public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Uladzimir Bely <ubely@ilbers.de>
To: isar-users@googlegroups.com
Subject: [PATCH v2 14/24] sbuild: Add recipes for host and target rootfs to run sbuild
Date: Fri, 19 Nov 2021 13:13:23 +0100	[thread overview]
Message-ID: <20211119121333.13805-15-ubely@ilbers.de> (raw)
In-Reply-To: <20211119121333.13805-1-ubely@ilbers.de>

Similar to buildchroot, we need a separate rootfs to be used
for schroot.

It's based on bootstrapped rootfs, but includes several
common build-related packages.

Signed-off-by: Uladzimir Bely <ubely@ilbers.de>
---
 meta/classes/dpkg-base.bbclass                |  3 ++
 meta/classes/dpkg.bbclass                     |  1 -
 meta/classes/sbuild.bbclass                   |  7 ++--
 meta/conf/bitbake.conf                        |  2 ++
 .../isar-bootstrap/isar-bootstrap.inc         |  2 +-
 .../sbuild-chroot/sbuild-chroot-host.bb       | 13 +++++++
 .../sbuild-chroot/sbuild-chroot-target.bb     | 10 ++++++
 .../sbuild-chroot/sbuild-chroot.inc           | 36 +++++++++++++++++++
 8 files changed, 70 insertions(+), 4 deletions(-)
 create mode 100644 meta/recipes-devtools/sbuild-chroot/sbuild-chroot-host.bb
 create mode 100644 meta/recipes-devtools/sbuild-chroot/sbuild-chroot-target.bb
 create mode 100644 meta/recipes-devtools/sbuild-chroot/sbuild-chroot.inc

diff --git a/meta/classes/dpkg-base.bbclass b/meta/classes/dpkg-base.bbclass
index 8bbc4165..acf967ac 100644
--- a/meta/classes/dpkg-base.bbclass
+++ b/meta/classes/dpkg-base.bbclass
@@ -4,6 +4,7 @@
 #
 # SPDX-License-Identifier: MIT
 
+inherit sbuild
 inherit buildchroot
 inherit debianize
 inherit terminal
@@ -214,6 +215,8 @@ python do_dpkg_build() {
 
 addtask dpkg_build before do_build
 
+do_dpkg_build[depends] = "${SCHROOT_DEP}"
+
 KEEP_INSTALLED_ON_CLEAN ?= "0"
 
 CLEANFUNCS += "deb_clean"
diff --git a/meta/classes/dpkg.bbclass b/meta/classes/dpkg.bbclass
index 6da61185..d49648be 100644
--- a/meta/classes/dpkg.bbclass
+++ b/meta/classes/dpkg.bbclass
@@ -2,7 +2,6 @@
 # Copyright (C) 2015-2018 ilbers GmbH
 
 inherit dpkg-base
-inherit sbuild
 
 PACKAGE_ARCH ?= "${DISTRO_ARCH}"
 
diff --git a/meta/classes/sbuild.bbclass b/meta/classes/sbuild.bbclass
index a03883f0..80f9ef25 100644
--- a/meta/classes/sbuild.bbclass
+++ b/meta/classes/sbuild.bbclass
@@ -15,8 +15,13 @@ python __anonymous() {
     if mode == "0" or d.getVar('HOST_ARCH') ==  distro_arch or \
        (d.getVar('HOST_DISTRO') == "debian-stretch" and distro_arch == "i386"):
         d.setVar('SBUILD_HOST_ARCH', distro_arch)
+        d.setVar('SCHROOT_DIR', d.getVar('SCHROOT_TARGET_DIR'))
+        dep = "sbuild-chroot-target:do_build"
     else:
         d.setVar('SBUILD_HOST_ARCH', d.getVar('HOST_ARCH'))
+        d.setVar('SCHROOT_DIR', d.getVar('SCHROOT_HOST_DIR'))
+        dep = "sbuild-chroot-host:do_build"
+    d.setVar('SCHROOT_DEP', dep)
 }
 
 SBUILD_CHROOT ?= "${DEBDISTRONAME}-${SCHROOT_USER}-${@os.getpid()}"
@@ -25,8 +30,6 @@ SBUILD_CHROOT_RW ?= "${SBUILD_CHROOT}-rw"
 SBUILD_CONF_DIR ?= "${SCHROOT_CONF}/${SBUILD_CHROOT}"
 SCHROOT_CONF_FILE ?= "${SCHROOT_CONF}/chroot.d/${SBUILD_CHROOT}"
 
-SCHROOT_DIR ?= "${DEPLOY_DIR_BOOTSTRAP}/${DISTRO}-${SBUILD_HOST_ARCH}"
-
 schroot_create_configs() {
     sudo -s <<'EOSUDO'
         set -e
diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
index dce467b2..83508ccc 100644
--- a/meta/conf/bitbake.conf
+++ b/meta/conf/bitbake.conf
@@ -57,6 +57,8 @@ DL_DIR ?= "${TOPDIR}/downloads"
 SSTATE_DIR ?= "${TMPDIR}/sstate-cache"
 BUILDCHROOT_HOST_DIR = "${DEPLOY_DIR_BUILDCHROOT}-host/${HOST_DISTRO}-${HOST_ARCH}_${DISTRO}-${DISTRO_ARCH}"
 BUILDCHROOT_TARGET_DIR = "${DEPLOY_DIR_BUILDCHROOT}-target/${DISTRO}-${DISTRO_ARCH}"
+SCHROOT_HOST_DIR = "${DEPLOY_DIR}/schroot-host/${HOST_DISTRO}-${HOST_ARCH}_${DISTRO}-${DISTRO_ARCH}"
+SCHROOT_TARGET_DIR = "${DEPLOY_DIR}/schroot-target/${DISTRO}-${DISTRO_ARCH}"
 SDKCHROOT_DIR = "${DEPLOY_DIR_SDKCHROOT}/${DISTRO}-${DISTRO_ARCH}"
 CACHE = "${TMPDIR}/cache"
 KERNEL_FILE ?= "vmlinuz"
diff --git a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
index 1b227028..e9f92916 100644
--- a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
+++ b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
@@ -25,7 +25,7 @@ APTSRCS_INIT = "${WORKDIR}/apt-sources-init"
 DISTRO_BOOTSTRAP_KEYFILES = ""
 THIRD_PARTY_APT_KEYFILES = ""
 DEPLOY_ISAR_BOOTSTRAP ?= ""
-DISTRO_BOOTSTRAP_BASE_PACKAGES = "locales,fakeroot,build-essential,debhelper"
+DISTRO_BOOTSTRAP_BASE_PACKAGES = "locales"
 DISTRO_BOOTSTRAP_BASE_PACKAGES_append_gnupg = ",gnupg"
 DISTRO_BOOTSTRAP_BASE_PACKAGES_append_https-support = "${@https_support(d)}"
 DISTRO_VARS_PREFIX ?= "${@'HOST_' if d.getVar('BOOTSTRAP_FOR_HOST') == '1' else ''}"
diff --git a/meta/recipes-devtools/sbuild-chroot/sbuild-chroot-host.bb b/meta/recipes-devtools/sbuild-chroot/sbuild-chroot-host.bb
new file mode 100644
index 00000000..aa82846b
--- /dev/null
+++ b/meta/recipes-devtools/sbuild-chroot/sbuild-chroot-host.bb
@@ -0,0 +1,13 @@
+# Root filesystem for packages building
+#
+# This software is a part of ISAR.
+# Copyright (C) 2015-2021 ilbers GmbH
+
+DESCRIPTION = "Isar sbuild/schroot filesystem for host"
+
+SBUILD_VARIANT = "host"
+
+require sbuild-chroot.inc
+
+ROOTFS_ARCH = "${HOST_ARCH}"
+ROOTFS_DISTRO = "${HOST_DISTRO}"
diff --git a/meta/recipes-devtools/sbuild-chroot/sbuild-chroot-target.bb b/meta/recipes-devtools/sbuild-chroot/sbuild-chroot-target.bb
new file mode 100644
index 00000000..d75d783b
--- /dev/null
+++ b/meta/recipes-devtools/sbuild-chroot/sbuild-chroot-target.bb
@@ -0,0 +1,10 @@
+# Root filesystem for packages building
+#
+# This software is a part of ISAR.
+# Copyright (C) 2015-2021 ilbers GmbH
+
+DESCRIPTION = "Isar sbuild/schroot filesystem for target"
+
+SBUILD_VARIANT = "target"
+
+require sbuild-chroot.inc
diff --git a/meta/recipes-devtools/sbuild-chroot/sbuild-chroot.inc b/meta/recipes-devtools/sbuild-chroot/sbuild-chroot.inc
new file mode 100644
index 00000000..177a8a6d
--- /dev/null
+++ b/meta/recipes-devtools/sbuild-chroot/sbuild-chroot.inc
@@ -0,0 +1,36 @@
+# Common part for build chroot filesystem.
+#
+# This software is a part of ISAR.
+# Copyright (C) 2015-2021 ilbers GmbH
+
+LICENSE = "gpl-2.0"
+LIC_FILES_CHKSUM = "file://${LAYERDIR_core}/licenses/COPYING.GPLv2;md5=751419260aa954499f7abaabaa882bbe"
+
+PV = "1.0"
+
+inherit rootfs
+
+SBUILD_CHROOT_PREINSTALL_COMMON = " \
+    fakeroot \
+    build-essential \
+    debhelper \
+"
+
+SBUILD_CHROOT_PREINSTALL ?= " \
+    ${SBUILD_CHROOT_PREINSTALL_COMMON} \
+"
+
+SBUILD_CHROOT_DIR = "${WORKDIR}/rootfs"
+ROOTFSDIR = "${SBUILD_CHROOT_DIR}"
+ROOTFS_PACKAGES = "${SBUILD_CHROOT_PREINSTALL}"
+
+# We don't need /etc/apt/sources.list.d/isar-apt.list' while it's handled by sbuild
+ROOTFS_CONFIGURE_COMMAND_remove = "rootfs_configure_isar_apt"
+
+DEPLOY_SCHROOT = "${@d.getVar('SCHROOT_' + d.getVar('SBUILD_VARIANT').upper() + '_DIR')}"
+
+do_sbuildchroot_deploy[dirs] = "${DEPLOY_DIR}/schroot-${SBUILD_VARIANT}"
+do_sbuildchroot_deploy() {
+    ln -Tfsr "${ROOTFSDIR}" "${DEPLOY_SCHROOT}"
+}
+addtask sbuildchroot_deploy before do_build after do_rootfs
-- 
2.20.1


  parent reply	other threads:[~2021-11-19 12:13 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-19 12:13 [PATCH v2 00/24] Sbuild/Schroot migration Uladzimir Bely
2021-11-19 12:13 ` [PATCH v2 01/24] dpkg: Install raw package files to source root Uladzimir Bely
2021-11-19 12:13 ` [PATCH v2 02/24] dpkg-gbp: Use separate command to export tarball Uladzimir Bely
2021-11-19 12:13 ` [PATCH v2 03/24] isar-bootstrap: Export bootstrap to schroot config Uladzimir Bely
2021-11-19 12:13 ` [PATCH v2 04/24] linux-module: Do not use shell environment Uladzimir Bely
2021-11-19 12:44   ` Jan Kiszka
2021-11-19 12:45     ` Jan Kiszka
2021-11-23 12:24     ` Uladzimir Bely
2021-11-24  6:13       ` Jan Kiszka
2021-11-25  5:47     ` Uladzimir Bely
2021-11-19 12:13 ` [PATCH v2 05/24] u-boot: " Uladzimir Bely
2021-11-19 12:13 ` [PATCH v2 06/24] trusted-firmware: " Uladzimir Bely
2021-11-19 12:13 ` [PATCH v2 07/24] optee-os: " Uladzimir Bely
2021-11-19 12:13 ` [PATCH v2 08/24] kselftest: " Uladzimir Bely
2021-11-19 12:13 ` [PATCH v2 09/24] dpkg: Build packages with sbuild Uladzimir Bely
2021-11-19 12:13 ` [PATCH v2 10/24] sbuild: Introduce environment variables export API Uladzimir Bely
2021-11-21  9:07   ` Jan Kiszka
2021-11-19 12:13 ` [PATCH v2 11/24] dpkg-gbp: Migrate to schroot Uladzimir Bely
2021-11-19 12:13 ` [PATCH v2 12/24] linux-mainline: Move cfg fragment test to debian/rules Uladzimir Bely
2021-11-19 12:13 ` [PATCH v2 13/24] linux-custom: Prepare kernel config inside sbuild Uladzimir Bely
2021-11-19 12:13 ` Uladzimir Bely [this message]
2021-11-19 12:13 ` [PATCH v2 15/24] sbuild: Mount base-apt in schroot Uladzimir Bely
2021-11-19 12:13 ` [PATCH v2 16/24] sbuild: Add sbuildshell task Uladzimir Bely
2021-11-19 12:13 ` [PATCH v2 17/24] dpkg-gbp: Preinstall gbp utils in schroot Uladzimir Bely
2021-11-19 12:13 ` [PATCH v2 18/24] dpkg: Remove builddeps install task Uladzimir Bely
2021-11-19 12:13 ` [PATCH v2 19/24] dpkg-base: Switch devshell to use schroot Uladzimir Bely
2021-11-19 12:13 ` [PATCH v2 20/24] dpkg-base: Switch apt_fetch and apt_unpack " Uladzimir Bely
2021-11-19 12:13 ` [PATCH v2 21/24] dpkg-base: Cleanup from buildchroot parts Uladzimir Bely
2021-11-19 12:13 ` [PATCH v2 22/24] dpkg-gbp: Use host tools for dsc preparation Uladzimir Bely
2021-11-19 12:13 ` [PATCH v2 23/24] doc: Add sbuild-related documentation Uladzimir Bely
2021-11-19 12:13 ` [PATCH v2 24/24] sbuild: Replace isar-apt mounting with copying Uladzimir Bely
2021-11-19 21:48 ` [PATCH v2 00/24] Sbuild/Schroot migration Henning Schild
2021-11-21  9:07   ` Jan Kiszka
2021-11-23 13:05 ` Uladzimir Bely
2021-11-26  6:43   ` Jan Kiszka
2021-11-26  8:03     ` Uladzimir Bely
2021-11-26  8:50       ` Jan Kiszka
2021-12-01 12:11         ` Jan Kiszka
2021-11-26 12:09   ` Michael Adler
2021-11-26 12:57     ` Uladzimir Bely
2021-11-26 14:58     ` Jan Kiszka

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=20211119121333.13805-15-ubely@ilbers.de \
    --to=ubely@ilbers.de \
    --cc=isar-users@googlegroups.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