From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6753266854416875520 X-Received: by 2002:a17:906:394:: with SMTP id b20mr11107661eja.188.1574673501841; Mon, 25 Nov 2019 01:18:21 -0800 (PST) X-BeenThere: isar-users@googlegroups.com Received: by 2002:aa7:db0b:: with SMTP id t11ls1914051eds.1.gmail; Mon, 25 Nov 2019 01:18:21 -0800 (PST) X-Google-Smtp-Source: APXvYqzBumGZEea1qeOU5fIMWUI8etter0MkvXYJs0AtsD3YYzVp7a0NU1iSpfILy6kfyvOBeXLV X-Received: by 2002:a50:ac14:: with SMTP id v20mr17391611edc.291.1574673501332; Mon, 25 Nov 2019 01:18:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574673501; cv=none; d=google.com; s=arc-20160816; b=0uJqVIh0u9Bhd7yWVpIW+etbFFqzhzvyAozntc7vyICa8uWHOkQLrVWWhwcpS38hfz zY3xKcDeRZXbl0zn1kFLdMdVdRI8gJHHxUXOZhFAXIN7E1+0iGHPD51HRnEjT4PjRXhL Utmbp2yRpTZiHXJaLUn5T9b2n73YfzZDqmN3Gfj31IqVD+elogfiNIf3KGRvTkKrF7Gk bUHQSC/k4VsqlNcfECwrOVsWmswn2zWEEIEG1sSeiOTbvMRfgCsOuBEon2j4OOjmbd63 CdxekF1CSS8zo6oFWo+0Y4KgO6LYuXKpA0q5hoUSeJGE9SF/r6jzZpfzLMRR7g+xoEQ6 Gd8w== 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:date:subject:cc:to:from; bh=oTP/zdqof3oMLy/0svHU8Xh58OHqXssPpwoJl3Qgkic=; b=eYd8RGV3dk8MFlLKOZjDAiIEoJGqnu2+FRHGS7jPEtoac2FjmlO42DaHYAXHlNgKVT jONuVv5XvQrComLPTG0qINpgeXy926kQ3TLZ/Jjd3aXcV7IW61NWo+IYiUu599ZeNzRk bFr9Ir2TJTgbaoUkbjEayJT7wOIZl/fJFfZzII15eHzW7PESTJ+s49NP1JS/FjBWrNU4 5SZkHLpekRO0ei//VPbjsMsyME4R0T++XaWVY3gHapWIYkDWudXCPP1PJAQFVxohbX1O BoeVPBK+PVUaX/iVJXYZz+ojX+Fqitizzb7D86HQI+R5wjKh+exhkiq1FaL5OyOz458o lF6g== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of henning.schild@siemens.com designates 192.35.17.2 as permitted sender) smtp.mailfrom=henning.schild@siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com Return-Path: Received: from thoth.sbs.de (thoth.sbs.de. [192.35.17.2]) by gmr-mx.google.com with ESMTPS id n21si299157eja.0.2019.11.25.01.18.21 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 Nov 2019 01:18:21 -0800 (PST) Received-SPF: pass (google.com: domain of henning.schild@siemens.com designates 192.35.17.2 as permitted sender) client-ip=192.35.17.2; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of henning.schild@siemens.com designates 192.35.17.2 as permitted sender) smtp.mailfrom=henning.schild@siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com Received: from mail1.sbs.de (mail1.sbs.de [192.129.41.35]) by thoth.sbs.de (8.15.2/8.15.2) with ESMTPS id xAP9IJ0r017306 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 25 Nov 2019 10:18:19 +0100 Received: from md1za8fc.ad001.siemens.net ([139.25.0.65]) by mail1.sbs.de (8.15.2/8.15.2) with ESMTP id xAP9IIdN024258; Mon, 25 Nov 2019 10:18:19 +0100 From: Henning Schild To: isar-users@googlegroups.com Cc: Jan Kiszka , chombourger@gmail.com, Henning Schild Subject: [PATCHv3 3/4] doc: write something about "debianize" and add example package Date: Mon, 25 Nov 2019 10:18:14 +0100 Message-Id: <20191125091815.27502-4-henning.schild@siemens.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191125091815.27502-1-henning.schild@siemens.com> References: <20191125091815.27502-1-henning.schild@siemens.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TUID: Kbw7kiMHWGiu From: Henning Schild Add documentation in the user manual, inside the code and in form of an example that shows various ways to customize the debianization. Signed-off-by: Henning Schild --- doc/user_manual.md | 19 +++++++- .../recipes-app/samefile/samefile_2.14.bb | 45 +++++++++++++++++++ meta/classes/debianize.bbclass | 6 +++ 3 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 meta-isar/recipes-app/samefile/samefile_2.14.bb diff --git a/doc/user_manual.md b/doc/user_manual.md index e3266a9..e52f5e1 100644 --- a/doc/user_manual.md +++ b/doc/user_manual.md @@ -590,7 +590,7 @@ Isar currently supports two ways of creating custom packages. The `deb` packages are built using `dpkg-buildpackage`, so the sources should contain the `debian` directory with necessary meta information. This way is the default way of adding software that needs to be compiled from source. The bbclass for this approach is called `dpkg`. -**NOTE:** If the sources do not contain a `debian` directory your recipe can fetch, create, or ship that. +**NOTE:** If the sources do not contain a `debian` directory your recipe can fetch, create, or ship that. You might want to read the the next section before returning here. This is also what you do if you want to rebuild/modify an upstream package. Isar does understand `SRC_URI` entries starting with "apt://". For an example @@ -631,6 +631,23 @@ This approach prevents duplication of the license files in different packages. The last line in the example above adds recipe to the Isar work chain. +### Compilation of sources missing the debian/-directory + +The `debian` directory contains meta information on how to build a package from source. This is roughly speaking "configure", "compile", "install" all described in a Debian-specific way. +Isar expects your sources to contain the `debian` folder and the above steps need to be described in it, not in a task in a recipe. + +So once you have sources you always need to combine them with a `debian` folder before Isar can build a package for you. +You might be able to find a debianization for a component on the internet, i.e. Ubuntu does package an open source component while Debian does not. Your recipe could download the `debian` folder from Ubuntu and the sources from the open source project. + +You can write it yourself, which can be pretty easy but requires a bit of studying. + +Isar does actually contain a helper that aims to "debianize" sources for your. If your package uses a build-system that Debian knows and follows the well known "configure", "compile", "install" scheme that debianization might just fit your needs without reading Debian manuals. +If it does not fully fit your needs, it probably gives you a good starting point for your manual tuning. + +The shell function `deb_debianize` creates a `debian` folder. But it will not overwrite files that already are in WORKDIR. So you can either just call it to fully generate the `debian` folder. Or you combine it with pre-existing parts. + +Have a look at meta-isar/recipes-app/samefile/samefile_2.14.bb and meta/classes/debianize.bbclass for an example and the implementation. + ### Packages without source If your customization is not about compiling from source there is a second way of creating `deb` packages. That way can be used for cases like: diff --git a/meta-isar/recipes-app/samefile/samefile_2.14.bb b/meta-isar/recipes-app/samefile/samefile_2.14.bb new file mode 100644 index 0000000..5e36a2a --- /dev/null +++ b/meta-isar/recipes-app/samefile/samefile_2.14.bb @@ -0,0 +1,45 @@ +# This software is a part of ISAR. +# Copyright (c) Siemens AG, 2019 +# +# SPDX-License-Identifier: MIT + +inherit dpkg + +DEBIAN_DEPENDS = "\${misc:Depends}" +DESCRIPTION = "utility that finds files with identical contents" + +# These variables allow more control, read the classes to find the default +# values, or check bitbake -e +# MAINTAINER CHANGELOG_V DPKG_ARCH + +SRC_URI = "http://www.schweikhardt.net/samefile-2.14.tar.gz" +SRC_URI[md5sum] = "0b438249f3549f18b49cbb49b0473f70" + +do_prepare_build[cleandirs] += "${S}/debian" +do_prepare_build() { + # You could also create parts of your debianization before calling + # deb_debianize. Pre-exisiting files will not be recreated, changelog + # will be prepended unless its latest entry is for CHANGELOG_V. + cat << EOF > ${WORKDIR}/changelog +${PN} (0.1) unstable; urgency=low + + * a long long time ago there was an early version + + -- ${MAINTAINER} Thu, 24 Dec 1970 00:00:00 +0100 +EOF + + # Hooks should be placed into WORKDIR before calling deb_debianize. + cat << EOF > ${WORKDIR}/postinst +#!/bin/sh +echo "" >&2 +echo "NOTE: This package was built by Isar." >&2 +echo "" >&2 +EOF + + # This step creates everything dpkg-buildpackage needs. For further details + # you might want to look at its implementation. + deb_debianize + + # We can also customize afterwards, in this case change the package section. + sed -i -e 's/Section: misc/Section: utils/g' ${S}/debian/control +} diff --git a/meta/classes/debianize.bbclass b/meta/classes/debianize.bbclass index fb9c234..f07a432 100644 --- a/meta/classes/debianize.bbclass +++ b/meta/classes/debianize.bbclass @@ -76,23 +76,29 @@ EOF } deb_debianize() { + # create the compat-file if there is no file with that name in WORKDIR if [ -f ${WORKDIR}/compat ]; then install -v -m 644 ${WORKDIR}/compat ${S}/debian/compat else deb_create_compat fi + # create the control-file if there is no control-file in WORKDIR if [ -f ${WORKDIR}/control ]; then install -v -m 644 ${WORKDIR}/control ${S}/debian/control else deb_create_control fi + # create rules if WORKDIR does not contain a rules-file if [ -f ${WORKDIR}/rules ]; then install -v -m 755 ${WORKDIR}/rules ${S}/debian/rules else deb_create_rules fi + # prepend a changelog-entry unless an existing changelog file already + # contains an entry with CHANGELOG_V deb_add_changelog + # copy all hooks from WORKDIR into debian/, hooks are not generated for t in pre post do for a in inst rm -- 2.23.0