From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6753266854416875520 X-Received: by 2002:a19:cbd2:: with SMTP id b201mr3415193lfg.192.1573154002363; Thu, 07 Nov 2019 11:13:22 -0800 (PST) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a05:651c:c4:: with SMTP id 4ls1856576ljr.6.gmail; Thu, 07 Nov 2019 11:13:21 -0800 (PST) X-Google-Smtp-Source: APXvYqwrf0WGfSFBCLb2O0BLR2i7az3SZMCVYdFWVTj3kpjJOZRhOXZJKrnPFD4ILH7tWqNSK3OE X-Received: by 2002:a2e:481:: with SMTP id a1mr3718113ljf.209.1573154001758; Thu, 07 Nov 2019 11:13:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573154001; cv=none; d=google.com; s=arc-20160816; b=YJUFyJQONsKXf3ka12lWC9sF4wjpZ4gQoMA4xS/0yrCqyKt/PfbGHSWhrS2pC9sbM/ ybFtWFPzjBRCT15PAsgPxWH+KsCLD9fclwn1a6OK5tJmrQuhtyWCOxBUUbKCge98kYRm 7kuVv5Gk5lDJvzFqPydKvGLbIXfZCPHZk8w0nsKH/Lj06jVokc6+OH3kNDEMjLbX7pIF 4psSAcvO8c6i6/MTfCUsS7v0z40Nm0zqGmzz7TdcfDzCIKFK2prXCH6v3iK6O9/AwlGJ 5CWIVovBm8cRy1TyCFXl2ZoPSz0Rt0iQXF2kbEvaCdbgGLGrci0AROuTOosLkwKV6c4P UdBA== 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=UrosNFmMJPmOA3IMN5ljy4F1fmtmSZjEcEuPXXvPUj8=; b=izx7LTJeYroJzyMudFsTSR31wKKWnIMOPtXHPRVGmcXNghzRH5tCI+tu3OQyeqZavx wa55ZkUu/IvsCggCLhFfHhLPIO8HX/53ltw1S8LuTUtb7MrYeiKDjX/zy43iDr7JYHL2 I+XnWB/kj3pRZud+/TNCTxaL/1RL153WLp1SYV4Gv+f8wZlWg1dW5P+nuTXu2dkRcv7t jeF3rejXFUx+aoGMLldbUhPbuKhQwNJdbmo2pk6kZQ1cld3pjJP3dTlp3JJCVF1Gcg9/ HQM4kdaR0NeBVmYkwLyR7BKSbodSm4h6inj78UEHO79LiotsXO6/6ww0RMgtXDPIBR4a Whbg== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of henning.schild@siemens.com designates 194.138.37.40 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 gecko.sbs.de (gecko.sbs.de. [194.138.37.40]) by gmr-mx.google.com with ESMTPS id f3si337788ljg.3.2019.11.07.11.13.21 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Nov 2019 11:13:21 -0800 (PST) Received-SPF: pass (google.com: domain of henning.schild@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 henning.schild@siemens.com designates 194.138.37.40 as permitted sender) smtp.mailfrom=henning.schild@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 xA7JDKJP031788 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 7 Nov 2019 20:13:20 +0100 Received: from md1za8fc.ad001.siemens.net ([139.25.0.32]) by mail2.sbs.de (8.15.2/8.15.2) with ESMTP id xA7JDJe8019192; Thu, 7 Nov 2019 20:13:19 +0100 From: Henning Schild To: isar-users@googlegroups.com Cc: Jan Kiszka , "Dalamagkidis, Konstantinos" , chombourger@gmail.com, Henning Schild Subject: [PATCHv2 3/4] doc: write something about "debianize" and add example package Date: Thu, 7 Nov 2019 20:13:17 +0100 Message-Id: <20191107191318.11348-4-henning.schild@siemens.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191107191318.11348-1-henning.schild@siemens.com> References: <20191107191318.11348-1-henning.schild@siemens.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TUID: DnQ9kH7VGs/7 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 -- 2.23.0