diff options
Diffstat (limited to 'rpm/Makefile.am')
-rw-r--r-- | rpm/Makefile.am | 62 |
1 files changed, 37 insertions, 25 deletions
diff --git a/rpm/Makefile.am b/rpm/Makefile.am index c7975e4..2388ad6 100644 --- a/rpm/Makefile.am +++ b/rpm/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2003-2022 the Pacemaker project contributors +# Copyright 2003-2023 the Pacemaker project contributors # # The version control history for this file may have further details. # @@ -12,7 +12,7 @@ # used in this file. top_srcdir ?= .. abs_srcdir ?= $(shell pwd) -abs_builddir ?= $(abs_srcdir) +abs_builddir ?= $(abs_srcdir) MAKE ?= make PACKAGE ?= pacemaker AM_V_at ?= @ @@ -21,9 +21,13 @@ MKDIR_P ?= mkdir -p include $(top_srcdir)/mk/common.mk include $(top_srcdir)/mk/release.mk -EXTRA_DIST = pacemaker.spec.in \ +EXTRA_DIST = pacemaker.spec.in \ rpmlintrc +# Extra options to pass to rpmbuild (this can be used to override the location +# options this file normally passes, or to override macros used by the spec) +RPM_EXTRA ?= + # Where to put RPM artifacts; possible values: # # - subtree (default): RPM sources (i.e. TARFILE) in top-level build directory, @@ -68,7 +72,7 @@ RPMTYPE = $(shell case "$(RPMDEST)" in \ esac) RPM_SPEC_DIR = $(RPM_SPEC_DIR_$(RPMTYPE)) RPM_SRCRPM_DIR = $(RPM_SRCRPM_DIR_$(RPMTYPE)) -RPM_OPTS = $(RPM_OPTS_$(RPMTYPE)) +RPM_OPTS = $(RPM_OPTS_$(RPMTYPE)) $(RPM_EXTRA) RPM_CLEAN = $(RPM_CLEAN_$(RPMTYPE)) WITH ?= --without doc @@ -90,7 +94,7 @@ SPEC_COMMIT ?= $(shell \ Pacemaker-*|DIST$(rparen) \ echo '$(TAG)' ;; \ *$(rparen) \ - git log --pretty=format:%h -n 1 '$(TAG)';; \ + "$(GIT)" log --pretty=format:%h -n 1 '$(TAG)';; \ esac)$(DIRTY_EXT) SPEC_ABBREV = $(shell printf %s '$(SPEC_COMMIT)' | wc -c) SPEC_RELEASE = $(shell case "$(WITH)" in \ @@ -115,6 +119,7 @@ TARFILE = $(abs_builddir)/../$(top_distdir).tar.gz # Create a source distribution based on a git archive. (If we aren't in a git # checkout, do a make dist instead.) +.PHONY: export export: cd $(abs_srcdir)/..; \ if [ -z "$(CHECKOUT)" ] && [ -f "$(TARFILE)" ]; then \ @@ -123,35 +128,40 @@ export: $(MAKE) $(AM_MAKEFLAGS) dist; \ echo "`date`: Rebuilt tarball: $(TARFILE)"; \ elif [ -n "$(DIRTY_EXT)" ]; then \ - git commit -m "DO-NOT-PUSH" -a; \ - git archive --prefix=$(top_distdir)/ -o "$(TARFILE)" HEAD^{tree}; \ - git reset --mixed HEAD^; \ + "$(GIT)" commit -m "DO-NOT-PUSH" -a; \ + "$(GIT)" archive --prefix=$(top_distdir)/ -o "$(TARFILE)" \ + HEAD^{tree}; \ + "$(GIT)" reset --mixed HEAD^; \ echo "`date`: Rebuilt $(TARFILE)"; \ elif [ -f "$(TARFILE)" ]; then \ echo "`date`: Using existing tarball: $(TARFILE)"; \ else \ - git archive --prefix=$(top_distdir)/ -o "$(TARFILE)" $(TAG)^{tree}; \ + "$(GIT)" archive --prefix=$(top_distdir)/ -o "$(TARFILE)" \ + $(TAG)^{tree}; \ echo "`date`: Rebuilt $(TARFILE)"; \ fi # Depend on spec-clean so the spec gets rebuilt every time $(RPM_SPEC_DIR)/$(PACKAGE).spec: spec-clean pacemaker.spec.in $(AM_V_at)$(MKDIR_P) "$(RPM_SPEC_DIR)" - $(AM_V_GEN)if [ x"`git ls-files -m pacemaker.spec.in 2>/dev/null`" != x ]; then \ - cat "$(abs_srcdir)/pacemaker.spec.in"; \ - elif git cat-file -e $(TAG):rpm/pacemaker.spec.in 2>/dev/null; then \ - git show $(TAG):rpm/pacemaker.spec.in; \ - elif git cat-file -e $(TAG):pacemaker.spec.in 2>/dev/null; then \ - git show $(TAG):pacemaker.spec.in; \ - else \ - cat "$(abs_srcdir)/pacemaker.spec.in"; \ - fi | sed \ - -e 's/^\(%global pcmkversion \).*/\1$(SPEC_RELEASE_NO)/' \ - -e 's/^\(%global specversion \).*/\1$(SPECVERSION)/' \ - -e 's/^\(%global commit \).*/\1$(SPEC_COMMIT)/' \ - -e 's/^\(%global commit_abbrev \).*/\1$(SPEC_ABBREV)/' \ - -e "s/PACKAGE_DATE/$$(date +'%a %b %d %Y')/" \ - -e 's/PACKAGE_VERSION/$(SPEC_RELEASE_NO)-$(SPECVERSION)/' \ + $(AM_V_GEN)if [ x"`"$(GIT)" ls-files \ + -m pacemaker.spec.in 2>/dev/null`" != x ]; then \ + cat "$(abs_srcdir)/pacemaker.spec.in"; \ + elif "$(GIT)" cat-file -e $(TAG):rpm/pacemaker.spec.in \ + 2>/dev/null; then \ + "$(GIT)" show $(TAG):rpm/pacemaker.spec.in; \ + elif "$(GIT)" cat-file -e $(TAG):pacemaker.spec.in 2>/dev/null; \ + then \ + "$(GIT)" show $(TAG):pacemaker.spec.in; \ + else \ + cat "$(abs_srcdir)/pacemaker.spec.in"; \ + fi | sed \ + -e 's/^\(%global pcmkversion \).*/\1$(SPEC_RELEASE_NO)/' \ + -e 's/^\(%global specversion \).*/\1$(SPECVERSION)/' \ + -e 's/^\(%global commit \).*/\1$(SPEC_COMMIT)/' \ + -e 's/^\(%global commit_abbrev \).*/\1$(SPEC_ABBREV)/' \ + -e "s/PACKAGE_DATE/$$(date +'%a %b %d %Y')/" \ + -e 's/PACKAGE_VERSION/$(SPEC_RELEASE_NO)-$(SPECVERSION)/' \ > "$@" .PHONY: spec $(PACKAGE).spec @@ -200,7 +210,7 @@ rc: echo 'This target must be run from a git checkout'; \ exit 1; \ fi - $(MAKE) $(AM_MAKEFLAGS) TAG="$$(git tag -l 2>/dev/null \ + $(MAKE) $(AM_MAKEFLAGS) TAG="$$("$(GIT)" tag -l 2>/dev/null \ | sed -n -e 's/^\(Pacemaker-[0-9.]*-rc[0-9]*\)$$/\1/p' \ | sort -Vr | head -n 1)" rpm @@ -251,6 +261,7 @@ mock-clean: -rm -rf "$(MOCK_DIR)" # Make debugging makefile issues easier +.PHONY: vars vars: @echo "CHECKOUT=$(CHECKOUT)" @echo "VERSION=$(VERSION)" @@ -278,5 +289,6 @@ vars: @echo "SPEC_RELEASE_NO=$(SPEC_RELEASE_NO)" @echo "TARFILE=$(TARFILE)" +.PHONY: clean-local clean-local: mock-clean rpm-clean -rm -f "$(TARFILE)" |