[OS-BUILD PATCHv7] Makefile: Check PKGRELEASE size on dist-brew targets

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

 



From: Prarit Bhargava <prarit@xxxxxxxxxx>

Makefile: Check PKGRELEASE size on dist-brew targets

The Red Hat brew system is a build system used internally within Red Hat
which is similar to the externally available koji build system.  One of
the architectures of a brew build is 's390x+zfcpdump'.  This arch using
the default of localversion 'test' always causes the rpm build error:

"5.17.0-0.rc0.20220114gitfb3b0673b7d5.65.test.el9_b.s390x+zfcpdump" exceeds 64 characters
make: *** [Makefile:1257: include/generated/utsrelease.h] Error 1
error: Bad exit status from /var/tmp/rpm-tmp.tMkhuG (%build)

The 64 character limit is a size limit on UTSRELEASE and cannot be dynamically
changed so the only other option is to reduce the package release
(PKGRELEASE) string in length.  Removing the date field and the string
'git' results in a string that is shorter by 11 characters, with a minimal
loss in information.

This option should not be set for the dist-git target so explicitly set
PREBUILD_GIT_ONLY to zero on the dist-git and dist-git-test targets.

Add an option, PREBUILD_GIT_ONLY, to shorten the PREBUILD variable which
is used in the PKGRELEASE string.  Add a check for the size of PKGRELEASE
and return a pre-build error if PKGRELEASE is greater than 35 characters.

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
@@ -390,10 +390,19 @@ dist-koji : BUILD_FLAGS ?= $(KOJI_FLAGS) $(TEST_FLAGS)
 distg-brew: BUILD_FLAGS ?= $(BREW_FLAGS) $(TEST_FLAGS)
 distg-koji: BUILD_FLAGS ?= $(KOJI_FLAGS) $(TEST_FLAGS)
 
-dist-brew dist-koji: dist-%: dist-srpm
+dist-vr-check:
+	@# builds may include a s390x+zfcpdump arch build.  UTS_RELEASE can only have a
+	@# version-release string with max 64 chars.  The version-release for s390x+zfcpdump
+	@# is 29 characters, leaving a maximum of 35 characters for PKGRELEASE.
+	@if [ $$(echo -n $(PKGRELEASE) | wc -c) -gt 35 ]; then \
+		echo "PKGRELEASE ($(PKGRELEASE)) is too long.  Use a shorter localversion (currently $(BUILDID))"; \
+		exit 1; \
+	fi
+
+dist-brew dist-koji: dist-%: dist-vr-check dist-srpm
 	$* $(BUILD_PROFILE) build $(BUILD_FLAGS) $(BUILD_TARGET) $(SRPMS)/$(PACKAGE_NAME)-$(KVERSION)-$(PKGRELEASE)$(DIST).src.rpm $(OUTPUT_FILE)
 
-distg-brew distg-koji: distg-%:
+distg-brew distg-koji: distg-%: dist-vr-check
 	$* $(BUILD_PROFILE) build $(BUILD_FLAGS) $(BUILD_TARGET) "$(RHGITURL)?redhat/koji#$(RHGITCOMMIT)"
 
 .PHONY: $(REDHAT)/rpm/SOURCES/$(PACKAGE_NAME).spec
diff --git a/redhat/Makefile.common b/redhat/Makefile.common
index blahblah..blahblah 100644
--- a/redhat/Makefile.common
+++ b/redhat/Makefile.common
@@ -75,9 +75,18 @@ ifeq ($(SNAPSHOT),1)
     PREBUILD:=0$(KEXTRAVERSION).
     RPMKPATCHLEVEL:=$(shell expr $(RPMKPATCHLEVEL) + 1)
   endif
-  # 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).
+  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
 

--
https://gitlab.com/cki-project/kernel-ark/-/merge_requests/1579
_______________________________________________
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