summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
Diffstat (limited to 'meta')
-rw-r--r--meta/classes-global/license.bbclass2
-rw-r--r--meta/classes-global/sstate.bbclass2
-rw-r--r--meta/classes-recipe/license_image.bbclass46
3 files changed, 35 insertions, 15 deletions
diff --git a/meta/classes-global/license.bbclass b/meta/classes-global/license.bbclass
index 23625f0104..b2e0d3faba 100644
--- a/meta/classes-global/license.bbclass
+++ b/meta/classes-global/license.bbclass
@@ -29,7 +29,7 @@ python do_populate_lic() {
29 lic_files_paths = find_license_files(d) 29 lic_files_paths = find_license_files(d)
30 30
31 # The base directory we wrangle licenses to 31 # The base directory we wrangle licenses to
32 destdir = os.path.join(d.getVar('LICSSTATEDIR'), d.getVar('PN')) 32 destdir = os.path.join(d.getVar('LICSSTATEDIR'), d.getVar('SSTATE_PKGARCH'), d.getVar('PN'))
33 copy_license_files(lic_files_paths, destdir) 33 copy_license_files(lic_files_paths, destdir)
34 info = get_recipe_info(d) 34 info = get_recipe_info(d)
35 with open(os.path.join(destdir, "recipeinfo"), "w") as f: 35 with open(os.path.join(destdir, "recipeinfo"), "w") as f:
diff --git a/meta/classes-global/sstate.bbclass b/meta/classes-global/sstate.bbclass
index d846e22f44..13ac844272 100644
--- a/meta/classes-global/sstate.bbclass
+++ b/meta/classes-global/sstate.bbclass
@@ -55,8 +55,6 @@ PV[vardepvalue] = "${PV}"
55SSTATE_EXTRAPATH[vardepvalue] = "" 55SSTATE_EXTRAPATH[vardepvalue] = ""
56SSTATE_EXTRAPATHWILDCARD[vardepvalue] = "" 56SSTATE_EXTRAPATHWILDCARD[vardepvalue] = ""
57 57
58# For multilib rpm the allarch packagegroup files can overwrite (in theory they're identical)
59SSTATE_ALLOW_OVERLAP_FILES = "${DEPLOY_DIR}/licenses/"
60# Avoid docbook/sgml catalog warnings for now 58# Avoid docbook/sgml catalog warnings for now
61SSTATE_ALLOW_OVERLAP_FILES += "${STAGING_ETCDIR_NATIVE}/sgml ${STAGING_DATADIR_NATIVE}/sgml" 59SSTATE_ALLOW_OVERLAP_FILES += "${STAGING_ETCDIR_NATIVE}/sgml ${STAGING_DATADIR_NATIVE}/sgml"
62# sdk-provides-dummy-nativesdk and nativesdk-buildtools-perl-dummy overlap for different SDKMACHINE 60# sdk-provides-dummy-nativesdk and nativesdk-buildtools-perl-dummy overlap for different SDKMACHINE
diff --git a/meta/classes-recipe/license_image.bbclass b/meta/classes-recipe/license_image.bbclass
index fc859c7c65..19b3dc55ba 100644
--- a/meta/classes-recipe/license_image.bbclass
+++ b/meta/classes-recipe/license_image.bbclass
@@ -18,7 +18,7 @@ python() {
18 18
19python write_package_manifest() { 19python write_package_manifest() {
20 # Get list of installed packages 20 # Get list of installed packages
21 license_image_dir = d.expand('${LICENSE_DIRECTORY}/${IMAGE_NAME}') 21 license_image_dir = d.expand('${LICENSE_DIRECTORY}/${SSTATE_PKGARCH}/${IMAGE_NAME}')
22 bb.utils.mkdirhier(license_image_dir) 22 bb.utils.mkdirhier(license_image_dir)
23 from oe.rootfs import image_list_installed_packages 23 from oe.rootfs import image_list_installed_packages
24 from oe.utils import format_pkg_list 24 from oe.utils import format_pkg_list
@@ -49,7 +49,7 @@ python license_create_manifest() {
49 pkg_dic[pkg_name]["LICENSE"] = pkg_dic[pkg_name][pkg_lic_name] 49 pkg_dic[pkg_name]["LICENSE"] = pkg_dic[pkg_name][pkg_lic_name]
50 50
51 rootfs_license_manifest = os.path.join(d.getVar('LICENSE_DIRECTORY'), 51 rootfs_license_manifest = os.path.join(d.getVar('LICENSE_DIRECTORY'),
52 d.getVar('IMAGE_NAME'), 'license.manifest') 52 d.getVar('SSTATE_PKGARCH'), d.getVar('IMAGE_NAME'), 'license.manifest')
53 write_license_files(d, rootfs_license_manifest, pkg_dic, rootfs=True) 53 write_license_files(d, rootfs_license_manifest, pkg_dic, rootfs=True)
54} 54}
55 55
@@ -59,6 +59,8 @@ def write_license_files(d, license_manifest, pkg_dic, rootfs=True):
59 59
60 bad_licenses = (d.getVar("INCOMPATIBLE_LICENSE") or "").split() 60 bad_licenses = (d.getVar("INCOMPATIBLE_LICENSE") or "").split()
61 bad_licenses = expand_wildcard_licenses(d, bad_licenses) 61 bad_licenses = expand_wildcard_licenses(d, bad_licenses)
62 pkgarchs = d.getVar("SSTATE_ARCHS").split()
63 pkgarchs.reverse()
62 64
63 exceptions = (d.getVar("INCOMPATIBLE_LICENSE_EXCEPTIONS") or "").split() 65 exceptions = (d.getVar("INCOMPATIBLE_LICENSE_EXCEPTIONS") or "").split()
64 with open(license_manifest, "w") as license_file: 66 with open(license_manifest, "w") as license_file:
@@ -98,9 +100,13 @@ def write_license_files(d, license_manifest, pkg_dic, rootfs=True):
98 license_file.write("FILES: %s\n\n" % pkg_dic[pkg]["FILES"]) 100 license_file.write("FILES: %s\n\n" % pkg_dic[pkg]["FILES"])
99 101
100 for lic in pkg_dic[pkg]["LICENSES"]: 102 for lic in pkg_dic[pkg]["LICENSES"]:
101 lic_file = os.path.join(d.getVar('LICENSE_DIRECTORY'), 103 for pkgarch in pkgarchs:
102 pkg_dic[pkg]["PN"], "generic_%s" % 104 lic_file = os.path.join(d.getVar('LICENSE_DIRECTORY'),
103 re.sub(r'\+', '', lic)) 105 pkgarch,
106 pkg_dic[pkg]["PN"], "generic_%s" %
107 re.sub(r'\+', '', lic))
108 if os.path.exists(lic_file):
109 break
104 # add explicity avoid of CLOSED license because isn't generic 110 # add explicity avoid of CLOSED license because isn't generic
105 if lic == "CLOSED": 111 if lic == "CLOSED":
106 continue 112 continue
@@ -130,8 +136,13 @@ def write_license_files(d, license_manifest, pkg_dic, rootfs=True):
130 for pkg in sorted(pkg_dic): 136 for pkg in sorted(pkg_dic):
131 pkg_rootfs_license_dir = os.path.join(rootfs_license_dir, pkg) 137 pkg_rootfs_license_dir = os.path.join(rootfs_license_dir, pkg)
132 bb.utils.mkdirhier(pkg_rootfs_license_dir) 138 bb.utils.mkdirhier(pkg_rootfs_license_dir)
133 pkg_license_dir = os.path.join(d.getVar('LICENSE_DIRECTORY'), 139 for pkgarch in pkgarchs:
134 pkg_dic[pkg]["PN"]) 140 pkg_license_dir = os.path.join(d.getVar('LICENSE_DIRECTORY'),
141 pkgarch, pkg_dic[pkg]["PN"])
142 if os.path.exists(pkg_license_dir):
143 break
144 if not os.path.exists(pkg_license_dir ):
145 bb.fatal("Couldn't find license information for dependency %s" % pkg)
135 146
136 pkg_manifest_licenses = [canonical_license(d, lic) \ 147 pkg_manifest_licenses = [canonical_license(d, lic) \
137 for lic in pkg_dic[pkg]["LICENSES"]] 148 for lic in pkg_dic[pkg]["LICENSES"]]
@@ -183,7 +194,7 @@ def write_license_files(d, license_manifest, pkg_dic, rootfs=True):
183 os.lchown(p, 0, 0) 194 os.lchown(p, 0, 0)
184 os.chmod(p, stat.S_IRWXU | stat.S_IRGRP | stat.S_IXGRP | stat.S_IROTH | stat.S_IXOTH) 195 os.chmod(p, stat.S_IRWXU | stat.S_IRGRP | stat.S_IXGRP | stat.S_IROTH | stat.S_IXOTH)
185 196
186 197write_license_files[vardepsexclude] = "SSTATE_ARCHS"
187 198
188def license_deployed_manifest(d): 199def license_deployed_manifest(d):
189 """ 200 """
@@ -195,6 +206,8 @@ def license_deployed_manifest(d):
195 dep_dic = {} 206 dep_dic = {}
196 man_dic = {} 207 man_dic = {}
197 lic_dir = d.getVar("LICENSE_DIRECTORY") 208 lic_dir = d.getVar("LICENSE_DIRECTORY")
209 pkgarchs = d.getVar("SSTATE_ARCHS").split()
210 pkgarchs.reverse()
198 211
199 dep_dic = get_deployed_dependencies(d) 212 dep_dic = get_deployed_dependencies(d)
200 for dep in dep_dic.keys(): 213 for dep in dep_dic.keys():
@@ -204,12 +217,19 @@ def license_deployed_manifest(d):
204 man_dic[dep]["PN"] = dep 217 man_dic[dep]["PN"] = dep
205 man_dic[dep]["FILES"] = \ 218 man_dic[dep]["FILES"] = \
206 " ".join(get_deployed_files(dep_dic[dep])) 219 " ".join(get_deployed_files(dep_dic[dep]))
207 with open(os.path.join(lic_dir, dep, "recipeinfo"), "r") as f: 220
221 for pkgarch in pkgarchs:
222 licfile = os.path.join(lic_dir, pkgarch, dep, "recipeinfo")
223 if os.path.exists(licfile):
224 break
225 if not os.path.exists(licfile):
226 bb.fatal("Couldn't find license information for dependency %s" % dep)
227 with open(licfile, "r") as f:
208 for line in f.readlines(): 228 for line in f.readlines():
209 key,val = line.split(": ", 1) 229 key,val = line.split(": ", 1)
210 man_dic[dep][key] = val[:-1] 230 man_dic[dep][key] = val[:-1]
211 231
212 lic_manifest_dir = os.path.join(d.getVar('LICENSE_DIRECTORY'), 232 lic_manifest_dir = os.path.join(d.getVar('LICENSE_DIRECTORY'), d.getVar('SSTATE_PKGARCH'),
213 d.getVar('IMAGE_NAME')) 233 d.getVar('IMAGE_NAME'))
214 bb.utils.mkdirhier(lic_manifest_dir) 234 bb.utils.mkdirhier(lic_manifest_dir)
215 image_license_manifest = os.path.join(lic_manifest_dir, 'image_license.manifest') 235 image_license_manifest = os.path.join(lic_manifest_dir, 'image_license.manifest')
@@ -217,7 +237,7 @@ def license_deployed_manifest(d):
217 237
218 link_name = d.getVar('IMAGE_LINK_NAME') 238 link_name = d.getVar('IMAGE_LINK_NAME')
219 if link_name: 239 if link_name:
220 lic_manifest_symlink_dir = os.path.join(d.getVar('LICENSE_DIRECTORY'), 240 lic_manifest_symlink_dir = os.path.join(d.getVar('LICENSE_DIRECTORY'), d.getVar('SSTATE_PKGARCH'),
221 link_name) 241 link_name)
222 # remove old symlink 242 # remove old symlink
223 if os.path.islink(lic_manifest_symlink_dir): 243 if os.path.islink(lic_manifest_symlink_dir):
@@ -227,6 +247,8 @@ def license_deployed_manifest(d):
227 if lic_manifest_dir != lic_manifest_symlink_dir: 247 if lic_manifest_dir != lic_manifest_symlink_dir:
228 os.symlink(lic_manifest_dir, lic_manifest_symlink_dir) 248 os.symlink(lic_manifest_dir, lic_manifest_symlink_dir)
229 249
250license_deployed_manifest[vardepsexclude] = "SSTATE_ARCHS"
251
230def get_deployed_dependencies(d): 252def get_deployed_dependencies(d):
231 """ 253 """
232 Get all the deployed dependencies of an image 254 Get all the deployed dependencies of an image
@@ -255,7 +277,7 @@ def get_deployed_dependencies(d):
255 break 277 break
256 278
257 return deploy 279 return deploy
258get_deployed_dependencies[vardepsexclude] = "BB_TASKDEPDATA" 280get_deployed_dependencies[vardepsexclude] = "BB_TASKDEPDATA SSTATE_ARCHS"
259 281
260def get_deployed_files(man_file): 282def get_deployed_files(man_file):
261 """ 283 """