From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 7075595997826514944 X-Received: by 2002:aa7:ca04:0:b0:410:92a6:1a9e with SMTP id y4-20020aa7ca04000000b0041092a61a9emr2513429eds.411.1647492625639; Wed, 16 Mar 2022 21:50:25 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a05:6402:430d:b0:418:f806:d240 with SMTP id m13-20020a056402430d00b00418f806d240ls455005edc.0.gmail; Wed, 16 Mar 2022 21:50:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJya1bZyo9YbOkVnZH3FQovfOuFJHjb+8l58XnMXAv9FUWQ+SnJOh0a2bpYB47tZLY/QVZsT X-Received: by 2002:a05:6402:2023:b0:416:2c7:945c with SMTP id ay3-20020a056402202300b0041602c7945cmr2584990edb.148.1647492624684; Wed, 16 Mar 2022 21:50:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647492624; cv=none; d=google.com; s=arc-20160816; b=ZQM1PiMxdsOk5i47+fU5FvnplzpnnO72E6FqGaWUAtuNijsDr8WqA7b7nMH/nuLzy8 Ht9XWR3/OJAfCOGH23hkOrtleon8lv1tBnDzL/IOSIqu7J3oDlptS8oIwxdkO44Ehmom KahFQsD08Q8yoqZsMdQ5neR+W3eCGWfJK9iLeS1WDx0pUOgbklgZJDzCXnIwpCbBWw+P drESUy82aYVY7Ru8kTl6//squkw/5l8nMV/iVyJNNlCqpDN/PwsdyWLferWXG82QQMj2 rJU1R3N9HOJhz0OAcdTIXxnrlQ61UlFdTtxQ2gEtaocXSCaQUt+Bcb2OC/wfnfrdWY1q 4uTg== 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=GygOy62VV57JeydHhe78KeMiq4l9wjwDWLv63nvFG8U=; b=nNh4f8dquc/niErxRcwTEH7MCOFAmpvDH+4cfQiyJaPOFC31aMLgdSHQPYQ1gq1Zit JAGPDcbsB/HiwiFJ5P2Jx1qTOc2lu6+MPKpbeXNnX6IkKTAkoO64FjK5NKONFeGZZP7c hdotdb00jJE8q7panc9QWNlbe4r1Xk1LXB84X4JFKlpVmtBVS1p5ndpHepE4UwLBLb76 pozrQ72gMamYA1WO4GSoR63bmzZPULlaoQPx7JI/4/eUXAXxNJj52EBeqa5Aktn6OtFU zN9xl7FITzIECle9Bkx42dxLbVfGapLhv6SKwCIeLgxpXBPSkAZJBKsf/1xEb4vP5/Pz YoRA== 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 s11-20020a056402520b00b004162c540122si183965edd.4.2022.03.16.21.50.24 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 16 Mar 2022 21:50:24 -0700 (PDT) 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 22H4oLHe025716 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 17 Mar 2022 05:50:24 +0100 From: Uladzimir Bely To: isar-users@googlegroups.com Subject: [PATCH v8 07/16] sbuild: Support of shell exports from dpkg_runbuild_prepend Date: Thu, 17 Mar 2022 05:50:12 +0100 Message-Id: <20220317045021.4018-8-ubely@ilbers.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220317045021.4018-1-ubely@ilbers.de> References: <20220317045021.4018-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: +RmZoKPIpMOz Many of recipes often use shell exports done in dpkg_run_prepend. While sbuild is performed in isolated environment, we need a way to pass these exported variables to it. This is done by storing environment just before dpkg_runbuild (after prepare_build) and finding just before the actual build what has been changed or added. This patch allows using shell exports, but warning will be produced. It's recommended to modify the code (in downstreams) and replace shell exports by other methods, like using templates. Signed-off-by: Uladzimir Bely --- meta/classes/dpkg.bbclass | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/meta/classes/dpkg.bbclass b/meta/classes/dpkg.bbclass index 1f795c75..b61d182d 100644 --- a/meta/classes/dpkg.bbclass +++ b/meta/classes/dpkg.bbclass @@ -32,6 +32,12 @@ 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)}" @@ -39,6 +45,26 @@ dpkg_runbuild() { export DEB_BUILD_OPTIONS="${@ isar_deb_build_options(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" + + # Don't warn some variables + [ "${var}" = "PARALLEL_MAKE" ] && continue + [ "${var}" = "CCACHE_DIR" ] && continue + [ "${var}" = "PATH_PREPEND" ] && continue + [ "${var}" = "DEB_BUILD_OPTIONS" ] && continue + + bbwarn "Export of '${line}' detected, please migrate to templates" + done + profiles="${@ isar_deb_build_profiles(d)}" if [ ! -z "$profiles" ]; then profiles=$(echo --profiles="$profiles" | sed -e 's/ \+/,/g') -- 2.20.1