[OS-BUILD PATCHv3 2/24] redhat: Combine Makefile and Makefile.common

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

 



From: Prarit Bhargava <prarit@xxxxxxxxxx>

redhat: Combine Makefile and Makefile.common

The only include of Makefile.common is the Makefile.  Combine the two
files in Makefile.

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
@@ -1,7 +1,174 @@
-include Makefile.common
-include Makefile.rhpkg
+include Makefile.variables
 
 LANG=C
+TOPDIR:=$(shell $(GIT) rev-parse --show-toplevel)
+REDHAT:=$(TOPDIR)/redhat
+include $(TOPDIR)/Makefile.rhelver
+
+RPMBUILD := $(shell if [ -x "/usr/bin/rpmbuild" ]; then echo rpmbuild; \
+                   else echo rpm; fi)
+
+MACH :=  $(shell uname -m)
+HEAD ?= HEAD
+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 $(HEAD))
+# 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.
+ifneq ($(RPMKEXTRAVERSION),)
+  MARKER:=v$(RPMKVERSION).$(RPMKPATCHLEVEL)$(RPMKEXTRAVERSION)
+  KEXTRAVERSION:=$(shell echo $(RPMKEXTRAVERSION) | sed -e s/-/./)
+  PREBUILD:=0$(KEXTRAVERSION).
+  UPSTREAM_TARBALL_NAME:=$(RPMKVERSION).$(RPMKPATCHLEVEL)$(RPMKEXTRAVERSION)
+else
+  KEXTRAVERSION:=
+  ifeq ($(RPMKSUBLEVEL),0)
+    MARKER:=v$(RPMKVERSION).$(RPMKPATCHLEVEL)
+    UPSTREAM_TARBALL_NAME:=$(RPMKVERSION).$(RPMKPATCHLEVEL)
+  else
+    MARKER:=v$(RPMKVERSION).$(RPMKPATCHLEVEL).$(RPMKSUBLEVEL)
+    UPSTREAM_TARBALL_NAME:=$(RPMKVERSION).$(RPMKPATCHLEVEL).$(RPMKSUBLEVEL)
+  endif
+  PREBUILD:=
+endif
+
+ifneq ($(findstring .fc,$(DIST)),)
+  DISTRO ?= fedora
+else
+  DISTRO ?= rhel
+endif
+
+# If VERSION_ON_UPSTREAM is set, the versioning of the rpm package is based
+# on a branch tracking upstream. This allows for generating rpms
+# based on untagged releases.
+ifndef VERSION_ON_UPSTREAM
+  ifeq ("$(DISTRO)", "fedora")
+    VERSION_ON_UPSTREAM:=1
+  else
+    VERSION_ON_UPSTREAM:=0
+  endif
+endif
+ifeq ($(VERSION_ON_UPSTREAM),1)
+  # UPSTREAM_BRANCH is expected to track mainline.
+  UPSTREAM:=$(shell $(GIT) rev-parse -q --verify origin/$(UPSTREAM_BRANCH) || \
+                  $(GIT) rev-parse -q --verify $(UPSTREAM_BRANCH))
+  ifeq ($(UPSTREAM),)
+      $(error "Missing an $(UPSTREAM_BRANCH) branch")
+  endif
+  MERGE_BASE:=$(shell $(GIT) merge-base $(HEAD) $(UPSTREAM))
+  _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
+  SNAPSHOT:=0
+endif
+
+ifeq ($(SNAPSHOT),1)
+  # The base for generating tags is the snapshot commit
+  MARKER:=$(shell echo $(_TAG) | awk -F "-g" '{ print $$2 }')
+  # The merge window is weird because the actual versioning hasn't
+  # been updated but we still need something that works for
+  # packaging. Fix this by bumping the patch level and marking
+  # this as rc0
+  ifeq ($(RPMKEXTRAVERSION),)
+    KEXTRAVERSION:=.rc0
+    PREBUILD:=0$(KEXTRAVERSION).
+    RPMKPATCHLEVEL:=$(shell expr $(RPMKPATCHLEVEL) + 1)
+  endif
+  ifneq ($(filter $(MAKECMDGOALS),dist-git-test dist-git),)
+    PREBUILD_GIT_ONLY ?= 0
+  else
+    PREBUILD_GIT_ONLY ?= 1
+  endif
+  ifeq ($(PREBUILD_GIT_ONLY),1)
+    PREBUILD:=$(PREBUILD)$(MARKER).
+  else
+    # Obtain the date that HEAD was committed (not the snapshot commit).
+    HEAD_DATE:=$(shell $(GIT) show -s --format=%cd --date=format:%Y%m%d $(HEAD))
+    PREBUILD:=$(PREBUILD)$(HEAD_DATE)git$(MARKER).
+  endif
+  UPSTREAM_TARBALL_NAME:=$(patsubst v%,%,$(_TAG))
+endif
+
+
+# RPMKPATCHVERSION may get adjusted if we're snapshotting
+# during the merge window so ensure this gets set after
+# we've checked for snapshots
+KVERSION:=$(RPMKVERSION).$(RPMKPATCHLEVEL).$(RPMKSUBLEVEL)
+RPMVERSION:=$(KVERSION)
+
+BUILD:=$(RHEL_RELEASE)
+SPECFILE:=$(PACKAGE_NAME).spec
+RPM:=$(REDHAT)/rpm
+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)
+
+LOCVERFILE:=../localversion
+# create an empty localversion file if you don't want a local buildid
+ifneq ($(wildcard $(LOCVERFILE)),)
+  BUILDID:=$(shell cat $(LOCVERFILE))
+  $(info BUILDID is "$(BUILDID)". Update '$(shell dirname $(REDHAT))/localversion' to change.)
+else
+  ifeq ($(BUILDID),)
+    BUILDID:=.test
+  endif
+  $(info BUILDID is "$(BUILDID)".)
+endif
+
+PKGRELEASE:=$(PREBUILD)$(BUILD)$(BUILDID)
+SPECRELEASE:=$(PREBUILD)$(BUILD)%{?buildid}%{?dist}
+
+ifeq ("$(SINGLE_TARBALL)", "0")
+  TARFILE_RELEASE:=$(UPSTREAM_TARBALL_NAME)
+else
+  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|')
+KABI_TARFILE:=kernel-abi-stablelists-$(KVERSION)-$(DISTRO_BUILD).tar.bz2
+KABI_TARBALL:=$(REDHAT)/rpm/SOURCES/$(KABI_TARFILE)
+KABIDW_TARFILE:=kernel-kabi-dw-$(KVERSION)-$(DISTRO_BUILD).tar.bz2
+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")
   __YSTREAM = no
diff --git a/redhat/Makefile.common b/redhat/Makefile.common
deleted file mode 100644
index blahblah..blahblah 0
--- a/redhat/Makefile.common
+++ /dev/null
@@ -1,167 +0,0 @@
-include Makefile.variables
-TOPDIR:=$(shell $(GIT) rev-parse --show-toplevel)
-REDHAT:=$(TOPDIR)/redhat
-include $(TOPDIR)/Makefile.rhelver
-
-RPMBUILD := $(shell if [ -x "/usr/bin/rpmbuild" ]; then echo rpmbuild; \
-                   else echo rpm; fi)
-
-MACH :=  $(shell uname -m)
-HEAD ?= HEAD
-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 $(HEAD))
-# 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.
-ifneq ($(RPMKEXTRAVERSION),)
-  MARKER:=v$(RPMKVERSION).$(RPMKPATCHLEVEL)$(RPMKEXTRAVERSION)
-  KEXTRAVERSION:=$(shell echo $(RPMKEXTRAVERSION) | sed -e s/-/./)
-  PREBUILD:=0$(KEXTRAVERSION).
-  UPSTREAM_TARBALL_NAME:=$(RPMKVERSION).$(RPMKPATCHLEVEL)$(RPMKEXTRAVERSION)
-else
-  KEXTRAVERSION:=
-  ifeq ($(RPMKSUBLEVEL),0)
-    MARKER:=v$(RPMKVERSION).$(RPMKPATCHLEVEL)
-    UPSTREAM_TARBALL_NAME:=$(RPMKVERSION).$(RPMKPATCHLEVEL)
-  else
-    MARKER:=v$(RPMKVERSION).$(RPMKPATCHLEVEL).$(RPMKSUBLEVEL)
-    UPSTREAM_TARBALL_NAME:=$(RPMKVERSION).$(RPMKPATCHLEVEL).$(RPMKSUBLEVEL)
-  endif
-  PREBUILD:=
-endif
-
-ifneq ($(findstring .fc,$(DIST)),)
-  DISTRO ?= fedora
-else
-  DISTRO ?= rhel
-endif
-
-# If VERSION_ON_UPSTREAM is set, the versioning of the rpm package is based
-# on a branch tracking upstream. This allows for generating rpms
-# based on untagged releases.
-ifndef VERSION_ON_UPSTREAM
-  ifeq ("$(DISTRO)", "fedora")
-    VERSION_ON_UPSTREAM:=1
-  else
-    VERSION_ON_UPSTREAM:=0
-  endif
-endif
-ifeq ($(VERSION_ON_UPSTREAM),1)
-  # UPSTREAM_BRANCH is expected to track mainline.
-  UPSTREAM:=$(shell $(GIT) rev-parse -q --verify origin/$(UPSTREAM_BRANCH) || \
-                  $(GIT) rev-parse -q --verify $(UPSTREAM_BRANCH))
-  ifeq ($(UPSTREAM),)
-      $(error "Missing an $(UPSTREAM_BRANCH) branch")
-  endif
-  MERGE_BASE:=$(shell $(GIT) merge-base $(HEAD) $(UPSTREAM))
-  _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
-  SNAPSHOT:=0
-endif
-
-ifeq ($(SNAPSHOT),1)
-  # The base for generating tags is the snapshot commit
-  MARKER:=$(shell echo $(_TAG) | awk -F "-g" '{ print $$2 }')
-  # The merge window is weird because the actual versioning hasn't
-  # been updated but we still need something that works for
-  # packaging. Fix this by bumping the patch level and marking
-  # this as rc0
-  ifeq ($(RPMKEXTRAVERSION),)
-    KEXTRAVERSION:=.rc0
-    PREBUILD:=0$(KEXTRAVERSION).
-    RPMKPATCHLEVEL:=$(shell expr $(RPMKPATCHLEVEL) + 1)
-  endif
-  ifneq ($(filter $(MAKECMDGOALS),dist-git-test dist-git),)
-    PREBUILD_GIT_ONLY ?= 0
-  else
-    PREBUILD_GIT_ONLY ?= 1
-  endif
-  ifeq ($(PREBUILD_GIT_ONLY),1)
-    PREBUILD:=$(PREBUILD)$(MARKER).
-  else
-    # Obtain the date that HEAD was committed (not the snapshot commit).
-    HEAD_DATE:=$(shell $(GIT) show -s --format=%cd --date=format:%Y%m%d $(HEAD))
-    PREBUILD:=$(PREBUILD)$(HEAD_DATE)git$(MARKER).
-  endif
-  UPSTREAM_TARBALL_NAME:=$(patsubst v%,%,$(_TAG))
-endif
-
-
-# RPMKPATCHVERSION may get adjusted if we're snapshotting
-# during the merge window so ensure this gets set after
-# we've checked for snapshots
-KVERSION:=$(RPMKVERSION).$(RPMKPATCHLEVEL).$(RPMKSUBLEVEL)
-RPMVERSION:=$(KVERSION)
-
-BUILD:=$(RHEL_RELEASE)
-SPECFILE:=$(PACKAGE_NAME).spec
-RPM:=$(REDHAT)/rpm
-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)
-
-LOCVERFILE:=../localversion
-# create an empty localversion file if you don't want a local buildid
-ifneq ($(wildcard $(LOCVERFILE)),)
-  BUILDID:=$(shell cat $(LOCVERFILE))
-  $(info BUILDID is "$(BUILDID)". Update '$(shell dirname $(REDHAT))/localversion' to change.)
-else
-  ifeq ($(BUILDID),)
-    BUILDID:=.test
-  endif
-  $(info BUILDID is "$(BUILDID)".)
-endif
-
-PKGRELEASE:=$(PREBUILD)$(BUILD)$(BUILDID)
-SPECRELEASE:=$(PREBUILD)$(BUILD)%{?buildid}%{?dist}
-
-ifeq ("$(SINGLE_TARBALL)", "0")
-  TARFILE_RELEASE:=$(UPSTREAM_TARBALL_NAME)
-else
-  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|')
-KABI_TARFILE:=kernel-abi-stablelists-$(KVERSION)-$(DISTRO_BUILD).tar.bz2
-KABI_TARBALL:=$(REDHAT)/rpm/SOURCES/$(KABI_TARFILE)
-KABIDW_TARFILE:=kernel-kabi-dw-$(KVERSION)-$(DISTRO_BUILD).tar.bz2
-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

--
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