Message ID | 20240926033935.2955085-2-cedric.hombourger@siemens.com |
---|---|
State | Accepted, archived |
Headers | show |
Series | do not build -compat/-native for dpkg-raw packages | expand |
On 26.09.24 05:39, 'Cedric Hombourger' via isar-users wrote: > -native / -compat do not always apply and some corner cases were > found. Introduce some helper functions to refactor the existing > code without changing its semantics for now. > > Signed-off-by: Cedric Hombourger <cedric.hombourger@siemens.com> > --- > meta/classes/multiarch.bbclass | 24 +++++++++++++++++------- > 1 file changed, 17 insertions(+), 7 deletions(-) > > diff --git a/meta/classes/multiarch.bbclass b/meta/classes/multiarch.bbclass > index bb0f7983..802686d5 100644 > --- a/meta/classes/multiarch.bbclass > +++ b/meta/classes/multiarch.bbclass > @@ -5,25 +5,35 @@ > > inherit compat > python() { > + archDiffers = d.getVar('HOST_ARCH') != d.getVar('DISTRO_ARCH') > + > + def pn_multiarch_target(pn): > + return pn.endswith('-native') or pn.endswith('-compat') > + > + def extend_provides(pn, provides, d): > + if not pn_multiarch_target(pn): Redundant? You are already testing this... > + all_provides = (d.getVar('PROVIDES') or '').split() > + for p in all_provides: > + if not pn_multiarch_target(p): > + d.appendVar('PROVIDES', f' {p}-{provides}') > + d.appendVar('PROVIDES', f' {pn}-{provides}') > + > # provide compat only when we can build it > if isar_can_build_compat(d): > d.appendVar('BBCLASSEXTEND', ' compat') > > # build native separately only when it differs from the target variant > - if d.getVar('HOST_ARCH') == d.getVar('DISTRO_ARCH'): > + if archDiffers is False: > pn = d.getVar('PN') > - if not pn.endswith('-native') and not pn.endswith('-compat'): > - provides = (d.getVar('PROVIDES') or '').split() > - for p in provides: > - d.appendVar('PROVIDES', f' {p}-native') > - d.appendVar('PROVIDES', f' {pn}-native') > + if pn_multiarch_target(pn) is False: ...here. And you are using different styles ("not" vs "is False"). But these lines get reworked again with patch 2 which at least resolves the duplicate test. But check again if you are using consistent styles. > + extend_provides(pn, 'native', d) > else: > d.appendVar('BBCLASSEXTEND', ' native') > > # drop own -native build dependencies at recipe level if building natively > # and not for the builder architecture > depends = d.getVar('DEPENDS') > - if depends is not None and d.getVar('HOST_ARCH') != d.getVar('DISTRO_ARCH') \ > + if depends is not None and archDiffers \ > and not bb.utils.to_boolean(d.getVar('ISAR_CROSS_COMPILE')): > new_deps = [] > for dep in depends.split(): Jan
diff --git a/meta/classes/multiarch.bbclass b/meta/classes/multiarch.bbclass index bb0f7983..802686d5 100644 --- a/meta/classes/multiarch.bbclass +++ b/meta/classes/multiarch.bbclass @@ -5,25 +5,35 @@ inherit compat python() { + archDiffers = d.getVar('HOST_ARCH') != d.getVar('DISTRO_ARCH') + + def pn_multiarch_target(pn): + return pn.endswith('-native') or pn.endswith('-compat') + + def extend_provides(pn, provides, d): + if not pn_multiarch_target(pn): + all_provides = (d.getVar('PROVIDES') or '').split() + for p in all_provides: + if not pn_multiarch_target(p): + d.appendVar('PROVIDES', f' {p}-{provides}') + d.appendVar('PROVIDES', f' {pn}-{provides}') + # provide compat only when we can build it if isar_can_build_compat(d): d.appendVar('BBCLASSEXTEND', ' compat') # build native separately only when it differs from the target variant - if d.getVar('HOST_ARCH') == d.getVar('DISTRO_ARCH'): + if archDiffers is False: pn = d.getVar('PN') - if not pn.endswith('-native') and not pn.endswith('-compat'): - provides = (d.getVar('PROVIDES') or '').split() - for p in provides: - d.appendVar('PROVIDES', f' {p}-native') - d.appendVar('PROVIDES', f' {pn}-native') + if pn_multiarch_target(pn) is False: + extend_provides(pn, 'native', d) else: d.appendVar('BBCLASSEXTEND', ' native') # drop own -native build dependencies at recipe level if building natively # and not for the builder architecture depends = d.getVar('DEPENDS') - if depends is not None and d.getVar('HOST_ARCH') != d.getVar('DISTRO_ARCH') \ + if depends is not None and archDiffers \ and not bb.utils.to_boolean(d.getVar('ISAR_CROSS_COMPILE')): new_deps = [] for dep in depends.split():
-native / -compat do not always apply and some corner cases were found. Introduce some helper functions to refactor the existing code without changing its semantics for now. Signed-off-by: Cedric Hombourger <cedric.hombourger@siemens.com> --- meta/classes/multiarch.bbclass | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-)