[oe-commits] Robert Yang : license.bbclass: hardlink requires write permission

git at git.openembedded.org git at git.openembedded.org
Tue Dec 23 12:02:36 UTC 2014


Module: openembedded-core.git
Branch: master-next
Commit: bf3a908bbb10ca43507a7b8f0ea13b3a8cdcdbd0
URL:    http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=bf3a908bbb10ca43507a7b8f0ea13b3a8cdcdbd0

Author: Robert Yang <liezhi.yang at windriver.com>
Date:   Wed Nov 12 23:55:58 2014 -0800

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.

Signed-off-by: Robert Yang <liezhi.yang at windriver.com>
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>

---

 meta/classes/license.bbclass | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/meta/classes/license.bbclass b/meta/classes/license.bbclass
index f85d4f9..d659b76 100644
--- a/meta/classes/license.bbclass
+++ b/meta/classes/license.bbclass
@@ -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):
     """



More information about the Openembedded-commits mailing list