* [PATCH] meta: add dpkg-prebuilt.bbclass
@ 2021-09-21 7:53 Adriaan Schmidt
2021-09-22 7:54 ` Henning Schild
2021-10-15 15:42 ` Anton Mikanovich
0 siblings, 2 replies; 5+ messages in thread
From: Adriaan Schmidt @ 2021-09-21 7:53 UTC (permalink / raw)
To: isar-users; +Cc: Adriaan Schmidt
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
--
2.20.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] meta: add dpkg-prebuilt.bbclass
2021-09-21 7:53 [PATCH] meta: add dpkg-prebuilt.bbclass Adriaan Schmidt
@ 2021-09-22 7:54 ` Henning Schild
2021-10-01 12:25 ` Schmidt, Adriaan
2021-10-15 15:42 ` Anton Mikanovich
1 sibling, 1 reply; 5+ messages in thread
From: Henning Schild @ 2021-09-22 7:54 UTC (permalink / raw)
To: Adriaan Schmidt; +Cc: isar-users
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [PATCH] meta: add dpkg-prebuilt.bbclass
2021-09-22 7:54 ` Henning Schild
@ 2021-10-01 12:25 ` Schmidt, Adriaan
2021-10-04 11:07 ` Henning Schild
0 siblings, 1 reply; 5+ messages in thread
From: Schmidt, Adriaan @ 2021-10-01 12:25 UTC (permalink / raw)
To: Schild, Henning (T RDA IOT SES-DE); +Cc: isar-users
> From: Henning Schild <henning.schild@siemens.com>
> Sent: Mittwoch, 22. September 2021 09:54
> Subject: Re: [PATCH] meta: add dpkg-prebuilt.bbclass
>
> 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.
I guess it's possible to only append ;unpack=false to *.deb sources, but the more important issue that would break "mixed" recipes is removing all tasks between do_unpack and do_deploy_deb.
> 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.
It's true that this is not suited for "mixed" recipes that need to build a package and add a prebuilt deb. In that case you would stick to the "pattern" (and probably don't turn do_dpkg_build into a nop).
This proposal covers "inject an existing deb" only, but makes that task as simple as possible.
Adriaan
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] meta: add dpkg-prebuilt.bbclass
2021-10-01 12:25 ` Schmidt, Adriaan
@ 2021-10-04 11:07 ` Henning Schild
0 siblings, 0 replies; 5+ messages in thread
From: Henning Schild @ 2021-10-04 11:07 UTC (permalink / raw)
To: Schmidt, Adriaan (T RDA IOT SES-DE); +Cc: isar-users
Am Fri, 1 Oct 2021 14:25:27 +0200
schrieb "Schmidt, Adriaan (T RDA IOT SES-DE)"
<adriaan.schmidt@siemens.com>:
> > From: Henning Schild <henning.schild@siemens.com>
> > Sent: Mittwoch, 22. September 2021 09:54
> > Subject: Re: [PATCH] meta: add dpkg-prebuilt.bbclass
> >
> > 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.
>
> I guess it's possible to only append ;unpack=false to *.deb sources,
> but the more important issue that would break "mixed" recipes is
> removing all tasks between do_unpack and do_deploy_deb.
Yes maybe match that .deb just to be on the safe side, even if people
do not end up mixing.
> > 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.
>
> It's true that this is not suited for "mixed" recipes that need to
> build a package and add a prebuilt deb. In that case you would stick
> to the "pattern" (and probably don't turn do_dpkg_build into a nop).
>
> This proposal covers "inject an existing deb" only, but makes that
> task as simple as possible.
Sure it is valid. And you can always argue if it should not be more
than one recipe if it does multiple packages. So whoever want to deploy
multiple debs will be on a non-standard path anyways and deal with
PROVIDES and stuff.
Henning
> Adriaan
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] meta: add dpkg-prebuilt.bbclass
2021-09-21 7:53 [PATCH] meta: add dpkg-prebuilt.bbclass Adriaan Schmidt
2021-09-22 7:54 ` Henning Schild
@ 2021-10-15 15:42 ` Anton Mikanovich
1 sibling, 0 replies; 5+ messages in thread
From: Anton Mikanovich @ 2021-10-15 15:42 UTC (permalink / raw)
To: isar-users
On 21.09.21 10:53, Adriaan Schmidt wrote:
> 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>
Applied to next, thanks.
--
Anton Mikanovich
Promwad Ltd.
External service provider of ilbers GmbH
Maria-Merian-Str. 8
85521 Ottobrunn, Germany
+49 (89) 122 67 24-0
Commercial register Munich, HRB 214197
General Manager: Baurzhan Ismagulov
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-10-15 15:42 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-21 7:53 [PATCH] meta: add dpkg-prebuilt.bbclass Adriaan Schmidt
2021-09-22 7:54 ` Henning Schild
2021-10-01 12:25 ` Schmidt, Adriaan
2021-10-04 11:07 ` Henning Schild
2021-10-15 15:42 ` Anton Mikanovich
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox