Skip to contentSkip to conversation

systemd: Do not install anything in /var/volatile

PATCH Superseded Peter Kjellerstedt 4 participants 7 messages Oct 29, 2021 – Nov 4, 2021

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/3 systemd: Do not install anything in /var/volatile

/var/log is typically a symbolic link to inside /var/volatile, which is expected to be empty. Check ${VOLATILE_LOG_DIR} to see if it is ok to install /var/log.

---

PATCHv2: Added check for ${VOLATILE_LOG_DIR} before removing /var/log.
PATCHv3: No changes.

 meta/recipes-core/systemd/systemd_249.5.bb | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)
meta/recipes-core/systemd/systemd_249.5.bb +9 -6
index d87f54bf16..c0c1f9bcfc 100644
@@ -270,13 +270,16 @@ do_install() {
 		install -Dm 0755 ${S}/src/systemctl/systemd-sysv-install.SKELETON ${D}${systemd_system_unitdir}d-sysv-install
 	fi
 
-	chown root:systemd-journal ${D}/${localstatedir}/log/journal
-
-	# Delete journal README, as log can be symlinked inside volatile.
-	rm -f ${D}/${localstatedir}/log/README
+	if "${@'true' if oe.types.boolean(d.getVar('VOLATILE_LOG_DIR')) else 'false'}"; then
+		# /var/log is typically a symbolic link to inside /var/volatile,
+		# which is expected to be empty.
+		rm -rf ${D}${localstatedir}/log
+	else
+		chown root:systemd-journal ${D}${localstatedir}/log/journal
 
-	# journal-remote creates this at start
-	rm -rf ${D}/${localstatedir}/log/journal/remote
+		# journal-remote creates this at start
+		rm -rf ${D}${localstatedir}/log/journal/remote
+	fi
 
 	install -d ${D}${systemd_system_unitdir}/graphical.target.wants
 	install -d ${D}${systemd_system_unitdir}/multi-user.target.wants
#1 lore raw

PATCH v3 2/3 base-files: Ignore the empty-dirs QA error due to files in /var/volatile

---

PATCHv3: An alternative to skipping the empty-dirs QA test for base-files would be to remove /var/volatile/tmp and /var/volatile/log, but I do not know if there are any consequences of doing that, e.g., due to them not existing before the tmpfs has been mounted on top of /var/volatile. Thus I have left them in place.

 meta/recipes-core/base-files/base-files_3.0.14.bb | 2 ++
 1 file changed, 2 insertions(+)
meta/recipes-core/base-files/base-files_3.0.14.bb +2 -0
index 032827a0d0..c3ecd81c4a 100644
@@ -182,3 +182,5 @@ PACKAGE_ARCH = "${MACHINE_ARCH}"
 
 CONFFILES:${PN} = "${sysconfdir}/fstab ${@['', '${sysconfdir}/hostname ${sysconfdir}/hosts'][(d.getVar('hostname') != '')]} ${sysconfdir}/shells"
 CONFFILES:${PN} += "${sysconfdir}/motd ${sysconfdir}/nsswitch.conf ${sysconfdir}/profile"
+
+INSANE_SKIP:${PN} += "empty-dirs"
#2 lore raw

PATCH v3 3/3 insane.bbclass: Add a check for directories that are expected to be empty

In reply to Peter Kjellerstedt

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.

---

PATCHv2: No changes.
PATCHv3: No changes.

 meta/classes/insane.bbclass  | 33 ++++++++++++++++++++++++++++++++-
 meta/conf/documentation.conf |  2 ++
 2 files changed, 34 insertions(+), 1 deletion(-)
meta/classes/insane.bbclass +32 -1
index 1e2f1b768a..1675adf6ac 100644
@@ -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
meta/conf/documentation.conf +2 -0
index 80ad8e10d5..45cd01374a 100644
@@ -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
#3 lore raw

Re: [OE-core] [PATCHv3 3/3] insane.bbclass: Add a check for directories that are expected to be empty

Quoted 80 lines · Peter Kjellerstedt

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.

---

PATCHv2: No changes.
PATCHv3: No changes.

 meta/classes/insane.bbclass  | 33 ++++++++++++++++++++++++++++++++-
 meta/conf/documentation.conf |  2 ++
 2 files changed, 34 insertions(+), 1 deletion(-)
meta/classes/insane.bbclass +32 -1
index 1e2f1b768a..1675adf6ac 100644
@@ -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
meta/conf/documentation.conf +0 -0
index 80ad8e10d5..45cd01374a 100644

meta/conf/documentation.conf PYPI_SRC_URI[doc] = "The URI to use to fetch from pypi, default uses pythonhoste · line 351

Quoted 7 lines
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."
 

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

Cheers,

Richard

#4 lore raw

Re: [OE-core] [PATCHv3 3/3] insane.bbclass: Add a check for directories that are expected to be empty

Quoted 92 lines · Richard Purdie
Quoted 80 lines · Peter Kjellerstedt

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.

---

PATCHv2: No changes.
PATCHv3: No changes.

 meta/classes/insane.bbclass  | 33 ++++++++++++++++++++++++++++++++-
 meta/conf/documentation.conf |  2 ++
 2 files changed, 34 insertions(+), 1 deletion(-)
meta/classes/insane.bbclass +32 -1
index 1e2f1b768a..1675adf6ac 100644
@@ -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
meta/conf/documentation.conf +0 -0
index 80ad8e10d5..45cd01374a 100644

meta/conf/documentation.conf PYPI_SRC_URI[doc] = "The URI to use to fetch from pypi, default uses pythonhoste · line 351

Quoted 7 lines
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."
 

This triggered:

Quoted 5 lines

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

Quoted 14 lines

Cheers,

Richard

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#157657): https://lists.openembedded.org/g/openembedded-core/message/157657
Mute This Topic: https://lists.openembedded.org/mt/86687486/1997914
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#5 lore raw

RE: [OE-core] [PATCHv3 3/3] insane.bbclass: Add a check for directories that are expected to be empty

Quoted 104 lines

-----Original Message-----
From: Khem Raj <[email protected]>
Sent: den 1 november 2021 02:00
To: Richard Purdie <[email protected]>
Cc: Peter Kjellerstedt <[email protected]>; Patches and discussions about the oe-core layer <openembedded- [email protected]>
Subject: Re: [OE-core] [PATCHv3 3/3] insane.bbclass: Add a check for directories that are expected to be empty

Quoted 92 lines · Richard Purdie
Quoted 80 lines · Peter Kjellerstedt

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.

---

PATCHv2: No changes.
PATCHv3: No changes.

 meta/classes/insane.bbclass  | 33 ++++++++++++++++++++++++++++++++-
 meta/conf/documentation.conf |  2 ++
 2 files changed, 34 insertions(+), 1 deletion(-)
meta/classes/insane.bbclass +32 -1
index 1e2f1b768a..1675adf6ac 100644
@@ -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
meta/conf/documentation.conf +0 -0
index 80ad8e10d5..45cd01374a 100644

meta/conf/documentation.conf PYPI_SRC_URI[doc] = "The URI to use to fetch from pypi, default uses pythonhoste · line 351

Quoted 7 lines
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."
 

This triggered:

Quoted 8 lines
Quoted 5 lines

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.

Quoted 4 lines
Quoted 4 lines

Cheers,

Richard

//Peter

#6 lore raw

Re: [OE-core] [PATCHv3 3/3] insane.bbclass: Add a check for directories that are expected to be empty

Quoted 108 lines · Peter Kjellerstedt
Quoted 108 lines

-----Original Message-----
From: Khem Raj <[email protected]>
Sent: den 1 november 2021 02:00
To: Richard Purdie <[email protected]>
Cc: Peter Kjellerstedt <[email protected]>; Patches and discussions about the oe-core layer <openembedded- [email protected]>
Subject: Re: [OE-core] [PATCHv3 3/3] insane.bbclass: Add a check for directories that are expected to be empty

Quoted 95 lines · Richard Purdie
Quoted 80 lines · Peter Kjellerstedt

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.

---

PATCHv2: No changes.
PATCHv3: No changes.

 meta/classes/insane.bbclass  | 33 ++++++++++++++++++++++++++++++++-
 meta/conf/documentation.conf |  2 ++
 2 files changed, 34 insertions(+), 1 deletion(-)
meta/classes/insane.bbclass +32 -1
index 1e2f1b768a..1675adf6ac 100644
@@ -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
meta/conf/documentation.conf +0 -0
index 80ad8e10d5..45cd01374a 100644

meta/conf/documentation.conf PYPI_SRC_URI[doc] = "The URI to use to fetch from pypi, default uses pythonhoste · line 351

Quoted 7 lines
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."
 

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.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

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.

FWIW there are few more failures found
https://errors.yoctoproject.org/Errors/Build/135082/
I am looking at iptraf-ng and monkey

Quoted 8 lines
Quoted 5 lines
Quoted 5 lines

Cheers,

Richard

//Peter