Make all version calculations come from scripts/version.sh and remove resulting redundant substitutions

This commit is contained in:
Hamish Coleman 2021-11-01 19:13:32 +00:00
parent a4910ddc77
commit ff72ed8190
11 changed files with 29 additions and 40 deletions

View File

@ -1,7 +1,6 @@
# NOTE: these are needed by the configure.in inside the packages folder # NOTE: these are needed by the configure.in inside the packages folder
N2N_VERSION_SHORT=@N2N_VERSION_SHORT@ N2N_VERSION=@N2N_VERSION@
GIT_COMMITS=@GIT_COMMITS@
######## ########
@ -252,7 +251,7 @@ install: edge supernode edge.8.gz supernode.1.gz n2n.7.gz
# Docker builder section # Docker builder section
DOCKER_IMAGE_NAME=ntop/supernode DOCKER_IMAGE_NAME=ntop/supernode
DOCKER_IMAGE_VERSION=$N2N_VERSION_SHORT DOCKER_IMAGE_VERSION=$N2N_VERSION_SHORT
N2N_COMMIT_HASH=@GIT_REVISION@ N2N_COMMIT_HASH=$(shell scripts/version.sh hash)
default: steps default: steps

View File

@ -2,13 +2,7 @@ odnl> Do not add anything above
AC_INIT([edge], m4_esyscmd([scripts/version.sh | tr -d '\n'])) AC_INIT([edge], m4_esyscmd([scripts/version.sh | tr -d '\n']))
dnl> Do not add anything above dnl> Do not add anything above
N2N_VERSION_SHORT=$(scripts/version.sh short) N2N_VERSION=${PACKAGE_VERSION}
if test -d ".git"; then
# NOTE: keep in sync with the definitions for configure.in files under the packages folder
GIT_COMMITS=`git rev-list --count HEAD`
GIT_REVISION=`git rev-parse --short HEAD`
fi
if test "${CC+set}" != set; then if test "${CC+set}" != set; then
CC=gcc CC=gcc
@ -120,9 +114,7 @@ AC_SUBST(CC)
AC_SUBST(AR) AC_SUBST(AR)
AC_SUBST(CFLAGS) AC_SUBST(CFLAGS)
AC_SUBST(LDFLAGS) AC_SUBST(LDFLAGS)
AC_SUBST(N2N_VERSION_SHORT) AC_SUBST(N2N_VERSION)
AC_SUBST(GIT_COMMITS)
AC_SUBST(GIT_REVISION)
AC_SUBST(N2N_DEFINES) AC_SUBST(N2N_DEFINES)
AC_SUBST(N2N_LIBS) AC_SUBST(N2N_LIBS)
AC_SUBST(ADDITIONAL_TOOLS) AC_SUBST(ADDITIONAL_TOOLS)

View File

@ -586,8 +586,7 @@ LIBOBJS
EXTRA_DEP EXTRA_DEP
DATE DATE
EXTN EXTN
GIT_COMMITS N2N_VERSION
N2N_VERSION_SHORT
APP APP
target_alias target_alias
host_alias host_alias
@ -1694,8 +1693,7 @@ fi
# NOTE: this file is not actually used. You need to edit configure as well! # NOTE: this file is not actually used. You need to edit configure as well!
N2N_VERSION_SHORT=`grep N2N_VERSION_SHORT ../../Makefile | head -1| cut -d "=" -f 2` N2N_VERSION=$(../../scripts/version.sh)
GIT_COMMITS=`grep GIT_COMMITS ../../Makefile | head -1| cut -d "=" -f 2`
DEBIAN_VERSION=`cat /etc/debian_version | grep "^8" | wc -l` DEBIAN_VERSION=`cat /etc/debian_version | grep "^8" | wc -l`
@ -1740,7 +1738,6 @@ DATE=`date -R`
ac_config_files="$ac_config_files debian/changelog" ac_config_files="$ac_config_files debian/changelog"
ac_config_files="$ac_config_files debian/files" ac_config_files="$ac_config_files debian/files"

View File

@ -3,8 +3,7 @@ AC_INIT([Makefile.in], 1.0)
AC_ARG_WITH(edgex, [ --with-edgex Build for Ubiquity-X]) AC_ARG_WITH(edgex, [ --with-edgex Build for Ubiquity-X])
# NOTE: this file is not actually used. You need to edit configure as well! # NOTE: this file is not actually used. You need to edit configure as well!
N2N_VERSION_SHORT=`grep N2N_VERSION_SHORT ../../Makefile | head -1| cut -d "=" -f 2` N2N_VERSION=$(../../scripts/version.sh)
GIT_COMMITS=`grep GIT_COMMITS ../../Makefile | head -1| cut -d "=" -f 2`
DEBIAN_VERSION=`cat /etc/debian_version | grep "^8" | wc -l` DEBIAN_VERSION=`cat /etc/debian_version | grep "^8" | wc -l`
@ -44,8 +43,7 @@ APP=n2n
DATE=`date -R` DATE=`date -R`
AC_SUBST(APP) AC_SUBST(APP)
AC_SUBST(N2N_VERSION_SHORT) AC_SUBST(N2N_VERSION)
AC_SUBST(GIT_COMMITS)
AC_SUBST(EXTN) AC_SUBST(EXTN)
AC_SUBST(DATE) AC_SUBST(DATE)
AC_SUBST(EXTRA_DEP) AC_SUBST(EXTRA_DEP)

View File

@ -1,4 +1,4 @@
@APP@ (@N2N_VERSION_SHORT@-@GIT_COMMITS@) table; urgency=high @APP@ (@N2N_VERSION@) table; urgency=high
* Last packaged version * Last packaged version
-- Luca Deri <deri@ntop.org> @DATE@ -- Luca Deri <deri@ntop.org> @DATE@

View File

@ -1 +1 @@
n2n_@N2N_VERSION_SHORT@_@EXTN@.deb free optional n2n_@N2N_VERSION@_@EXTN@.deb free optional

View File

@ -4,7 +4,7 @@
N2N_HOME=$(PWD)/../.. N2N_HOME=$(PWD)/../..
N2N_BUILD=${N2N_HOME}/packages/debian/n2n N2N_BUILD=${N2N_HOME}/packages/debian/n2n
PLATFORM=@MACHINE@ PLATFORM=@MACHINE@
RPM_PKG=n2n-@N2N_VERSION_SHORT@-@GIT_COMMITS@.$(PLATFORM).rpm RPM_PKG=n2n-@N2N_VERSION_RPM@-1.$(PLATFORM).rpm
all: clean pkg all: clean pkg

View File

@ -586,8 +586,7 @@ LIBOBJS
RPM_SIGN_CMD RPM_SIGN_CMD
DATE DATE
EXTN EXTN
GIT_COMMITS N2N_VERSION_RPM
N2N_VERSION_SHORT
MACHINE MACHINE
APP APP
target_alias target_alias
@ -609,6 +608,7 @@ infodir
docdir docdir
oldincludedir oldincludedir
includedir includedir
runstatedir
localstatedir localstatedir
sharedstatedir sharedstatedir
sysconfdir sysconfdir
@ -673,6 +673,7 @@ datadir='${datarootdir}'
sysconfdir='${prefix}/etc' sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com' sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var' localstatedir='${prefix}/var'
runstatedir='${localstatedir}/run'
includedir='${prefix}/include' includedir='${prefix}/include'
oldincludedir='/usr/include' oldincludedir='/usr/include'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
@ -925,6 +926,15 @@ do
| -silent | --silent | --silen | --sile | --sil) | -silent | --silent | --silen | --sile | --sil)
silent=yes ;; silent=yes ;;
-runstatedir | --runstatedir | --runstatedi | --runstated \
| --runstate | --runstat | --runsta | --runst | --runs \
| --run | --ru | --r)
ac_prev=runstatedir ;;
-runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
| --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
| --run=* | --ru=* | --r=*)
runstatedir=$ac_optarg ;;
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
ac_prev=sbindir ;; ac_prev=sbindir ;;
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@ -1062,7 +1072,7 @@ fi
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
datadir sysconfdir sharedstatedir localstatedir includedir \ datadir sysconfdir sharedstatedir localstatedir includedir \
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
libdir localedir mandir libdir localedir mandir runstatedir
do do
eval ac_val=\$$ac_var eval ac_val=\$$ac_var
# Remove trailing slashes. # Remove trailing slashes.
@ -1215,6 +1225,7 @@ Fine tuning of the installation directories:
--sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var] --localstatedir=DIR modifiable single-machine data [PREFIX/var]
--runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
--libdir=DIR object code libraries [EPREFIX/lib] --libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include] --includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include] --oldincludedir=DIR C header files for non-gcc [/usr/include]
@ -1670,8 +1681,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
# NOTE: this file is not actually used. You need to edit configure as well! # NOTE: this file is not actually used. You need to edit configure as well!
N2N_VERSION_SHORT=`grep N2N_VERSION_SHORT ../../Makefile | head -1| cut -d "=" -f 2` N2N_VERSION_RPM=$(../../scripts/version.sh |tr - _)
GIT_COMMITS=`grep GIT_COMMITS ../../Makefile | head -1| cut -d "=" -f 2`
MACHINE=`uname -m` MACHINE=`uname -m`
SHORT_MACHINE=`uname -m | cut -b1-3` SHORT_MACHINE=`uname -m | cut -b1-3`
@ -1717,7 +1727,6 @@ fi
ac_config_files="$ac_config_files n2n.spec" ac_config_files="$ac_config_files n2n.spec"
ac_config_files="$ac_config_files ../etc/systemd/system/edge.service" ac_config_files="$ac_config_files ../etc/systemd/system/edge.service"

View File

@ -1,8 +1,7 @@
AC_INIT([Makefile.in], 1.0) AC_INIT([Makefile.in], 1.0)
# NOTE: this file is not actually used. You need to edit configure as well! # NOTE: this file is not actually used. You need to edit configure as well!
N2N_VERSION_SHORT=`grep N2N_VERSION_SHORT ../../Makefile | head -1| cut -d "=" -f 2` N2N_VERSION_RPM=$(../../scripts/version.sh |tr - _)
GIT_COMMITS=`grep GIT_COMMITS ../../Makefile | head -1| cut -d "=" -f 2`
MACHINE=`uname -m` MACHINE=`uname -m`
SHORT_MACHINE=`uname -m | cut -b1-3` SHORT_MACHINE=`uname -m | cut -b1-3`
@ -43,8 +42,7 @@ fi
AC_SUBST(APP) AC_SUBST(APP)
AC_SUBST(MACHINE) AC_SUBST(MACHINE)
AC_SUBST(N2N_VERSION_SHORT) AC_SUBST(N2N_VERSION_RPM)
AC_SUBST(GIT_COMMITS)
AC_SUBST(EXTN) AC_SUBST(EXTN)
AC_SUBST(DATE) AC_SUBST(DATE)
AC_SUBST(RPM_SIGN_CMD) AC_SUBST(RPM_SIGN_CMD)

View File

@ -1,6 +1,6 @@
Summary: n2n peer-to-peer VPN Summary: n2n peer-to-peer VPN
Name: n2n Name: n2n
Version: @N2N_VERSION_SHORT@ Version: @N2N_VERSION_RPM@
Release: 1 Release: 1
License: GPL License: GPL
Group: Networking/Utilities Group: Networking/Utilities

View File

@ -3,11 +3,7 @@
# Specifically for windows, where installing autoconf looks suspiciously # Specifically for windows, where installing autoconf looks suspiciously
# like boiling the ocean. # like boiling the ocean.
VERSION=$(cat VERSION)
sed \ sed \
-e "s%@N2N_VERSION_SHORT@%$VERSION%g" \
-e "s%@GIT_COMMITS@%FIXME%g" \
-e "s%@CC@%gcc%g" \ -e "s%@CC@%gcc%g" \
-e "s%@AR@%ar%g" \ -e "s%@AR@%ar%g" \
-e "s%@CFLAGS@%$CFLAGS%g" \ -e "s%@CFLAGS@%$CFLAGS%g" \