Skip to contentSkip to conversation

perl: Handle PACKAGES_DYNAMIC for perl-native

PATCH Superseded Khem Raj 2 participants 3 messages Oct 6, 2019 – Oct 7, 2019

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/1 perl: Handle PACKAGES_DYNAMIC for perl-native

A perl module recipe extending to provide native version causes target perl dependencies to be pulled into native build if the module recipe has RDEPENDS_${PN} = "perl-module-XXXX" e.g. libxml-sax-base-perl recipe.

The reason is that native bbclass empties out PACKAGES_DYNAMIC and perl's PACKAGES_DYNAMIC_class-target is greedy enough to usurp native modules as well.

Eventually we end up with errors like when sstate is used across machines

* ERROR: libxml-sax-base-perl-native different signature for task do_populate_sysroot.sigdata between qemux86copy and qemuarm

Therefore, to fix this native case needs to handled specially when re-assigning module dependencies in split_perl_packages(), where the modules are named correctly for native case and have a single dependency on perl-native, secondly, PACKAGES_DYNAMIC for target case needs to be reined in to spare, -native modules, thirdly, let perl-native take over the case for providing native modules

This will fix several sstate signature errors like above with external perl modules providing native variants and having runtime dependencies on modules which are provided by perl proper

---
 meta/recipes-devtools/perl/perl_5.30.0.bb | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
meta/recipes-devtools/perl/perl_5.30.0.bb +9 -4
index a221bce52b..9614477982 100644
@@ -265,13 +265,18 @@ python split_perl_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():
         splitline = line.split()
-        module = splitline[0].replace("RDEPENDS_perl", "RDEPENDS_${PN}")
-        depends = splitline[2].strip('"').replace("perl-module", "${PN}-module")
+        if bb.data.inherits_class('native', d):
+            module = splitline[0] + '-native'
+            depends = "perl-native"
+        else:
+            module = splitline[0].replace("RDEPENDS_perl", "RDEPENDS_${PN}")
+            depends = splitline[2].strip('"').replace("perl-module", "${PN}-module")
         d.appendVar(d.expand(module), " " + depends)
 }
 
-PACKAGES_DYNAMIC_class-target += "^perl-module-.*"
-PACKAGES_DYNAMIC_class-nativesdk += "^nativesdk-perl-module-.*"
+PACKAGES_DYNAMIC_class-native_forcevariable = "^perl-module-.*-native$"
+PACKAGES_DYNAMIC_class-target = "^perl-module-.*(?<!native)$"
+PACKAGES_DYNAMIC_class-nativesdk = "^nativesdk-perl-module-.*"
 
 RDEPENDS_${PN}-misc += "perl perl-modules"
 RDEPENDS_${PN}-pod += "perl"
Signature · 1 line
2.23.0
#1 lore raw
Quoted 47 lines · Khem Raj

A perl module recipe extending to provide native version causes target perl dependencies to be pulled into native build if the module recipe has RDEPENDS_${PN} = "perl-module-XXXX" e.g. libxml-sax-base-perl recipe.

The reason is that native bbclass empties out PACKAGES_DYNAMIC and perl's PACKAGES_DYNAMIC_class-target is greedy enough to usurp native modules as well.

Eventually we end up with errors like when sstate is used across machines

* ERROR: libxml-sax-base-perl-native different signature for task do_populate_sysroot.sigdata between qemux86copy and qemuarm

Therefore, to fix this native case needs to handled specially when re-assigning module dependencies in split_perl_packages(), where the modules are named correctly for native case and have a single dependency on perl-native, secondly, PACKAGES_DYNAMIC for target case needs to be reined in to spare, -native modules, thirdly, let perl-native take over the case for providing native modules

This will fix several sstate signature errors like above with external perl modules providing native variants and having runtime dependencies on modules which are provided by perl proper

---
 meta/recipes-devtools/perl/perl_5.30.0.bb | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
meta/recipes-devtools/perl/perl_5.30.0.bb +6 -2
index a221bce52b..9614477982 100644
@@ -265,13 +265,18 @@ python split_perl_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():
         splitline = line.split()
-        module = splitline[0].replace("RDEPENDS_perl", "RDEPENDS_${PN}")
-        depends = splitline[2].strip('"').replace("perl-module", "${PN}-module")
+        if bb.data.inherits_class('native', d):
+            module = splitline[0] + '-native'
+            depends = "perl-native"
+        else:
+            module = splitline[0].replace("RDEPENDS_perl", "RDEPENDS_${PN}")
+            depends = splitline[2].strip('"').replace("perl-module", "${PN}-module")
         d.appendVar(d.expand(module), " " + depends)

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

Quoted 10 lines
meta/recipes-devtools/perl/perl_5.30.0.bb +3 -2
 }
 
-PACKAGES_DYNAMIC_class-target += "^perl-module-.*"
-PACKAGES_DYNAMIC_class-nativesdk += "^nativesdk-perl-module-.*"
+PACKAGES_DYNAMIC_class-native_forcevariable = "^perl-module-.*-native$"
+PACKAGES_DYNAMIC_class-target = "^perl-module-.*(?<!native)$"
+PACKAGES_DYNAMIC_class-nativesdk = "^nativesdk-perl-module-.*"
 
 RDEPENDS_${PN}-misc += "perl perl-modules"
 RDEPENDS_${PN}-pod += "perl"

We should never be using _forcevariable in public repos, let alone OE- Core. Its a tool of last resort. I guess this is because native.bbclass is clearing it but we need to find a better way.

Cheers,

Richard

author
#2 lore raw
Quoted 63 lines · Richard Purdie
Quoted 5 lines · Khem Raj

A perl module recipe extending to provide native version causes target perl dependencies to be pulled into native build if the module recipe has RDEPENDS_${PN} = "perl-module-XXXX" e.g. libxml-sax-base-perl recipe.

Quoted 8 lines

The reason is that native bbclass empties out PACKAGES_DYNAMIC and perl's PACKAGES_DYNAMIC_class-target is greedy enough to usurp native modules as well.

Eventually we end up with errors like when sstate is used across machines

* ERROR: libxml-sax-base-perl-native different signature for task

do_populate_sysroot.sigdata between qemux86copy and qemuarm

Quoted 12 lines

Therefore, to fix this native case needs to handled specially when re-assigning module dependencies in split_perl_packages(), where the modules are named correctly for native case and have a single dependency on perl-native, secondly, PACKAGES_DYNAMIC for target case needs to be reined in to spare, -native modules, thirdly, let perl-native take over the case for providing native modules

This will fix several sstate signature errors like above with external perl modules providing native variants and having runtime dependencies on modules which are provided by perl proper

Review

Quoted 6 lines
---
 meta/recipes-devtools/perl/perl_5.30.0.bb | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
(quoted diff) +0 -0

b/meta/recipes-devtools/perl/perl_5.30.0.bb

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

Quoted 5 lines

index a221bce52b..9614477982 100644

meta/recipes-devtools/perl/perl_5.30.0.bb +0 -0
@@ -265,13 +265,18 @@ python split_perl_packages () {
     # Read the pre-generated dependency file, and use it to set module

dependecies

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

Quoted 1 line
meta/recipes-devtools/perl/perl_5.30.0.bb +0 -0
     for line in open(d.expand("${WORKDIR}") +

'/perl-rdepends.txt').readlines():

meta/recipes-devtools/perl/perl_5.30.0.bb python split_perl_packages () {

Quoted 3 lines
meta/recipes-devtools/perl/perl_5.30.0.bb +0 -2
         splitline = line.split()
-        module = splitline[0].replace("RDEPENDS_perl", "RDEPENDS_${PN}")
-        depends = splitline[2].strip('"').replace("perl-module",

"${PN}-module")

meta/recipes-devtools/perl/perl_5.30.0.bb python split_perl_packages () {

Quoted 5 lines
meta/recipes-devtools/perl/perl_5.30.0.bb +5 -0
+        if bb.data.inherits_class('native', d):
+            module = splitline[0] + '-native'
+            depends = "perl-native"
+        else:
+            module = splitline[0].replace("RDEPENDS_perl",

"RDEPENDS_${PN}")

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

Quoted 1 line
meta/recipes-devtools/perl/perl_5.30.0.bb +1 -0
+            depends = splitline[2].strip('"').replace("perl-module",

"${PN}-module")

Quoted 9 lines
meta/recipes-devtools/perl/perl_5.30.0.bb +3 -2
         d.appendVar(d.expand(module), " " + depends)
 }
 
-PACKAGES_DYNAMIC_class-target += "^perl-module-.*"
-PACKAGES_DYNAMIC_class-nativesdk += "^nativesdk-perl-module-.*"
+PACKAGES_DYNAMIC_class-native_forcevariable = "^perl-module-.*-native$"
+PACKAGES_DYNAMIC_class-target = "^perl-module-.*(?<!native)$"
+PACKAGES_DYNAMIC_class-nativesdk = "^nativesdk-perl-module-.*"
 
Quoted 6 lines

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

Quoted 2 lines
meta/recipes-devtools/perl/perl_5.30.0.bb +0 -0
 RDEPENDS_${PN}-misc += "perl perl-modules"
 RDEPENDS_${PN}-pod += "perl"

We should never be using _forcevariable in public repos, let alone OE- Core. Its a tool of last resort. I guess this is because native.bbclass is clearing it but we need to find a better way.

Ok and any suggestions that would be better here ?

Quoted 6 lines

Cheers,

Richard