This is an automated email from the git hooks/post-receive script. guillem pushed a commit to branch main in repository dpkg.
View the commit online: https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=349e0d2f75cff33fdda9e6b8e09441af2696abae commit 349e0d2f75cff33fdda9e6b8e09441af2696abae Author: Guillem Jover <[email protected]> AuthorDate: Mon Jan 13 02:07:48 2025 +0100 scripts/mk: Use flavor to avoid re-caching empty variables We were using the or function for the variable caches, but if the variable is empty we might end up re-evaluating the contents, which means we can end up executing the same command many times. This happened to work fine with GNU make 4.3 and earlier, but stopped working correctly with GNU make 4.4, which incurs a significant slow down due to excess execution of for example dpkg-buildflags. This change alone does not restore the previous number of spawned processes, but getting back to that, implies a semantics change that can break existing code. Ref: #1092051 --- scripts/mk/architecture.mk | 2 +- scripts/mk/buildflags.mk | 2 +- scripts/mk/pkg-info.mk | 2 +- scripts/mk/vendor.mk | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/mk/architecture.mk b/scripts/mk/architecture.mk index e506fb672..ba081e07b 100644 --- a/scripts/mk/architecture.mk +++ b/scripts/mk/architecture.mk @@ -10,7 +10,7 @@ ifndef dpkg_architecture_mk_included dpkg_architecture_mk_included = yes -dpkg_lazy_eval ?= $$(or $$(value DPKG_CACHE_$(1)),$$(eval DPKG_CACHE_$(1) := $$(shell $(2)))$$(value DPKG_CACHE_$(1))) +dpkg_lazy_eval ?= $$(if $$(filter undefined,$$(flavor DPKG_CACHE_$(1))),$$(eval DPKG_CACHE_$(1) := $$(shell $(2)))$$(value DPKG_CACHE_$(1)),$$(value DPKG_CACHE_$(1))) dpkg_architecture_setvar = export $(1) ?= $(call dpkg_lazy_eval,$(1),dpkg-architecture -q$(1)) diff --git a/scripts/mk/buildflags.mk b/scripts/mk/buildflags.mk index a273b7089..7998d99f5 100644 --- a/scripts/mk/buildflags.mk +++ b/scripts/mk/buildflags.mk @@ -38,7 +38,7 @@ dpkg_buildflags_mk_included = yes # This list is kept in sync with the default set of flags returned # by dpkg-buildflags. -dpkg_lazy_eval ?= $$(or $$(value DPKG_CACHE_$(1)),$$(eval DPKG_CACHE_$(1) := $$(shell $(2)))$$(value DPKG_CACHE_$(1))) +dpkg_lazy_eval ?= $$(if $$(filter undefined,$$(flavor DPKG_CACHE_$(1))),$$(eval DPKG_CACHE_$(1) := $$(shell $(2)))$$(value DPKG_CACHE_$(1)),$$(value DPKG_CACHE_$(1))) DPKG_BUILDFLAGS_LIST := $(foreach var,\ ASFLAGS \ diff --git a/scripts/mk/pkg-info.mk b/scripts/mk/pkg-info.mk index 017f51918..1cfd62121 100644 --- a/scripts/mk/pkg-info.mk +++ b/scripts/mk/pkg-info.mk @@ -48,7 +48,7 @@ ifndef dpkg_pkg_info_mk_included dpkg_pkg_info_mk_included = yes -dpkg_late_eval ?= $(or $(value DPKG_CACHE_$(1)),$(eval DPKG_CACHE_$(1) := $(shell $(2)))$(value DPKG_CACHE_$(1))) +dpkg_late_eval ?= $(if $(filter undefined,$(flavor DPKG_CACHE_$(1))),$(eval DPKG_CACHE_$(1) := $(shell $(2)))$(value DPKG_CACHE_$(1)),$(value DPKG_CACHE_$(1))) DEB_SOURCE = $(call dpkg_late_eval,DEB_SOURCE,dpkg-parsechangelog -SSource) DEB_VERSION = $(call dpkg_late_eval,DEB_VERSION,dpkg-parsechangelog -SVersion) diff --git a/scripts/mk/vendor.mk b/scripts/mk/vendor.mk index 1d33299a0..18da22a56 100644 --- a/scripts/mk/vendor.mk +++ b/scripts/mk/vendor.mk @@ -45,7 +45,7 @@ ifndef dpkg_datadir endif include $(dpkg_datadir)/buildapi.mk -dpkg_late_eval ?= $(or $(value DPKG_CACHE_$(1)),$(eval DPKG_CACHE_$(1) := $(shell $(2)))$(value DPKG_CACHE_$(1))) +dpkg_late_eval ?= $(if $(filter undefined,$(flavor DPKG_CACHE_$(1))),$(eval DPKG_CACHE_$(1) := $(shell $(2)))$(value DPKG_CACHE_$(1)),$(value DPKG_CACHE_$(1))) DEB_VENDOR = $(call dpkg_late_eval,DEB_VENDOR,dpkg-vendor --query Vendor) DEB_PARENT_VENDOR = $(call dpkg_late_eval,DEB_PARENT_VENDOR,dpkg-vendor --query Parent) -- Dpkg.Org's dpkg

