rootfs: clean debconf cache files

Message ID 20220616043657.3750-1-venkata.pyla@toshiba-tsip.com
State Accepted, archived
Headers show
Series rootfs: clean debconf cache files | expand

Commit Message

venkata.pyla@toshiba-tsip.com June 15, 2022, 8:36 p.m. UTC
From: venkata pyla <venkata.pyla@toshiba-tsip.com>

Cleaning the debconf cache files for the purpose of generating
reproducible system image.

The debconf cache database sometime generates with non-reproducible
contents because of some packages behaviour (e.g: localepurge), reported
this to package bug tracking system[1], but because this problem is not
with one particular package and can happen with other packages also,
this should be solved in common place to address reproducibility
problem, discussing with Reproducible-builds community[2] to find some
common solution for this problem.

[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1009639
[2] https://lists.reproducible-builds.org/pipermail/rb-general/2022-April/002546.html

Signed-off-by: venkata pyla <venkata.pyla@toshiba-tsip.com>
Suggested-by: Henning Schild <henning.schild@siemens.com>
---
 meta/classes/image.bbclass  | 2 +-
 meta/classes/rootfs.bbclass | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

Comments

Anton Mikanovich Sept. 26, 2022, 9:03 a.m. UTC | #1
16.06.2022 07:36, venkata.pyla@toshiba-tsip.com wrote:
> From: venkata pyla <venkata.pyla@toshiba-tsip.com>
>
> Cleaning the debconf cache files for the purpose of generating
> reproducible system image.
>
> The debconf cache database sometime generates with non-reproducible
> contents because of some packages behaviour (e.g: localepurge), reported
> this to package bug tracking system[1], but because this problem is not
> with one particular package and can happen with other packages also,
> this should be solved in common place to address reproducibility
> problem, discussing with Reproducible-builds community[2] to find some
> common solution for this problem.
>
> [1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1009639
> [2] https://lists.reproducible-builds.org/pipermail/rb-general/2022-April/002546.html
>
> Signed-off-by: venkata pyla <venkata.pyla@toshiba-tsip.com>
> Suggested-by: Henning Schild <henning.schild@siemens.com>

Applied to next, thanks.
Sorry for delay, it looks like we've lost this patch after the latest 
release.

Patch

diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 0da56b7..dc8330a 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -69,7 +69,7 @@  image_do_mounts() {
 }
 
 ROOTFSDIR = "${IMAGE_ROOTFS}"
-ROOTFS_FEATURES += "clean-package-cache generate-manifest export-dpkg-status clean-log-files"
+ROOTFS_FEATURES += "clean-package-cache generate-manifest export-dpkg-status clean-log-files clean-debconf-cache"
 ROOTFS_PACKAGES += "${IMAGE_PREINSTALL} ${IMAGE_INSTALL}"
 ROOTFS_MANIFEST_DEPLOY_DIR ?= "${DEPLOY_DIR_IMAGE}"
 ROOTFS_DPKGSTATUS_DEPLOY_DIR ?= "${DEPLOY_DIR_IMAGE}"
diff --git a/meta/classes/rootfs.bbclass b/meta/classes/rootfs.bbclass
index 7e9fb0f..3b0abc2 100644
--- a/meta/classes/rootfs.bbclass
+++ b/meta/classes/rootfs.bbclass
@@ -244,6 +244,12 @@  rootfs_postprocess_clean_log_files() {
         -exec rm -f {} ';'
 }
 
+ROOTFS_POSTPROCESS_COMMAND += "${@bb.utils.contains('ROOTFS_FEATURES', 'clean-debconf-cache', 'rootfs_postprocess_clean_debconf_cache', '', d)}"
+rootfs_postprocess_clean_debconf_cache() {
+    # Delete debconf cache files
+    sudo rm -rf "${ROOTFSDIR}/var/cache/debconf/"*
+}
+
 ROOTFS_POSTPROCESS_COMMAND += "${@bb.utils.contains('ROOTFS_FEATURES', 'generate-manifest', 'rootfs_generate_manifest', '', d)}"
 rootfs_generate_manifest () {
     mkdir -p ${ROOTFS_MANIFEST_DEPLOY_DIR}