All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: brian avery <brian.avery@intel.com>,
	openembedded-core@lists.openembedded.org
Subject: Re: [PATCH 1/1] gen-lockedsig-cache: catch os.link error
Date: Fri, 17 Mar 2017 08:47:22 +0000	[thread overview]
Message-ID: <1489740442.13980.134.camel@linuxfoundation.org> (raw)
In-Reply-To: <44af73e99b58322b14a9490f67c9417377404966.1489534872.git.brian.avery@intel.com>

On Tue, 2017-03-14 at 17:04 -0700, brian avery wrote:
> We do a hard link to speed up sdk creation but if your sstate-cache
> is
> across a file system boundary, this tries and fails. This patch
> catches
> that error and does a copy instead.
> 
> Signed-off-by: brian avery <brian.avery@intel.com>
> ---
>  scripts/gen-lockedsig-cache | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/scripts/gen-lockedsig-cache b/scripts/gen-lockedsig-
> cache
> index 49de74ed..1cfbeae 100755
> --- a/scripts/gen-lockedsig-cache
> +++ b/scripts/gen-lockedsig-cache
> @@ -63,6 +63,12 @@ for f in files:
>      if (os.stat(src).st_dev == os.stat(destdir).st_dev):
>          print('linking')
>          os.link(src, dst)
> +        try:
> +            os.link(src, dst)
> +        except Exception:
> +            print('hard linking failed, copying')
> +            shutil.copyfile(src, dst)
> +        os.link(src, dst)
>      else:
>          print('copying')
>          shutil.copyfile(src, dst)

Really? How many os.link() calls do we need?

Also, "Exception" without a specific exception you want to catch tends
to be a bad idea.

Cheers,

Richard




      reply	other threads:[~2017-03-17  8:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-15  0:04 [PATCH 0/1] gen-lockedsig-cache: catch os.link error brian avery
2017-03-15  0:04 ` [PATCH 1/1] " brian avery
2017-03-17  8:47   ` Richard Purdie [this message]

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=1489740442.13980.134.camel@linuxfoundation.org \
    --to=richard.purdie@linuxfoundation.org \
    --cc=brian.avery@intel.com \
    --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.