From: Henning Schild <henning.schild@siemens.com>
To: isar-users@googlegroups.com
Cc: Alexander Smirnov <asmirnov@ilbers.de>,
Henning Schild <henning.schild@siemens.com>,
Claudius Heine <ch@denx.de>
Subject: [PATCH v2 5/6] meta/dpkg: add dpkg-raw class
Date: Tue, 12 Sep 2017 17:58:09 +0200 [thread overview]
Message-ID: <20170912155810.9434-6-henning.schild@siemens.com> (raw)
In-Reply-To: <20170912155810.9434-1-henning.schild@siemens.com>
Issues:
1. full customizations of the images is hard to impossible to
realize in a layer without touching Isar
1.1. there is no easy way to just copy a file into the image
1.2. configuration (passwords, groups, cfg-files changes) can not be
done in a layer, there is no way too hook into multistrap or the
configure-script
Change:
Introduce a class that lets users create custom debian packages on the
fly, without having to create a /debian directory and actually building.
That allows you to pull in debian-dependencies, you could have a
package that has no content and is just there to install what you need
for a feature of your product.
Using package hooks (preinst, postinst ..) you can configure pretty much
all you want when installing the package.
The package can contain actual payload as well, basically any files that
come from "somewhere else". Say binary data like wallpapers, sound files
or application binaries.
Impact:
This patch addresses the metioned issue in a way that uses debian
mechanism. All the customizations will enjoy features like
- collission protection (multiple packages providing the same file)
- config file protection
- versioning and the ability to deploy your changes in an updateable way
This patch introduces a major new feature to Isar.
This class introduces a new class for building debian packages on the
fly. They can basically contain anything from random sources, where
building happens outside of Isar. It also allows to create meta-packages
that contain nothing but pull in dependencies, once all our packets come
in via multistrap that will come in handy.
For rootfs configuration you would use post- and pre- scripts just like
regular debian packages do.
Signed-off-by: Henning Schild <henning.schild@siemens.com>
---
meta/classes/dpkg-raw.bbclass | 55 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 55 insertions(+)
create mode 100644 meta/classes/dpkg-raw.bbclass
diff --git a/meta/classes/dpkg-raw.bbclass b/meta/classes/dpkg-raw.bbclass
new file mode 100644
index 0000000..f9a7411
--- /dev/null
+++ b/meta/classes/dpkg-raw.bbclass
@@ -0,0 +1,55 @@
+# This software is a part of ISAR.
+# Copyright (C) 2017 Siemens AG
+
+inherit dpkg-base
+
+DEBIAN_DEPENDS ?= ""
+MAINTAINER ?= "FIXME Unknown maintainer"
+
+D = "${WORKDIR}/image/"
+
+# Populate folder that will be picked up as package
+# TODO this should be called 'do_install'
+do_populate_package() {
+ bbnote "Put your files for this package in ${D}"
+}
+
+addtask populate_package after do_unpack before do_deb_package_prepare
+
+# so we can put hooks etc. in there already
+do_populate_package[dirs] = "${D}/DEBIAN"
+
+do_deb_package_prepare() {
+ cat<<-__EOF__ > ${D}/DEBIAN/control
+ Package: ${PN}
+ Architecture: ${DISTRO_ARCH}
+ Section: misc
+ Priority: optional
+ Maintainer: ${MAINTAINER}
+ Depends: `echo ${DEBIAN_DEPENDS} | tr '[:blank:]' ','`
+ Version: ${PV}+isar
+ Description: ${DESCRIPTION}
+ __EOF__
+ for t in pre post
+ do
+ for a in inst rm
+ do
+ chmod -f +x ${D}/DEBIAN/${t}${a} || true
+ done
+ done
+}
+
+addtask deb_package_prepare after do_populate_package before do_deb_package_conffiles
+
+do_deb_package_conffiles() {
+ CONFFILES=${D}/DEBIAN/conffiles
+ find ${D} -type f -path '*/etc/*' | sed -e 's|^${D}|/|' >> $CONFFILES
+ test -s $CONFFILES || rm $CONFFILES
+}
+
+addtask deb_package_conffiles after do_deb_package_prepare before do_build
+
+dpkg_runbuild() {
+ sudo chown -R root:root ${D}/DEBIAN/
+ sudo chroot ${BUILDCHROOT_DIR} dpkg-deb --build ${PP}/image ${PP}
+}
--
2.13.5
next prev parent reply other threads:[~2017-09-12 15:58 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-12 15:58 [PATCH v2 0/6] v4 of the custom debian package Henning Schild
2017-09-12 15:58 ` [PATCH v2 1/6] meta: Move 'do_fetch' and 'do_unpack' to base-class Henning Schild
2017-09-12 15:58 ` [PATCH v2 2/6] meta/dpkg-debian: Move 'do_install' to new dpkg-base.bbclass Henning Schild
2017-09-12 15:58 ` [PATCH v2 3/6] meta/dpkg: pull out actual build command from 'do_build' Henning Schild
2017-09-13 12:44 ` Alexander Smirnov
2017-09-13 13:41 ` Henning Schild
2017-09-13 14:40 ` Claudius Heine
2017-09-13 15:27 ` Henning Schild
2017-09-12 15:58 ` [PATCH v2 4/6] meta/dpkg: Move 'do_build' and buildchroot stuff to dpkg-base.bbclass Henning Schild
2017-09-12 15:58 ` Henning Schild [this message]
2017-09-12 15:58 ` [PATCH v2 6/6] recipes-app/example-raw: add an example on how to use dpkg-raw Henning Schild
2017-09-13 11:39 ` Andreas Reichel
2017-09-14 7:28 ` Alexander Smirnov
2017-09-14 8:11 ` Henning Schild
2017-09-13 13:13 ` Alexander Smirnov
2017-09-13 14:15 ` Henning Schild
2017-09-13 15:06 ` Alexander Smirnov
2017-09-13 15:28 ` Henning Schild
2017-09-13 15:38 ` Alexander Smirnov
2017-09-14 8:33 ` Henning Schild
2017-09-12 17:07 ` [PATCH v2 0/6] v4 of the custom debian package Henning Schild
2017-09-13 15:00 ` [PATCH][FYI] dpkg-raw: Allow multiconfig build Alexander Smirnov
2017-09-13 15:09 ` Alexander Smirnov
2017-09-14 8:31 ` Henning Schild
2017-09-14 17:18 ` [PATCH v2 0/6] v4 of the custom debian package Alexander Smirnov
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=20170912155810.9434-6-henning.schild@siemens.com \
--to=henning.schild@siemens.com \
--cc=asmirnov@ilbers.de \
--cc=ch@denx.de \
--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