diff --git a/nfv/centos/build_srpm b/nfv/centos/build_srpm deleted file mode 100755 index a7fab0b2..00000000 --- a/nfv/centos/build_srpm +++ /dev/null @@ -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 - - - - - diff --git a/nfv/centos/build_srpm.data b/nfv/centos/build_srpm.data index a7f7170d..7b30f035 100755 --- a/nfv/centos/build_srpm.data +++ b/nfv/centos/build_srpm.data @@ -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 diff --git a/nfv/centos/nfv.spec b/nfv/centos/nfv.spec index 960136a1..ca7c3cfd 100755 --- a/nfv/centos/nfv.spec +++ b/nfv/centos/nfv.spec @@ -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