Message ID | 426c29dc-ab8d-45e8-83e8-70ddcb91efce@web.de |
---|---|
State | Superseded, archived |
Headers | show |
Series | multiarch: Fix PN-to-BPN massaging | expand |
On Sat, 2024-03-30 at 15:25 +0100, 'Jan Kiszka' via isar-users wrote: > From: Jan Kiszka <jan.kiszka@siemens.com> > > SRC_URI and FILESPATH are differently built, thus can't be handled > the > same way when trying to translate PN to BPN. While entries in the > former > are space-separated, they are colon-separated in the latter. > > Furthermore, the existing logic didn't properly split the entries, > rather > processed the complete string. That was surely not desired as well. > > Account for all by handling the variables separately and by splitting > them first. This fixes warnings like > > WARNING: /build/../repo/meta-isar/recipes-core/images/isar-image- > installer.bb: Unable to get checksum for isar-image-installer-native > SRC_URI entry debian-configscript.sh: file could not be found > > Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> > --- > meta/classes/multiarch.bbclass | 16 ++++++++++------ > 1 file changed, 10 insertions(+), 6 deletions(-) > > diff --git a/meta/classes/multiarch.bbclass > b/meta/classes/multiarch.bbclass > index 5783b0bf..3123045e 100644 > --- a/meta/classes/multiarch.bbclass > +++ b/meta/classes/multiarch.bbclass > @@ -46,12 +46,16 @@ python multiarch_virtclass_handler() { > # parse time, and parsing always happens for all build variants. > So in those > # few variables, we automatically replace ${PN} with ${BPN}. > def fixup_pn_in_vars(d): > - vars = 'SRC_URI FILESPATH'.split() > - for var in vars: > - v = d.getVar(var, expand=False) > - if v is not None and '${PN}' in v: > - d.setVar(var + ':remove', v) > - d.appendVar(var, ' ' + v.replace('${PN}', '${BPN}')) > + v = d.getVar('SRC_URI', expand=False) or '' > + for uri in v.split(':'): > + if '${PN}' in uri: > + d.setVar('SRC_URI' + ':remove', uri) > + d.appendVar('SRC_URI', ' ' + uri.replace('${PN}', > '${BPN}')) > + > + v = d.getVar('FILESPATH', expand=False) or '' > + for path in v.split(':'): > + if '${PN}' in path: > + d.appendVar('FILESPATH', ':' + path.replace('${PN}', > '${BPN}')) > > # When building compat/native, the corresponding suffix needs to > be > # propagated to all bitbake dependency definitions. > -- > 2.35.3 > Hello Jan. This patch seems to make all machines except qemuamd64 unbuildable. Error happens on parsing recipe stage. Example of output when "qemuarm" is selected in kas menu: ``` ERROR: ExpansionError during parsing /build/../repo/meta-isar/recipes- app/hello/hello.bb############################ | ETA: 0:00:00 Traceback (most recent call last): File "Var <do_fetch[file-checksums]>", line 1, in <module> File "/repo/bitbake/lib/bb/fetch2/__init__.py", line 1226, in get_checksum_file_list(d=<bb.data_smart.DataSmart object at 0x7f7217696390>): """ > fetch = Fetch([], d, cache = False, localonly = True) File "/repo/bitbake/lib/bb/fetch2/__init__.py", line 1684, in Fetch.__init__(urls=['//hello'], d=<bb.data_smart.DataSmart object at 0x7f7217696390>, cache=False, localonly=True, connection_cache=None): try: > self.ud[url] = FetchData(url, d, localonly) except NonLocalMethod: File "/repo/bitbake/lib/bb/fetch2/__init__.py", line 1271, in FetchData.__init__(url='//hello', d=<bb.data_smart.DataSmart object at 0x7f7217696390>, localonly=True): self.basepath = None > (self.type, self.host, self.path, self.user, self.pswd, self.parm) = decodeurl(d.expand(url)) self.date = self.getSRCDate(d) File "/repo/bitbake/lib/bb/fetch2/__init__.py", line 357, in decodeurl(url='//hello'): if not m: > raise MalformedUrl(url) bb.data_smart.ExpansionError: Failure expanding variable do_fetch[file- checksums], expression was ${@bb.fetch.get_checksum_file_list(d)} which triggered exception MalformedUrl: The URL: '//hello' is invalid and cannot be interpreted The variable dependency chain for the failure is: do_fetch[file- checksums] ``` Best regards, Uladzimir.
On 01.04.24 14:42, Uladzimir Bely wrote: > On Sat, 2024-03-30 at 15:25 +0100, 'Jan Kiszka' via isar-users wrote: >> From: Jan Kiszka <jan.kiszka@siemens.com> >> >> SRC_URI and FILESPATH are differently built, thus can't be handled >> the >> same way when trying to translate PN to BPN. While entries in the >> former >> are space-separated, they are colon-separated in the latter. >> >> Furthermore, the existing logic didn't properly split the entries, >> rather >> processed the complete string. That was surely not desired as well. >> >> Account for all by handling the variables separately and by splitting >> them first. This fixes warnings like >> >> WARNING: /build/../repo/meta-isar/recipes-core/images/isar-image- >> installer.bb: Unable to get checksum for isar-image-installer-native >> SRC_URI entry debian-configscript.sh: file could not be found >> >> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> >> --- >> meta/classes/multiarch.bbclass | 16 ++++++++++------ >> 1 file changed, 10 insertions(+), 6 deletions(-) >> >> diff --git a/meta/classes/multiarch.bbclass >> b/meta/classes/multiarch.bbclass >> index 5783b0bf..3123045e 100644 >> --- a/meta/classes/multiarch.bbclass >> +++ b/meta/classes/multiarch.bbclass >> @@ -46,12 +46,16 @@ python multiarch_virtclass_handler() { >> # parse time, and parsing always happens for all build variants. >> So in those >> # few variables, we automatically replace ${PN} with ${BPN}. >> def fixup_pn_in_vars(d): >> - vars = 'SRC_URI FILESPATH'.split() >> - for var in vars: >> - v = d.getVar(var, expand=False) >> - if v is not None and '${PN}' in v: >> - d.setVar(var + ':remove', v) >> - d.appendVar(var, ' ' + v.replace('${PN}', '${BPN}')) >> + v = d.getVar('SRC_URI', expand=False) or '' >> + for uri in v.split(':'): >> + if '${PN}' in uri: >> + d.setVar('SRC_URI' + ':remove', uri) >> + d.appendVar('SRC_URI', ' ' + uri.replace('${PN}', >> '${BPN}')) >> + >> + v = d.getVar('FILESPATH', expand=False) or '' >> + for path in v.split(':'): >> + if '${PN}' in path: >> + d.appendVar('FILESPATH', ':' + path.replace('${PN}', >> '${BPN}')) >> >> # When building compat/native, the corresponding suffix needs to >> be >> # propagated to all bitbake dependency definitions. >> -- >> 2.35.3 >> > > Hello Jan. > > This patch seems to make all machines except qemuamd64 unbuildable. > Error happens on parsing recipe stage. > > Example of output when "qemuarm" is selected in kas menu: > > ``` > ERROR: ExpansionError during parsing /build/../repo/meta-isar/recipes- > app/hello/hello.bb############################ | > ETA: 0:00:00 > Traceback (most recent call last): > File "Var <do_fetch[file-checksums]>", line 1, in <module> > File "/repo/bitbake/lib/bb/fetch2/__init__.py", line 1226, in > get_checksum_file_list(d=<bb.data_smart.DataSmart object at > 0x7f7217696390>): > """ > > fetch = Fetch([], d, cache = False, localonly = True) > > File "/repo/bitbake/lib/bb/fetch2/__init__.py", line 1684, in > Fetch.__init__(urls=['//hello'], d=<bb.data_smart.DataSmart object at > 0x7f7217696390>, cache=False, localonly=True, connection_cache=None): > try: > > self.ud[url] = FetchData(url, d, localonly) > except NonLocalMethod: > File "/repo/bitbake/lib/bb/fetch2/__init__.py", line 1271, in > FetchData.__init__(url='//hello', d=<bb.data_smart.DataSmart object at > 0x7f7217696390>, localonly=True): > self.basepath = None > > (self.type, self.host, self.path, self.user, self.pswd, > self.parm) = decodeurl(d.expand(url)) > self.date = self.getSRCDate(d) > File "/repo/bitbake/lib/bb/fetch2/__init__.py", line 357, in > decodeurl(url='//hello'): > if not m: > > raise MalformedUrl(url) > > bb.data_smart.ExpansionError: Failure expanding variable do_fetch[file- > checksums], expression was ${@bb.fetch.get_checksum_file_list(d)} which > triggered exception MalformedUrl: The URL: '//hello' is invalid and > cannot be interpreted > The variable dependency chain for the failure is: do_fetch[file- > checksums] > ``` > Seems I shared a stale version. Jan
diff --git a/meta/classes/multiarch.bbclass b/meta/classes/multiarch.bbclass index 5783b0bf..3123045e 100644 --- a/meta/classes/multiarch.bbclass +++ b/meta/classes/multiarch.bbclass @@ -46,12 +46,16 @@ python multiarch_virtclass_handler() { # parse time, and parsing always happens for all build variants. So in those # few variables, we automatically replace ${PN} with ${BPN}. def fixup_pn_in_vars(d): - vars = 'SRC_URI FILESPATH'.split() - for var in vars: - v = d.getVar(var, expand=False) - if v is not None and '${PN}' in v: - d.setVar(var + ':remove', v) - d.appendVar(var, ' ' + v.replace('${PN}', '${BPN}')) + v = d.getVar('SRC_URI', expand=False) or '' + for uri in v.split(':'): + if '${PN}' in uri: + d.setVar('SRC_URI' + ':remove', uri) + d.appendVar('SRC_URI', ' ' + uri.replace('${PN}', '${BPN}')) + + v = d.getVar('FILESPATH', expand=False) or '' + for path in v.split(':'): + if '${PN}' in path: + d.appendVar('FILESPATH', ':' + path.replace('${PN}', '${BPN}')) # When building compat/native, the corresponding suffix needs to be # propagated to all bitbake dependency definitions.