Skip to contentSkip to conversation

perl: Fix perl-module-* being ignored via COMPLEMENTARY_GLOB

PATCH In review [email protected] 2 participants 3 messages Jan 24, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perl: Fix perl-module-* being ignored via COMPLEMENTARY_GLOB

From: William Lyu <[email protected]>

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 changes the relationship between perl-modules and all of its perl-module-* from RRECOMMENDS to RDEPENDS. This makes sense as perl-modules should represent the collection of all optional perl-module-* packages. After this patch, perl-modules itself is being RRECOMMENDED instead of the individual perl-module-* packages perl-modules represents.

---
 meta/recipes-devtools/perl/perl_5.38.2.bb | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)
meta/recipes-devtools/perl/perl_5.38.2.bb +12 -7
index a9d684cfc5..329652a718 100644
@@ -306,8 +306,8 @@ ALTERNATIVE_PRIORITY = "40"
 ALTERNATIVE:${PN}-doc = "Thread.3"
 ALTERNATIVE_LINK_NAME[Thread.3] = "${mandir}/man3/Thread.3"
 
-# Create a perl-modules package recommending all the other perl
-# packages (actually the non modules packages and not created too)
+# Create a perl-modules package that represents the collection of all the
+# other perl packages (actually the non modules packages and not created too).
 ALLOW_EMPTY:${PN}-modules = "1"
 PACKAGES += "${PN}-modules "
 
@@ -322,11 +322,15 @@ python split_perl_packages () {
     do_split_packages(d, libdir, r'.*linux/([^\/].*)\.(pm|pl|e2x)', '${PN}-module-%s', 'perl module %s', recursive=True, allow_dirs=False, match_path=True, prepend=False)
     do_split_packages(d, libdir, r'(^(?!(CPAN\/|CPANPLUS\/|Module\/|unicore\/|.*linux\/)[^\/]).*)\.(pm|pl|e2x)', '${PN}-module-%s', 'perl module %s', recursive=True, allow_dirs=False, match_path=True, prepend=False)
 
-    # perl-modules should recommend every perl module, and only the
+    # perl-modules should runtime-depend on every perl module, and only the
     # modules. Don't attempt to use the result of do_split_packages() as some
-    # modules are manually split (eg. perl-module-unicore).
-    packages = filter(lambda p: 'perl-module-' in p, d.getVar('PACKAGES').split())
-    d.setVar(d.expand("RRECOMMENDS:${PN}-modules"), ' '.join(packages))
+    # modules are manually split (eg. perl-module-unicore). Also, the split
+    # packages should not include packages defined in RPROVIDES:${PN}. In
+    # addition, "perl-module-config-git" is not a valid package as
+    # Config_git.pl is listed under FILES:${PN}.
+    empty_module_pkgs = d.getVar(d.expand("RPROVIDES:${PN}")).split() + ['perl-module-config-git']
+    packages = filter(lambda p: 'perl-module-' in p and p not in empty_module_pkgs, d.getVar('PACKAGES').split())
+    d.setVar(d.expand("RDEPENDS:${PN}-modules"), ' '.join(packages))
 
     # Read the pre-generated dependency file, and use it to set module dependecies
     for line in open(d.expand("${WORKDIR}") + '/perl-rdepends.txt').readlines():
@@ -352,7 +356,8 @@ python() {
         d.setVar("PACKAGES_DYNAMIC", "^nativesdk-perl-module-.*")
 }
 
-RDEPENDS:${PN}-misc += "perl perl-modules"
+RDEPENDS:${PN}-misc += "perl"
+RRECOMMENDS:${PN}-misc += "perl-modules"
 RDEPENDS:${PN}-pod += "perl"
 
 BBCLASSEXTEND = "native nativesdk"
Signature · 1 line
2.43.0
#1 lore raw

meta/recipes-devtools/perl/perl_5.38.2.bb python split_perl_packages () { · line 331

Quoted 5 lines · William via lists.openembedded.org
meta/recipes-devtools/perl/perl_5.38.2.bb +5 -0
+    # modules are manually split (eg. perl-module-unicore). Also, the split
+    # packages should not include packages defined in RPROVIDES:${PN}. In
+    # addition, "perl-module-config-git" is not a valid package as
+    # Config_git.pl is listed under FILES:${PN}.
+    empty_module_pkgs = d.getVar(d.expand("RPROVIDES:${PN}")).split() + ['perl-module-config-git']

Nearly there - I think it's better to add perl-module-config-git to RPROVIDES:perl, and avoid special casing here.

Alex

#2 lore raw
Quoted 10 lines

meta/recipes-devtools/perl/perl_5.38.2.bb python split_perl_packages () { · line 331

Quoted 5 lines · William via lists.openembedded.org
meta/recipes-devtools/perl/perl_5.38.2.bb +5 -0
+    # modules are manually split (eg. perl-module-unicore). Also, the split
+    # packages should not include packages defined in RPROVIDES:${PN}. In
+    # addition, "perl-module-config-git" is not a valid package as
+    # Config_git.pl is listed under FILES:${PN}.
+    empty_module_pkgs = d.getVar(d.expand("RPROVIDES:${PN}")).split() + ['perl-module-config-git']

Nearly there - I think it's better to add perl-module-config-git to RPROVIDES:perl, and avoid special casing here.

It makes perfect sense to me now. perl-module-config-git is just like perl-module-strict. As the file - "${libdir}/perl5/${PV}/strict.pm" - corresponding to perl-module-strict is already listed under FILES:${PN}, ${PN} is effectively runtime-providing (RPROVIDES) perl-module-strict. Similarly, we see that the file - "${libdir}/perl5/${PV}/*/Config_git.pl" - corresponding to perl-module-config-git is also listed under FILES:${PN}, ${PN} is effectively runtime-providing (RPROVIDES) perl-module-config-it.

I will submit a new patch.

Thanks!
William

Quoted 2 lines

Alex