From: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
To: Khem Raj <raj.khem@gmail.com>,
Richard Purdie <richard.purdie@linuxfoundation.org>
Cc: Patches and discussions about the oe-core layer
<openembedded-core@lists.openembedded.org>
Subject: RE: [OE-core] [PATCHv3 3/3] insane.bbclass: Add a check for directories that are expected to be empty
Date: Tue, 2 Nov 2021 18:55:58 +0000 [thread overview]
Message-ID: <1d70a5983e8249f0bb17f34570ef08fb@axis.com> (raw)
In-Reply-To: <CAMKF1sp0akoc327A630iZhD6U2Dw8mG6Zsfk-COVLpBauMEYPA@mail.gmail.com>
> -----Original Message-----
> From: Khem Raj <raj.khem@gmail.com>
> Sent: den 1 november 2021 02:00
> To: Richard Purdie <richard.purdie@linuxfoundation.org>
> Cc: Peter Kjellerstedt <peter.kjellerstedt@axis.com>; Patches and
> discussions about the oe-core layer <openembedded-
> core@lists.openembedded.org>
> Subject: Re: [OE-core] [PATCHv3 3/3] insane.bbclass: Add a check for
> directories that are expected to be empty
>
> On Sun, Oct 31, 2021 at 8:54 AM Richard Purdie
> <richard.purdie@linuxfoundation.org> wrote:
> >
> > On Fri, 2021-10-29 at 23:29 +0200, Peter Kjellerstedt wrote:
> > > The empty-dirs QA check verifies that all directories specified in
> > > QA_EMPTY_DIRS are empty. It is possible to specify why a directory is
> > > expected to be empty by defining QA_EMPTY_DIRS_RECOMMENDATION:<path>,
> > > which will then be included in the error message if the directory is
> > > not empty. If it is not specified for a directory, then "but it is
> > > expected to be empty" will be used.
> > >
> > > Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
> > > ---
> > >
> > > PATCHv2: No changes.
> > > PATCHv3: No changes.
> > >
> > > meta/classes/insane.bbclass | 33 ++++++++++++++++++++++++++++++++-
> > > meta/conf/documentation.conf | 2 ++
> > > 2 files changed, 34 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass
> > > index 1e2f1b768a..1675adf6ac 100644
> > > --- a/meta/classes/insane.bbclass
> > > +++ b/meta/classes/insane.bbclass
> > > @@ -37,7 +37,7 @@ ERROR_QA ?= "dev-so debug-deps dev-deps debug-files arch pkgconfig la \
> > > configure-gettext perllocalpod shebang-size \
> > > already-stripped installed-vs-shipped ldflags compile-host-path \
> > > install-host-path pn-overrides unknown-configure-option \
> > > - useless-rpaths rpaths staticdev \
> > > + useless-rpaths rpaths staticdev empty-dirs \
> > > "
> > > # Add usrmerge QA check based on distro feature
> > > ERROR_QA:append = "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', ' usrmerge', '', d)}"
> > > @@ -50,6 +50,21 @@ ALL_QA = "${WARN_QA} ${ERROR_QA}"
> > >
> > > UNKNOWN_CONFIGURE_WHITELIST ?= "--enable-nls --disable-nls --disable-silent-rules --disable-dependency-tracking --with-libtool-sysroot --disable-static"
> > >
> > > +# This is a list of directories that are expected to be empty.
> > > +QA_EMPTY_DIRS ?= " \
> > > + /dev/pts \
> > > + /media \
> > > + /proc \
> > > + /run \
> > > + /tmp \
> > > + ${localstatedir}/run \
> > > + ${localstatedir}/volatile \
> > > +"
> > > +# It is possible to specify why a directory is expected to be empty by defining
> > > +# QA_EMPTY_DIRS_RECOMMENDATION:<path>, which will then be included in the error
> > > +# message if the directory is not empty. If it is not specified for a directory,
> > > +# then "but it is expected to be empty" will be used.
> > > +
> > > def package_qa_clean_path(path, d, pkg=None):
> > > """
> > > Remove redundant paths from the path for display. If pkg isn't set then
> > > @@ -885,6 +900,22 @@ def package_qa_check_unlisted_pkg_lics(package, d, messages):
> > > "listed in LICENSE" % (package, ' '.join(unlisted)))
> > > return False
> > >
> > > +QAPKGTEST[empty-dirs] = "package_qa_check_empty_dirs"
> > > +def package_qa_check_empty_dirs(pkg, d, messages):
> > > + """
> > > + Check for the existence of files in directories that are expected to be
> > > + empty.
> > > + """
> > > +
> > > + pkgd = oe.path.join(d.getVar('PKGDEST'), pkg)
> > > + for dir in (d.getVar('QA_EMPTY_DIRS') or "").split():
> > > + empty_dir = oe.path.join(pkgd, dir)
> > > + if os.path.exists(empty_dir) and os.listdir(empty_dir):
> > > + recommendation = (d.getVar('QA_EMPTY_DIRS_RECOMMENDATION:' + dir) or
> > > + "but it is expected to be empty")
> > > + msg = "%s installs files in %s, %s" % (pkg, dir, recommendation)
> > > + oe.qa.add_message(messages, "empty-dirs", msg)
> > > +
> > > def package_qa_check_encoding(keys, encode, d):
> > > def check_encoding(key, enc):
> > > sane = True
> > > diff --git a/meta/conf/documentation.conf b/meta/conf/documentation.conf
> > > index 80ad8e10d5..45cd01374a 100644
> > > --- a/meta/conf/documentation.conf
> > > +++ b/meta/conf/documentation.conf
> > > @@ -345,6 +345,8 @@ PYPI_SRC_URI[doc] = "The URI to use to fetch from pypi, default uses pythonhoste
> > >
> > > #Q
> > >
> > > +QA_EMPTY_DIRS[doc] = "A list of directories that are expected to be empty."
> > > +QA_EMPTY_DIRS_RECOMMENDATION[doc] = "This specifies a recommendation for a directory why it must be empty, which will be included in the error message if the directory is not empty."
> > > QMAKE_PROFILES[doc] = "Specifies your own subset of .pro files to be built for use with qmake."
> > >
> >
> > This triggered:
> >
> > ERROR: apt-2.2.4-r0 do_package_qa: QA Issue: apt installs files in /var/volatile, but it is expected to be empty [empty-dirs]
> > ERROR: apt-2.2.4-r0 do_package_qa: Fatal QA errors were found, failing task.
> >
> > https://autobuilder.yoctoproject.org/typhoon/#/builders/119/builds/915/steps/12/logs/stdio
> >
>
> meta-openembedded layers report a few too see
> https://autobuilder.yoctoproject.org/typhoon/#/builders/88/builds/1675
I have sent a patch series to openembedded-devel now that should cover
these.
> >
> > Cheers,
> >
> > Richard
//Peter
next prev parent reply other threads:[~2021-11-02 18:56 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-29 21:29 [PATCHv3 1/3] systemd: Do not install anything in /var/volatile Peter Kjellerstedt
2021-10-29 21:29 ` [PATCHv3 2/3] base-files: Ignore the empty-dirs QA error due to files " Peter Kjellerstedt
2021-10-29 21:29 ` [PATCHv3 3/3] insane.bbclass: Add a check for directories that are expected to be empty Peter Kjellerstedt
2021-10-31 15:53 ` [OE-core] " Richard Purdie
2021-11-01 1:00 ` Khem Raj
2021-11-02 18:55 ` Peter Kjellerstedt [this message]
2021-11-04 5:09 ` Khem Raj
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=1d70a5983e8249f0bb17f34570ef08fb@axis.com \
--to=peter.kjellerstedt@axis.com \
--cc=openembedded-core@lists.openembedded.org \
--cc=raj.khem@gmail.com \
--cc=richard.purdie@linuxfoundation.org \
/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