public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [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

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