]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
license: Improve disk usage
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 12 Sep 2014 15:39:49 +0000 (16:39 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 16 Sep 2014 21:12:29 +0000 (22:12 +0100)
Currently copies of the license files are made which wastes disk space
and adversely affects performance. We can link these instead in most
cases for small performance gains.

(From OE-Core rev: 0b0f3631fd22f731b6aeedb73965e367b695028b)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes/license.bbclass

index 601f5611cc10592c8946adb89601724d49172dd8..a34ea39493c785bed710435654f54e246cf9686f 100644 (file)
@@ -145,7 +145,14 @@ def copy_license_files(lic_files_paths, destdir):
     bb.utils.mkdirhier(destdir)
     for (basename, path) in lic_files_paths:
         try:
-            ret = shutil.copyfile(path, os.path.join(destdir, basename))
+            src = path
+            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):
+                os.link(src, dst)
+            else:
+                shutil.copyfile(src, dst)
         except Exception as e:
             bb.warn("Could not copy license file %s: %s" % (basename, e))