From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 7057122428766388224 X-Received: by 2002:ac2:5e7b:: with SMTP id a27mr19911270lfr.417.1643734871035; Tue, 01 Feb 2022 09:01:11 -0800 (PST) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a05:6512:22d1:: with SMTP id g17ls927925lfu.2.gmail; Tue, 01 Feb 2022 09:01:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJxFr7jaCUO6Kt+hOb3p9yBPuhQABpOjZld9FwrLqX5K7jcJZssHIgDyYnJSpJIqK8Bln1wk X-Received: by 2002:a05:6512:3181:: with SMTP id i1mr20076835lfe.286.1643734870128; Tue, 01 Feb 2022 09:01:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643734870; cv=none; d=google.com; s=arc-20160816; b=qWm7v1ziX0ZaIFkMz6HQAQ1UfNIaNQnkbm6+O5IXnZlx4GTZlCA9q8Ye1Db/uPJ2p+ fZ5v1Nrjb1i/HlsRbf8FjZB6re+234fBx7KLPdSY6cvDPhDgK12U3+EGrY1LoXmDBTfq 3AuQhkfe2WXCaYlUmL26uWyR/b86NM8E0+uycydPaoZ4lR2LMlkvNNLihPZtm2XDJhRM iQKn4X9+Z0Z8MFbqqoN+u2AWfjx78aGqR+QwZRrpt8xJOEYE1Xg/eXrKqiQOBRz1N6mw 1/ujIxFPF/+iQJXKFUSPnLyPu8gU5l3Qz0whNY2qgu0SuOb377ykQallH5m9LolNRNgL acEA== 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=0FRFEtSVo8smunHVADBMjW5+srhLrzYCFScartmTY78=; b=c2sGGGTI/VLWHYgsyrrznDB5NRdbeSAEKR8M5kONpEvjxo/9jh7zqDlKufikRp9Ueo 4XjWMCeXLdhUBdqjE4bI/aGPPvLo+NmtPFXFO8SYGVTWF0wKWjLuIjwE4oRmRdGKQigb dlYIS+dcpI2mXC5cz6I5Hp9os8FNm9iPt/gysvVj/Cz0PuC9l7NPfv6YRPBXA9YGvQ2T +gSX41GWJTvtH/mNwCCLgOdh2SbO2T6ht3mdRSeAEqaRUVUOhzQz6C//lzK2gJhO472E NNxg0O12OfDYGpC54Je8qMDz+BlbwMWiWL1DUW1FKJWqozU+T+Oi2dKL6Mhy+FC626IH rkyQ== 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 a6si999176lji.0.2022.02.01.09.01.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 01 Feb 2022 09:01:10 -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 211H0cAB019722 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 1 Feb 2022 18:01:04 +0100 From: Uladzimir Bely To: isar-users@googlegroups.com Subject: [PATCH v5 07/12] sbuild: support of shell exports from dpkg_runbuild_prepend Date: Tue, 1 Feb 2022 18:00:33 +0100 Message-Id: <20220201170038.5723-8-ubely@ilbers.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220201170038.5723-1-ubely@ilbers.de> References: <20220201170038.5723-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: vKe8M4S1vNZd Many of recipes often use shell exports done in dpkg_run_prepend, so that this changed environment is used during build. While sbuild is performed in isolated environment, we need a way to pass these variables to it. This is done by storing environment before dpkg_runbuild (after prepare_build) and finding just before the actual build what was changed or added. Signed-off-by: Uladzimir Bely --- meta/classes/dpkg.bbclass | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/meta/classes/dpkg.bbclass b/meta/classes/dpkg.bbclass index 66db7ec5..c252e9b3 100644 --- a/meta/classes/dpkg.bbclass +++ b/meta/classes/dpkg.bbclass @@ -29,12 +29,30 @@ do_install_builddeps[lockfiles] += "${REPO_ISAR_DIR}/isar.lock" addtask devshell after do_install_builddeps +DPKG_PREBUILD_ENV_FILE="${WORKDIR}/dpkg_prebuild.env" + +do_prepare_build_append() { + env > ${DPKG_PREBUILD_ENV_FILE} +} + # Build package from sources using build script dpkg_runbuild() { E="${@ isar_export_proxies(d)}" E="${@ isar_export_ccache(d)}" export PARALLEL_MAKE="${PARALLEL_MAKE}" + env | while read -r line; do + # Filter the same lines + grep -q "^${line}" ${DPKG_PREBUILD_ENV_FILE} && continue + # Filter some standard variables + echo ${line} | grep -q "^HOME=" && continue + echo ${line} | grep -q "^PWD=" && continue + + var=$(echo "${line}" | cut -d '=' -f1) + value=$(echo "${line}" | cut -d '=' -f2-) + sbuild_export $var "$value" + done + profiles=$(grep "DEB_BUILD_PROFILES" ${SBUILD_CONFIG} | tail -n1 | cut -d "'" -f 4) if [ ${ISAR_CROSS_COMPILE} -eq 1 ]; then profiles="${profiles} cross nocheck" -- 2.20.1