From: Randy Witt Date: Mon, 23 Feb 2015 17:00:35 +0000 (+0000) Subject: gen-lockedsig-cache: Allow cross-filesystem copies. X-Git-Tag: lucaceresoli/bug-15201-perf-libtraceevent-missing~31131 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cf675896340ebed7c4830b93d791ddb08999031f;p=thirdparty%2Fopenembedded%2Fopenembedded-core-contrib.git gen-lockedsig-cache: Allow cross-filesystem copies. Since this previously always tried to use hardlinks you couldn't have the source and destination be on different devices. This change allows for that and also prevents failure in situations where the files already existed. Signed-off-by: Randy Witt Signed-off-by: Richard Purdie --- diff --git a/scripts/gen-lockedsig-cache b/scripts/gen-lockedsig-cache index dfb282efd4a..c93b2c0b99b 100755 --- a/scripts/gen-lockedsig-cache +++ b/scripts/gen-lockedsig-cache @@ -35,6 +35,12 @@ for s in sigs: for f in files: dst = f.replace(sys.argv[2], sys.argv[3]) - mkdir(os.path.dirname(dst)) - os.link(f, dst) + destdir = os.path.dirname(dst) + mkdir(destdir) + if os.path.exists(dst): + os.remove(dst) + if (os.stat(f).st_dev == os.stat(destdir).st_dev): + os.link(f, dst) + else: + shutil.copyfile(f, dst)