Juan Hernandez has uploaded a new change for review. Change subject: sdk: Always generate the tarball when building RPMs ......................................................................
sdk: Always generate the tarball when building RPMs Currently when building a RPM the tarball is generated using the "git archive" command and the HEAD tree. This means that changes that haven't been locally commited aren't included in the result. In addition the tarball is only generated if there were changes in the Makefile or the .spec template, which has the same effect. To avoid these two issues this patch changes the command used to build the tarball and also changes the Makefile so that the tarball is always regenerated. Change-Id: Ib16253e18f39ff4bafef1fcdebe21e8f456b4b23 Signed-off-by: Juan Hernandez <[email protected]> --- M Makefile M ovirt-engine-sdk-python.spec.in 2 files changed, 34 insertions(+), 29 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine-sdk refs/changes/54/39854/1 diff --git a/Makefile b/Makefile index b277d7c..9a7b00e 100644 --- a/Makefile +++ b/Makefile @@ -1,39 +1,44 @@ all: rpm -rpmrelease:=0.11$(rpmsuffix) -rpmversion=3.6.0.0 -RPMTOP=$(shell bash -c "pwd -P")/rpmtop -SPEC=ovirt-engine-sdk-python.spec +PWD=$(shell bash -c "pwd -P") +version=3.6.0.0 +rpmversion=$(version) +rpmdist=$(shell rpm --eval '%dist') +rpmrelease:=0.11$(rpmsuffix)$(rpmdist) -TARBALL=ovirt-engine-sdk-python-$(rpmversion).tar.gz -SRPM=$(RPMTOP)/SRPMS/ovirt-engine-sdk-python-$(rpmversion)-$(rpmrelease)*.src.rpm +RPMTOP=$(PWD)/rpmtop +NAME=ovirt-engine-sdk-python +SPEC=$(NAME).spec -TESTS=pyflakes +TARBALL=$(NAME)-$(version).tar.gz +SRPM=$(RPMTOP)/SRPMS/$(NAME)-$(rpmversion)-$(rpmrelease).src.rpm -test: pyflakes exceptions - echo $(rpmrelease) $(rpmversion) - -pyflakes: - @git ls-files '*.py' | xargs pyflakes \ - || (echo "Pyflakes errors or pyflakes not found"; exit 1) +.PHONY: spec +spec: $(SPEC).in + sed \ + -e 's/@RPM_VERSION@/$(rpmversion)/g' \ + -e 's/@RPM_RELEASE@/$(rpmrelease)/g' \ + -e 's/@TARBALL@/$(TARBALL)/g' \ + < $(SPEC).in \ + > $(SPEC) .PHONY: tarball -tarball: $(TARBALL) -$(TARBALL): Makefile #$(TESTS) - git archive --format=tar --prefix ovirt-engine-sdk-python/ HEAD | gzip > $(TARBALL) +tarball: spec + git ls-files | tar --transform='s|^|$(NAME)/|' --files-from /proc/self/fd/0 -czf $(TARBALL) $(SPEC) -.PHONY: srpm rpm -srpm: $(SRPM) -$(SRPM): $(TARBALL) ovirt-engine-sdk-python.spec.in - sed 's/^Version:.*/Version: $(rpmversion)/;s/^Release:.*/Release: $(rpmrelease)%{dist}/;s/%{release}/$(rpmrelease)/' ovirt-engine-sdk-python.spec.in > $(SPEC) - mkdir -p $(RPMTOP)/{RPMS,SRPMS,SOURCES,BUILD} - rpmbuild -bs \ - --define="_topdir $(RPMTOP)" \ - --define="_sourcedir ." $(SPEC) +.PHONY: srpm +srpm: tarball + rpmbuild \ + --define="_topdir $(RPMTOP)" \ + -ts $(TARBALL) -rpm: $(SRPM) - rpmbuild --define="_topdir $(RPMTOP)" --rebuild $< +.PHONY: rpm +rpm: srpm + rpmbuild \ + --define="_topdir $(RPMTOP)" \ + --rebuild $(SRPM) +.PHONY: clean clean: - $(RM) *~ *.pyc ovirt-engine-sdk*.tar.gz $(SPEC) + $(RM) $(NAME)*.tar.gz $(SPEC) $(RM) -r rpmtop diff --git a/ovirt-engine-sdk-python.spec.in b/ovirt-engine-sdk-python.spec.in index 223a9b9..2c892e1 100644 --- a/ovirt-engine-sdk-python.spec.in +++ b/ovirt-engine-sdk-python.spec.in @@ -1,6 +1,6 @@ Name: ovirt-engine-sdk-python -Version: [?] -Release: 1%{?dist} +Version: @RPM_VERSION@ +Release: @RPM_RELEASE@ Summary: oVirt Engine Software Development Kit (Python) Group: Development/Libraries License: ASL 2.0 -- To view, visit https://gerrit.ovirt.org/39854 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib16253e18f39ff4bafef1fcdebe21e8f456b4b23 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine-sdk Gerrit-Branch: master Gerrit-Owner: Juan Hernandez <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
