aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2017-04-18 15:26:39 +0200
committerFlorin Coras <florin.coras@gmail.com>2017-04-19 20:16:14 +0000
commitc06eeb0e3c9c1a9fa8f913e2d785b03220bfdabd (patch)
tree7ce8ea3eb0aa68f102922868c08470ecb2515c97
parentb59a7055524bae29a328958c493d0b600776dc27 (diff)
Fix "make dist" to include version number, docouple it from rpm packaging
Change-Id: If2f9976d668089026c97b897cf449bff09050631 Signed-off-by: Damjan Marion <damarion@cisco.com>
-rw-r--r--Makefile28
-rw-r--r--build-data/platforms.mk17
-rwxr-xr-xbuild-root/scripts/verdist31
-rw-r--r--extras/rpm/Makefile30
-rw-r--r--extras/rpm/vpp.service (renamed from build-root/rpm/vpp.service)0
-rw-r--r--extras/rpm/vpp.spec (renamed from build-root/rpm/vpp.spec)13
-rwxr-xr-xsrc/scripts/version12
7 files changed, 61 insertions, 70 deletions
diff --git a/Makefile b/Makefile
index 133c3d45cb5..791127a7b00 100644
--- a/Makefile
+++ b/Makefile
@@ -214,18 +214,30 @@ else
$(shell $(BR)/scripts/version > $(BR)/scripts/.version)
endif
-dist: $(BR)/scripts/.version
- $(MAKE) verstring=$(PLATFORM)-$(shell cat $(BR)/scripts/.version) prefix=$(PLATFORM) distversion
-
-distversion: $(BR)/scripts/.version
- $(BR)/scripts/verdist ${BR} ${prefix}-$(shell $(BR)/scripts/version rpm-version) ${verstring}
- mv $(verstring).tar.gz $(BR)/rpm
+DIST_FILE = $(BR)/vpp-$(shell src/scripts/version).tar
+DIST_SUBDIR = vpp-$(shell src/scripts/version|cut -f1 -d-)
+
+dist:
+ @git archive \
+ --prefix=$(DIST_SUBDIR)/ \
+ --format=tar \
+ -o $(DIST_FILE) \
+ HEAD
+ @git describe > $(BR)/.version
+ @tar --append \
+ --file $(DIST_FILE) \
+ --transform='s,.*/.version,$(DIST_SUBDIR)/src/scripts/.version,' \
+ $(BR)/.version
+ @$(RM) $(BR)/.version $(DIST_FILE).xz
+ @xz -v --threads=0 $(DIST_FILE)
+ @$(RM) $(BR)/vpp-latest.tar.xz
+ @ln -rs $(DIST_FILE).xz $(BR)/vpp-latest.tar.xz
build: $(BR)/.bootstrap.ok
$(call make,$(PLATFORM)_debug,vpp-install)
wipedist:
- $(RM) $(BR)/scripts/.version $(BR)/rpm/*.tar.gz
+ @$(RM) $(BR)/*.tar.xz
wipe: wipedist $(BR)/.bootstrap.ok
$(call make,$(PLATFORM)_debug,vpp-wipe)
@@ -351,7 +363,7 @@ pkg-deb:
$(call make,$(PLATFORM),install-deb)
pkg-rpm: dist
- $(call make,$(PLATFORM),install-rpm)
+ make -C extras/rpm
dpdk-install-dev:
make -C dpdk install-$(PKG)
diff --git a/build-data/platforms.mk b/build-data/platforms.mk
index f491ee59571..7904cc40b5c 100644
--- a/build-data/platforms.mk
+++ b/build-data/platforms.mk
@@ -94,20 +94,3 @@ install-deb: $(patsubst %,%-find-source,$(ROOT_PACKAGES))
dpkg-buildpackage -us -uc -b \
)
-.PHONY: install-rpm
-install-rpm: $(patsubst %,%-find-source,$(ROOT_PACKAGES))
- @$(BUILD_ENV) ; \
- set -eu$(BUILD_DEBUG) ; \
- $(MAKE) -C $(MU_BUILD_ROOT_DIR) \
- $(patsubst %,%-install, \
- $(ROOT_PACKAGES)) || exit 1; \
- \
- cd rpm ; \
- mkdir -p SOURCES ; \
- if test -f *.tar.gz ; then mv *.tar.gz SOURCES ; fi ; \
- rpmbuild -bb --define "_topdir $$PWD" --define \
- "_install_dir $(INSTALL_PREFIX)$(ARCH)" \
- --define "_mu_build_root_dir $(MU_BUILD_ROOT_DIR)" \
- vpp.spec ; \
- mv $$(find RPMS -name \*.rpm -type f) ..
-
diff --git a/build-root/scripts/verdist b/build-root/scripts/verdist
deleted file mode 100755
index 9d1f1b5adcd..00000000000
--- a/build-root/scripts/verdist
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/bin/bash
-
-#
-# Add version to dist tarball.
-#
-BR=$1
-prefix=$2
-verstring=$3
-BASE=`pwd`
-
-git rev-parse 2> /dev/null
-if [ $? == 0 ]; then
- git archive --prefix=${prefix}/ HEAD | gzip -9 > ${verstring}.tar.gz
-else
- cd ..
- tar -c ${prefix} | gzip -9 > ${verstring}.tar.gz
- cp ${verstring}.tar.gz $BASE
- cd $BASE
-fi
-
-mkdir ${BASE}/tmp
-cd ${BASE}/tmp
-tar -xzf ${BASE}/${verstring}.tar.gz
-rm ${BASE}/${verstring}.tar.gz
-
-cp ${BR}/scripts/.version ${BASE}/tmp/${prefix}/build-root/scripts
-tar -c ${prefix} | gzip -9 > ${verstring}.tar.gz
-mv ${verstring}.tar.gz ${BASE}
-
-cd ${BASE}
-rm -rf tmp
diff --git a/extras/rpm/Makefile b/extras/rpm/Makefile
new file mode 100644
index 00000000000..1dcbb203d0f
--- /dev/null
+++ b/extras/rpm/Makefile
@@ -0,0 +1,30 @@
+# Copyright (c) 2017 Cisco and/or its affiliates.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at:
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+
+TARBALL=$(shell realpath ../../build-root/vpp-latest.tar.xz)
+
+BASENAME=$(shell basename $(TARBALL) | sed -e s/.tar.\*//)
+VERSION=$(shell echo $(BASENAME) | cut -f2 -d-)
+RELEASE=$(shell echo $(BASENAME) | cut -f3- -d- | sed -e s/-/_/g)
+
+all:
+ @echo $(TARBALL)
+ mkdir -p SOURCES RPMS
+ cp $(TARBALL) SOURCES/vpp-latest.tar.xz
+ rpmbuild -bb \
+ --define "_topdir $(PWD)" \
+ --define "_version $(VERSION)" \
+ --define "_release $(RELEASE)" \
+ vpp.spec
+ mv $$(find RPMS -name \*.rpm -type f) .
diff --git a/build-root/rpm/vpp.service b/extras/rpm/vpp.service
index 40bf9d48c3b..40bf9d48c3b 100644
--- a/build-root/rpm/vpp.service
+++ b/extras/rpm/vpp.service
diff --git a/build-root/rpm/vpp.spec b/extras/rpm/vpp.spec
index 2cfe67c5dcb..55b20109e78 100644
--- a/build-root/rpm/vpp.spec
+++ b/extras/rpm/vpp.spec
@@ -1,11 +1,9 @@
-%define _mu_build_dir %{_mu_build_root_dir}
-%define _vpp_install_dir %{_install_dir}
%define _vpp_build_dir build-tool-native
%define _unitdir /lib/systemd/system
%define _topdir %(pwd)
%define _builddir %{_topdir}
-%define _version %(../scripts/version rpm-version)
-%define _release %(../scripts/version rpm-release)
+%define _mu_build_dir %{_topdir}/%{name}-%{_version}/build-root
+%define _vpp_install_dir install-vpp-native
# Failsafe backport of Python2-macros for RHEL <= 6
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
@@ -28,7 +26,8 @@ Release: %{_release}
Requires: vpp-lib = %{_version}-%{_release}, net-tools, pciutils, python
BuildRequires: systemd, chrpath
-Source: %{name}-%{_version}-%{_release}.tar.gz
+# Source: %{name}-%{_version}-%{_release}.tar.xz
+Source: vpp-latest.tar.xz
%description
This package provides VPP executables: vpp, vpp_api_test, vpp_json_test
@@ -102,6 +101,8 @@ This package contains the python bindings for the vpp api
groupadd -f -r vpp
%build
+make bootstrap
+make -C build-root PLATFORM=vpp TAG=vpp install-packages
cd %{_mu_build_dir}/../src/vpp-api/python && %py2_build
%install
@@ -120,7 +121,7 @@ mkdir -p -m755 %{buildroot}/usr/share/vpp/api
#
mkdir -p -m755 %{buildroot}/etc/vpp
mkdir -p -m755 %{buildroot}/etc/sysctl.d
-install -p -m 644 %{_mu_build_dir}/rpm/vpp.service %{buildroot}%{_unitdir}
+install -p -m 644 %{_topdir}/vpp.service %{buildroot}%{_unitdir}
install -p -m 644 %{_mu_build_dir}/../src/vpp/conf/startup.conf %{buildroot}/etc/vpp/startup.conf
install -p -m 644 %{_mu_build_dir}/../src/vpp/conf/80-vpp.conf %{buildroot}/etc/sysctl.d
#
diff --git a/src/scripts/version b/src/scripts/version
index d92eb8b70fc..d8728a9f6a8 100755
--- a/src/scripts/version
+++ b/src/scripts/version
@@ -4,16 +4,12 @@ path=$( cd "$(dirname "${BASH_SOURCE}")" ; pwd -P )
cd "$path"
-git rev-parse 2> /dev/null
-if [ $? == 0 ]; then
- vstring=$(git describe)
-elif [ -f .version ]; then
+if [ -f .version ]; then
vstring=$(cat .version)
else
- if [ -f ../rpm/*.gz ]; then
- vstring=$(ls ../rpm/*.gz)
- else
- exit 1
+ vstring=$(git describe)
+ if [ $? != 0 ]; then
+ exit 1
fi
fi