sanity.bbclass: TMPDIR and sanity_info related fixes
v2 cover sanity.bbclass: TMPDIR and sanity_info related fixes
* V2:
- Move ${TOPDIR}/conf/sanity_info to ${TMPDIR}, we need update the document for this change.
// Robert
The following changes since commit 9160f376065752e2e92c8b37ee9a80d0eb86b53b:
bitbake: toaster: enable required classes in the toaster startup script (2013-11-04 09:36:22 +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 (4):
sanity.bbclass: move conf/sanity_info into TMPDIR sanity.bbclass: check that TMPDIR is not located on nfs sanity.bbclass: remove the obsolete variable last_tmpdir build-perf-test.sh: cleanup conf/sanity_info
meta/classes/sanity.bbclass | 26 ++++++++++++++++++++------ scripts/contrib/build-perf-test.sh | 2 +- 2 files changed, 21 insertions(+), 7 deletions(-)
Signature · 1 line
1.8.3.1
PATCH v2 1/4 sanity.bbclass: move conf/sanity_info into TMPDIR
Move conf/sanity_info into TMPDIR, otherwise, when we reset TMPDIR to another dir, the SANITY_VERSION from conf/sanity_info and sanity_data.getVar('SANITY_VERSION', True) are still the same, so that the check_sanity_version_change() would not rerun.
Another fix is that we can move the TMPDIR/saved_tmpdir to conf dir, but that will make we can't reset the TMPDIR.
[YOCTO #5442]
--- meta/classes/sanity.bbclass | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes/sanity.bbclass +1 -1
@@ -694,7 +694,7 @@ def check_sanity(sanity_data): last_sanity_version = 0 last_tmpdir = "" last_sstate_dir = "" - sanityverfile = sanity_data.expand("${TOPDIR}/conf/sanity_info") + sanityverfile = os.path.join(tmpdir, "sanity_info") if os.path.exists(sanityverfile): with open(sanityverfile, 'r') as f: for line in f:
Signature · 1 line
1.8.3.1
PATCH v2 2/4 sanity.bbclass: check that TMPDIR is not located on nfs
In reply to Robert YangThere 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]
--- meta/classes/sanity.bbclass | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-)
meta/classes/sanity.bbclass +19 -1
@@ -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: %s can't be located on nfs.\n" % (name, path) + 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
@@ -569,9 +584,12 @@ 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 + # 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_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.
Signature · 1 line
1.8.3.1
PATCH v2 3/4 sanity.bbclass: remove the obsolete variable last_tmpdir
In reply to Robert YangThe variable last_tmpdir which is read from the sanity_info file had been used by check_sanity_tmpdir_change(), but the function was removed, the check had been moved into check_sanity_version_change(), so we can remove last_tmpdir and we don't need to save the TMPDIR in the sanity_info file anymore.
[YOCTO #5442]
--- meta/classes/sanity.bbclass | 4 ---- 1 file changed, 4 deletions(-)
meta/classes/sanity.bbclass +0 -4
@@ -710,7 +710,6 @@ def check_sanity(sanity_data): # Check saved sanity info last_sanity_version = 0 - last_tmpdir = "" last_sstate_dir = "" sanityverfile = os.path.join(tmpdir, "sanity_info") if os.path.exists(sanityverfile):
@@ -718,8 +717,6 @@ def check_sanity(sanity_data): for line in f: if line.startswith('SANITY_VERSION'): last_sanity_version = int(line.split()[1]) - if line.startswith('TMPDIR'): - last_tmpdir = line.split()[1] if line.startswith('SSTATE_DIR'): last_sstate_dir = line.split()[1]
@@ -737,7 +734,6 @@ def check_sanity(sanity_data): if os.path.exists(os.path.dirname(sanityverfile)) and not status.messages: with open(sanityverfile, 'w') as f: f.write("SANITY_VERSION %s\n" % sanity_version) - f.write("TMPDIR %s\n" % tmpdir) f.write("SSTATE_DIR %s\n" % sstate_dir) sanity_handle_abichanges(status, sanity_data)
Signature · 1 line
1.8.3.1
PATCH v2 4/4 build-perf-test.sh: cleanup conf/sanity_info
In reply to Robert YangThe conf/sanity_info is in TMPDIR now, it would be removed when TMPDIR is removed.
[YOCTO #5442]
--- scripts/contrib/build-perf-test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/contrib/build-perf-test.sh +1 -1
@@ -227,7 +227,7 @@ bbnotime () { do_rmtmp() { log " Removing tmp" - rm -rf bitbake.lock pseudodone conf/sanity_info cache tmp + rm -rf bitbake.lock pseudodone cache tmp } do_rmsstate () { log " Removing sstate-cache"
Signature · 1 line
1.8.3.1