added rt-run script, bundled with lat-plot (now plcos-util-scripts)
This commit is contained in:
1 parent
2b568af092
commit
5cab13fe5c
12 files changed
+450
-349
No files matched your search
@@ -1,174 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2024 Wind River Systems, Inc
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
#
|
||||
|
||||
inherit enable-vendor-revision
|
||||
|
||||
VENDOR_REVISION_DIR ?= "${TMPDIR}/vendor-revisions/${MACHINE}"
|
||||
VENDOR_REVISION_ALL ?= "${VENDOR_REVISION_DIR}/wrlinux-vendor-revision.conf"
|
||||
|
||||
# For fixed RCPL users which can be set in their own conf file such as
|
||||
# conf/layer.conf, for example, ccm01 to ccm99:
|
||||
#VENDOR_REVISION_SUFFIX = ".ccm01"
|
||||
VENDOR_REVISION_SUFFIX ??= ""
|
||||
|
||||
addhandler gen_vr_fatal
|
||||
gen_vr_fatal[eventmask] = "bb.event.BuildStarted"
|
||||
python gen_vr_fatal() {
|
||||
bb.fatal('Only bitbake -p is supported when gen-vendor-revision.bbclass is enabled!')
|
||||
}
|
||||
|
||||
addhandler gen_vr_prepare
|
||||
gen_vr_prepare[eventmask] = "bb.event.CacheLoadStarted"
|
||||
python gen_vr_prepare() {
|
||||
vendor_revision_dir = d.getVar('VENDOR_REVISION_DIR')
|
||||
# Need a fresh VENDOR_REVISION_DIR and CACHE dir
|
||||
for k in ('VENDOR_REVISION_DIR', 'CACHE'):
|
||||
value = d.getVar(k)
|
||||
bb.note("Removing %s" % value)
|
||||
bb.utils.remove(value, True)
|
||||
bb.utils.mkdirhier(value)
|
||||
}
|
||||
|
||||
# Generate VENDOR_REVISION for each recipe
|
||||
addhandler gen_vr_recipe_handler
|
||||
gen_vr_recipe_handler[eventmask] = "bb.event.RecipeParsed"
|
||||
python gen_vr_recipe_handler() {
|
||||
"""
|
||||
Generate VENDOR_REVISION for each recipe, the format is:
|
||||
VENDOR_REVISION[recipe_file] ?= 'vr cveid1:patch1 notcve:patch2'
|
||||
"""
|
||||
|
||||
import hashlib
|
||||
|
||||
# Only generate vr for supported recipes
|
||||
bpn = d.getVar('BPN')
|
||||
wrl_supported = d.getVar('WRLINUX_SUPPORTED_RECIPE') or d.getVar('WRLINUX_SUPPORTED_RECIPE:pn-%s' % bpn)
|
||||
if wrl_supported and wrl_supported.strip() == '0':
|
||||
return
|
||||
|
||||
if vr_need_skip(d):
|
||||
return
|
||||
|
||||
def get_cve_patch(patch):
|
||||
ret = []
|
||||
patch_bn = os.path.basename(patch)
|
||||
# Open in 'text' mode doesn't work for very a few patches such as:
|
||||
# hddtemp_0.3-beta15-52.diff: 'utf-8' codec can't decode byte 0xe8 in
|
||||
# position 3851: invalid continuation byte
|
||||
with open(patch, 'rb') as f:
|
||||
# Get md5
|
||||
md5 = hashlib.md5()
|
||||
md5.update(f.read())
|
||||
hash = md5.hexdigest()
|
||||
patch_bn += ':%s' % md5.hexdigest()
|
||||
# Reset file postion
|
||||
f.seek(0, 0)
|
||||
for line in f:
|
||||
if not 'CVE:' in str(line):
|
||||
continue
|
||||
line = line.decode('utf-8')
|
||||
if line.startswith('CVE:') and 'CVE-' in line:
|
||||
line_split = line.split('CVE:')
|
||||
for cveid in line_split[1].split():
|
||||
cveid = cveid.strip()
|
||||
if cveid.startswith('CVE-'):
|
||||
ret.append('%s:%s' % (cveid, patch_bn))
|
||||
if not ret:
|
||||
ret.append('notcve:%s' % patch_bn)
|
||||
return ret
|
||||
|
||||
def update_vr(patches):
|
||||
"""
|
||||
Check whether recipe's VENDOR_REVISION need update or not
|
||||
* If old_vr == new_vf
|
||||
- No check is needed since they are in the same
|
||||
RCPL, just update it.
|
||||
|
||||
* If old_vr != new_vr:
|
||||
- If the patches are the same:
|
||||
Nothing changed, use the old_vr to avoid unneeded updates by dnf.
|
||||
|
||||
- If the patches are different:
|
||||
Update to the new_vr
|
||||
"""
|
||||
|
||||
patches.sort()
|
||||
new_patches = ' '.join(patches)
|
||||
|
||||
file_short = get_file_short(d)
|
||||
vr = get_current_vendor_revision(d)
|
||||
old_val = d.getVarFlag('VENDOR_REVISION', file_short)
|
||||
|
||||
# No checking is needed in the following cases:
|
||||
# - No old_val: It's a new vr, just update it
|
||||
if old_val:
|
||||
old_vr = old_val.split()[0]
|
||||
if old_vr:
|
||||
# In different RCPL, check whether need update
|
||||
if old_vr != vr:
|
||||
old_patches = ' '.join(old_val.split()[1:])
|
||||
# The patches are the same, no update is needed
|
||||
if old_patches == new_patches:
|
||||
vr = old_vr
|
||||
|
||||
# Replace .vr -> ${VENDOR_REVISION_PREFIX}
|
||||
vr_prefix = d.getVar("VENDOR_REVISION_PREFIX") or ""
|
||||
vr = vr.removeprefix(vr_prefix)
|
||||
vr = '${VENDOR_REVISION_PREFIX}%s' % vr
|
||||
out_lines = []
|
||||
val = ""
|
||||
if new_patches:
|
||||
val = '%s %s' % (vr, new_patches)
|
||||
out_lines.append("VENDOR_REVISION[%s] ??= '%s'" % (file_short, val))
|
||||
|
||||
if is_work_shared(d):
|
||||
s_short = get_var_short(d.getVar('S'))
|
||||
if val:
|
||||
out_lines.append("VENDOR_REVISION[%s] ?= '%s'" % (s_short, val))
|
||||
else:
|
||||
out_lines.append("VENDOR_REVISION[%s] ??= '${@d.getVarFlag(\"VENDOR_REVISION\", \"%s\")}'" \
|
||||
% (file_short, s_short))
|
||||
if out_lines:
|
||||
out_file = os.path.join(d.getVar('VENDOR_REVISION_DIR'), file_short)
|
||||
with open(out_file, 'w') as f:
|
||||
f.write('%s\n' % '\n'.join(out_lines))
|
||||
|
||||
patches = []
|
||||
localdata = bb.data.createCopy(d)
|
||||
localdata.setVar('OVERRIDES', localdata.getVar('OVERRIDES') + localdata.getVar('GEN_VENDOR_REVISION_OVERRIDES'))
|
||||
for local in get_src_patches(localdata):
|
||||
patches += get_cve_patch(local)
|
||||
update_vr(patches)
|
||||
}
|
||||
|
||||
# Generate vendor-revision.conf
|
||||
addhandler gen_vr_all_handler
|
||||
gen_vr_all_handler[eventmask] = "bb.event.ParseCompleted"
|
||||
python gen_vr_all_handler () {
|
||||
"""
|
||||
Collect each recipe's vendor revision in VENDOR_REVISION_DIR and save
|
||||
to VENDOR_REVISION_ALL
|
||||
"""
|
||||
import glob
|
||||
vendor_revision_dir = d.getVar('VENDOR_REVISION_DIR')
|
||||
patches = []
|
||||
output = d.getVar('VENDOR_REVISION_ALL')
|
||||
output_dir = os.path.dirname(output)
|
||||
for recipe in glob.glob(os.path.join(vendor_revision_dir, '*')):
|
||||
with open(recipe) as f:
|
||||
for line in f:
|
||||
if not line in (patches):
|
||||
patches.append(line)
|
||||
patches.sort()
|
||||
with open(output, 'w') as f:
|
||||
f.write('require %s\n\n' % "wrlinux-vendor-revision-manual.inc")
|
||||
f.write(''.join(patches))
|
||||
bb.note('The recipes with patches are saved to %s' % output)
|
||||
}
|
||||
|
||||
# Workaround Exception during build_dependencies for fetcher_hashes_dummyfunc
|
||||
# https://git.openembedded.org/openembedded-core/commit/?id=a8e7b0f932b9ea69b3a218fca18041676c65aba0
|
||||
fetcher_hashes_dummyfunc[vardepvalue] = ""
|
||||
@@ -1,41 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2025 Wind River Systems, Inc.
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
|
||||
python do_create_spdx:prepend() {
|
||||
import oe.packagedata
|
||||
|
||||
purl_qualifiers = "distro=%s-%s&arch=%s" % ("yocto" if d.getVar("DISTRO") == "poky" else d.getVar("DISTRO"), \
|
||||
d.getVar("DISTRO_VERSION"), \
|
||||
d.getVar("MACHINE"), \
|
||||
)
|
||||
purl_qualifiers_extend = d.getVar("SPDX_PURL_QUALIFIERS_EXTEND")
|
||||
if purl_qualifiers_extend:
|
||||
purl_qualifiers += "&%s" % purl_qualifiers_extend
|
||||
|
||||
purl_type = d.getVar("IMAGE_PKGTYPE")
|
||||
if purl_type == "ipk":
|
||||
purl_type = "yocto"
|
||||
purl_qualifiers = "file_extension=ipk&" + purl_qualifiers
|
||||
|
||||
purl_subpath = d.getVar("SPDX_PURL_SUBPATH")
|
||||
purl_subpath = "#" + purl_subpath if purl_subpath else ""
|
||||
|
||||
bb.build.exec_func("read_subpackage_metadata", d)
|
||||
|
||||
for package in d.getVar("PACKAGES", True).split():
|
||||
if not oe.packagedata.packaged(package, d):
|
||||
continue
|
||||
pkg_name = d.getVar("PKG:%s" % package) or package
|
||||
purl = "pkg:%s/%s/%s@%s?%s%s" % (purl_type, \
|
||||
d.getVar("DISTRO"), \
|
||||
pkg_name, \
|
||||
d.getVar("EXTENDPKGV"), \
|
||||
purl_qualifiers, \
|
||||
purl_subpath \
|
||||
)
|
||||
|
||||
d.setVar("SPDX_PACKAGE_URL:%s" % package, purl)
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
target_build_msg = "The meta-anaconda layer has been included, and the \
|
||||
current build is a regular target build. After it is finished, create \
|
||||
a new installer build with DISTRO = 'wrlinux-installer', \
|
||||
INSTALLER_TARGET_BUILD = '<target-build-topdir>|<target-build-image>' \
|
||||
and INSTALLER_TARGET_IMAGE = '<target-image-pn>' in local.conf"
|
||||
|
||||
target_build_warnmsg = "WARNING: The meta-anaconda layer has been included, \
|
||||
and the current build is a regular target build. It requires to enable \
|
||||
feature/installer-support template. Add option \
|
||||
--templates=feature/installer-support to setup.sh, or set WRTEMPLATE += \
|
||||
'feature/installer-support' in local.conf"
|
||||
|
||||
installer_build_msg = "The meta-anaconda layer has been included, and the \
|
||||
current build is a installer build, if set INSTALLER_TARGET_BUILD = \
|
||||
'<target-build-topdir>', and INSTALLER_TARGET_IMAGE = '<target-image-pn>' \
|
||||
the installer is to do RPMs install; if set INSTALLER_TARGET_BUILD = \
|
||||
'<target-build-image>', the installer is to do image copy install."
|
||||
|
||||
def get_installer_banner(d):
|
||||
if d.getVar('DISTRO',True) == 'wrlinux-installer':
|
||||
return d.getVar('installer_build_msg')
|
||||
elif "feature/installer-support" in d.getVar("WRTEMPLATE").split():
|
||||
return d.getVar('target_build_msg')
|
||||
else:
|
||||
return d.getVar('target_build_warnmsg')
|
||||
|
||||
CONFIG_BANNER[installer] = "${@get_installer_banner(d)}"
|
||||
Reference in new issue
Block a user