From: William Lyu <william....@windriver.com>

When perl-modules is added via COMPLEMENTARY_GLOB, all perl-module-*
packages recommended by perl-modules are ignored due to the defined
behavior of COMPLEMENTARY_GLOB.

This patch creates a new package perl-modules-force-all that RDEPENDS on
the same set of packages perl-modules recommends. If another recipe
always needs the packages recommended by perl-modules, it can add
perl-modules-force-all to RDEPENDS to make sure that the recommended
packages by perl-modules are not ignored by COMPLEMENTARY_GLOB.

Signed-off-by: William Lyu <william....@windriver.com>
---
 meta/recipes-devtools/perl/perl_5.38.2.bb | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/meta/recipes-devtools/perl/perl_5.38.2.bb 
b/meta/recipes-devtools/perl/perl_5.38.2.bb
index a9d684cfc5..f75c5aa971 100644
--- a/meta/recipes-devtools/perl/perl_5.38.2.bb
+++ b/meta/recipes-devtools/perl/perl_5.38.2.bb
@@ -311,6 +311,14 @@ ALTERNATIVE_LINK_NAME[Thread.3] = "${mandir}/man3/Thread.3"
 ALLOW_EMPTY:${PN}-modules = "1"
 PACKAGES += "${PN}-modules "
 
+# When perl-modules is added through COMPLEMENTARY_GLOB, as it is recommending
+# packages, all its recommendations will be ignored. So, we create a
+# perl-modules-force-all package depending on the same set of packages as 
listed
+# in perl-modules to provide a way to guarantee COMPLEMENTARY_GLOB not removing
+# these packages.
+ALLOW_EMPTY:${PN}-modules-force-all = "1"
+PACKAGES += "${PN}-modules-force-all "
+
 PACKAGESPLITFUNCS =+ "split_perl_packages"
 
 python split_perl_packages () {
@@ -328,6 +336,20 @@ python split_perl_packages () {
     packages = filter(lambda p: 'perl-module-' in p, 
d.getVar('PACKAGES').split())
     d.setVar(d.expand("RRECOMMENDS:${PN}-modules"), ' '.join(packages))
 
+    # perl-modules-force-all provides a way to prevent COMPLEMENTARY_GLOB
+    # from removing the packages specified in perl-modules.
+    # perl-modules-force-all contains the same set of packages as perl-modules.
+    d.setVar(
+        d.expand("RDEPENDS:${PN}-modules-force-all"),
+        d.getVar(d.expand("RRECOMMENDS:${PN}-modules"))
+    )
+
+    # As perl-modules-force-all depends on all other, potentially non-existent,
+    # perl packages, we allow these packages to be empty to prevent build
+    # errors.
+    for pkg in d.getVar(d.expand("RDEPENDS:${PN}-modules-force-all")).split():
+        d.setVar(d.expand("ALLOW_EMPTY:" + pkg), "1")
+
     # Read the pre-generated dependency file, and use it to set module 
dependecies
     for line in open(d.expand("${WORKDIR}") + 
'/perl-rdepends.txt').readlines():
         splitline = line.split()
-- 
2.43.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#193867): 
https://lists.openembedded.org/g/openembedded-core/message/193867
Mute This Topic: https://lists.openembedded.org/mt/103766391/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to