diff options
| author | Mikko Rapeli <mikko.rapeli@bmw.de> | 2015-08-10 17:00:23 +0300 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-08-11 09:28:50 -0700 |
| commit | f820d0275f25917a4e279da3637a0d4cbd02c1ad (patch) | |
| tree | 5c5179594fe174784a01b044a262d66bffe6e0d4 | |
| parent | 9d8a725a8cb42bf5eef5ad8c27c8a4777566f3fa (diff) | |
| download | poky-f820d0275f25917a4e279da3637a0d4cbd02c1ad.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
(From OE-Core rev: f635b9c00aa8a69130e471b9507f263a1ba081ff)
Signed-off-by: Mikko Rapeli <mikko.rapeli@bmw.de>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -rw-r--r-- | meta/classes/sanity.bbclass | 21 |
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): | |||
| 259 | return "The %s: %s can't be located on nfs.\n" % (name, path) | 259 | return "The %s: %s can't be located on nfs.\n" % (name, path) |
| 260 | return "" | 260 | return "" |
| 261 | 261 | ||
| 262 | # Check that path isn't a broken symlink | ||
| 263 | def check_symlink(lnk, data): | ||
| 264 | if os.path.islink(lnk) and not os.path.exists(lnk): | ||
| 265 | raise_sanity_error("%s is a broken symlink." % lnk, data) | ||
| 266 | |||
| 262 | def check_connectivity(d): | 267 | def check_connectivity(d): |
| 263 | # URI's to check can be set in the CONNECTIVITY_CHECK_URIS variable | 268 | # URI's to check can be set in the CONNECTIVITY_CHECK_URIS variable |
| 264 | # using the same syntax as for SRC_URI. If the variable is not set | 269 | # using the same syntax as for SRC_URI. If the variable is not set |
| @@ -718,6 +723,7 @@ def check_sanity_everybuild(status, d): | |||
| 718 | 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") | 723 | 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") |
| 719 | if os.path.exists(dldir) and not os.access(dldir, os.W_OK): | 724 | if os.path.exists(dldir) and not os.access(dldir, os.W_OK): |
| 720 | status.addresult("DL_DIR: %s exists but you do not appear to have write access to it. \n" % dldir) | 725 | status.addresult("DL_DIR: %s exists but you do not appear to have write access to it. \n" % dldir) |
| 726 | check_symlink(dldir, d) | ||
| 721 | 727 | ||
| 722 | # Check that the MACHINE is valid, if it is set | 728 | # Check that the MACHINE is valid, if it is set |
| 723 | machinevalid = True | 729 | machinevalid = True |
| @@ -811,8 +817,17 @@ def check_sanity_everybuild(status, d): | |||
| 811 | bb.warn('Invalid protocol in %s: %s' % (mirror_var, mirror_entry)) | 817 | bb.warn('Invalid protocol in %s: %s' % (mirror_var, mirror_entry)) |
| 812 | continue | 818 | continue |
| 813 | 819 | ||
| 814 | if mirror.startswith('file://') and not mirror.startswith('file:///'): | 820 | if mirror.startswith('file://'): |
| 815 | bb.warn('Invalid file url in %s: %s, must be absolute path (file:///)' % (mirror_var, mirror_entry)) | 821 | if not mirror.startswith('file:///'): |
| 822 | bb.warn('Invalid file url in %s: %s, must be absolute path (file:///)' % (mirror_var, mirror_entry)) | ||
| 823 | import urlparse | ||
| 824 | check_symlink(urlparse.urlparse(mirror).path, d) | ||
| 825 | # SSTATE_MIRROR ends with a /PATH string | ||
| 826 | if mirror.endswith('/PATH'): | ||
| 827 | # remove /PATH$ from SSTATE_MIRROR to get a working | ||
| 828 | # base directory path | ||
| 829 | mirror_base = urlparse.urlparse(mirror[:-1*len('/PATH')]).path | ||
| 830 | check_symlink(mirror_base, d) | ||
| 816 | 831 | ||
| 817 | # Check that TMPDIR hasn't changed location since the last time we were run | 832 | # Check that TMPDIR hasn't changed location since the last time we were run |
| 818 | tmpdir = d.getVar('TMPDIR', True) | 833 | tmpdir = d.getVar('TMPDIR', True) |
| @@ -860,6 +875,8 @@ def check_sanity(sanity_data): | |||
| 860 | tmpdir = sanity_data.getVar('TMPDIR', True) | 875 | tmpdir = sanity_data.getVar('TMPDIR', True) |
| 861 | sstate_dir = sanity_data.getVar('SSTATE_DIR', True) | 876 | sstate_dir = sanity_data.getVar('SSTATE_DIR', True) |
| 862 | 877 | ||
| 878 | check_symlink(sstate_dir, sanity_data) | ||
| 879 | |||
| 863 | # Check saved sanity info | 880 | # Check saved sanity info |
| 864 | last_sanity_version = 0 | 881 | last_sanity_version = 0 |
| 865 | last_tmpdir = "" | 882 | last_tmpdir = "" |
