From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6463052406736289792 X-Received: by 10.28.156.86 with SMTP id f83mr826198wme.5.1505127402857; Mon, 11 Sep 2017 03:56:42 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 10.46.21.66 with SMTP id 2ls238957ljv.54.gmail; Mon, 11 Sep 2017 03:56:42 -0700 (PDT) X-Google-Smtp-Source: AOwi7QDh8flne9tT7VdB0Tldv8whpt8yF8L64dRZrnkapg2LOgQxFpDHOItp9nmPh1MXaBRPmuPc X-Received: by 10.25.228.134 with SMTP id x6mr686415lfi.33.1505127402481; Mon, 11 Sep 2017 03:56:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505127402; cv=none; d=google.com; s=arc-20160816; b=zWgQox5FySHheqUW4NlIrLaxUpL9+qjI1pU2T2PekbmywjPk1inkakSJ+mveDUGszy CTHZZx1DQbHvyRsiMvXeMZGBMeZ3r/8iimlNnlMqKA5gxMTZ3DaqUHNXDAOY5QpxEXdM m8qYWSromzz9xclcNUvhueUJjpJUBajZIgJR5cy1vX68L8l/1SgM1PXjTSFLZAz/ZuCr XadMk3nRiaCPIoF45q3NrE/8AyPEMEmROobLP9k42e3rrLcOkOfjAskztbjs14opySlo Pn9Ym9wOFrQDiw7VO/nah8KXo1LfWThmqwo6mhb12kKqjsPs56Yo+bPy6hAY8K6kfxg3 NvCQ== 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=uF+BqLr0lu8tfqeMkvPYP/2hTzWCrVgEsHNb0AUv/vI=; b=xB5Z/ryvQtUO6XSF4+iNYgy2FasVSPM/K11eK2BisOvANCokGnQbEbs2EMsWHteuID f5pL0t6rWJWd36rbiBUqnFCQxmJ6+1IsWS9qEor8LnbfsHdIa2GHwuOk9bCxrXEMiued P2v6VarsAJ+kRFPZT5IESic21W1wMZbCogtRfwNvLHcD0Gt+FQJG+/r6/UkR0uPXJeah WdL1Lp/JX/enfnpVJVsWJAVMr3RV4Xsigk/YKFEfoarnsQfDb2X3KvlL55cy/7mka8Gq sq7NI9I7tAuy+mNfJig1bAsCPfExL4MzYDdc1l1b2sybmSVUNAwGdSsFXQSStzAYw66R j5SQ== 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 o7si362768wme.1.2017.09.11.03.56.42 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Sep 2017 03:56:42 -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 mail1.siemens.de (mail1.siemens.de [139.23.33.14]) by david.siemens.de (8.15.2/8.15.2) with ESMTPS id v8BAugk1006598 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 11 Sep 2017 12:56:42 +0200 Received: from localhost.localdomain (golem.ppmd.siemens.net [139.25.69.162]) by mail1.siemens.de (8.15.2/8.15.2) with ESMTP id v8BAudgn012310; Mon, 11 Sep 2017 12:56:42 +0200 From: "Andreas J. Reichel" To: isar-users@googlegroups.com Cc: Andreas Reichel Subject: [PATCH v2 1/1] Add proxy support to isar-image-*.bb and buildchroot.bb Date: Mon, 11 Sep 2017 12:55:58 +0200 Message-Id: <20170911105558.7308-2-andreas.reichel.ext@siemens.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20170911105558.7308-1-andreas.reichel.ext@siemens.com> References: <20170911105558.7308-1-andreas.reichel.ext@siemens.com> X-TUID: AZiPNEvxYcmV 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