mirror of
https://github.com/kenzok8/vmlinux-btf.git
synced 2026-12-05 08:05:16 +00:00
改动:kernel_version 支持逗号分隔的多个版本,矩阵按 (sdk, arch, kernel) 展开,artifact 名字带上内核号避免撞名。 原因:24.10 各点版本内核不同,用户按 uname -r 精确匹配才装得上 BTF,一次只能编一个版本效率太低。
51 lines
1.5 KiB
Python
Executable File
51 lines
1.5 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
"""Print the (sdk, arch, kernel) build matrix as `matrix={json}` for $GITHUB_OUTPUT.
|
|
|
|
24.10 的点版本内核与分支 HEAD 不一致(例如 24.10.8 是 6.6.144,分支已到 6.6.159),
|
|
BTF 又必须按 uname -r 精确匹配,所以支持一次排多个内核版本:WANT_KERNELS 用逗号
|
|
分隔,留空则跟随 SDK 自身的内核版本。
|
|
"""
|
|
import json
|
|
import os
|
|
import sys
|
|
|
|
ARCHES = [
|
|
"aarch64_cortex-a53",
|
|
"aarch64_cortex-a72",
|
|
"aarch64_generic",
|
|
"arm_cortex-a7_neon-vfpv4",
|
|
"arm_cortex-a9_neon",
|
|
"i386_pentium4",
|
|
"mips_24kc",
|
|
"mipsel_24kc",
|
|
"x86_64",
|
|
]
|
|
SDKS = ["24.10", "25.12"]
|
|
|
|
|
|
def main() -> int:
|
|
want_sdk = os.environ.get("WANT_SDK", "").strip()
|
|
want_arch = os.environ.get("WANT_ARCH", "").strip()
|
|
want_kernels = [k.strip() for k in os.environ.get("WANT_KERNELS", "").replace(" ", ",").split(",") if k.strip()]
|
|
if want_sdk and want_sdk not in SDKS:
|
|
print(f"unknown sdk: {want_sdk}", file=sys.stderr)
|
|
return 2
|
|
if want_arch and want_arch not in ARCHES:
|
|
print(f"unknown arch: {want_arch}", file=sys.stderr)
|
|
return 2
|
|
kernels = want_kernels or [""]
|
|
include = [
|
|
{"sdk": sdk, "arch": arch, "kernel": kernel}
|
|
for sdk in SDKS
|
|
if not want_sdk or sdk == want_sdk
|
|
for arch in ARCHES
|
|
if not want_arch or arch == want_arch
|
|
for kernel in kernels
|
|
]
|
|
print("matrix=" + json.dumps({"include": include}))
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
sys.exit(main())
|