From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6652594697292218368 X-Received: by 2002:a5d:4811:: with SMTP id l17mr970875wrq.29.1548933927077; Thu, 31 Jan 2019 03:25:27 -0800 (PST) X-BeenThere: isar-users@googlegroups.com Received: by 2002:adf:9d28:: with SMTP id k40ls1137086wre.12.gmail; Thu, 31 Jan 2019 03:25:26 -0800 (PST) X-Google-Smtp-Source: AHgI3IZSQ+9SybedE8Lcq+DBbU3R3bMSwqZJ+/KxViPhXguMgCm9o32iotJVI4zh1atQc1+EOyq8 X-Received: by 2002:a5d:49c4:: with SMTP id t4mr971424wrs.31.1548933926665; Thu, 31 Jan 2019 03:25:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548933926; cv=none; d=google.com; s=arc-20160816; b=E9aqafE3tqv62jwsbUa3mwsGRoTXh1zKa2kle9sR8EhopPp+9tfclOfC6G2IpE0k6x /vNPxpyYgOWZ8WjHjrnTtLBiq44jk1oYFnWGaokl9YgCpb3AM4sQuhAarmgLtPGQGs5F LvejCK0vPo9n5gxmNFk8UdTVDeO90oi2Jpzc3Dh32kn0OSd6EksVM17DJMpWay6ALfDb OoPLNecGpLAJH17yKqX81BH+KIFDrVRLlQEsJG4WXRA4J5j1uJP5hQLjkgPSv8RhL7F0 mfBLi0+SWlDWkTbNkbUTKKiRprSmGpRHWy5JYJlCF7HiZ2Yv+OqtTfUzeWTcsg51InAm rO5w== 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:subject:cc:to:from:date; bh=eU8GmO3AkTpzvlxVyu6phapNBo6bPw+jiMn9pEoEbOw=; b=hvRLclK480iH91V+Ayl+zX5pTLVKNrT9BARf19qK4K0yoOdVTL0kgv1St4k+nmQsGT P3G0lWkSWcLuTeEL+0G6/cepiI2EGeQCNaVM/olCJcEiJSxsuvqecv2hBxnTlXQ+bn5m 6qslw/0I6rldlAN0T7XDo0j4L5yvBljoj4uwoKoatV2WAN+xU/3aouQjffMUUKHbBt4E L0lSHjxb4Pglv5mxUZMzYvPrnzygqlMJaKtu53Y7dDnlFKlbIi/1UVOnj36lV0Kn39yo B1J8Kufqgo9FTEcx+nQmigNJohmuoZszhzQzq/H2jt6h5u2cacNmm5NGnh4H9H122Pnj 1xBQ== 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 Return-Path: Received: from gecko.sbs.de (gecko.sbs.de. [194.138.37.40]) by gmr-mx.google.com with ESMTPS id y6si146221wmd.1.2019.01.31.03.25.26 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 31 Jan 2019 03:25:26 -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 Received: from mail1.sbs.de (mail1.sbs.de [192.129.41.35]) by gecko.sbs.de (8.15.2/8.15.2) with ESMTPS id x0VBPP5w010558 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 31 Jan 2019 12:25:26 +0100 Received: from md1za8fc.ad001.siemens.net ([139.25.69.211]) by mail1.sbs.de (8.15.2/8.15.2) with ESMTP id x0VBPO3r025528; Thu, 31 Jan 2019 12:25:24 +0100 Date: Thu, 31 Jan 2019 12:25:23 +0100 From: Henning Schild To: "[ext] Jan Kiszka" Cc: "[ext] claudius.heine.ext@siemens.com" , , Claudius Heine Subject: Re: [RFC PATCH 1/1] meta: added template file system and switched recipes to it Message-ID: <20190131122523.3c268278@md1za8fc.ad001.siemens.net> In-Reply-To: References: <20190131094458.32223-1-claudius.heine.ext@siemens.com> <20190131094458.32223-2-claudius.heine.ext@siemens.com> X-Mailer: Claws Mail 3.15.0-dirty (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-TUID: 3YUoZ703c4OG On Thu, 31 Jan 2019 11:23:37 +0100 "[ext] Jan Kiszka" wrote: > 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 > > +} Could that also be transform(in, out, vars ...), that would make pretty clear which vars to use in the transformation and which not. And it might help bitbake to do its magic. Henning > > 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 >