New version string on the form: 7.1.0-1+11+g2b25294

This commit is contained in:
Olof hagsand 2024-10-18 17:25:47 +02:00
parent 3cad374f33
commit 0a37cf31ab
15 changed files with 66 additions and 25 deletions

View file

@ -43,6 +43,7 @@ Expected: October 2024
Users may have to change how they access the system Users may have to change how they access the system
* New version string on the form: `7.1.0-1+11+g2b25294`
* Restconf: Better RFC compliance with Accept errors: 406 vs 415 * Restconf: Better RFC compliance with Accept errors: 406 vs 415
* Removed YANG line-number in error-messages for memory optimization * Removed YANG line-number in error-messages for memory optimization
* Re-enable by setting `YANG_SPEC_LINENR` compile-time option * Re-enable by setting `YANG_SPEC_LINENR` compile-time option

View file

@ -561,7 +561,7 @@ main(int argc,
help = 1; help = 1;
break; break;
case 'V': case 'V':
cligen_output(stdout, "Clixon version: %s\n", CLIXON_GITHASH); cligen_output(stdout, "Clixon version: %s\n", CLIXON_VERSION);
print_version++; /* plugins may also print versions w ca-version callback */ print_version++; /* plugins may also print versions w ca-version callback */
break; break;
case 'D' : /* debug */ case 'D' : /* debug */

View file

@ -616,7 +616,7 @@ main(int argc,
help = 1; help = 1;
break; break;
case 'V': /* version */ case 'V': /* version */
cligen_output(stdout, "Clixon version: %s\n", CLIXON_GITHASH); cligen_output(stdout, "Clixon version: %s\n", CLIXON_VERSION);
print_version++; /* plugins may also print versions w ca-version callback */ print_version++; /* plugins may also print versions w ca-version callback */
break; break;
case 'D' : /* debug, if set here overrides option CLICON_DEBUG */ case 'D' : /* debug, if set here overrides option CLICON_DEBUG */

View file

@ -994,7 +994,7 @@ cli_show_version(clixon_handle h,
cvec *cvv, cvec *cvv,
cvec *argv) cvec *argv)
{ {
cligen_output(stdout, "Clixon: %s\n", CLIXON_GITHASH); cligen_output(stdout, "Clixon: %s\n", CLIXON_VERSION);
cligen_output(stdout, "CLIgen: %s\n", CLIGEN_VERSION); cligen_output(stdout, "CLIgen: %s\n", CLIGEN_VERSION);
return 0; return 0;
} }

View file

@ -707,7 +707,7 @@ main(int argc,
usage(h, argv[0]); usage(h, argv[0]);
break; break;
case 'V': /* version */ case 'V': /* version */
cligen_output(stdout, "Clixon version: %s\n", CLIXON_GITHASH); cligen_output(stdout, "Clixon version: %s\n", CLIXON_VERSION);
print_version++; /* plugins may also print versions w ca-version callback */ print_version++; /* plugins may also print versions w ca-version callback */
break; break;
case 'D' : /* debug */ case 'D' : /* debug */

View file

@ -348,7 +348,7 @@ main(int argc,
usage(h, argv[0]); usage(h, argv[0]);
break; break;
case 'V': case 'V':
cligen_output(stdout, "Clixon version: %s\n", CLIXON_GITHASH); cligen_output(stdout, "Clixon version: %s\n", CLIXON_VERSION);
print_version++; /* plugins may also print versions w ca-version callback */ print_version++; /* plugins may also print versions w ca-version callback */
break; break;
case 'D' : { /* debug */ case 'D' : { /* debug */

View file

@ -1189,7 +1189,7 @@ main(int argc,
usage(h, argv0); usage(h, argv0);
break; break;
case 'V': /* version */ case 'V': /* version */
cligen_output(stdout, "Clixon version: %s\n", CLIXON_GITHASH); cligen_output(stdout, "Clixon version: %s\n", CLIXON_VERSION);
print_version++; /* plugins may also print versions w ca-version callback */ print_version++; /* plugins may also print versions w ca-version callback */
break; break;
case 'D' : /* debug. Note this overrides any setting in the config */ case 'D' : /* debug. Note this overrides any setting in the config */

View file

@ -381,7 +381,7 @@ main(int argc,
usage(h, argv[0]); usage(h, argv[0]);
break; break;
case 'V': /* version */ case 'V': /* version */
cligen_output(stdout, "Clixon version: %s\n", CLIXON_GITHASH); cligen_output(stdout, "Clixon version: %s\n", CLIXON_VERSION);
print_version++; /* plugins may also print versions w ca-version callback */ print_version++; /* plugins may also print versions w ca-version callback */
break; break;
case 'D' : { /* debug */ case 'D' : { /* debug */

19
configure vendored
View file

@ -2813,10 +2813,11 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
# Use GIT version (what if no git?) # Use GIT version (what if no git?)
CLIXON_VERSION="$(git log --pretty="format:%(describe) %ci" -n1)" CLIXON_VERSION="$(./scripts/version.sh)"
CLIXON_VERSION_MAJOR="7" CLIXON_VERSION2=$(echo ${CLIXON_VERSION} | awk -F- '{print $1}')
CLIXON_VERSION_MINOR="1" CLIXON_VERSION_MAJOR=$(echo ${CLIXON_VERSION2} | awk -F. '{print $1}')
CLIXON_VERSION_PATCH="0" CLIXON_VERSION_MINOR=$(echo ${CLIXON_VERSION2} | awk -F. '{print $2}')
CLIXON_VERSION_PATCH=$(echo ${CLIXON_VERSION2} | awk -F. '{print $3}')
# Debug flag # Debug flag
# Check whether --enable-debug was given. # Check whether --enable-debug was given.
@ -5304,11 +5305,11 @@ if test x$ac_prog_cxx_stdcxx = xno
then : then :
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++11 features" >&5 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++11 features" >&5
printf %s "checking for $CXX option to enable C++11 features... " >&6; } printf %s "checking for $CXX option to enable C++11 features... " >&6; }
if test ${ac_cv_prog_cxx_11+y} if test ${ac_cv_prog_cxx_cxx11+y}
then : then :
printf %s "(cached) " >&6 printf %s "(cached) " >&6
else $as_nop else $as_nop
ac_cv_prog_cxx_11=no ac_cv_prog_cxx_cxx11=no
ac_save_CXX=$CXX ac_save_CXX=$CXX
cat confdefs.h - <<_ACEOF >conftest.$ac_ext cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */ /* end confdefs.h. */
@ -5350,11 +5351,11 @@ if test x$ac_prog_cxx_stdcxx = xno
then : then :
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++98 features" >&5 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++98 features" >&5
printf %s "checking for $CXX option to enable C++98 features... " >&6; } printf %s "checking for $CXX option to enable C++98 features... " >&6; }
if test ${ac_cv_prog_cxx_98+y} if test ${ac_cv_prog_cxx_cxx98+y}
then : then :
printf %s "(cached) " >&6 printf %s "(cached) " >&6
else $as_nop else $as_nop
ac_cv_prog_cxx_98=no ac_cv_prog_cxx_cxx98=no
ac_save_CXX=$CXX ac_save_CXX=$CXX
cat confdefs.h - <<_ACEOF >conftest.$ac_ext cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */ /* end confdefs.h. */
@ -6549,7 +6550,7 @@ printf "%s\n" "Generated YANGs from MIB files are expected to be in ${MIB_GENERA
fi fi
# Set default config file location # Set default config file location
CLIXON_DEFAULT_CONFIG=/usr/local/etc/clixon.xml CLIXON_DEFAULT_CONFIG=${SYSCONFDIR}/clixon.xml
# Check whether --with-configfile was given. # Check whether --with-configfile was given.
if test ${with_configfile+y} if test ${with_configfile+y}

View file

@ -49,10 +49,11 @@ AC_CONFIG_SRCDIR([lib/clixon/clixon.h.in])
AC_CONFIG_AUX_DIR(config-aux) AC_CONFIG_AUX_DIR(config-aux)
# Use GIT version (what if no git?) # Use GIT version (what if no git?)
CLIXON_VERSION="$(git log --pretty="format:%(describe) %ci" -n1)" CLIXON_VERSION="$(./scripts/version.sh)"
CLIXON_VERSION_MAJOR="7" CLIXON_VERSION2=$(echo ${CLIXON_VERSION} | awk -F- '{print $1}')
CLIXON_VERSION_MINOR="1" CLIXON_VERSION_MAJOR=$(echo ${CLIXON_VERSION2} | awk -F. '{print $1}')
CLIXON_VERSION_PATCH="0" CLIXON_VERSION_MINOR=$(echo ${CLIXON_VERSION2} | awk -F. '{print $2}')
CLIXON_VERSION_PATCH=$(echo ${CLIXON_VERSION2} | awk -F. '{print $3}')
# Debug flag # Debug flag
AC_ARG_ENABLE(debug, AS_HELP_STRING([--enable-debug],[Build with debug symbols, default: no]),[ AC_ARG_ENABLE(debug, AS_HELP_STRING([--enable-debug],[Build with debug symbols, default: no]),[

View file

@ -358,7 +358,7 @@ example_cli_errmsg(clixon_handle h,
* *
* A plugin can customize a version (or banner) output on stdout. * A plugin can customize a version (or banner) output on stdout.
* Several version strings can be printed if there are multiple callbacks. * Several version strings can be printed if there are multiple callbacks.
* If no registered plugins exist, clixon prints CLIXON_GITHASH * If no registered plugins exist, clixon prints CLIXON_VERSION
* Typically invoked by command-line option -V * Typically invoked by command-line option -V
* @param[in] h Clixon handle * @param[in] h Clixon handle
* @param[in] f Output file * @param[in] f Output file

View file

@ -60,7 +60,6 @@ extern "C" {
/* /*
* CLIXON version macros, set in configure and resolved when expanding to * CLIXON version macros, set in configure and resolved when expanding to
* clixon.h * clixon.h
* XXX: use github versioning: CLIXON_GITHASH[] instead
*/ */
#undef CLIXON_VERSION_MAJOR #undef CLIXON_VERSION_MAJOR
#undef CLIXON_VERSION_MINOR #undef CLIXON_VERSION_MINOR
@ -123,7 +122,6 @@ extern "C" {
* Global variables generated by Makefile * Global variables generated by Makefile
*/ */
extern const char CLIXON_BUILDSTR[]; extern const char CLIXON_BUILDSTR[];
extern const char CLIXON_GITHASH[];
extern const char CLIXON_VERSION[]; extern const char CLIXON_VERSION[];
#ifdef __cplusplus #ifdef __cplusplus

View file

@ -340,7 +340,7 @@ typedef int (errmsg_t)(clixon_handle h, const char *fn, const int line,
* *
* A plugin can customize a version (or banner) output on stdout. * A plugin can customize a version (or banner) output on stdout.
* Several version strings can be printed if there are multiple callbacks. * Several version strings can be printed if there are multiple callbacks.
* If no registered plugins exist, clixon prints CLIXON_GITHASH * If no registered plugins exist, clixon prints CLIXON_VERSION
* Typically invoked by command-line option -V * Typically invoked by command-line option -V
* @param[in] h Clixon handle * @param[in] h Clixon handle
* @param[in] f Output file * @param[in] f Output file

View file

@ -299,7 +299,6 @@ DATELEN = $(shell date +"%Y.%m.%d %H:%M by `whoami` on `hostname`XXXX"|wc -c)
build.c: build.c:
echo "/* This file is generated from the Clixon Makefile */" > $@; echo "/* This file is generated from the Clixon Makefile */" > $@;
date +"const char CLIXON_BUILDSTR[$(DATELEN)]=\"%Y.%m.%d %H:%M by `whoami` on `hostname`"\"\; >> $@; date +"const char CLIXON_BUILDSTR[$(DATELEN)]=\"%Y.%m.%d %H:%M by `whoami` on `hostname`"\"\; >> $@;
echo "const char CLIXON_GITHASH[64]=\"$(shell git log --pretty="format:%(describe) %ci" -n1)\""\; >> $@;
echo "const char CLIXON_VERSION[64]=\"$(CLIXON_VERSION)\""\; >> $@; echo "const char CLIXON_VERSION[64]=\"$(CLIXON_VERSION)\""\; >> $@;
# Note: will always be remade since GENOBS is date dependent # Note: will always be remade since GENOBS is date dependent

41
scripts/version.sh Executable file
View file

@ -0,0 +1,41 @@
#!/usr/bin/env bash
# Version script
# Usage:
# ./version.sh
# with optional fields:
# PREFIX= INDEX=1 ARCH= SUFFIX=
# Example:
# PREFIX=cligen INDEX=1 ARCH=amd64 SUFFIX=deb ./version.sh
set -eu
: ${PREFIX:=}
: ${INDEX=1}
: ${ARCH=}
: ${SUFFIX=}
# Get version string from default git describe: <tag>-<nr>-g<hash>
if [ -f .version ]; then
v1=$(cat .version)
else
v1=$(git describe)
fi
if [ -z $v1 ]; then
echo "No base version"
exit 1
fi
TAG=$(echo $v1 | awk -F- '{print $1}')
NR=$(echo $v1 | awk -F- '{print $2}')
HASH=$(echo $v1 | awk -F- '{print $3}')
V=""
if [ -n "$PREFIX" ]; then
V="${V}${PREFIX}_"
fi
V="${V}${TAG}"
V="${V}-${INDEX}"
V="${V}+${NR}"
V="${V}+${HASH}"
if [ -n "$ARCH" ]; then
V="${V}_${ARCH}"
fi
if [ -n "$SUFFIX" ]; then
V="${V}.${SUFFIX}"
fi
echo "${V}"