public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Henning Schild <henning.schild@siemens.com>
To: isar-users@googlegroups.com
Cc: Alexander Smirnov <alex.bluesman.smirnov@gmail.com>,
	Henning Schild <henning.schild@siemens.com>
Subject: [PATCH 11-16 of 16 v2 5/6] meta: add dpkg-bin class
Date: Thu,  3 Aug 2017 21:15:23 +0200	[thread overview]
Message-ID: <afbe7578e358b1bf901287f9d7f18427e55f34cc.1501787333.git.henning.schild@siemens.com> (raw)
In-Reply-To: <cover.1501787333.git.henning.schild@siemens.com>
In-Reply-To: <cover.1501787333.git.henning.schild@siemens.com>

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-bin.bbclass | 56 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 56 insertions(+)
 create mode 100644 meta/classes/dpkg-bin.bbclass

diff --git a/meta/classes/dpkg-bin.bbclass b/meta/classes/dpkg-bin.bbclass
new file mode 100644
index 0000000..29480ff
--- /dev/null
+++ b/meta/classes/dpkg-bin.bbclass
@@ -0,0 +1,56 @@
+# This software is a part of ISAR.
+# Copyright (C) 2017 Siemens AG
+
+inherit isar-base-dpkg
+
+DEBIAN_DEPENDS ?= ""
+MAINTAINER ?= "FIXME Unknown maintainer"
+
+D = "${WORKDIR}/image/"
+
+# Populate folder that will be picked up as package
+do_install() {
+	bbnote "Put your files for this package in ${D}"
+}
+
+addtask install after do_unpack before do_deb_package_prepare
+
+# so we can put hooks etc. in there already
+do_install[dirs] = "${D}/DEBIAN"
+
+do_deb_package_prepare() {
+	cat<<-__EOF__ > ${D}/DEBIAN/control
+		Package: ${PN}
+		Architecture: `dpkg --print-architecture`
+		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_install 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_deb_package
+
+do_deb_package() {
+	sudo chown -R root:root ${D}/DEBIAN/
+	sudo dpkg-deb --build ${D} ${WORKDIR}
+}
+
+addtask deb_package after do_deb_package_conffiles before do_package_write_deb
-- 
2.13.0


  parent reply	other threads:[~2017-08-03 19:13 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-03 19:15 [PATCH 11-16 of 16 v2 0/6] and now for the second half Henning Schild
2017-08-03 19:15 ` [PATCH 11-16 of 16 v2 1/6] meta: dpkg rename install to package_write_deb Henning Schild
2017-08-08 13:06   ` Alexander Smirnov
2017-08-08 14:49     ` Henning Schild
2017-08-08 15:06       ` Alexander Smirnov
2017-08-03 19:15 ` [PATCH 11-16 of 16 v2 2/6] package_write_deb: change access rights on .debs Henning Schild
2017-08-08 13:16   ` Alexander Smirnov
2017-08-21 23:14   ` Baurzhan Ismagulov
2017-08-03 19:15 ` [PATCH 11-16 of 16 v2 3/6] meta: classes: move package_write_deb to new class isar-base-dpkg Henning Schild
2017-08-03 19:15 ` [PATCH 11-16 of 16 v2 4/6] meta: classes: rename dpkg to dpkg-src Henning Schild
2017-08-03 19:15 ` Henning Schild [this message]
2017-08-03 19:15 ` [PATCH 11-16 of 16 v2 6/6] recipes-app/hello-bin: add example on how to use dpkg-bin Henning Schild

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=afbe7578e358b1bf901287f9d7f18427e55f34cc.1501787333.git.henning.schild@siemens.com \
    --to=henning.schild@siemens.com \
    --cc=alex.bluesman.smirnov@gmail.com \
    --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