diff options
Diffstat (limited to 'meta/lib/oe')
-rw-r--r-- | meta/lib/oe/__init__.py | 2 | ||||
-rw-r--r-- | meta/lib/oe/go.py | 6 | ||||
-rw-r--r-- | meta/lib/oe/reproducible.py | 5 | ||||
-rw-r--r-- | meta/lib/oe/rust.py | 2 | ||||
-rw-r--r-- | meta/lib/oe/spdx30_tasks.py | 2 | ||||
-rw-r--r-- | meta/lib/oe/tune.py | 81 |
6 files changed, 91 insertions, 7 deletions
diff --git a/meta/lib/oe/__init__.py b/meta/lib/oe/__init__.py index dd094a874a..73de774266 100644 --- a/meta/lib/oe/__init__.py +++ b/meta/lib/oe/__init__.py | |||
@@ -12,4 +12,4 @@ __path__ = extend_path(__path__, __name__) | |||
12 | BBIMPORTS = ["qa", "data", "path", "utils", "types", "package", "packagedata", \ | 12 | BBIMPORTS = ["qa", "data", "path", "utils", "types", "package", "packagedata", \ |
13 | "packagegroup", "sstatesig", "lsb", "cachedpath", "license", "qemu", \ | 13 | "packagegroup", "sstatesig", "lsb", "cachedpath", "license", "qemu", \ |
14 | "reproducible", "rust", "buildcfg", "go", "spdx30_tasks", "spdx_common", \ | 14 | "reproducible", "rust", "buildcfg", "go", "spdx30_tasks", "spdx_common", \ |
15 | "cve_check"] | 15 | "cve_check", "tune"] |
diff --git a/meta/lib/oe/go.py b/meta/lib/oe/go.py index dfd957d157..4559dc63b2 100644 --- a/meta/lib/oe/go.py +++ b/meta/lib/oe/go.py | |||
@@ -7,6 +7,10 @@ | |||
7 | import re | 7 | import re |
8 | 8 | ||
9 | def map_arch(a): | 9 | def map_arch(a): |
10 | """ | ||
11 | Map our architecture names to Go's GOARCH names. | ||
12 | See https://github.com/golang/go/blob/master/src/internal/syslist/syslist.go for the complete list. | ||
13 | """ | ||
10 | if re.match('i.86', a): | 14 | if re.match('i.86', a): |
11 | return '386' | 15 | return '386' |
12 | elif a == 'x86_64': | 16 | elif a == 'x86_64': |
@@ -31,4 +35,4 @@ def map_arch(a): | |||
31 | return 'riscv64' | 35 | return 'riscv64' |
32 | elif a == 'loongarch64': | 36 | elif a == 'loongarch64': |
33 | return 'loong64' | 37 | return 'loong64' |
34 | return '' | 38 | raise KeyError(f"Cannot map architecture {a}") |
diff --git a/meta/lib/oe/reproducible.py b/meta/lib/oe/reproducible.py index cdb38d5aa4..0270024a83 100644 --- a/meta/lib/oe/reproducible.py +++ b/meta/lib/oe/reproducible.py | |||
@@ -75,10 +75,11 @@ def get_source_date_epoch_from_known_files(d, sourcedir): | |||
75 | return source_date_epoch | 75 | return source_date_epoch |
76 | 76 | ||
77 | def find_git_folder(d, sourcedir): | 77 | def find_git_folder(d, sourcedir): |
78 | # First guess: UNPACKDIR/git | 78 | # First guess: UNPACKDIR/BB_GIT_DEFAULT_DESTSUFFIX |
79 | # This is the default git fetcher unpack path | 79 | # This is the default git fetcher unpack path |
80 | unpackdir = d.getVar('UNPACKDIR') | 80 | unpackdir = d.getVar('UNPACKDIR') |
81 | gitpath = os.path.join(unpackdir, "git/.git") | 81 | default_destsuffix = d.getVar('BB_GIT_DEFAULT_DESTSUFFIX') |
82 | gitpath = os.path.join(unpackdir, default_destsuffix, ".git") | ||
82 | if os.path.isdir(gitpath): | 83 | if os.path.isdir(gitpath): |
83 | return gitpath | 84 | return gitpath |
84 | 85 | ||
diff --git a/meta/lib/oe/rust.py b/meta/lib/oe/rust.py index 185553eeeb..1dc9cf150d 100644 --- a/meta/lib/oe/rust.py +++ b/meta/lib/oe/rust.py | |||
@@ -8,6 +8,4 @@ | |||
8 | def arch_to_rust_arch(arch): | 8 | def arch_to_rust_arch(arch): |
9 | if arch == "ppc64le": | 9 | if arch == "ppc64le": |
10 | return "powerpc64le" | 10 | return "powerpc64le" |
11 | if arch in ('riscv32', 'riscv64'): | ||
12 | return arch + 'gc' | ||
13 | return arch | 11 | return arch |
diff --git a/meta/lib/oe/spdx30_tasks.py b/meta/lib/oe/spdx30_tasks.py index beeafc2bb7..5d9f3168d9 100644 --- a/meta/lib/oe/spdx30_tasks.py +++ b/meta/lib/oe/spdx30_tasks.py | |||
@@ -552,7 +552,7 @@ def create_spdx(d): | |||
552 | ) | 552 | ) |
553 | build_objset.new_relationship( | 553 | build_objset.new_relationship( |
554 | source_files, | 554 | source_files, |
555 | oe.spdx30.RelationshipType.hasConcludedLicense, | 555 | oe.spdx30.RelationshipType.hasDeclaredLicense, |
556 | [oe.sbom30.get_element_link_id(recipe_spdx_license)], | 556 | [oe.sbom30.get_element_link_id(recipe_spdx_license)], |
557 | ) | 557 | ) |
558 | 558 | ||
diff --git a/meta/lib/oe/tune.py b/meta/lib/oe/tune.py new file mode 100644 index 0000000000..7fda19430d --- /dev/null +++ b/meta/lib/oe/tune.py | |||
@@ -0,0 +1,81 @@ | |||
1 | # | ||
2 | # Copyright OpenEmbedded Contributors | ||
3 | # | ||
4 | # SPDX-License-Identifier: GPL-2.0-only | ||
5 | # | ||
6 | |||
7 | # riscv_isa_to_tune(isa) | ||
8 | # | ||
9 | # Automatically translate a RISC-V ISA string to TUNE_FEATURES | ||
10 | # | ||
11 | # Abbreviations, such as rv32g -> rv32imaffd_zicsr_zifencei are supported. | ||
12 | # | ||
13 | # Profiles, such as rva22u64, are NOT supported, you must use ISA strings. | ||
14 | # | ||
15 | def riscv_isa_to_tune(isa): | ||
16 | _isa = isa.lower() | ||
17 | |||
18 | feature = [] | ||
19 | iter = 0 | ||
20 | |||
21 | # rv or riscv | ||
22 | if _isa[iter:].startswith('rv'): | ||
23 | feature.append('rv') | ||
24 | iter = iter + 2 | ||
25 | elif _isa[iter:].startswith('riscv'): | ||
26 | feature.append('rv') | ||
27 | iter = iter + 5 | ||
28 | else: | ||
29 | # Not a risc-v ISA! | ||
30 | return _isa | ||
31 | |||
32 | while (_isa[iter:]): | ||
33 | # Skip _ and whitespace | ||
34 | if _isa[iter] == '_' or _isa[iter].isspace(): | ||
35 | iter = iter + 1 | ||
36 | continue | ||
37 | |||
38 | # Length, just capture numbers here | ||
39 | if _isa[iter].isdigit(): | ||
40 | iter_end = iter | ||
41 | while iter_end < len(_isa) and _isa[iter_end].isdigit(): | ||
42 | iter_end = iter_end + 1 | ||
43 | |||
44 | feature.append(_isa[iter:iter_end]) | ||
45 | iter = iter_end | ||
46 | continue | ||
47 | |||
48 | # Typically i, e or g is next, followed by extensions. | ||
49 | # Extensions are single character, except for Z, Ss, Sh, Sm, Sv, and X | ||
50 | |||
51 | # If the extension starts with 'Z', 'S' or 'X' use the name until the next _, whitespace or end | ||
52 | if _isa[iter] in ['z', 's', 'x']: | ||
53 | ext_type = _isa[iter] | ||
54 | iter_end = iter + 1 | ||
55 | |||
56 | # Multicharacter extension, these are supposed to have a _ before the next multicharacter extension | ||
57 | # See 37.4 and 37.5: | ||
58 | # 37.4: Underscores "_" may be used to separate ISA extensions... | ||
59 | # 37.5: All multi-letter extensions ... must be separated from other multi-letter extensions by an underscore... | ||
60 | # Some extensions permit only alphabetic characters, while others allow alphanumeric chartacters | ||
61 | while iter_end < len(_isa) and _isa[iter_end] != "_" and not _isa[iter_end].isspace(): | ||
62 | iter_end = iter_end + 1 | ||
63 | |||
64 | feature.append(_isa[iter:iter_end]) | ||
65 | iter = iter_end | ||
66 | continue | ||
67 | |||
68 | # 'g' is special, it's an abbreviation for imafd_zicsr_zifencei | ||
69 | # When expanding the abbreviation, any additional letters must appear before the _z* extensions | ||
70 | if _isa[iter] == 'g': | ||
71 | _isa = 'imafd' + _isa[iter+1:] + '_zicsr_zifencei' | ||
72 | iter = 0 | ||
73 | continue | ||
74 | |||
75 | feature.append(_isa[iter]) | ||
76 | iter = iter + 1 | ||
77 | continue | ||
78 | |||
79 | # Eliminate duplicates, but preserve the order | ||
80 | feature = list(dict.fromkeys(feature)) | ||
81 | return ' '.join(feature) | ||