Removed customized rpm macros that should really be set by users ~/.rpmmacros directory. This removed need for custom tar target, as we can now use dist and rpmbuild -ta instead. Still need to have custom RPM_FLAGS for ovirt specific overrides like OVIRT_CACHE_DIR (used by appliance and node-image spec files) Removed unused bumprelease, bumpversion and setversion targets Removed other unused make variables Simplified publish to just rsync all RPMS frpm the rpmdir. Added seconds granularity to git tag for bumpgit target. Made it so version file is no longer edited by makefile. Instead version.out is created either as a simple cp or in the case of bumpgit the bumpgit target output. Specfile now uses version.out for getting version info. Signed-off-by: Perry Myers <pmyers at redhat.com> --- .gitignore | 2 +- Makefile.am | 8 ++++---- ovirt-node.spec | 2 +- release.mk | 42 ++++++++++-------------------------------- 4 files changed, 16 insertions(+), 38 deletions(-) diff --git a/.gitignore b/.gitignore index 7824d79..cb92381 100644 --- a/.gitignore +++ b/.gitignore @@ -11,5 +11,5 @@ depcomp install-sh missing stamp-h1 -rpm-build ovirt-node*.gz +version.out diff --git a/Makefile.am b/Makefile.am index f9478db..9118f7f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -22,6 +22,7 @@ EXTRA_DIST = \ ovirt-node.spec \ release.mk \ version \ + version.out \ scripts/collectd \ scripts/collectd.conf.in \ scripts/ovirt \ @@ -32,10 +33,9 @@ EXTRA_DIST = \ logrotate/ovirt-logrotate \ logrotate/ovirt-logrotate.conf +CLEANFILES = \ + version.out + include release.mk pkg_name = $(PACKAGE_NAME) -.PHONY: tar -tar: dist - mkdir -p rpm-build/BUILDROOT - cp version $(distdir).tar.gz rpm-build diff --git a/ovirt-node.spec b/ovirt-node.spec index 303d353..908fe45 100644 --- a/ovirt-node.spec +++ b/ovirt-node.spec @@ -1,6 +1,6 @@ Summary: The oVirt Node daemons/scripts Name: ovirt-node -Source1: version +Source1: version.out Version: %(echo `awk '{ print $1 }' %{SOURCE1}`) Release: %(echo `awk '{ print $2 }' %{SOURCE1}`)%{?dist}%{?extra_release} Source0: %{name}-%{version}.tar.gz diff --git a/release.mk b/release.mk index 7d9ddd0..f2bcb48 100644 --- a/release.mk +++ b/release.mk @@ -11,45 +11,23 @@ NEWRELEASE = $$(($(RELEASE) + 1)) X = $$(awk '{ split($$2,r,"."); \ printf("%d.%d\n", r[1], r[2]+1) }' $(srcdir)/version) git_head = $$(git log -1 --pretty=format:%h) -GITRELEASE = $(X).$$(date --utc +%Y%m%d%H%M)git$(git_head) -DIST = $$(rpm --eval '%{dist}') - -SPEC_FILE = $(pkg_name).spec +GITRELEASE = $(X).$$(date --utc +%Y%m%d%H%M%S)git$(git_head) +RPMDIR = $$(rpm --eval '%{_rpmdir}') +RPM_FLAGS = --define "ovirt_cache_dir $(OVIRT_CACHE_DIR)" OVIRT_CACHE_DIR ?= $(HOME)/ovirt-cache -NV = $(pkg_name)-$(VERSION) -RPM_FLAGS = \ - --define "_topdir %(pwd)/rpm-build" \ - --define "_builddir %{_topdir}" \ - --define "_rpmdir %{_topdir}" \ - --define "_srcrpmdir %{_topdir}" \ - --define '_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm' \ - --define "_specdir %{_topdir}" \ - --define "_sourcedir %{_topdir}" \ - --define "ovirt_cache_dir $(OVIRT_CACHE_DIR)" - bumpgit: - echo "$(VERSION) $(GITRELEASE)" > version - -bumprelease: - echo "$(VERSION) $(NEWRELEASE)" > version - -bumpversion: - echo "$(NEWVERSION) 1" > version - -setversion: - echo "$(VERSION) $(RELEASE)" > version + echo "$(VERSION) $(GITRELEASE)" > version.out -new-rpms: bumprelease rpms +version.out: + cp -a version version.out -rpms: tar - rpmbuild $(RPM_FLAGS) -ba $(SPEC_FILE) +rpms: dist + rpmbuild $(RPM_FLAGS) -ta $(distdir).tar.gz publish: rpms - rm -f $(OVIRT_CACHE_DIR)/ovirt/$(pkg_name)* - mkdir -p $(OVIRT_CACHE_DIR)/ovirt - cp -a rpm-build/$(pkg_name)*.rpm $(OVIRT_CACHE_DIR)/ovirt + rsync -aq --delete $(shell rpm --eval '%{_rpmdir}')/ $(OVIRT_CACHE_DIR)/ovirt/ createrepo $(OVIRT_CACHE_DIR)/ovirt -.PHONY: rpms new-rpms publish setversion bumprelease bumpversion bumpgit +.PHONY: rpms publish bumpgit -- 1.5.5.1