From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 7004754512489480192 X-Received: by 2002:adf:a486:: with SMTP id g6mr11942370wrb.130.1633365959882; Mon, 04 Oct 2021 09:45:59 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:adf:ef50:: with SMTP id c16ls19279453wrp.3.gmail; Mon, 04 Oct 2021 09:45:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwRvuoFJJQwq1xzjmtBCMGElvkE6yQZ8JeR4PI7kyxWg81jRXLxCqkV5mGBzmI0fLCVuXZJ X-Received: by 2002:adf:b1c5:: with SMTP id r5mr3723702wra.357.1633365958964; Mon, 04 Oct 2021 09:45:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633365958; cv=none; d=google.com; s=arc-20160816; b=NvPeALRR29Hx51fWdb9I37UGBfKQp7kkmd1Nze1INeZCuAKXJaBR44ss5TwitOrip0 0TCSvndxFQito68lpCcVlJXOMPlZ+Rz6KvY/hqa8FKp9NXWF/DKiiJMUzh1xAUFCRzyk 35zpOXbMUXxScLuuHVfVRakEH5HMQEIFcAgHLuTr2oSqBf8yGHLViIgfQRjcPiYZ5Bve PfWdISLCcVGXxs3FVxV+qeWYkE/8QXliORD7rla9nF/4PNosm3MvhTcD4K4tNBtAFWLc v1KJNEFZgq2kJWwSY9u7VWNw1jhbjZDcWj2/3pji+DvP2ChZ30whoUz1XJIo5DOX+rwQ DPAQ== 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=0v15AH0xPFD/hqtmYNRiUpJUHOuwBgwqSnpu0+N2HcY=; b=ObcrTkkvvT2sgTRyy3xbnZyG7oosp1/b1F0v+GZYGEqn6ATcTdZv9oTsJp28RF3p0C J+0A4WBH4k/FyyNJClybkobi+1aEml5ISCzNA1DXLXHdKQD2fq4/kGH1Z+0vwgsHSZ+1 ZXk90aeoVEFQ9XgH1KROgOq5FBQ5A8Lm08JqPD/iGcMBmV+bURDse68O1KEn8hSD81Bw Ww/R1P4UJmfD2Qmn+03Yi46k42Zb5UBnGD2WTV/QyKCT1GOnbGofO4dvfXRTAMf0ksP5 rxkr9k9ewUTt6D3z+t3B06kpRhXiCsJf/mc6CRbF7fScMNqjt/U/2zQQSbIAYgldTTU4 3Jzw== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of henning.schild@siemens.com designates 192.35.17.14 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 david.siemens.de (david.siemens.de. [192.35.17.14]) by gmr-mx.google.com with ESMTPS id s194si403598wme.0.2021.10.04.09.45.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Oct 2021 09:45:58 -0700 (PDT) Received-SPF: pass (google.com: domain of henning.schild@siemens.com designates 192.35.17.14 as permitted sender) client-ip=192.35.17.14; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of henning.schild@siemens.com designates 192.35.17.14 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 david.siemens.de (8.15.2/8.15.2) with ESMTPS id 194Gjw3W023174 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 4 Oct 2021 18:45:58 +0200 Received: from md1za8fc.ad001.siemens.net ([139.25.0.59]) by mail1.sbs.de (8.15.2/8.15.2) with ESMTP id 194GjwYS008289; Mon, 4 Oct 2021 18:45:58 +0200 Date: Mon, 4 Oct 2021 18:45:57 +0200 From: Henning Schild To: Cc: , , Subject: Re: [PATCH v2] rootfs: clean package log files that are not owned by packages Message-ID: <20211004184557.134c741f@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> <20211004154846.23f58980@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: 7XD6D1KPM2oA Am Mon, 4 Oct 2021 15:07:04 +0000 schrieb : > >-----Original Message----- > >From: Henning Schild > >Sent: 04 October 2021 19:19 > >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 Mon, 4 Oct 2021 12:51:43 +0000 > >schrieb : > > =20 > >> >-----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 > >> > >> 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 > >> > >> 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 > >> > >> If we delete only files then there may be some residue left over as > >> empty folders. =20 > > > >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. =20 >=20 > The dpkg -S should search even if it is empty folder and owned by > packages, Also if the applications are expecting them even if it is > not part of package list contents, I think it should be an > application bug. Anyway keeping them doesn=E2=80=99t give any difference,= so > If no objections I will modify it. >=20 > I will resend the patch with the below changes, kindly let me know if > there are more review comments. > * correct the commit message by removing extra leading space > characters > * Use "type -f" to delete only files in the log folder I am also not sure that is needed. I first thought a debian package was not allowed to contain an empty folder ... like git or a gentoo package. I do not feel strong about the "type f" and the "rm -f". Henning > * Set this feature to on as default in image.bbclass >=20 > Thanks. >=20 > > > >Henning > > =20 > >> >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