summaryrefslogtreecommitdiffstats
path: root/extras/rpm
diff options
context:
space:
mode:
authorThomas F Herbert <therbert@redhat.com>2017-07-19 19:17:15 -0400
committerNeale Ranns <nranns@cisco.com>2017-08-08 15:29:11 +0000
commitb60f4965bf6f51eb746e18fa0307af8e3444bf96 (patch)
treee0522500ce15459996f804d7bde197c41546177a /extras/rpm
parent80cb2584c3fecec59c75f94726a95d2b2adce188 (diff)
Create source rpm.
Use actual file name for tarball. Includes required modifications in spec file for unpacking srpm. Spec file source references actual dist tarball name so it matches the revision and release while building from srpm. JIRA: VPP-498 Change-Id: I8b55a69f060b7864527b94d8c5b0a2ebccc306b1 Signed-off-by: Thomas F Herbert <therbert@redhat.com>
Diffstat (limited to 'extras/rpm')
-rw-r--r--extras/rpm/Makefile22
-rw-r--r--extras/rpm/vpp.spec4
2 files changed, 21 insertions, 5 deletions
diff --git a/extras/rpm/Makefile b/extras/rpm/Makefile
index 1dcbb203d0f..534e4d43f99 100644
--- a/extras/rpm/Makefile
+++ b/extras/rpm/Makefile
@@ -17,11 +17,27 @@ 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)
+PC=%
-all:
+all: RPM
+
+srpm:
+ @echo $(TARBALL)
+ mkdir -p rpmbuild/{RPMS,SRPMS,BUILD,SOURCES,SPECS}
+ cp $(TARBALL) rpmbuild/SOURCES/vpp-$(VERSION)-$(RELEASE).tar.xz
+ cp vpp.spec rpmbuild/SOURCES
+ sed -i '1s/^/$(PC)define _version $(VERSION)\n/' rpmbuild/SOURCES/vpp.spec
+ sed -i '1s/^/$(PC)define _release $(RELEASE)\n/' rpmbuild/SOURCES/vpp.spec
+ sed -i '/define _topdir/d' rpmbuild/SOURCES/vpp.spec
+ rpmbuild -bs \
+ --define "_topdir rpmbuild" \
+ rpmbuild/SOURCES/vpp.spec
+ mv $$(find rpmbuild/SRPMS -name \*.src.rpm -type f) .
+
+RPM:
@echo $(TARBALL)
- mkdir -p SOURCES RPMS
- cp $(TARBALL) SOURCES/vpp-latest.tar.xz
+ mkdir -p RPMS SOURCES
+ cp $(TARBALL) SOURCES/vpp-$(VERSION)-$(RELEASE).tar.xz
rpmbuild -bb \
--define "_topdir $(PWD)" \
--define "_version $(VERSION)" \
diff --git a/extras/rpm/vpp.spec b/extras/rpm/vpp.spec
index 3644570d117..ffb6382fefd 100644
--- a/extras/rpm/vpp.spec
+++ b/extras/rpm/vpp.spec
@@ -30,8 +30,8 @@ Release: %{_release}
Requires: vpp-lib = %{_version}-%{_release}, net-tools, pciutils, python
BuildRequires: systemd, chrpath
-# Source: %{name}-%{_version}-%{_release}.tar.xz
-Source: vpp-latest.tar.xz
+Source: %{name}-%{_version}-%{_release}.tar.xz
+# Source: vpp-latest.tar.xz
%description
This package provides VPP executables: vpp, vpp_api_test, vpp_json_test