[OE-core] [PATCHv2 5/8] license_class: license_manifest_creation improvment copying licenses to target

Aníbal Limón anibal.limon at linux.intel.com
Tue Nov 4 17:14:57 UTC 2014


Do a hardlink for license.manifest and licenses instead of copy this helps in
reduce disk usage when rootfs is built.

Signed-off-by: Aníbal Limón <anibal.limon at linux.intel.com>
---
 meta/classes/license.bbclass | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/meta/classes/license.bbclass b/meta/classes/license.bbclass
index 74de364..f2dd0eb 100644
--- a/meta/classes/license.bbclass
+++ b/meta/classes/license.bbclass
@@ -26,7 +26,6 @@ python write_package_manifest() {
 }
 
 python license_create_manifest() {
-    import shutil
     import re
     import oe.license
 
@@ -143,7 +142,7 @@ python license_create_manifest() {
         os.makedirs(rootfs_license_dir)
         rootfs_license_manifest = os.path.join(rootfs_license_dir,
                                                 'license.manifest')
-        shutil.copyfile(license_manifest, rootfs_license_manifest)
+        os.link(license_manifest, rootfs_license_manifest)
 
         if copy_lic_dirs == "1":
             for pkg in sorted(pkg_dic):
@@ -162,15 +161,15 @@ python license_create_manifest() {
                         if not license_ok(bad_licenses, generic_lic):
                             continue
 
-                        if not os.path.exists(pkg_rootfs_license):
-                            shutil.copyfile(pkg_license, rootfs_license)
+                        if not os.path.exists(rootfs_license):
+                            os.link(pkg_license, rootfs_license)
 
                         os.symlink(os.path.join('..', lic), pkg_rootfs_license)
                     else:
                         if not license_ok(bad_licenses, lic):
                             continue
 
-                        shutil.copyfile(pkg_license, pkg_rootfs_license)
+                        os.link(pkg_license, pkg_rootfs_license)
 }
 
 python do_populate_lic() {
-- 
1.9.1




More information about the Openembedded-core mailing list