From: Arran Cudbard-Bell Date: Thu, 17 Nov 2022 17:30:05 +0000 (-0600) Subject: Update versioning scheme to use commit depth for incrimental component X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4baa5dd876cdc466264b886bae8e9536f8a1e8cf;p=thirdparty%2Ffreeradius-server.git Update versioning scheme to use commit depth for incrimental component --- diff --git a/Make.inc.in b/Make.inc.in index 08fae4f584d..80419312340 100644 --- a/Make.inc.in +++ b/Make.inc.in @@ -144,7 +144,7 @@ endif # # Version to use for packaging and other Make related things # -RADIUSD_VERSION_STRING = @RADIUSD_VERSION_STRING@ +RADIUSD_VERSION = @RADIUSD_VERSION@ # # This allows dlopen to do runtime checks for version mismatches diff --git a/Makefile b/Makefile index 9306d5398a3..4dd9c459782 100644 --- a/Makefile +++ b/Makefile @@ -55,14 +55,9 @@ endif # 'configure' was not run? Get the version number from the file. # ifeq "$(RADIUS_VERSION_STRING)" "" - RADIUSD_VERSION_STRING := $(shell cat VERSION) -endif - -ifeq "$(RADIUS_VERSION_RELEASE)" "" - RADIUSD_VERSION_RELEASE := $(shell git status > /dev/null 2>&1 && git describe | cut -d '-' -f 2) - RADIUSD_PACKAGE_VERSION := $(RADIUSD_VERSION_STRING)+git$(RADIUSD_VERSION_RELEASE) + RADIUSD_VERSION := $(shell cat VERSION | cut -d '.' -f 1,2).$(shell (git status > /dev/null 2>&1 || (echo '0' && false)) && git describe | cut -d '-' -f 2) else - RADIUSD_PACKAGE_VERSION := $(RADIUSD_VERSION_STRING) + RADIUSD_VERSION := $(shell cat VERSION) endif MFLAGS += --no-print-directory @@ -377,27 +372,27 @@ certs: ###################################################################### BRANCH = $(shell git rev-parse --abbrev-ref HEAD) -.PHONY: freeradius-server-$(RADIUSD_VERSION_STRING).tar +.PHONY: freeradius-server-$(RADIUSD_VERSION).tar # This can't depend on .git/ (dirs don't work) or .git/HEAD (not present in submodules) # so it's just left as a phony target. -freeradius-server-$(RADIUSD_VERSION_STRING).tar: - rm -rf $(top_srcdir)/$(BUILD_DIR)/freeradius-server-$(RADIUSD_VERSION_STRING) +freeradius-server-$(RADIUSD_VERSION).tar: + rm -rf $(top_srcdir)/$(BUILD_DIR)/freeradius-server-$(RADIUSD_VERSION) mkdir -p $(top_srcdir)/$(BUILD_DIR) - git archive --format=tar --prefix=freeradius-server-$(RADIUSD_VERSION_STRING)/ $(BRANCH) | tar -C $(top_srcdir)/$(BUILD_DIR) -xf - - git submodule foreach --recursive 'git archive --format=tar --prefix=freeradius-server-$(RADIUSD_VERSION_STRING)/$$sm_path/ $$sha1 | tar -C $(top_srcdir)/$(BUILD_DIR) -xf -' + git archive --format=tar --prefix=freeradius-server-$(RADIUSD_VERSION)/ $(BRANCH) | tar -C $(top_srcdir)/$(BUILD_DIR) -xf - + git submodule foreach --recursive 'git archive --format=tar --prefix=freeradius-server-$(RADIUSD_VERSION)/$$sm_path/ $$sha1 | tar -C $(top_srcdir)/$(BUILD_DIR) -xf -' ifneq "$(EXT_MODULES)" "" for x in $(subst _ext,,$(EXT_MODULES)); do \ cd $(top_srcdir)/$${x}_ext && \ - git archive --format=tar --prefix=freeradius-server-$(RADIUSD_VERSION_STRING)/$$x/ $(BRANCH) | tar -C $(top_srcdir)/$(BUILD_DIR) -xf -; \ + git archive --format=tar --prefix=freeradius-server-$(RADIUSD_VERSION)/$$x/ $(BRANCH) | tar -C $(top_srcdir)/$(BUILD_DIR) -xf -; \ done endif - tar -cf $@ -C $(top_srcdir)/$(BUILD_DIR) freeradius-server-$(RADIUSD_VERSION_STRING) + tar -cf $@ -C $(top_srcdir)/$(BUILD_DIR) freeradius-server-$(RADIUSD_VERSION) -freeradius-server-$(RADIUSD_VERSION_STRING).tar.gz: freeradius-server-$(RADIUSD_VERSION_STRING).tar +freeradius-server-$(RADIUSD_VERSION).tar.gz: freeradius-server-$(RADIUSD_VERSION).tar gzip < $^ > $@ -freeradius-server-$(RADIUSD_VERSION_STRING).tar.bz2: freeradius-server-$(RADIUSD_VERSION_STRING).tar +freeradius-server-$(RADIUSD_VERSION).tar.bz2: freeradius-server-$(RADIUSD_VERSION).tar bzip2 < $^ > $@ %.sig: % @@ -406,28 +401,28 @@ freeradius-server-$(RADIUSD_VERSION_STRING).tar.bz2: freeradius-server-$(RADIUSD # high-level targets .PHONY: dist-check dist-check: redhat/freeradius.spec suse/freeradius.spec debian/changelog - @if [ `grep ^Version: redhat/freeradius.spec | sed 's/.*://;s/ //'` != "$(RADIUSD_VERSION_STRING)" ]; then \ - cat redhat/freeradius.spec | sed 's/^Version: .*/Version: $(RADIUSD_VERSION_STRING)/' > redhat/.foo; \ + @if [ `grep ^Version: redhat/freeradius.spec | sed 's/.*://;s/ //'` != "$(RADIUSD_VERSION)" ]; then \ + cat redhat/freeradius.spec | sed 's/^Version: .*/Version: $(RADIUSD_VERSION)/' > redhat/.foo; \ mv redhat/.foo redhat/freeradius.spec; \ echo redhat/freeradius.spec 'Version' needs to be updated; \ exit 1; \ fi - @if [ `grep ^Version: suse/freeradius.spec | sed 's/.*://;s/ //'` != "$(RADIUSD_VERSION_STRING)" ]; then \ - cat suse/freeradius.spec | sed 's/^Version: .*/Version: $(RADIUSD_VERSION_STRING)/' > suse/.foo; \ + @if [ `grep ^Version: suse/freeradius.spec | sed 's/.*://;s/ //'` != "$(RADIUSD_VERSION)" ]; then \ + cat suse/freeradius.spec | sed 's/^Version: .*/Version: $(RADIUSD_VERSION)/' > suse/.foo; \ mv suse/.foo suse/freeradius.spec; \ echo suse/freeradius.spec 'Version' needs to be updated; \ exit 1; \ fi - @if [ `head -n 1 debian/changelog | sed 's/.*(//;s/-0).*//;s/-1).*//;s/\+.*//'` != "$(RADIUSD_VERSION_STRING)" ]; then \ + @if [ `head -n 1 debian/changelog | sed 's/.*(//;s/-0).*//;s/-1).*//;s/\+.*//'` != "$(RADIUSD_VERSION)" ]; then \ echo debian/changelog needs to be updated; \ exit 1; \ fi -dist: dist-check freeradius-server-$(RADIUSD_VERSION_STRING).tar.gz freeradius-server-$(RADIUSD_VERSION_STRING).tar.bz2 +dist: dist-check freeradius-server-$(RADIUSD_VERSION).tar.gz freeradius-server-$(RADIUSD_VERSION).tar.bz2 -dist-sign: freeradius-server-$(RADIUSD_VERSION_STRING).tar.gz.sig freeradius-server-$(RADIUSD_VERSION_STRING).tar.bz2.sig +dist-sign: freeradius-server-$(RADIUSD_VERSION).tar.gz.sig freeradius-server-$(RADIUSD_VERSION).tar.bz2.sig -dist-publish: freeradius-server-$(RADIUSD_VERSION_STRING).tar.gz.sig freeradius-server-$(RADIUSD_VERSION_STRING).tar.gz freeradius-server-$(RADIUSD_VERSION_STRING).tar.gz.sig freeradius-server-$(RADIUSD_VERSION_STRING).tar.bz2 freeradius-server-$(RADIUSD_VERSION_STRING).tar.gz.sig freeradius-server-$(RADIUSD_VERSION_STRING).tar.bz2.sig +dist-publish: freeradius-server-$(RADIUSD_VERSION).tar.gz.sig freeradius-server-$(RADIUSD_VERSION).tar.gz freeradius-server-$(RADIUSD_VERSION).tar.gz.sig freeradius-server-$(RADIUSD_VERSION).tar.bz2 freeradius-server-$(RADIUSD_VERSION).tar.gz.sig freeradius-server-$(RADIUSD_VERSION).tar.bz2.sig scp $^ freeradius.org@ns5.freeradius.org:public_ftp scp $^ freeradius.org@www.tr.freeradius.org:public_ftp @@ -435,8 +430,8 @@ dist-publish: freeradius-server-$(RADIUSD_VERSION_STRING).tar.gz.sig freeradius- # Note that we do NOT do the tagging here! We just print out what # to do! # -dist-tag: freeradius-server-$(RADIUSD_VERSION_STRING).tar.gz freeradius-server-$(RADIUSD_VERSION_STRING).tar.bz2 - @echo "git tag release_`echo $(RADIUSD_VERSION_STRING) | tr .- __`" +dist-tag: freeradius-server-$(RADIUSD_VERSION).tar.gz freeradius-server-$(RADIUSD_VERSION).tar.bz2 + @echo "git tag release_`echo $(RADIUSD_VERSION) | tr .- __`" # # Build a debian package @@ -452,15 +447,15 @@ deb: exit 1; \ fi fakeroot debian/rules debian/control #clean - fakeroot dpkg-buildpackage -b -uc -v$(RADIUSD_PACKAGE_VERSION) + fakeroot dpkg-buildpackage -b -uc -v$(RADIUSD_VERSION) .PHONY: rpm -rpmbuild/SOURCES/freeradius-server-$(RADIUSD_VERSION_STRING).tar.bz2: freeradius-server-$(RADIUSD_VERSION_STRING).tar.bz2 +rpmbuild/SOURCES/freeradius-server-$(RADIUSD_VERSION).tar.bz2: freeradius-server-$(RADIUSD_VERSION).tar.bz2 @mkdir -p $(addprefix rpmbuild/,SOURCES SPECS BUILD RPMS SRPMS BUILDROOT) @for file in `awk '/^Source...:/ {print $$2}' redhat/freeradius.spec` ; do cp redhat/$$file rpmbuild/SOURCES/$$file ; done @cp $< $@ -rpm: rpmbuild/SOURCES/freeradius-server-$(RADIUSD_VERSION_STRING).tar.bz2 +rpm: rpmbuild/SOURCES/freeradius-server-$(RADIUSD_VERSION).tar.bz2 @if ! $(SUDO) yum-builddep -q -C --assumeno redhat/freeradius.spec 1> rpmbuild/builddep.log 2>&1; then \ echo "ERROR: Required dependencies not found, install them with: yum-builddep redhat/freeradius.spec"; \ cat rpmbuild/builddep.log; \ diff --git a/VERSION b/VERSION index fcdb2e109f6..5186d07068c 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -4.0.0 +4.0 diff --git a/configure b/configure index 4eddbd39b8e..dd0b2ac5242 100755 --- a/configure +++ b/configure @@ -733,7 +733,6 @@ PANDOC_ENGINE PANDOC ASCIIDOCTOR GIT -RADIUSD_VERSION_STRING target_alias host_alias build_alias @@ -2819,7 +2818,7 @@ ac_config_headers="$ac_config_headers src/include/autoconf.h" RADIUSD_VERSION_MAJOR=`cat VERSION | cut -f1 -d.` RADIUSD_VERSION_MINOR=`cat VERSION | cut -f2 -d.` -RADIUSD_VERSION_INCRM=`cat VERSION | cut -f3 -d. | sed 's/[\.-].*$//'` +RADIUSD_VERSION_INCRM=`(git status > /dev/null 2>&1 || (echo '0' && false)) && git describe | cut -d '-' -f 2` { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking build version" >&5 printf %s "checking build version... " >&6; } @@ -2827,19 +2826,17 @@ RADIUSD_VERSION=`printf "%02i%02i%02i" $RADIUSD_VERSION_MAJOR $RADIUSD_VERSION_M { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $RADIUSD_VERSION" >&5 printf "%s\n" "$RADIUSD_VERSION" >&6; } -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking build version string" >&5 -printf %s "checking build version string... " >&6; } -RADIUSD_VERSION_STRING=`cat VERSION` -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $RADIUSD_VERSION_STRING" >&5 -printf "%s\n" "$RADIUSD_VERSION_STRING" >&6; } +printf "%s\n" "#define RADIUSD_VERSION ${RADIUSD_VERSION}" >>confdefs.h +printf "%s\n" "#define RADIUSD_VERSION_MAJOR ${RADIUSD_VERSION_MAJOR}" >>confdefs.h -printf "%s\n" "#define RADIUSD_VERSION ${RADIUSD_VERSION}" >>confdefs.h + +printf "%s\n" "#define RADIUSD_VERSION_MINOR ${RADIUSD_VERSION_MINOR}" >>confdefs.h -printf "%s\n" "#define RADIUSD_VERSION_STRING \"${RADIUSD_VERSION_STRING}\"" >>confdefs.h +printf "%s\n" "#define RADIUSD_VERSION_INCRM ${RADIUSD_VERSION_INCRM}" >>confdefs.h @@ -3252,14 +3249,6 @@ fi if test "x$GIT" = "xyes" && git status 2>&1 > /dev/null; then - if test "x$RADIUSD_VERSION_RELEASE" = "x"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking build release" >&5 -printf %s "checking build release... " >&6; } - RADIUSD_VERSION_RELEASE=`git describe | sed -e 's/^.*-\([0-9]*\)-g[0-9a-f]*/\1/'` - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $RADIUSD_VERSION_RELEASE" >&5 -printf "%s\n" "$RADIUSD_VERSION_RELEASE" >&6; } - fi - if test "x$RADIUSD_VERSION_COMMIT" = "x"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking build commit" >&5 printf %s "checking build commit... " >&6; } @@ -3275,12 +3264,6 @@ printf "%s\n" "$as_me: in git repository, enabling developer build implicitly, d fi fi -if test "x$RADIUSD_VERSION_RELEASE" != "x"; then - -printf "%s\n" "#define RADIUSD_VERSION_RELEASE ${RADIUSD_VERSION_RELEASE}" >>confdefs.h - -fi - if test "x$RADIUSD_VERSION_COMMIT" != "x"; then printf "%s\n" "#define RADIUSD_VERSION_COMMIT ${RADIUSD_VERSION_COMMIT}" >>confdefs.h diff --git a/configure.ac b/configure.ac index 598a6a6203c..bd7bd1bb34d 100644 --- a/configure.ac +++ b/configure.ac @@ -38,30 +38,20 @@ dnl ############################################################# RADIUSD_VERSION_MAJOR=`cat VERSION | cut -f1 -d.` RADIUSD_VERSION_MINOR=`cat VERSION | cut -f2 -d.` -RADIUSD_VERSION_INCRM=`cat VERSION | cut -f3 -d. | sed 's/[[\.-]].*$//'` +RADIUSD_VERSION_INCRM=`(git status > /dev/null 2>&1 || (echo '0' && false)) && git describe | cut -d '-' -f 2` AC_MSG_CHECKING([build version]) RADIUSD_VERSION=`printf "%02i%02i%02i" $RADIUSD_VERSION_MAJOR $RADIUSD_VERSION_MINOR $RADIUSD_VERSION_INCRM` AC_MSG_RESULT($RADIUSD_VERSION) -dnl # -dnl # Still useful for custom builds -dnl # -AC_MSG_CHECKING([build version string]) -RADIUSD_VERSION_STRING=`cat VERSION` -AC_MSG_RESULT($RADIUSD_VERSION_STRING) - -dnl # -dnl # Add definitions to Make.inc as it's used by various build targets -dnl # -AC_SUBST([RADIUSD_VERSION_STRING]) - dnl # dnl # Add definitions to autoconf.h, so that the headers that we install dnl # contain the version number of the server. dnl # -AC_DEFINE_UNQUOTED([RADIUSD_VERSION], [${RADIUSD_VERSION}], [Version integer in format ]) -AC_DEFINE_UNQUOTED([RADIUSD_VERSION_STRING], ["${RADIUSD_VERSION_STRING}"], [Raw version string from VERSION file]) +AC_DEFINE_UNQUOTED([RADIUSD_VERSION], [${RADIUSD_VERSION}], [Version integer in format ]) +AC_DEFINE_UNQUOTED([RADIUSD_VERSION_MAJOR], [${RADIUSD_VERSION_MAJOR}], [Version integer in format ]) +AC_DEFINE_UNQUOTED([RADIUSD_VERSION_MINOR], [${RADIUSD_VERSION_MINOR}], [Version integer in format ]) +AC_DEFINE_UNQUOTED([RADIUSD_VERSION_INCRM], [${RADIUSD_VERSION_INCRM}], [Version integer in format ]) dnl ############################################################# dnl # @@ -151,12 +141,6 @@ dnl # dnl # Turn on the developer flag when taken from a git checkout (not a release) dnl # if test "x$GIT" = "xyes" && git status 2>&1 > /dev/null; then - if test "x$RADIUSD_VERSION_RELEASE" = "x"; then - AC_MSG_CHECKING([build release]) - RADIUSD_VERSION_RELEASE=`git describe | cut -d '-' -f 2` - AC_MSG_RESULT($RADIUSD_VERSION_RELEASE) - fi - if test "x$RADIUSD_VERSION_COMMIT" = "x"; then AC_MSG_CHECKING([build commit]) RADIUSD_VERSION_COMMIT=`git rev-parse --short=8 HEAD` @@ -169,10 +153,6 @@ if test "x$GIT" = "xyes" && git status 2>&1 > /dev/null; then fi fi -if test "x$RADIUSD_VERSION_RELEASE" != "x"; then - AC_DEFINE_UNQUOTED([RADIUSD_VERSION_RELEASE],[${RADIUSD_VERSION_RELEASE}],[Version release number at time of configuring]) -fi - if test "x$RADIUSD_VERSION_COMMIT" != "x"; then AC_DEFINE_UNQUOTED([RADIUSD_VERSION_COMMIT],[${RADIUSD_VERSION_COMMIT}],[Commit HEAD at time of configuring]) fi diff --git a/doc/all.mk b/doc/all.mk index 59f398c55bf..e1063abd367 100644 --- a/doc/all.mk +++ b/doc/all.mk @@ -258,7 +258,7 @@ endif # file:// links and http:// links. # DOC_BASEDIR = $(subst $() $(),,$(foreach x,$(subst /, ,$1),../)) -DOC_UPDATED_LABEL = "FreeRADIUS ${RADIUSD_VERSION_STRING} - \#$(shell git rev-parse --short HEAD) - Last updated" +DOC_UPDATED_LABEL = "FreeRADIUS ${RADIUSD_VERSION} - \#$(shell git rev-parse --short HEAD) - Last updated" doc/%.html: doc/%.adoc @echo HTML $^ diff --git a/scripts/jenkins/Jenkinsfile.defs b/scripts/jenkins/Jenkinsfile.defs index 235b3977215..109c0bcf318 100644 --- a/scripts/jenkins/Jenkinsfile.defs +++ b/scripts/jenkins/Jenkinsfile.defs @@ -111,7 +111,7 @@ def buildClosures(args) { if (platform.contains("centos")) { sh 'sed -i -e "s/^Version:.*$/Version: ' + version + '/" redhat/freeradius.spec' sh 'sed -i -e "s/^Release:.*$/Release: ' + release + '/" redhat/freeradius.spec' - sh 'make RADIUSD_VERSION_STRING="' + version + '" rpm' + sh 'make RADIUSD_VERSION="' + version + '" rpm' } else { sh "apt-get install -y unixodbc-dev" diff --git a/scripts/libtool.mk b/scripts/libtool.mk index 5f15a3adfd3..adb64e69892 100644 --- a/scripts/libtool.mk +++ b/scripts/libtool.mk @@ -33,7 +33,7 @@ ifneq "${LIBTOOL}" "" ifeq "${LIBTOOL}" "JLIBTOOL" JLIBTOOL := ${BUILD_DIR}/make/jlibtool - JLIBTOOL_DEFS := -DPROGRAM_VERSION=$(RADIUSD_VERSION_STRING) + JLIBTOOL_DEFS := -DPROGRAM_VERSION=$(RADIUSD_VERSION) # Pass compiler and ranlib paths through to jlibtool if they're # defined in the environment. This lets us define a separate diff --git a/src/bin/dhcpclient.c b/src/bin/dhcpclient.c index 77804bd31c4..1ece6cd4650 100644 --- a/src/bin/dhcpclient.c +++ b/src/bin/dhcpclient.c @@ -67,7 +67,7 @@ static struct sockaddr_ll ll; /* Socket address structure */ static bool raw_mode = false; static bool reply_expected = true; -static char const *dhcpclient_version = RADIUSD_VERSION_STRING_BUILD("dhcpclient"); +static char const *dhcpclient_version = RADIUSD_VERSION_BUILD("dhcpclient"); /* structure to keep track of offered IP addresses */ typedef struct { diff --git a/src/bin/radclient.c b/src/bin/radclient.c index 7395abb084c..22e65aa4452 100644 --- a/src/bin/radclient.c +++ b/src/bin/radclient.c @@ -81,7 +81,7 @@ static fr_packet_list_t *packet_list = NULL; static rc_request_t *request_head = NULL; static rc_request_t *rc_request_tail = NULL; -static char const *radclient_version = RADIUSD_VERSION_STRING_BUILD("radclient"); +static char const *radclient_version = RADIUSD_VERSION_BUILD("radclient"); static fr_dict_t const *dict_freeradius; static fr_dict_t const *dict_radius; diff --git a/src/bin/radiusd.c b/src/bin/radiusd.c index aefac34013b..cea617fd7a1 100644 --- a/src/bin/radiusd.c +++ b/src/bin/radiusd.c @@ -79,7 +79,7 @@ RCSID("$Id$") # include #endif -char const *radiusd_version = RADIUSD_VERSION_STRING_BUILD("FreeRADIUS"); +char const *radiusd_version = RADIUSD_VERSION_BUILD("FreeRADIUS"); static pid_t radius_pid; /* diff --git a/src/bin/radsniff.c b/src/bin/radsniff.c index d0c1b22c339..66bf76c862d 100644 --- a/src/bin/radsniff.c +++ b/src/bin/radsniff.c @@ -62,7 +62,7 @@ static int packets_count = 1; // Used in '$PATH/${packet}.txt.${count}' static int self_pipe[2] = {-1, -1}; //!< Signals from sig handlers -static char const *radsniff_version = RADIUSD_VERSION_STRING_BUILD("radsniff"); +static char const *radsniff_version = RADIUSD_VERSION_BUILD("radsniff"); static int rs_useful_codes[] = { FR_RADIUS_CODE_ACCESS_REQUEST, //!< RFC2865 - Authentication request diff --git a/src/bin/radsnmp.c b/src/bin/radsnmp.c index 586d529864f..2854b7dae9c 100644 --- a/src/bin/radsnmp.c +++ b/src/bin/radsnmp.c @@ -44,7 +44,7 @@ RCSID("$Id$") #include -static char const *radsnmp_version = RADIUSD_VERSION_STRING_BUILD("radsnmp"); +static char const *radsnmp_version = RADIUSD_VERSION_BUILD("radsnmp"); static bool stop; diff --git a/src/bin/unit_test_module.c b/src/bin/unit_test_module.c index ca6f25df045..595a23e9c43 100644 --- a/src/bin/unit_test_module.c +++ b/src/bin/unit_test_module.c @@ -59,7 +59,7 @@ do { \ static bool filedone = false; static int my_debug_lvl = 0; -char const *radiusd_version = RADIUSD_VERSION_STRING_BUILD("unit_test_module"); +char const *radiusd_version = RADIUSD_VERSION_BUILD("unit_test_module"); static fr_dict_t const *dict_freeradius; static fr_dict_t const *dict_protocol; diff --git a/src/include/autoconf.h.in b/src/include/autoconf.h.in index fe10b3a9dd1..bb86434ae41 100644 --- a/src/include/autoconf.h.in +++ b/src/include/autoconf.h.in @@ -593,17 +593,20 @@ /* Posix-Style ctime_r */ #undef POSIXSTYLE -/* Version integer in format */ +/* Version integer in format */ #undef RADIUSD_VERSION /* Commit HEAD at time of configuring */ #undef RADIUSD_VERSION_COMMIT -/* Version release number at time of configuring */ -#undef RADIUSD_VERSION_RELEASE +/* Version integer in format */ +#undef RADIUSD_VERSION_INCRM -/* Raw version string from VERSION file */ -#undef RADIUSD_VERSION_STRING +/* Version integer in format */ +#undef RADIUSD_VERSION_MAJOR + +/* Version integer in format */ +#undef RADIUSD_VERSION_MINOR /* The number of bytes in type time_t */ #undef SIZEOF_TIME_T diff --git a/src/lib/server/dependency.c b/src/lib/server/dependency.c index da93bb86193..0c0185bde32 100644 --- a/src/lib/server/dependency.c +++ b/src/lib/server/dependency.c @@ -30,7 +30,7 @@ RCSID("$Id$") USES_APPLE_DEPRECATED_API /* OpenSSL API has been deprecated by Apple */ static uint64_t libmagic = RADIUSD_MAGIC_NUMBER; -char const *radiusd_version_short = RADIUSD_VERSION_STRING; +char const *radiusd_version_short = STRINGIFY(RADIUSD_VERSION_MAJOR) "." STRINGIFY(RADIUSD_VERSION_MINOR) "." STRINGIFY(RADIUSD_VERSION_INCRM); static CONF_SECTION *default_feature_cs; //!< Default configuration section to add features to. static CONF_SECTION *default_version_cs; //!< Default configuration section to add features to. @@ -456,7 +456,7 @@ void dependency_version_print(void) #endif DEBUG2(" "); } - INFO("FreeRADIUS Version " RADIUSD_VERSION_STRING); + INFO(RADIUSD_VERSION_BUILD("FreeRADIUS")); INFO("Copyright 1999-2022 The FreeRADIUS server project and contributors"); INFO("There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A"); INFO("PARTICULAR PURPOSE"); diff --git a/src/lib/server/dependency.h b/src/lib/server/dependency.h index 51e94db2f62..f0601287744 100644 --- a/src/lib/server/dependency.h +++ b/src/lib/server/dependency.h @@ -36,6 +36,8 @@ extern char const *radiusd_version_short; #include +#define RADIUSD_VERSION_STRING STRINGIFY(RADIUSD_VERSION_MAJOR) "." STRINGIFY(RADIUSD_VERSION_MINOR) "." STRINGIFY(RADIUSD_VERSION_INCRM) + int rad_check_lib_magic(uint64_t magic); int dependency_feature_add(CONF_SECTION *cs, char const *name, bool enabled); int dependency_version_number_add(CONF_SECTION *cs, char const *name, char const *version); diff --git a/src/lib/util/version.h b/src/lib/util/version.h index 576ff5f08ff..92de79b6f5a 100644 --- a/src/lib/util/version.h +++ b/src/lib/util/version.h @@ -39,12 +39,6 @@ extern "C" { # define RADIUSD_VERSION_DEVELOPER "" #endif -#ifdef RADIUSD_VERSION_RELEASE -# define RADIUSD_VERSION_RELEASE_STRING "-" STRINGIFY(RADIUSD_VERSION_RELEASE) -#else -# define RADIUSD_VERSION_RELEASE_STRING "" -#endif - #ifdef RADIUSD_VERSION_COMMIT # define RADIUSD_VERSION_COMMIT_STRING " (git #" STRINGIFY(RADIUSD_VERSION_COMMIT) ")" #else @@ -61,11 +55,10 @@ extern "C" { * * @param _x utility name */ -#define RADIUSD_VERSION_STRING_BUILD(_x) \ +#define RADIUSD_VERSION_BUILD(_x) \ RADIUSD_VERSION_DEVELOPER \ _x " version " \ - RADIUSD_VERSION_STRING \ - RADIUSD_VERSION_RELEASE_STRING \ + STRINGIFY(RADIUSD_VERSION_MAJOR) "." STRINGIFY(RADIUSD_VERSION_MINOR) "." STRINGIFY(RADIUSD_VERSION_INCRM) \ RADIUSD_VERSION_COMMIT_STRING \ ", for host " HOSTINFO \ RADIUSD_VERSION_BUILD_TIMESTAMP @@ -74,7 +67,6 @@ extern "C" { # define RADIUSD_MAGIC_NUMBER ((uint64_t) (0xf4ee4ad3f4ee4ad3)) # define MAGIC_PREFIX(_x) ((uint8_t) 0x00) # define MAGIC_VERSION(_x) ((uint32_t) 0x00000000) -# define MAGIC_COMMIT(_x) ((uint32_t) 0x00000000) #else /* * Mismatch between debug builds between @@ -86,11 +78,7 @@ extern "C" { # else # define MAGIC_PREFIX_DEBUG 00 # endif -# ifdef RADIUSD_VERSION_COMMIT -# define RADIUSD_MAGIC_NUMBER ((uint64_t) HEXIFY3(MAGIC_PREFIX_DEBUG, RADIUSD_VERSION, RADIUSD_VERSION_COMMIT)) -# else -# define RADIUSD_MAGIC_NUMBER ((uint64_t) HEXIFY3(MAGIC_PREFIX_DEBUG, RADIUSD_VERSION, 00000000)) -# endif +# define RADIUSD_MAGIC_NUMBER ((uint64_t) HEXIFY2(MAGIC_PREFIX_DEBUG, RADIUSD_VERSION)) # define MAGIC_PREFIX(_x) ((uint8_t) ((0xff00000000000000 & (_x)) >> 56)) # define MAGIC_VERSION(_x) ((uint32_t)((0x00ffffff00000000 & (_x)) >> 32)) # define MAGIC_COMMIT(_x) ((uint32_t)((0x00000000ffffffff & (_x)))) diff --git a/src/listen/control/radmin.c b/src/listen/control/radmin.c index 1e5af744d95..43cb98204dd 100644 --- a/src/listen/control/radmin.c +++ b/src/listen/control/radmin.c @@ -89,7 +89,7 @@ DIAG_ON(strict-prototypes) * For configuration file stuff. */ static char const *progname = "radmin"; -static char const *radmin_version = RADIUSD_VERSION_STRING_BUILD("radmin"); +static char const *radmin_version = RADIUSD_VERSION_BUILD("radmin"); typedef enum { RADMIN_CONN_NONE = 0, //!< Don't know, never connected. diff --git a/src/modules/rlm_eap/types/rlm_eap_mschapv2/rlm_eap_mschapv2.c b/src/modules/rlm_eap/types/rlm_eap_mschapv2/rlm_eap_mschapv2.c index e0adee79dfd..2d45a01a500 100644 --- a/src/modules/rlm_eap/types/rlm_eap_mschapv2/rlm_eap_mschapv2.c +++ b/src/modules/rlm_eap/types/rlm_eap_mschapv2/rlm_eap_mschapv2.c @@ -22,12 +22,13 @@ RCSID("$Id$") -#include +#include #include +#include #include #include -#include #include +#include #include #include "eap_mschapv2.h"