From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6652594697292218368 X-Received: by 2002:a05:6000:100d:: with SMTP id a13mr988709wrx.2.1548934510463; Thu, 31 Jan 2019 03:35:10 -0800 (PST) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a1c:7e4e:: with SMTP id z75ls322320wmc.1.canary-gmail; Thu, 31 Jan 2019 03:35:10 -0800 (PST) X-Google-Smtp-Source: AHgI3IYSY3sXpVFBo6p6hp3JyPJrGoBv13DSrUiGanLWoUr6g9EB1qEDbF78Q2Y5h8hag55csRYq X-Received: by 2002:a1c:e703:: with SMTP id e3mr1169465wmh.1.1548934510051; Thu, 31 Jan 2019 03:35:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548934510; cv=none; d=google.com; s=arc-20160816; b=y5aqMiQlj5BCvPlWmkKSsZaMhN/ry2jM0ZUuBmy1E4R+auMebGF+5pEfB5ttBLeGTo FCdZaan5CBmF8bcpYXSPzPvIo8Uvb2awkd34ZBYyg3N1BdkZGYCoybCBympn4M/cApMv CUEVYv8ZsN2BimEHVmeAc2YvjsoPJ29paTYMJ0jmmpLCLp71iwL8AEdlXrNK2ByCEACB qfUGn0Lz0u4KSl/OP2Fknx64+gKHYn7wotwxH4A3TS7h3U4eyAcJwZK5MG1mnORVq560 f1RuDLrsJHaVNiclEJmYnUKbFk1CFj/MpI8l18SYpSdMJR+QS+n78PnZSOQa+qbaQqES vFxg== 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=0ERLHt8sfmwYu1cq8xkSQ23yRvPH9VrzI8Vn6tLhe9c=; b=AVGvSZwNS6dGHaJi0zT7Yn66frRZYuKfWA55R2867OSIfwLuiJOV+Xm75lQQerHvTn vp2cJIvb1V1xoPaxbfRLTw26tayCyzjFFwy+x9Ra8nlIAty7ybRLJWfpqskWWZO+yF/c ob73Nq9V5s4jYd/RuXdMPsGqqrj2/MSRmDOG4JXFfnw4a/RREkqc9LRwg9zVLs81rpbd XEcrGr21ZmcJXR82Jksrz889pbhwkGIEKKCu03PiFd14gfxW3gL3yevjFne4BfRDgp7E W/sl+pctuoGzfGaeCKOG49mRNDJoC5QNCGusX7RdNQLcZJa7O2ccqpVU3qCu1/iCo1u1 tAJg== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of claudius.heine.ext@siemens.com designates 192.35.17.28 as permitted sender) smtp.mailfrom=claudius.heine.ext@siemens.com Return-Path: Received: from goliath.siemens.de (goliath.siemens.de. [192.35.17.28]) by gmr-mx.google.com with ESMTPS id 64si161746wma.1.2019.01.31.03.35.09 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 31 Jan 2019 03:35:10 -0800 (PST) Received-SPF: pass (google.com: domain of claudius.heine.ext@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 claudius.heine.ext@siemens.com designates 192.35.17.28 as permitted sender) smtp.mailfrom=claudius.heine.ext@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 x0VBZ8Yo031422 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 31 Jan 2019 12:35:08 +0100 Received: from [139.25.69.181] (linux-ses-ext02.ppmd.siemens.net [139.25.69.181]) by mail1.sbs.de (8.15.2/8.15.2) with ESMTP id x0VBZ8AF018894; Thu, 31 Jan 2019 12:35:08 +0100 Subject: Re: [RFC PATCH 1/1] meta: added template file system and switched recipes to it To: Jan Kiszka , 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: Claudius Heine Message-ID: <333a6d41-e08d-3974-e77d-2888fe7824b9@siemens.com> Date: Thu, 31 Jan 2019 12:35:08 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-TUID: kxSoOcmw/ozF Hi Jan, On 31/01/2019 11.23, 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. I think it would affect only shell tasks not python tasks like fetch and unpack. I think I will try an alternative solution using an additional task. I might be able to use that in my UBI process as long as I don't use the find device tree python inline to set variables. > >> + >>   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. No its not. Since PN is marked as export in the base.bbclass already, doing that again here is redundant. Claudius > > Jan > -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-54 Fax: (+49)-8142-66989-80 Email: ch@denx.de