From: <Mikko.Rapeli@bmw.de>
To: <openembedded-core@lists.openembedded.org>
Subject: Re: [PATCH] sanity.bbclass: check SSTATE_DIR, DL_DIR and *MIRROR for broken symlinks
Date: Mon, 10 Aug 2015 08:18:45 +0000 [thread overview]
Message-ID: <20150810081845.GF6102@loska> (raw)
In-Reply-To: <1438333215-1593-1-git-send-email-mikko.rapeli@bmw.de>
On Fri, Jul 31, 2015 at 12:00:15PM +0300, Mikko Rapeli wrote:
> 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.o currently oe-core isn't
So currently patch testing and review queues are full.
Should I file bugzilla tickets with links to patches like this or
are the mailing list contributions tracked via patchwork or something?
If small changes like this are not getting merged, then I don't have confidence
in pushing bigger ones back upstream.
-Mikko
> Change-Id: I2e92702237ab3bdb897d0bdefcf33480aabbc288
> Signed-off-by: Mikko Rapeli <mikko.rapeli@bmw.de>
> ---
> meta/classes/sanity.bbclass | 25 +++++++++++++++++++++++--
> 1 file changed, 23 insertions(+), 2 deletions(-)
>
> diff --git a/meta/classes/sanity.bbclass b/meta/classes/sanity.bbclass
> index 5be5efb..45ca992 100644
> --- a/meta/classes/sanity.bbclass
> +++ b/meta/classes/sanity.bbclass
> @@ -253,6 +253,12 @@ 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):
> + if os.path.islink(lnk) and not os.path.exists(lnk):
> + return False
> + return True
> +
> 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
> @@ -532,6 +538,8 @@ def check_sanity_sstate_dir_change(sstate_dir, data):
> # Check that SSTATE_DIR isn't on a filesystem with limited filename length (eg. eCryptFS)
> testmsg = ""
> if sstate_dir != "":
> + if not check_symlink(sstate_dir):
> + raise_sanity_error("SSTATE_DIR %s is a broken symlink." % sstate_dir, data)
> testmsg = check_create_long_filename(sstate_dir, "SSTATE_DIR")
> # If we don't have permissions to SSTATE_DIR, suggest the user set it as an SSTATE_MIRRORS
> try:
> @@ -695,6 +703,8 @@ 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)
> + if not check_symlink(dldir):
> + status.addresult("DL_DIR: %s is a broken symlink." % dldir)
>
> # Check that the MACHINE is valid, if it is set
> machinevalid = True
> @@ -788,8 +798,19 @@ 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
> + if not check_symlink(urlparse.urlparse(mirror).path):
> + raise_sanity_error("Mirror %s is a broken symlink." % mirror_entry, 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
> + if not check_symlink(mirror_base):
> + raise_sanity_error("State mirror %s is a broken symlink." % mirror_base, d)
>
> # Check that TMPDIR hasn't changed location since the last time we were run
> tmpdir = d.getVar('TMPDIR', True)
> --
> 2.4.6
>
next prev parent reply other threads:[~2015-08-10 8:31 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-31 9:00 [PATCH] sanity.bbclass: check SSTATE_DIR, DL_DIR and *MIRROR for broken symlinks Mikko Rapeli
2015-08-10 8:18 ` Mikko.Rapeli [this message]
2015-08-10 9:10 ` Mike Looijmans
2015-08-10 11:48 ` Mikko.Rapeli
2015-08-10 14:00 ` [PATCH v2] " Mikko Rapeli
2015-08-10 16:35 ` [PATCH] " Burton, Ross
2015-08-10 17:02 ` Mikko.Rapeli
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150810081845.GF6102@loska \
--to=mikko.rapeli@bmw.de \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.