license.bbclass: hardlink requires write permission

Fixed:
* The os.link() reqiures write permission on the src file (suppose the
  src file belongs to another user, then you need write permission to harlink to
  it since the link count would change)

* Print more info when failed to copy
  The warning was like:
  WARNING: Could not copy license file COPYING: [Errno 1] Operation not permitted

  We couldn't know which recipe print the warning from this message.

(From OE-Core rev: ebc185186c36fe839008d94dbfb779383df960c7)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Robert Yang authored and Richard Purdie committed 2014-12-25 08:18:13 +00:00
1 parent ccd2f54d5e
commit bcc548c750
1 file changed
+2 -2
+2 -2
View File
@@ -150,12 +150,12 @@ def copy_license_files(lic_files_paths, destdir):
dst = os.path.join(destdir, basename)
if os.path.exists(dst):
os.remove(dst)
if (os.stat(src).st_dev == os.stat(destdir).st_dev):
if os.access(src, os.W_OK) and (os.stat(src).st_dev == os.stat(destdir).st_dev):
os.link(src, dst)
else:
shutil.copyfile(src, dst)
except Exception as e:
bb.warn("Could not copy license file %s: %s" % (basename, e))
bb.warn("Could not copy license file %s to %s: %s" % (src, dst, e))
def find_license_files(d):
"""