On Monday, October 28, 2019 at 6:01:36 PM UTC+1, Henning Schild wrote: > > From: Henning Schild > > > 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 > > --- > meta/classes/deb-dl-dir.bbclass | 14 ++++++++++++++ > 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 | 12 ++++++++++-- > meta/conf/bitbake.conf | 1 + > 8 files changed, 30 insertions(+), 3 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 0000000..e58df7a > --- /dev/null > +++ b/meta/classes/deb-dl-dir.bbclass > @@ -0,0 +1,14 @@ > +# This software is a part of ISAR. > +# Copyright (C) 2019 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}" \; > use -exec command {} + to reduce the number of fork/execvp pairs? note: you would need to use cp -t "${pc}" since the "+" modifier appends matches to the end of the command > + ' > +} > diff --git a/meta/classes/dpkg-base.bbclass > b/meta/classes/dpkg-base.bbclass > index b39df5c..8815478 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 d9c3af0..9e6945b 100644 > --- a/meta/classes/dpkg-gbp.bbclass > +++ b/meta/classes/dpkg-gbp.bbclass > @@ -16,6 +16,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 d809cca..b6844e9 100644 > --- a/meta/classes/dpkg.bbclass > +++ b/meta/classes/dpkg.bbclass > @@ -9,6 +9,7 @@ do_install_builddeps() { > E="${@ bb.build.exec_func('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 3c0758f..0f0d0ca 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 243fa11..3906585 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 095ebc1..841aa89 100644 > --- a/meta/classes/rootfs.bbclass > +++ b/meta/classes/rootfs.bbclass > @@ -1,6 +1,8 @@ > # This software is a part of ISAR. > # Copyright (c) Siemens AG, 2019 > > +inherit deb-dl-dir > + > ROOTFS_ARCH ?= "${DISTRO_ARCH}" > ROOTFS_DISTRO ?= "${DISTRO}" > ROOTFS_PACKAGES ?= "" > @@ -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 4c0a809..56f4fbf 100644 > --- a/meta/conf/bitbake.conf > +++ b/meta/conf/bitbake.conf > @@ -26,6 +26,7 @@ DEPLOY_DIR = "${TMPDIR}/deploy" > FILESPATH = > "${FILE_DIRNAME}/${PF}:${FILE_DIRNAME}/${P}:${FILE_DIRNAME}/${PN}:${FILE_DIRNAME}/files:${FILE_DIRNAME}" > > FILE_DIRNAME = "${@os.path.dirname(d.getVar('FILE', False))}" > GITDIR = "${DL_DIR}/git" > +DEBDIR = "${DL_DIR}/deb" > DEBSRCDIR = "${DL_DIR}/deb-src" > P = "${PN}-${PV}" > PF = "${PN}-${PV}-${PR}" > -- > 2.23.0 > >