From: Henning Schild <henning.schild@siemens.com>
To: <isar-users@googlegroups.com>
Subject: Re: [PATCHv2 7/9] base: implement BB_NO_NETWORK for apt-get
Date: Thu, 31 Oct 2019 09:42:35 +0100 [thread overview]
Message-ID: <20191031094235.2d71357d@md1za8fc.ad001.siemens.net> (raw)
In-Reply-To: <20191023114227.31308-8-henning.schild@siemens.com>
This causes the function definition to end up in WORKDIR for all
recipes. Still need to see what happens there and how to stop that
spamming.
Henning
On Wed, 23 Oct 2019 13:42:25 +0200
Henning Schild <henning.schild@siemens.com> wrote:
> From: Henning Schild <henning.schild@siemens.com>
>
> BB_NO_NETWORK should stop all fetchers from downloading stuff, but
> apt-get will continue to access the network.
>
> To make it respect the wish for no network, inject a proxy that will
> not work, forcing it to eventually fail so when trying to download
> something.
>
> Signed-off-by: Henning Schild <henning.schild@siemens.com>
> ---
> meta/classes/base.bbclass | 14
> ++++++++++++++ meta/classes/dpkg-base.bbclass |
> 4 ++-- meta/classes/dpkg-gbp.bbclass | 2 +-
> meta/classes/dpkg.bbclass | 4 ++--
> meta/classes/image-tools-extension.bbclass | 2 +-
> meta/classes/rootfs.bbclass | 2 +-
> .../recipes-core/isar-bootstrap/isar-bootstrap.inc | 2 +-
> meta/recipes-kernel/linux/linux-custom.inc | 4 ++--
> 8 files changed, 24 insertions(+), 10 deletions(-)
>
> diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
> index 8c7b021..7ad98c3 100644
> --- a/meta/classes/base.bbclass
> +++ b/meta/classes/base.bbclass
> @@ -124,6 +124,20 @@ python() {
> )
> }
>
> +python isar_export_proxies() {
> + deadend_proxy = 'http://this.should.fail:4242'
> + variables = ['http_proxy', 'HTTP_PROXY', 'https_proxy',
> 'HTTPS_PROXY',
> + 'ftp_proxy', 'FTP_PROXY' ]
> +
> + if d.getVar('BB_NO_NETWORK') == "1":
> + for v in variables:
> + d.setVar(v, deadend_proxy)
> + for v in [ 'no_proxy', 'NO_PROXY' ]:
> + d.setVar(v, '')
> +
> + return bb.utils.export_proxies(d)
> +}
> +
> # filter out all "apt://" URIs out of SRC_URI and stick them into
> SRC_APT python() {
> src_uri = (d.getVar('SRC_URI', True) or "").split()
> diff --git a/meta/classes/dpkg-base.bbclass
> b/meta/classes/dpkg-base.bbclass index adc0e85..fae0a2b 100644
> --- a/meta/classes/dpkg-base.bbclass
> +++ b/meta/classes/dpkg-base.bbclass
> @@ -30,7 +30,7 @@ do_apt_fetch() {
> fi
> rm -rf ${S}
> dpkg_do_mounts
> - E="${@ bb.utils.export_proxies(d)}"
> + E="${@ bb.build.exec_func('isar_export_proxies', d)}"
> sudo -E chroot ${BUILDCHROOT_DIR} /usr/bin/apt-get update \
> -o Dir::Etc::SourceList="sources.list.d/isar-apt.list" \
> -o Dir::Etc::SourceParts="-" \
> @@ -154,7 +154,7 @@ python do_devshell() {
>
> bb.build.exec_func('dpkg_do_mounts', d)
>
> - bb.utils.export_proxies(d)
> + bb.build.exec_func('isar_export_proxies', d)
>
> buildchroot = d.getVar('BUILDCHROOT_DIR')
> pp_pps = os.path.join(d.getVar('PP'), d.getVar('PPS'))
> diff --git a/meta/classes/dpkg-gbp.bbclass
> b/meta/classes/dpkg-gbp.bbclass index 8a8e0f4..3977e63 100644
> --- a/meta/classes/dpkg-gbp.bbclass
> +++ b/meta/classes/dpkg-gbp.bbclass
> @@ -12,7 +12,7 @@ GBP_EXTRA_OPTIONS ?= "--git-pristine-tar"
>
> do_install_builddeps_append() {
> dpkg_do_mounts
> - E="${@ bb.utils.export_proxies(d)}"
> + E="${@ bb.build.exec_func('isar_export_proxies', d)}"
> sudo -E chroot ${BUILDCHROOT_DIR} \
> apt-get install -y -o Debug::pkgProblemResolver=yes \
> --no-install-recommends ${GBP_DEPENDS}
> diff --git a/meta/classes/dpkg.bbclass b/meta/classes/dpkg.bbclass
> index 19d77a2..8b6ef21 100644
> --- a/meta/classes/dpkg.bbclass
> +++ b/meta/classes/dpkg.bbclass
> @@ -6,7 +6,7 @@ inherit dpkg-base
> # Install build dependencies for package
> do_install_builddeps() {
> dpkg_do_mounts
> - E="${@ bb.utils.export_proxies(d)}"
> + E="${@ bb.build.exec_func('isar_export_proxies', d)}"
> sudo -E chroot ${BUILDCHROOT_DIR} /isar/deps.sh ${PP}/${PPS}
> ${DISTRO_ARCH} dpkg_undo_mounts
> }
> @@ -19,7 +19,7 @@ addtask devshell after do_install_builddeps
>
> # Build package from sources using build script
> dpkg_runbuild() {
> - E="${@ bb.utils.export_proxies(d)}"
> + E="${@ bb.build.exec_func('isar_export_proxies', d)}"
> sudo -E chroot --userspec=$( id -u ):$( id -g )
> ${BUILDCHROOT_DIR} \ /isar/build.sh ${PP}/${PPS} ${DISTRO_ARCH}
> }
> diff --git a/meta/classes/image-tools-extension.bbclass
> b/meta/classes/image-tools-extension.bbclass index 2d8a777..7ea7557
> 100644 --- a/meta/classes/image-tools-extension.bbclass
> +++ b/meta/classes/image-tools-extension.bbclass
> @@ -24,7 +24,7 @@ do_install_imager_deps() {
>
> buildchroot_do_mounts
>
> - E="${@bb.utils.export_proxies(d)}"
> + E="${@ bb.build.exec_func('isar_export_proxies', d)}"
> sudo -E chroot ${BUILDCHROOT_DIR} sh -c ' \
> apt-get update \
> -o Dir::Etc::SourceList="sources.list.d/isar-apt.list" \
> diff --git a/meta/classes/rootfs.bbclass b/meta/classes/rootfs.bbclass
> index f49f3cc..995dcb6 100644
> --- a/meta/classes/rootfs.bbclass
> +++ b/meta/classes/rootfs.bbclass
> @@ -18,7 +18,7 @@ ROOTFS_APT_ARGS="install --yes -o
> Debug::pkgProblemResolver=yes" ROOTFS_CLEAN_FILES="/etc/hostname
> /etc/resolv.conf"
> # Useful environment variables:
> -export E = "${@ bb.utils.export_proxies(d)}"
> +export E = "${@ bb.build.exec_func('isar_export_proxies', d)}"
> export DEBIAN_FRONTEND = "noninteractive"
> # To avoid Perl locale warnings:
> export LANG = "C"
> diff --git a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
> b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc index
> 1a58471..bd35f72 100644 ---
> a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc +++
> b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc @@ -240,7
> +240,7 @@ isar_bootstrap() { debootstrap_args="$debootstrap_args
> --no-check-gpg" fi
> fi
> - E="${@bb.utils.export_proxies(d)}"
> + E="${@ bb.build.exec_func('isar_export_proxies', d)}"
> export IS_HOST debootstrap_args E
> sudo -E -s <<'EOSUDO'
> set -e
> diff --git a/meta/recipes-kernel/linux/linux-custom.inc
> b/meta/recipes-kernel/linux/linux-custom.inc index 5a4f5bf..d923458
> 100644 --- a/meta/recipes-kernel/linux/linux-custom.inc
> +++ b/meta/recipes-kernel/linux/linux-custom.inc
> @@ -40,7 +40,7 @@ KERNEL_LIBC_DEV_DEPLOY ?= "0"
>
> do_install_builddeps() {
> dpkg_do_mounts
> - E="${@ bb.utils.export_proxies(d)}"
> + E="${@ bb.build.exec_func('isar_export_proxies', d)}"
> sudo -E chroot ${BUILDCHROOT_DIR} \
> apt-get update \
> -o
> Dir::Etc::SourceList="sources.list.d/isar-apt.list" \ @@ -65,7 +65,7
> @@ dpkg_runbuild() { cp ${WORKDIR}/${KERNEL_DEFCONFIG} ${S}/.config
> fi
>
> - E="${@ bb.utils.export_proxies(d)}"
> + E="${@ bb.build.exec_func('isar_export_proxies', d)}"
>
> export PV=${PV}
> export KERNEL_NAME=${KERNEL_NAME_PROVIDED}
next prev parent reply other threads:[~2019-10-31 8:42 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-23 11:42 [PATCHv2 0/9] a few cleanups a bug and a feature Henning Schild
2019-10-23 11:42 ` [PATCHv2 1/9] rootfs: fix incorrect feature name in comment Henning Schild
2019-10-23 11:42 ` [PATCHv2 2/9] base-apt: use the "basename" command instead of pattern substitution Henning Schild
2019-10-23 20:36 ` Baurzhan Ismagulov
2019-10-24 9:16 ` Henning Schild
2019-10-24 12:01 ` Baurzhan Ismagulov
2019-10-24 9:34 ` chombourger
2019-10-24 12:01 ` Baurzhan Ismagulov
2019-10-23 11:42 ` [PATCHv2 3/9] base_apt_helper: change variable names to increase readability Henning Schild
2019-10-23 11:42 ` [PATCHv2 4/9] rootfs: rename ROOTFS_INSTALL_COMMAND lock to "isar-apt-lock" Henning Schild
2019-10-23 11:42 ` [PATCHv2 5/9] dpkg-base: remove pointless ";" s at end of line Henning Schild
2019-10-23 11:42 ` [PATCHv2 6/9] dpkg-base: fix indentation from tabs to spaces Henning Schild
2019-10-23 11:42 ` [PATCHv2 7/9] base: implement BB_NO_NETWORK for apt-get Henning Schild
2019-10-31 8:42 ` Henning Schild [this message]
2019-10-23 11:42 ` [PATCHv2 8/9] meta: do not equip rootfss with resolv.conf when BB_NO_NETWORK Henning Schild
2019-10-23 11:42 ` [PATCHv2 9/9] bootstrap: fix debootstrap gpg issue when base-apt is not signed Henning Schild
2019-10-23 11:43 ` [PATCHv2 0/9] a few cleanups a bug and a feature Henning Schild
2019-11-07 12:16 ` Jan Kiszka
2019-11-07 14:36 ` Henning Schild
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=20191031094235.2d71357d@md1za8fc.ad001.siemens.net \
--to=henning.schild@siemens.com \
--cc=isar-users@googlegroups.com \
/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