From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 7004754512489480192 X-Received: by 2002:a05:6512:ace:: with SMTP id n14mr6399018lfu.523.1633355328673; Mon, 04 Oct 2021 06:48:48 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a2e:bc16:: with SMTP id b22ls3140608ljf.1.gmail; Mon, 04 Oct 2021 06:48:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxbK1ARmYeZxOKVajPHjnA48ucAuAjVZTiebodgc7Of9nOqlk0+6ty9T/oDMixOdDkxUaau X-Received: by 2002:a2e:9ad7:: with SMTP id p23mr16039561ljj.527.1633355327655; Mon, 04 Oct 2021 06:48:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633355327; cv=none; d=google.com; s=arc-20160816; b=qN9/2NtMZ7WO2I3RXKe+zu3BONjVQ14jemiM6uPwUwlHcLkbvGwtwGcEQNd9N/ZYu9 jSKqz2nArkP7Cp935EC8FMoTZBLNRN+6KPGd2m682qBYvVP/6cTMWbXUirzoFskNQ3ws U9kpAPE2P/xyM/bIm3oy0edVdMag9mLvpMtzF8FXfCQx7G02pPwx7dHrs+YvUIzugXvK oohN2SvDQHR73G4maKwcZpL7VpKVPOFu4A5FokZ9O7uulHga2RfuGbEfDREtUWVHOE/B ri4UzWp5o7T2OJV+s7OX2kAI5dlk2HIhb0ghvZbQoJhMZBATQEgKSH6ZhZfaaufV+bj3 5sOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date; bh=2mO9bf5IrmSLjjw3n+qauOEsccjcRShDnxFvhaA2GRQ=; b=e2tAacAa4iPXF/UnX2uIM0dM2Lwu+qJFJRXe1YZped2LX1lnDlPD1jOLbXnlQXCovp Fn1BnlwlSBj0yivyexdfVsjyvIVNZRQsmJXJIUt4kyiG05rqE1L3MBt+V6Vp34SxFHe5 MexBra1PJMEBNsPuJTRivvpsVdLBEwYlaANiJTWu7jm9CW9DT+/Wq5jaP8xYUqSlbGvu 0Cfa5moOPMrfkK52vDVb+qkI17hgERZkdrNtIDoymmuJ5GiGjtJx+nfK4DuELxG3ORzc vmNzOgz9Dt81/6yQtMPx3cATi8KAx4HwNL4lz3Vay+ySugwutXPDlpUbBNMJT6vDhrS3 57ng== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of henning.schild@siemens.com designates 194.138.37.40 as permitted sender) smtp.mailfrom=henning.schild@siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com Return-Path: Received: from gecko.sbs.de (gecko.sbs.de. [194.138.37.40]) by gmr-mx.google.com with ESMTPS id z21si636102ljn.1.2021.10.04.06.48.47 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Oct 2021 06:48:47 -0700 (PDT) Received-SPF: pass (google.com: domain of henning.schild@siemens.com designates 194.138.37.40 as permitted sender) client-ip=194.138.37.40; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of henning.schild@siemens.com designates 194.138.37.40 as permitted sender) smtp.mailfrom=henning.schild@siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com Received: from mail1.sbs.de (mail1.sbs.de [192.129.41.35]) by gecko.sbs.de (8.15.2/8.15.2) with ESMTPS id 194Dmko7005264 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 4 Oct 2021 15:48:46 +0200 Received: from md1za8fc.ad001.siemens.net ([139.25.0.59]) by mail1.sbs.de (8.15.2/8.15.2) with ESMTP id 194Dmkix029036; Mon, 4 Oct 2021 15:48:46 +0200 Date: Mon, 4 Oct 2021 15:48:46 +0200 From: Henning Schild To: Cc: , Subject: Re: [PATCH v2] rootfs: clean package log files that are not owned by packages Message-ID: <20211004154846.23f58980@md1za8fc.ad001.siemens.net> In-Reply-To: References: <20210906124831.202ce22f@md1za8fc.ad001.siemens.net> <20211001143748.8711-1-venkata.pyla@toshiba-tsip.com> <20211004140513.29414a72@md1za8fc.ad001.siemens.net> X-Mailer: Claws Mail 3.18.0 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-TUID: 21amvL15xQB2 Am Mon, 4 Oct 2021 12:51:43 +0000 schrieb : > >-----Original Message----- > >From: Henning Schild > >Sent: 04 October 2021 17:35 > >To: pyla venkata(=EF=BC=B4=EF=BC=B3=EF=BC=A9=EF=BC=B0) > >Cc: isar-users@googlegroups.com; jan.kiszka@siemens.com > >Subject: Re: [PATCH v2] rootfs: clean package log files that are not > >owned by packages > > > >Am Fri, 1 Oct 2021 20:07:48 +0530 > >schrieb : > > =20 > >> From: venkata pyla > >> > >> /var/log/* files that are created during build stage and not owned > >> by any package are not neccessary to be present in rootfs image, as > >> these log files adds additional size to rootfs image, and also it > >> create problems for reproducible build functionality. > >> > >> so this ROOTFS feature 'clean-log-files' should help to clean the > >> log files when it is enalbed, disable it if we need the log files > >> for debugging purpose. > >> > >> ROOTFS_FEATURE +=3D clean-log-files =20 > > > >The two leading spaces of the commit message look a little weird. > >Like you are not using git-format-patch or git-send-email correctly. > >Or like you are using a funny editor for writing your commit > >messages. =20 >=20 > I will correct it, thanks. >=20 > > > >I think that adds value but i do not see why we should model it as a > >feature. It should probably be the "new normal" and we introduce an > >option once there is a need for a switch. =20 >=20 > I added it as feature because if we delete the logs file by default > from the image, if any user want those log files for debugging > purpose then there will be provision to disable this feature and get > the log files as earlier >=20 > > =20 > >> Signed-off-by: venkata pyla > >> --- > >> meta/classes/rootfs.bbclass | 10 ++++++++++ > >> 1 file changed, 10 insertions(+) > >> > >> diff --git a/meta/classes/rootfs.bbclass > >> b/meta/classes/rootfs.bbclass index f9151c5..ff0ecad 100644 > >> --- a/meta/classes/rootfs.bbclass > >> +++ b/meta/classes/rootfs.bbclass > >> @@ -12,6 +12,7 @@ ROOTFS_PACKAGES ?=3D "" > >> # 'clean-package-cache' - delete package cache from rootfs # > >> 'generate-manifest' - generate a package manifest of the rootfs > >> into ${ROOTFS_MANIFEST_DEPLOY_DIR} # 'export-dpkg-status' - exports > >> /var/lib/dpkg/status file to ${ROOTFS_DPKGSTATUS_DEPLOY_DIR} +# > >> 'clean-log-files' - delete log files that are not owned by packages > >> ROOTFS_FEATURES ?=3D "" > >> ROOTFS_APT_ARGS=3D"install --yes -o Debug::pkgProblemResolver=3Dyes" > >> @@ -213,6 +214,15 @@ rootfs_postprocess_clean_package_cache() { > >> sudo rm -rf "${ROOTFSDIR}/var/lib/apt/lists/"* > >> } > >> > >> +ROOTFS_POSTPROCESS_COMMAND +=3D > >> "${@bb.utils.contains('ROOTFS_FEATURES', 'clean-log-files', > >> 'rootfs_postprocess_clean_log_files', '', d)}" > >> +rootfs_postprocess_clean_log_files() { > >> + # Delete log files that are not owned by packages > >> + sudo -E chroot '${ROOTFSDIR}' \ > >> + /usr/bin/find /var/log/ \ > >> + -exec sh -c '! dpkg -S {} > /dev/null 2>&1' ';' \ > >> + -exec rm -rf {} ';' =20 > > > >I think we should restrict that to "-type f" and switch over to "rm > >-f" (not -r) > > =20 >=20 > If we delete only files then there may be some residue left over as > empty folders. Which is exactly what i was aiming for! An empty folder belonging to a package should be kept ... i think your code keeps it as well. But empty folders do not hurt too much ... and them not being there might have an impact on the applications expecting them to exist ... they might not log or might not even start in the worst case. I think a proper debian package will contain required empty folders, i am not sure we should remove empty folders that are seemingly not needed. Henning > >Henning > > =20 > >> +} > >> + > >> ROOTFS_POSTPROCESS_COMMAND +=3D > >> "${@bb.utils.contains('ROOTFS_FEATURES', 'generate-manifest', > >> 'rootfs_generate_manifest', '', d)}" rootfs_generate_manifest () { > >> mkdir -p ${ROOTFS_MANIFEST_DEPLOY_DIR} =20 >=20