insane.bbclass: Add a check for directories that are expected to be empty
PATCH 1/1 insane.bbclass: Add a check for directories that are expected to be empty
From: Peter Kjellerstedt <[email protected]>
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.
---
Compared to the corresponding patch for master, there are two differences:
* "/var/volatile" is not added to QA_EMPTY_DIRS by default.
* "empty-dirs" is added to WARN_QA instead of ERROR_QA.
This should make it safe to add this QA test to Honister without introdusing any new QA errors, while still allowing the QA test to be activated for those who wants to use it.
meta/classes/insane.bbclass | 32 +++++++++++++++++++++++++++++++- meta/conf/documentation.conf | 2 ++ 2 files changed, 33 insertions(+), 1 deletion(-)
meta/classes/insane.bbclass +31 -1
@@ -27,7 +27,7 @@ WARN_QA ?= " libdir xorg-driver-abi \ infodir build-deps src-uri-bad symlink-to-sysroot multilib \ invalid-packageconfig host-user-contaminated uppercase-pn patch-fuzz \ mime mime-xdg unlisted-pkg-lics unhandled-features-check \ - missing-update-alternatives native-last missing-ptest \ + missing-update-alternatives native-last missing-ptest empty-dirs \ " ERROR_QA ?= "dev-so debug-deps dev-deps debug-files arch pkgconfig la \ perms dep-cmp pkgvarcheck perm-config perm-line perm-link \
@@ -50,6 +50,20 @@ 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 \ +" +# 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
@@ -917,6 +931,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
meta/conf/documentation.conf +2 -0
@@ -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." #R
Quoted 16 lines · Peter Kjellerstedt
From: Peter Kjellerstedt <[email protected]>
The empty-dirs QA check verifies that all directories specified in
QA_EMPTY_DIRSare 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.Change-Id Ic61019528f4b22f26e42e78125a99666ae27c7f5Signed-off-by Peter Kjellerstedt <[email protected]>---
Compared to the corresponding patch for master, there are two differences:
Quoted 6 lines
* "
/var/volatile" is not added toQA_EMPTY_DIRSby default.
* "empty-dirs" is added toWARN_QAinstead ofERROR_QA.This should make it safe to add this QA test to Honister without introdusing any new QA errors, while still allowing the QA test to be activated for those who wants to use it.
Does it have to be enabled by default?
Thanks,
Anuj
Quoted 111 lines
meta/classes/insane.bbclass | 32 +++++++++++++++++++++++++++++++-
meta/conf/documentation.conf| 2 ++2 files changed, 33 insertions(+), 1 deletion(-)meta/classes/insane.bbclass +0
-0@@ -27,7 +27,7 @@ WARN_QA ?= " libdir xorg-driver-abi \infodir build-deps src-uri-bad symlink-to-sysroot multilib \
invalid-packageconfig host-user-contaminated uppercase- pn patch-fuzz \
mime mime-xdg unlisted-pkg-lics unhandled-features-check \
- missing-update-alternatives native-last missing-ptest \
+ missing-update-alternatives native-last missing-ptest empty-dirs \
"
ERROR_QA ?= "dev-so debug-deps dev-deps debug-files arch pkgconfig la \
perms dep-cmp pkgvarcheck perm-config perm-line perm- link \meta/classes/insane.bbclass +0
-0@@ -50,6 +50,20 @@ ALL_QA = "${WARN_QA} ${ERROR_QA}"
UNKNOWN_CONFIGURE_WHITELIST ?= "--enable-nls --disable-nls -- disable-silent-rules --disable-dependency-tracking --with-libtool- sysroot --disable-static"meta/classes/insane.bbclass +10
-0+# This is a list of directories that are expected to be empty. +QA_EMPTY_DIRS ?= " \ + /dev/pts \ + /media \ + /proc \ + /run \ + /tmp \ + ${localstatedir}/run \ +" +# It is possible to specify why a directory is expected to be emptyby 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,meta/classes/insane.bbclass +2
-0+# 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 thenmeta/classes/insane.bbclass +0
-0@@ -917,6 +931,22 @@ def package_qa_check_unlisted_pkg_lics(package,d, messages):
"listed in LICENSE" % (package, ' '.join(unlisted)))
return Falsemeta/classes/insane.bbclass +4
-0+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 areexpected 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)
+ ifos.path.exists(empty_dir)andos.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)+
defpackage_qa_check_encoding(keys, encode, d):
defcheck_encoding(key, enc):
sane = Truemeta/conf/documentation.conf +0
-0@@ -345,6 +345,8 @@ PYPI_SRC_URI[doc] = "The URI to use to fetch frompypi, 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."
#R-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#157986):
https://lists.openembedded.org/g/openembedded-core/message/157986
Mute This Topic: https://lists.openembedded.org/mt/86910911/3616702
Group Owner: [email protected] Unsubscribe:
https://lists.openembedded.org/g/openembedded-core/unsub [
[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 47 lines
-----Original Message-----
From: Mittal, Anuj <[email protected]>
Sent: den 11 november 2021 04:06
To: Peter Kjellerstedt <[email protected]>
Subject: Re: [OE-core] [honister][PATCH] insane.bbclass: Add a check for directories that are expected to be emptyQuoted 39 lines · Peter Kjellerstedt
Quoted 39 lines
-----Original Message-----
From: [email protected] <openembedded- [email protected]> On Behalf Of Anuj Mittal
Sent: den 9 november 2021 15:36
To: [email protected]; Peter Kjellerstedt <[email protected]>
Subject: Re: [OE-core] [honister][PATCH] insane.bbclass: Add a check for
directories that are expected to be emptyQuoted 27 lines · Peter Kjellerstedt
From: Peter Kjellerstedt <[email protected]>
The empty-dirs QA check verifies that all directories specified in
QA_EMPTY_DIRSare 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.Change-Id Ic61019528f4b22f26e42e78125a99666ae27c7f5Signed-off-by Peter Kjellerstedt <[email protected]>---
Compared to the corresponding patch for master, there are two differences:
* "
/var/volatile" is not added toQA_EMPTY_DIRSby default.
* "empty-dirs" is added toWARN_QAinstead ofERROR_QA.This should make it safe to add this QA test to Honister without introdusing any new QA errors, while still allowing the QA test to be activated for those who wants to use it.
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
Does it have to be enabled by default?
Well, it doesn't have to be enabled. However, without
/var/volatileinQA_EMPTY_DIRS, there should be no warnings generated for OE-Core or OpenEmbedded so it should not hurt to have it inWARN_QA.Right, but there could be unexpected warnings for other downstream layers in release versions.
True, but they would still just be warnings.
Quoted 2 lines
I think we can add the test but only for people to use it if they'd like to.
Sure, if you prefer that. Do you want me to send an updated patch, or will you take care of it?
Quoted 3 lines
Thanks,
Anuj
//Peter
Quoted 49 lines · Peter Kjellerstedt
Quoted 49 lines
-----Original Message-----
From: Mittal, Anuj <[email protected]>
Sent: den 11 november 2021 04:06
To: Peter Kjellerstedt <[email protected]>
Subject: Re: [OE-core] [honister][PATCH] insane.bbclass: Add a check for directories that are expected to be emptyQuoted 41 lines · Peter Kjellerstedt
Quoted 40 lines
-----Original Message-----
From: [email protected] <openembedded- [email protected]> On Behalf Of Anuj Mittal
Sent: den 9 november 2021 15:36
To: [email protected]; Peter Kjellerstedt <[email protected]>
Subject: Re: [OE-core] [honister][PATCH] insane.bbclass: Add a check for
directories that are expected to be emptyQuoted 21 lines · Peter Kjellerstedt
From: Peter Kjellerstedt <[email protected]>
The empty-dirs QA check verifies that all directories specified in
QA_EMPTY_DIRSare 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.Change-Id Ic61019528f4b22f26e42e78125a99666ae27c7f5Signed-off-by Peter Kjellerstedt <[email protected]>---
Compared to the corresponding patch for master, there are two differences:
Quoted 6 lines
* "
/var/volatile" is not added toQA_EMPTY_DIRSby default.
* "empty-dirs" is added toWARN_QAinstead ofERROR_QA.This should make it safe to add this QA test to Honister without introdusing any new QA errors, while still allowing the QA test to be activated for those who wants to use it.
Does it have to be enabled by default?
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Well, it doesn't have to be enabled. However, without
/var/volatileinQA_EMPTY_DIRS, there should be no warnings generated for OE-Core or OpenEmbedded so it should not hurt to have it inWARN_QA.Right, but there could be unexpected warnings for other downstream layers in release versions.
True, but they would still just be warnings.
In the context of backports, this needs to be handled carefully. You're effectively asking for new feature backport here and people aren't happy when stable branches suddenly show new warnings.
If the issue was of huge importance, that would be ok but I'm not sure that is the case here, we've managed with the code as is for a long time.
Cheers,
Richard
Quoted 77 lines
-----Original Message-----
From: Richard Purdie <[email protected]>
Sent: den 11 november 2021 11:31
To: Peter Kjellerstedt <[email protected]>; Mittal, Anuj <[email protected]>
Cc: OE Core ([email protected]) <openembedded- [email protected]>
Subject: Re: [OE-core] [honister][PATCH] insane.bbclass: Add a check for directories that are expected to be emptyQuoted 5 lines · Peter Kjellerstedt
Quoted 5 lines
-----Original Message-----
From: Mittal, Anuj <[email protected]>
Sent: den 11 november 2021 04:06
To: Peter Kjellerstedt <[email protected]>
Subject: Re: [OE-core] [honister][PATCH] insane.bbclass: Add a checkfor
Quoted 16 lines
Quoted 16 lines
directories that are expected to be empty
Quoted 13 lines · Peter Kjellerstedt
Quoted 13 lines
-----Original Message-----
From: [email protected] <openembedded- [email protected]> On Behalf Of Anuj Mittal
Sent: den 9 november 2021 15:36
To: [email protected]; Peter Kjellerstedt <[email protected]>
Subject: Re: [OE-core] [honister][PATCH] insane.bbclass: Add a check for
directories that are expected to be emptyQuoted 2 lines · Peter Kjellerstedt
From: Peter Kjellerstedt <[email protected]>
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
The empty-dirs QA check verifies that all directories specified in
QA_EMPTY_DIRSare 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 thedirectory
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
is
not empty. If it is not specified for a directory, then "but it is
expected to be empty" will be used.Change-Id Ic61019528f4b22f26e42e78125a99666ae27c7f5Signed-off-by Peter Kjellerstedt <[email protected]>---
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Compared to the corresponding patch for master, there are two differences:
* "
/var/volatile" is not added toQA_EMPTY_DIRSby default.
* "empty-dirs" is added toWARN_QAinstead ofERROR_QA.This should make it safe to add this QA test to Honister without introdusing any new QA errors, while still allowing the QA test
to be
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
activated for those who wants to use it.
Does it have to be enabled by default?
Well, it doesn't have to be enabled. However, without
/var/volatilein
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
QA_EMPTY_DIRS, there should be no warnings generated for OE-Core or OpenEmbedded so it should not hurt to have it inWARN_QA.Right, but there could be unexpected warnings for other downstream layers in release versions.
True, but they would still just be warnings.
In the context of backports, this needs to be handled carefully. You're effectively asking for new feature backport here and people aren't happy when stable branches suddenly show new warnings.
Quoted 6 lines
If the issue was of huge importance, that would be ok but I'm not sure that is the case here, we've managed with the code as is for a long time.
Cheers,
Richard
Sure, I'm perfectly fine with the feature being backported without it being enabled out-of-the-box as it will still allow me to remove our local solution for the same problem.
//Peter
Quoted 66 lines · Peter Kjellerstedt
Quoted 57 lines
-----Original Message-----
From: Mittal, Anuj <[email protected]>
Sent: den 11 november 2021 04:06
To: Peter Kjellerstedt <[email protected]>
Subject: Re: [OE-core] [honister][PATCH] insane.bbclass: Add a check for
directories that are expected to be emptyQuoted 48 lines · Peter Kjellerstedt
Quoted 47 lines
-----Original Message-----
From: [email protected] <openembedded- [email protected]> On Behalf Of Anuj Mittal
Sent: den 9 november 2021 15:36
To: [email protected]; Peter Kjellerstedt
<[email protected]>
Subject: Re: [OE-core] [honister][PATCH] insane.bbclass: Add a check for
directories that are expected to be emptyQuoted 25 lines · Peter Kjellerstedt
From: Peter Kjellerstedt <[email protected]>
The empty-dirs QA check verifies that all directories specified
inQA_EMPTY_DIRSare 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.Change-Id: Ic61019528f4b22f26e42e78125a99666ae27c7f5
Signed-off-by: Peter Kjellerstedt <[email protected]>
---Compared to the corresponding patch for master, there are two differences:
Quoted 8 lines
* "
/var/volatile" is not added toQA_EMPTY_DIRSby default.
* "empty-dirs" is added toWARN_QAinstead ofERROR_QA.This should make it safe to add this QA test to Honister without
introdusing any new QA errors, while still allowing the QA test to be
activated for those who wants to use it.Does it have to be enabled by default?
Quoted 8 lines
Quoted 5 lines
Well, it doesn't have to be enabled. However, without
/var/volatileinQA_EMPTY_DIRS, there should be no warnings generated for OE-Core or
OpenEmbedded so it should not hurt to have it inWARN_QA.Right, but there could be unexpected warnings for other downstream layers in release versions.
Quoted 9 lines
True, but they would still just be warnings.
Quoted 2 lines
I think we can add the test but only for people to use it if they'd like to.
Sure, if you prefer that. Do you want me to send an updated patch, or will
you take care of it?
Please send an updated patch.
Thanks,
Anuj