[RFC ARK PATCH v2] redhat: Implement Makefile.dist

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



dzickus, jforbes, and bcrocker,

The reason adding a

include makefile

didn't work is that there was an additional variable that had to be
specified, no-dot-config-targets, which  must be populated with
the dist-% and distg-% targets.  If you don't do that then the
top-level Makefile will look for a .config, and that was the source
of the weird error I and dzickus saw the other week.

Once I figured that out, the rest was pretty simple and leads to the
attached patch.  Most of the patch is a search-and-replace of
Makefile.rhelver for Makefile.dist.  The "guts" of the patch are
the actual Makefile modifications themselves.

I wish we had a way to test everything out.  I'll try my best to
verify nothing is broken over the next few days and we can discuss
in Thursday's meeting.

Quick note on the '-include'.  The negative sign means that the file
is optional.

Comments welcomed of course,

P.

v2: cc'ing fedora list

---8<---

One of the nice things about the RHEL and ARK trees is that commands like
'make dist-configs' and 'make dist-help' can be executed from the
top-level linux directory.

In the existing code, the makefile includes the top-level linux Makefile
if the targets are not dist-* or distg-*.  Otherwise the commands are
executed with the redhat/Makefile* files.  This is clunky and requires the
inclusion of the makefile in .gitignore which causes problems when
upstream modifies .gitignore.

A better approach is to include the code in a top-level Makefile.dist.
This change can then be moved upstream for inclusion with a oneline patch
to include Makefile.dist.  Makefile.dist would not be included in the
gitignore file because we want to track changes for the file in our
own tree.

Move the makefile and Makefile.rhelver code into Makefile.dist, and
include Makefile.dist from the top-level Makefile.

Signed-off-by: Prarit Bhargava <prarit@xxxxxxxxxx>
Cc: dzickus@xxxxxxxxxx
Cc: jforbes@xxxxxxxxxx
Cc: bcrocker@xxxxxxxxxx
---
 Makefile                      |  6 ++--
 Makefile.dist                 | 62 +++++++++++++++++++++++++++++++++++
 Makefile.rhelver              | 45 -------------------------
 makefile                      | 16 ---------
 redhat/Makefile               |  4 +--
 redhat/Makefile.common        |  2 +-
 redhat/genspec.sh             |  2 +-
 redhat/kernel.spec.template   |  2 +-
 redhat/scripts/new_release.sh | 12 +++----
 9 files changed, 75 insertions(+), 76 deletions(-)
 create mode 100644 Makefile.dist
 delete mode 100644 Makefile.rhelver
 delete mode 100644 makefile

diff --git a/Makefile b/Makefile
index db82850bcb3a..141502c9caba 100644
--- a/Makefile
+++ b/Makefile
@@ -18,10 +18,6 @@ $(if $(filter __%, $(MAKECMDGOALS)), \
 PHONY := __all
 __all:
 
-# Set RHEL variables
-# Use this spot to avoid future merge conflicts
-include Makefile.rhelver
-
 # We are using a recursive build, so we need to do a little thinking
 # to get the ordering right.
 #
@@ -273,6 +269,8 @@ no-sync-config-targets := $(no-dot-config-targets) install %install \
 			   kernelrelease
 single-targets := %.a %.i %.ko %.lds %.ll %.lst %.mod %.o %.s %.symtypes %/
 
+-include Makefile.dist
+
 config-build	:=
 mixed-build	:=
 need-config	:= 1
diff --git a/Makefile.dist b/Makefile.dist
new file mode 100644
index 000000000000..0b4f2d28e7b8
--- /dev/null
+++ b/Makefile.dist
@@ -0,0 +1,62 @@
+RHEL_MAJOR = 8
+RHEL_MINOR = 99
+
+#
+# RHEL_RELEASE
+# -------------
+#
+# Represents build number in 'release' part of RPM's name-version-release.
+#   name is <package_name>, e.g. kernel
+#   version is upstream kernel version this kernel is based on, e.g. 4.18.0
+#   release is <RHEL_RELEASE>.<dist_tag>[<buildid>], e.g. 100.el8
+#
+# Use this spot to avoid future merge conflicts.
+# Do not trim this comment.
+RHEL_RELEASE = 1
+
+#
+# Early y+1 numbering
+# --------------------
+#
+# In early y+1 process, RHEL_RELEASE consists of 2 numbers: x.y
+# First is RHEL_RELEASE inherited/merged from y as-is, second number
+# is incremented with each build starting from 1. After merge from y,
+# it resets back to 1. This way y+1 nvr reflects status of last merge.
+#
+# Example:
+#
+# rhel8.0                        rhel-8.1
+#   kernel-4.18.0-58.el8   -->     kernel-4.18.0-58.1.el8
+#                                  kernel-4.18.0-58.2.el8
+#   kernel-4.18.0-59.el8           kernel-4.18.0-59.1.el8
+#   kernel-4.18.0-60.el8
+#   kernel-4.18.0-61.el8   -->     kernel-4.18.0-61.1.el8
+#
+#
+# Use this spot to avoid future merge conflicts.
+# Do not trim this comment.
+EARLY_YSTREAM ?= no
+EARLY_YBUILD:=
+EARLY_YRELEASE:=
+ifneq ("$(ZSTREAM)", "yes")
+  ifeq ("$(EARLY_YSTREAM)","yes")
+    RHEL_RELEASE:=$(RHEL_RELEASE).$(EARLY_YRELEASE)
+  endif
+endif
+
+no-dot-config-targets += dist-% distg-%
+
+ifneq ($(filter dist-% distg-%,$(MAKECMDGOALS)),)
+_OUTPUT := "."
+# this section is needed in order to make O= to work
+ifeq ("$(origin O)", "command line")
+  _OUTPUT := "$(abspath $(O))"
+  _EXTRA_ARGS := O=$(_OUTPUT)
+endif
+endif
+
+dist-%::
+	$(MAKE) -C redhat $(@) $(_EXTRA_ARGS)
+
+distg-%::
+	$(MAKE) -C redhat $(@) $(_EXTRA_ARGS)
diff --git a/Makefile.rhelver b/Makefile.rhelver
deleted file mode 100644
index 7fb2464bc6de..000000000000
--- a/Makefile.rhelver
+++ /dev/null
@@ -1,45 +0,0 @@
-RHEL_MAJOR = 8
-RHEL_MINOR = 99
-
-#
-# RHEL_RELEASE
-# -------------
-#
-# Represents build number in 'release' part of RPM's name-version-release.
-#   name is <package_name>, e.g. kernel
-#   version is upstream kernel version this kernel is based on, e.g. 4.18.0
-#   release is <RHEL_RELEASE>.<dist_tag>[<buildid>], e.g. 100.el8
-#
-# Use this spot to avoid future merge conflicts.
-# Do not trim this comment.
-RHEL_RELEASE = 1
-
-#
-# Early y+1 numbering
-# --------------------
-#
-# In early y+1 process, RHEL_RELEASE consists of 2 numbers: x.y
-# First is RHEL_RELEASE inherited/merged from y as-is, second number
-# is incremented with each build starting from 1. After merge from y,
-# it resets back to 1. This way y+1 nvr reflects status of last merge.
-#
-# Example:
-#
-# rhel8.0                        rhel-8.1
-#   kernel-4.18.0-58.el8   -->     kernel-4.18.0-58.1.el8
-#                                  kernel-4.18.0-58.2.el8
-#   kernel-4.18.0-59.el8           kernel-4.18.0-59.1.el8
-#   kernel-4.18.0-60.el8
-#   kernel-4.18.0-61.el8   -->     kernel-4.18.0-61.1.el8
-#
-#
-# Use this spot to avoid future merge conflicts.
-# Do not trim this comment.
-EARLY_YSTREAM ?= no
-EARLY_YBUILD:=
-EARLY_YRELEASE:=
-ifneq ("$(ZSTREAM)", "yes")
-  ifeq ("$(EARLY_YSTREAM)","yes")
-    RHEL_RELEASE:=$(RHEL_RELEASE).$(EARLY_YRELEASE)
-  endif
-endif
diff --git a/makefile b/makefile
deleted file mode 100644
index 819ac9a5cd60..000000000000
--- a/makefile
+++ /dev/null
@@ -1,16 +0,0 @@
-ifeq ($(filter dist-% distg-%,$(MAKECMDGOALS)),)
-	include Makefile
-endif
-
-_OUTPUT := "."
-# this section is needed in order to make O= to work
-ifeq ("$(origin O)", "command line")
-  _OUTPUT := "$(abspath $(O))"
-  _EXTRA_ARGS := O=$(_OUTPUT)
-endif
-dist-%::
-	$(MAKE) -C redhat $(@) $(_EXTRA_ARGS)
-
-distg-%::
-	$(MAKE) -C redhat $(@) $(_EXTRA_ARGS)
-
diff --git a/redhat/Makefile b/redhat/Makefile
index 7cdf9e3bd0bf..de9d1dfaa6e9 100644
--- a/redhat/Makefile
+++ b/redhat/Makefile
@@ -256,7 +256,7 @@ sources-rh: $(TARBALL)
 		configs/process_configs.sh \
 		parallel_xz.sh \
 		generate_bls_conf.sh \
-		../Makefile.rhelver \
+		../Makefile.dist \
 		README.rst \
 		$(SOURCES)/
 	@for KABIARCH in $(ARCH_LIST); do \
@@ -308,7 +308,7 @@ dist-release-finish: setup-source
 	@git add $(REDHAT)/$(CHANGELOG)
 	@echo $(MARKER) > $(REDHAT)/marker
 	@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 commit -s ../Makefile.dist $(REDHAT)/marker $(REDHAT)/$(CHANGELOG) $(PACKAGE_NAME).spec.template -m "[redhat] $(PACKAGE_NAME)-$(STAMP_VERSION)-$(PREBUILD)$(BUILD)$(BUILDID)"
 	@$(MAKE) dist-configs
 	@$(MAKE) dist-kabi
 	@$(MAKE) dist-kabi-dup
diff --git a/redhat/Makefile.common b/redhat/Makefile.common
index e7fb532874e3..81811c8795ed 100644
--- a/redhat/Makefile.common
+++ b/redhat/Makefile.common
@@ -1,6 +1,6 @@
 TOPDIR:=$(shell git rev-parse --show-toplevel)
 REDHAT:=$(TOPDIR)/redhat
-include $(TOPDIR)/Makefile.rhelver
+include $(TOPDIR)/Makefile.dist
 
 RPMBUILD := $(shell if [ -x "/usr/bin/rpmbuild" ]; then echo rpmbuild; \
                    else echo rpm; fi)
diff --git a/redhat/genspec.sh b/redhat/genspec.sh
index b72dffe14729..1cd9095a69ea 100755
--- a/redhat/genspec.sh
+++ b/redhat/genspec.sh
@@ -253,7 +253,7 @@ if [ "$SINGLE_TARBALL" = 0 ]; then
 		":(exclude,top).gitignore" \
 		":(exclude,top).gitlab-ci.yml" \
 		":(exclude,top)makefile" \
-		":(exclude,top)Makefile.rhelver" \
+		":(exclude,top)Makefile.dist" \
 		":(exclude,top)redhat")
 	for c in $COMMITS; do
 		patch=$(git format-patch --zero-commit -1 "$c")
diff --git a/redhat/kernel.spec.template b/redhat/kernel.spec.template
index d47c9cce8a0e..93fa8c2985b1 100644
--- a/redhat/kernel.spec.template
+++ b/redhat/kernel.spec.template
@@ -569,7 +569,7 @@ BuildRequires: asciidoc
 # xzcat -qq ${TARBALL} | git get-tar-commit-id
 Source0: linux-%%TARBALL_VERSION%%.tar.xz
 
-Source1: Makefile.rhelver
+Source1: Makefile.dist
 
 
 # Name of the packaged file containing signing key
diff --git a/redhat/scripts/new_release.sh b/redhat/scripts/new_release.sh
index 1e4c7bb1dc86..f1025f458d04 100755
--- a/redhat/scripts/new_release.sh
+++ b/redhat/scripts/new_release.sh
@@ -13,7 +13,7 @@ if [ -s "$RHPATH/linux-kernel-test.patch" ]; then
 	exit 1;
 fi
 
-RELEASE=$(sed -n -e 's/^RHEL_RELEASE\ =\ \(.*\)/\1/p' $RHPATH/../Makefile.rhelver)
+RELEASE=$(sed -n -e 's/^RHEL_RELEASE\ =\ \(.*\)/\1/p' $RHPATH/../Makefile.dist)
 
 YVER=$(echo $RELEASE | cut -d "." -f 1)
 YVER=${YVER:=$RELEASE}
@@ -26,15 +26,15 @@ if [ "$ZSTREAM_FLAG" == "no" ]; then
 	if [ "$YSTREAM_FLAG" == "yes" ]; then
 		NEW_RELEASE="$[RELEASE + 1]";
 	else
-		EARLY_YBUILD=$(sed -n -e 's/^EARLY_YBUILD:=\(.*\)/\1/p' $RHPATH/../Makefile.rhelver);
-		EARLY_YRELEASE=$(sed -n -e 's/^EARLY_YRELEASE:=\(.*\)/\1/p' $RHPATH/../Makefile.rhelver);
+		EARLY_YBUILD=$(sed -n -e 's/^EARLY_YBUILD:=\(.*\)/\1/p' $RHPATH/../Makefile.dist);
+		EARLY_YRELEASE=$(sed -n -e 's/^EARLY_YRELEASE:=\(.*\)/\1/p' $RHPATH/../Makefile.dist);
 		if [ "$EARLY_YBUILD" != "$RELEASE" ]; then
 			NEW_EARLY_YRELEASE=1;
 		else
 			NEW_EARLY_YRELEASE="$[EARLY_YRELEASE + 1]";
 		fi
-		sed -i -e "s/^EARLY_YBUILD:=$EARLY_YBUILD/EARLY_YBUILD:=$RELEASE/" $RHPATH/../Makefile.rhelver;
-		sed -i -e "s/^EARLY_YRELEASE:=$EARLY_YRELEASE/EARLY_YRELEASE:=$NEW_EARLY_YRELEASE/" $RHPATH/../Makefile.rhelver;
+		sed -i -e "s/^EARLY_YBUILD:=$EARLY_YBUILD/EARLY_YBUILD:=$RELEASE/" $RHPATH/../Makefile.dist;
+		sed -i -e "s/^EARLY_YRELEASE:=$EARLY_YRELEASE/EARLY_YRELEASE:=$NEW_EARLY_YRELEASE/" $RHPATH/../Makefile.dist;
 		NEW_RELEASE=$RELEASE;
 	fi
 elif [ "$ZSTREAM_FLAG" == "yes" ]; then
@@ -46,5 +46,5 @@ else
 	exit 1;
 fi
 
-sed -i -e "s/RHEL_RELEASE\ =.*/RHEL_RELEASE\ =\ $NEW_RELEASE/" $RHPATH/../Makefile.rhelver;
+sed -i -e "s/RHEL_RELEASE\ =.*/RHEL_RELEASE\ =\ $NEW_RELEASE/" $RHPATH/../Makefile.dist;
 
-- 
2.21.3
_______________________________________________
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




[Index of Archives]     [Fedora General Discussion]     [Older Fedora Users Archive]     [Fedora Advisory Board]     [Fedora Security]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Mentors]     [Fedora Package Announce]     [Fedora Package Review]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Coolkey]     [Yum Users]     [Tux]     [Yosemite News]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [USB]     [Asterisk PBX]

  Powered by Linux