public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH 0/7] Avoid using shell environment during the build
@ 2021-12-23  5:05 Uladzimir Bely
  2021-12-23  5:05 ` [PATCH 1/7] template: Copy template attributes on transform Uladzimir Bely
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Uladzimir Bely @ 2021-12-23  5:05 UTC (permalink / raw)
  To: isar-users

This patchset is a subseries of 'Sbuild/Schroot migration' patchset
including only preparation patches. It doesn't require any changes
in downstreams (meta-iot2050 and xenomai-images were tested) so can
be merged independently.

In this patchset the main topic is a migration to template files that
allows to use cleaner build environment.

When this patchset is merged, it will make maintenance of remaining
sbuild-related patches easier and will shorten their number.

Anton Mikanovich (6):
  linux-module: Do not use shell environment
  u-boot: Do not use shell environment
  trusted-firmware: Do not use shell environment
  optee-os: Do not use shell environment
  kselftest: Do not use shell environment
  linux-mainline: Move cfg fragment test to debian/rules

Uladzimir Bely (1):
  template: Copy template attributes on transform

 .../linux/linux-mainline_5.4.70.bb            | 16 +++---
 meta/classes/template.bbclass                 |  4 +-
 .../files/debian/{rules => rules.tmpl}        |  4 +-
 meta/recipes-bsp/optee-os/optee-os-custom.inc |  9 +---
 .../files/debian/{rules => rules.tmpl}        |  4 +-
 .../trusted-firmware-a-custom.inc             |  9 +---
 .../u-boot/files/debian/{rules => rules.tmpl} |  2 +-
 meta/recipes-bsp/u-boot/u-boot-custom.inc     |  9 +---
 .../kselftest/files/{rules => rules.tmpl}     |  0
 meta/recipes-kernel/kselftest/kselftest.inc   | 21 +++-----
 .../linux-module/files/debian/rules           | 37 -------------
 .../linux-module/files/debian/rules.tmpl      | 52 +++++++++++++++++++
 meta/recipes-kernel/linux-module/module.inc   | 19 ++-----
 13 files changed, 86 insertions(+), 100 deletions(-)
 rename meta/recipes-bsp/optee-os/files/debian/{rules => rules.tmpl} (75%)
 rename meta/recipes-bsp/trusted-firmware-a/files/debian/{rules => rules.tmpl} (77%)
 rename meta/recipes-bsp/u-boot/files/debian/{rules => rules.tmpl} (94%)
 rename meta/recipes-kernel/kselftest/files/{rules => rules.tmpl} (100%)
 delete mode 100755 meta/recipes-kernel/linux-module/files/debian/rules
 create mode 100755 meta/recipes-kernel/linux-module/files/debian/rules.tmpl

-- 
2.20.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/7] template: Copy template attributes on transform
  2021-12-23  5:05 [PATCH 0/7] Avoid using shell environment during the build Uladzimir Bely
@ 2021-12-23  5:05 ` Uladzimir Bely
  2021-12-23  5:05 ` [PATCH 2/7] linux-module: Do not use shell environment Uladzimir Bely
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Uladzimir Bely @ 2021-12-23  5:05 UTC (permalink / raw)
  To: isar-users

Output file should have exactly the same flags as input one,
which is usefull for the cases like debian/rules or other executables.
So we should copy this part of metadata after the conversion.

Signed-off-by: Uladzimir Bely <ubely@ilbers.de>
---
 meta/classes/template.bbclass | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/meta/classes/template.bbclass b/meta/classes/template.bbclass
index fb9d1186..e6bcc362 100644
--- a/meta/classes/template.bbclass
+++ b/meta/classes/template.bbclass
@@ -8,7 +8,7 @@ TEMPLATE_VARS ?= "PN PV DESCRIPTION HOMEPAGE MAINTAINER DISTRO_ARCH"
 
 do_transform_template[vardeps] = "TEMPLATE_FILES ${TEMPLATE_VARS}"
 python do_transform_template() {
-    import subprocess, contextlib
+    import subprocess, contextlib, shutil
 
     workdir = os.path.normpath(d.getVar('WORKDIR', True))
 
@@ -56,5 +56,7 @@ python do_transform_template() {
                                           stdout=output, env=env))
             if process.wait() != 0:
                 bb.fatal("processing of template failed")
+
+        shutil.copymode(template_file, output_file)
 }
 addtask do_transform_template after do_unpack
-- 
2.20.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 2/7] linux-module: Do not use shell environment
  2021-12-23  5:05 [PATCH 0/7] Avoid using shell environment during the build Uladzimir Bely
  2021-12-23  5:05 ` [PATCH 1/7] template: Copy template attributes on transform Uladzimir Bely
@ 2021-12-23  5:05 ` Uladzimir Bely
  2021-12-23  5:05 ` [PATCH 3/7] u-boot: " Uladzimir Bely
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Uladzimir Bely @ 2021-12-23  5:05 UTC (permalink / raw)
  To: isar-users

From: Anton Mikanovich <amikan@ilbers.de>

To make package build process independent of the shell environment we
should remove KDIR and PN passing through export call.
KDIR can be prepared during package build. This also will allow not to
rely on previous builddeps install task.
To pass PN variable we can just migrate to template-based debian/rules
file.

Signed-off-by: Anton Mikanovich <amikan@ilbers.de>
Signed-off-by: Uladzimir Bely <ubely@ilbers.de>
---
 .../linux-module/files/debian/rules           | 37 -------------
 .../linux-module/files/debian/rules.tmpl      | 52 +++++++++++++++++++
 meta/recipes-kernel/linux-module/module.inc   | 19 ++-----
 3 files changed, 55 insertions(+), 53 deletions(-)
 delete mode 100755 meta/recipes-kernel/linux-module/files/debian/rules
 create mode 100755 meta/recipes-kernel/linux-module/files/debian/rules.tmpl

diff --git a/meta/recipes-kernel/linux-module/files/debian/rules b/meta/recipes-kernel/linux-module/files/debian/rules
deleted file mode 100755
index 59720b37..00000000
--- a/meta/recipes-kernel/linux-module/files/debian/rules
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/usr/bin/make -f
-
-# Debian rules for custom kernel module build
-#
-# This software is a part of ISAR.
-# Copyright (c) Siemens AG, 2018
-#
-# SPDX-License-Identifier: MIT
-
-export DEB_BUILD_OPTIONS=parallel=$(shell nproc)
-
-export CROSS_COMPILE=$(DEB_HOST_GNU_TYPE)-
-
-ifeq ($(DEB_HOST_GNU_CPU), arm)
-export ARCH=arm
-endif
-ifeq ($(DEB_HOST_GNU_CPU), aarch64)
-export ARCH=arm64
-endif
-ifeq ($(DEB_HOST_GNU_CPU), riscv64)
-export ARCH=riscv
-endif
-ifneq (,$(findstring 86,$(DEB_HOST_GNU_CPU)))
-export ARCH=x86
-endif
-
-override_dh_auto_clean:
-	$(MAKE) -C $(KDIR) M=$(PWD) clean
-
-override_dh_auto_build:
-	$(MAKE) -C $(KDIR) M=$(PWD) modules
-
-override_dh_auto_install:
-	$(MAKE) -C $(KDIR) M=$(PWD) INSTALL_MOD_PATH=$(PWD)/debian/$(PN) modules_install
-
-%:
-	CFLAGS= LDFLAGS= dh $@ --parallel
diff --git a/meta/recipes-kernel/linux-module/files/debian/rules.tmpl b/meta/recipes-kernel/linux-module/files/debian/rules.tmpl
new file mode 100755
index 00000000..52453e5f
--- /dev/null
+++ b/meta/recipes-kernel/linux-module/files/debian/rules.tmpl
@@ -0,0 +1,52 @@
+#!/usr/bin/make -f
+
+# Debian rules for custom kernel module build
+#
+# This software is a part of ISAR.
+# Copyright (c) Siemens AG, 2018
+#
+# SPDX-License-Identifier: MIT
+
+export DEB_BUILD_OPTIONS=parallel=$(shell nproc)
+
+export CROSS_COMPILE=$(DEB_HOST_GNU_TYPE)-
+
+ifeq ($(DEB_HOST_GNU_CPU), arm)
+export ARCH=arm
+endif
+ifeq ($(DEB_HOST_GNU_CPU), aarch64)
+export ARCH=arm64
+endif
+ifeq ($(DEB_HOST_GNU_CPU), riscv64)
+export ARCH=riscv
+endif
+ifneq (,$(findstring 86,$(DEB_HOST_GNU_CPU)))
+export ARCH=x86
+endif
+
+# Custom kernels contain the build folder directly.
+KDIR := $(shell dpkg -L linux-headers-${KERNEL_NAME} | grep "/lib/modules/.*/build")
+ifeq ($(KDIR),)
+# Debian kernels install that folder indirectly via a dependency.
+KERNEL_DEP := $(shell dpkg-query -W -f '$${Depends}' linux-headers-${KERNEL_NAME} | sed 's/.*\(linux-headers-[[:graph:]]*\).*/\1/')
+KDIR := $(shell dpkg -L $(KERNEL_DEP) | grep "/lib/modules/.*/build")
+endif
+
+# With some build systems like sbuild `dh clean` can be called twice:
+# first, by build system itself before chroot's apt database updated,
+# second, by dpkg-buildpackage during build. So, KDIR may be empty
+# in first case (while no dependencies are yet installed), and a broken
+# 'make ... clean' command is produced. Just skip override in this case.
+ifneq ($(KDIR),)
+override_dh_auto_clean:
+	$(MAKE) -C $(KDIR) M=$(PWD) clean
+endif
+
+override_dh_auto_build:
+	$(MAKE) -C $(KDIR) M=$(PWD) modules
+
+override_dh_auto_install:
+	$(MAKE) -C $(KDIR) M=$(PWD) INSTALL_MOD_PATH=$(PWD)/debian/${PN} modules_install
+
+%:
+	CFLAGS= LDFLAGS= dh $@ --parallel
diff --git a/meta/recipes-kernel/linux-module/module.inc b/meta/recipes-kernel/linux-module/module.inc
index 0515621a..9ae3af9b 100644
--- a/meta/recipes-kernel/linux-module/module.inc
+++ b/meta/recipes-kernel/linux-module/module.inc
@@ -22,8 +22,9 @@ AUTOLOAD ?= ""
 inherit dpkg
 
 TEMPLATE_FILES = "debian/control.tmpl \
-                  debian/changelog.tmpl"
-TEMPLATE_VARS += "KERNEL_NAME"
+                  debian/changelog.tmpl \
+                  debian/rules.tmpl"
+TEMPLATE_VARS += "KERNEL_NAME PN"
 
 do_prepare_build() {
     cp -r ${WORKDIR}/debian ${S}/
@@ -32,17 +33,3 @@ do_prepare_build() {
         echo "echo $module >> /etc/modules" >> ${S}/debian/postinst
     done
 }
-
-dpkg_runbuild_prepend() {
-    # Custom kernels contain the build folder directly.
-    export KDIR=$(dpkg -L --root=${BUILDCHROOT_DIR} linux-headers-${KERNEL_NAME} | \
-                  grep "/lib/modules/.*/build")
-    if [ -z "$KDIR" ]; then
-        # Debian kernels install that folder indirectly via a dependency.
-        KERNEL_DEP=$(dpkg-query -W -f '${Depends}' --admindir=${BUILDCHROOT_DIR}/var/lib/dpkg \
-                     linux-headers-${KERNEL_NAME} | sed 's/.*\(linux-headers-[[:graph:]]*\).*/\1/')
-        export KDIR=$(dpkg -L --root=${BUILDCHROOT_DIR} ${KERNEL_DEP} | \
-                      grep "/lib/modules/.*/build")
-    fi
-    export PN=${PN}
-}
-- 
2.20.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 3/7] u-boot: Do not use shell environment
  2021-12-23  5:05 [PATCH 0/7] Avoid using shell environment during the build Uladzimir Bely
  2021-12-23  5:05 ` [PATCH 1/7] template: Copy template attributes on transform Uladzimir Bely
  2021-12-23  5:05 ` [PATCH 2/7] linux-module: Do not use shell environment Uladzimir Bely
@ 2021-12-23  5:05 ` Uladzimir Bely
  2021-12-23  5:05 ` [PATCH 4/7] trusted-firmware: " Uladzimir Bely
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Uladzimir Bely @ 2021-12-23  5:05 UTC (permalink / raw)
  To: isar-users

From: Anton Mikanovich <amikan@ilbers.de>

To make package build process independent of the shell environment we
should remove U_BOOT_CONFIG and U_BOOT_BIN passing through export call.
So we migrate to template-based debian/rules file.

Signed-off-by: Anton Mikanovich <amikan@ilbers.de>
Signed-off-by: Uladzimir Bely <ubely@ilbers.de>
---
 .../u-boot/files/debian/{rules => rules.tmpl}            | 2 +-
 meta/recipes-bsp/u-boot/u-boot-custom.inc                | 9 ++-------
 2 files changed, 3 insertions(+), 8 deletions(-)
 rename meta/recipes-bsp/u-boot/files/debian/{rules => rules.tmpl} (94%)

diff --git a/meta/recipes-bsp/u-boot/files/debian/rules b/meta/recipes-bsp/u-boot/files/debian/rules.tmpl
similarity index 94%
rename from meta/recipes-bsp/u-boot/files/debian/rules
rename to meta/recipes-bsp/u-boot/files/debian/rules.tmpl
index 3d667620..806b01fe 100755
--- a/meta/recipes-bsp/u-boot/files/debian/rules
+++ b/meta/recipes-bsp/u-boot/files/debian/rules.tmpl
@@ -13,7 +13,7 @@ SET_CROSS_BUILD_TOOLS=CROSS_BUILD_TOOLS=y
 endif
 
 override_dh_auto_build:
-	$(MAKE) $(PARALLEL_MAKE) $(U_BOOT_CONFIG)
+	$(MAKE) $(PARALLEL_MAKE) ${U_BOOT_CONFIG}
 	$(MAKE) $(PARALLEL_MAKE) ${U_BOOT_BIN}
 	$(MAKE) -n u-boot-initial-env >/dev/null 2>&1; if [ $$? -ne 2 ]; then \
 		$(MAKE) $(PARALLEL_MAKE) u-boot-initial-env; \
diff --git a/meta/recipes-bsp/u-boot/u-boot-custom.inc b/meta/recipes-bsp/u-boot/u-boot-custom.inc
index 9984d8cc..2af7ada1 100644
--- a/meta/recipes-bsp/u-boot/u-boot-custom.inc
+++ b/meta/recipes-bsp/u-boot/u-boot-custom.inc
@@ -26,8 +26,8 @@ python() {
 
 DEBIAN_BUILD_DEPENDS ?= "bc, bison, flex, device-tree-compiler, git"
 
-TEMPLATE_FILES = "debian/control.tmpl"
-TEMPLATE_VARS += "MACHINE DEBIAN_BUILD_DEPENDS"
+TEMPLATE_FILES = "debian/control.tmpl debian/rules.tmpl"
+TEMPLATE_VARS += "MACHINE DEBIAN_BUILD_DEPENDS U_BOOT_CONFIG U_BOOT_BIN"
 
 U_BOOT_TOOLS_PACKAGE ?= "0"
 U_BOOT_CONFIG_PACKAGE ?= "0"
@@ -71,8 +71,3 @@ fw_env.config      /etc
 EOF
     fi
 }
-
-dpkg_runbuild_prepend() {
-    export U_BOOT_CONFIG="${U_BOOT_CONFIG}"
-    export U_BOOT_BIN="${U_BOOT_BIN}"
-}
-- 
2.20.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 4/7] trusted-firmware: Do not use shell environment
  2021-12-23  5:05 [PATCH 0/7] Avoid using shell environment during the build Uladzimir Bely
                   ` (2 preceding siblings ...)
  2021-12-23  5:05 ` [PATCH 3/7] u-boot: " Uladzimir Bely
@ 2021-12-23  5:05 ` Uladzimir Bely
  2021-12-23  5:05 ` [PATCH 5/7] optee-os: " Uladzimir Bely
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Uladzimir Bely @ 2021-12-23  5:05 UTC (permalink / raw)
  To: isar-users

From: Anton Mikanovich <amikan@ilbers.de>

To make package build process independent of the shell environment we
should remove TF_A_PLATFORM and TF_A_EXTRA_BUILDARGS passing through
export call. So we migrate to template-based debian/rules file.

Signed-off-by: Anton Mikanovich <amikan@ilbers.de>
---
 .../files/debian/{rules => rules.tmpl}                   | 4 ++--
 .../trusted-firmware-a/trusted-firmware-a-custom.inc     | 9 ++-------
 2 files changed, 4 insertions(+), 9 deletions(-)
 rename meta/recipes-bsp/trusted-firmware-a/files/debian/{rules => rules.tmpl} (77%)

diff --git a/meta/recipes-bsp/trusted-firmware-a/files/debian/rules b/meta/recipes-bsp/trusted-firmware-a/files/debian/rules.tmpl
similarity index 77%
rename from meta/recipes-bsp/trusted-firmware-a/files/debian/rules
rename to meta/recipes-bsp/trusted-firmware-a/files/debian/rules.tmpl
index 70e1dd66..6dbf44db 100755
--- a/meta/recipes-bsp/trusted-firmware-a/files/debian/rules
+++ b/meta/recipes-bsp/trusted-firmware-a/files/debian/rules.tmpl
@@ -12,8 +12,8 @@ export CROSS_COMPILE=$(DEB_HOST_GNU_TYPE)-
 endif
 
 override_dh_auto_build:
-	CFLAGS= LDFLAGS= $(MAKE) $(PARALLEL_MAKE) PLAT=$(TF_A_PLATFORM) \
-		$(TF_A_EXTRA_BUILDARGS)
+	CFLAGS= LDFLAGS= $(MAKE) $(PARALLEL_MAKE) PLAT=${TF_A_PLATFORM} \
+		${TF_A_EXTRA_BUILDARGS}
 
 %:
 	dh $@
diff --git a/meta/recipes-bsp/trusted-firmware-a/trusted-firmware-a-custom.inc b/meta/recipes-bsp/trusted-firmware-a/trusted-firmware-a-custom.inc
index 1142bfce..64153c6b 100644
--- a/meta/recipes-bsp/trusted-firmware-a/trusted-firmware-a-custom.inc
+++ b/meta/recipes-bsp/trusted-firmware-a/trusted-firmware-a-custom.inc
@@ -22,8 +22,8 @@ DEBIAN_BUILD_DEPENDS ?= ""
 
 PROVIDES += "trusted-firmware-a-${TF_A_NAME}"
 
-TEMPLATE_FILES = "debian/control.tmpl"
-TEMPLATE_VARS += "TF_A_NAME DEBIAN_BUILD_DEPENDS"
+TEMPLATE_FILES = "debian/control.tmpl debian/rules.tmpl"
+TEMPLATE_VARS += "TF_A_NAME DEBIAN_BUILD_DEPENDS TF_A_PLATFORM TF_A_EXTRA_BUILDARGS"
 
 do_prepare_build() {
     cp -r ${WORKDIR}/debian ${S}/
@@ -36,8 +36,3 @@ do_prepare_build() {
             ${S}/debian/trusted-firmware-a-${TF_A_NAME}.install
     done
 }
-
-dpkg_runbuild_prepend() {
-    export TF_A_PLATFORM="${TF_A_PLATFORM}"
-    export TF_A_EXTRA_BUILDARGS="${TF_A_EXTRA_BUILDARGS}"
-}
-- 
2.20.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 5/7] optee-os: Do not use shell environment
  2021-12-23  5:05 [PATCH 0/7] Avoid using shell environment during the build Uladzimir Bely
                   ` (3 preceding siblings ...)
  2021-12-23  5:05 ` [PATCH 4/7] trusted-firmware: " Uladzimir Bely
@ 2021-12-23  5:05 ` Uladzimir Bely
  2021-12-23  5:05 ` [PATCH 6/7] kselftest: " Uladzimir Bely
  2021-12-23  5:05 ` [PATCH 7/7] linux-mainline: Move cfg fragment test to debian/rules Uladzimir Bely
  6 siblings, 0 replies; 8+ messages in thread
From: Uladzimir Bely @ 2021-12-23  5:05 UTC (permalink / raw)
  To: isar-users

From: Anton Mikanovich <amikan@ilbers.de>

To make package build process independent of the shell environment we
should remove OPTEE_PLATFORM and OPTEE_EXTRA_BUILDARGS passing through
export call. So we migrate to template-based debian/rules file.

Signed-off-by: Anton Mikanovich <amikan@ilbers.de>
---
 .../optee-os/files/debian/{rules => rules.tmpl}          | 4 ++--
 meta/recipes-bsp/optee-os/optee-os-custom.inc            | 9 ++-------
 2 files changed, 4 insertions(+), 9 deletions(-)
 rename meta/recipes-bsp/optee-os/files/debian/{rules => rules.tmpl} (75%)

diff --git a/meta/recipes-bsp/optee-os/files/debian/rules b/meta/recipes-bsp/optee-os/files/debian/rules.tmpl
similarity index 75%
rename from meta/recipes-bsp/optee-os/files/debian/rules
rename to meta/recipes-bsp/optee-os/files/debian/rules.tmpl
index d2e9900f..9ab80dfe 100755
--- a/meta/recipes-bsp/optee-os/files/debian/rules
+++ b/meta/recipes-bsp/optee-os/files/debian/rules.tmpl
@@ -12,8 +12,8 @@ export CROSS_COMPILE=$(DEB_HOST_GNU_TYPE)-
 endif
 
 override_dh_auto_build:
-	CFLAGS= LDFLAGS= $(MAKE) $(PARALLEL_MAKE) PLATFORM=$(OPTEE_PLATFORM) \
-		$(OPTEE_EXTRA_BUILDARGS)
+	CFLAGS= LDFLAGS= $(MAKE) $(PARALLEL_MAKE) PLATFORM=${OPTEE_PLATFORM} \
+		${OPTEE_EXTRA_BUILDARGS}
 
 %:
 	dh $@
diff --git a/meta/recipes-bsp/optee-os/optee-os-custom.inc b/meta/recipes-bsp/optee-os/optee-os-custom.inc
index 1bd51969..23612d81 100644
--- a/meta/recipes-bsp/optee-os/optee-os-custom.inc
+++ b/meta/recipes-bsp/optee-os/optee-os-custom.inc
@@ -22,8 +22,8 @@ DEBIAN_BUILD_DEPENDS ?= "python3-pycryptodome:native, python3-pyelftools"
 
 PROVIDES += "optee-os-${OPTEE_NAME}"
 
-TEMPLATE_FILES = "debian/control.tmpl"
-TEMPLATE_VARS += "OPTEE_NAME DEBIAN_BUILD_DEPENDS"
+TEMPLATE_FILES = "debian/control.tmpl debian/rules.tmpl"
+TEMPLATE_VARS += "OPTEE_NAME DEBIAN_BUILD_DEPENDS OPTEE_PLATFORM OPTEE_EXTRA_BUILDARGS"
 
 # split strip platform flavor, if any, from the specified platform string
 OPTEE_PLATFORM_BASE = "${@d.getVar('OPTEE_PLATFORM').split('-')[0]}"
@@ -39,8 +39,3 @@ do_prepare_build() {
             ${S}/debian/optee-os-${OPTEE_NAME}.install
     done
 }
-
-dpkg_runbuild_prepend() {
-    export OPTEE_PLATFORM="${OPTEE_PLATFORM}"
-    export OPTEE_EXTRA_BUILDARGS="${OPTEE_EXTRA_BUILDARGS}"
-}
-- 
2.20.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 6/7] kselftest: Do not use shell environment
  2021-12-23  5:05 [PATCH 0/7] Avoid using shell environment during the build Uladzimir Bely
                   ` (4 preceding siblings ...)
  2021-12-23  5:05 ` [PATCH 5/7] optee-os: " Uladzimir Bely
@ 2021-12-23  5:05 ` Uladzimir Bely
  2021-12-23  5:05 ` [PATCH 7/7] linux-mainline: Move cfg fragment test to debian/rules Uladzimir Bely
  6 siblings, 0 replies; 8+ messages in thread
From: Uladzimir Bely @ 2021-12-23  5:05 UTC (permalink / raw)
  To: isar-users

From: Anton Mikanovich <amikan@ilbers.de>

To make package build process independent of the shell environment we
should remove KSELFTEST_ARGS passing through export call. The same
logic can be done by internal recipe parser and then pass variable to
template-based debian/rules file.

Signed-off-by: Anton Mikanovich <amikan@ilbers.de>
---
 .../kselftest/files/{rules => rules.tmpl}     |  0
 meta/recipes-kernel/kselftest/kselftest.inc   | 21 +++++++------------
 2 files changed, 8 insertions(+), 13 deletions(-)
 rename meta/recipes-kernel/kselftest/files/{rules => rules.tmpl} (100%)

diff --git a/meta/recipes-kernel/kselftest/files/rules b/meta/recipes-kernel/kselftest/files/rules.tmpl
similarity index 100%
rename from meta/recipes-kernel/kselftest/files/rules
rename to meta/recipes-kernel/kselftest/files/rules.tmpl
diff --git a/meta/recipes-kernel/kselftest/kselftest.inc b/meta/recipes-kernel/kselftest/kselftest.inc
index 2a76028b..6187d8e4 100644
--- a/meta/recipes-kernel/kselftest/kselftest.inc
+++ b/meta/recipes-kernel/kselftest/kselftest.inc
@@ -33,26 +33,21 @@ DEBIAN_BUILD_DEPENDS ?= " \
     llvm:native, \
 "
 
-SRC_URI += "file://rules"
+SRC_URI += "file://rules.tmpl"
 S = "${WORKDIR}/linux-${PV}"
 
+TEMPLATE_FILES = "rules.tmpl"
+TEMPLATE_VARS += "KSELFTEST_ARGS"
+
 KSELFTEST_TARGETS ?= ""
 KSELFTEST_SKIP_TARGETS ?= ""
 KSELFTEST_FORCE_TARGETS ?= "0"
 
+KSELFTEST_ARGS = "${@ "TARGETS=\"${KSELFTEST_TARGETS}\"" if d.getVar('KSELFTEST_TARGETS', True) else ''}"
+KSELFTEST_ARGS_append = "${@ " FORCE_TARGETS=1" if d.getVar('KSELFTEST_FORCE_TARGETS', True) == '1' else ''}"
+KSELFTEST_ARGS_append .= "${@ " SKIP_TARGETS=\"${KSELFTEST_SKIP_TARGETS}\"" if d.getVar('KSELFTEST_SKIP_TARGETS', True) else ''}"
+
 do_prepare_build[cleandirs] += "${S}/debian"
 do_prepare_build() {
     deb_debianize
 }
-
-dpkg_runbuild_prepend() {
-    if [ -n "${KSELFTEST_TARGETS}" ];then
-        export KSELFTEST_ARGS="TARGETS=\"${KSELFTEST_TARGETS}\""
-    fi
-    if [ ${KSELFTEST_FORCE_TARGETS} -eq 1 ];then
-        export KSELFTEST_ARGS="${KSELFTEST_ARGS} FORCE_TARGETS=1"
-    fi
-    if [ -n "${KSELFTEST_SKIP_TARGETS}" ];then
-        export KSELFTEST_ARGS="${KSELFTEST_ARGS} SKIP_TARGETS=\"${KSELFTEST_SKIP_TARGETS}\""
-    fi
-}
-- 
2.20.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 7/7] linux-mainline: Move cfg fragment test to debian/rules
  2021-12-23  5:05 [PATCH 0/7] Avoid using shell environment during the build Uladzimir Bely
                   ` (5 preceding siblings ...)
  2021-12-23  5:05 ` [PATCH 6/7] kselftest: " Uladzimir Bely
@ 2021-12-23  5:05 ` Uladzimir Bely
  6 siblings, 0 replies; 8+ messages in thread
From: Uladzimir Bely @ 2021-12-23  5:05 UTC (permalink / raw)
  To: isar-users

From: Anton Mikanovich <amikan@ilbers.de>

Perform all config fragments checking in Debian way.

Signed-off-by: Anton Mikanovich <amikan@ilbers.de>
---
 .../linux/linux-mainline_5.4.70.bb               | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/meta-isar/recipes-kernel/linux/linux-mainline_5.4.70.bb b/meta-isar/recipes-kernel/linux/linux-mainline_5.4.70.bb
index 980e137b..28e51c0d 100644
--- a/meta-isar/recipes-kernel/linux/linux-mainline_5.4.70.bb
+++ b/meta-isar/recipes-kernel/linux/linux-mainline_5.4.70.bb
@@ -25,11 +25,13 @@ LINUX_VERSION_EXTENSION = "-isar"
 
 # For testing purposes only
 dpkg_configure_kernel_append() {
-    if ! grep "# CONFIG_MTD is not set" ${S}/${KERNEL_BUILD_DIR}/.config && \
-       ! grep "# CONFIG_MTD_UBI is not set" ${S}/${KERNEL_BUILD_DIR}/.config; then
-        grep "# CONFIG_UBIFS_FS is not set" ${S}/${KERNEL_BUILD_DIR}/.config || \
-            bbfatal "Self-check failed: CONFIG_UBIFS_FS still enabled"
-    fi
-    grep "CONFIG_ROOT_NFS=y" ${S}/${KERNEL_BUILD_DIR}/.config || \
-        bbfatal "Self-check failed: CONFIG_ROOT_NFS not enabled"
+cat << EOF | sed -i '/^override_dh_auto_build/ r /dev/stdin' ${S}/debian/rules
+	if ! grep "# CONFIG_MTD is not set" \$(O)/.config && \\
+	   ! grep "# CONFIG_MTD_UBI is not set" \$(O)/.config; then \\
+	    grep "# CONFIG_UBIFS_FS is not set" \$(O)/.config || \\
+	        (echo "Self-check failed: CONFIG_UBIFS_FS still enabled" && exit 1); \\
+	fi
+	grep "CONFIG_ROOT_NFS=y" \$(O)/.config || \\
+	    (echo "Self-check failed: CONFIG_ROOT_NFS not enabled" && exit 1)
+EOF
 }
-- 
2.20.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-12-23  5:06 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-23  5:05 [PATCH 0/7] Avoid using shell environment during the build Uladzimir Bely
2021-12-23  5:05 ` [PATCH 1/7] template: Copy template attributes on transform Uladzimir Bely
2021-12-23  5:05 ` [PATCH 2/7] linux-module: Do not use shell environment Uladzimir Bely
2021-12-23  5:05 ` [PATCH 3/7] u-boot: " Uladzimir Bely
2021-12-23  5:05 ` [PATCH 4/7] trusted-firmware: " Uladzimir Bely
2021-12-23  5:05 ` [PATCH 5/7] optee-os: " Uladzimir Bely
2021-12-23  5:05 ` [PATCH 6/7] kselftest: " Uladzimir Bely
2021-12-23  5:05 ` [PATCH 7/7] linux-mainline: Move cfg fragment test to debian/rules Uladzimir Bely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox