From: Herton R. Krzesinski <herton(a)redhat.com>
redhat: add initial support for centos stream dist-git sync on Makefiles
This change introduces some initial centos stream support, mainly what's
needed for a dist-git sync. The dist-git sync is initially proposed to
be a fork + merge request model, and thus we need some changes for the
Makefiles. I also dropped IS_FEDORA variable, and replace it with
DISTRO, which can have either "fedora" or "centos" (and could be set
later to "rhel" or anything else if needed through the code).
While at it, I also fixed the default RHPKG_BIN to rhpkg instead of
rhpkg-sha512 in the default RHEL case, the former was a wrapper for
the sha512 transition on dist-git at RHEL 8 time and is not needed
anymore, it is now deprecated and will be removed from rhpkg.
Example of a dist-git sync with new centos dist-git:
make DIST=".el9" GL_DISTGIT_USER=<gitlab user> BUILDID=""
RHDISTGIT_BRANCH=c9s dist-git
v2: use PACKAGE_NAME in Makefile.rhpkg as suggested by Jan Stancek
v3: make the default DISTRO rhel in case DIST is not fc*, to not break
folks building kernel-ark on rhel which are used to not have to
specify an extra variable, as reported by Don Zickus
Signed-off-by: Herton R. Krzesinski <herton(a)redhat.com>
diff a/redhat/Makefile b/redhat/Makefile
--- a/redhat/Makefile
+++ b/redhat/Makefile
@@ -404,6 +404,12 @@ dist-git: dist-srpm $(KABI_TARBALL) $(KABIDW_TARBALL)
ifeq ("$(RHDISTGIT_BRANCH)", "")
$(error RHDISTGIT_BRANCH unset)
endif
+ if [ "$(DISTRO)" == "centos" ]; then \
+ if [ -z "$(GL_DISTGIT_USER)" ]; then \
+ echo "Error: please Please provide your gitlab username with
GL_DISTGIT_USER"; \
+ exit 1; \
+ fi; \
+ fi
$(REDHAT)/scripts/rh-dist-git.sh "$(RHDISTGIT_BRANCH)"
"$(RHDISTGIT_CACHE)" "$(RHDISTGIT_TMP)" "$(RHDISTGIT)"
"$(TARBALL)" "$(KABI_TARBALL)" "$(KABIDW_TARBALL)"
"$(__ZSTREAM)" "$(PACKAGE_NAME)" "$(RHEL_MAJOR)"
"$(RHPKG_BIN)"
"$(SRPMS)/$(PACKAGE_NAME)-$(KVERSION)-$(PKGRELEASE)$(DIST).src.rpm"
dist-rtg: dist-release
diff a/redhat/Makefile.common b/redhat/Makefile.common
--- a/redhat/Makefile.common
+++ b/redhat/Makefile.common
@@ -29,14 +29,19 @@ else
PREBUILD:=
endif
-DIST ?=.fc33
-IS_FEDORA:=$(shell ! echo $(DIST) | grep -q fc; echo $$?)
+DIST ?= .fc33
+ifeq ("$(shell ! echo $(DIST) | grep -q fc; echo $$?)", "1")
+ 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.
ifeq ("$(DIST)", ".elrdy")
VERSION_ON_UPSTREAM:=1
-else ifeq ("$(IS_FEDORA)", "1")
+else ifeq ("$(DISTRO)", "fedora")
VERSION_ON_UPSTREAM:=1
else
VERSION_ON_UPSTREAM:=0
@@ -90,7 +95,7 @@ ARCH_LIST=aarch64 ppc64le s390x x86_64
# a diff in the spec file
ifeq ("$(DIST)", ".elrdy")
SINGLE_TARBALL:=0
-else ifeq ("$(IS_FEDORA)", "1")
+else ifeq ("$(DISTRO)", "fedora")
SINGLE_TARBALL:=0
else
SINGLE_TARBALL:=1
@@ -139,16 +144,20 @@ CHANGELOG_PREV:=$(PACKAGE_NAME).changelog-$(RHEL_MAJOR).$(shell expr
$(RHEL_MINO
ifeq ("$(DIST)", ".elrdy")
RHPRODUCT:=rhel-ready
-else ifeq ("$(IS_FEDORA)", "1")
+else ifeq ("$(DISTRO)", "fedora")
RHPRODUCT:=rawhide
+else ifeq ("$(DISTRO)", "centos")
+ RHPRODUCT:=c$(RHEL_MAJOR)s
else
RHPRODUCT:=rhel-$(RHEL_MAJOR).$(RHEL_MINOR).0
endif
ifeq ("$(DIST)", ".elrdy")
BUILD_SCRATCH_TARGET ?= temp-ark-rhel-8-test
-else ifeq ("$(IS_FEDORA)", "1")
+else ifeq ("$(DISTRO)", "fedora")
BUILD_SCRATCH_TARGET ?= temp-ark-rhel-8-test
+else ifeq ("$(DISTRO)", "centos")
+ BUILD_SCRATCH_TARGET ?= c$(RHEL_MAJOR)s-candidate
else
BUILD_SCRATCH_TARGET ?= rhel-$(RHEL_MAJOR).$(RHEL_MINOR).0-test-pesign
endif
diff a/redhat/Makefile.rhpkg b/redhat/Makefile.rhpkg
--- a/redhat/Makefile.rhpkg
+++ b/redhat/Makefile.rhpkg
@@ -2,10 +2,12 @@
#
# Command to invoke rhpkg
-ifeq ("$(IS_FEDORA)", "1")
+ifeq ("$(DISTRO)", "fedora")
RHPKG_BIN:=fedpkg
+else ifeq ("$(DISTRO)", "centos")
+ RHPKG_BIN:=centpkg
else
- RHPKG_BIN:=rhpkg-sha512
+ RHPKG_BIN:=rhpkg
endif
# Kerberos username for
pkgs.devel.redhat.com
RHDISTGIT_USER:="$(shell whoami)"
@@ -27,4 +29,13 @@ ifeq ("$(RHDISTGIT_CACHE)", "")
endif
endif
-RHDISTGIT:="ssh://$(RHDISTGIT_USER)@pkgs.devel.redhat.com/rpms/$(PACKAGE_NAME)"
+ifneq ("$(DISTRO)", "centos")
+ RHDISTGIT:="ssh://$(RHDISTGIT_USER)@pkgs.devel.redhat.com/rpms/$(PACKAGE_NAME)"
+else
+ # CentOS uses a fork + merge request based workflow with dist-git to
+ # handle changes, so you need to provide the gitlab username and we by
+ # default set the default user's fork path. The dist-git target in
+ # redhat/Makefile has a check to see if the variable is not set.
+ GL_FORK_PATH?=$(PACKAGE_NAME).git
+ RHDISTGIT:=git@gitlab.com:$(GL_DISTGIT_USER)/$(GL_FORK_PATH)
+endif
--
https://gitlab.com/cki-project/kernel-ark/-/merge_requests/977