[OS-BUILD PATCHv3 4/4] redhat/Makefile: Fix long dist-full-help execution time

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

 



From: Prarit Bhargava <prarit@xxxxxxxxxx>

redhat/Makefile: Fix long dist-full-help execution time

@jstancek and @dzickus both noted that the execution time of
dist-full-help was longer than eight seconds.  This happens due to the
long lookup times of the git merge-base command in the localversion
variables code.

The help commands do not need 99.9% of the variable definitions, so wrap
the variable definitions with an ifeq statement to avoid execution for the
help commands.  The include of Makefile.cross and definition of HELP_TYPES
are required by the help commands, so those do remain included.

The dist-git and dist-git-headers must be modified to make the checks for
RHDISTGIT_BRANCH variable local instead of global.

Fix the long dist-full-help execution time by skipping most of the
variable definition code.

Reported-by: Jan Stancek <jstancek@xxxxxxxxxx>
Reported-by: Don Zickus <dzickus@xxxxxxxxxx>
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
@@ -6,6 +6,9 @@ include Makefile.variables
 # This section is intentionally left at the top of the Makefile so it won't be ignored.
 #
 
+# Variables do not have to be configured for help output.
+ifeq ($(filter dist-full-help dist-help dist-help-% dist-helper-%,$(MAKECMDGOALS)),)
+
 # These entries are 'duplicates' of variables specified in Makefile.variables
 # that are used in the SPEC file.  Specifying these with a SPEC prefix indicates
 # that the value is passed through to the spec file.
@@ -103,7 +106,6 @@ ifndef RHJOBS
 	  fi)
 endif
 
-ifeq ($(filter dist-full-help dist-help dist-help-% dist-helper-%,$(MAKECMDGOALS)),)
 LOCVERFILE:=../localversion
 # create an empty localversion file if you don't want a local buildid
 ifneq ($(wildcard $(LOCVERFILE)),)
@@ -119,7 +121,6 @@ else
     $(info DISTLOCALVERSION is "$(DISTLOCALVERSION)".)
   endif
 endif
-endif
 
 # options for process_configs.sh script
 ifdef NO_CONFIGCHECKS
@@ -366,6 +367,8 @@ else
   endif
 endif
 
+endif # Variables do not have to be configured for help output.
+
 include Makefile.cross
 
 # different types of help targets (for example, dist-help-misc or dist-help-build)
@@ -865,9 +868,10 @@ dist-git-test: export RH_DIST_GIT_TEST="1"
 dist-git-test: dist-git
 
 dist-git: dist-srpm $(KABI_TARBALL) $(KABIDW_TARBALL)
-ifeq ("$(RHDISTGIT_BRANCH)", "")
- $(error RHDISTGIT_BRANCH unset)
-endif
+	@if [ -z "$(RHDISTGIT_BRANCH)" ]; then \
+		echo "RHDISTGIT_BRANCH is unset"; \
+		exit 1; \
+	fi
 	$(REDHAT)/scripts/rh-dist-git.sh
 
 dist-headers-srpm:
@@ -878,9 +882,10 @@ dist-headers-srpm:
 	$(RPMBUILD) --define "_sourcedir $(SOURCES)" --define "_builddir $(RPM)/BUILD" --define "_srcrpmdir $(RPM)/SRPMS" --define "_rpmdir $(RPM)/RPMS" --define "_specdir $(RPM)/SPECS" --define "dist $(DIST)" --nodeps -bs $(RPM)/SOURCES/kernel-headers.spec
 
 dist-git-headers: dist-headers-srpm
-ifeq ("$(RHDISTGIT_BRANCH)", "")
- $(error RHDISTGIT_BRANCH unset)
-endif
+	@if [ -z "$(RHDISTGIT_BRANCH)" ]; then \
+		echo "RHDISTGIT_BRANCH is unset"; \
+		exit 1; \
+	fi
 	SPECPACKAGE_NAME=kernel-headers SRPM=$(SRPMS)/kernel-headers-$(BASEVERSION)$(DIST).src.rpm $(REDHAT)/scripts/rh-headers-dist-git.sh
 
 dist-git-headers-test: export RH_DIST_GIT_TEST="1"

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

-- 
_______________________________________________
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, report it: https://pagure.io/fedora-infrastructure/new_issue




[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