From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6652594697292218368 X-Received: by 2002:a2e:5d84:: with SMTP id v4-v6mr1021768lje.4.1548927909943; Thu, 31 Jan 2019 01:45:09 -0800 (PST) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a2e:90ce:: with SMTP id o14-v6ls693669ljg.11.gmail; Thu, 31 Jan 2019 01:45:09 -0800 (PST) X-Google-Smtp-Source: AHgI3IbluFEYNpkL/r4jnh/iVhLIXrNBYLL1zdL2mcYbt5blhqHR8fsR0BtpmbKFvIEr4gJQgp6D X-Received: by 2002:a2e:5d0c:: with SMTP id r12-v6mr1021802ljb.8.1548927908450; Thu, 31 Jan 2019 01:45:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548927908; cv=none; d=google.com; s=arc-20160816; b=PxuKzgLXre6aIev/UwPdy1vLUIEyHBR1B35lLCPAGIPBBFAFJYMe5fhFDHCbR/x+8w +Q3ZCPaxQRu+bFMVXG3UOxAbQ7LNkZb3QKD/KoIZ6bxMG0bkvVsToWK8zGViK5hUn0O4 FJrB3cKL+1R7ruJxtHiEWYDrhBJErDiqPvz5pDhC6YdLo0ALfL3NjkvPRm7cUQGWpYgZ rMIM8kV80G741dM8RDne2rSdDJLPnAfJCQFIktl2MGhkSkyxuCHVYn6qLt6h5FDALZ8F CZtkrf84l7Wmu8hyk3QFIDvGxgwTiR/+q+fSBAyY6fhPwLuk0nhfgAn/lHzHYMtjgHf5 Auww== 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=xrSrdaU7Ofk7vAFHHS5zE4fdfKQoy1t/Uj61THqoij0=; b=vp5kPLOdb6UF/O+x3ayDcmV5C3IlYj+AavBhd9v72cWRskBw/MthmFqOENKXkinQmt OwVEWxsg4LIxoG6tGIEB4pwArwdvrswgEj8UcNXN8XRC2fuoBbKpr3RXWQQNIraPTdeW KYuc+9K8C1Su2tvDDfyfMnOnIW+XtNYAyMSm+kYGTAhFwsunc5Txe2ggqwz3lWQjhhPI uUSgQpRg/YX5q1t1kuECTEJ7UND3N9mzg+c15uYfbwwVkh9SSH8SDIMr/EOHjO4Mjaau sXKiPyZGTZhbV2zrz2XjhrChno8WZF+Hc491lJXYduVqAYPIKPuleZw9v3yVtts4fXml ewFg== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of claudius.heine.ext@siemens.com designates 192.35.17.14 as permitted sender) smtp.mailfrom=claudius.heine.ext@siemens.com Return-Path: Received: from david.siemens.de (david.siemens.de. [192.35.17.14]) by gmr-mx.google.com with ESMTPS id w10si187304lfc.5.2019.01.31.01.45.08 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 31 Jan 2019 01:45:08 -0800 (PST) Received-SPF: pass (google.com: domain of claudius.heine.ext@siemens.com designates 192.35.17.14 as permitted sender) client-ip=192.35.17.14; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of claudius.heine.ext@siemens.com designates 192.35.17.14 as permitted sender) smtp.mailfrom=claudius.heine.ext@siemens.com Received: from mail2.sbs.de (mail2.sbs.de [192.129.41.66]) by david.siemens.de (8.15.2/8.15.2) with ESMTPS id x0V9j7D1013882 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 31 Jan 2019 10:45:07 +0100 Received: from ring.ppmd.siemens.net (linux-ses-ext02.ppmd.siemens.net [139.25.69.181]) by mail2.sbs.de (8.15.2/8.15.2) with ESMTP id x0V9j3rV020590; Thu, 31 Jan 2019 10:45:07 +0100 From: claudius.heine.ext@siemens.com To: isar-users@googlegroups.com Cc: Claudius Heine Subject: [RFC PATCH 1/1] meta: added template file system and switched recipes to it Date: Thu, 31 Jan 2019 10:44:58 +0100 Message-Id: <20190131094458.32223-2-claudius.heine.ext@siemens.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190131094458.32223-1-claudius.heine.ext@siemens.com> References: <20190131094458.32223-1-claudius.heine.ext@siemens.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TUID: M+YwchYAtcXe 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 +export PN +export PV +export DESCRIPTION +export HOMEPAGE +export MAINTAINER +export KERNEL_NAME +export MACHINE +export DISTRO_ARCH + 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} } -- 2.20.1