From: Ben Crocker <bcrocker@xxxxxxxxxx> GIT ?= git and replace literal occurrences of 'git' with $(GIT). This change enables us to override 'git' with, e.g., some arbitrary shell script that prints additional information and/or does additional processing before and/or after (or even instead of) invoking /usr/bin/git. Signed-off-by: Ben Crocker <bcrocker@xxxxxxxxxx> --- redhat/Makefile | 33 +++++++++++++++++---------------- redhat/Makefile.common | 16 ++++++++-------- 2 files changed, 25 insertions(+), 24 deletions(-) diff --git a/redhat/Makefile b/redhat/Makefile index 7130f4e25c8c..d74a0d3a27c1 100644 --- a/redhat/Makefile +++ b/redhat/Makefile @@ -1,3 +1,4 @@ +GIT ?= git include Makefile.common include Makefile.rhpkg @@ -32,8 +33,8 @@ endif BUILD_TARGET ?= --scratch $(BUILD_SCRATCH_TARGET) FLAVOR = -RHGITURL?=$(shell git config rhg.url || git config remote.origin.url) -RHGITCOMMIT?=$(shell git log -1 --pretty=format:%H) +RHGITURL?=$(shell $(GIT) config rhg.url || $(GIT) config remote.origin.url) +RHGITCOMMIT?=$(shell $(GIT) log -1 --pretty=format:%H) # this section is needed in order to make O= to work _OUTPUT := .. @@ -199,7 +200,7 @@ $(KABIDW_TARBALL): dist-git-version-check: @# genspec.sh uses pathspec magic that wasn't introduced until version 2.13 @IFS=" ."; \ - set -- $$(git --version); \ + set -- $$($(GIT) --version); \ IFS=; \ if [ "$$3" -lt 2 -o \( "$$3" -eq 2 -a "$$4" -lt 13 \) ]; then \ echo "ERROR: You need git version 2.13 or newer to run some setup commands"; \ @@ -219,7 +220,7 @@ setup-source: dist-git-version-check dist-clean-sources sources-rh: $(TARBALL) @cp -l $(TARBALL) $(SOURCES)/ || cp $(TARBALL) $(SOURCES)/ @touch $(TESTPATCH) - @git diff --no-renames HEAD > $(TESTPATCH).tmp + @$(GIT) diff --no-renames HEAD > $(TESTPATCH).tmp @# 1) filterdiff will return crap from the patches it just filtered, @# that's why egrep is needed so if there're changes under redhat/ @# but not everywhere else, it will be empty just like @@ -265,7 +266,7 @@ sources-rh: $(TARBALL) dist-sources: setup-source dist-configs-check dist-kabi dist-kabi-dup sources-rh dist-test-patch: - @git diff --no-renames HEAD > $(TESTPATCH); + @$(GIT) diff --no-renames HEAD > $(TESTPATCH); @($(FILTERDIFF) $(TESTPATCH) | egrep -v "^index|^diff" >$(TESTPATCH).tmp; true) @mv $(TESTPATCH).tmp $(TESTPATCH); @@ -298,43 +299,43 @@ dist-rpm-baseonly: dist-sources # unless you know what you're doing, you don't want to use the next four ones dist-release-finish: setup-source @cp $(SOURCES)/$(CHANGELOG) $(REDHAT)/$(CHANGELOG) - @git add $(REDHAT)/$(CHANGELOG) - @git add $(REDHAT)/marker - @git commit -s ../Makefile.rhelver $(REDHAT)/marker $(REDHAT)/$(CHANGELOG) $(PACKAGE_NAME).spec.template -m "[redhat] $(PACKAGE_NAME)-$(STAMP_VERSION)-$(PREBUILD)$(BUILD)$(BUILDID)" + @$(GIT) add $(REDHAT)/$(CHANGELOG) + @$(GIT) add $(REDHAT)/marker + @$(GIT) commit -s ../Makefile.rhelver $(REDHAT)/marker $(REDHAT)/$(CHANGELOG) $(PACKAGE_NAME).spec.template -m "[redhat] $(PACKAGE_NAME)-$(STAMP_VERSION)-$(PREBUILD)$(BUILD)$(BUILDID)" dist-release-changed: setup-source @cp $(SOURCES)/$(CHANGELOG) $(REDHAT)/$(CHANGELOG) @echo $(MARKER) > $(REDHAT)/marker @# if neither changelog nor marker was updated, skip bumping a release - @git update-index -q --really-refresh - @if git diff-index --quiet HEAD; then \ + @$(GIT) update-index -q --really-refresh + @if $(GIT) diff-index --quiet HEAD; then \ echo "Nothing changed, skipping updates"; \ else \ - git checkout -- $(REDHAT)/$(CHANGELOG); \ + $(GIT) checkout -- $(REDHAT)/$(CHANGELOG); \ $(REDHAT)/scripts/new_release.sh $(REDHAT) $(__YSTREAM) $(__ZSTREAM); \ $(MAKE) dist-release-finish; \ fi dist-release: dist-clean-sources @$(MAKE) dist-release-changed dist-release-tag: - @git tag -a -m "$(PACKAGE_NAME)-$(STAMP_VERSION)-$(PKGRELEASE)" $(PACKAGE_NAME)-$(STAMP_VERSION)-$(PKGRELEASE) + @$(GIT) tag -a -m "$(PACKAGE_NAME)-$(STAMP_VERSION)-$(PKGRELEASE)" $(PACKAGE_NAME)-$(STAMP_VERSION)-$(PKGRELEASE) git-tree-check: - @if test -n "$(DIST_PUSH)" && test -z "$(shell git remote get-url gitlab 2>/dev/null)"; then \ + @if test -n "$(DIST_PUSH)" && test -z "$(shell $(GIT) remote get-url gitlab 2>/dev/null)"; then \ echo -e "Please run 'git remote add gitlab <url>' to enable git-push.\n"; \ exit 1; \ fi - @git diff-index --quiet HEAD || \ + @$(GIT) diff-index --quiet HEAD || \ { echo -e "Dirty tree, please clean before merging.\n"; exit 1; } DIST_BRANCH ?= "os-build" dist-merge-upstream: git-tree-check - @if test "$(shell git branch --show-current)" != "$(DIST_BRANCH)"; then \ + @if test "$(shell $(GIT) branch --show-current)" != "$(DIST_BRANCH)"; then \ echo -e "Please checkout $(DIST_BRANCH) branch before merging.\n"; \ exit 1; \ fi; @# If TAG is empty, script defaults to master:HEAD - @git checkout $(DIST_BRANCH) + @$(GIT) checkout $(DIST_BRANCH) @cd ..; $(REDHAT)/scripts/ci/ark-update-configs.sh $(TAG) dist-merge-upstream-push: export DIST_PUSH="1" diff --git a/redhat/Makefile.common b/redhat/Makefile.common index b335f3c77c7d..80c3b8dfccd4 100644 --- a/redhat/Makefile.common +++ b/redhat/Makefile.common @@ -1,4 +1,4 @@ -TOPDIR:=$(shell git rev-parse --show-toplevel) +TOPDIR:=$(shell $(GIT) rev-parse --show-toplevel) REDHAT:=$(TOPDIR)/redhat include $(TOPDIR)/Makefile.rhelver @@ -6,11 +6,11 @@ RPMBUILD := $(shell if [ -x "/usr/bin/rpmbuild" ]; then echo rpmbuild; \ else echo rpm; fi) MACH := $(shell uname -m) -RPMKVERSION:=$(shell git show HEAD:Makefile | sed -ne '/^VERSION\ =\ /{s///;p;q}') -RPMKPATCHLEVEL:=$(shell git show HEAD:Makefile | sed -ne '/^PATCHLEVEL\ =\ /{s///;p;q}') -RPMKSUBLEVEL:=$(shell git show HEAD:Makefile | sed -ne '/^SUBLEVEL\ =\ /{s///;p;q}') -RPMKEXTRAVERSION:=$(shell git show HEAD:Makefile | sed -ne '/^EXTRAVERSION\ =\ /{s///;p;q}') -GITID:= $(shell git log --max-count=1 --pretty=format:%H) +RPMKVERSION:=$(shell $(GIT) show HEAD:Makefile | sed -ne '/^VERSION\ =\ /{s///;p;q}') +RPMKPATCHLEVEL:=$(shell $(GIT) show HEAD:Makefile | sed -ne '/^PATCHLEVEL\ =\ /{s///;p;q}') +RPMKSUBLEVEL:=$(shell $(GIT) show HEAD:Makefile | sed -ne '/^SUBLEVEL\ =\ /{s///;p;q}') +RPMKEXTRAVERSION:=$(shell $(GIT) show HEAD:Makefile | sed -ne '/^EXTRAVERSION\ =\ /{s///;p;q}') +GITID:= $(shell $(GIT) log --max-count=1 --pretty=format:%H) # marker is git tag which we base off of for exporting patches # Make sure marker uses RPMKPATCHLEVEL and RPMKEXTRAVERSION from the kernel # makefile as opposed to any adjusted version for snapshotting. @@ -42,8 +42,8 @@ else endif ifeq ($(VERSION_ON_UPSTREAM),1) # master is expected to track mainline. - MERGE_BASE:=$(shell git merge-base HEAD master) - _TAG:=$(shell git describe $(MERGE_BASE)) + MERGE_BASE:=$(shell $(GIT) merge-base HEAD master) + _TAG:=$(shell $(GIT) describe $(MERGE_BASE)) # a snapshot off of a tagged git is of the form [tag]-[cnt]-g[hash] SNAPSHOT:=$(shell echo $(_TAG) | grep -c '\-g') else -- GitLab _______________________________________________ kernel mailing list -- kernel@xxxxxxxxxxxxxxxxxxxxxxx To unsubscribe send an email to kernel-leave@xxxxxxxxxxxxxxxxxxxxxxx Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/kernel@xxxxxxxxxxxxxxxxxxxxxxx