From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6753266854416875520 X-Received: by 2002:a7b:c7c7:: with SMTP id z7mr8972770wmk.85.1573232965957; Fri, 08 Nov 2019 09:09:25 -0800 (PST) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a1c:f417:: with SMTP id z23ls7325235wma.5.canary-gmail; Fri, 08 Nov 2019 09:09:25 -0800 (PST) X-Google-Smtp-Source: APXvYqymtQ5R0c8aXdKbI+GS6D4grV+tQuHtp/zb6zDGiDLYbFyehQ+6wlH5KCEEODlO/Y/k8zE+ X-Received: by 2002:a1c:28d4:: with SMTP id o203mr9312783wmo.147.1573232965276; Fri, 08 Nov 2019 09:09:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573232965; cv=none; d=google.com; s=arc-20160816; b=HX5yfXrR1W6ItWCKbiZgQjiH9eBcmQEIUcIWpU+ZMjUZ8WnjVYUdkLeGpMLV+9W/tC 1O+iNOrubXDXsS9LXxzvg0TUd2s/q3uRgGBGTKBPrhP/aEynU9lprhJ2Jk1QU9cyeILE gSaF7kpwHYuzp/jVUHjbizKFCGVsnSxzRXg5WW5ficGe1xnq4T+1ax2G+UuuAfqvETUP 4YatX7wq9VDCBAMJ8fROhVbUdLJbxVcsu6KGeBXgLT+0OtPzDsSZDUJo8R+BWoGd1eFT MaQG8O82tThI8Y5bFz0VpB7PhTR9O4E6glUzaSwOzydmbk5qIxPovWyg1tDtSAW0T66e tfpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:from:references:cc:to:subject; bh=45n/Gebmq+YVnFDGqnXWuJIAT6NPatpIOd9XYxjt1bE=; b=DHNoyqGIxajx2nS43Kigd1aenC/jllKiLa00H8Gq8jEwf4ZJnklCYIX0oddc/pODXZ xXLVKvC5HTt9lxUugD9BwLs99mEKfHQ6T7lVjM3lHMnApEArehjA56uaQ22U0aHZ92bS Rk/qRACb2vuCdFxy7Rx6cw9mUUVUTrU7lLnDdr5BJUtodnyTuo4Fyvcu6HvvmnCJyRfF iIM2GE0eh8GPeCkRRWDhsvUQ3JEHJbmBiKQrnlzeE9dT07JfE4mlhk2CMrA9ltfX4yuE Evs2+uAIHJuLPVvoZ4n32/tqhO9OzcN1sAdfC1Ld8NAGAMfCF5Pw7pTGx4JqJJfPRSmT kMvA== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of jan.kiszka@siemens.com designates 194.138.37.40 as permitted sender) smtp.mailfrom=jan.kiszka@siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com Return-Path: Received: from gecko.sbs.de (gecko.sbs.de. [194.138.37.40]) by gmr-mx.google.com with ESMTPS id y140si446694wmd.0.2019.11.08.09.09.25 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Nov 2019 09:09:25 -0800 (PST) Received-SPF: pass (google.com: domain of jan.kiszka@siemens.com designates 194.138.37.40 as permitted sender) client-ip=194.138.37.40; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of jan.kiszka@siemens.com designates 194.138.37.40 as permitted sender) smtp.mailfrom=jan.kiszka@siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com Received: from mail2.sbs.de (mail2.sbs.de [192.129.41.66]) by gecko.sbs.de (8.15.2/8.15.2) with ESMTPS id xA8H9OlW006130 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 8 Nov 2019 18:09:24 +0100 Received: from [139.25.68.37] ([139.25.68.37]) by mail2.sbs.de (8.15.2/8.15.2) with ESMTP id xA8H9Nqg020754; Fri, 8 Nov 2019 18:09:23 +0100 Subject: Re: [PATCHv2 3/4] doc: write something about "debianize" and add example package To: Henning Schild , isar-users@googlegroups.com Cc: "Dalamagkidis, Konstantinos" , chombourger@gmail.com References: <20191107191318.11348-1-henning.schild@siemens.com> <20191107191318.11348-4-henning.schild@siemens.com> From: Jan Kiszka Message-ID: <74253922-df35-1b72-3948-f2aaa5683de2@siemens.com> Date: Fri, 8 Nov 2019 18:09:20 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.1 MIME-Version: 1.0 In-Reply-To: <20191107191318.11348-4-henning.schild@siemens.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-TUID: I1rrbRZPCFU8 On 07.11.19 20:13, Henning Schild wrote: > 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..18a8662 > --- /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 > Minor: git am gives two trailing whitespace warnings. Jan -- Siemens AG, Corporate Technology, CT RDA IOT SES-DE Corporate Competence Center Embedded Linux