Skip to content

Commit

Permalink
Added script to get the package version
Browse files Browse the repository at this point in the history
  • Loading branch information
cardigliano committed Dec 7, 2018
1 parent 70d0566 commit b2c00b3
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 20 deletions.
21 changes: 15 additions & 6 deletions packages/rpm/configure
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,6 @@ PACKAGE_URL=''
ac_subst_vars='LTLIBOBJS
LIBOBJS
GIT_REVISION
GIT_RELEASE
KERNEL
DATE
EXTN
Expand All @@ -609,6 +608,7 @@ infodir
docdir
oldincludedir
includedir
runstatedir
localstatedir
sharedstatedir
sysconfdir
Expand Down Expand Up @@ -673,6 +673,7 @@ datadir='${datarootdir}'
sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var'
runstatedir='${localstatedir}/run'
includedir='${prefix}/include'
oldincludedir='/usr/include'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
Expand Down Expand Up @@ -925,6 +926,15 @@ do
| -silent | --silent | --silen | --sile | --sil)
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)
ac_prev=sbindir ;;
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
Expand Down Expand Up @@ -1062,7 +1072,7 @@ fi
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
datadir sysconfdir sharedstatedir localstatedir includedir \
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
libdir localedir mandir
libdir localedir mandir runstatedir
do
eval ac_val=\$$ac_var
# Remove trailing slashes.
Expand Down Expand Up @@ -1215,6 +1225,7 @@ Fine tuning of the installation directories:
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
--runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
--libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include]
Expand Down Expand Up @@ -1694,9 +1705,8 @@ else
fi
fi

PACKAGE_VERSION=`cat ../../configure.ac|grep C_INIT|cut -c 21-|rev|cut -c 3-|rev`
GIT_RELEASE=`git rev-parse HEAD`
GIT_REVISION=`git rev-list --all |wc -l | tr -d '[:space:]'`
PACKAGE_VERSION=`../version.sh --release`
GIT_REVISION=`../version.sh --revision`

ac_config_files="$ac_config_files Makefile ndpi.spec"

Expand All @@ -1709,7 +1719,6 @@ ac_config_files="$ac_config_files Makefile ndpi.spec"




cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
# tests run on this system so they can be shared between configure
Expand Down
6 changes: 2 additions & 4 deletions packages/rpm/configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@ else
fi
fi

PACKAGE_VERSION=`cat ../../configure.ac|grep C_INIT|cut -c 21-|rev|cut -c 3-|rev`
GIT_RELEASE=`git rev-parse HEAD`
GIT_REVISION=`git rev-list --all |wc -l | tr -d '[[:space:]]'`
PACKAGE_VERSION=`../version.sh --release`
GIT_REVISION=`../version.sh --revision`

AC_CONFIG_FILES([Makefile ndpi.spec])

Expand All @@ -37,7 +36,6 @@ AC_SUBST(MACHINE)
AC_SUBST(EXTN)
AC_SUBST(DATE)
AC_SUBST(KERNEL)
AC_SUBST(GIT_RELEASE)
AC_SUBST(GIT_REVISION)

AC_OUTPUT
Expand Down
21 changes: 15 additions & 6 deletions packages/ubuntu/configure
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,6 @@ PACKAGE_URL=''
ac_subst_vars='LTLIBOBJS
LIBOBJS
GIT_REVISION
GIT_RELEASE
KERNEL
DATE
EXTN
Expand All @@ -609,6 +608,7 @@ infodir
docdir
oldincludedir
includedir
runstatedir
localstatedir
sharedstatedir
sysconfdir
Expand Down Expand Up @@ -673,6 +673,7 @@ datadir='${datarootdir}'
sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var'
runstatedir='${localstatedir}/run'
includedir='${prefix}/include'
oldincludedir='/usr/include'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
Expand Down Expand Up @@ -925,6 +926,15 @@ do
| -silent | --silent | --silen | --sile | --sil)
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)
ac_prev=sbindir ;;
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
Expand Down Expand Up @@ -1062,7 +1072,7 @@ fi
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
datadir sysconfdir sharedstatedir localstatedir includedir \
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
libdir localedir mandir
libdir localedir mandir runstatedir
do
eval ac_val=\$$ac_var
# Remove trailing slashes.
Expand Down Expand Up @@ -1215,6 +1225,7 @@ Fine tuning of the installation directories:
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
--runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
--libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include]
Expand Down Expand Up @@ -1693,9 +1704,8 @@ else
fi
fi

NDPI_VERS=`cat ../../configure.ac|grep C_INIT|cut -c 21-|rev|cut -c 3-|rev`
GIT_RELEASE=`git rev-parse HEAD`
GIT_REVISION=`git rev-list --all |wc -l | tr -d '[:space:]'`
NDPI_VERS=`../version.sh --release`
GIT_REVISION=`../version.sh --revision`

ac_config_files="$ac_config_files Makefile debian/changelog debian/files debian/control"

Expand All @@ -1707,7 +1717,6 @@ ac_config_files="$ac_config_files Makefile debian/changelog debian/files debian/




cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
# tests run on this system so they can be shared between configure
Expand Down
6 changes: 2 additions & 4 deletions packages/ubuntu/configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@ else
fi
fi

NDPI_VERS=`cat ../../configure.ac|grep C_INIT|cut -c 21-|rev|cut -c 3-|rev`
GIT_RELEASE=`git rev-parse HEAD`
GIT_REVISION=`git rev-list --all |wc -l | tr -d '[[:space:]]'`
NDPI_VERS=`../version.sh --release`
GIT_REVISION=`../version.sh --revision`

AC_CONFIG_FILES([Makefile debian/changelog debian/files debian/control])

Expand All @@ -35,7 +34,6 @@ AC_SUBST(MACHINE)
AC_SUBST(EXTN)
AC_SUBST(DATE)
AC_SUBST(KERNEL)
AC_SUBST(GIT_RELEASE)
AC_SUBST(GIT_REVISION)

AC_OUTPUT
37 changes: 37 additions & 0 deletions packages/version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash

SCRIPTPATH="$(cd "$(dirname "$0")"; pwd -P)"
RELEASE="$(cd ${SCRIPTPATH}; cat ../configure.ac|grep C_INIT|cut -c 21-|rev|cut -c 3-|rev)"
REVISION="$(cd ${SCRIPTPATH}; git rev-list --all |wc -l | tr -d '[[:space:]]')"

get_release() {
echo "${RELEASE}"
exit 0
}

get_revision() {
echo "${REVISION}"
exit 0
}

get_version() {
echo "${RELEASE}-${REVISION}"
exit 0
}

case "$1" in
--release)
get_release;
;;
--revision)
get_revision;
;;
--version)
get_version;
;;
*)
echo "Usage: ${0} {--release|--revision|--version}"
exit 1
esac

exit 0

0 comments on commit b2c00b3

Please sign in to comment.