diff options
Diffstat (limited to 'meta/classes')
-rw-r--r-- | meta/classes/create-spdx-2.2.bbclass | 8 | ||||
-rw-r--r-- | meta/classes/externalsrc.bbclass | 44 | ||||
-rw-r--r-- | meta/classes/toolchain/clang-native.bbclass | 18 |
3 files changed, 48 insertions, 22 deletions
diff --git a/meta/classes/create-spdx-2.2.bbclass b/meta/classes/create-spdx-2.2.bbclass index 6fc60a1d97..94e0108815 100644 --- a/meta/classes/create-spdx-2.2.bbclass +++ b/meta/classes/create-spdx-2.2.bbclass | |||
@@ -23,6 +23,8 @@ def get_namespace(d, name): | |||
23 | namespace_uuid = uuid.uuid5(uuid.NAMESPACE_DNS, d.getVar("SPDX_UUID_NAMESPACE")) | 23 | namespace_uuid = uuid.uuid5(uuid.NAMESPACE_DNS, d.getVar("SPDX_UUID_NAMESPACE")) |
24 | return "%s/%s-%s" % (d.getVar("SPDX_NAMESPACE_PREFIX"), name, str(uuid.uuid5(namespace_uuid, name))) | 24 | return "%s/%s-%s" % (d.getVar("SPDX_NAMESPACE_PREFIX"), name, str(uuid.uuid5(namespace_uuid, name))) |
25 | 25 | ||
26 | SPDX_PACKAGE_VERSION ??= "${PV}" | ||
27 | SPDX_PACKAGE_VERSION[doc] = "The version of a package, versionInfo in recipe, package and image" | ||
26 | 28 | ||
27 | def create_annotation(d, comment): | 29 | def create_annotation(d, comment): |
28 | from datetime import datetime, timezone | 30 | from datetime import datetime, timezone |
@@ -447,7 +449,7 @@ python do_create_spdx() { | |||
447 | 449 | ||
448 | recipe = oe.spdx.SPDXPackage() | 450 | recipe = oe.spdx.SPDXPackage() |
449 | recipe.name = d.getVar("PN") | 451 | recipe.name = d.getVar("PN") |
450 | recipe.versionInfo = d.getVar("PV") | 452 | recipe.versionInfo = d.getVar("SPDX_PACKAGE_VERSION") |
451 | recipe.SPDXID = oe.sbom.get_recipe_spdxid(d) | 453 | recipe.SPDXID = oe.sbom.get_recipe_spdxid(d) |
452 | recipe.supplier = d.getVar("SPDX_SUPPLIER") | 454 | recipe.supplier = d.getVar("SPDX_SUPPLIER") |
453 | if bb.data.inherits_class("native", d) or bb.data.inherits_class("cross", d): | 455 | if bb.data.inherits_class("native", d) or bb.data.inherits_class("cross", d): |
@@ -556,7 +558,7 @@ python do_create_spdx() { | |||
556 | 558 | ||
557 | spdx_package.SPDXID = oe.sbom.get_package_spdxid(pkg_name) | 559 | spdx_package.SPDXID = oe.sbom.get_package_spdxid(pkg_name) |
558 | spdx_package.name = pkg_name | 560 | spdx_package.name = pkg_name |
559 | spdx_package.versionInfo = d.getVar("PV") | 561 | spdx_package.versionInfo = d.getVar("SPDX_PACKAGE_VERSION") |
560 | spdx_package.licenseDeclared = convert_license_to_spdx(package_license, license_data, package_doc, d, found_licenses) | 562 | spdx_package.licenseDeclared = convert_license_to_spdx(package_license, license_data, package_doc, d, found_licenses) |
561 | spdx_package.supplier = d.getVar("SPDX_SUPPLIER") | 563 | spdx_package.supplier = d.getVar("SPDX_SUPPLIER") |
562 | 564 | ||
@@ -832,7 +834,7 @@ def combine_spdx(d, rootfs_name, rootfs_deploydir, rootfs_spdxid, packages, spdx | |||
832 | 834 | ||
833 | image = oe.spdx.SPDXPackage() | 835 | image = oe.spdx.SPDXPackage() |
834 | image.name = d.getVar("PN") | 836 | image.name = d.getVar("PN") |
835 | image.versionInfo = d.getVar("PV") | 837 | image.versionInfo = d.getVar("SPDX_PACKAGE_VERSION") |
836 | image.SPDXID = rootfs_spdxid | 838 | image.SPDXID = rootfs_spdxid |
837 | image.supplier = d.getVar("SPDX_SUPPLIER") | 839 | image.supplier = d.getVar("SPDX_SUPPLIER") |
838 | 840 | ||
diff --git a/meta/classes/externalsrc.bbclass b/meta/classes/externalsrc.bbclass index 70e27a8d35..527c99ab69 100644 --- a/meta/classes/externalsrc.bbclass +++ b/meta/classes/externalsrc.bbclass | |||
@@ -28,6 +28,20 @@ | |||
28 | SRCTREECOVEREDTASKS ?= "do_patch do_unpack do_fetch" | 28 | SRCTREECOVEREDTASKS ?= "do_patch do_unpack do_fetch" |
29 | EXTERNALSRC_SYMLINKS ?= "oe-workdir:${WORKDIR} oe-logs:${T}" | 29 | EXTERNALSRC_SYMLINKS ?= "oe-workdir:${WORKDIR} oe-logs:${T}" |
30 | 30 | ||
31 | def find_git_dir(d, s_dir): | ||
32 | import subprocess | ||
33 | git_dir = None | ||
34 | try: | ||
35 | git_dir = os.path.join(s_dir, | ||
36 | subprocess.check_output(['git', '-C', s_dir, 'rev-parse', '--git-dir'], stderr=subprocess.DEVNULL).decode("utf-8").rstrip()) | ||
37 | top_git_dir = os.path.join(d.getVar("TOPDIR"), | ||
38 | subprocess.check_output(['git', '-C', d.getVar("TOPDIR"), 'rev-parse', '--git-dir'], stderr=subprocess.DEVNULL).decode("utf-8").rstrip()) | ||
39 | if git_dir == top_git_dir: | ||
40 | git_dir = None | ||
41 | except subprocess.CalledProcessError: | ||
42 | pass | ||
43 | return git_dir | ||
44 | |||
31 | python () { | 45 | python () { |
32 | externalsrc = d.getVar('EXTERNALSRC') | 46 | externalsrc = d.getVar('EXTERNALSRC') |
33 | externalsrcbuild = d.getVar('EXTERNALSRC_BUILD') | 47 | externalsrcbuild = d.getVar('EXTERNALSRC_BUILD') |
@@ -169,14 +183,16 @@ python externalsrc_configure_prefunc() { | |||
169 | newlinks.append(symsplit[0]) | 183 | newlinks.append(symsplit[0]) |
170 | # Hide the symlinks from git | 184 | # Hide the symlinks from git |
171 | try: | 185 | try: |
172 | git_exclude_file = os.path.join(s_dir, '.git/info/exclude') | 186 | git_dir = find_git_dir(d, s_dir) |
173 | if os.path.exists(git_exclude_file): | 187 | if git_dir: |
174 | with open(git_exclude_file, 'r+') as efile: | 188 | git_exclude_file = os.path.join(git_dir, 'info/exclude') |
175 | elines = efile.readlines() | 189 | if os.path.exists(git_exclude_file): |
176 | for link in newlinks: | 190 | with open(git_exclude_file, 'r+') as efile: |
177 | if link in elines or '/'+link in elines: | 191 | elines = efile.readlines() |
178 | continue | 192 | for link in newlinks: |
179 | efile.write('/' + link + '\n') | 193 | if link in elines or '/'+link in elines: |
194 | continue | ||
195 | efile.write('/' + link + '\n') | ||
180 | except IOError as ioe: | 196 | except IOError as ioe: |
181 | bb.note('Failed to hide EXTERNALSRC_SYMLINKS from git') | 197 | bb.note('Failed to hide EXTERNALSRC_SYMLINKS from git') |
182 | } | 198 | } |
@@ -207,17 +223,7 @@ def srctree_hash_files(d, srcdir=None): | |||
207 | import hashlib | 223 | import hashlib |
208 | 224 | ||
209 | s_dir = srcdir or d.getVar('EXTERNALSRC') | 225 | s_dir = srcdir or d.getVar('EXTERNALSRC') |
210 | git_dir = None | 226 | git_dir = find_git_dir(d, s_dir) |
211 | |||
212 | try: | ||
213 | git_dir = os.path.join(s_dir, | ||
214 | subprocess.check_output(['git', '-C', s_dir, 'rev-parse', '--git-dir'], stderr=subprocess.DEVNULL).decode("utf-8").rstrip()) | ||
215 | top_git_dir = os.path.join(d.getVar("TOPDIR"), | ||
216 | subprocess.check_output(['git', '-C', d.getVar("TOPDIR"), 'rev-parse', '--git-dir'], stderr=subprocess.DEVNULL).decode("utf-8").rstrip()) | ||
217 | if git_dir == top_git_dir: | ||
218 | git_dir = None | ||
219 | except subprocess.CalledProcessError: | ||
220 | pass | ||
221 | 227 | ||
222 | ret = " " | 228 | ret = " " |
223 | if git_dir is not None: | 229 | if git_dir is not None: |
diff --git a/meta/classes/toolchain/clang-native.bbclass b/meta/classes/toolchain/clang-native.bbclass new file mode 100644 index 0000000000..4de491a1cb --- /dev/null +++ b/meta/classes/toolchain/clang-native.bbclass | |||
@@ -0,0 +1,18 @@ | |||
1 | BUILD_CC = "${CCACHE}${BUILD_PREFIX}clang ${BUILD_CC_ARCH}" | ||
2 | BUILD_CXX = "${CCACHE}${BUILD_PREFIX}clang++ ${BUILD_CC_ARCH}" | ||
3 | BUILD_FC = "${BUILD_PREFIX}gfortran ${BUILD_CC_ARCH}" | ||
4 | BUILD_CPP = "${BUILD_PREFIX}clang ${BUILD_CC_ARCH} -E" | ||
5 | BUILD_LD = "${BUILD_PREFIX}ld ${BUILD_LD_ARCH}" | ||
6 | BUILD_CCLD = "${BUILD_PREFIX}clang ${BUILD_CC_ARCH}" | ||
7 | BUILD_AR = "${BUILD_PREFIX}llvm-ar" | ||
8 | BUILD_AS = "${BUILD_PREFIX}as ${BUILD_AS_ARCH}" | ||
9 | BUILD_RANLIB = "${BUILD_PREFIX}llvm-ranlib -D" | ||
10 | BUILD_STRIP = "${BUILD_PREFIX}llvm-strip" | ||
11 | BUILD_OBJCOPY = "${BUILD_PREFIX}llvm-objcopy" | ||
12 | BUILD_OBJDUMP = "${BUILD_PREFIX}llvm-objdump" | ||
13 | BUILD_NM = "${BUILD_PREFIX}llvm-nm" | ||
14 | BUILD_READELF = "${BUILD_PREFIX}llvm-readelf" | ||
15 | |||
16 | DEPENDS += "clang-native libcxx-native compiler-rt-native" | ||
17 | |||
18 | LDFLAGS += " --rtlib=libgcc --unwindlib=libgcc" | ||