diff --git a/.gitignore b/.gitignore index 49cb78b..9a2dec6 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ *.a *.gz configure +configure.ac config.* Makefile autom4te.cache @@ -9,4 +10,4 @@ benchmark edge example_edge_embed supernode -build \ No newline at end of file +build diff --git a/CMakeLists.txt b/CMakeLists.txt index 2cbf97b..1fd0a03 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ project(n2n) cmake_minimum_required(VERSION 2.6) # N2n information -set(N2N_VERSION 2.5.0) +set(N2N_VERSION 2.5.1) set(N2N_OSNAME ${CMAKE_SYSTEM}) # N2n specific params diff --git a/Makefile.in b/Makefile.in index 05ecb16..4cc8570 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,8 +1,3 @@ - -N2N_VERSION=@N2N_VERSION@ - -######## - CC?=gcc DEBUG?=-g3 #OPTIMIZATION?=-O2 @@ -102,8 +97,8 @@ install: edge supernode edge.8.gz supernode.1.gz n2n.7.gz # Docker builder section DOCKER_IMAGE_NAME=ntop/supernode -DOCKER_IMAGE_VERSION=$N2N_VERSION -N2N_COMMIT_HASH=21055550f3392235a1b41d71257e9dc9ead0dfa0 +DOCKER_IMAGE_VERSION=@N2N_VERSION_SHORT@ +N2N_COMMIT_HASH=@GIT_REVISION@ default: steps diff --git a/autogen.sh b/autogen.sh index e164756..5c9c377 100755 --- a/autogen.sh +++ b/autogen.sh @@ -1,5 +1,19 @@ #!/usr/bin/env bash +# NOTE: update version in CMakeLists.txt after changing these +N2N_MAJOR="2" +N2N_MINOR="5" +N2N_PATCH="1" + +N2N_VERSION_SHORT="$N2N_MAJOR.$N2N_MINOR.$N2N_PATCH" + +cat configure.seed | sed \ + -e "s/@N2N_MAJOR@/$N2N_MAJOR/g" \ + -e "s/@N2N_MINOR@/$N2N_MINOR/g" \ + -e "s/@N2N_PATCH@/$N2N_PATCH/g" \ + -e "s/@N2N_VERSION_SHORT@/$N2N_VERSION_SHORT/g" \ + > configure.ac + rm -f config.h config.h.in *~ Makefile configure #* echo "Wait please..." diff --git a/configure.ac b/configure.seed similarity index 68% rename from configure.ac rename to configure.seed index 9e3867f..15e5554 100644 --- a/configure.ac +++ b/configure.seed @@ -1,8 +1,14 @@ odnl> Do not add anything above -AC_INIT([edge],2.5.0) +AC_INIT([edge],@N2N_VERSION_SHORT@) dnl> Do not add anything above -N2N_VERSION=2.5.0 +if test -d ".git"; then +GIT_COMMITS=`git rev-list --count HEAD` +GIT_REVISION=`git rev-parse --short HEAD` +GIT_RELEASE="@N2N_VERSION_SHORT@.r${GIT_COMMITS}.${GIT_REVISION}" +else +GIT_RELEASE=@N2N_VERSION_SHORT@ +fi AC_CHECK_LIB([crypto], [AES_cbc_encrypt]) @@ -30,6 +36,7 @@ dnl> wget -O config.guess 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=bl OSNAME=`./config.guess` fi AC_DEFINE_UNQUOTED(PACKAGE_OSNAME, "${OSNAME}", [OS name]) +AC_DEFINE_UNQUOTED(GIT_RELEASE, "${GIT_RELEASE}", [GIT release]) if test $MACHINE = "x86_64"; then EXTN="amd64" @@ -41,7 +48,13 @@ fi DATE=`date +"%Y-%m-%d"` -AC_SUBST(N2N_VERSION) +AC_SUBST(N2N_MAJOR) +AC_SUBST(N2N_MINOR) +AC_SUBST(N2N_PATCH) +AC_SUBST(N2N_VERSION_SHORT) +AC_SUBST(GIT_COMMITS) +AC_SUBST(GIT_REVISION) +AC_SUBST(GIT_RELEASE) AC_SUBST(N2N_DEFINES) AC_SUBST(N2N_LIBS) AC_CONFIG_HEADERS(config.h) diff --git a/n2n.c b/n2n.c index 78c5010..f544752 100644 --- a/n2n.c +++ b/n2n.c @@ -257,8 +257,8 @@ void hexdump(const uint8_t * buf, size_t len) void print_n2n_version() { printf("Welcome to n2n v.%s for %s\n" "Built on %s\n" - "Copyright 2007-18 - ntop.org and contributors\n\n", - PACKAGE_VERSION, PACKAGE_OSNAME, PACKAGE_BUILDDATE); + "Copyright 2007-19 - ntop.org and contributors\n\n", + GIT_RELEASE, PACKAGE_OSNAME, PACKAGE_BUILDDATE); } /* *********************************************** */ diff --git a/packages/debian/configure.in b/packages/debian/configure.in index 5af61a4..cd5186c 100644 --- a/packages/debian/configure.in +++ b/packages/debian/configure.in @@ -25,18 +25,12 @@ else fi APP=n2n -N2N_VERS=`grep N2N_VERSION ../../Makefile | head -1| cut -d "=" -f 2` -GIT_RELEASE=`git rev-parse HEAD` -GIT_COMMITS=`git rev-list --all |wc -l | tr -d '[[:space:]]'` DATE=`date -R` AC_SUBST(APP) -AC_SUBST(N2N_VERS) AC_SUBST(MACHINE) AC_SUBST(EXTN) AC_SUBST(DATE) -AC_SUBST(GIT_RELEASE) -AC_SUBST(GIT_COMMITS) AC_CONFIG_FILES(debian/changelog) AC_CONFIG_FILES(debian/files) diff --git a/packages/debian/debian/changelog.in b/packages/debian/debian/changelog.in index 1856dbd..6d4e3dc 100644 --- a/packages/debian/debian/changelog.in +++ b/packages/debian/debian/changelog.in @@ -1,4 +1,4 @@ -@APP@ (@N2N_VERS@-@GIT_COMMITS@) table; urgency=high +@APP@ (@N2N_VERSION_SHORT@-@GIT_COMMITS@) table; urgency=high * Last packaged version -- Luca Deri @DATE@ diff --git a/packages/debian/debian/control.in b/packages/debian/debian/control.in index a75ff5a..77e2fe9 100644 --- a/packages/debian/debian/control.in +++ b/packages/debian/debian/control.in @@ -2,7 +2,7 @@ Source: n2n Section: net Priority: extra Maintainer: Luca Deri -Standards-Version: @N2N_VERS@ +Standards-Version: @N2N_VERSION_SHORT@ Build-Depends: Package: n2n diff --git a/packages/debian/debian/files.in b/packages/debian/debian/files.in index b73ea13..6128dce 100644 --- a/packages/debian/debian/files.in +++ b/packages/debian/debian/files.in @@ -1 +1 @@ -n2n_@N2N_VERS@_@EXTN@.deb free optional +n2n_@N2N_VERSION_SHORT@_@EXTN@.deb free optional diff --git a/packages/rpm/Makefile.in b/packages/rpm/Makefile.in index 067d017..716c05b 100644 --- a/packages/rpm/Makefile.in +++ b/packages/rpm/Makefile.in @@ -4,7 +4,7 @@ N2N_HOME=$(PWD)/../.. N2N_BUILD=${N2N_HOME}/packages/debian/n2n PLATFORM=@MACHINE@ -RPM_PKG=n2n-@N2N_VERS@-@REVISION@.$(PLATFORM).rpm +RPM_PKG=n2n-@N2N_VERSION_SHORT@-@GIT_COMMITS@.$(PLATFORM).rpm all: clean pkg diff --git a/packages/rpm/configure.in b/packages/rpm/configure.in index 708114d..fa71a81 100644 --- a/packages/rpm/configure.in +++ b/packages/rpm/configure.in @@ -20,20 +20,12 @@ else fi APP=n2n -N2N_VERS=`grep N2N_VERSION ../../Makefile | head -1| cut -d "=" -f 2` -GIT_RELEASE=`git rev-parse HEAD` -GIT_COMMITS=`git rev-list --all |wc -l | tr -d '[[:space:]]'` DATE=`date -R` -REVISION=`git log --pretty=oneline | wc -l` AC_SUBST(APP) -AC_SUBST(N2N_VERS) AC_SUBST(MACHINE) AC_SUBST(EXTN) AC_SUBST(DATE) -AC_SUBST(GIT_RELEASE) -AC_SUBST(GIT_COMMITS) -AC_SUBST(REVISION) AC_CONFIG_FILES(n2n.spec) AC_CONFIG_FILES(../etc/systemd/system/edge.service) diff --git a/packages/rpm/n2n.spec.in b/packages/rpm/n2n.spec.in index e6ff726..301a205 100644 --- a/packages/rpm/n2n.spec.in +++ b/packages/rpm/n2n.spec.in @@ -1,7 +1,7 @@ Summary: n2n peer-to-peer VPN Name: n2n -Version: @N2N_VERS@ -Release: @REVISION@ +Version: @N2N_VERSION_SHORT@ +Release: @GIT_COMMITS@ License: GPL Group: Networking/Utilities URL: http://www.ntop.org/ diff --git a/win32/winconfig.h b/win32/winconfig.h index edc6498..3a8cea0 100644 --- a/win32/winconfig.h +++ b/win32/winconfig.h @@ -5,3 +5,4 @@ /* Define to the version of this package. */ #define PACKAGE_VERSION N2N_VERSION +#define GIT_RELEASE N2N_VERSION