Use PKG_GITREVCOUNT for nfv package version

This update revises the nfv package build to drop the old and
unneeded custom build_srpm script, in order to use the
PKG_GITREVCOUNT feature for package versions.

Change-Id: Ib02cb0db8b8c802658bb1833360617d5a6483641
Story: 2006166
Task: 40325
Signed-off-by: Bart Wensley <barton.wensley@windriver.com>
changes/86/740686/1
Bart Wensley 2 years ago
parent b005bc0c14
commit 0bec7460c8
  1. 91
      nfv/centos/build_srpm
  2. 6
      nfv/centos/build_srpm.data
  3. 17
      nfv/centos/nfv.spec

@ -1,91 +0,0 @@
source "$SRC_BASE/build-tools/spec-utils"
if [ "x$DATA" == "x" ]; then
echo "ERROR: Environment variable 'DATA' not defined."
exit 1
fi
if [ ! -f "$DATA" ]; then
echo "ERROR: Couldn't find '$PWD/$DATA'"
exit 1
fi
unset TIS_PATCH_VER # Ensure there's nothing in the env already
source $DATA
if [ -z "$TIS_PATCH_VER" ]; then
echo "ERROR: TIS_PATCH_VER must be defined"
exit 1
fi
SRC_DIR=("./nfv-common" "./nfv-plugins" "./nfv-tools" "./nfv-vim" "./nfv-client")
VERSION=$(grep '^Version:' PKG-INFO | awk -F ': ' '{print $2}' | sed -e 's/^[[:space:]]*//')
TAR_NAME=$(grep '^Name:' PKG-INFO | awk -F ': ' '{print $2}' | sed -e 's/^[[:space:]]*//')
CUR_DIR=`pwd`
BUILD_DIR="$RPMBUILD_BASE"
mkdir -p $BUILD_DIR/SRPMS
TAR="$TAR_NAME-$VERSION.tar.gz"
TAR_PATH="$BUILD_DIR/SOURCES/$TAR"
TAR_NEEDED=0
if [ -f $TAR_PATH ]; then
n=`find . -cnewer $TAR_PATH -and ! -path './.git*' \
-and ! -path './build/*' \
-and ! -path './.pc/*' \
-and ! -path './patches/*' \
-and ! -path "./$DISTRO/*" \
-and ! -path './pbr-*.egg/*' \
| wc -l`
if [ $n -gt 0 ]; then
TAR_NEEDED=1
fi
else
TAR_NEEDED=1
fi
if [ $TAR_NEEDED -gt 0 ]; then
tar czvf $TAR_PATH ${SRC_DIR[@]} --exclude '.git*' --exclude 'build' --exclude='.pc' --exclude='patches' --exclude="$DISTRO" --exclude='pbr-*.egg' --transform "s,^,$TAR_NAME-$VERSION/,"
# tar czvf $TAR_PATH ${SRC_DIR[@]} --exclude '.git*' --exclude 'build' --exclude='.pc' --exclude='patches' --exclude='$DISTRO' --exclude='pbr-*.egg' --transform "s,^\,$TAR_NAME-$VERSION,"
fi
for SPEC in `ls $BUILD_DIR/SPECS`; do
SPEC_PATH="$BUILD_DIR/SPECS/$SPEC"
RELEASE=`spec_find_tag Release "$SPEC_PATH" 2>> /dev/null`
if [ $? -ne 0 ]; then
echo "ERROR: 'Release' not found in '$SPEC_PATH'"
fi
NAME=`spec_find_tag Name "$SPEC_PATH" 2>> /dev/null`
if [ $? -ne 0 ]; then
echo "ERROR: 'Name' not found in '$SPEC_PATH'"
fi
SRPM="$NAME-$VERSION-$RELEASE.src.rpm"
SRPM_PATH="$BUILD_DIR/SRPMS/$SRPM"
BUILD_NEEDED=0
if [ -f $SRPM_PATH ]; then
n=`find . -cnewer $SRPM_PATH | wc -l`
if [ $n -gt 0 ]; then
BUILD_NEEDED=1
fi
else
BUILD_NEEDED=1
fi
if [ $BUILD_NEEDED -gt 0 ]; then
echo "SPEC file: $SPEC_PATH"
echo "SRPM build directory: $BUILD_DIR"
echo "TIS_PATCH_VER: $TIS_PATCH_VER"
sed -i -e "1 i%define tis_patch_ver $TIS_PATCH_VER" $SPEC_PATH
rpmbuild -bs $SPEC_PATH --define="%_topdir $BUILD_DIR" --define="_tis_dist .tis"
fi
done

@ -1 +1,5 @@
TIS_PATCH_VER=81
SRC_DIR=.
EXCLUDE_LIST_FROM_TAR="centos opensuse .stestr \
nfv-client/build nfv-common/build nfv-debug-tools nfv-plugins/build \
nfv-tests nfv-tools/build nfv-vim/build"
TIS_PATCH_VER=PKG_GITREVCOUNT

@ -79,14 +79,6 @@ Network Function Virtualization Client
%prep
%setup
# use actual value of %{_sysconfdir} to repace @SYSCONFDIR@ in config files
# use actual value of %{pythonroot} to replace @PYTHONROOT@ in config.ini.
sed -i -e 's|@SYSCONFDIR@|%{_sysconfdir}|g' nfv-vim/scripts/vim
sed -i -e 's|@SYSCONFDIR@|%{_sysconfdir}|g' nfv-vim/scripts/vim-api
sed -i -e 's|@SYSCONFDIR@|%{_sysconfdir}|g' nfv-vim/scripts/vim-webserver
sed -i -e 's|@SYSCONFDIR@|%{_sysconfdir}|g' nfv-vim/nfv_vim/config.ini
sed -i -e 's|@PYTHONROOT@|%{pythonroot}|g' nfv-vim/nfv_vim/config.ini
%build
%build_python nfv-common
%build_python nfv-plugins
@ -118,6 +110,15 @@ install -d -m 755 %{buildroot}/
install -p -D -m 644 nfv-plugins/scripts/nfvi-plugins.logrotate %{buildroot}/%{_sysconfdir}/logrotate.d/nfvi-plugins.logrotate
# nfv-vim
# use actual value of %{_sysconfdir} to replace @SYSCONFDIR@ in config files
# use actual value of %{pythonroot} to replace @PYTHONROOT@ in config.ini
sed -i -e 's|@SYSCONFDIR@|%{_sysconfdir}|g' nfv-vim/scripts/vim
sed -i -e 's|@SYSCONFDIR@|%{_sysconfdir}|g' nfv-vim/scripts/vim-api
sed -i -e 's|@SYSCONFDIR@|%{_sysconfdir}|g' nfv-vim/scripts/vim-webserver
sed -i -e 's|@SYSCONFDIR@|%{_sysconfdir}|g' nfv-vim/nfv_vim/config.ini
sed -i -e 's|@PYTHONROOT@|%{pythonroot}|g' nfv-vim/nfv_vim/config.ini
install -d -m 755 %{buildroot}/usr/lib/ocf/resource.d/nfv
install -p -D -m 755 nfv-vim/scripts/vim %{buildroot}/usr/lib/ocf/resource.d/nfv/vim
install -p -D -m 755 nfv-vim/scripts/vim-api %{buildroot}/usr/lib/ocf/resource.d/nfv/vim-api

Loading…
Cancel
Save