[OE-core] [PATCH 1/1] gen-lockedsig-cache: catch os.link error
Richard Purdie
richard.purdie at linuxfoundation.org
Fri Mar 17 08:47:22 UTC 2017
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 at 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
More information about the Openembedded-core
mailing list