From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6652594697292218368 X-Received: by 2002:adf:9d19:: with SMTP id k25mr890693wre.27.1548930219666; Thu, 31 Jan 2019 02:23:39 -0800 (PST) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a1c:a9d1:: with SMTP id s200ls295872wme.2.canary-gmail; Thu, 31 Jan 2019 02:23:39 -0800 (PST) X-Google-Smtp-Source: AHgI3IYzP9sYIjLqUvG39zHdG6Ti4jKUoLL5/7NERooFXXNAFbMeJSQBz/cmfEAbKeS4/3xxR/Y1 X-Received: by 2002:a1c:1889:: with SMTP id 131mr1151355wmy.5.1548930219140; Thu, 31 Jan 2019 02:23:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548930219; cv=none; d=google.com; s=arc-20160816; b=NXlhjDY2ekMSJwAjqP0Rb92AL0CPi1D+PTj0dQtAHDl7d3eT5SYz3/XhCB2A2M27qf bETwUeuSE+8zH+tEaS3gJG8PIUsx0Uou5WN2OnqKQBaWXSEfhaK6lDgfAnjINfeRsn96 IHVntQCThUzx2KpFNGkmuPXOi0kvYF/WqLtulEANDFkqfZmX03img8fPEEspoRfsrRyO 4M2ANzLnRx6u+hT8h4nKHX/eN14JrG4ZLUHNpKc6Xxtoim00xUqpm2JCZ/NVbk+fBtQ/ J7akkSASvJjLsXi0joz2YID/SHUkxYFOOyS17JURL1qHM4ov0VUg6GwuAJ3tHLWjQJys tCTw== 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=amvmGzRqtAToRd0Hu5V7mYkRF6QfGqkx5/DH5gcL3pw=; b=dJlFiOLj1qdhYeEVvUMrebusVGCtH6JuTuyI6uY7q4aLyogNIgUNpEZImbh4dff508 60b5HLzgz51WFHh45gT5SbHj9oLrxNeuwkRqgUqoN5MnOWV2qYjax89EzOfFmpz38/Wc GdTeIp1bML57FqPmgVrRW0tUpsyyArbEslFc+FionoABTsrC0Q8tRWymZSK5p2g9WZgD k3yxzVnfQREaCAgGN4MUDw82jpoR0Qd+XTMNptZ2niOA+pb14zd2hXx9jZGfH516WYCH 0qNDAJcHuNOF0BSdWit5DYntFpAwsHPylxqMKx0mOFtBGJjQ7HIlDfjrKPCrdOSvSV4l GRsg== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of jan.kiszka@siemens.com designates 192.35.17.28 as permitted sender) smtp.mailfrom=jan.kiszka@siemens.com Return-Path: Received: from goliath.siemens.de (goliath.siemens.de. [192.35.17.28]) by gmr-mx.google.com with ESMTPS id q63si67769wme.2.2019.01.31.02.23.39 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 31 Jan 2019 02:23:39 -0800 (PST) Received-SPF: pass (google.com: domain of jan.kiszka@siemens.com designates 192.35.17.28 as permitted sender) client-ip=192.35.17.28; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of jan.kiszka@siemens.com designates 192.35.17.28 as permitted sender) smtp.mailfrom=jan.kiszka@siemens.com Received: from mail1.sbs.de (mail1.sbs.de [192.129.41.35]) by goliath.siemens.de (8.15.2/8.15.2) with ESMTPS id x0VANcIG015256 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 31 Jan 2019 11:23:38 +0100 Received: from [167.87.23.147] ([167.87.23.147]) by mail1.sbs.de (8.15.2/8.15.2) with ESMTP id x0VANbTE030674; Thu, 31 Jan 2019 11:23:37 +0100 Subject: Re: [RFC PATCH 1/1] meta: added template file system and switched recipes to it To: "[ext] claudius.heine.ext@siemens.com" , isar-users@googlegroups.com Cc: Claudius Heine References: <20190131094458.32223-1-claudius.heine.ext@siemens.com> <20190131094458.32223-2-claudius.heine.ext@siemens.com> From: Jan Kiszka Message-ID: Date: Thu, 31 Jan 2019 11:23:37 +0100 User-Agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666 MIME-Version: 1.0 In-Reply-To: <20190131094458.32223-2-claudius.heine.ext@siemens.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-TUID: IMOL71F5zQKJ On 31.01.19 10:44, [ext] claudius.heine.ext@siemens.com wrote: > From: Claudius Heine > > Signed-off-by: Claudius Heine > --- > meta/classes/base.bbclass | 30 +++++++++++++++++++ > .../debian/{changelog => changelog.tmpl} | 2 +- > meta/recipes-bsp/u-boot/files/debian/control | 19 ------------ > .../u-boot/files/debian/control.tmpl | 19 ++++++++++++ > meta/recipes-bsp/u-boot/u-boot-custom.inc | 17 ++++------- > .../debian/{changelog => changelog.tmpl} | 2 +- > .../linux-module/files/debian/control | 11 ------- > .../linux-module/files/debian/control.tmpl | 11 +++++++ > meta/recipes-kernel/linux-module/module.inc | 7 ++--- > 9 files changed, 70 insertions(+), 48 deletions(-) > rename meta/recipes-bsp/u-boot/files/debian/{changelog => changelog.tmpl} (74%) > delete mode 100644 meta/recipes-bsp/u-boot/files/debian/control > create mode 100644 meta/recipes-bsp/u-boot/files/debian/control.tmpl > rename meta/recipes-kernel/linux-module/files/debian/{changelog => changelog.tmpl} (74%) > delete mode 100644 meta/recipes-kernel/linux-module/files/debian/control > create mode 100644 meta/recipes-kernel/linux-module/files/debian/control.tmpl > > diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass > index d4082de..3ce223d 100644 > --- a/meta/classes/base.bbclass > +++ b/meta/classes/base.bbclass > @@ -20,6 +20,16 @@ > > THISDIR = "${@os.path.dirname(d.getVar('FILE', True))}" > > +# Exported variable to be availble for template replacing available > +export PN > +export PV > +export DESCRIPTION > +export HOMEPAGE > +export MAINTAINER > +export KERNEL_NAME > +export MACHINE > +export DISTRO_ARCH What are the implications of there exports /wrt task re-execution? If I change a package DESCRIPTION, will all tasks of the affected recipe then be redone? For vars like MACHINE or DISTRO_ARCH, this is surely not an issue, for others, it should at least be documented in this commit. > + > die() { > bbfatal "$*" > } > @@ -176,3 +186,23 @@ python do_cleanall() { > except bb.fetch2.BBFetchException as e: > bb.fatal(str(e)) > } > + > +transform_template() { > + IN="$1" > + OUT="$2" > + shift 2 > + WHITELIST="$*" > + > + if [ -e "$IN" ]; then > + if [ -n "$WHITELIST" ]; then > + FORMAT="$( > + for i in $WHITELIST; do > + printf "\${%s} " "$i" > + done > + )" > + envsubst "$FORMAT" < "$IN" > "$OUT" > + else > + envsubst < "$IN" > "$OUT" > + fi > + fi > +} > diff --git a/meta/recipes-bsp/u-boot/files/debian/changelog b/meta/recipes-bsp/u-boot/files/debian/changelog.tmpl > similarity index 74% > rename from meta/recipes-bsp/u-boot/files/debian/changelog > rename to meta/recipes-bsp/u-boot/files/debian/changelog.tmpl > index c1c3516..6e59e06 100644 > --- a/meta/recipes-bsp/u-boot/files/debian/changelog > +++ b/meta/recipes-bsp/u-boot/files/debian/changelog.tmpl > @@ -1,4 +1,4 @@ > -@PN@ (@PV@) unstable; urgency=low > +${PN} (${PV}) unstable; urgency=low > > * Generated package. > > diff --git a/meta/recipes-bsp/u-boot/files/debian/control b/meta/recipes-bsp/u-boot/files/debian/control > deleted file mode 100644 > index 6b4c839..0000000 > --- a/meta/recipes-bsp/u-boot/files/debian/control > +++ /dev/null > @@ -1,19 +0,0 @@ > -Source: @PN@ > -Section: admin > -Priority: optional > -Standards-Version: 3.9.6 > -Build-Depends: @BUILD_DEPENDS@ > -Maintainer: ISAR project > - > -Package: u-boot-@MACHINE@ > -Architecture: @DISTRO_ARCH@ > -Description: @DESCRIPTION@, bootloader binaries > - > -Package: u-boot-@MACHINE@-dev > -Architecture: @DISTRO_ARCH@ > -Description: @DESCRIPTION@, bootloader libraries > - > -Package: u-boot-tools > -Architecture: linux-any > -Depends: ${shlibs:Depends}, ${misc:Depends} > -Description: @DESCRIPTION@, companion tools > diff --git a/meta/recipes-bsp/u-boot/files/debian/control.tmpl b/meta/recipes-bsp/u-boot/files/debian/control.tmpl > new file mode 100644 > index 0000000..5c1cc92 > --- /dev/null > +++ b/meta/recipes-bsp/u-boot/files/debian/control.tmpl > @@ -0,0 +1,19 @@ > +Source: ${PN} > +Section: admin > +Priority: optional > +Standards-Version: 3.9.6 > +Build-Depends: ${BUILD_DEPENDS} > +Maintainer: ISAR project > + > +Package: u-boot-${MACHINE} > +Architecture: ${DISTRO_ARCH} > +Description: ${DESCRIPTION}, bootloader binaries > + > +Package: u-boot-${MACHINE}-dev > +Architecture: ${DISTRO_ARCH} > +Description: ${DESCRIPTION}, bootloader libraries > + > +Package: u-boot-tools > +Architecture: linux-any > +Depends: ${shlibs:Depends}, ${misc:Depends} > +Description: ${DESCRIPTION}, companion tools > diff --git a/meta/recipes-bsp/u-boot/u-boot-custom.inc b/meta/recipes-bsp/u-boot/u-boot-custom.inc > index 4b38c88..0d4cc66 100644 > --- a/meta/recipes-bsp/u-boot/u-boot-custom.inc > +++ b/meta/recipes-bsp/u-boot/u-boot-custom.inc > @@ -17,14 +17,14 @@ SRC_URI += "file://debian/" > > U_BOOT_BUILD_DEPENDS ?= "bc, bison, flex, device-tree-compiler" > > +export U_BOOT_CONFIG > +export U_BOOT_BIN > + > do_prepare_build() { > cp -r ${WORKDIR}/debian ${S}/ > - sed -i -e 's/@PN@/${PN}/g' -e 's/@PV@/${PV}/g' \ > - -e 's/@BUILD_DEPENDS@/${U_BOOT_BUILD_DEPENDS}/g' \ > - -e 's/@MACHINE@/${MACHINE}/g' \ > - -e 's/@DISTRO_ARCH@/${DISTRO_ARCH}/g' \ > - -e 's/@DESCRIPTION@/${DESCRIPTION}/g' \ > - ${S}/debian/changelog ${S}/debian/control > + export BUILD_DEPENDS="${U_BOOT_BUILD_DEPENDS}" > + transform_template "${S}/debian/changelog.tmpl" "${S}/debian/changelog" > + transform_template "${S}/debian/control.tmpl" "${S}/debian/control" > > echo "${U_BOOT_BIN} /usr/lib/u-boot/${MACHINE}" > \ > ${S}/debian/u-boot-${MACHINE}.install > @@ -32,8 +32,3 @@ do_prepare_build() { > echo "tools/env/libubootenv.a usr/lib" > \ > ${S}/debian/u-boot-${MACHINE}-dev.install > } > - > -dpkg_runbuild_prepend() { > - export U_BOOT_CONFIG=${U_BOOT_CONFIG} > - export U_BOOT_BIN=${U_BOOT_BIN} > -} > diff --git a/meta/recipes-kernel/linux-module/files/debian/changelog b/meta/recipes-kernel/linux-module/files/debian/changelog.tmpl > similarity index 74% > rename from meta/recipes-kernel/linux-module/files/debian/changelog > rename to meta/recipes-kernel/linux-module/files/debian/changelog.tmpl > index c1c3516..6e59e06 100644 > --- a/meta/recipes-kernel/linux-module/files/debian/changelog > +++ b/meta/recipes-kernel/linux-module/files/debian/changelog.tmpl > @@ -1,4 +1,4 @@ > -@PN@ (@PV@) unstable; urgency=low > +${PN} (${PV}) unstable; urgency=low > > * Generated package. > > diff --git a/meta/recipes-kernel/linux-module/files/debian/control b/meta/recipes-kernel/linux-module/files/debian/control > deleted file mode 100644 > index 1ee634c..0000000 > --- a/meta/recipes-kernel/linux-module/files/debian/control > +++ /dev/null > @@ -1,11 +0,0 @@ > -Source: @PN@ > -Section: kernel > -Priority: optional > -Standards-Version: 3.9.6 > -Build-Depends: linux-headers-@KERNEL_NAME@ > -Maintainer: ISAR project > - > -Package: @PN@ > -Architecture: any > -Depends: linux-image-@KERNEL_NAME@, kmod > -Description: @DESCRIPTION@ > diff --git a/meta/recipes-kernel/linux-module/files/debian/control.tmpl b/meta/recipes-kernel/linux-module/files/debian/control.tmpl > new file mode 100644 > index 0000000..3b3292d > --- /dev/null > +++ b/meta/recipes-kernel/linux-module/files/debian/control.tmpl > @@ -0,0 +1,11 @@ > +Source: ${PN} > +Section: kernel > +Priority: optional > +Standards-Version: 3.9.6 > +Build-Depends: linux-headers-${KERNEL_NAME} > +Maintainer: ISAR project > + > +Package: ${PN} > +Architecture: any > +Depends: linux-image-${KERNEL_NAME}, kmod > +Description: ${DESCRIPTION} > diff --git a/meta/recipes-kernel/linux-module/module.inc b/meta/recipes-kernel/linux-module/module.inc > index cb7b8ad..6504b98 100644 > --- a/meta/recipes-kernel/linux-module/module.inc > +++ b/meta/recipes-kernel/linux-module/module.inc > @@ -21,10 +21,8 @@ inherit dpkg > > do_prepare_build() { > cp -r ${WORKDIR}/debian ${S}/ > - sed -i -e 's/@PN@/${PN}/g' -e 's/@PV@/${PV}/g' \ > - -e 's/@KERNEL_NAME@/${KERNEL_NAME}/g' \ > - -e 's/@DESCRIPTION@/${DESCRIPTION}/g' \ > - ${S}/debian/changelog ${S}/debian/control > + transform_template "${S}/debian/changelog.tmpl" "${S}/debian/changelog" > + transform_template "${S}/debian/control.tmpl" "${S}/debian/control" > > for module in "${AUTOLOAD}"; do > echo "echo $module >> /etc/modules" >> ${S}/debian/postinst > @@ -43,5 +41,4 @@ dpkg_runbuild_prepend() { > export KDIR=$(dpkg -L --root=${BUILDCHROOT_DIR} ${KERNEL_DEP} | \ > grep "/lib/modules/.*/build") > fi > - export PN=${PN} This is wrong - unless you process debian/rules as template as well. Jan -- Siemens AG, Corporate Technology, CT RDA IOT SES-DE Corporate Competence Center Embedded Linux