aboutsummaryrefslogtreecommitdiffstats
path: root/meta/classes/sanity.bbclass
diff options
context:
space:
mode:
authorMikko Rapeli <mikko.rapeli@bmw.de>2015-08-10 17:00:23 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-08-11 08:53:45 -0700
commitf635b9c00aa8a69130e471b9507f263a1ba081ff (patch)
treec1a35bab351cc4c1f3040082f0b2b580b92fc385 /meta/classes/sanity.bbclass
parent4b35871f0883ded624c6d5dd9bbf3365934c0e93 (diff)
downloadopenembedded-core-contrib-f635b9c00aa8a69130e471b9507f263a1ba081ff.tar.gz
sanity.bbclass: check SSTATE_DIR, DL_DIR and *MIRROR for broken symlinks
This change makes broken symlinks stand out clearly instead of bitbake failing with odd error messages. Tested locally with broken symlink as SSTATE_DIR, DL_DIR and SSTATE_MIRROR. Change-Id: I2e92702237ab3bdb897d0bdefcf33480aabbc288 Signed-off-by: Mikko Rapeli <mikko.rapeli@bmw.de> Signed-off-by: Ross Burton <ross.burton@intel.com>
Diffstat (limited to 'meta/classes/sanity.bbclass')
-rw-r--r--meta/classes/sanity.bbclass21
1 files changed, 19 insertions, 2 deletions
diff --git a/meta/classes/sanity.bbclass b/meta/classes/sanity.bbclass
index 6ad620b0a4..ef90fc82b5 100644
--- a/meta/classes/sanity.bbclass
+++ b/meta/classes/sanity.bbclass
@@ -259,6 +259,11 @@ def check_not_nfs(path, name):
return "The %s: %s can't be located on nfs.\n" % (name, path)
return ""
+# Check that path isn't a broken symlink
+def check_symlink(lnk, data):
+ if os.path.islink(lnk) and not os.path.exists(lnk):
+ raise_sanity_error("%s is a broken symlink." % lnk, data)
+
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
@@ -718,6 +723,7 @@ def check_sanity_everybuild(status, d):
status.addresult("DL_DIR is not set. Your environment is misconfigured, check that DL_DIR is set, and if the directory exists, that it is writable. \n")
if os.path.exists(dldir) and not os.access(dldir, os.W_OK):
status.addresult("DL_DIR: %s exists but you do not appear to have write access to it. \n" % dldir)
+ check_symlink(dldir, d)
# Check that the MACHINE is valid, if it is set
machinevalid = True
@@ -811,8 +817,17 @@ def check_sanity_everybuild(status, d):
bb.warn('Invalid protocol in %s: %s' % (mirror_var, mirror_entry))
continue
- if mirror.startswith('file://') and not mirror.startswith('file:///'):
- bb.warn('Invalid file url in %s: %s, must be absolute path (file:///)' % (mirror_var, mirror_entry))
+ if mirror.startswith('file://'):
+ if not mirror.startswith('file:///'):
+ bb.warn('Invalid file url in %s: %s, must be absolute path (file:///)' % (mirror_var, mirror_entry))
+ import urlparse
+ check_symlink(urlparse.urlparse(mirror).path, d)
+ # SSTATE_MIRROR ends with a /PATH string
+ if mirror.endswith('/PATH'):
+ # remove /PATH$ from SSTATE_MIRROR to get a working
+ # base directory path
+ mirror_base = urlparse.urlparse(mirror[:-1*len('/PATH')]).path
+ check_symlink(mirror_base, d)
# Check that TMPDIR hasn't changed location since the last time we were run
tmpdir = d.getVar('TMPDIR', True)
@@ -860,6 +875,8 @@ def check_sanity(sanity_data):
tmpdir = sanity_data.getVar('TMPDIR', True)
sstate_dir = sanity_data.getVar('SSTATE_DIR', True)
+ check_symlink(sstate_dir, sanity_data)
+
# Check saved sanity info
last_sanity_version = 0
last_tmpdir = ""