From: Scott Weaver <scwea...@redhat.com>

redhat/Makefile: add automotive scratch build targets

RHEL has the dist-brew target for easily starting a scratch build, this
adds new targets for creating a scratch build in CBS and brew.

Signed-off-by: Scott Weaver <scwea...@redhat.com>

diff --git a/Makefile.rhelver b/Makefile.rhelver
index blahblah..blahblah 100644
--- a/Makefile.rhelver
+++ b/Makefile.rhelver
@@ -78,3 +78,13 @@ ifneq ("$(ZSTREAM)", "yes")
     RHEL_RELEASE:=$(RHEL_RELEASE).$(EARLY_YRELEASE)
   endif
 endif
+
+#
+# Automotive
+# ----------
+#
+# Represents the major and minor release used by automotive.
+# Primarily this is used to to identify the build target when
+# building the kernel-automotive packages.
+AUTOMOTIVE_MAJOR = 2
+AUTOMOTIVE_MINOR = 99
diff --git a/redhat/Makefile b/redhat/Makefile
index blahblah..blahblah 100644
--- a/redhat/Makefile
+++ b/redhat/Makefile
@@ -79,10 +79,10 @@ SPECCHANGELOG=$(SPECPACKAGE_NAME).$(CHANGELOG_EXT)
 ARCH_LIST=aarch64 ppc64le s390x x86_64 riscv64
 
 # save some user selectable values to know later if we can override them
-DISTRO_USERDEF=$(DISTRO)
-DIST_USERDEF=$(DIST)
-BUILD_PROFILE_USERDEF=$(BUILD_PROFILE)
-BUILD_TARGET_USERDEF=$(BUILD_TARGET)
+DISTRO_USERDEF:=$(DISTRO)
+DIST_USERDEF:=$(DIST)
+BUILD_PROFILE_USERDEF:=$(BUILD_PROFILE)
+BUILD_TARGET_USERDEF:=$(BUILD_TARGET)
 
 ifndef DIST
   DIST = $(shell $(RPMBUILD) --eval '%{?dist}')
@@ -299,6 +299,8 @@ else ifeq ("$(DISTRO)", "centos")
   endif
   ifndef BUILD_TARGET
     BUILD_TARGET:=c$(RHEL_MAJOR)s-candidate
+    # The CentOS Stream equivalent for automotive is AutoSD built out of CBS
+    AUTOMOTIVE_BUILD_TARGET = 
autosd$(RHEL_MAJOR)s-packages-main-el$(RHEL_MAJOR)s
   endif
   SPECTARFILE_RELEASE=$(BASEVERSION)$(DIST)
   SPECKABIVERSION=$(BASEVERSION)$(DIST)
@@ -315,6 +317,7 @@ else
       # This value is used by the dist[g]-targets.  Changing this value has 
significant
       # consequences for all of RHEL kernel engineering.
       BUILD_TARGET:=rhel-$(RHEL_MAJOR)-newest-test-pesign
+      AUTOMOTIVE_BUILD_TARGET = rhivos-$(AUTOMOTIVE_MAJOR)-newest-test-pesign
     endif
   endif
   ifeq ("$(DIST)", ".eln")
@@ -895,6 +898,30 @@ _dist-brew _dist-koji: _dist-%: dist-vr-check dist-srpm
 _distg-brew _distg-koji: _distg-%: dist-vr-check
        $* $(BUILD_PROFILE) build $(BUILD_FLAGS) --scratch $(BUILD_TARGET) 
"$(RHGITURL)?redhat/koji#$(RHGITCOMMIT)"
 
+dist-cbs-automotive: ##build Create a kernel-automotive SRPM and then call cbs 
to build the created SRPM.
+dist-cbs-automotive: SPECPACKAGE_NAME := kernel-automotive
+dist-cbs-automotive: DISTRO=$(if $(DISTRO_USERDEF),$(DISTRO_USERDEF),centos)
+dist-cbs-automotive: DIST=$(if 
$(DIST_USERDEF),$(DIST_USERDEF),.el$(RHEL_MAJOR)iv)
+dist-cbs-automotive: BUILD_PROFILE=$(if 
$(BUILD_PROFILE_USERDEF),$(BUILD_PROFILE_USERDEF))
+dist-cbs-automotive: BUILD_TARGET=$(if 
$(BUILD_TARGET_USERDEF),$(BUILD_TARGET_USERDEF))
+dist-cbs-automotive:
+       $(MAKE) _$@
+
+_dist-cbs-automotive: dist-srpm-automotive
+       cbs build $(BUILD_FLAGS) --scratch $(AUTOMOTIVE_BUILD_TARGET) 
$(SRPMS)/$(RELEASETAG)$(DIST).src.rpm
+
+dist-brew-automotive: ##build Create a kernel-automotive SRPM and then call 
brew to build the created SRPM.
+dist-brew-automotive: SPECPACKAGE_NAME := kernel-automotive
+dist-brew-automotive: DISTRO=$(if $(DISTRO_USERDEF),$(DISTRO_USERDEF),rhel)
+dist-brew-automotive: DIST=$(if 
$(DIST_USERDEF),$(DIST_USERDEF),.el$(RHEL_MAJOR)iv)
+dist-brew-automotive: BUILD_PROFILE=$(if 
$(BUILD_PROFILE_USERDEF),$(BUILD_PROFILE_USERDEF))
+dist-brew-automotive: BUILD_TARGET=$(if 
$(BUILD_TARGET_USERDEF),$(BUILD_TARGET_USERDEF))
+dist-brew-automotive:
+       $(MAKE) _$@
+
+_dist-brew-automotive: dist-srpm-automotive
+       brew build $(BUILD_FLAGS) --scratch $(AUTOMOTIVE_BUILD_TARGET) 
$(SRPMS)/$(RELEASETAG)$(DIST).src.rpm
+
 dist-git-test: export RH_DIST_GIT_TEST="1"
 dist-git-test: dist-git
 
diff --git a/redhat/Makefile.variables b/redhat/Makefile.variables
index blahblah..blahblah 100644
--- a/redhat/Makefile.variables
+++ b/redhat/Makefile.variables
@@ -14,6 +14,9 @@
 # which is then reflected in the package NVR.
 ADD_COMMITID_TO_VERSION ?=
 
+# This is the brew/cbs scratch build target.
+AUTOMOTIVE_BUILD_TARGET ?=
+
 # This sets the incremental build version value in the rpm NVR.  If unset, this
 # defaults to RHEL_RELEASE from Makefile.rhelver
 BUILD ?=

--
https://gitlab.com/cki-project/kernel-ark/-/merge_requests/3870

-- 
_______________________________________________
kernel mailing list -- kernel@lists.fedoraproject.org
To unsubscribe send an email to kernel-le...@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
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue

Reply via email to