diff options
author | Marco Varlese <marco.varlese@suse.com> | 2017-11-29 16:13:04 +0100 |
---|---|---|
committer | Damjan Marion <dmarion.lists@gmail.com> | 2017-11-30 08:48:49 +0000 |
commit | aba730fc0dc54a804af27a826e730e2bea72183e (patch) | |
tree | 021330a73359f286ba1408703841fd7a3f56d0c8 /extras/rpm | |
parent | 837503cf66c432355b37db842ac5b0ee37c18085 (diff) |
Cleanup and simplify
This patch addresses two things:
1) It simplifies the Makefile to build RPMs by removing duplication and
use environment variables instead;
2) It aligns openSUSE with others with regards to invoke "pkg-rpm" by
the build.sh for Vagrant
Change-Id: I51557f54e4ddf49d83bb69fa0035c8fff122857e
Signed-off-by: Marco Varlese <marco.varlese@suse.com>
Diffstat (limited to 'extras/rpm')
-rw-r--r-- | extras/rpm/Makefile | 44 |
1 files changed, 13 insertions, 31 deletions
diff --git a/extras/rpm/Makefile b/extras/rpm/Makefile index 4ec1e622616..5d965f95c21 100644 --- a/extras/rpm/Makefile +++ b/extras/rpm/Makefile @@ -26,41 +26,24 @@ PC=% all: RPM ifeq ($(filter opensuse,$(OS_ID)),$(OS_ID)) -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-suse.spec - sed -i '1s/^/$(PC)define _release $(RELEASE)\n/' rpmbuild/SOURCES/vpp-suse.spec - sed -i '/define _topdir/d' rpmbuild/SOURCES/vpp-suse.spec - rpmbuild -bs \ - --define "_topdir rpmbuild" \ - rpmbuild/SOURCES/vpp-suse.spec - mv $$(find rpmbuild/SRPMS -name \*.src.rpm -type f) . - -RPM: - @echo $(TARBALL) - mkdir -p RPMS SOURCES - cp $(TARBALL) SOURCES/vpp-$(VERSION)-$(RELEASE).tar.xz - rpmbuild -bb \ - --define "_topdir $(CURDIR)" \ - --define "_version $(VERSION)" \ - --define "_release $(RELEASE)" \ - vpp-suse.spec - mv $$(find RPMS -name \*.rpm -type f) . +TOPDIR=$(CURDIR) +SPEC_FILE='vpp-suse.spec' else +TOPDIR=$(PWD) +SPEC_FILE='vpp.spec' +endif + 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 + cp $(SPEC_FILE) rpmbuild/SOURCES + sed -i '1s/^/$(PC)define _version $(VERSION)\n/' rpmbuild/SOURCES/$(SPEC_FILE) + sed -i '1s/^/$(PC)define _release $(RELEASE)\n/' rpmbuild/SOURCES/$(SPEC_FILE) + sed -i '/define _topdir/d' rpmbuild/SOURCES/$(SPEC_FILE) rpmbuild -bs \ --define "_topdir rpmbuild" \ - rpmbuild/SOURCES/vpp.spec + rpmbuild/SOURCES/$(SPEC_FILE) mv $$(find rpmbuild/SRPMS -name \*.src.rpm -type f) . RPM: @@ -68,9 +51,8 @@ RPM: mkdir -p RPMS SOURCES cp $(TARBALL) SOURCES/vpp-$(VERSION)-$(RELEASE).tar.xz rpmbuild -bb \ - --define "_topdir $(PWD)" \ + --define "_topdir $(TOPDIR)" \ --define "_version $(VERSION)" \ --define "_release $(RELEASE)" \ - vpp.spec + $(SPEC_FILE) mv $$(find RPMS -name \*.rpm -type f) . -endif |