From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6750962531146137600 X-Received: by 2002:a19:ad4c:: with SMTP id s12mr2640770lfd.49.1572511366615; Thu, 31 Oct 2019 01:42:46 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a2e:3013:: with SMTP id w19ls282034ljw.6.gmail; Thu, 31 Oct 2019 01:42:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqwJjHxJs/ell3YcsmNovgwopzM+rvCEZjYe/xLbadmvJE3WDcA7lNfneFgDVoZwooEzGnVM X-Received: by 2002:a2e:750c:: with SMTP id q12mr3214289ljc.138.1572511365901; Thu, 31 Oct 2019 01:42:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572511365; cv=none; d=google.com; s=arc-20160816; b=Rwnx4nPKJ6tjU+5Hpkn+xcBY6z79G0IfXs9Y3h4T463HHOxfb8ZKFEid+co0jWbs1P pXGTzen3fP36wB0UEG1CAgYW4VWnUvrQZzGHlODEdIR3+tznlGjp7GhuXe1pUljlX//P pZxH5WA4KmHVdVJgWH2Lrnl2FIn98h/JCXCgMEuOobsKv1YEPVPlgIq6aTCM0y2vk2xS oDVZ2KQgn5xlr7O5Jp8nHbVDw/ljZdME6s4Ucf+DK7QsuvIrgFRL9a5Jgv1yOWnHsju7 ajLgt8YPvBToqNYqtrNj4SI08xCMtYrB/aW+qyDAoQ+M5nV/iRSHbgZEGMCtuHjjzJ1i kDkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:to:from:date; bh=aW8IkIkJpCgVD0SYpVOSGnoOwtWJZwF6HPrhFOkrAGs=; b=rLxGw/oRQFk3uTI4yUxZBT3hNnxW2QrdhV2FEwpPBd1lfSwdTc26/bO+Q3vVhhaH8W tG7lXZaUyfN1fffv3Z5sZ6mtcjqwvwodRiLGNtSdr85lwwNschiteOj2nwsPgHPKvei5 cLDX+yBihmKgRyPhm/0p++gTBaNrW8q1/w7V2eUEnnm2zARpnMoh1+RrCZqBNo/Pst5r 8UqY7D/m+EXaHylslpnilvPETcC4qa9+JmdWKDuQJwYF+gPUCGvSWFEUzEEAKFKwj6i1 ma/NpIV8EO9EL7lB7D2svkQldOBj/KW75eaBHjOLnFykSauijRfevVr21BdzgjGAOTOz Fl6w== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of henning.schild@siemens.com designates 192.35.17.2 as permitted sender) smtp.mailfrom=henning.schild@siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com Return-Path: Received: from thoth.sbs.de (thoth.sbs.de. [192.35.17.2]) by gmr-mx.google.com with ESMTPS id r71si218461lff.5.2019.10.31.01.42.45 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 31 Oct 2019 01:42:45 -0700 (PDT) Received-SPF: pass (google.com: domain of henning.schild@siemens.com designates 192.35.17.2 as permitted sender) client-ip=192.35.17.2; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of henning.schild@siemens.com designates 192.35.17.2 as permitted sender) smtp.mailfrom=henning.schild@siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com Received: from mail2.sbs.de (mail2.sbs.de [192.129.41.66]) by thoth.sbs.de (8.15.2/8.15.2) with ESMTPS id x9V8gjXv022777 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 31 Oct 2019 09:42:45 +0100 Received: from md1za8fc.ad001.siemens.net ([167.87.129.189]) by mail2.sbs.de (8.15.2/8.15.2) with ESMTP id x9V8ghsj027863 for ; Thu, 31 Oct 2019 09:42:44 +0100 Date: Thu, 31 Oct 2019 09:42:35 +0100 From: Henning Schild To: Subject: Re: [PATCHv2 7/9] base: implement BB_NO_NETWORK for apt-get Message-ID: <20191031094235.2d71357d@md1za8fc.ad001.siemens.net> In-Reply-To: <20191023114227.31308-8-henning.schild@siemens.com> References: <20191023114227.31308-1-henning.schild@siemens.com> <20191023114227.31308-8-henning.schild@siemens.com> X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-TUID: y5ozKm8LgJUK 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 wrote: > From: Henning Schild > > 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 > --- > 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}