[PATCH v2 0/2] Prebuilt debian package example

54 views
Skip to first unread message

Jan Kiszka

unread,
Feb 13, 2021, 7:46:23 AM2/13/21
to isar-users, Henning Schild
Changes in v2:
- integrated with Henning's version, specifically including his
documentation
- converted example deb generation into pure README, removing sources


CC: Henning Schild <henning...@siemens.com>

Henning Schild (1):
doc/user_manual.md: add a section on how to deal with prebuilt debs

Jan Kiszka (1):
meta-isar: Add simple example for injecting prebuilt deb packages

doc/user_manual.md | 8 +++++++
meta-isar/conf/local.conf.sample | 2 +-
.../prebuilt-deb/files/README-create-deb.txt | 14 ++++++++++++
.../files/example-prebuilt_1.0.0-0_all.deb | Bin 0 -> 776 bytes
.../recipes-app/prebuilt-deb/prebuilt-deb.bb | 20 ++++++++++++++++++
5 files changed, 43 insertions(+), 1 deletion(-)
create mode 100644 meta-isar/recipes-app/prebuilt-deb/files/README-create-deb.txt
create mode 100644 meta-isar/recipes-app/prebuilt-deb/files/example-prebuilt_1.0.0-0_all.deb
create mode 100644 meta-isar/recipes-app/prebuilt-deb/prebuilt-deb.bb

--
2.26.2

Jan Kiszka

unread,
Feb 13, 2021, 7:51:24 AM2/13/21
to isar-users, Henning Schild
From: Henning Schild <henning...@siemens.com>

Signed-off-by: Henning Schild <henning...@siemens.com>
[Jan: some tweaks for the wording]
Signed-off-by: Jan Kiszka <jan.k...@siemens.com>
---
doc/user_manual.md | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/doc/user_manual.md b/doc/user_manual.md
index a4f3d1de..e051cc70 100644
--- a/doc/user_manual.md
+++ b/doc/user_manual.md
@@ -691,6 +691,14 @@ For the variables please have a look at the previous example, the following new
Have a look at the `example-raw` recipe to get an idea how the `dpkg-raw` class can be used to customize your image.
Note that the package will be build using the whole debian package workflow, so your package will be checked by many debhelper scripts. If those helpers point out quality issues it might be a good idea to fix them. But `example-raw` also shows how rules can still be violated.

+### Prebuilt .deb packages from somewhere
+
+In some cases you might find yourself having a `.deb` that someone else built,
+but not a proper debian repository to add to `DISTRO_APT_SOURCES` to get it from which would be the better way.
+
+Such single debs can be included if need be. You just need to write a recipe that just fetches those debs to its `WORKDIR` and deploys them.
+They can then be installed via `IMAGE_INSTALL`. Have a look at `prebuilt-deb`.
+
## Isar Cross-compilation

### Motivation
--
2.26.2

Jan Kiszka

unread,
Feb 13, 2021, 7:56:23 AM2/13/21
to isar-users, Henning Schild
From: Jan Kiszka <jan.k...@siemens.com>

While it's definitely nicer and more convenient to pull deb packages
from repos, this may not always be the case. This recipe demonstrates
how to implement such a pattern.

The example embeds the deb as local artifact which is clearly an
anti-pattern. That path was only chosen here because it's hard to find a
stable URL to a prebuilt arch-independent deb file in the wild. The
procedure for creating the deb is also included as README.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>
---
meta-isar/conf/local.conf.sample | 2 +-
.../prebuilt-deb/files/README-create-deb.txt | 14 ++++++++++++
.../files/example-prebuilt_1.0.0-0_all.deb | Bin 0 -> 776 bytes
.../recipes-app/prebuilt-deb/prebuilt-deb.bb | 20 ++++++++++++++++++
4 files changed, 35 insertions(+), 1 deletion(-)
create mode 100644 meta-isar/recipes-app/prebuilt-deb/files/README-create-deb.txt
create mode 100644 meta-isar/recipes-app/prebuilt-deb/files/example-prebuilt_1.0.0-0_all.deb
create mode 100644 meta-isar/recipes-app/prebuilt-deb/prebuilt-deb.bb

diff --git a/meta-isar/conf/local.conf.sample b/meta-isar/conf/local.conf.sample
index 107496c1..cc0b5c66 100644
--- a/meta-isar/conf/local.conf.sample
+++ b/meta-isar/conf/local.conf.sample
@@ -172,7 +172,7 @@ CONF_VERSION = "1"

#
# The default list of extra packages to be installed.
-IMAGE_INSTALL = "hello-isar example-raw example-module-${KERNEL_NAME} enable-fsck isar-exclude-docs samefile hello isar-disable-apt-cache cowsay"
+IMAGE_INSTALL = "hello-isar example-raw example-module-${KERNEL_NAME} enable-fsck isar-exclude-docs samefile hello isar-disable-apt-cache cowsay example-prebuilt"

#
# Enable cross-compilation support
diff --git a/meta-isar/recipes-app/prebuilt-deb/files/README-create-deb.txt b/meta-isar/recipes-app/prebuilt-deb/files/README-create-deb.txt
new file mode 100644
index 00000000..e2dc35dc
--- /dev/null
+++ b/meta-isar/recipes-app/prebuilt-deb/files/README-create-deb.txt
@@ -0,0 +1,14 @@
+Create test deb package:
+
+mkdir -p example-prebuilt/DEBIAN example-prebuilt/opt
+cat << EOF > example-prebuilt/DEBIAN/control
+Section: misc
+Priority: optional
+Package: example-prebuilt
+Version: 1.0.0
+Maintainer: Who Knows <who....@example.com>
+Description: Just a test package
+Architecture: all
+EOF
+echo "Just some test content" > example-prebuilt/opt/some-package-file
+dpkg -b example-prebuilt example-prebuilt_1.0.0-0_all.deb
diff --git a/meta-isar/recipes-app/prebuilt-deb/files/example-prebuilt_1.0.0-0_all.deb b/meta-isar/recipes-app/prebuilt-deb/files/example-prebuilt_1.0.0-0_all.deb
new file mode 100644
index 0000000000000000000000000000000000000000..3049dab62d8e8bb1857626e2a791e65a986c8f36
GIT binary patch
literal 776
zcmY$iNi0gvu;WTeP0CEn(@o0EODw8XP*5;5Gc-0dH8e4^R8TMg@?oT*fq|KciGl(U
zK|unSk)8opa(-S(QGSkINn(*+MHONF#>QrF{eR7?BBB@=Se{+m;>L1d0#iePBBK}s
z1c=Be={!*X&&UzWAkMu<rj~K)0a-7*O3_1S)D|b&2(F!~Wt_XYcj`Wmwjwe2$w`7W
zcNkvUUAXiyd%l*p<Pt8%i${;t8GgHeG&{q1@}?zb->yuspRjqxy_YRdYBVND7#5f2
zojAB~Q`K$05-xTIohG9<PVDox7|dXp#Wbxa(D69WhI0WI3e~HHA8q(o_0@l#o&6@(
zwlkYV_?K)u^IdHBj<EBw`SR9s+k6}UaSP9!bm#2jaM{)Sa+YpWi><u6{iPREb_CZ=
zZa$kQO<C7YzD#cVVf3r*e*bQ-lcgMsWPcVEt~~tMRy%(d=gYi(rlC>ar1|Vp{`0?+
zGmh5!vGP}B^_Qz+ljl!vuwN=~khxmP{$jH3WN!ur_pGvC@;BsPGcc|Jh7|+D;&bc5
zHXcd;%>)WEmdL1-#F9jKL;ypXP+S_BSm20@?TpBAacGgFB`_`+)+5J-+Z>rA{{;?r
zDJES0U>A4Mbkg>BhKoyfKZ^bHDTkvjv;OI?g)B0Xc6n=U6YUqgTlLZCx22wE_MFR!
zml`a@^X-z-ZcRL~D)HNvt!|yXn<jpU*XaJUbxq;V#eX>ddOzB=Yw^ccs|9VlcYWwh
z4s<OS%c<0RHl_M%-j^wDv${7sWn^i_v)|jwmVY%WF8FEJ5!1VO6oPkDY;ya}C8Bj|
ma*R#G{p}eGV}ZePiLHOqg_-NZ85l1E{lvhK&Rz8yIm`gKeJ%$8

literal 0
HcmV?d00001

diff --git a/meta-isar/recipes-app/prebuilt-deb/prebuilt-deb.bb b/meta-isar/recipes-app/prebuilt-deb/prebuilt-deb.bb
new file mode 100644
index 00000000..2f1b699e
--- /dev/null
+++ b/meta-isar/recipes-app/prebuilt-deb/prebuilt-deb.bb
@@ -0,0 +1,20 @@
+# This software is a part of ISAR.
+# Copyright (c) Siemens AG, 2021
+#
+# SPDX-License-Identifier: MIT
+
+inherit dpkg-base
+
+# 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"
+
+# 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() {
+}
--
2.26.2

Henning Schild

unread,
Feb 15, 2021, 2:50:47 AM2/15/21
to Jan Kiszka, isar-users
Am Sat, 13 Feb 2021 13:46:20 +0100
schrieb Jan Kiszka <jan.k...@siemens.com>:
prebuilt-deb-1.0.0.bb

> @@ -0,0 +1,20 @@
> +# This software is a part of ISAR.
> +# Copyright (c) Siemens AG, 2021
> +#
> +# SPDX-License-Identifier: MIT
> +
> +inherit dpkg-base
> +
> +# 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" +

file://${P}-0_all.deb

Jan Kiszka

unread,
Feb 15, 2021, 4:25:28 AM2/15/21
to Henning Schild, isar-users
Well, not consistently done in our examples. But I can change that.

>> @@ -0,0 +1,20 @@
>> +# This software is a part of ISAR.
>> +# Copyright (c) Siemens AG, 2021
>> +#
>> +# SPDX-License-Identifier: MIT
>> +
>> +inherit dpkg-base
>> +
>> +# 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" +
>
> file://${P}-0_all.deb
>

Nope, these are intentionally decoupled. No magics here, that's only
confusing.

>> +# 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() {
>> +}
>

Jan

--
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux

Jan Kiszka

unread,
Feb 15, 2021, 4:35:40 AM2/15/21
to isar-users, Henning Schild
From: Henning Schild <henning...@siemens.com>

Signed-off-by: Henning Schild <henning...@siemens.com>
[Jan: some tweaks for the wording]
Signed-off-by: Jan Kiszka <jan.k...@siemens.com>
---

Jan Kiszka

unread,
Feb 15, 2021, 4:45:41 AM2/15/21
to isar-users, Henning Schild
From: Jan Kiszka <jan.k...@siemens.com>

While it's definitely nicer and more convenient to pull deb packages
from repos, this may not always be the case. This recipe demonstrates
how to implement such a pattern.

The example embeds the deb as local artifact which is clearly an
anti-pattern. That path was only chosen here because it's hard to find a
stable URL to a prebuilt arch-independent deb file in the wild. The
procedure for creating the deb is also included as README.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>
---
meta-isar/conf/local.conf.sample | 2 +-
.../prebuilt-deb/files/README-create-deb.txt | 14 ++++++++++++
.../files/example-prebuilt_1.0.0-0_all.deb | Bin 0 -> 776 bytes
.../prebuilt-deb/prebuilt-deb_0.1.bb | 20 ++++++++++++++++++
4 files changed, 35 insertions(+), 1 deletion(-)
create mode 100644 meta-isar/recipes-app/prebuilt-deb/files/README-create-deb.txt
create mode 100644 meta-isar/recipes-app/prebuilt-deb/files/example-prebuilt_1.0.0-0_all.deb
create mode 100644 meta-isar/recipes-app/prebuilt-deb/prebuilt-deb_0.1.bb
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
new file mode 100644
index 00000000..2f1b699e
--- /dev/null
+++ b/meta-isar/recipes-app/prebuilt-deb/prebuilt-deb_0.1.bb
@@ -0,0 +1,20 @@
+# This software is a part of ISAR.
+# Copyright (c) Siemens AG, 2021
+#
+# SPDX-License-Identifier: MIT
+
+inherit dpkg-base
+
+# 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"
+
+# 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() {
+}
--
2.26.2

Jan Kiszka

unread,
Feb 15, 2021, 4:50:41 AM2/15/21
to isar-users, Henning Schild
Changes in v3:
- add a version to the recipe (but keep it decoupled from the deb
package, for demonstration purposes)

Changes in v2:
- integrated with Henning's version, specifically including his
documentation
- converted example deb generation into pure README, removing sources


CC: Henning Schild <henning...@siemens.com>

Henning Schild (1):
doc/user_manual.md: add a section on how to deal with prebuilt debs

Jan Kiszka (1):
meta-isar: Add simple example for injecting prebuilt deb packages

doc/user_manual.md | 8 +++++++
meta-isar/conf/local.conf.sample | 2 +-
.../prebuilt-deb/files/README-create-deb.txt | 14 ++++++++++++
.../files/example-prebuilt_1.0.0-0_all.deb | Bin 0 -> 776 bytes
.../prebuilt-deb/prebuilt-deb_0.1.bb | 20 ++++++++++++++++++
5 files changed, 43 insertions(+), 1 deletion(-)
create mode 100644 meta-isar/recipes-app/prebuilt-deb/files/README-create-deb.txt
create mode 100644 meta-isar/recipes-app/prebuilt-deb/files/example-prebuilt_1.0.0-0_all.deb
create mode 100644 meta-isar/recipes-app/prebuilt-deb/prebuilt-deb_0.1.bb

--
2.26.2

Henning Schild

unread,
Feb 15, 2021, 6:51:54 AM2/15/21
to Jan Kiszka, isar-users
ACK, thanks for taking over.

Henning

Am Mon, 15 Feb 2021 10:35:36 +0100
schrieb Jan Kiszka <jan.k...@siemens.com>:

Baurzhan Ismagulov

unread,
Mar 30, 2021, 4:13:11 AM3/30/21
to Jan Kiszka, isar-users, Henning Schild
On Mon, Feb 15, 2021 at 10:35:38AM +0100, Jan Kiszka wrote:
> diff --git a/doc/user_manual.md b/doc/user_manual.md
> index a4f3d1de..e051cc70 100644
> --- a/doc/user_manual.md
> +++ b/doc/user_manual.md
> @@ -691,6 +691,14 @@ For the variables please have a look at the previous example, the following new
> Have a look at the `example-raw` recipe to get an idea how the `dpkg-raw` class can be used to customize your image.
> Note that the package will be build using the whole debian package workflow, so your package will be checked by many debhelper scripts. If those helpers point out quality issues it might be a good idea to fix them. But `example-raw` also shows how rules can still be violated.
>
> +### Prebuilt .deb packages from somewhere
> +
> +In some cases you might find yourself having a `.deb` that someone else built,
> +but not a proper debian repository to add to `DISTRO_APT_SOURCES` to get it from which would be the better way.
> +
> +Such single debs can be included if need be. You just need to write a recipe that just fetches those debs to its `WORKDIR` and deploys them.
> +They can then be installed via `IMAGE_INSTALL`. Have a look at `prebuilt-deb`.
> +

Thanks, the series looks good to me. Ok to reformat at column 79 before
applying?

With kind regards,
Baurzhan.

Baurzhan Ismagulov

unread,
Apr 5, 2021, 6:00:26 AM4/5/21
to isar-users
On Mon, Feb 15, 2021 at 10:35:36AM +0100, Jan Kiszka wrote:
> Changes in v3:
> - add a version to the recipe (but keep it decoupled from the deb
> package, for demonstration purposes)

Thanks, applied to next with newlines.

With kind regards,
Baurzhan.
Reply all
Reply to author
Forward
0 new messages