ALT Linux Bugzilla
– Attachment 12139 Details for
Bug 44561
Зависает сборка с make 4.4.0, если заданы THE_GROUPS или MAIN_GROUPS
New bug
|
Search
|
[?]
|
Help
Register
|
Log In
[x]
|
Forgot Password
Login:
[x]
|
EN
|
RU
[patch]
Защита функций от спонтанного выполнения в make-4.4
0001-image.in-functions.mk-protect-the-code-from-spontane.patch (text/plain), 3.99 KB, created by
Антон Мидюков
on 2022-12-22 18:10:28 MSK
(
hide
)
Description:
Защита функций от спонтанного выполнения в make-4.4
Filename:
MIME Type:
Creator:
Антон Мидюков
Created:
2022-12-22 18:10:28 MSK
Size:
3.99 KB
patch
obsolete
>From db34d3c4ea13047293f07af1b773980afb7d7ddd Mon Sep 17 00:00:00 2001 >From: Anton Midyukov <antohami@altlinux.org> >Date: Thu, 22 Dec 2022 00:58:17 +0700 >Subject: [PATCH] image.in/functions.mk: protect the code from spontaneous > execution > >The new make-4.4 does not reset '$(1)', '$(2)', etc. when do recursively >expanding. So the functions fire spontaneously. The reason for recursive >expanding might be to use $(shell ...). > >To protect the code from spontaneous execution, we add a match check >'$(0)' to the function name. The '$(0)' variable must always have the >name of our function at the time of the call. If this is not the case, >then we are out of the $(call ...) context. > >From make documentation: > >| The syntax of the 'call' function is: >| >| $(call VARIABLE,PARAM,PARAM,...) >| >| When 'make' expands this function, it assigns each PARAM to temporary >| variables '$(1)', '$(2)', etc. The variable '$(0)' will contain >| VARIABLE. > >Fix ALT bug 44561 > >See also: >https://github.com/osboot/make-initrd/commit/60afcd997affe150fe1153006ffcc1adac735710 >--- > image.in/functions.mk | 60 ++++++++++++++++++++++++++++++------------- > 1 file changed, 42 insertions(+), 18 deletions(-) > >diff --git a/image.in/functions.mk b/image.in/functions.mk >index 9289ca1a35..163cd0d36e 100644 >--- a/image.in/functions.mk >+++ b/image.in/functions.mk >@@ -12,28 +12,46 @@ ARCH ?= $(shell arch | sed 's/i686/i586/; s/armv.*/arm/') > DATE ?= $(shell date +%Y%m%d) > > # prefix pkglist name with its directory to form a path (relative/absolute) >-rlist = $(1:%=lists/%) >-list = $(addprefix $(PKGDIR)/,$(call rlist,$(1))) >+define rlist >+$(if $(filter rlist,$(0)),$(1:%=lists/%)) >+endef >+ >+define list >+$(if $(filter list,$(0)),$(addprefix $(PKGDIR)/,$(call rlist,$(1)))) >+endef > > # prefix/suffix group name to form a path (relative/absolute) >-rgroup = $(1:%=groups/%.directory) >-group = $(addprefix $(PKGDIR)/,$(call rgroup,$(1))) >+define rgroup >+$(if $(filter rgroup,$(0)),$(1:%=groups/%.directory)) >+endef >+ >+define group >+$(if $(filter group,$(0)),$(addprefix $(PKGDIR)/,$(call rgroup,$(1)))) >+endef > > # prefix/suffix pkg profile name to form a path (relative/absolute) >-rprofile = $(1:%=profiles/%.directory) >-profile = $(addprefix $(PKGDIR)/,$(call rprofile,$(1))) >+define rprofile >+$(if $(filter rprofile,$(0)),$(1:%=profiles/%.directory)) >+endef >+ >+define profile >+$(if $(filter profile,$(0)),$(addprefix $(PKGDIR)/,$(call rprofile,$(1)))) >+endef > > # map first argument (a function) onto second one (an argument list) >-map = $(foreach a,$(2),$(call $(1),$(a))) >+define map >+$(if $(filter map,$(0)),$(foreach a,$(2),$(call $(1),$(a)))) >+endef > > # happens at least twice, and variables are the same by design >-groups2lists = $(shell $(groups2lists_body)) >-define groups2lists_body >-{ if [ -n "$(THE_GROUPS)$(MAIN_GROUPS)" ]; then \ >- sed -rn 's,^X-Alterator-PackageList=(.*)$$,\1,p' \ >- $(call map,group,$(THE_GROUPS) $(MAIN_GROUPS)) | \ >- sed 's/;/\n/g'; \ >-fi; } >+define groups2lists >+$(if $(filter groups2lists,$(0)),$(shell \ >+ if [ -n "$(THE_GROUPS)$(MAIN_GROUPS)" ]; then \ >+ sed -rn 's,^X-Alterator-PackageList=(.*)$$,\1,p' \ >+ $(call map,group,$(THE_GROUPS) $(MAIN_GROUPS)) | \ >+ sed 's/;/\n/g'; \ >+ fi; \ >+)) > endef > > # kernel package list generation; see also #24669 >@@ -41,15 +59,21 @@ NULL := > SPACE := $(NULL) # the officially documented way of getting a space > COMMA := , > >-list2re = $(subst $(SPACE),|,$(strip $(1))) >+define list2re >+$(if $(filter list2re,$(0)),$(subst $(SPACE),|,$(strip $(1)))) >+endef > > # args: KFLAVOURS, KMODULES > # NB: $(2) could be empty >-kpackages = $(and $(1), \ >- ^kernel-(image|modules-($(call list2re,$(2))))-($(call list2re,$(1)))$$) >+define kpackages >+$(if $(filter kpackages,$(0)),$(and $(1), \ >+ ^kernel-(image|modules-($(call list2re,$(2))))-($(call list2re,$(1)))$$)) >+endef > > # arg: branding subpackages >-branding = $(and $(1),^branding-$(BRANDING)-($(call list2re,$(1)))$$) >+define branding >+$(if $(filter branding,$(0)),$(and $(1),^branding-$(BRANDING)-($(call list2re,$(1)))$$)) >+endef > > endif > endif >-- >2.33.5 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 44561
:
12132
| 12139