On Sat, Sep 05, 2020 at 04:10:31AM -0000, GitLab Bridge on behalf of bcrocker wrote:
From: Ben Crocker <bcrocker(a)redhat.com>
In redhat/Makefile and redhat/Makefile.common, introduce a
GIT macro:
GIT ?= git
which takes on the value from the environment, if it
exists, and defaults to 'git' otherwise.
Replace instances of "git" with "$(GIT)", e.g.
RHGITCOMMIT?=$(shell $(GIT) log -1 --pretty=format:%H)
Also, add a dist-dump-variables target in Makefile.
Oops, should respond to this version looking for output data.
Cheers,
Don
Signed-off-by: Ben Crocker <bcrocker(a)redhat.com>
---
redhat/Makefile | 43 +++++++++++++++++++++++++++++++++++++++---
redhat/Makefile.common | 16 ++++++++--------
2 files changed, 48 insertions(+), 11 deletions(-)
diff --git a/redhat/Makefile b/redhat/Makefile
index 7cdf9e3bd0bf..f5486915da10 100644
--- a/redhat/Makefile
+++ b/redhat/Makefile
@@ -1,3 +1,4 @@
+GIT ?= git
include Makefile.common
include Makefile.rhpkg
@@ -39,8 +40,8 @@ endif
BUILD_TARGET ?= --scratch $(BUILD_SCRATCH_TARGET)
FLAVOR ?= rhel
-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 := ..
@@ -206,7 +207,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";
\
@@ -358,6 +359,42 @@ dist-get-latest:
dist-os-version:
@echo "OSVERSION: $(RHEL_MAJOR).$(RHEL_MINOR)"
+dist-dump-variables:
+ @echo "GIT = $(GIT)"
+ @echo "RPMKVERSION = $(RPMKVERSION)"
+ @echo "RPMKPATCHLEVEL = $(RPMKPATCHLEVEL)"
+ @echo "RPMKSUBLEVEL = $(RPMKSUBLEVEL)"
+ @echo "RPMKEXTRAVERSION = $(RPMKEXTRAVERSION)"
+ @echo "GITID = $(GITID)"
+ @echo "MARKER = $(MARKER)"
+ @echo "KEXTRAVERSION = $(KEXTRAVERSION)"
+ @echo "PREBUILD = $(PREBUILD)"
+ @echo "UPSTREAM_TARBALL_NAME = $(UPSTREAM_TARBALL_NAME)"
+ @echo "DIST = $(DIST)"
+ @echo "IS_FEDORA = $(IS_FEDORA)"
+ @echo "VERSION_ON_UPSTREAM = $(VERSION_ON_UPSTREAM)"
+ @echo "MERGE_BASE = $(MERGE_BASE)"
+ @echo "TAG = $(TAG)"
+ @echo "SNAPSHOT = $(SNAPSHOT)"
+ @echo "KVERSION = $(KVERSION)"
+ @echo "RPMVERSION = $(RPMVERSION)"
+ @echo "BUILD = $(BUILD)"
+ @echo "RELEASED_KERNEL = $(RELEASED_KERNEL)"
+ @echo "STAMP_VERSION = $(STAMP_VERSION)"
+ @echo "PKGRELEASE = $(PKGRELEASE)"
+ @echo "SPECRELEASE = $(SPECRELEASE)"
+ @echo "TARFILE_RELEASE = $(TARFILE_RELEASE)"
+ @echo "TARFILE = $(TARFILE)"
+ @echo "TARBALL = $(TARBALL)"
+ @echo "DISTRO_BUILD = $(DISTRO_BUILD)"
+ @echo "KABI_TARFILE = $(KABI_TARFILE)"
+ @echo "KABI_TARBALL = $(KABI_TARBALL)"
+ @echo "KABIDW_TARFILE = $(KABIDW_TARFILE)"
+ @echo "KABIDW_TARBALL = $(KABIDW_TARBALL)"
+ @echo "CHANGELOG = $(CHANGELOG)"
+ @echo "CHANGELOG_PREV = $(CHANGELOG_PREV)"
+ @echo "RHPRODUCT = $(RHPRODUCT)"
+
dist-help:
@echo 'Cleaning targets:'
@echo ' dist-clean - Clean redhat/configs/ and redhat/rpm/
directories.'
diff --git a/redhat/Makefile.common b/redhat/Makefile.common
index e7fb532874e3..81a07a8b8ed1 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(a)lists.fedoraproject.org
To unsubscribe send an email to kernel-leave(a)lists.fedoraproject.org
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@lists.fedoraproject.org