From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6460145511220379648 X-Received: by 10.25.228.134 with SMTP id x6mr41215lfi.33.1504858542544; Fri, 08 Sep 2017 01:15:42 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 10.25.203.2 with SMTP id b2ls99112lfg.54.gmail; Fri, 08 Sep 2017 01:15:42 -0700 (PDT) X-Google-Smtp-Source: AOwi7QB9STZ7x4T7c95skPPL0chkHE8pKpB+qWqaognD5YJLHdNOLHraNE+bD83SBmnyHbIxxtjN X-Received: by 10.25.23.233 with SMTP id 102mr156750lfx.25.1504858542014; Fri, 08 Sep 2017 01:15:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504858541; cv=none; d=google.com; s=arc-20160816; b=MNsFgCkNJOeR8jwNuNCJUH/bhBDEutPjiYoMDleYFMYNBVzQlRbT6YygKSsH0ddggO +hWbm80BRzlHjJqnOtnzvlushLX+gmjbfske8fORJAU18g/7TfqlU0iS8TzSRuntY82/ NULcIM71Ah8JOHItnrEbeSLnTkQZob5fKpoR2lDkJRy3JaZTeEaRvjOHX0O5uCephmbB zC/cM+SsCpH0NacUxxVBqDrmDbKRZvqfBIRQon/bwArw4m335S5YYq9+XRvhnELQTTb5 zsq3LpTZxCliwF+3JkvJ9gJCSPi+BOgn3gU6h6Fxn97Yi/jTZtbnC/rW2tmMyqTJKH9F A6/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:arc-authentication-results; bh=hQ8Q+jeXrOCKeedUJ2FlUnR/oYEhOLCJcM2srDouCEQ=; b=MXROzZC2/dxM+G31tu6EtKWw1yBNY//p3YMlccRiO00m8X0zg8TnPsqibk5WpChpDd GJMatLWCPZrGt7jFXeeMykXM9J5rSyjWbnMtHZwwv4y8YwtLhONXYSr9NAkhWaXdutLZ qR3PWqL+WSe/RDLONxdXArWxVIwjxS0GLm6OeWVJ0vAPKpCRyKfAsTAwNzcRgauh97pK VXn3bqUOhpkHG4VZhCaGred9Hp22mo/9Y84VRJATfCx8/4QezHtOV9kczOqfjEXV++nu m4bkFJMh9sa/xsjuVhFn1oJkpMPr174P6vUCQ6XSdJ0wBCd2chqOt68WWoqDcY19FK2B /w2g== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=neutral (google.com: 192.35.17.28 is neither permitted nor denied by best guess record for domain of henning.schild@siemens.com) smtp.mailfrom=henning.schild@siemens.com Return-Path: Received: from goliath.siemens.de (goliath.siemens.de. [192.35.17.28]) by gmr-mx.google.com with ESMTPS id a20si74392wma.7.2017.09.08.01.15.41 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Sep 2017 01:15:41 -0700 (PDT) Received-SPF: neutral (google.com: 192.35.17.28 is neither permitted nor denied by best guess record for domain of henning.schild@siemens.com) client-ip=192.35.17.28; Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 192.35.17.28 is neither permitted nor denied by best guess record for domain of henning.schild@siemens.com) smtp.mailfrom=henning.schild@siemens.com Received: from mail1.siemens.de (mail1.siemens.de [139.23.33.14]) by goliath.siemens.de (8.15.2/8.15.2) with ESMTPS id v888FfVD005082 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 8 Sep 2017 10:15:41 +0200 Received: from md1em3qc ([139.25.68.40]) by mail1.siemens.de (8.15.2/8.15.2) with ESMTP id v888Fe3T025349; Fri, 8 Sep 2017 10:15:40 +0200 Date: Fri, 8 Sep 2017 10:15:49 +0200 From: Henning Schild To: Alexander Smirnov Cc: Subject: Re: [PATCH 5/6] meta/dpkg: add dpkg-custom class Message-ID: <20170908101549.25d4e3ff@md1em3qc> In-Reply-To: References: <356cb2c3f7dfead49d75580fdff10dfa8c41232e.1504119538.git.henning.schild@siemens.com> X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-TUID: hVoNQt9JX9Br Am Mon, 4 Sep 2017 18:36:23 +0300 schrieb Alexander Smirnov : > 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 > > --- > > 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: Well it is a capital "DEBIAN" folder that contains the package metadata and no build instructions like 'debian'. > 1. Why we need another do_deb_package, while do_build from dpkg class > does the same? do_build does not do the same. It eventually calls 'dpkg-buildpackage' which does "configure; make; make install; make deb" Using the same language this step is just "make deb" and it uses the debian tool 'dpkg-deb'. Custom steps for "configure; make;" could be added in the future. "make install" is do_populate_package. > 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. That would be adding support for 'debian'-izing a source package. This patch is more about packaging binaries and creating meta-packages. Henning