From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6470427481174179840 X-Received: by 10.223.164.206 with SMTP id h14mr143487wrb.2.1506513795352; Wed, 27 Sep 2017 05:03:15 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 10.223.130.78 with SMTP id 72ls42235wrb.7.gmail; Wed, 27 Sep 2017 05:03:14 -0700 (PDT) X-Google-Smtp-Source: AOwi7QDu/Ax/pdV9yp+VOmISKabWCwYCGLrrCi04CKE648PM61lT2cnN2tQsBBjIGLNi9cKZH3am X-Received: by 10.223.133.244 with SMTP id 49mr141610wru.22.1506513794960; Wed, 27 Sep 2017 05:03:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506513794; cv=none; d=google.com; s=arc-20160816; b=Pk2e6cAUpzux6atirYkt60S16ef2Bg+h5E03eseDY1gqKDlS4PscvHYl9kn9rOJYix cShJRUm5R0TGiBVDsArEVREU1Z0CG12k6A/V9pxPhp7SU9IjReNyEr0yAQPQq5sBHkNO DRLOSfWbVDhjJeHFNpzRCoWmmPLja1mgYrf9dVWCET08F09yvtpOz+cZLlKk9VkX1hTF RhieCSgyGaplHOXNwcPPp6Z5R/7dGlNnvTSM6uJt1gSlamDpF4EcRPKSw37Uq3c5JMZr c54610AfNJhxyHCFrbPdzXzbzbfKwG8Nf4Uk/d5GkA3ZQqKDoptD+1aXg9oyHcycuQ+q sg6Q== 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:to:from :arc-authentication-results; bh=uF+BqLr0lu8tfqeMkvPYP/2hTzWCrVgEsHNb0AUv/vI=; b=Qp10RJsrll2QyjwQrGFQBRmqmtDsEJpFJrC3glT4avfJ3Fji52jSo2mMe4PVnhZ/cG wVRB1okpvKoBuFBvlr2z9TLAfU7UF5sZMwd/ggMbfP78Np4nKQNy9wGhDgjtJqbgE/pf VRU2EpfdQL7maggP3xUBox0x2Yi49Fyd+2FHxrSWV/eQch5NEn1KXf7M12R2AmDOg0iC J9O2spAp05W4yo4D2oJ6rsIRbNOB5rcmQ25NJzemczkZnNlBG8MshdJvq7A+NyYF6/Jj gsmeLsZZUTNnmxI0NML+JZpYFOxb8KKAwfltRStHEdaVo7eHaG5GVFBCwuRGjOoPtUyW gWNA== 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 h17si306561wmd.0.2017.09.27.05.03.14 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 27 Sep 2017 05:03:14 -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 v8RC3ERp016385 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 27 Sep 2017 14:03:14 +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 v8RC3Etl030127; Wed, 27 Sep 2017 14:03:14 +0200 From: "Andreas J. Reichel" To: christian.storm@siemens.com, isar-users@googlegroups.com Subject: [PATCH v2 1/1] Add proxy support to isar-image-*.bb and buildchroot.bb Date: Wed, 27 Sep 2017 14:02:18 +0200 Message-Id: <20170927120234.1541-2-andreas.reichel.ext@siemens.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20170927120234.1541-1-andreas.reichel.ext@siemens.com> References: <20170927120234.1541-1-andreas.reichel.ext@siemens.com> X-TUID: MyLo8yAtrNAw 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 | 5 ++++- meta/recipes-devtools/buildchroot/buildchroot.bb | 4 +++- scripts/isar-buildenv-internal | 2 +- 3 files changed, 8 insertions(+), 3 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..96b5510 100644 --- a/meta-isar/recipes-core/images/isar-image-base.bb +++ b/meta-isar/recipes-core/images/isar-image-base.bb @@ -24,6 +24,8 @@ IMAGE_ROOTFS = "${S}" do_rootfs[stamp-extra-info] = "${MACHINE}-${DISTRO}" do_rootfs() { + E="${@ bb.utils.export_proxies(d)}" + install -d -m 755 ${WORKDIR}/hooks_multistrap # Copy config file @@ -46,7 +48,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..e251a8f 100644 --- a/meta/recipes-devtools/buildchroot/buildchroot.bb +++ b/meta/recipes-devtools/buildchroot/buildchroot.bb @@ -26,6 +26,8 @@ WORKDIR = "${TMPDIR}/work/${PF}/${DISTRO}" do_build[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}" do_build() { + E="${@ bb.utils.export_proxies(d)}" + install -d -m 755 ${WORKDIR}/hooks_multistrap # Copy config files @@ -48,7 +50,7 @@ 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} 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