diff --git a/CHANGELOG.md b/CHANGELOG.md index 2643a08c..9da45a11 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,7 @@ Expected: June 2024 ### API changes on existing protocol/config features Users may have to change how they access the system +* Changed intermediate version numbers to be git-style, eg `7.0.0-39` instead of `7.1.0-PRE` * If `CLICON_XMLDB_MULTI` is set, datastores are stored in a new directory * Previously: `CLICON_XMLDB_DIR/_db` * New: `CLICON_XMLDB_DIR/d/` diff --git a/apps/backend/backend_main.c b/apps/backend/backend_main.c index 050cb431..27fef31a 100644 --- a/apps/backend/backend_main.c +++ b/apps/backend/backend_main.c @@ -569,7 +569,7 @@ main(int argc, help = 1; break; case 'V': - cligen_output(stdout, "Clixon version: %s\n", CLIXON_VERSION_STRING); + cligen_output(stdout, "Clixon version: %s\n", CLIXON_GITHASH); print_version++; /* plugins may also print versions w ca-version callback */ break; case 'D' : { /* debug */ diff --git a/apps/cli/cli_main.c b/apps/cli/cli_main.c index 235fefe6..584b2649 100644 --- a/apps/cli/cli_main.c +++ b/apps/cli/cli_main.c @@ -618,7 +618,7 @@ main(int argc, help = 1; break; case 'V': /* version */ - cligen_output(stdout, "Clixon version: %s\n", CLIXON_VERSION_STRING); + cligen_output(stdout, "Clixon version: %s\n", CLIXON_GITHASH); print_version++; /* plugins may also print versions w ca-version callback */ break; case 'D' : { /* debug */ diff --git a/apps/cli/cli_show.c b/apps/cli/cli_show.c index e22bb939..1460654b 100644 --- a/apps/cli/cli_show.c +++ b/apps/cli/cli_show.c @@ -992,7 +992,7 @@ cli_show_version(clixon_handle h, cvec *cvv, cvec *argv) { - cligen_output(stdout, "Clixon: %s\n", CLIXON_VERSION_STRING); + cligen_output(stdout, "Clixon: %s\n", CLIXON_GITHASH); cligen_output(stdout, "CLIgen: %s\n", CLIGEN_VERSION); return 0; } diff --git a/apps/netconf/netconf_main.c b/apps/netconf/netconf_main.c index 556a272a..b33a27c0 100644 --- a/apps/netconf/netconf_main.c +++ b/apps/netconf/netconf_main.c @@ -709,7 +709,7 @@ main(int argc, usage(h, argv[0]); break; case 'V': /* version */ - cligen_output(stdout, "Clixon version: %s\n", CLIXON_VERSION_STRING); + cligen_output(stdout, "Clixon version: %s\n", CLIXON_GITHASH); print_version++; /* plugins may also print versions w ca-version callback */ break; case 'D' : { /* debug */ diff --git a/apps/restconf/restconf_main_fcgi.c b/apps/restconf/restconf_main_fcgi.c index 5268b236..878e54e7 100644 --- a/apps/restconf/restconf_main_fcgi.c +++ b/apps/restconf/restconf_main_fcgi.c @@ -345,7 +345,7 @@ main(int argc, usage(h, argv[0]); break; case 'V': - cligen_output(stdout, "Clixon version: %s\n", CLIXON_VERSION_STRING); + cligen_output(stdout, "Clixon version: %s\n", CLIXON_GITHASH); print_version++; /* plugins may also print versions w ca-version callback */ break; case 'D' : { /* debug */ diff --git a/apps/restconf/restconf_main_native.c b/apps/restconf/restconf_main_native.c index 3b11113a..9bd4af3d 100644 --- a/apps/restconf/restconf_main_native.c +++ b/apps/restconf/restconf_main_native.c @@ -1176,7 +1176,7 @@ main(int argc, usage(h, argv0); break; case 'V': /* version */ - cligen_output(stdout, "Clixon version: %s\n", CLIXON_VERSION_STRING); + cligen_output(stdout, "Clixon version: %s\n", CLIXON_GITHASH); print_version++; /* plugins may also print versions w ca-version callback */ break; case 'D' : { /* debug. Note this overrides any setting in the config */ diff --git a/apps/snmp/snmp_main.c b/apps/snmp/snmp_main.c index 93fd6cb6..94a5ce4f 100644 --- a/apps/snmp/snmp_main.c +++ b/apps/snmp/snmp_main.c @@ -382,7 +382,7 @@ main(int argc, usage(h, argv[0]); break; case 'V': /* version */ - cligen_output(stdout, "Clixon version: %s\n", CLIXON_VERSION_STRING); + cligen_output(stdout, "Clixon version: %s\n", CLIXON_GITHASH); print_version++; /* plugins may also print versions w ca-version callback */ break; case 'D' : { /* debug */ diff --git a/configure b/configure index e0d6c478..59b7b31d 100755 --- a/configure +++ b/configure @@ -696,7 +696,6 @@ INSTALL_PROGRAM INCLUDES CLIXON_VERSION_MINOR CLIXON_VERSION_MAJOR -CLIXON_VERSION_STRING CLIXON_VERSION target_os target_vendor @@ -2846,9 +2845,6 @@ ac_config_headers="$ac_config_headers include/clixon_config.h lib/clixon/clixon. -printf "%s\n" "#define CLIXON_VERSION_STRING $CLIXON_VERSION" >>confdefs.h - - printf "%s\n" "#define CLIXON_VERSION_MAJOR $CLIXON_VERSION_MAJOR" >>confdefs.h @@ -4014,8 +4010,7 @@ test -n "$target_alias" && program_prefix=${target_alias}- # AC_SUBST(var) makes @var@ appear in makefiles. -# clixon versions spread to Makefile's (.so files) and variable in build.c - +# Clixon versions is used in Makefile's (.so files) and variable in build.c diff --git a/configure.ac b/configure.ac index 0fda29d9..53a4c84b 100644 --- a/configure.ac +++ b/configure.ac @@ -73,7 +73,6 @@ fi AC_CONFIG_HEADERS([include/clixon_config.h lib/clixon/clixon.h]) -AC_DEFINE_UNQUOTED(CLIXON_VERSION_STRING, $CLIXON_VERSION, [Clixon version string]) AC_DEFINE_UNQUOTED(CLIXON_VERSION_MAJOR, $CLIXON_VERSION_MAJOR, [Clixon major release]) AC_DEFINE_UNQUOTED(CLIXON_VERSION_MINOR, $CLIXON_VERSION_MINOR, [Clixon minor release]) AC_DEFINE_UNQUOTED(CLIXON_VERSION_PATCH, $CLIXON_VERSION_PATCH, [Clixon path version]) @@ -84,9 +83,8 @@ AC_CHECK_LIB(m, main) AC_CANONICAL_TARGET # AC_SUBST(var) makes @var@ appear in makefiles. -# clixon versions spread to Makefile's (.so files) and variable in build.c +# Clixon versions is used in Makefile's (.so files) and variable in build.c AC_SUBST(CLIXON_VERSION) -AC_SUBST(CLIXON_VERSION_STRING) AC_SUBST(CLIXON_VERSION_MAJOR) AC_SUBST(CLIXON_VERSION_MINOR) diff --git a/example/main/example_cli.c b/example/main/example_cli.c index 3b5134ac..e20a7b35 100644 --- a/example/main/example_cli.c +++ b/example/main/example_cli.c @@ -356,7 +356,7 @@ example_cli_errmsg(clixon_handle h, * * A plugin can customize a version (or banner) output on stdout. * Several version strings can be printed if there are multiple callbacks. - * If not regstered plugins exist, clixon prints CLIXON_VERSION_STRING + * If no registered plugins exist, clixon prints CLIXON_GITHASH * Typically invoked by command-line option -V * @param[in] h Clixon handle * @param[in] f Output file diff --git a/include/clixon_config.h.in b/include/clixon_config.h.in index bc265017..3fc0b830 100644 --- a/include/clixon_config.h.in +++ b/include/clixon_config.h.in @@ -30,9 +30,6 @@ /* Clixon path version */ #undef CLIXON_VERSION_PATCH -/* Clixon version string */ -#undef CLIXON_VERSION_STRING - /* Enable YANG patch, RFC 8072 */ #undef CLIXON_YANG_PATCH diff --git a/lib/clixon/clixon.h.in b/lib/clixon/clixon.h.in index daf621be..ae522cd1 100644 --- a/lib/clixon/clixon.h.in +++ b/lib/clixon/clixon.h.in @@ -60,8 +60,8 @@ extern "C" { /* * CLIXON version macros, set in configure and resolved when expanding to * clixon.h + * XXX: use github versioning: CLIXON_GITHASH[] instead */ -#undef CLIXON_VERSION_STRING #undef CLIXON_VERSION_MAJOR #undef CLIXON_VERSION_MINOR #undef CLIXON_VERSION_PATCH @@ -122,6 +122,7 @@ extern "C" { * Global variables generated by Makefile */ extern const char CLIXON_BUILDSTR[]; +extern const char CLIXON_GITHASH[]; extern const char CLIXON_VERSION[]; #ifdef __cplusplus diff --git a/lib/clixon/clixon_plugin.h b/lib/clixon/clixon_plugin.h index 88207369..6ee15132 100644 --- a/lib/clixon/clixon_plugin.h +++ b/lib/clixon/clixon_plugin.h @@ -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. * Several version strings can be printed if there are multiple callbacks. - * If not registered plugins exist, clixon prints CLIXON_VERSION_STRING + * If no registered plugins exist, clixon prints CLIXON_GITHASH * Typically invoked by command-line option -V * @param[in] h Clixon handle * @param[in] f Output file diff --git a/lib/src/Makefile.in b/lib/src/Makefile.in index 62abf160..a68b1de9 100644 --- a/lib/src/Makefile.in +++ b/lib/src/Makefile.in @@ -299,6 +299,7 @@ DATELEN = $(shell date +"%Y.%m.%d %H:%M by `whoami` on `hostname`XXXX"|wc -c) build.c: echo "/* This file is generated from the Clixon Makefile */" > $@; 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)\""\; >> $@; # Note: will always be remade since GENOBS is date dependent diff --git a/test/config.sh.in b/test/config.sh.in index 784ffd1c..77f9c9f2 100755 --- a/test/config.sh.in +++ b/test/config.sh.in @@ -64,9 +64,6 @@ CC=@CC@ # Top src dir TOP_SRCDIR=@top_srcdir@ -# Clixon version -CLIXON_VERSION=@CLIXON_VERSION@ - CLICON_USER=@CLICON_USER@ CLICON_GROUP=@CLICON_GROUP@ diff --git a/test/lib.sh b/test/lib.sh index 7e68a5c7..a5d861b3 100755 --- a/test/lib.sh +++ b/test/lib.sh @@ -41,6 +41,9 @@ if [ -f ./config.sh ]; then fi fi +# Note that this relies on git being present in shell +CLIXON_VERSION="$(git log --pretty="format:%(describe) %ci" -n1)" + # Test number from start : ${testnr:=0}