diff options
author | Robert Yang <liezhi.yang@windriver.com> | 2014-01-22 18:50:20 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-02-02 11:22:11 +0000 |
commit | 47208175027686339dd18df52b60ec2c43594918 (patch) | |
tree | a615e3a7862b3098c81a6fad67586717cf91c972 | |
parent | 3ab4a2bd022d8e8723bd60d8e6a230322b97441f (diff) | |
download | poky-47208175027686339dd18df52b60ec2c43594918.tar.gz |
sanity.bbclass: check that TMPDIR is not located on nfs
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.
BTW., s/tmpdir/TMPDIR/ in the previous comment message to make them have
a uniform.
[YOCTO #5442]
(From OE-Core rev: ee4061b43522c4893b41c3be63d06be1ee7e3c70)
Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/classes/sanity.bbclass | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/meta/classes/sanity.bbclass b/meta/classes/sanity.bbclass index e5bf970db2..bae010d864 100644 --- a/meta/classes/sanity.bbclass +++ b/meta/classes/sanity.bbclass | |||
@@ -201,6 +201,21 @@ def check_path_length(filepath, pathname, limit): | |||
201 | return "The length of %s is longer than 410, this would cause unexpected errors, please use a shorter path.\n" % pathname | 201 | return "The length of %s is longer than 410, this would cause unexpected errors, please use a shorter path.\n" % pathname |
202 | return "" | 202 | return "" |
203 | 203 | ||
204 | def get_filesystem_id(path): | ||
205 | status, result = oe.utils.getstatusoutput("stat -f -c '%s' %s" % ("%t", path)) | ||
206 | if status == 0: | ||
207 | return result | ||
208 | else: | ||
209 | bb.warn("Can't get the filesystem id of: %s" % path) | ||
210 | return None | ||
211 | |||
212 | # Check that the path isn't located on nfs. | ||
213 | def check_not_nfs(path, name): | ||
214 | # The nfs' filesystem id is 6969 | ||
215 | if get_filesystem_id(path) == "6969": | ||
216 | return "The %s: %s can't be located on nfs.\n" % (name, path) | ||
217 | return "" | ||
218 | |||
204 | def check_connectivity(d): | 219 | def check_connectivity(d): |
205 | # URI's to check can be set in the CONNECTIVITY_CHECK_URIS variable | 220 | # URI's to check can be set in the CONNECTIVITY_CHECK_URIS variable |
206 | # using the same syntax as for SRC_URI. If the variable is not set | 221 | # using the same syntax as for SRC_URI. If the variable is not set |
@@ -584,9 +599,12 @@ def check_sanity_version_change(status, d): | |||
584 | if not oes_bb_conf: | 599 | if not oes_bb_conf: |
585 | status.addresult('You are not using the OpenEmbedded version of conf/bitbake.conf. This means your environment is misconfigured, in particular check BBPATH.\n') | 600 | status.addresult('You are not using the OpenEmbedded version of conf/bitbake.conf. This means your environment is misconfigured, in particular check BBPATH.\n') |
586 | 601 | ||
587 | # The length of tmpdir can't be longer than 410 | 602 | # The length of TMPDIR can't be longer than 410 |
588 | status.addresult(check_path_length(tmpdir, "TMPDIR", 410)) | 603 | status.addresult(check_path_length(tmpdir, "TMPDIR", 410)) |
589 | 604 | ||
605 | # Check that TMPDIR isn't located on nfs | ||
606 | status.addresult(check_not_nfs(tmpdir, "TMPDIR")) | ||
607 | |||
590 | def check_sanity_everybuild(status, d): | 608 | def check_sanity_everybuild(status, d): |
591 | # Sanity tests which test the users environment so need to run at each build (or are so cheap | 609 | # Sanity tests which test the users environment so need to run at each build (or are so cheap |
592 | # it makes sense to always run them. | 610 | # it makes sense to always run them. |