From: "Q. Gylstorff" <Quirin.Gylstorff@siemens.com>
To: isar-users@googlegroups.com, jan.kiszka@siemens.com,
henning.schild@siemens.com
Cc: Quirin Gylstorff <quirin.gylstorff@siemens.com>
Subject: [RFC 1/2] meta/classes: Add remove packages to rootfs postprocessing
Date: Fri, 21 Feb 2020 15:53:47 +0100 [thread overview]
Message-ID: <20200221145348.24250-2-Quirin.Gylstorff@siemens.com> (raw)
In-Reply-To: <20200221145348.24250-1-Quirin.Gylstorff@siemens.com>
From: Quirin Gylstorff <quirin.gylstorff@siemens.com>
Remove non-essential packages to reduce the amount of packages
to be cleared. It can also to used to reduce the foot print
of a image.
Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
---
meta/classes/image.bbclass | 2 +-
meta/classes/rootfs.bbclass | 13 +++++++++++++
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 6bcc6cd..62d6f46 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -60,7 +60,7 @@ image_do_mounts() {
}
ROOTFSDIR = "${IMAGE_ROOTFS}"
-ROOTFS_FEATURES += "copy-package-cache clean-package-cache finalize-rootfs generate-manifest"
+ROOTFS_FEATURES += "copy-package-cache clean-package-cache finalize-rootfs generate-manifest remove_packages"
ROOTFS_PACKAGES += "${IMAGE_PREINSTALL} ${IMAGE_INSTALL}"
ROOTFS_MANIFEST_DEPLOY_DIR ?= "${DEPLOY_DIR_IMAGE}"
diff --git a/meta/classes/rootfs.bbclass b/meta/classes/rootfs.bbclass
index 64eaef7..0329f55 100644
--- a/meta/classes/rootfs.bbclass
+++ b/meta/classes/rootfs.bbclass
@@ -187,6 +187,19 @@ rootfs_postprocess_clean_package_cache() {
/usr/bin/apt-get clean
sudo rm -rf "${ROOTFSDIR}/var/lib/apt/lists/"*
}
+ROOTFS_POSTPROCESS_COMMAND += "${@bb.utils.contains('ROOTFS_FEATURES', 'remove_packages', 'rootfs_rm_packages', '', d)}"
+rootfs_rm_packages () {
+ if [ -n "${ROOTFS_PACKAGES_FORCE_REMOVE}" ]; then
+ RMPKGS=$(sudo -E chroot "${ROOTFSDIR}" \
+ dpkg-query \
+ -f '${Package}\n' \
+ -W ${ROOTFS_PACKAGES_FORCE_REMOVE} 2>/dev/null || true)
+ fi
+ if [ -n "${RMPKGS}" ]; then
+ sudo -E chroot "${ROOTFSDIR}" \
+ dpkg --purge --force-depends ${RMPKGS}
+ fi
+}
ROOTFS_POSTPROCESS_COMMAND += "${@bb.utils.contains('ROOTFS_FEATURES', 'generate-manifest', 'rootfs_generate_manifest', '', d)}"
rootfs_generate_manifest () {
--
2.20.1
next prev parent reply other threads:[~2020-02-21 14:53 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-21 14:53 [RFC 0/2] Remove Packages during Postprocessing Q. Gylstorff
2020-02-21 14:53 ` Q. Gylstorff [this message]
2020-02-21 18:28 ` [RFC 1/2] meta/classes: Add remove packages to rootfs postprocessing Jan Kiszka
2020-02-24 13:04 ` Gylstorff Quirin
2020-02-21 14:53 ` [RFC 2/2] meta-isar/images: Remove gcc-8-base from rootfs Q. Gylstorff
2020-02-21 18:29 ` Jan Kiszka
2020-02-24 14:24 ` [RFC 0/2] Remove Packages during Postprocessing Henning Schild
2020-02-25 5:43 ` Gylstorff Quirin
2020-02-25 13:10 ` Henning Schild
2020-03-17 10:23 ` Gylstorff Quirin
2020-03-17 10:28 ` Jan Kiszka
2020-03-17 10:48 ` Gylstorff Quirin
2022-09-22 5:55 ` Balasubramanian Sundaram
2022-09-22 9:26 ` 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=20200221145348.24250-2-Quirin.Gylstorff@siemens.com \
--to=quirin.gylstorff@siemens.com \
--cc=henning.schild@siemens.com \
--cc=isar-users@googlegroups.com \
--cc=jan.kiszka@siemens.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