[OS-BUILD PATCH 4/24] redhat/Makefile: Cleanup DISTRO variable

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

 



From: Prarit Bhargava <prarit@xxxxxxxxxx>

redhat/Makefile: Cleanup DISTRO variable

Move the DISTRO variable to Makefile.variables and clean up its usage in
the Makfile.  This creates separate fedora-specific, centos-specific, and
'other'-specific variable sections.

Signed-off-by: Prarit Bhargava <prarit@xxxxxxxxxx>

diff --git a/redhat/Makefile b/redhat/Makefile
index blahblah..blahblah 100644
--- a/redhat/Makefile
+++ b/redhat/Makefile
@@ -34,10 +34,12 @@ else
   PREBUILD:=
 endif
 
-ifneq ($(findstring .fc,$(DIST)),)
-  DISTRO ?= fedora
-else
-  DISTRO ?= rhel
+ifndef DISTRO
+  ifneq ($(findstring .fc,$(DIST)),)
+    DISTRO := fedora
+  else
+    DISTRO := rhel
+  endif
 endif
 
 # If VERSION_ON_UPSTREAM is set, the versioning of the rpm package is based
@@ -106,16 +108,6 @@ SRPMS:=$(RPM)/SRPMS
 SOURCES:=$(RPM)/SOURCES
 TESTPATCH:=$(REDHAT)/linux-kernel-test.patch
 ARCH_LIST=aarch64 ppc64le s390x x86_64
-# Make can't match on a regex to match fc31, fc32 so add another check here
-# A unified tarball means that the tarball in the srpm contains both the
-# upstream sources and redhat patches. A non-unified tarball means that
-# the tarball is only upstream sources and the patches get applied as
-# a diff in the spec file
-ifeq ("$(DISTRO)", "fedora")
-  SINGLE_TARBALL:=0
-else
-  SINGLE_TARBALL:=1
-endif
 
 STAMP_VERSION:=$(KVERSION)
 
@@ -134,11 +126,30 @@ endif
 PKGRELEASE:=$(PREBUILD)$(BUILD)$(BUILDID)
 SPECRELEASE:=$(PREBUILD)$(BUILD)%{?buildid}%{?dist}
 
-ifeq ("$(SINGLE_TARBALL)", "0")
+ifeq ("$(DISTRO)", "fedora")
+  # A non-unified tarball means that the tarball is only upstream sources
+  # and the patches get applied as a diff in the spec file
+  SINGLE_TARBALL:=0
   TARFILE_RELEASE:=$(UPSTREAM_TARBALL_NAME)
+  RHPRODUCT:=rawhide
+  BUILD_SCRATCH_TARGET ?= temp-ark-rhel-8-test
+else ifeq ("$(DISTRO)", "centos")
+  # A unified tarball means that the tarball in the srpm contains both the
+  # upstream sources and RHEL specific patches.
+  SINGLE_TARBALL:=1
+  RHPRODUCT:=c$(RHEL_MAJOR)s
+  BUILD_PROFILE ?= -p stream
+  BUILD_SCRATCH_TARGET ?= c$(RHEL_MAJOR)s-candidate
+  TARFILE_RELEASE:=$(KVERSION)-$(PKGRELEASE)
 else
+  # A unified tarball means that the tarball in the srpm contains both the
+  # upstream sources and RHEL specific patches.
+  SINGLE_TARBALL:=1
+  RHPRODUCT:=rhel-$(RHEL_MAJOR).$(RHEL_MINOR).0
+  BUILD_SCRATCH_TARGET ?= rhel-$(RHEL_MAJOR).$(RHEL_MINOR).0-test-pesign
   TARFILE_RELEASE:=$(KVERSION)-$(PKGRELEASE)
 endif
+
 TARFILE:=linux-$(TARFILE_RELEASE).tar.xz
 TARBALL:=$(REDHAT)/$(TARFILE)
 DISTRO_BUILD:=$(PREBUILD)$(shell echo $(BUILD) | sed -e 's|\(^[0-9]\{1,4\}\)\..*|\1|')
@@ -150,23 +161,6 @@ KABIDW_TARBALL:=$(REDHAT)/rpm/SOURCES/$(KABIDW_TARFILE)
 CHANGELOG:=$(PACKAGE_NAME).changelog-$(RHEL_MAJOR).$(RHEL_MINOR)
 CHANGELOG_PREV:=$(PACKAGE_NAME).changelog-$(RHEL_MAJOR).$(shell expr $(RHEL_MINOR) - 1)
 
-ifeq ("$(DISTRO)", "fedora")
-  RHPRODUCT:=rawhide
-else ifeq ("$(DISTRO)", "centos")
-  RHPRODUCT:=c$(RHEL_MAJOR)s
-else
-  RHPRODUCT:=rhel-$(RHEL_MAJOR).$(RHEL_MINOR).0
-endif
-
-ifeq ("$(DISTRO)", "fedora")
-  BUILD_SCRATCH_TARGET ?= temp-ark-rhel-8-test
-else ifeq ("$(DISTRO)", "centos")
-  BUILD_PROFILE ?= -p stream
-  BUILD_SCRATCH_TARGET ?= c$(RHEL_MAJOR)s-candidate
-else
-  BUILD_SCRATCH_TARGET ?= rhel-$(RHEL_MAJOR).$(RHEL_MINOR).0-test-pesign
-endif
-
 include Makefile.rhpkg
 
 ifeq ("$(ZSTREAM)", "yes")
diff --git a/redhat/Makefile.variables b/redhat/Makefile.variables
index blahblah..blahblah 100644
--- a/redhat/Makefile.variables
+++ b/redhat/Makefile.variables
@@ -12,6 +12,10 @@ DIST_BRANCH ?= "os-build"
 # .el8 etc. In a different branch this may be set to a fixed value.
 DIST ?= $(shell $(RPMBUILD) --eval '%{?dist}')
 
+# This is a human readable distribution variable that is used to determine the
+# OS version (fedora, centos, or rhel).
+DISTRO ?=
+
 # The branch used as upstream. This is what the upstream tarball is it
 # should be tracked in a local branch. This would be "master" for the
 # Linus master branch or linux-5.x.y for a stable branch. It can also be

--
https://gitlab.com/cki-project/kernel-ark/-/merge_requests/1641
_______________________________________________
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
Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure




[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