diff options
Diffstat (limited to 'meta/classes')
-rw-r--r-- | meta/classes/create-spdx-2.2.bbclass | 16 | ||||
-rw-r--r-- | meta/classes/devtool-source.bbclass | 74 | ||||
-rw-r--r-- | meta/classes/siteconfig.bbclass | 39 |
3 files changed, 22 insertions, 107 deletions
diff --git a/meta/classes/create-spdx-2.2.bbclass b/meta/classes/create-spdx-2.2.bbclass index 486efadba9..7c8a0b8b0f 100644 --- a/meta/classes/create-spdx-2.2.bbclass +++ b/meta/classes/create-spdx-2.2.bbclass | |||
@@ -28,7 +28,7 @@ SPDX_ARCHIVE_SOURCES ??= "0" | |||
28 | SPDX_ARCHIVE_PACKAGED ??= "0" | 28 | SPDX_ARCHIVE_PACKAGED ??= "0" |
29 | 29 | ||
30 | SPDX_UUID_NAMESPACE ??= "sbom.openembedded.org" | 30 | SPDX_UUID_NAMESPACE ??= "sbom.openembedded.org" |
31 | SPDX_NAMESPACE_PREFIX ??= "http://spdx.org/spdxdoc" | 31 | SPDX_NAMESPACE_PREFIX ??= "http://spdx.org/spdxdocs" |
32 | SPDX_PRETTY ??= "0" | 32 | SPDX_PRETTY ??= "0" |
33 | 33 | ||
34 | SPDX_LICENSES ??= "${COREBASE}/meta/files/spdx-licenses.json" | 34 | SPDX_LICENSES ??= "${COREBASE}/meta/files/spdx-licenses.json" |
@@ -357,7 +357,13 @@ def collect_dep_recipes(d, doc, spdx_recipe): | |||
357 | with spdx_deps_file.open("r") as f: | 357 | with spdx_deps_file.open("r") as f: |
358 | deps = json.load(f) | 358 | deps = json.load(f) |
359 | 359 | ||
360 | for dep_pn, dep_hashfn in deps: | 360 | for dep_pn, dep_hashfn, in_taskhash in deps: |
361 | # If this dependency is not calculated in the taskhash skip it. | ||
362 | # Otherwise, it can result in broken links since this task won't | ||
363 | # rebuild and see the new SPDX ID if the dependency changes | ||
364 | if not in_taskhash: | ||
365 | continue | ||
366 | |||
361 | dep_recipe_path = oe.sbom.doc_find_by_hashfn(deploy_dir_spdx, package_archs, "recipe-" + dep_pn, dep_hashfn) | 367 | dep_recipe_path = oe.sbom.doc_find_by_hashfn(deploy_dir_spdx, package_archs, "recipe-" + dep_pn, dep_hashfn) |
362 | if not dep_recipe_path: | 368 | if not dep_recipe_path: |
363 | bb.fatal("Cannot find any SPDX file for recipe %s, %s" % (dep_pn, dep_hashfn)) | 369 | bb.fatal("Cannot find any SPDX file for recipe %s, %s" % (dep_pn, dep_hashfn)) |
@@ -478,7 +484,7 @@ def collect_direct_deps(d, dep_task): | |||
478 | for dep_name in this_dep[3]: | 484 | for dep_name in this_dep[3]: |
479 | dep_data = taskdepdata[dep_name] | 485 | dep_data = taskdepdata[dep_name] |
480 | if dep_data[1] == dep_task and dep_data[0] != pn: | 486 | if dep_data[1] == dep_task and dep_data[0] != pn: |
481 | deps.add((dep_data[0], dep_data[7])) | 487 | deps.add((dep_data[0], dep_data[7], dep_name in this_dep[8])) |
482 | 488 | ||
483 | return sorted(deps) | 489 | return sorted(deps) |
484 | 490 | ||
@@ -721,9 +727,9 @@ def collect_package_providers(d): | |||
721 | providers = {} | 727 | providers = {} |
722 | 728 | ||
723 | deps = collect_direct_deps(d, "do_create_spdx") | 729 | deps = collect_direct_deps(d, "do_create_spdx") |
724 | deps.append((d.getVar("PN"), d.getVar("BB_HASHFILENAME"))) | 730 | deps.append((d.getVar("PN"), d.getVar("BB_HASHFILENAME"), True)) |
725 | 731 | ||
726 | for dep_pn, dep_hashfn in deps: | 732 | for dep_pn, dep_hashfn, _ in deps: |
727 | localdata = d | 733 | localdata = d |
728 | recipe_data = oe.packagedata.read_pkgdata(dep_pn, localdata) | 734 | recipe_data = oe.packagedata.read_pkgdata(dep_pn, localdata) |
729 | if not recipe_data: | 735 | if not recipe_data: |
diff --git a/meta/classes/devtool-source.bbclass b/meta/classes/devtool-source.bbclass index 4158c20c7e..3e24800dcb 100644 --- a/meta/classes/devtool-source.bbclass +++ b/meta/classes/devtool-source.bbclass | |||
@@ -26,8 +26,6 @@ | |||
26 | 26 | ||
27 | 27 | ||
28 | DEVTOOL_TEMPDIR ?= "" | 28 | DEVTOOL_TEMPDIR ?= "" |
29 | DEVTOOL_PATCH_SRCDIR = "${DEVTOOL_TEMPDIR}/patchworkdir" | ||
30 | |||
31 | 29 | ||
32 | python() { | 30 | python() { |
33 | tempdir = d.getVar('DEVTOOL_TEMPDIR') | 31 | tempdir = d.getVar('DEVTOOL_TEMPDIR') |
@@ -60,7 +58,6 @@ python() { | |||
60 | else: | 58 | else: |
61 | unpacktask = 'do_unpack' | 59 | unpacktask = 'do_unpack' |
62 | d.appendVarFlag(unpacktask, 'postfuncs', ' devtool_post_unpack') | 60 | d.appendVarFlag(unpacktask, 'postfuncs', ' devtool_post_unpack') |
63 | d.prependVarFlag('do_patch', 'prefuncs', ' devtool_pre_patch') | ||
64 | d.appendVarFlag('do_patch', 'postfuncs', ' devtool_post_patch') | 61 | d.appendVarFlag('do_patch', 'postfuncs', ' devtool_post_patch') |
65 | 62 | ||
66 | # NOTE: in order for the patch stuff to be fully functional, | 63 | # NOTE: in order for the patch stuff to be fully functional, |
@@ -79,67 +76,23 @@ python devtool_post_unpack() { | |||
79 | 76 | ||
80 | tempdir = d.getVar('DEVTOOL_TEMPDIR') | 77 | tempdir = d.getVar('DEVTOOL_TEMPDIR') |
81 | workdir = d.getVar('WORKDIR') | 78 | workdir = d.getVar('WORKDIR') |
79 | unpackdir = d.getVar('UNPACKDIR') | ||
82 | srcsubdir = d.getVar('S') | 80 | srcsubdir = d.getVar('S') |
83 | 81 | ||
84 | def _move_file(src, dst): | 82 | # Add locally copied files to gitignore as we add back to the metadata directly |
85 | """Move a file. Creates all the directory components of destination path.""" | ||
86 | dst_d = os.path.dirname(dst) | ||
87 | if dst_d: | ||
88 | bb.utils.mkdirhier(dst_d) | ||
89 | shutil.move(src, dst) | ||
90 | |||
91 | def _ls_tree(directory): | ||
92 | """Recursive listing of files in a directory""" | ||
93 | ret = [] | ||
94 | for root, dirs, files in os.walk(directory): | ||
95 | ret.extend([os.path.relpath(os.path.join(root, fname), directory) for | ||
96 | fname in files]) | ||
97 | return ret | ||
98 | |||
99 | is_kernel_yocto = bb.data.inherits_class('kernel-yocto', d) | ||
100 | # Move local source files into separate subdir | ||
101 | recipe_patches = [os.path.basename(patch) for patch in | ||
102 | oe.recipeutils.get_recipe_patches(d)] | ||
103 | local_files = oe.recipeutils.get_recipe_local_files(d) | 83 | local_files = oe.recipeutils.get_recipe_local_files(d) |
104 | |||
105 | if is_kernel_yocto: | ||
106 | for key in [f for f in local_files if f.endswith('scc')]: | ||
107 | with open(local_files[key], 'r') as sccfile: | ||
108 | for l in sccfile: | ||
109 | line = l.split() | ||
110 | if line and line[0] in ('kconf', 'patch'): | ||
111 | cfg = os.path.join(os.path.dirname(local_files[key]), line[-1]) | ||
112 | if cfg not in local_files.values(): | ||
113 | local_files[line[-1]] = cfg | ||
114 | shutil.copy2(cfg, workdir) | ||
115 | |||
116 | # Ignore local files with subdir={BP} | ||
117 | srcabspath = os.path.abspath(srcsubdir) | 84 | srcabspath = os.path.abspath(srcsubdir) |
118 | local_files = [fname for fname in local_files if | 85 | local_files = [fname for fname in local_files if |
119 | os.path.exists(os.path.join(workdir, fname)) and | 86 | os.path.exists(os.path.join(unpackdir, fname)) and |
120 | (srcabspath == workdir or not | 87 | srcabspath == unpackdir] |
121 | os.path.join(workdir, fname).startswith(srcabspath + | ||
122 | os.sep))] | ||
123 | if local_files: | 88 | if local_files: |
124 | for fname in local_files: | 89 | with open(os.path.join(tempdir, '.gitignore'), 'a+') as f: |
125 | _move_file(os.path.join(workdir, fname), | 90 | f.write('# Ignore local files, by default. Remove following lines' |
126 | os.path.join(tempdir, 'oe-local-files', fname)) | 91 | 'if you want to commit the directory to Git\n') |
127 | with open(os.path.join(tempdir, 'oe-local-files', '.gitignore'), | 92 | for fname in local_files: |
128 | 'w') as f: | 93 | f.write('%s\n' % fname) |
129 | f.write('# Ignore local files, by default. Remove this file ' | 94 | |
130 | 'if you want to commit the directory to Git\n*\n') | 95 | if os.path.dirname(srcsubdir) != workdir: |
131 | |||
132 | if srcsubdir == workdir: | ||
133 | # Find non-patch non-local sources that were "unpacked" to srctree | ||
134 | # directory | ||
135 | src_files = [fname for fname in _ls_tree(workdir) if | ||
136 | os.path.basename(fname) not in recipe_patches] | ||
137 | srcsubdir = d.getVar('DEVTOOL_PATCH_SRCDIR') | ||
138 | # Move source files to S | ||
139 | for path in src_files: | ||
140 | _move_file(os.path.join(workdir, path), | ||
141 | os.path.join(srcsubdir, path)) | ||
142 | elif os.path.dirname(srcsubdir) != workdir: | ||
143 | # Handle if S is set to a subdirectory of the source | 96 | # Handle if S is set to a subdirectory of the source |
144 | srcsubdir = os.path.join(workdir, os.path.relpath(srcsubdir, workdir).split(os.sep)[0]) | 97 | srcsubdir = os.path.join(workdir, os.path.relpath(srcsubdir, workdir).split(os.sep)[0]) |
145 | 98 | ||
@@ -164,11 +117,6 @@ python devtool_post_unpack() { | |||
164 | f.write(srcsubdir) | 117 | f.write(srcsubdir) |
165 | } | 118 | } |
166 | 119 | ||
167 | python devtool_pre_patch() { | ||
168 | if d.getVar('S') == d.getVar('WORKDIR'): | ||
169 | d.setVar('S', '${DEVTOOL_PATCH_SRCDIR}') | ||
170 | } | ||
171 | |||
172 | python devtool_post_patch() { | 120 | python devtool_post_patch() { |
173 | import shutil | 121 | import shutil |
174 | tempdir = d.getVar('DEVTOOL_TEMPDIR') | 122 | tempdir = d.getVar('DEVTOOL_TEMPDIR') |
diff --git a/meta/classes/siteconfig.bbclass b/meta/classes/siteconfig.bbclass deleted file mode 100644 index 953cafd285..0000000000 --- a/meta/classes/siteconfig.bbclass +++ /dev/null | |||
@@ -1,39 +0,0 @@ | |||
1 | # | ||
2 | # Copyright OpenEmbedded Contributors | ||
3 | # | ||
4 | # SPDX-License-Identifier: MIT | ||
5 | # | ||
6 | |||
7 | python siteconfig_do_siteconfig () { | ||
8 | shared_state = sstate_state_fromvars(d) | ||
9 | if shared_state['task'] != 'populate_sysroot': | ||
10 | return | ||
11 | if not os.path.isdir(os.path.join(d.getVar('FILE_DIRNAME'), 'site_config')): | ||
12 | bb.debug(1, "No site_config directory, skipping do_siteconfig") | ||
13 | return | ||
14 | sstate_install(shared_state, d) | ||
15 | bb.build.exec_func('do_siteconfig_gencache', d) | ||
16 | sstate_clean(shared_state, d) | ||
17 | } | ||
18 | |||
19 | EXTRASITECONFIG ?= "" | ||
20 | |||
21 | siteconfig_do_siteconfig_gencache () { | ||
22 | mkdir -p ${WORKDIR}/site_config_${MACHINE} | ||
23 | gen-site-config ${FILE_DIRNAME}/site_config \ | ||
24 | >${WORKDIR}/site_config_${MACHINE}/configure.ac | ||
25 | cd ${WORKDIR}/site_config_${MACHINE} | ||
26 | autoconf | ||
27 | rm -f ${BPN}_cache | ||
28 | CONFIG_SITE="" ${EXTRASITECONFIG} ./configure ${CONFIGUREOPTS} --cache-file ${BPN}_cache | ||
29 | sed -n -e "/ac_cv_c_bigendian/p" -e "/ac_cv_sizeof_/p" \ | ||
30 | -e "/ac_cv_type_/p" -e "/ac_cv_header_/p" -e "/ac_cv_func_/p" \ | ||
31 | < ${BPN}_cache > ${BPN}_config | ||
32 | mkdir -p ${SYSROOT_DESTDIR}${datadir}/${TARGET_SYS}_config_site.d | ||
33 | cp ${BPN}_config ${SYSROOT_DESTDIR}${datadir}/${TARGET_SYS}_config_site.d | ||
34 | |||
35 | } | ||
36 | |||
37 | do_populate_sysroot[sstate-interceptfuncs] += "do_siteconfig " | ||
38 | |||
39 | EXPORT_FUNCTIONS do_siteconfig do_siteconfig_gencache | ||