From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 7075595997826514944 X-Received: by 2002:a17:906:a0ce:b0:6d1:cb30:3b3b with SMTP id bh14-20020a170906a0ce00b006d1cb303b3bmr26218762ejb.582.1651761591715; Thu, 05 May 2022 07:39:51 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a05:6402:270b:b0:427:d070:5bfe with SMTP id y11-20020a056402270b00b00427d0705bfels5250495edd.0.gmail; Thu, 05 May 2022 07:39:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzI0g4I9cfmrOjVy4oyceRoUAQp9beOQ0Ga+9HyEUVMm+0r5twtJOdZMJiQTpyIPnakGR8J X-Received: by 2002:a50:ce14:0:b0:425:cb75:5322 with SMTP id y20-20020a50ce14000000b00425cb755322mr31327766edi.386.1651761590823; Thu, 05 May 2022 07:39:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651761590; cv=none; d=google.com; s=arc-20160816; b=oYGKivua7KnPvswK0r1L9zJJrSwA1/2gh4gmppchBCi0okcrwypxhJaEQN1sgCG/4M 4/6NZO00eR+N/Xm/5BNh7kxWH6s23fAuNc0G0PPA8KZRLN+oBUrT5UZrtdNqulANVG4N LtLaQF2KDEHOjF66xOK3FsvcOgLQupsY23lq/hown6PgALpWUbQFpkCHWHnnNMN8XhDy 5/uwQN73yWxT1hWU/3SJgwO+EjUdNYhZulR9GFhurJYr/OM3X2uyF85FtgkvpWOPU9Nt o5A0PxbuuenCmm0x2SpZOeN1r7MLuYNSSKi2rOXFOJhk+6IecyRc92mjAYaAhRVL2P3p LH0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from; bh=WYEHaugeTOpNgSCdGt43n0x+i77Ns814YL0hjsUI8Tw=; b=0/N7Nl8yNFORo94OE3ZRsM3xDD8fIXLQECzqMyuPe51xmwW7gJwH3pcVjKWA5uW/QG 8RHozbgWQJ0J+hU/LTL4lRNPjmCkNqwJKUfSn6cosWibquWlDeqL+lw6SKiUGBGo+1xx Vp2WKeDW+AxJ4UazA7DBVtmEWpy+K2cCgi+fj8Uy+mKqqHNNRDUf2pWRJvDD2WosXvmj ZAZ71cNdE/Mh5x2XAvC3xzV5W8LDXdike5UbykX8VKBFTYBcnJqFLzN2Cpx2L+NiaBM1 u8wau0yAKc2AnMMbtRmA9k5MOKAwiIcGmNctPiCWJ7M6osMrScGgAockShidduRD+bjV LbJw== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of amikan@ilbers.de designates 85.214.156.166 as permitted sender) smtp.mailfrom=amikan@ilbers.de Return-Path: Received: from shymkent.ilbers.de (shymkent.ilbers.de. [85.214.156.166]) by gmr-mx.google.com with ESMTPS id gz5-20020a170907a04500b006f4639cc02dsi77174ejc.2.2022.05.05.07.39.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 05 May 2022 07:39:50 -0700 (PDT) Received-SPF: pass (google.com: domain of amikan@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 amikan@ilbers.de designates 85.214.156.166 as permitted sender) smtp.mailfrom=amikan@ilbers.de Received: from localhost.localdomain (mm-0-74-214-37.mgts.dynamic.pppoe.byfly.by [37.214.74.0] (may be forged)) (authenticated bits=0) by shymkent.ilbers.de (8.15.2/8.15.2/Debian-8) with ESMTPSA id 245Edf7Z014026 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 5 May 2022 16:39:50 +0200 From: Anton Mikanovich To: isar-users@googlegroups.com Cc: adriaan.schmidt@siemens.com, Uladzimir Bely Subject: [PATCH v10 07/19] sbuild: Support of shell exports from dpkg_runbuild_prepend Date: Thu, 5 May 2022 17:39:22 +0300 Message-Id: <20220505143934.16096-8-amikan@ilbers.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220505143934.16096-1-amikan@ilbers.de> References: <20220505143934.16096-1-amikan@ilbers.de> 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: SyjDCcOtAs3X From: Uladzimir Bely 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 1f795c7..b61d182 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.17.1