public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: "Moessbauer, Felix" <felix.moessbauer@siemens.com>
To: Uladzimir Bely <ubely@ilbers.de>
Cc: "isar-users@googlegroups.com" <isar-users@googlegroups.com>,
	"jan.kiszka@siemens.com" <jan.kiszka@siemens.com>
Subject: RE: [PATCH v6 07/12] sbuild: support of shell exports from dpkg_runbuild_prepend
Date: Wed, 9 Mar 2022 17:57:32 +0000	[thread overview]
Message-ID: <AS8PR10MB486584CED7D6651372E3B091890A9@AS8PR10MB4865.EURPRD10.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <AM9PR10MB48698F892FBA3A33D2C0405289049@AM9PR10MB4869.EURPRD10.PROD.OUTLOOK.COM>

[-- Attachment #1: Type: text/plain, Size: 3128 bytes --]

Hi,

The attached patch adds support to run the sbuild behind a proxy.
I briefly tested this with "bitbake mc:qemuamd64-bullseye:isar-image-base" in an environment where proxies are mandatory.

Best regards,
Felix

> -----Original Message-----
> From: isar-users@googlegroups.com <isar-users@googlegroups.com> On
> Behalf Of Moessbauer, Felix
> Sent: Thursday, March 3, 2022 2:37 PM
> To: Uladzimir Bely <ubely@ilbers.de>
> Cc: isar-users@googlegroups.com
> Subject: RE: [PATCH v6 07/12] sbuild: support of shell exports from
> dpkg_runbuild_prepend
> 
> Hi,
> 
> > +
> > +        # Don't warn some variables
> > +        [ "${var}" = "PARALLEL_MAKE" ] && continue
> > +        [ "${var}" = "CCACHE_DIR" ] && continue
> > +        [ "${var}" = "PATH_PREPEND" ] && continue
> > +        [ "${var}" = "DEB_BUILD_OPTIONS" ] && continue
> > +        [ "${var}" = "DEB_BUILD_PROFILES" ] && continue
> > +
> > +        bbwarn "Export of '${line}' detected, please migrate to templates"
> 
> There are more variables that have to be excluded, e.g. all proxy related
> settings:
> (http_proxy, HTTP_PROXY, https_proxy, HTTPS_PROXY, no_proxy, NO_PROXY).
> 
> But the proxy settings have to be passed into the sbuild environment.
> Currently, building behind a proxy fails (in do_dpkg_build):
> 
> +------------------------------------------------------------------------------+
> | Update chroot                                                                |
> +------------------------------------------------------------------------------+
> [...]
> Err:8
> https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fdeb.debia
> n.org%2Fdebian&amp;data=04%7C01%7Cfelix.moessbauer%40siemens.com%7
> C2c6b2941e0eb40ffccb408d9fd1ad566%7C38ae3bcd95794fd4addab42e1495d5
> 5a%7C1%7C0%7C637819114851078826%7CUnknown%7CTWFpbGZsb3d8eyJWI
> joiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C300
> 0&amp;sdata=aLGsi%2BBgf28Cm5g7GGhBY5h3eRu7cL5do5Ern45lsVA%3D&am
> p;reserved=0 bullseye Release
>   Cannot initiate the connection to deb.debian.org:80 (2a04:4e42:62::644). -
> connect (101: Network is unreachable)
> 
> Best regards,
> Felix
> 
> --
> Siemens AG, Technology, T CED SES-DE
> Otto-Hahn-Ring 6, 81739 München, Germany
> 
> 
> --
> You received this message because you are subscribed to the Google Groups
> "isar-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email
> to isar-users+unsubscribe@googlegroups.com.
> To view this discussion on the web visit
> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.g
> oogle.com%2Fd%2Fmsgid%2Fisar-
> users%2FAM9PR10MB48698F892FBA3A33D2C0405289049%2540AM9PR10MB4
> 869.EURPRD10.PROD.OUTLOOK.COM&amp;data=04%7C01%7Cfelix.moessbau
> er%40siemens.com%7C2c6b2941e0eb40ffccb408d9fd1ad566%7C38ae3bcd957
> 94fd4addab42e1495d55a%7C1%7C0%7C637819114851078826%7CUnknown%7
> CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJ
> XVCI6Mn0%3D%7C3000&amp;sdata=PGDjMxGm4JkrqZoktZXAJakrj3Xmxt1w8Gq
> vVVYmL5w%3D&amp;reserved=0.

[-- Attachment #2: 0001-export-proxies-for-apt-in-sbuild-schroot.patch --]
[-- Type: application/octet-stream, Size: 2390 bytes --]

From 669d14a8b6285f45782b3969a5cea1737d331e2e Mon Sep 17 00:00:00 2001
From: Felix Moessbauer <felix.moessbauer@siemens.com>
Date: Wed, 9 Mar 2022 18:38:24 +0100
Subject: [PATCH 1/1] export proxies for apt in sbuild / schroot

The proxy variables have to be manually set for the apt
inside the schroot.
Otherwise, the apt-update that is run as part of sbuild
fails to fetch dependencies.

Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
---
 meta/classes/dpkg.bbclass   |  3 +++
 meta/classes/sbuild.bbclass | 18 ++++++++++++++++++
 2 files changed, 21 insertions(+)

diff --git a/meta/classes/dpkg.bbclass b/meta/classes/dpkg.bbclass
index 314ac86e..cb5d4139 100644
--- a/meta/classes/dpkg.bbclass
+++ b/meta/classes/dpkg.bbclass
@@ -34,6 +34,9 @@ dpkg_runbuild() {
         [ "${var}" = "CCACHE_DIR" ] && continue
         [ "${var}" = "PATH_PREPEND" ] && continue
         [ "${var}" = "DEB_BUILD_OPTIONS" ] && continue
+        [ "${var}" = "http_proxy" ] && continue
+        [ "${var}" = "https_proxy" ] && continue
+        [ "${var}" = "no_proxy" ] && continue
 
         bbwarn "Export of '${line}' detected, please migrate to templates"
     done
diff --git a/meta/classes/sbuild.bbclass b/meta/classes/sbuild.bbclass
index eb358c71..7d2b8ac7 100644
--- a/meta/classes/sbuild.bbclass
+++ b/meta/classes/sbuild.bbclass
@@ -33,6 +33,20 @@ SCHROOT_CONF_FILE_RW ?= "${SCHROOT_CONF}/chroot.d/${SBUILD_CHROOT}-rw"
 
 SBUILD_CONFIG="${WORKDIR}/sbuild.conf"
 
+def get_apt_proxy_config(d):
+    isar_export_proxies(d)
+    out = ''
+    if 'http_proxy' in os.environ:
+        out += 'Acquire::http::Proxy "{}";\n'.format(os.environ['http_proxy'])
+    if 'https_proxy' in os.environ:
+        out += 'Acquire::https::Proxy "{}";\n'.format(os.environ['https_proxy'])
+    if 'no_proxy' in os.environ:
+        no_proxies = os.environ['no_proxy'].split(',')
+        for np in no_proxies:
+            out += 'Acquire::http::Proxy::{} DIRECT;\n'.format(np.strip())
+            out += 'Acquire::https::Proxy::{} DIRECT;\n'.format(np.strip())
+    return out
+
 schroot_create_configs() {
     sudo -s <<'EOSUDO'
         set -e
@@ -69,6 +83,10 @@ EOF
 Package: *
 Pin: release n=${DEBDISTRONAME}
 Pin-Priority: 1000
+EOF
+
+        cat << EOF > "${SCHROOT_DIR}/etc/apt/apt.conf.d/proxy.conf"
+${@ get_apt_proxy_config(d) }
 EOF
 
         # Prepare mount points
-- 
2.30.2


  reply	other threads:[~2022-03-09 17:57 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-10  6:46 [PATCH v6 00/12] Sbuild/Schroot migration Uladzimir Bely
2022-02-10  6:46 ` [PATCH v6 01/12] dpkg-gbp: Use separate command to export tarball Uladzimir Bely
2022-02-10  6:46 ` [PATCH v6 02/12] dpkg-gbp: Use host tools for dsc preparation Uladzimir Bely
2022-02-10  6:46 ` [PATCH v6 03/12] sbuild: Add recipes for host and target rootfs to run sbuild Uladzimir Bely
2022-02-10  6:46 ` [PATCH v6 04/12] sbuild: Introduce a class for another build method Uladzimir Bely
2022-02-10  6:46 ` [PATCH v6 05/12] dpkg: Build packages with sbuild Uladzimir Bely
2022-02-10  6:46 ` [PATCH v6 06/12] sbuild: support of DEB_BUILD_PROFILES Uladzimir Bely
2022-02-10  6:46 ` [PATCH v6 07/12] sbuild: support of shell exports from dpkg_runbuild_prepend Uladzimir Bely
2022-03-03 13:36   ` Moessbauer, Felix
2022-03-09 17:57     ` Moessbauer, Felix [this message]
2022-03-14 12:28       ` Uladzimir Bely
2022-03-14 14:52         ` Moessbauer, Felix
2022-02-10  6:46 ` [PATCH v6 08/12] dpkg: Remove builddeps install task Uladzimir Bely
2022-02-10  6:46 ` [PATCH v6 09/12] sbuild: add ccache support Uladzimir Bely
2022-02-10  6:46 ` [PATCH v6 10/12] dpkg-base: Switch devshell to use schroot Uladzimir Bely
2022-02-10  6:46 ` [PATCH v6 11/12] dpkg-base: Switch apt_fetch and apt_unpack " Uladzimir Bely
2022-02-10  6:46 ` [PATCH v6 12/12] doc: Add sbuild-related documentation Uladzimir Bely

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AS8PR10MB486584CED7D6651372E3B091890A9@AS8PR10MB4865.EURPRD10.PROD.OUTLOOK.COM \
    --to=felix.moessbauer@siemens.com \
    --cc=isar-users@googlegroups.com \
    --cc=jan.kiszka@siemens.com \
    --cc=ubely@ilbers.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox