Hi,

I have an build configured to create a debug fs and the image includes
logrotate.

I'm seeing a failure similar to the one fixed in this change:

        https://patchwork.openembedded.org/patch/122139/

but for /var/lib/logrotate.status, which is marked as a conffile in
logrotate's recipe.

My fix looks like the following patch. I'm taking a clue from Debian and
instead of marking logrotate.status as a configuration file, I'm not
adding it to the packaged files and instead I'm creating an empty
version when the package is installed. If the package is removed, I
remove the file.

I'm also seeing a similar failure for nfs-utils (/var/lib/nfs). Again,
Debian handles this in a similar way: those files are not shipped with
the package, but instead they are handled via package scripts. The
alternative is to extend the fix implemented in the referenced patch and
add /var/lib/nfs to the list of special directories. Needless to say,
this doesn't scale well.

Any comments?

Marcelo

>From fc8819afbadf1e2ffa30babc45267a92ae78e246 Mon Sep 17 00:00:00 2001
From: "Marcelo E. Magallon" <marcelo.magal...@hpe.com>
Date: Fri, 30 Dec 2016 09:01:30 -0800
Subject: [PATCH] Remove logrotate.status from list of CONFFILES

Since /var/lib/logrotate.status is declared to be a configuration file,
some packaging tools (dpkg, ipkg) will compute a checksum and try to
validate that when asked for status. This happens when the system is
configured to generate a debug fs, and because of the mechanics used to
create it, the operation fails. Removing this file from the
configuration files list fixes this.

Signed-off-by: Marcelo E. Magallon <marcelo.magal...@hpe.com>
---
 meta/recipes-extended/logrotate/logrotate_3.9.1.bb | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/meta/recipes-extended/logrotate/logrotate_3.9.1.bb 
b/meta/recipes-extended/logrotate/logrotate_3.9.1.bb
index 5f1a601aeb..1fa2096b19 100644
--- a/meta/recipes-extended/logrotate/logrotate_3.9.1.bb
+++ b/meta/recipes-extended/logrotate/logrotate_3.9.1.bb
@@ -27,8 +27,7 @@ PACKAGECONFIG ?= "\
 PACKAGECONFIG[acl] = ",,acl"
 PACKAGECONFIG[selinux] = ",,libselinux"
 
-CONFFILES_${PN} += "${localstatedir}/lib/logrotate.status \
-                   ${sysconfdir}/logrotate.conf"
+CONFFILES_${PN} += "${sysconfdir}/logrotate.conf"
 
 # If RPM_OPT_FLAGS is unset, it adds -g itself rather than obeying our
 # optimization variables, so use it rather than EXTRA_CFLAGS.
@@ -59,5 +58,16 @@ do_install(){
     mkdir -p ${D}${localstatedir}/lib
     install -p -m 644 examples/logrotate-default 
${D}${sysconfdir}/logrotate.conf
     install -p -m 755 examples/logrotate.cron 
${D}${sysconfdir}/cron.daily/logrotate
-    touch ${D}${localstatedir}/lib/logrotate.status
+}
+
+pkg_postinst_${PN}() {
+#!/bin/sh
+if [ -n "$D" ] ; then
+    touch $D${localstatedir}/lib/logrotate.status
+fi
+}
+
+pkg_postinst_${PN}() {
+#!/bin/sh
+rm $D${localstatedir}/lib/logrotate.status
 }
-- 
2.11.0

-- 
_______________________________________________
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto

Reply via email to