From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 7032253102499561472 X-Received: by 2002:a2e:a268:: with SMTP id k8mr25522990ljm.451.1637324020257; Fri, 19 Nov 2021 04:13:40 -0800 (PST) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a05:6512:3e10:: with SMTP id i16ls223128lfv.3.gmail; Fri, 19 Nov 2021 04:13:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJx/Bsn58jx/D35LZUQiXcV6OeDeXOXhB3wlpQUI/206BLGJTNWSFvZpj7f9NrtpheuFWd9N X-Received: by 2002:a05:6512:b03:: with SMTP id w3mr32217246lfu.219.1637324019231; Fri, 19 Nov 2021 04:13:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1637324019; cv=none; d=google.com; s=arc-20160816; b=b4E5sHF5noV4O5EHQmmW1DKwu6tOIEGsdpthZ48iBRlqJ2HkY5nlvFoY4FxFtQJcyJ q4xpZLAQtT1V+LiqHc8TWB/N6xt8MN/NU2TyNETX2+It5sAR7cg1E3bv+P5L88QljJEr 3OdHiTlxaoCMM99Xm1IsLNBQqohNJmyBobZFbHhs70eyarDBycRGH/JyK24dPFB3BYpj CQMsJRmhSkhRkSnwLlKeZ10CycFrmLhTbaWp1YuT2kFuawTLpERRrYzlCMsz7esDmZ9t uhLXXl62ggQFMeo1kH0M8AgHopqxeN/wVZZDwvdUyUJoifQpjBYp/MWiMnaxIfQesXKH scrA== 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:to:from; bh=eGJC6B2ZhZqiMEcYOfbrYEwjb624LrMWWOmunLH6YlA=; b=L8KRHmyHUVKpQ0mneOa7f+UPtUiAPOuu+jzwHqDbBrsUA7v5c+Yc8Oemyr1oz7E8hB hWB2289F04WnbxAyFW37crOqX8KaQ7iLWQugeiTZqsFvk8S6tzKqOuChvSle5pEXeL0W +KYb3eBn2kWZKHRkElmdeRQhryRCXl4vDLujy2IOZCoCOaGVuUtjMIbdZDu0Nz5490cQ OLN5/pKc8BZr8NuM+cwBNtcfD2BIBS4jV4oFikAYXmPH/U3tOBd9FsbnwNkPhAfpDiko TyXHfvalurawlJ1sH0WHCQ9htrINLbTsbbe1t0H3oAxOXj8JpcXuFF4hmrzLYDVD9O2h T64g== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of ubely@ilbers.de designates 85.214.156.166 as permitted sender) smtp.mailfrom=ubely@ilbers.de Return-Path: Received: from shymkent.ilbers.de (shymkent.ilbers.de. [85.214.156.166]) by gmr-mx.google.com with ESMTPS id u19si183711ljl.5.2021.11.19.04.13.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 19 Nov 2021 04:13:39 -0800 (PST) Received-SPF: pass (google.com: domain of ubely@ilbers.de designates 85.214.156.166 as permitted sender) client-ip=85.214.156.166; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of ubely@ilbers.de designates 85.214.156.166 as permitted sender) smtp.mailfrom=ubely@ilbers.de Received: from baighyz.m.ilbers.de (host-80-81-17-52.static.customer.m-online.net [80.81.17.52]) (authenticated bits=0) by shymkent.ilbers.de (8.15.2/8.15.2/Debian-8) with ESMTPSA id 1AJCDX7N021829 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 19 Nov 2021 13:13:38 +0100 From: Uladzimir Bely To: isar-users@googlegroups.com Subject: [PATCH v2 13/24] linux-custom: Prepare kernel config inside sbuild Date: Fri, 19 Nov 2021 13:13:22 +0100 Message-Id: <20211119121333.13805-14-ubely@ilbers.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20211119121333.13805-1-ubely@ilbers.de> References: <20211119121333.13805-1-ubely@ilbers.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED autolearn=unavailable autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on shymkent.ilbers.de X-TUID: MU6toBSa549C From: Anton Mikanovich Move prepare code inside sbuild hook to perform all the operations inside schroot. Signed-off-by: Anton Mikanovich --- meta/classes/dpkg.bbclass | 4 ++++ meta/classes/sbuild.bbclass | 10 +++++----- meta/recipes-core/isar-bootstrap/isar-bootstrap.inc | 8 -------- meta/recipes-kernel/linux/linux-custom.inc | 7 +++++-- 4 files changed, 14 insertions(+), 15 deletions(-) diff --git a/meta/classes/dpkg.bbclass b/meta/classes/dpkg.bbclass index e021e546..6da61185 100644 --- a/meta/classes/dpkg.bbclass +++ b/meta/classes/dpkg.bbclass @@ -36,9 +36,13 @@ dpkg_runbuild() { E="${@ isar_export_proxies(d)}" export PARALLEL_MAKE="${PARALLEL_MAKE}" + schroot_create_configs + sbuild -A -n -c ${SBUILD_CHROOT} --extra-repository="${ISAR_APT_REPO}" \ --host=${PACKAGE_ARCH} --build=${SBUILD_HOST_ARCH} \ --starting-build-commands="runuser -u ${SCHROOT_USER} -- sh -c \"${SBUILD_PREBUILD:-:}\"" \ --no-run-lintian --no-run-piuparts --no-run-autopkgtest \ --build-dir=${WORKDIR} ${WORKDIR}/${PPS} + + schroot_delete_configs } diff --git a/meta/classes/sbuild.bbclass b/meta/classes/sbuild.bbclass index b7a349e6..a03883f0 100644 --- a/meta/classes/sbuild.bbclass +++ b/meta/classes/sbuild.bbclass @@ -19,7 +19,7 @@ python __anonymous() { d.setVar('SBUILD_HOST_ARCH', d.getVar('HOST_ARCH')) } -SBUILD_CHROOT ?= "${DEBDISTRONAME}-${SCHROOT_USER}-${DISTRO}-${SBUILD_HOST_ARCH}" +SBUILD_CHROOT ?= "${DEBDISTRONAME}-${SCHROOT_USER}-${@os.getpid()}" SBUILD_CHROOT_RW ?= "${SBUILD_CHROOT}-rw" SBUILD_CONF_DIR ?= "${SCHROOT_CONF}/${SBUILD_CHROOT}" @@ -102,6 +102,7 @@ sbuild_export() { } schroot_install() { + schroot_create_configs APTS="$1" #TODO deb_dl_dir_import "${BUILDCHROOT_DIR}" "${distro}" schroot -d / -c ${SBUILD_CHROOT_RW} -u root -- \ @@ -111,35 +112,34 @@ schroot_install() { schroot -d / -c ${SBUILD_CHROOT_RW} -u root -- \ apt install -y -o Debug::pkgProblemResolver=yes \ --no-install-recommends ${APTS} + schroot_delete_configs } insert_mounts() { sudo -s <<'EOSUDO' - ( flock 9 set -e for mp in ${SCHROOT_MOUNTS}; do FSTAB_LINE="${mp%%:*} ${mp#*:} none rw,bind 0 0" grep -qxF "${FSTAB_LINE}" ${SBUILD_CONF_DIR}/fstab || \ echo "${FSTAB_LINE}" >> ${SBUILD_CONF_DIR}/fstab done - ) 9>'${SCHROOT_LOCKFILE}' EOSUDO } remove_mounts() { sudo -s <<'EOSUDO' - ( flock 9 set -e for mp in ${SCHROOT_MOUNTS}; do FSTAB_LINE="${mp%%:*} ${mp#*:} none rw,bind 0 0" sed -i "\|${FSTAB_LINE}|d" ${SBUILD_CONF_DIR}/fstab done - ) 9>'${SCHROOT_LOCKFILE}' EOSUDO } schroot_run() { + schroot_create_configs insert_mounts schroot $@ remove_mounts + schroot_delete_configs } diff --git a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc index 39e9c007..1b227028 100644 --- a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc +++ b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc @@ -32,7 +32,6 @@ DISTRO_VARS_PREFIX ?= "${@'HOST_' if d.getVar('BOOTSTRAP_FOR_HOST') == '1' else BOOTSTRAP_DISTRO = "${@d.getVar('HOST_DISTRO' if d.getVar('BOOTSTRAP_FOR_HOST') == '1' else 'DISTRO')}" inherit deb-dl-dir -inherit sbuild python () { distro_bootstrap_keys = (d.getVar("DISTRO_BOOTSTRAP_KEYS") or "").split() @@ -399,13 +398,6 @@ EOSUDO addtask bootstrap before do_build after do_generate_keyrings -do_schroot_config() { - schroot_create_configs -} - -addtask schroot_config before do_bootstrap after do_generate_keyrings -# TODO: remove configs from /etc/schroot - CLEANFUNCS = "clean_deploy" clean_deploy() { rm -f "${DEPLOY_ISAR_BOOTSTRAP}" diff --git a/meta/recipes-kernel/linux/linux-custom.inc b/meta/recipes-kernel/linux/linux-custom.inc index ed89aa09..21115840 100644 --- a/meta/recipes-kernel/linux/linux-custom.inc +++ b/meta/recipes-kernel/linux/linux-custom.inc @@ -125,6 +125,9 @@ do_prepare_build_prepend() { # remove templates from the source tree find ${S}/debian -name *.tmpl | xargs rm -f + # restore execute permissions + chmod a+x ${S}/debian/rules + # rename install/remove hooks to match user-specified name for our linux-image package mv ${S}/debian/linux-image.postinst ${S}/debian/linux-image-${KERNEL_NAME_PROVIDED}.postinst mv ${S}/debian/linux-image.postrm ${S}/debian/linux-image-${KERNEL_NAME_PROVIDED}.postrm @@ -164,9 +167,9 @@ dpkg_configure_kernel() { (cd ${WORKDIR} && cp ${src_frags} ${S}/debian/fragments/) fi - sudo -E chroot --userspec=$(id -u):$(id -g) ${BUILDCHROOT_DIR} sh -c " \ + SBUILD_PREBUILD=" \ export ARCH=${KERNEL_ARCH} && \ - cd ${PP}/${PPS} && \ + cd %p && \ make O=${KERNEL_BUILD_DIR} ${config_target} && \ ./scripts/kconfig/merge_config.sh \ -O ${KERNEL_BUILD_DIR}/ \ -- 2.20.1