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...@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