Skip to contentSkip to conversation

sanity.bbclass: check that TMPDIR is not located on nfs

PATCH In review Robert Yang 2 participants 5 messages Nov 1, 2013

lore
Share & tools
lore
#0 lore raw

cover sanity.bbclass: check that TMPDIR is not located on nfs

The following changes since commit 523f2a9ea970713fb775bc48f84b67420b1106a0:

cross-canadian: Improve comment (2013-10-30 18:01:34 +0000)

are available in the git repository at:

git://git.pokylinux.org/poky-contrib rbty/nfs_check
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=rbty/nfs_check

Robert Yang (2):
sanity.bbclass: move check_path_length(TMPDIR) to
check_sanity_everybuild
sanity.bbclass: check that TMPDIR is not located on nfs

 meta/classes/sanity.bbclass | 24 +++++++++++++++++++++---
 1 file changed, 21 insertions(+), 3 deletions(-)
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH 1/2 sanity.bbclass: move check_path_length(TMPDIR) to check_sanity_everybuild

We may change the TMPDIR in different builds, so that the check_path_length(TMPDIR) should be in check_sanity_everybuild().

[YOCTO #5442]

---
 meta/classes/sanity.bbclass | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
meta/classes/sanity.bbclass +3 -3
index b8e5b02..c4827f4 100644
@@ -569,9 +569,6 @@ def check_sanity_version_change(status, d):
     if not oes_bb_conf:
         status.addresult('You are not using the OpenEmbedded version of conf/bitbake.conf. This means your environment is misconfigured, in particular check BBPATH.\n')
 
-    # The length of tmpdir can't be longer than 410
-    status.addresult(check_path_length(tmpdir, "TMPDIR", 410))
-
 def check_sanity_everybuild(status, d):
     # Sanity tests which test the users environment so need to run at each build (or are so cheap
     # it makes sense to always run them.
@@ -672,6 +669,9 @@ def check_sanity_everybuild(status, d):
         with open(checkfile, "w") as f:
             f.write(tmpdir)
 
+    # The length of TMPDIR can't be longer than 410
+    status.addresult(check_path_length(tmpdir, "TMPDIR", 410))
+
 def check_sanity(sanity_data):
     import subprocess
 
Signature · 1 line
1.8.3.1
#3 lore raw

PATCH 2/2 sanity.bbclass: check that TMPDIR is not located on nfs

In reply to Robert Yang

There would be some unexpected errors when the whole TMPDIR is located on nfs, so add a test for it in sanity.bbclass.

Note:
The better way to get the filesystem id should be get f_fsid from struct statvfs, but there is no f_fsid in os.stat() or os.statvfs(), so we use 'stat -f -c "%t"' here.

[YOCTO #5442]

---
 meta/classes/sanity.bbclass | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
meta/classes/sanity.bbclass +18 -0
index c4827f4..7517120 100644
@@ -198,6 +198,21 @@ def check_path_length(filepath, pathname, limit):
         return "The length of %s is longer than 410, this would cause unexpected errors, please use a shorter path.\n" % pathname
     return ""
 
+def get_filesystem_id(path):
+    status, result = oe.utils.getstatusoutput("stat -f -c '%s' %s" % ("%t", path))
+    if status == 0:
+        return result
+    else:
+        bb.warn("Can't get the filesystem id of: %s" % path)
+        return None
+
+# Check that the path isn't located on nfs.
+def check_not_nfs(path, name):
+    # The nfs' filesystem id is 6969
+    if get_filesystem_id(path) == "6969":
+        return "The %s can't be located on nfs.\n" % name
+    return ""
+
 def check_connectivity(d):
     # URI's to check can be set in the CONNECTIVITY_CHECK_URIS variable
     # using the same syntax as for SRC_URI. If the variable is not set
@@ -672,6 +687,9 @@ def check_sanity_everybuild(status, d):
     # The length of TMPDIR can't be longer than 410
     status.addresult(check_path_length(tmpdir, "TMPDIR", 410))
 
+    # Check that TMPDIR isn't located on nfs
+    status.addresult(check_not_nfs(tmpdir, "TMPDIR"))
+
 def check_sanity(sanity_data):
     import subprocess
 
Signature · 1 line
1.8.3.1
#2 lore raw

Re: [PATCH 1/2] sanity.bbclass: move check_path_length(TMPDIR) to check_sanity_everybuild

In reply to Robert Yang
Quoted 9 lines · Robert Yang

We may change the TMPDIR in different builds, so that the check_path_length(TMPDIR) should be in check_sanity_everybuild().

[YOCTO #5442]

---
 meta/classes/sanity.bbclass | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

No.

The stamp than controls these checks is in tmpdir. We detect if tmpdir moves and error. If we change to a new tmpdir, there will be no stamp and the check reruns. There is no need to do this every build.

Cheers,

Richard

Quoted 24 lines
meta/classes/sanity.bbclass +3 -3
index b8e5b02..c4827f4 100644
@@ -569,9 +569,6 @@ def check_sanity_version_change(status, d):
     if not oes_bb_conf:
         status.addresult('You are not using the OpenEmbedded version of conf/bitbake.conf. This means your environment is misconfigured, in particular check BBPATH.\n')
 
-    # The length of tmpdir can't be longer than 410
-    status.addresult(check_path_length(tmpdir, "TMPDIR", 410))
-
 def check_sanity_everybuild(status, d):
     # Sanity tests which test the users environment so need to run at each build (or are so cheap
     # it makes sense to always run them.
@@ -672,6 +669,9 @@ def check_sanity_everybuild(status, d):
         with open(checkfile, "w") as f:
             f.write(tmpdir)
 
+    # The length of TMPDIR can't be longer than 410
+    status.addresult(check_path_length(tmpdir, "TMPDIR", 410))
+
 def check_sanity(sanity_data):
     import subprocess
 
#4 lore raw
In reply to Robert Yang
Quoted 8 lines · Robert Yang

There would be some unexpected errors when the whole TMPDIR is located on nfs, so add a test for it in sanity.bbclass.

Note:
The better way to get the filesystem id should be get f_fsid from struct statvfs, but there is no f_fsid in os.stat() or os.statvfs(), so we use 'stat -f -c "%t"' here.

Quoted 6 lines

[YOCTO #5442]

---
 meta/classes/sanity.bbclass | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

Why does this need to run every build? It doesn't so don't do that please.

Cheers,

Richard

Quoted 36 lines
meta/classes/sanity.bbclass +18 -0
index c4827f4..7517120 100644
@@ -198,6 +198,21 @@ def check_path_length(filepath, pathname, limit):
         return "The length of %s is longer than 410, this would cause unexpected errors, please use a shorter path.\n" % pathname
     return ""
 
+def get_filesystem_id(path):
+    status, result = oe.utils.getstatusoutput("stat -f -c '%s' %s" % ("%t", path))
+    if status == 0:
+        return result
+    else:
+        bb.warn("Can't get the filesystem id of: %s" % path)
+        return None
+
+# Check that the path isn't located on nfs.
+def check_not_nfs(path, name):
+    # The nfs' filesystem id is 6969
+    if get_filesystem_id(path) == "6969":
+        return "The %s can't be located on nfs.\n" % name
+    return ""
+
 def check_connectivity(d):
     # URI's to check can be set in the CONNECTIVITY_CHECK_URIS variable
     # using the same syntax as for SRC_URI. If the variable is not set
@@ -672,6 +687,9 @@ def check_sanity_everybuild(status, d):
     # The length of TMPDIR can't be longer than 410
     status.addresult(check_path_length(tmpdir, "TMPDIR", 410))
 
+    # Check that TMPDIR isn't located on nfs
+    status.addresult(check_not_nfs(tmpdir, "TMPDIR"))
+
 def check_sanity(sanity_data):
     import subprocess