From: Henning Schild <henning.schild@siemens.com>
To: isar-users@googlegroups.com
Cc: Vijai Kumar K <vijaikumar.kanagarajan@gmail.com>,
Baurzhan Ismagulov <ibr@radix50.net>,
Jan Kiszka <jan.kiszka@siemens.com>,
Henning Schild <henning.schild@siemens.com>
Subject: [PATCHv5 09/29] meta: create DL_DIR support for all apt-get downloaded .debs
Date: Tue, 10 Mar 2020 22:56:11 +0100 [thread overview]
Message-ID: <20200310215631.24859-10-henning.schild@siemens.com> (raw)
In-Reply-To: <20200310215631.24859-1-henning.schild@siemens.com>
From: Henning Schild <henning.schild@siemens.com>
Hook in between the "apt-get --download-only"s and the "apt-get"s and
copy out all the debs for later.
Signed-off-by: Henning Schild <henning.schild@siemens.com>
---
meta/classes/deb-dl-dir.bbclass | 15 +++++++++++++++
meta/classes/dpkg-base.bbclass | 1 +
meta/classes/dpkg-gbp.bbclass | 1 +
meta/classes/dpkg.bbclass | 1 +
meta/classes/image-locales-extension.bbclass | 2 +-
meta/classes/image-tools-extension.bbclass | 1 +
meta/classes/rootfs.bbclass | 14 +++++++++++---
meta/conf/bitbake.conf | 1 +
8 files changed, 32 insertions(+), 4 deletions(-)
create mode 100644 meta/classes/deb-dl-dir.bbclass
diff --git a/meta/classes/deb-dl-dir.bbclass b/meta/classes/deb-dl-dir.bbclass
new file mode 100644
index 00000000..066ce1a3
--- /dev/null
+++ b/meta/classes/deb-dl-dir.bbclass
@@ -0,0 +1,15 @@
+# This software is a part of ISAR.
+# Copyright (C) 2020 Siemens AG
+#
+# SPDX-License-Identifier: MIT
+
+deb_dl_dir_export() {
+ export pc="${DEBDIR}/${DISTRO}"
+ export rootfs="${1}"
+ mkdir -p "${pc}"
+ flock "${pc}".lock -c ' \
+ sudo find "${rootfs}"/var/cache/apt/archives/ -type f -iname '*\.deb' \
+ -exec cp -f '{}' "${pc}" \;
+ sudo chown -R $(id -u):$(id -g) "${pc}"
+ '
+}
diff --git a/meta/classes/dpkg-base.bbclass b/meta/classes/dpkg-base.bbclass
index 5dd334d0..9aa2d546 100644
--- a/meta/classes/dpkg-base.bbclass
+++ b/meta/classes/dpkg-base.bbclass
@@ -8,6 +8,7 @@ inherit buildchroot
inherit debianize
inherit terminal
inherit repository
+inherit deb-dl-dir
DEPENDS ?= ""
diff --git a/meta/classes/dpkg-gbp.bbclass b/meta/classes/dpkg-gbp.bbclass
index 2afe9db4..7e908eba 100644
--- a/meta/classes/dpkg-gbp.bbclass
+++ b/meta/classes/dpkg-gbp.bbclass
@@ -15,6 +15,7 @@ do_install_builddeps_append() {
sudo -E chroot ${BUILDCHROOT_DIR} \
apt-get install -y -o Debug::pkgProblemResolver=yes \
--no-install-recommends --download-only ${GBP_DEPENDS}
+ deb_dl_dir_export "${BUILDCHROOT_DIR}"
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 b26c6456..7e2c86d6 100644
--- a/meta/classes/dpkg.bbclass
+++ b/meta/classes/dpkg.bbclass
@@ -9,6 +9,7 @@ do_install_builddeps() {
E="${@ isar_export_proxies(d)}"
sudo -E chroot ${BUILDCHROOT_DIR} /isar/deps.sh \
${PP}/${PPS} ${DISTRO_ARCH} --download-only
+ deb_dl_dir_export "${BUILDCHROOT_DIR}"
sudo -E chroot ${BUILDCHROOT_DIR} /isar/deps.sh \
${PP}/${PPS} ${DISTRO_ARCH}
dpkg_undo_mounts
diff --git a/meta/classes/image-locales-extension.bbclass b/meta/classes/image-locales-extension.bbclass
index 3c0758ff..0f0d0ca4 100644
--- a/meta/classes/image-locales-extension.bbclass
+++ b/meta/classes/image-locales-extension.bbclass
@@ -25,7 +25,7 @@ def get_nopurge(d):
j.split()[0].split(".")[0],
j.split()[0]))))
-ROOTFS_INSTALL_COMMAND_BEFORE_CLEAN += "image_install_localepurge_download"
+ROOTFS_INSTALL_COMMAND_BEFORE_EXPORT += "image_install_localepurge_download"
image_install_localepurge_download[weight] = "40"
image_install_localepurge_download() {
sudo -E chroot '${ROOTFSDIR}' \
diff --git a/meta/classes/image-tools-extension.bbclass b/meta/classes/image-tools-extension.bbclass
index b8531cb4..ec67d940 100644
--- a/meta/classes/image-tools-extension.bbclass
+++ b/meta/classes/image-tools-extension.bbclass
@@ -34,6 +34,7 @@ do_install_imager_deps() {
--allow-unauthenticated --allow-downgrades --download-only install \
${IMAGER_INSTALL}'
+ deb_dl_dir_export ${BUILDCHROOT_DIR}
sudo -E chroot ${BUILDCHROOT_DIR} sh -c ' \
apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y \
--allow-unauthenticated --allow-downgrades install \
diff --git a/meta/classes/rootfs.bbclass b/meta/classes/rootfs.bbclass
index 64eaef70..706b43a7 100644
--- a/meta/classes/rootfs.bbclass
+++ b/meta/classes/rootfs.bbclass
@@ -1,5 +1,7 @@
# This software is a part of ISAR.
-# Copyright (c) Siemens AG, 2019
+# Copyright (c) Siemens AG, 2020
+
+inherit deb-dl-dir
ROOTFS_ARCH ?= "${DISTRO_ARCH}"
ROOTFS_DISTRO ?= "${DISTRO}"
@@ -119,8 +121,14 @@ rootfs_install_pkgs_download() {
/usr/bin/apt-get ${ROOTFS_APT_ARGS} --download-only ${ROOTFS_PACKAGES}
}
-ROOTFS_INSTALL_COMMAND_BEFORE_CLEAN ??= ""
-ROOTFS_INSTALL_COMMAND += "${ROOTFS_INSTALL_COMMAND_BEFORE_CLEAN}"
+ROOTFS_INSTALL_COMMAND_BEFORE_EXPORT ??= ""
+ROOTFS_INSTALL_COMMAND += "${ROOTFS_INSTALL_COMMAND_BEFORE_EXPORT}"
+
+ROOTFS_INSTALL_COMMAND += "rootfs_export_package_cache"
+rootfs_export_package_cache[weight] = "5"
+rootfs_export_package_cache() {
+ deb_dl_dir_export ${ROOTFSDIR}
+}
ROOTFS_INSTALL_COMMAND += "${@ 'rootfs_install_clean_files' if (d.getVar('ROOTFS_CLEAN_FILES') or '').strip() else ''}"
rootfs_install_clean_files[weight] = "2"
diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
index 6b05e91b..b7c0a8f5 100644
--- a/meta/conf/bitbake.conf
+++ b/meta/conf/bitbake.conf
@@ -26,6 +26,7 @@ DEPLOY_DIR = "${TMPDIR}/deploy"
FILE_DIRNAME = "${@os.path.dirname(d.getVar('FILE', False))}"
FILESEXTRAPATHS ?= "__default:"
GITDIR = "${DL_DIR}/git"
+DEBDIR = "${DL_DIR}/deb"
DEBSRCDIR = "${DL_DIR}/deb-src"
P = "${PN}-${PV}"
PF = "${PN}-${PV}-${PR}"
--
2.24.1
next prev parent reply other threads:[~2020-03-10 21:56 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-10 21:56 [PATCHv5 00/29] base-apt-rework Henning Schild
2020-03-10 21:56 ` [PATCHv5 01/29] repository: new class to deal with repos Henning Schild
2020-03-10 21:56 ` [PATCHv5 02/29] dpkg-base: add download caching of apt:// downloads Henning Schild
2020-03-10 21:56 ` [PATCHv5 03/29] meta: dpkg-base: convert "exit" into "return 0" Henning Schild
2020-03-10 21:56 ` [PATCHv5 04/29] base-apt: change the sources.list to also offer deb-src Henning Schild
2020-03-10 21:56 ` [PATCHv5 05/29] base-apt: add deb-src packages as well Henning Schild
2020-03-10 21:56 ` [PATCHv5 06/29] base-apt: do not skip gpg check when it is signed Henning Schild
2020-03-10 21:56 ` [PATCHv5 07/29] ci: conf: add "hello" to the sample config and every build Henning Schild
2020-03-10 21:56 ` [PATCHv5 08/29] meta: split all apt-get invocations into download and execution Henning Schild
2020-03-10 21:56 ` Henning Schild [this message]
2020-03-10 21:56 ` [PATCHv5 10/29] meta: import DL_DIR debs before apt-get download steps Henning Schild
2020-03-10 21:56 ` [PATCHv5 11/29] meta: include DL_DIR deb import/export into bootstrap Henning Schild
2020-03-10 21:56 ` [PATCHv5 12/29] base-apt: populate from DEBDIR as well Henning Schild
2020-03-10 21:56 ` [PATCHv5 13/29] base-apt: drop the "apt_cache" feature Henning Schild
2020-03-10 21:56 ` [PATCHv5 14/29] base-apt: do not copy debs directly out of rootfss anymore Henning Schild
2020-03-10 21:56 ` [PATCHv5 15/29] base-apt: rework base-apt population Henning Schild
2020-03-10 21:56 ` [PATCHv5 16/29] base-apt: move class "base-apt-helper" into only user Henning Schild
2020-03-10 21:56 ` [PATCHv5 17/29] CI: include "isar-disable-apt-cache" into all CI images Henning Schild
2020-03-10 21:56 ` [PATCHv5 18/29] CI: include "cowsay" into default build to test dpkg-gbp Henning Schild
2020-03-10 21:56 ` [PATCHv5 19/29] CI: set BB_NO_NETWORK for cached rebuild Henning Schild
2020-03-10 21:56 ` [PATCHv5 20/29] meta: repository: implement repo_contains_package and use it in base_apt Henning Schild
2020-03-10 21:56 ` [PATCHv5 21/29] meta: repository: simplify the matching of packages Henning Schild
2020-03-10 21:56 ` [PATCHv5 22/29] meta: deb-dl-dir: do not cache debs from isar-apt Henning Schild
2020-03-10 21:56 ` [PATCHv5 23/29] base-apt: pull base-apt population to the front of the build chain Henning Schild
2020-03-10 21:56 ` [PATCHv5 24/29] meta: base-apt: remove isar-apt check from population Henning Schild
2020-03-10 21:56 ` [PATCHv5 25/29] meta: deb-dl-dir: only export newly downloaded files Henning Schild
2020-03-18 7:59 ` Henning Schild
2020-03-20 9:27 ` Henning Schild
2020-03-20 13:47 ` Baurzhan Ismagulov
2020-03-10 21:56 ` [PATCHv5 26/29] CI: test a custom kernel build in the base-apt offline rebuild Henning Schild
2020-03-10 21:56 ` [PATCHv5 27/29] meta/deb-dl-dir: make subshell verbose and fail on error Henning Schild
2020-03-10 21:56 ` [PATCHv5 28/29] meta: deb-dl-dir: fix "command not found" error when excluding pkgs Henning Schild
2020-03-10 21:56 ` [PATCHv5 29/29] RECIPE-API-CHANGELOG: add a few bits on the base-apt caching changes Henning Schild
2020-03-15 16:58 ` [PATCHv5 00/29] base-apt-rework Baurzhan Ismagulov
2020-03-15 17:02 ` [PATCH] base-apt, isar-apt: Split code and configuration Baurzhan Ismagulov
2020-03-30 20:26 ` Baurzhan Ismagulov
2020-03-17 8:04 ` [PATCHv5 00/29] base-apt-rework Henning Schild
2020-03-20 13:38 ` [PATCH v6 20/29] meta: repository: implement repo_contains_package and use it in base_apt Baurzhan Ismagulov
2020-03-20 13:38 ` [PATCH v6 23/29] base-apt: pull base-apt population to the front of the build chain Baurzhan Ismagulov
2020-03-20 13:39 ` [PATCH v6 24/29] meta: base-apt: remove isar-apt check from population Baurzhan Ismagulov
2020-03-20 13:39 ` [PATCH v6 28/29] meta: deb-dl-dir: fix "command not found" error when excluding pkgs Baurzhan Ismagulov
2020-03-20 13:41 ` [PATCH v6 29/29] RECIPE-API-CHANGELOG: add a few bits on the base-apt caching changes Baurzhan Ismagulov
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=20200310215631.24859-10-henning.schild@siemens.com \
--to=henning.schild@siemens.com \
--cc=ibr@radix50.net \
--cc=isar-users@googlegroups.com \
--cc=jan.kiszka@siemens.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