[PATCH 2/4] image.in/functions.mk: automatic profiles2groups

Michael Shigorin mike at altlinux.org
Tue Jul 16 22:49:47 MSK 2019


It dawned on me this evening that there was no such thing
as automatic group (and then list) names extraction from
pkg.in/profiles in m-p; and I sort of assumed there was one
implemented already.

Here it is, actually being _the_ reason to finally factor out
that archdep-filter script.
---
 image.in/functions.mk | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/image.in/functions.mk b/image.in/functions.mk
index 17e4a3a..548a6a6 100644
--- a/image.in/functions.mk
+++ b/image.in/functions.mk
@@ -20,12 +20,26 @@ profile  = $(addprefix $(PKGDIR)/,$(call rprofile,$(1)))
 # map first argument (a function) onto second one (an argument list)
 map = $(foreach a,$(2),$(call $(1),$(a)))
 
-# happens at least twice, and variables are the same by design
+# needed once, split out for readability
+profiles2groups = $(shell $(profiles2groups_body))
+define profiles2groups_body
+{ if [ -n "$(THE_PROFILES)" ]; then \
+	  sed -rn 's,^X-Alterator-Groups=(.*)$$,\1,p' \
+		  $(call map,profile,$(THE_PROFILES)) \
+		  /dev/null \
+	  | archdep-filter; \
+fi; }
+endef
+
+# happens at least thrice, 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)); \
+{ if [ -n "$(THE_GROUPS)$(MAIN_GROUPS)$(THE_PROFILES)" ]; then \
+	sed -rn 's,^X-Alterator-PackageList=(.*)$$,\1,p' \
+		$(call map,group, \
+			$(THE_GROUPS) $(MAIN_GROUPS) \
+			$(call profiles2groups)) \
+		/dev/null; \
 fi; }
 endef
 
-- 
2.10.4


--k1lZvvs/B4yU6o8G
Content-Type: text/x-patch; charset=us-ascii
Content-Disposition: attachment; filename="0003-pkg.in-Makefile-fix-subdir-order.patch"



More information about the devel-distro mailing list