From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6464921707679318016 X-Received: by 10.25.115.131 with SMTP id h3mr1250591lfk.44.1505231882817; Tue, 12 Sep 2017 08:58:02 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 10.46.18.219 with SMTP id 88ls138490ljs.39.gmail; Tue, 12 Sep 2017 08:58:02 -0700 (PDT) X-Google-Smtp-Source: AOwi7QDKsygb4bWLFeb4Dg+jCgyqZn/EgqCq56MoF6PKozYBKu92P+U4WErQ21/KkCtiqnPLFb0a X-Received: by 10.25.181.214 with SMTP id g83mr1273697lfk.17.1505231882456; Tue, 12 Sep 2017 08:58:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505231882; cv=none; d=google.com; s=arc-20160816; b=Yngxamio4lgcg/tieQNMpmtDNkHbnIb1Y1i8hzUhFSjMXNfCJDwx/okOtgVyhp52mX 2djjcQiKzZeZgZxI2hwADY/VPfrBKK/SoUVoqpx036B9EpH7qj8kuWcogmWkJZbmNRqI +2g/FeJu8JachElOXZdYYbq57nz+JjPjX0rktDz1tCpsQ13knuAsZiOCtLCnyVWF+O1z 6sydo0VzidtjEQqohVlxpylSBqlwJwt81KRgY+GzYq3WWMIBFnL9mG3LwYDJsSvSca50 Wy77Q2sU7d9FqKiEv+NrhgBl2NmUCmaRrAqlDkiVrK7ic6QJVQt9R3ko67CZO86WlVRe OuXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=ipwcNYdSitUhnLY1kt6YsGGhB3cCBvPQy/uI6CIhbBY=; b=OyBM+pJ0ZhTcwPzcoBIcmbGQIzgMyeeVS2FFULks/SWGADZk3fcJtJgVhjygMkQ8lW Rg2aw8Bjf7zoZI30ivgzHjohtDtlxNT3GqL26m+f9w/oxaFUyMWkJ4EOhvg8nXSHdCiH NWVuZjYe9x8ESvxeRtIjwo4fiMLweWn2oua6+PMvpUJgupHhbtTPIDj1EUDORvitv43U kuUclnRIGKdK1gvI7LJE4OZJhNosKcK1qAzlU5T60hYFCR8ebCU6QOVf+7AcGClPMlvg y8B2rt6OM4uWI0PqQgn8L67Bvnu3XdXDiWgJSozAu93TpFs6OHp5bHNZgr+2mPxrAUJr Ot8A== 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 r185si532438wma.9.2017.09.12.08.58.02 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Sep 2017 08:58:02 -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 mail2.siemens.de (mail2.siemens.de [139.25.208.11]) by goliath.siemens.de (8.15.2/8.15.2) with ESMTPS id v8CFw1Up008094 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 12 Sep 2017 17:58:01 +0200 Received: from md1em3qc.ww002.siemens.net ([139.25.68.40]) by mail2.siemens.de (8.15.2/8.15.2) with ESMTP id v8CFw19M001102; Tue, 12 Sep 2017 17:58:01 +0200 From: Henning Schild To: isar-users@googlegroups.com Cc: Alexander Smirnov , Henning Schild , Claudius Heine Subject: [PATCH v2 5/6] meta/dpkg: add dpkg-raw class Date: Tue, 12 Sep 2017 17:58:09 +0200 Message-Id: <20170912155810.9434-6-henning.schild@siemens.com> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170912155810.9434-1-henning.schild@siemens.com> References: <20170912155810.9434-1-henning.schild@siemens.com> X-TUID: q++l5TuErn/4 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 --- 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