Hi Richard,

Is it possible to use an opposite way for pseudo path filtering?
Instead of ignoring paths, only take into consideration paths in something like PSEUDO_CONSIDER_PATHS.
The list should be short. ${D}, ${PKGD}, ${PKGDEST}, ${IMAGE_ROOTFS}?

Best Regards,
Chen Qi

On 01/26/2021 07:54 AM, Richard Purdie wrote:
On Tue, 2021-01-26 at 00:08 +0100, Dorinda wrote:
If a user builds in a path in PSEUDO_IGNORE_PATHS, random failures are generated. Hence this patch adds a sanity check in sanity.bbclass to ensure that a user isn't building in PSEUDO_IGNORE_PATHS.

[YOCTO #14179]

Signed-off-by: Dorinda Bassey <dorindabassey@gmail.com>
---
 meta/classes/sanity.bbclass | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/meta/classes/sanity.bbclass b/meta/classes/sanity.bbclass
index 2040b48595..14271c1ca9 100644
--- a/meta/classes/sanity.bbclass
+++ b/meta/classes/sanity.bbclass
@@ -703,6 +703,13 @@ def check_sanity_version_change(status, d):
     if (tmpdirmode & stat.S_ISUID):
         status.addresult("TMPDIR is setuid, please don't build in a setuid directory")
 



+    # Check that a user isn't building in a path in PSEUDO_IGNORE_PATHS
+    pseudoignorepaths = d.getVar('PSEUDO_IGNORE_PATHS', expand=True).split(",")
+    workdir = d.getVar('WORKDIR', expand=True)
+    for i in pseudoignorepaths:
+        if i and workdir.startswith(i):
+            status.addresult("You are building in a path in PSEUDO_IGNORE_PATHS: " + str(i) + " please don't build in this directory: " + str(workdir) + "\n")

To ensure the user fully understands this, should this be something
like:


status.addresult("You are building in a path included in
PSEUDO_IGNORE_PATHS " + str(i) + " which will not work, please locate
the build outside this path.\n")

as we then tell the user what to do (and don't repeat effectively the
same information twice).

Cheers,

Richard