summaryrefslogtreecommitdiffstats
path: root/meta/classes/license_image.bbclass
diff options
context:
space:
mode:
authorJoshua Watt <jpewhacker@gmail.com>2019-02-13 10:58:36 -0600
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-02-15 08:17:49 +0000
commit8d47356ad263fee8566c561cb509905e6e19ed59 (patch)
tree60565c82c677118e68f1d36ad4473b73f1692500 /meta/classes/license_image.bbclass
parenta20a4d734d49a58ef1f063d2da32a00d3fd5c312 (diff)
downloadpoky-8d47356ad263fee8566c561cb509905e6e19ed59.tar.gz
classes/license_image.bbclass: Fix rootfs license file permissions
Fixes up the permissions on the license files when they are put on the target file system so that they are readable by everyone. Previously, they would have inherited whatever permissions the file had in the recipe, which may not have been appropriate. [YOCTO #13175] (From OE-Core rev: 8190d192fceb9b0969385507d3d4bca7be75c810) Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/license_image.bbclass')
-rw-r--r--meta/classes/license_image.bbclass12
1 files changed, 9 insertions, 3 deletions
diff --git a/meta/classes/license_image.bbclass b/meta/classes/license_image.bbclass
index 6ac63e0192..67500386bf 100644
--- a/meta/classes/license_image.bbclass
+++ b/meta/classes/license_image.bbclass
@@ -37,6 +37,7 @@ python license_create_manifest() {
37 37
38def write_license_files(d, license_manifest, pkg_dic, rootfs=True): 38def write_license_files(d, license_manifest, pkg_dic, rootfs=True):
39 import re 39 import re
40 import stat
40 41
41 bad_licenses = (d.getVar("INCOMPATIBLE_LICENSE") or "").split() 42 bad_licenses = (d.getVar("INCOMPATIBLE_LICENSE") or "").split()
42 bad_licenses = map(lambda l: canonical_license(d, l), bad_licenses) 43 bad_licenses = map(lambda l: canonical_license(d, l), bad_licenses)
@@ -146,12 +147,17 @@ def write_license_files(d, license_manifest, pkg_dic, rootfs=True):
146 continue 147 continue
147 148
148 os.link(pkg_license, pkg_rootfs_license) 149 os.link(pkg_license, pkg_rootfs_license)
149 # Fixup file ownership 150 # Fixup file ownership and permissions
150 for walkroot, dirs, files in os.walk(rootfs_license_dir): 151 for walkroot, dirs, files in os.walk(rootfs_license_dir):
151 for f in files: 152 for f in files:
152 os.lchown(os.path.join(walkroot, f), 0, 0) 153 p = os.path.join(walkroot, f)
154 os.lchown(p, 0, 0)
155 if not os.path.islink(p):
156 os.chmod(p, stat.S_IRUSR | stat.S_IWUSR | stat.S_IRGRP | stat.S_IROTH)
153 for dir in dirs: 157 for dir in dirs:
154 os.lchown(os.path.join(walkroot, dir), 0, 0) 158 p = os.path.join(walkroot, dir)
159 os.lchown(p, 0, 0)
160 os.chmod(p, stat.S_IRWXU | stat.S_IRGRP | stat.S_IXGRP | stat.S_IROTH | stat.S_IXOTH)
155 161
156 162
157 163