From: Claudius Heine <claudius.heine.ext@siemens.com>
To: Jan Kiszka <jan.kiszka@siemens.com>, isar-users@googlegroups.com
Cc: Claudius Heine <ch@denx.de>
Subject: Re: [RFC PATCH 1/1] meta: added template file system and switched recipes to it
Date: Thu, 31 Jan 2019 12:35:08 +0100 [thread overview]
Message-ID: <333a6d41-e08d-3974-e77d-2888fe7824b9@siemens.com> (raw)
In-Reply-To: <b27bda08-ffcb-652b-2b7a-e5d3cf4aae8f@siemens.com>
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 <ch@denx.de>
>>
>> Signed-off-by: Claudius Heine <ch@denx.de>
>> ---
>> 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 <isar-users@googlegroups.com>
>> -
>> -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 <isar-users@googlegroups.com>
>> +
>> +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 <isar-users@googlegroups.com>
>> -
>> -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 <isar-users@googlegroups.com>
>> +
>> +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
prev parent reply other threads:[~2019-01-31 11:35 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-31 9:44 [RFC PATCH 0/1] Template system claudius.heine.ext
2019-01-31 9:44 ` [RFC PATCH 1/1] meta: added template file system and switched recipes to it claudius.heine.ext
2019-01-31 10:23 ` Jan Kiszka
2019-01-31 11:25 ` Henning Schild
2019-01-31 11:35 ` Claudius Heine [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=333a6d41-e08d-3974-e77d-2888fe7824b9@siemens.com \
--to=claudius.heine.ext@siemens.com \
--cc=ch@denx.de \
--cc=isar-users@googlegroups.com \
--cc=jan.kiszka@siemens.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox