public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Henning Schild <henning.schild@siemens.com>
To: isar-users@googlegroups.com
Cc: Vijai Kumar K <vijaikumar.kanagarajan@gmail.com>,
	Henning Schild <henning.schild@siemens.com>
Subject: [PATCHv4 08/26] meta: split all apt-get invocations into download and execution
Date: Fri, 31 Jan 2020 15:29:42 +0100	[thread overview]
Message-ID: <20200131143000.14873-9-henning.schild@siemens.com> (raw)
In-Reply-To: <20200131143000.14873-1-henning.schild@siemens.com>

From: Henning Schild <henning.schild@siemens.com>

This commit does not contain a functional change. We just split all
calls of "apt-get" into a download and an execution phase, so we can
later copy out the downloaded files.

Signed-off-by: Henning Schild <henning.schild@siemens.com>
---
 meta/classes/dpkg-gbp.bbclass                 |  3 ++
 meta/classes/dpkg.bbclass                     |  5 ++-
 meta/classes/image-tools-extension.bbclass    |  5 +++
 .../buildchroot/files/deps.sh                 | 37 +++++++++++--------
 4 files changed, 34 insertions(+), 16 deletions(-)

diff --git a/meta/classes/dpkg-gbp.bbclass b/meta/classes/dpkg-gbp.bbclass
index 0533a52f..2afe9db4 100644
--- a/meta/classes/dpkg-gbp.bbclass
+++ b/meta/classes/dpkg-gbp.bbclass
@@ -12,6 +12,9 @@ GBP_EXTRA_OPTIONS ?= "--git-pristine-tar"
 
 do_install_builddeps_append() {
     dpkg_do_mounts
+    sudo -E chroot ${BUILDCHROOT_DIR} \
+        apt-get install -y -o Debug::pkgProblemResolver=yes \
+                        --no-install-recommends --download-only ${GBP_DEPENDS}
     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 180a3a89..b26c6456 100644
--- a/meta/classes/dpkg.bbclass
+++ b/meta/classes/dpkg.bbclass
@@ -7,7 +7,10 @@ inherit dpkg-base
 do_install_builddeps() {
     dpkg_do_mounts
     E="${@ isar_export_proxies(d)}"
-    sudo -E chroot ${BUILDCHROOT_DIR} /isar/deps.sh ${PP}/${PPS} ${DISTRO_ARCH}
+    sudo -E chroot ${BUILDCHROOT_DIR} /isar/deps.sh \
+        ${PP}/${PPS} ${DISTRO_ARCH} --download-only
+    sudo -E chroot ${BUILDCHROOT_DIR} /isar/deps.sh \
+        ${PP}/${PPS} ${DISTRO_ARCH}
     dpkg_undo_mounts
 }
 
diff --git a/meta/classes/image-tools-extension.bbclass b/meta/classes/image-tools-extension.bbclass
index d4f216da..b8531cb4 100644
--- a/meta/classes/image-tools-extension.bbclass
+++ b/meta/classes/image-tools-extension.bbclass
@@ -30,6 +30,11 @@ do_install_imager_deps() {
             -o Dir::Etc::SourceList="sources.list.d/isar-apt.list" \
             -o Dir::Etc::SourceParts="-" \
             -o APT::Get::List-Cleanup="0"
+        apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y \
+            --allow-unauthenticated --allow-downgrades --download-only install \
+            ${IMAGER_INSTALL}'
+
+    sudo -E chroot ${BUILDCHROOT_DIR} sh -c ' \
         apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y \
             --allow-unauthenticated --allow-downgrades install \
             ${IMAGER_INSTALL}'
diff --git a/meta/recipes-devtools/buildchroot/files/deps.sh b/meta/recipes-devtools/buildchroot/files/deps.sh
index 002085b1..0f11d78e 100644
--- a/meta/recipes-devtools/buildchroot/files/deps.sh
+++ b/meta/recipes-devtools/buildchroot/files/deps.sh
@@ -12,27 +12,34 @@ source /isar/common.sh
 #   2) we add -y to go non-interactive
 #   3) downgrades shall be allowed in case a package recipe was changed
 install_cmd="apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends \
-    -y --allow-downgrades"
+    -y --allow-downgrades $3"
 
-# Make sure that we have latest isar-apt content.
-# Options meaning:
-#   Dir::Etc::SourceList - specifies which source to be used
-#   Dir::Etc::SourceParts - disables looking for the other sources
-#   APT::Get::List-Cleanup - do not erase obsolete packages list for
-#                            upstream in '/var/lib/apt/lists'
-apt-get update \
-    -o Dir::Etc::SourceList="sources.list.d/isar-apt.list" \
-    -o Dir::Etc::SourceParts="-" \
-    -o APT::Get::List-Cleanup="0"
+if [ "$3" != "-download-only" ]; then
+    # Make sure that we have latest isar-apt content.
+    # Options meaning:
+    #   Dir::Etc::SourceList - specifies which source to be used
+    #   Dir::Etc::SourceParts - disables looking for the other sources
+    #   APT::Get::List-Cleanup - do not erase obsolete packages list for
+    #                            upstream in '/var/lib/apt/lists'
+    apt-get update \
+        -o Dir::Etc::SourceList="sources.list.d/isar-apt.list" \
+        -o Dir::Etc::SourceParts="-" \
+        -o APT::Get::List-Cleanup="0"
+fi
 
 # Do not set an architecture when building only 'all' (generic) packages.
 # This can avoid unneeded cross-build issues.
 if ! grep "^Architecture:" debian/control | grep -qv "all"; then
-	set_arch=""
+    set_arch=""
 fi
 
 # Install all build deps
-mk-build-deps $set_arch -t "${install_cmd}" -i -r debian/control
+if [ "$3" = "--download-only" ]; then
+    mk-build-deps $set_arch -t "${install_cmd}" -i -r debian/control 2>&1 \
+        | grep "mk-build-deps: Unable to install all build-dep packages"
+else
+    mk-build-deps $set_arch -t "${install_cmd}" -i -r debian/control
 
-# Upgrade any already installed packages in case we are partially rebuilding
-apt-get upgrade -y --allow-downgrades
+    # Upgrade any already installed packages in case we are partially rebuilding
+    apt-get upgrade -y --allow-downgrades
+fi
-- 
2.24.1


  parent reply	other threads:[~2020-01-31 14:30 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-31 14:29 [PATCHv4 00/26] base-apt-rework Henning Schild
2020-01-31 14:29 ` [PATCHv4 01/26] repository: new class to deal with repos Henning Schild
2020-01-31 14:29 ` [PATCHv4 02/26] dpkg-base: add download caching of apt:// downloads Henning Schild
2020-01-31 14:29 ` [PATCHv4 03/26] meta: dpkg-base: convert "exit" into "return 0" Henning Schild
2020-01-31 14:29 ` [PATCHv4 04/26] base-apt: change the sources.list to also offer deb-src Henning Schild
2020-01-31 14:29 ` [PATCHv4 05/26] base-apt: add deb-src packages as well Henning Schild
2020-01-31 14:29 ` [PATCHv4 06/26] base-apt: do not skip gpg check when it is signed Henning Schild
2020-01-31 14:29 ` [PATCHv4 07/26] ci: conf: add "hello" to the sample config and every build Henning Schild
2020-01-31 14:29 ` Henning Schild [this message]
2020-01-31 14:29 ` [PATCHv4 09/26] meta: create DL_DIR support for all apt-get downloaded .debs Henning Schild
2020-01-31 14:29 ` [PATCHv4 10/26] meta: import DL_DIR debs before apt-get download steps Henning Schild
2020-01-31 14:29 ` [PATCHv4 11/26] meta: include DL_DIR deb import/export into bootstrap Henning Schild
2020-01-31 14:29 ` [PATCHv4 12/26] base-apt: populate from DEBDIR as well Henning Schild
2020-01-31 14:29 ` [PATCHv4 13/26] base-apt: drop the "apt_cache" feature Henning Schild
2020-01-31 14:29 ` [PATCHv4 14/26] base-apt: do not copy debs directly out of rootfss anymore Henning Schild
2020-01-31 14:29 ` [PATCHv4 15/26] base-apt: rework base-apt population Henning Schild
2020-01-31 14:29 ` [PATCHv4 16/26] base-apt: move class "base-apt-helper" into only user Henning Schild
2020-01-31 14:29 ` [PATCHv4 17/26] CI: include "isar-disable-apt-cache" into all CI images Henning Schild
2020-01-31 14:29 ` [PATCHv4 18/26] CI: include "cowsay" into default build to test dpkg-gbp Henning Schild
2020-01-31 14:29 ` [PATCHv4 19/26] CI: set BB_NO_NETWORK for cached rebuild Henning Schild
2020-01-31 14:29 ` [PATCHv4 20/26] meta: repository: implement repo_contains_package and use it in base_apt Henning Schild
2020-01-31 14:29 ` [PATCHv4 21/26] meta: repository: simplify the matching of packages Henning Schild
2020-01-31 14:29 ` [PATCHv4 22/26] meta: deb-dl-dir: do not cache debs from isar-apt Henning Schild
2020-02-03 17:20   ` Jan Kiszka
2020-02-03 18:27     ` Henning Schild
2020-02-03 18:59       ` Henning Schild
2020-02-04  2:11         ` Su, Bao Cheng
2020-02-04  5:10           ` Su, Bao Cheng
2020-02-04  5:14             ` Jan Kiszka
2020-02-04  5:31               ` Su, Bao Cheng
2020-02-04 16:26               ` Henning Schild
2020-02-04  9:33             ` Henning Schild
2020-02-05 12:11             ` Henning Schild
2020-02-05 14:21               ` Su, Bao Cheng
2020-01-31 14:29 ` [PATCHv4 23/26] base-apt: pull base-apt population to the front of the build chain Henning Schild
2020-01-31 14:29 ` [PATCHv4 24/26] meta: base-apt: remove isar-apt check from population Henning Schild
2020-01-31 14:29 ` [PATCHv4 25/26] meta: deb-dl-dir: only export newly downloaded files Henning Schild
2020-01-31 14:30 ` [PATCHv4 26/26] CI: test a custom kernel build in the base-apt offline rebuild Henning Schild
2020-01-31 14:30 ` [PATCHv4 00/26] base-apt-rework Henning Schild
2020-03-04 23:25 ` Baurzhan Ismagulov
2020-03-04 23:28   ` [PATCH v5 01/26] repository: new class to deal with repos Baurzhan Ismagulov
2020-03-10 13:14     ` Henning Schild
2020-03-10 14:13       ` Baurzhan Ismagulov
2020-03-04 23:28   ` [PATCH v5 08/26] meta: split all apt-get invocations into download and execution Baurzhan Ismagulov
2020-03-10 13:01   ` [PATCHv4 00/26] base-apt-rework 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=20200131143000.14873-9-henning.schild@siemens.com \
    --to=henning.schild@siemens.com \
    --cc=isar-users@googlegroups.com \
    --cc=vijaikumar.kanagarajan@gmail.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