From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6460145511220379648 X-Received: by 10.223.166.162 with SMTP id t31mr170324wrc.27.1504119837900; Wed, 30 Aug 2017 12:03:57 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 10.28.178.75 with SMTP id b72ls973107wmf.27.canary-gmail; Wed, 30 Aug 2017 12:03:57 -0700 (PDT) X-Google-Smtp-Source: ADKCNb5UVLQS2h9OWrdgldJhJr0k8GYDEvhFZS/yFjWerF8vA+a/NGpWu2fCKW9r7PS8Qjc7pqB7 X-Received: by 10.28.217.17 with SMTP id q17mr291897wmg.30.1504119837510; Wed, 30 Aug 2017 12:03:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504119837; cv=none; d=google.com; s=arc-20160816; b=QMOuwfRIpx0XmwvVv+mKfMlUjNQnCV/JDZtAck3XYkSYe3Fym50z9/lp7Auv9fCQAT sArJ8RGyBBwhMxyI/2PEyB5dnjkzYjV0gL8+Or+Vhw+mfsFzjyVP8kj8gHO09JOyFwB/ wKs8AEDdIq6afnwiqRrjWrtLcpMGv6e10LLAqgxQaOLAUxb+yfWqG7u0Zv0ZxPQmBS3G cWHkwYAtgKX5BYSft3kDfGG9qN/lEWPaY/ofqypRpZLXCPIK66dzU97fqZO+Mg6TWxOf mMAFig8V+/2CViHwr3j6dBYVgb0zY4H8HJwwojKTlhtbGNIrfjXyoJTOZ0gXeUp47fqH G/Jw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=N3dp0vROUzV8q9sIY2zCgGRCuFjlec+6VikuKeETSrI=; b=BX0aSgj/YglhmOCPeXzMZCiG3XhefNsoseRrJkY2Tbj0kC6OnERqpOQCv0crBLSJ8l DIeGh4yYD2huUKslM+nTR98+evo8QHGYPl7CbvlmWVIMAa9R8rtTwUF/1LmCbgA3M6A4 NMbeoG1Id1aj14aYrP0uoNP+U0OtnawTwYmJBQ80XsbJ+mMHE0A/590z7wF7+Gy3AqDi tNtBRkBsuqUOjzHiO+TbIuSQ9v0CyDhAmLwTUgxse+elChKUqo5u5IKbefovY9IO8R+d 7jE1wshdPr5m3vTKa+U2LIFZM8lD4p9MohL0jZogL8IojJMVxPXPC+XlVsdiAfk2EyZB WJhA== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=neutral (google.com: 192.35.17.2 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 thoth.sbs.de (thoth.sbs.de. [192.35.17.2]) by gmr-mx.google.com with ESMTPS id e84si216706wmc.4.2017.08.30.12.03.57 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 30 Aug 2017 12:03:57 -0700 (PDT) Received-SPF: neutral (google.com: 192.35.17.2 is neither permitted nor denied by best guess record for domain of henning.schild@siemens.com) client-ip=192.35.17.2; Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 192.35.17.2 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 thoth.sbs.de (8.15.2/8.15.2) with ESMTPS id v7UJ3u3u024101 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 30 Aug 2017 21:03:56 +0200 Received: from md1em3qc.ad001.siemens.net ([139.25.68.40]) by mail2.siemens.de (8.15.2/8.15.2) with ESMTP id v7UJ3t5k027281; Wed, 30 Aug 2017 21:03:56 +0200 From: Henning Schild To: isar-users@googlegroups.com Cc: Alexander Smirnov , Christian Storm , Claudius Heine , Henning Schild Subject: [PATCH 5/6] meta/dpkg: add dpkg-custom class Date: Wed, 30 Aug 2017 21:03:56 +0200 Message-Id: <356cb2c3f7dfead49d75580fdff10dfa8c41232e.1504119538.git.henning.schild@siemens.com> X-Mailer: git-send-email 2.13.5 In-Reply-To: References: In-Reply-To: References: X-TUID: Z3HygQ48GFK0 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-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 -- 2.13.5