From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6463052406736289792 X-Received: by 10.223.142.172 with SMTP id q41mr206449wrb.25.1504796652888; Thu, 07 Sep 2017 08:04:12 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 10.25.15.203 with SMTP id 72ls53852lfp.50.gmail; Thu, 07 Sep 2017 08:04:12 -0700 (PDT) X-Google-Smtp-Source: ADKCNb4RnI6RMlTKvsZFkpu7XZ2rbaFDW4+CbpdKkO72KEwUGcFW6bgkbtA9gDrKvZjeqgpAZBul X-Received: by 10.46.83.71 with SMTP id t7mr265025ljd.13.1504796652428; Thu, 07 Sep 2017 08:04:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504796652; cv=none; d=google.com; s=arc-20160816; b=l0zgz2ER02k5NB+dLBdP0j8LTQcjNA2hhjj6DGKiRtoVFBT1f5Ms1fCEsREnLG/cmL /hxYRQ3JId+Gde0Dfdxb17X+8+1KrRKNhmsFLMtbb3Eq00U5c2iIvQzvOSULyDWGpqIm D0vRIvHUJmppwRWsKtG9hsCE3ZUHsOUlHoCYTjOQQqXyQVYLnXiVi3h+RdoRdYJITtan k9fnNVB3V5VVGti0bv3etg+S0n/7pv2aWJ5Qy/pMuzj91HxdcLA0Xr0MN1WIYQPXydWf iGku5bCXfn/AY0XHIdSOZzBzxjfFuqki04FoFzHfTMt1OjJrdcCuYXknQubwcEk43SPM b8aw== 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 :arc-authentication-results; bh=rpTzrNfkiwI+6dYIg8D5hVo8WKEUt7GvL+N7V4cq3wk=; b=oZHNZlS1lLh+B8pK6op0Iwu5zYgGERFtB3wi2pdtuhcwddfqir2dKvsxQDo6IPcgp7 SE2n+WplvOMyX/coAcTHieT0URGAVL/XfYmp68y6RnUrZYtMZ0Joo6NXoXgzkSOG6LiI 2vq3eCmTdZfvxk3zH9pcN47C0KNxzCiBEdDhnogTXOTmAAIC1dXd2bb/z92EeKhuR2xP lRNkLcZOGHeUCZzmUc4HdlDsAD0W9u/mV+pHaORkjo11sdZYICdZm0hF0VUC0OO+k3NV LGhbdHhaLTZNXvg+pucu4F7LRJxMlvLjJ2h/+d3IsOqmzEwNq0unWdmgFo/A4HbY49RV mY/A== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=neutral (google.com: 192.35.17.14 is neither permitted nor denied by best guess record for domain of andreas.reichel.ext@siemens.com) smtp.mailfrom=andreas.reichel.ext@siemens.com Return-Path: Received: from david.siemens.de (david.siemens.de. [192.35.17.14]) by gmr-mx.google.com with ESMTPS id g20si181485wmi.1.2017.09.07.08.04.12 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Sep 2017 08:04:12 -0700 (PDT) Received-SPF: neutral (google.com: 192.35.17.14 is neither permitted nor denied by best guess record for domain of andreas.reichel.ext@siemens.com) client-ip=192.35.17.14; Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 192.35.17.14 is neither permitted nor denied by best guess record for domain of andreas.reichel.ext@siemens.com) smtp.mailfrom=andreas.reichel.ext@siemens.com Received: from mail2.siemens.de (mail2.siemens.de [139.25.208.11]) by david.siemens.de (8.15.2/8.15.2) with ESMTPS id v87F4CIj007507 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 7 Sep 2017 17:04:12 +0200 Received: from localhost.localdomain (golem.ppmd.siemens.net [139.25.69.162]) by mail2.siemens.de (8.15.2/8.15.2) with ESMTP id v87F4ARo004962; Thu, 7 Sep 2017 17:04:11 +0200 From: "Andreas J. Reichel" To: isar-users@googlegroups.com Cc: Andreas Reichel Subject: [PATCH 1/1] Add proxy support to isar-image-*.bb and buildchroot.bb Date: Thu, 7 Sep 2017 17:03:35 +0200 Message-Id: <20170907150335.30970-2-andreas.reichel.ext@siemens.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20170907150335.30970-1-andreas.reichel.ext@siemens.com> References: <20170907150335.30970-1-andreas.reichel.ext@siemens.com> X-TUID: /VAqJYxaoJfD From: Andreas Reichel * BB_ENV_EXTRAWHITE provides a list for variables that are kept in the environment by bitbake. However, isar init script clears any additional settings. Thus, add proxy variables to BB_ENV_EXTRAWHITE in isar-buildenv-internal. * Bitbake clears environment variables for each task within a recipe. However, bb.utils.export_proxies function can be used with an inline-python call to reexport the proxy settings. * Sudo loses environment variables again, thus call multistrap with sudo with the -E option to preserve (the already cleaned) environment for the task's multistrap command. Note: Downloads are normally done by the fetcher task, which calls a python function that in turn uses bb.util.export_proxies. However we have a non-fetcher task, which needs download capabilities as well. Signed-off-by: Andreas Reichel --- meta-isar/recipes-core/images/isar-image-base.bb | 8 +++++++- meta/recipes-devtools/buildchroot/buildchroot.bb | 9 +++++++-- scripts/isar-buildenv-internal | 2 +- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/meta-isar/recipes-core/images/isar-image-base.bb b/meta-isar/recipes-core/images/isar-image-base.bb index b679d97..a826b88 100644 --- a/meta-isar/recipes-core/images/isar-image-base.bb +++ b/meta-isar/recipes-core/images/isar-image-base.bb @@ -24,6 +24,11 @@ IMAGE_ROOTFS = "${S}" do_rootfs[stamp-extra-info] = "${MACHINE}-${DISTRO}" do_rootfs() { + # Bitbake clears environment for all task functions, but we need the proxy + # settings in this task so do an inline python call which exports them + # again to the environment + E="${@ bb.utils.export_proxies(d)}" + install -d -m 755 ${WORKDIR}/hooks_multistrap # Copy config file @@ -46,7 +51,8 @@ do_rootfs() { cd ${TOPDIR} # Create root filesystem - sudo multistrap -a ${DISTRO_ARCH} -d "${S}" -f "${WORKDIR}/multistrap.conf" || true + # We must use sudo -E here to preserve the environment because of proxy settings + sudo -E multistrap -a ${DISTRO_ARCH} -d "${S}" -f "${WORKDIR}/multistrap.conf" || true # Configure root filesystem sudo chroot ${S} /configscript.sh ${MACHINE_SERIAL} ${BAUDRATE_TTY} \ diff --git a/meta/recipes-devtools/buildchroot/buildchroot.bb b/meta/recipes-devtools/buildchroot/buildchroot.bb index ccba683..7627015 100644 --- a/meta/recipes-devtools/buildchroot/buildchroot.bb +++ b/meta/recipes-devtools/buildchroot/buildchroot.bb @@ -26,6 +26,11 @@ WORKDIR = "${TMPDIR}/work/${PF}/${DISTRO}" do_build[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}" do_build() { + # Bitbake clears environment for all task functions, but we need the proxy + # settings in this task so do an inline python call which exports them + # again to the environment + E="${@ bb.utils.export_proxies(d)}" + install -d -m 755 ${WORKDIR}/hooks_multistrap # Copy config files @@ -48,11 +53,11 @@ do_build() { cd ${TOPDIR} # Create root filesystem - sudo multistrap -a ${DISTRO_ARCH} -d "${BUILDCHROOT_DIR}" -f "${WORKDIR}/multistrap.conf" || true + sudo -E multistrap -a ${DISTRO_ARCH} -d "${BUILDCHROOT_DIR}" -f "${WORKDIR}/multistrap.conf" || true # Install package builder script sudo install -m 755 ${THISDIR}/files/build.sh ${BUILDCHROOT_DIR} # Configure root filesystem - sudo chroot ${BUILDCHROOT_DIR} /configscript.sh + sudo -E chroot ${BUILDCHROOT_DIR} /configscript.sh } diff --git a/scripts/isar-buildenv-internal b/scripts/isar-buildenv-internal index f14d1ff..94d7eb1 100755 --- a/scripts/isar-buildenv-internal +++ b/scripts/isar-buildenv-internal @@ -66,5 +66,5 @@ export PATH BBPATH="${BUILDDIR}" export BBPATH -BB_ENV_EXTRAWHITE="BASEDIR BUILDDIR" +BB_ENV_EXTRAWHITE="BASEDIR BUILDDIR http_proxy https_proxy ftp_proxy no_proxy" export BB_ENV_EXTRAWHITE -- 2.14.1