public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: "'Jan Kiszka' via isar-users" <isar-users@googlegroups.com>
To: Cedric Hombourger <cedric.hombourger@siemens.com>,
	isar-users@googlegroups.com
Subject: Re: [PATCH v3 1/3] multiarch: introduce some helpers to later handle corner cases
Date: Fri, 4 Oct 2024 14:28:05 +0200	[thread overview]
Message-ID: <507dfa6c-8fc7-415c-8f45-4f96ebfb57ad@siemens.com> (raw)
In-Reply-To: <20240926033935.2955085-2-cedric.hombourger@siemens.com>

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

-- 
Siemens AG, Technology
Linux Expert Center

-- 
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/isar-users/507dfa6c-8fc7-415c-8f45-4f96ebfb57ad%40siemens.com.

  reply	other threads:[~2024-10-04 12:28 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-12 15:11 [PATCH 0/1] dpkg-raw: make sure do_install gets called for -compat/-native builds 'Cedric Hombourger' via isar-users
2024-09-12 15:11 ` [PATCH 1/1] " 'Cedric Hombourger' via isar-users
2024-09-13  8:08   ` 'Jan Kiszka' via isar-users
2024-09-13  8:29     ` 'cedric.hombourger@siemens.com' via isar-users
2024-09-13 10:45       ` 'Jan Kiszka' via isar-users
2024-09-13 10:52         ` 'cedric.hombourger@siemens.com' via isar-users
2024-09-13 11:04           ` 'Jan Kiszka' via isar-users
2024-09-13 11:12             ` 'cedric.hombourger@siemens.com' via isar-users
2024-09-13 11:33               ` 'cedric.hombourger@siemens.com' via isar-users
2024-09-13 12:28                 ` 'Jan Kiszka' via isar-users
2024-09-13 12:39                   ` 'cedric.hombourger@siemens.com' via isar-users
2024-09-17  7:00                     ` [PATCH v2 0/2] do not build -compat/-native for dpkg-raw packages 'Cedric Hombourger' via isar-users
2024-09-17  7:00                       ` [PATCH v2 1/2] multiarch: avoid separate builds when DPKG_ARCH is all 'Cedric Hombourger' via isar-users
2024-09-25 16:09                         ` 'Jan Kiszka' via isar-users
2024-09-17  7:00                       ` [PATCH v2 2/2] dpkg-raw: change DPKG_ARCH to all 'Cedric Hombourger' via isar-users
2024-09-25 16:11                         ` 'Jan Kiszka' via isar-users
2024-09-26  3:39                           ` [PATCH v3 0/3] do not build -compat/-native for dpkg-raw packages 'Cedric Hombourger' via isar-users
2024-09-26  3:39                             ` [PATCH v3 1/3] multiarch: introduce some helpers to later handle corner cases 'Cedric Hombourger' via isar-users
2024-10-04 12:28                               ` 'Jan Kiszka' via isar-users [this message]
2024-09-26  3:39                             ` [PATCH v3 2/3] multiarch: avoid separate builds when DPKG_ARCH is all 'Cedric Hombourger' via isar-users
2024-09-26  3:39                             ` [PATCH v3 3/3] dpkg-raw: change DPKG_ARCH to all 'Cedric Hombourger' via isar-users
2024-10-04 12:31                               ` 'Jan Kiszka' via isar-users
2024-10-04 13:11                                 ` [PATCH 1/3] dpkg-raw: use weak assignments for DPKG_ARCH and DEBIAN_MULTI_ARCH 'Cedric Hombourger' via isar-users
2024-10-04 13:11                                   ` [PATCH 2/3] multiarch: use "if not" vs "if cond is False" for consistency 'Cedric Hombourger' via isar-users
2024-10-04 13:11                                   ` [PATCH 3/3] RECIPE-API-CHANGELOG.md: clarify scope of recent multiarch/dpkg-arch changes 'Cedric Hombourger' via isar-users
2024-10-04 13:37                                     ` 'Jan Kiszka' via isar-users
2024-10-04 14:17                                       ` [PATCH v2 0/3] address review comments for dpkg-raw/multiarch 'Cedric Hombourger' via isar-users
2024-10-04 14:17                                         ` [PATCH v2 1/3] dpkg-raw: use weak assignments for DPKG_ARCH and DEBIAN_MULTI_ARCH 'Cedric Hombourger' via isar-users
2024-10-04 14:17                                         ` [PATCH v2 2/3] multiarch: use "if not" vs "if cond is False" for consistency 'Cedric Hombourger' via isar-users
2024-10-04 14:17                                         ` [PATCH v2 3/3] RECIPE-API-CHANGELOG.md: clarify scope of recent multiarch/dpkg-arch changes 'Cedric Hombourger' via isar-users
2024-10-08  5:24                                         ` [PATCH v2 0/3] address review comments for dpkg-raw/multiarch Uladzimir Bely
2024-10-10 11:25                                         ` Uladzimir Bely
2024-11-22  6:07                               ` [PATCH v3 3/3] dpkg-raw: change DPKG_ARCH to all Uladzimir Bely
2024-11-22  6:12                                 ` Uladzimir Bely
2024-11-22  6:12                                 ` 'cedric.hombourger@siemens.com' via isar-users
2024-10-04 11:54                             ` [PATCH v3 0/3] do not build -compat/-native for dpkg-raw packages Uladzimir Bely
2024-10-04 12:27                               ` 'Jan Kiszka' via isar-users
2024-09-13 12:15               ` [PATCH 1/1] dpkg-raw: make sure do_install gets called for -compat/-native builds 'Jan Kiszka' via isar-users
2024-09-13 12:37                 ` 'cedric.hombourger@siemens.com' via isar-users

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=507dfa6c-8fc7-415c-8f45-4f96ebfb57ad@siemens.com \
    --to=isar-users@googlegroups.com \
    --cc=cedric.hombourger@siemens.com \
    --cc=jan.kiszka@siemens.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox