public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Henning Schild <henning.schild@siemens.com>
To: Alexander Smirnov <asmirnov@ilbers.de>
Cc: Jan Kiszka <jan.kiszka@siemens.com>, <isar-users@googlegroups.com>
Subject: Re: [PATCH 5/6] meta/dpkg: add dpkg-custom class
Date: Fri, 8 Sep 2017 10:20:16 +0200	[thread overview]
Message-ID: <20170908102016.73b2513d@md1em3qc> (raw)
In-Reply-To: <8e7d0e5f-ac47-7a83-6bdd-8c04654af5e7@ilbers.de>

Am Mon, 4 Sep 2017 19:30:43 +0300
schrieb Alexander Smirnov <asmirnov@ilbers.de>:

> On 09/04/2017 07:08 PM, Jan Kiszka wrote:
> > On 2017-09-04 17:36, Alexander Smirnov wrote:  
> >> On 08/30/2017 10:03 PM, Henning Schild wrote:  
> >>> 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.
> >>>  
> >>
> >> Good idea.
> >>  
> >>> Signed-off-by: Henning Schild <henning.schild@siemens.com>
> >>> ---
> >>>    meta/classes/dpkg-custom.bbclass | 57
> >>> ++++++++++++++++++++++++++++++++++++++++
> >>>    1 file changed, 57 insertions(+)
> >>>    create mode 100644 meta/classes/dpkg-custom.bbclass
> >>>
> >>> diff --git a/meta/classes/dpkg-custom.bbclass
> >>> b/meta/classes/dpkg-custom.bbclass
> >>> new file mode 100644
> >>> index 0000000..e4e743f
> >>> --- /dev/null
> >>> +++ b/meta/classes/dpkg-custom.bbclass
> >>> @@ -0,0 +1,57 @@
> >>> +# This software is a part of ISAR.
> >>> +# Copyright (C) 2017 Siemens AG
> >>> +
> >>> +inherit dpkg
> >>> +
> >>> +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: `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_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_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_install 
> >>
> >> If I got this correctly, the difference from dpkg-debian flow is
> >> that you generate 'debian' folder on the fly. So:
> >>
> >> 1. Why we need another do_deb_package, while do_build from dpkg
> >> class does the same?
> >>
> >> 2. Can we just add optional task to generic pipeline which
> >> generates debian folder? Or make it as a part of do_build: if [ !
> >> -d ${D}/debian ]; then blablabla.
> >>  
> > 
> > I'm not too deep into the details here, but the general
> > considerations should be here:
> > 
> > - Do both classes share enough code to unify them?  
> 
>  From my POV - yes.

I do not think so. Because it is not about 'debian'-izing the sources
before do_build but rather replacing do_build with a series of tasks
that use other debian tools. So it is an orthogonal workflow from the
source to the debian package.

Henning

> 
> > - Is it easy enough for the user to specify and the class to derive
> > the mode of operation when there is only one class?  
> 
> That's, for example, how autotools work in Yocto. If you need to run 
> autoconf/configure in your recipe, you just:
> 
> inherit autotools
> 
> and respective tasks are added to your pipeline. So in current case, 
> user could inherit some 'debian-gen' class, which adds task that 
> generates debian folder for your project.
> 
> In my opinion, the pipeline should stay the same, but some tasks
> could be included/excluded on demand.
> 
> Alex
> 


  parent reply	other threads:[~2017-09-08  8:20 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-30 19:03 [PATCH 0/6] v3 of getting the custom debian package in Henning Schild
2017-08-30 19:03 ` [PATCH 1/6] meta/dpkg: Make 'do_unpack' more generic, prepare for pulling out Henning Schild
2017-09-04 15:11   ` Alexander Smirnov
2017-09-04 16:47     ` Jan Kiszka
2017-09-05  7:05     ` Claudius Heine
2017-09-05  7:25       ` Alexander Smirnov
2017-09-05  7:37         ` Alexander Smirnov
2017-09-05  7:56           ` Claudius Heine
2017-09-08  8:30           ` Henning Schild
2017-09-08  8:44             ` Claudius Heine
2017-09-08  9:03               ` Henning Schild
2017-08-30 19:03 ` [PATCH 2/6] meta: Move 'do_fetch' and 'do_unpack' to base-class Henning Schild
2017-09-04 15:14   ` Alexander Smirnov
2017-09-04 16:03     ` Jan Kiszka
2017-09-04 16:10       ` Alexander Smirnov
2017-09-04 16:11         ` Jan Kiszka
2017-09-04 16:39           ` Alexander Smirnov
2017-09-04 16:45             ` Jan Kiszka
2017-08-30 19:03 ` [PATCH 3/6] meta/dpkg: rename to dpkg-debian and add comment Henning Schild
2017-08-31  8:23   ` Claudius Heine
2017-09-04 15:17   ` Alexander Smirnov
2017-09-04 16:05     ` Jan Kiszka
2017-08-30 19:03 ` [PATCH 4/6] meta/dpkg-debian: Make 'do_install' more generic, prepare for pulling out Henning Schild
2017-08-30 19:09   ` Henning Schild
2017-09-08  8:35     ` Henning Schild
2017-08-30 19:03 ` [PATCH 5/6] meta/dpkg: add dpkg-custom class Henning Schild
2017-08-31  8:38   ` Claudius Heine
2017-08-31  8:42     ` Jan Kiszka
2017-08-31  9:10       ` Claudius Heine
2017-08-31  9:32       ` Henning Schild
2017-08-31 12:14         ` Claudius Heine
2017-08-31 13:39           ` Henning Schild
2017-09-11  8:39       ` Alexander Smirnov
2017-08-31  8:53     ` Claudius Heine
2017-08-31 10:21       ` Henning Schild
2017-09-04 15:36   ` Alexander Smirnov
2017-09-04 16:08     ` Jan Kiszka
2017-09-04 16:30       ` Alexander Smirnov
2017-09-04 16:53         ` Jan Kiszka
2017-09-08  8:20         ` Henning Schild [this message]
2017-09-08  8:15     ` Henning Schild
2017-09-08  8:31       ` Alexander Smirnov
2017-09-08  8:42         ` Henning Schild
2017-09-08  8:50           ` Alexander Smirnov
2017-09-11  8:13     ` Claudius Heine
2017-09-11  8:19       ` Henning Schild
2017-09-11  9:12         ` Claudius Heine
2017-09-11  8:42       ` Claudius Heine
2017-08-30 19:03 ` [PATCH 6/6] recipes-app/example-custom: add example on how to use dpkg-custom Henning Schild
2017-09-04 15:40   ` Alexander Smirnov
2017-09-06  7:36     ` 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=20170908102016.73b2513d@md1em3qc \
    --to=henning.schild@siemens.com \
    --cc=asmirnov@ilbers.de \
    --cc=isar-users@googlegroups.com \
    --cc=jan.kiszka@siemens.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