public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Henning Schild <henning.schild@siemens.com>
To: Adriaan Schmidt <adriaan.schmidt@siemens.com>
Cc: isar-users@googlegroups.com
Subject: Re: [PATCH] meta: add dpkg-prebuilt.bbclass
Date: Wed, 22 Sep 2021 09:54:16 +0200	[thread overview]
Message-ID: <20210922095416.46f889d9@md1za8fc.ad001.siemens.net> (raw)
In-Reply-To: <20210921075300.25327-1-adriaan.schmidt@siemens.com>

I am not sure about the magic unpack prepend. I guess if someone want
to download more stuff they will have to ";unpack=true" to get back to
the global default.

Not sure anyone would want to do that. But if you think about a recipe
that maybe downloads multiple debs and drops a config file or license
key with dpkg-raw ... that would be harder using that class. But i
guess people could split such a recipe into multiple.

In one layer i have a recipe that brings a prebuild deb and adds a
dpkg-raw for configuration and license key.

It used to be just "a pattern" that could be easily mixed. Being a
class deleting tasks and messing with SRC_URI is problematic for such
mix recipes. But in fact one can keep using the "pattern" and not use
the class.

I think it can be merged, even if i do not see too much value. But the
value likely depends on the user ;).

Henning

Am Tue, 21 Sep 2021 09:53:00 +0200
schrieb Adriaan Schmidt <adriaan.schmidt@siemens.com>:

> This puts the existing example pattern to inject prebuilt deb packages
> (prebuilt-deb recipe) into a class, and adds two new features:
>   * `unpack=false` is added automatically.
>   * dpkg_build is removed using `deltask` instead of replacing with
> nop. This way also other dependent tasks (patch, prepare_build, ...)
> are skipped.
> 
> The existing example recipe is changed to use the new class.
> 
> Signed-off-by: Adriaan Schmidt <adriaan.schmidt@siemens.com>
> ---
>  .../prebuilt-deb/prebuilt-deb_0.1.bb          |  9 ++-------
>  meta/classes/dpkg-prebuilt.bbclass            | 20
> +++++++++++++++++++ 2 files changed, 22 insertions(+), 7 deletions(-)
>  create mode 100644 meta/classes/dpkg-prebuilt.bbclass
> 
> diff --git a/meta-isar/recipes-app/prebuilt-deb/prebuilt-deb_0.1.bb
> b/meta-isar/recipes-app/prebuilt-deb/prebuilt-deb_0.1.bb index
> 2f1b699..35a0da3 100644 ---
> a/meta-isar/recipes-app/prebuilt-deb/prebuilt-deb_0.1.bb +++
> b/meta-isar/recipes-app/prebuilt-deb/prebuilt-deb_0.1.bb @@ -3,18
> +3,13 @@ #
>  # SPDX-License-Identifier: MIT
>  
> -inherit dpkg-base
> +inherit dpkg-prebuilt
>  
>  # NOTE: The deb packages should almost never be stored in the repo
> itself but #       rather fetched from a binary-serving location. For
> this example, local #       storage was just simpler to maintain
> across all archs and distros. -#
> -# 2nd NOTE: "unpack=false" is important, bitbake unpacks deb files
> otherwise -SRC_URI =
> "file://example-prebuilt_1.0.0-0_all.deb;unpack=false" +SRC_URI =
> "file://example-prebuilt_1.0.0-0_all.deb" 
>  # Only needed if recipe name != package name, as in this case. Or
> multiple # packages are provided by a single recipe.
>  PROVIDES += "example-prebuilt"
> -
> -do_dpkg_build() {
> -}
> diff --git a/meta/classes/dpkg-prebuilt.bbclass
> b/meta/classes/dpkg-prebuilt.bbclass new file mode 100644
> index 0000000..c32224b
> --- /dev/null
> +++ b/meta/classes/dpkg-prebuilt.bbclass
> @@ -0,0 +1,20 @@
> +# This software is a part of ISAR.
> +# Copyright (C) 2021 Siemens AG
> +#
> +# SPDX-License-Identifier: MIT
> +
> +inherit dpkg-base
> +
> +python do_unpack_prepend() {
> +    # enforce unpack=false
> +    src_uri = (d.getVar('SRC_URI', True) or '').split()
> +    if len(src_uri) == 0:
> +        return
> +    def ensure_unpack_false(uri):
> +        return ';'.join([x for x in uri.split(';') if not
> x.startswith('unpack=')] + ['unpack=false'])
> +    src_uri = [ensure_unpack_false(uri) for uri in src_uri]
> +    d.setVar('SRC_URI', ' '.join(src_uri))
> +}
> +
> +deltask dpkg_build
> +addtask unpack before do_deploy_deb


  reply	other threads:[~2021-09-22  7:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-21  7:53 Adriaan Schmidt
2021-09-22  7:54 ` Henning Schild [this message]
2021-10-01 12:25   ` Schmidt, Adriaan
2021-10-04 11:07     ` Henning Schild
2021-10-15 15:42 ` Anton Mikanovich

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=20210922095416.46f889d9@md1za8fc.ad001.siemens.net \
    --to=henning.schild@siemens.com \
    --cc=adriaan.schmidt@siemens.com \
    --cc=isar-users@googlegroups.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