Initial commit
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
header:
|
||||
version: 14
|
||||
|
||||
distro: poky
|
||||
|
||||
defaults:
|
||||
repos:
|
||||
branch: master
|
||||
|
||||
repos:
|
||||
meta-arm:
|
||||
layers:
|
||||
meta-arm:
|
||||
meta-arm-bsp:
|
||||
meta-arm-toolchain:
|
||||
|
||||
poky:
|
||||
url: https://git.yoctoproject.org/git/poky
|
||||
layers:
|
||||
meta:
|
||||
meta-poky:
|
||||
|
||||
env:
|
||||
BB_LOGCONFIG: ""
|
||||
TOOLCHAIN_DIR: ""
|
||||
|
||||
local_conf_header:
|
||||
base: |
|
||||
CONF_VERSION = "2"
|
||||
setup: |
|
||||
PACKAGE_CLASSES = "package_ipk"
|
||||
PACKAGECONFIG:remove:pn-qemu-system-native = "gtk+ sdl"
|
||||
PACKAGECONFIG:append:pn-perf = " coresight"
|
||||
INHERIT += "rm_work"
|
||||
DISTRO_FEATURES:remove = "ptest"
|
||||
extrapackages: |
|
||||
CORE_IMAGE_EXTRA_INSTALL += "perf opencsd"
|
||||
CORE_IMAGE_EXTRA_INSTALL:append:aarch64 = " gator-daemon"
|
||||
|
||||
machine: unset
|
||||
|
||||
target:
|
||||
- core-image-sato
|
||||
Executable
+28
@@ -0,0 +1,28 @@
|
||||
#! /usr/bin/env python3
|
||||
|
||||
from pathlib import Path
|
||||
import sys
|
||||
from listmachines import list_machines
|
||||
|
||||
metaarm = Path.cwd()
|
||||
|
||||
if metaarm.name != "meta-arm":
|
||||
print("Not running inside meta-arm")
|
||||
sys.exit(1)
|
||||
|
||||
# Find all layers
|
||||
layers = (p.name for p in metaarm.glob("meta-*") if p.is_dir())
|
||||
# All machine configurations
|
||||
machines = list_machines(layers)
|
||||
|
||||
# All kas files
|
||||
kas = metaarm.glob("ci/*.yml")
|
||||
kas = set(p.stem for p in kas)
|
||||
|
||||
missing = machines - kas
|
||||
print(f"The following machines are missing: {', '.join(sorted(missing))}.")
|
||||
|
||||
covered = len(machines) - len(missing)
|
||||
total = len(machines)
|
||||
percent = int(covered / total * 100)
|
||||
print(f"Coverage: {percent}%")
|
||||
Executable
+19
@@ -0,0 +1,19 @@
|
||||
#! /bin/bash
|
||||
|
||||
# Expects the path to a log file as $1, and if this file has any content
|
||||
# then display the contents and exit with an error code.
|
||||
|
||||
set -e -u
|
||||
|
||||
LOGFILE=$1
|
||||
|
||||
LINES=$(grep --invert-match "attempting MIRRORS if available" $LOGFILE | wc -l)
|
||||
if test "$LINES" -ne 0; then
|
||||
echo ==============================
|
||||
echo The build had warnings/errors:
|
||||
echo ==============================
|
||||
cat $LOGFILE
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exit 0
|
||||
@@ -0,0 +1,19 @@
|
||||
header:
|
||||
version: 14
|
||||
|
||||
repos:
|
||||
meta-clang:
|
||||
url: https://github.com/kraj/meta-clang
|
||||
|
||||
local_conf_header:
|
||||
toolchain: |
|
||||
TOOLCHAIN = "clang"
|
||||
PREFERRED_PROVIDER_llvm = "clang"
|
||||
PREFERRED_PROVIDER_llvm-native = "clang-native"
|
||||
PREFERRED_PROVIDER_nativesdk-llvm = "nativesdk-clang"
|
||||
PROVIDES:pn-clang = "llvm"
|
||||
PROVIDES:pn-clang-native = "llvm-native"
|
||||
PROVIDES:pn-nativesdk-clang = "nativesdk-llvm"
|
||||
# This is needed to stop bitbake getting confused about what clang/llvm is
|
||||
# being used, see https://github.com/kraj/meta-clang/pull/766
|
||||
BBMASK += "/meta/recipes-devtools/llvm/llvm.*\.bb"
|
||||
@@ -0,0 +1,14 @@
|
||||
header:
|
||||
version: 14
|
||||
includes:
|
||||
- ci/base.yml
|
||||
- ci/meta-openembedded.yml
|
||||
- ci/poky-tiny.yml
|
||||
|
||||
local_conf_header:
|
||||
extrapackages: |
|
||||
# Intentionally blank to prevent perf from being added to the image in base.yml
|
||||
|
||||
target:
|
||||
- corstone1000-image
|
||||
- perf
|
||||
@@ -0,0 +1,12 @@
|
||||
header:
|
||||
version: 14
|
||||
includes:
|
||||
- ci/corstone1000-common.yml
|
||||
- ci/fvp.yml
|
||||
|
||||
local_conf_header:
|
||||
fvp-config: |
|
||||
# Remove Dropbear SSH as it will not fit into the corstone1000 image.
|
||||
IMAGE_FEATURES:remove = " ssh-server-dropbear"
|
||||
|
||||
machine: corstone1000-fvp
|
||||
@@ -0,0 +1,6 @@
|
||||
header:
|
||||
version: 14
|
||||
includes:
|
||||
- ci/corstone1000-common.yml
|
||||
|
||||
machine: corstone1000-mps3
|
||||
@@ -0,0 +1,12 @@
|
||||
header:
|
||||
version: 14
|
||||
includes:
|
||||
- ci/base.yml
|
||||
- ci/fvp.yml
|
||||
- ci/poky-tiny.yml
|
||||
|
||||
local_conf_header:
|
||||
fvp-config: |
|
||||
IMAGE_FEATURES:remove = " ssh-server-dropbear"
|
||||
|
||||
machine: corstone500
|
||||
@@ -0,0 +1,7 @@
|
||||
header:
|
||||
version: 14
|
||||
|
||||
# Add universally helpful features when testing boards
|
||||
local_conf_header:
|
||||
debug: |
|
||||
EXTRA_IMAGE_FEATURES:append = " debug-tweaks"
|
||||
Executable
+31
@@ -0,0 +1,31 @@
|
||||
#! /usr/bin/env python3
|
||||
|
||||
"""
|
||||
Download the lockfile.yml produced by a CI pipeline, specified by the GitLab
|
||||
server, full name of the meta-arm project, and the refspec that was executed.
|
||||
|
||||
For example,
|
||||
$ ./download-lockfile.py https://gitlab.com/ rossburton/meta-arm master
|
||||
|
||||
SPDX-FileCopyrightText: Copyright 2023 Arm Limited and Contributors
|
||||
SPDX-License-Identifier: GPL-2.0-only
|
||||
"""
|
||||
|
||||
import argparse
|
||||
import gitlab
|
||||
import io
|
||||
import zipfile
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("server", help="GitLab server name")
|
||||
parser.add_argument("project", help="meta-arm project name")
|
||||
parser.add_argument("refspec", help="Branch/commit")
|
||||
args = parser.parse_args()
|
||||
|
||||
gl = gitlab.Gitlab(args.server)
|
||||
project = gl.projects.get(args.project)
|
||||
artefact = project.artifacts.download(ref_name=args.refspec, job="update-repos")
|
||||
|
||||
z = zipfile.ZipFile(io.BytesIO(artefact))
|
||||
z.extract("lockfile.yml")
|
||||
print("Fetched lockfile.yml")
|
||||
@@ -0,0 +1,17 @@
|
||||
header:
|
||||
version: 14
|
||||
|
||||
local_conf_header:
|
||||
bootfirmware: |
|
||||
PREFERRED_PROVIDER_virtual/bootloader = "edk2-firmware"
|
||||
MACHINE_FEATURES += "efi"
|
||||
TFA_UBOOT = "0"
|
||||
TFA_UEFI = "1"
|
||||
|
||||
EXTRA_IMAGEDEPENDS += "edk2-firmware"
|
||||
EFI_PROVIDER ?= "grub-efi"
|
||||
|
||||
QB_DEFAULT_BIOS = "QEMU_EFI.fd"
|
||||
WKS_FILE ?= "efi-disk.wks.in"
|
||||
failing_tests: |
|
||||
TEST_SUITES:remove = "xorg"
|
||||
@@ -0,0 +1,8 @@
|
||||
header:
|
||||
version: 14
|
||||
|
||||
local_conf_header:
|
||||
cc: |
|
||||
SKIP_RECIPE[gcc-cross-arm] = "Using external toolchain"
|
||||
TCMODE = "external-arm"
|
||||
EXTERNAL_TOOLCHAIN = "${TOPDIR}/toolchains/${TARGET_ARCH}"
|
||||
@@ -0,0 +1,7 @@
|
||||
header:
|
||||
version: 14
|
||||
includes:
|
||||
- ci/base.yml
|
||||
- ci/fvp.yml
|
||||
|
||||
machine: fvp-base
|
||||
@@ -0,0 +1,7 @@
|
||||
header:
|
||||
version: 14
|
||||
includes:
|
||||
- ci/base.yml
|
||||
- ci/fvp.yml
|
||||
|
||||
machine: fvp-baser-aemv8r64
|
||||
@@ -0,0 +1,12 @@
|
||||
header:
|
||||
version: 14
|
||||
|
||||
local_conf_header:
|
||||
testimagefvp: |
|
||||
LICENSE_FLAGS_ACCEPTED += "Arm-FVP-EULA"
|
||||
INHERIT += "fvpboot"
|
||||
failing_tests: |
|
||||
# This fails but we can't add to the ignorelist from meta-arm yet
|
||||
# https://bugzilla.yoctoproject.org/show_bug.cgi?id=14604
|
||||
TEST_SUITES:remove = "parselogs"
|
||||
TEST_SUITES:remove = "xorg"
|
||||
@@ -0,0 +1,22 @@
|
||||
# Simple target to build the FVPs that are publically available
|
||||
|
||||
header:
|
||||
version: 14
|
||||
includes:
|
||||
- ci/base.yml
|
||||
|
||||
machine: qemuarm64
|
||||
|
||||
local_conf_header:
|
||||
license: |
|
||||
LICENSE_FLAGS_ACCEPTED += "Arm-FVP-EULA"
|
||||
sdk: |
|
||||
SDKMACHINE = "x86_64"
|
||||
|
||||
target:
|
||||
- nativesdk-fvp-base-a-aem
|
||||
- nativesdk-fvp-corstone500
|
||||
- nativesdk-fvp-corstone1000
|
||||
- nativesdk-fvp-n1-edge
|
||||
- nativesdk-fvp-sgi575
|
||||
- nativesdk-fvp-tc1
|
||||
@@ -0,0 +1,7 @@
|
||||
header:
|
||||
version: 14
|
||||
|
||||
#NOTE: This is the default for poky. This is only being added for completeness/clarity
|
||||
local_conf_header:
|
||||
toolchain: |
|
||||
TOOLCHAIN = "gcc"
|
||||
@@ -0,0 +1,6 @@
|
||||
header:
|
||||
version: 14
|
||||
includes:
|
||||
- ci/base.yml
|
||||
|
||||
machine: generic-arm64
|
||||
Executable
+50
@@ -0,0 +1,50 @@
|
||||
#!/bin/bash
|
||||
set -u -e
|
||||
|
||||
BASENAME=arm-gnu-toolchain
|
||||
VER=${VER:-12.2.rel1}
|
||||
HOST_ARCH=${HOST_ARCH:-$(uname -m)}
|
||||
|
||||
DOWNLOAD_DIR=$1
|
||||
TOOLCHAIN_DIR=$2
|
||||
TOOLCHAIN_LINK_DIR=$3
|
||||
|
||||
# These should be already created by .gitlab-ci.yml, but do here if run outside of that env
|
||||
mkdir -p $DOWNLOAD_DIR $TOOLCHAIN_DIR $TOOLCHAIN_LINK_DIR
|
||||
|
||||
download() {
|
||||
TRIPLE=$1
|
||||
URL=https://developer.arm.com/-/media/Files/downloads/gnu/$VER/binrel/$BASENAME-$VER-$HOST_ARCH-$TRIPLE.tar.xz
|
||||
wget -P $DOWNLOAD_DIR -nc $URL
|
||||
}
|
||||
|
||||
if [ $HOST_ARCH = "aarch64" ]; then
|
||||
# AArch64 Linux hosted cross compilers
|
||||
|
||||
# AArch32 target with hard float
|
||||
download arm-none-linux-gnueabihf
|
||||
elif [ $HOST_ARCH = "x86_64" ]; then
|
||||
# x86_64 Linux hosted cross compilers
|
||||
|
||||
# AArch32 target with hard float
|
||||
download arm-none-linux-gnueabihf
|
||||
|
||||
# AArch64 GNU/Linux target
|
||||
download aarch64-none-linux-gnu
|
||||
else
|
||||
echo "ERROR - Unknown build arch of $HOST_ARCH"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for i in arm aarch64; do
|
||||
if [ ! -d $TOOLCHAIN_DIR/$BASENAME-$VER-$HOST_ARCH-$i-none-linux-gnu*/ ]; then
|
||||
if [ ! -f $DOWNLOAD_DIR/$BASENAME-$VER-$HOST_ARCH-$i-none-linux-gnu*.tar.xz ]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
tar -C $TOOLCHAIN_DIR -axvf $DOWNLOAD_DIR/$BASENAME-$VER-$HOST_ARCH-$i-none-linux-gnu*.tar.xz
|
||||
fi
|
||||
|
||||
# Setup a link for the toolchain to use local to the building machine (e.g., not in a shared location)
|
||||
ln -s $TOOLCHAIN_DIR/$BASENAME-$VER-$HOST_ARCH-$i-none-linux-gnu* $TOOLCHAIN_LINK_DIR/$i
|
||||
done
|
||||
@@ -0,0 +1,7 @@
|
||||
header:
|
||||
version: 14
|
||||
|
||||
#NOTE: This is the default for poky. This is only being added for completeness/clarity
|
||||
local_conf_header:
|
||||
libc: |
|
||||
TCLIBC = "glibc"
|
||||
Executable
+27
@@ -0,0 +1,27 @@
|
||||
#! /bin/bash
|
||||
|
||||
# This script is expecting an input of machine name, optionally followed by a
|
||||
# colon and a list of one or more parameters separated by commas between
|
||||
# brackets. For example, the following are acceptable:
|
||||
# corstone500
|
||||
# fvp-base: [testimage]
|
||||
# qemuarm64-secureboot: [clang, glibc, testimage]
|
||||
#
|
||||
# Turn this list into a series of yml files separated by colons to pass to kas
|
||||
|
||||
set -e -u
|
||||
|
||||
FILES="ci/$(echo $1 | cut -d ':' -f 1).yml"
|
||||
|
||||
for i in $(echo $1 | cut -s -d ':' -f 2 | sed 's/[][,]//g'); do
|
||||
# Given that there are no yml files for gcc or glibc, as those are the
|
||||
# defaults, we can simply ignore those parameters. They are necessary
|
||||
# to pass in so that matrix can correctly setup all of the permutations
|
||||
# of each individual run.
|
||||
if [[ $i == 'none' ]]; then
|
||||
continue
|
||||
fi
|
||||
FILES+=":ci/$i.yml"
|
||||
done
|
||||
|
||||
echo $FILES
|
||||
@@ -0,0 +1,6 @@
|
||||
header:
|
||||
version: 14
|
||||
includes:
|
||||
- ci/base.yml
|
||||
|
||||
machine: juno
|
||||
@@ -0,0 +1,6 @@
|
||||
header:
|
||||
version: 14
|
||||
|
||||
local_conf_header:
|
||||
kernel: |
|
||||
PREFERRED_PROVIDER_virtual/kernel = "linux-yocto-dev"
|
||||
@@ -0,0 +1,6 @@
|
||||
header:
|
||||
version: 14
|
||||
|
||||
local_conf_header:
|
||||
kernel: |
|
||||
PREFERRED_PROVIDER_virtual/kernel = "linux-yocto-rt"
|
||||
@@ -0,0 +1,7 @@
|
||||
header:
|
||||
version: 14
|
||||
|
||||
#NOTE: This is the default for poky. This is only being added for completeness/clarity
|
||||
local_conf_header:
|
||||
kernel: |
|
||||
PREFERRED_PROVIDER_virtual/kernel = "linux-yocto"
|
||||
Executable
+29
@@ -0,0 +1,29 @@
|
||||
#! /usr/bin/env python3
|
||||
|
||||
import pathlib
|
||||
import typing
|
||||
import sys
|
||||
|
||||
"""
|
||||
List all of the machines available under the listed sub-layers of meta-arm.
|
||||
"""
|
||||
def list_machines(layers: typing.Sequence[str]) -> typing.Set[str]:
|
||||
machines = set()
|
||||
|
||||
# We know we're in meta-arm/scripts, so find the top-level directory
|
||||
metaarm = pathlib.Path(__file__).resolve().parent.parent
|
||||
if metaarm.name != "meta-arm":
|
||||
raise Exception("Not running inside meta-arm")
|
||||
|
||||
for layer in layers:
|
||||
machines |= set(p.stem for p in (metaarm / layer / "conf" / "machine").glob("*.conf"))
|
||||
return machines
|
||||
|
||||
if __name__ == "__main__":
|
||||
if len(sys.argv) > 1:
|
||||
machines = list_machines(sys.argv[1:])
|
||||
print(" ".join(sorted(machines)))
|
||||
sys.exit(0)
|
||||
else:
|
||||
print("Usage:\n$ %s [layer name ...] " % sys.argv[0])
|
||||
sys.exit(1)
|
||||
@@ -0,0 +1,13 @@
|
||||
# Python logging configuration to write all warnings to a separate file
|
||||
version: 1
|
||||
|
||||
handlers:
|
||||
warnings:
|
||||
class: logging.FileHandler
|
||||
level: WARNING
|
||||
filename: warnings.log
|
||||
formatter: BitBake.logfileFormatter
|
||||
|
||||
loggers:
|
||||
BitBake:
|
||||
handlers: [warnings]
|
||||
@@ -0,0 +1,11 @@
|
||||
header:
|
||||
version: 14
|
||||
|
||||
repos:
|
||||
meta-openembedded:
|
||||
url: https://git.openembedded.org/meta-openembedded
|
||||
layers:
|
||||
meta-filesystems:
|
||||
meta-networking:
|
||||
meta-oe:
|
||||
meta-python:
|
||||
@@ -0,0 +1,8 @@
|
||||
header:
|
||||
version: 14
|
||||
includes:
|
||||
- ci/meta-openembedded.yml
|
||||
|
||||
repos:
|
||||
meta-virtualization:
|
||||
url: git://git.yoctoproject.org/meta-virtualization
|
||||
@@ -0,0 +1,10 @@
|
||||
header:
|
||||
version: 14
|
||||
includes:
|
||||
- ci/base.yml
|
||||
- ci/meta-openembedded.yml
|
||||
|
||||
machine: musca-b1
|
||||
|
||||
target:
|
||||
- trusted-firmware-m
|
||||
@@ -0,0 +1,10 @@
|
||||
header:
|
||||
version: 14
|
||||
includes:
|
||||
- ci/base.yml
|
||||
- ci/meta-openembedded.yml
|
||||
|
||||
machine: musca-s1
|
||||
|
||||
target:
|
||||
- trusted-firmware-m
|
||||
@@ -0,0 +1,6 @@
|
||||
header:
|
||||
version: 14
|
||||
|
||||
local_conf_header:
|
||||
libc: |
|
||||
TCLIBC = "musl"
|
||||
@@ -0,0 +1,14 @@
|
||||
header:
|
||||
version: 14
|
||||
includes:
|
||||
- ci/meta-openembedded.yml
|
||||
|
||||
local_conf_header:
|
||||
trusted_services: |
|
||||
TEST_SUITES:append = " trusted_services"
|
||||
# Include TS Crypto, TS Protected Storage, TS Internal and Trusted Storage SPs into optee-os image
|
||||
MACHINE_FEATURES:append = " arm-ffa ts-crypto ts-storage ts-its"
|
||||
# Include TS demo/test tools into image
|
||||
IMAGE_INSTALL:append = " packagegroup-ts-tests"
|
||||
# Include TS PSA Arch tests into image
|
||||
IMAGE_INSTALL:append = " packagegroup-ts-tests-psa"
|
||||
@@ -0,0 +1,10 @@
|
||||
header:
|
||||
version: 14
|
||||
includes:
|
||||
- ci/base.yml
|
||||
|
||||
machine: n1sdp
|
||||
|
||||
local_conf_header:
|
||||
unsupported_trusted_services: |
|
||||
MACHINE_FEATURES:remove = "ts-smm-gateway"
|
||||
Executable
+286
@@ -0,0 +1,286 @@
|
||||
#! /usr/bin/env python3
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
#
|
||||
|
||||
# TODO
|
||||
# - option to just list all broken files
|
||||
# - test suite
|
||||
# - validate signed-off-by
|
||||
|
||||
import argparse
|
||||
import collections
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import subprocess
|
||||
|
||||
status_values = (
|
||||
"accepted",
|
||||
"pending",
|
||||
"inappropriate",
|
||||
"backport",
|
||||
"submitted",
|
||||
"denied",
|
||||
)
|
||||
|
||||
|
||||
class PatchResult:
|
||||
# Whether the patch has an Upstream-Status or not
|
||||
missing_upstream_status = False
|
||||
# If the Upstream-Status tag is malformed in some way (string for bad bit)
|
||||
malformed_upstream_status = None
|
||||
# If the Upstream-Status value is unknown (boolean)
|
||||
unknown_upstream_status = False
|
||||
# The upstream status value (Pending, etc)
|
||||
upstream_status = None
|
||||
# Whether the patch has a Signed-off-by or not
|
||||
missing_sob = False
|
||||
# Whether the Signed-off-by tag is malformed in some way
|
||||
malformed_sob = False
|
||||
# The Signed-off-by tag value
|
||||
sob = None
|
||||
# Whether a patch looks like a CVE but doesn't have a CVE tag
|
||||
missing_cve = False
|
||||
|
||||
|
||||
class Summary:
|
||||
total = 0
|
||||
cve_missing = 0
|
||||
sob_missing = 0
|
||||
sob_malformed = 0
|
||||
status_missing = 0
|
||||
status_malformed = 0
|
||||
status_pending = 0
|
||||
|
||||
def blame_patch(patch):
|
||||
"""
|
||||
From a patch filename, return a list of "commit summary (author name <author
|
||||
email>)" strings representing the history.
|
||||
"""
|
||||
return subprocess.check_output(("git", "log",
|
||||
"--follow", "--find-renames", "--diff-filter=A",
|
||||
"--format=%s (%aN <%aE>)",
|
||||
"--", patch)).decode("utf-8").splitlines()
|
||||
|
||||
def patchreview(patches):
|
||||
# General pattern: start of line, optional whitespace, tag with optional
|
||||
# hyphen or spaces, maybe a colon, some whitespace, then the value, all case
|
||||
# insensitive.
|
||||
sob_re = re.compile(r"^[\t ]*(Signed[-_ ]off[-_ ]by:?)[\t ]*(.+)", re.IGNORECASE | re.MULTILINE)
|
||||
status_re = re.compile(r"^[\t ]*(Upstream[-_ ]Status:?)[\t ]*(\w*)", re.IGNORECASE | re.MULTILINE)
|
||||
cve_tag_re = re.compile(r"^[\t ]*(CVE:)[\t ]*(.*)", re.IGNORECASE | re.MULTILINE)
|
||||
cve_re = re.compile(r"cve-[0-9]{4}-[0-9]{4,6}", re.IGNORECASE)
|
||||
|
||||
results = {}
|
||||
|
||||
for patch in patches:
|
||||
|
||||
result = PatchResult()
|
||||
results[patch] = result
|
||||
|
||||
content = open(patch, encoding="ascii", errors="ignore").read()
|
||||
|
||||
# Find the Signed-off-by tag
|
||||
match = sob_re.search(content)
|
||||
if match:
|
||||
value = match.group(1)
|
||||
if value != "Signed-off-by:":
|
||||
result.malformed_sob = value
|
||||
result.sob = match.group(2)
|
||||
else:
|
||||
result.missing_sob = True
|
||||
|
||||
# Find the Upstream-Status tag
|
||||
match = status_re.search(content)
|
||||
if match:
|
||||
value = match.group(1)
|
||||
if value != "Upstream-Status:":
|
||||
result.malformed_upstream_status = value
|
||||
|
||||
value = match.group(2).lower()
|
||||
# TODO: check case
|
||||
if value not in status_values:
|
||||
result.unknown_upstream_status = True
|
||||
result.upstream_status = value
|
||||
else:
|
||||
result.missing_upstream_status = True
|
||||
|
||||
# Check that patches which looks like CVEs have CVE tags
|
||||
if cve_re.search(patch) or cve_re.search(content):
|
||||
if not cve_tag_re.search(content):
|
||||
result.missing_cve = True
|
||||
# TODO: extract CVE list
|
||||
|
||||
return results
|
||||
|
||||
|
||||
def analyse(results, want_blame=False, verbose=True):
|
||||
"""
|
||||
want_blame: display blame data for each malformed patch
|
||||
verbose: display per-file results instead of just summary
|
||||
"""
|
||||
|
||||
# want_blame requires verbose, so disable blame if we're not verbose
|
||||
if want_blame and not verbose:
|
||||
want_blame = False
|
||||
|
||||
summary = Summary()
|
||||
|
||||
for patch in sorted(results):
|
||||
r = results[patch]
|
||||
summary.total += 1
|
||||
need_blame = False
|
||||
|
||||
# Build statistics
|
||||
if r.missing_sob:
|
||||
summary.sob_missing += 1
|
||||
if r.malformed_sob:
|
||||
summary.sob_malformed += 1
|
||||
if r.missing_upstream_status:
|
||||
summary.status_missing += 1
|
||||
if r.malformed_upstream_status or r.unknown_upstream_status:
|
||||
summary.status_malformed += 1
|
||||
# Count patches with no status as pending
|
||||
summary.status_pending += 1
|
||||
if r.missing_cve:
|
||||
summary.cve_missing += 1
|
||||
if r.upstream_status == "pending":
|
||||
summary.status_pending += 1
|
||||
|
||||
# Output warnings
|
||||
if r.missing_sob:
|
||||
need_blame = True
|
||||
if verbose:
|
||||
print("Missing Signed-off-by tag (%s)" % patch)
|
||||
if r.malformed_sob:
|
||||
need_blame = True
|
||||
if verbose:
|
||||
print("Malformed Signed-off-by '%s' (%s)" % (r.malformed_sob, patch))
|
||||
if r.missing_cve:
|
||||
need_blame = True
|
||||
if verbose:
|
||||
print("Missing CVE tag (%s)" % patch)
|
||||
if r.missing_upstream_status:
|
||||
need_blame = True
|
||||
if verbose:
|
||||
print("Missing Upstream-Status tag (%s)" % patch)
|
||||
if r.malformed_upstream_status:
|
||||
need_blame = True
|
||||
if verbose:
|
||||
print("Malformed Upstream-Status '%s' (%s)" % (r.malformed_upstream_status, patch))
|
||||
if r.unknown_upstream_status:
|
||||
need_blame = True
|
||||
if verbose:
|
||||
print("Unknown Upstream-Status value '%s' (%s)" % (r.upstream_status, patch))
|
||||
|
||||
if want_blame and need_blame:
|
||||
print("\n".join(blame_patch(patch)) + "\n")
|
||||
|
||||
return summary
|
||||
|
||||
|
||||
def display_summary(summary, verbose):
|
||||
def percent(num):
|
||||
try:
|
||||
return "%d (%d%%)" % (num, round(num * 100.0 / summary.total))
|
||||
except ZeroDivisionError:
|
||||
return "N/A"
|
||||
|
||||
if verbose:
|
||||
print()
|
||||
|
||||
print("""Total patches found: %d
|
||||
Patches missing Signed-off-by: %s
|
||||
Patches with malformed Signed-off-by: %s
|
||||
Patches missing CVE: %s
|
||||
Patches missing Upstream-Status: %s
|
||||
Patches with malformed Upstream-Status: %s
|
||||
Patches in Pending state: %s""" % (summary.total,
|
||||
percent(summary.sob_missing),
|
||||
percent(summary.sob_malformed),
|
||||
percent(summary.cve_missing),
|
||||
percent(summary.status_missing),
|
||||
percent(summary.status_malformed),
|
||||
percent(summary.status_pending)))
|
||||
|
||||
|
||||
def generate_metrics(summary, output):
|
||||
# https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md
|
||||
# Summary attribute name, MetricPoint help
|
||||
mapping = (
|
||||
("total", "Total patches"),
|
||||
("cve_missing", "Patches missing CVE tag"),
|
||||
("sob_malformed", "Patches with malformed Signed-off-by"),
|
||||
("sob_missing", "Patches with missing Signed-off-by"),
|
||||
("status_malformed", "Patches with malformed Upstream-Status"),
|
||||
("status_missing", "Patches with missing Upstream-Status"),
|
||||
("status_pending", "Patches with Pending Upstream-Status")
|
||||
)
|
||||
for attr, help in mapping:
|
||||
metric = f"patch_check_{attr}"
|
||||
value = getattr(summary, attr)
|
||||
output.write(f"""
|
||||
# TYPE {metric} gauge
|
||||
# HELP {help}
|
||||
{metric} {value}
|
||||
""")
|
||||
output.write("\n# EOF\n")
|
||||
|
||||
def histogram(results):
|
||||
import math
|
||||
|
||||
from toolz import dicttoolz, recipes
|
||||
counts = recipes.countby(lambda r: r.upstream_status, results.values())
|
||||
bars = dicttoolz.valmap(lambda v: "#" * int(math.ceil(float(v) / len(results) * 100)), counts)
|
||||
for k in bars:
|
||||
print("%-20s %s (%d)" % (k.capitalize() if k else "No status", bars[k], counts[k]))
|
||||
|
||||
def gather_patches(directories):
|
||||
patches = []
|
||||
for directory in directories:
|
||||
filenames = subprocess.check_output(("git", "-C", directory, "ls-files", "recipes-*/**/*.patch", "recipes-*/**/*.diff")).decode("utf-8").split()
|
||||
patches += [os.path.join(directory, f) for f in filenames]
|
||||
return patches
|
||||
|
||||
if __name__ == "__main__":
|
||||
args = argparse.ArgumentParser(description="Patch Review Tool")
|
||||
args.add_argument("-b", "--blame", action="store_true", help="show blame for malformed patches")
|
||||
args.add_argument("-v", "--verbose", action="store_true", help="show per-patch results")
|
||||
args.add_argument("-g", "--histogram", action="store_true", help="show patch histogram")
|
||||
args.add_argument("-j", "--json", help="update JSON")
|
||||
args.add_argument("-m", "--metrics", type=argparse.FileType('w'), help="write OpenMetrics")
|
||||
args.add_argument("dirs", metavar="DIRECTORY", nargs="+", help="directory to scan")
|
||||
args = args.parse_args()
|
||||
|
||||
patches = gather_patches(args.dirs)
|
||||
results = patchreview(patches)
|
||||
summary = analyse(results, want_blame=args.blame, verbose=args.verbose)
|
||||
display_summary(summary, verbose=args.verbose)
|
||||
|
||||
if args.json:
|
||||
if os.path.isfile(args.json):
|
||||
data = json.load(open(args.json))
|
||||
else:
|
||||
data = []
|
||||
|
||||
row = collections.Counter()
|
||||
row["total"] = len(results)
|
||||
row["date"] = subprocess.check_output(["git", "-C", args.dirs[0], "show", "-s", "--pretty=format:%cd", "--date=format:%s"]).decode("utf-8").strip()
|
||||
for r in results.values():
|
||||
if r.upstream_status in status_values:
|
||||
row[r.upstream_status] += 1
|
||||
if r.malformed_upstream_status or r.missing_upstream_status:
|
||||
row["malformed-upstream-status"] += 1
|
||||
if r.malformed_sob or r.missing_sob:
|
||||
row["malformed-sob"] += 1
|
||||
|
||||
data.append(row)
|
||||
json.dump(data, open(args.json, "w"))
|
||||
|
||||
if args.metrics:
|
||||
generate_metrics(summary, args.metrics)
|
||||
|
||||
if args.histogram:
|
||||
print()
|
||||
histogram(results)
|
||||
@@ -0,0 +1,14 @@
|
||||
header:
|
||||
version: 14
|
||||
|
||||
distro: poky-tiny
|
||||
|
||||
local_conf_header:
|
||||
hacking: |
|
||||
TEST_SUITES = "ping"
|
||||
extrapackages: |
|
||||
# Intentionally blank to prevent perf from being added to the image in base.yml
|
||||
|
||||
target:
|
||||
- core-image-minimal
|
||||
- perf
|
||||
@@ -0,0 +1,4 @@
|
||||
header:
|
||||
version: 14
|
||||
|
||||
distro: poky
|
||||
@@ -0,0 +1,14 @@
|
||||
header:
|
||||
version: 14
|
||||
includes:
|
||||
- ci/generic-arm64.yml
|
||||
|
||||
local_conf_header:
|
||||
failing_tests: |
|
||||
DEFAULT_TEST_SUITES:remove = "parselogs"
|
||||
|
||||
machine: qemu-generic-arm64
|
||||
|
||||
target:
|
||||
- core-image-sato
|
||||
- sbsa-acs
|
||||
@@ -0,0 +1,12 @@
|
||||
header:
|
||||
version: 14
|
||||
includes:
|
||||
- ci/base.yml
|
||||
|
||||
machine: qemuarm-secureboot
|
||||
|
||||
target:
|
||||
- core-image-base
|
||||
- optee-examples
|
||||
- optee-test
|
||||
- optee-os-tadevkit
|
||||
@@ -0,0 +1,6 @@
|
||||
header:
|
||||
version: 14
|
||||
includes:
|
||||
- ci/base.yml
|
||||
|
||||
machine: qemuarm
|
||||
@@ -0,0 +1,14 @@
|
||||
header:
|
||||
version: 14
|
||||
includes:
|
||||
- ci/meta-openembedded.yml
|
||||
|
||||
local_conf_header:
|
||||
trusted_services: |
|
||||
TEST_SUITES:append = " trusted_services"
|
||||
# Include TS Crypto, TS Protected Storage, TS Internal Trusted Storage and SMM-Gateway SPs into optee-os image
|
||||
MACHINE_FEATURES:append = " arm-ffa ts-crypto ts-storage ts-its ts-smm-gateway"
|
||||
# Include TS demo/test tools into image
|
||||
IMAGE_INSTALL:append = " packagegroup-ts-tests"
|
||||
# Include TS PSA Arch tests into image
|
||||
IMAGE_INSTALL:append = " packagegroup-ts-tests-psa"
|
||||
@@ -0,0 +1,12 @@
|
||||
header:
|
||||
version: 14
|
||||
includes:
|
||||
- ci/base.yml
|
||||
|
||||
machine: qemuarm64-secureboot
|
||||
|
||||
target:
|
||||
- core-image-base
|
||||
- optee-examples
|
||||
- optee-test
|
||||
- optee-os-tadevkit
|
||||
@@ -0,0 +1,6 @@
|
||||
header:
|
||||
version: 14
|
||||
includes:
|
||||
- ci/base.yml
|
||||
|
||||
machine: qemuarm64
|
||||
@@ -0,0 +1,6 @@
|
||||
header:
|
||||
version: 14
|
||||
includes:
|
||||
- ci/base.yml
|
||||
|
||||
machine: qemuarmv5
|
||||
@@ -0,0 +1,7 @@
|
||||
header:
|
||||
version: 14
|
||||
|
||||
local_conf_header:
|
||||
setup: |
|
||||
BB_LOGCONFIG = ""
|
||||
SANITY_TESTED_DISTROS = ""
|
||||
@@ -0,0 +1,6 @@
|
||||
header:
|
||||
version: 14
|
||||
includes:
|
||||
- ci/base.yml
|
||||
|
||||
machine: sgi575
|
||||
@@ -0,0 +1,12 @@
|
||||
header:
|
||||
version: 14
|
||||
includes:
|
||||
- ci/base.yml
|
||||
- ci/fvp.yml
|
||||
- ci/meta-openembedded.yml
|
||||
|
||||
machine: tc1
|
||||
|
||||
target:
|
||||
- core-image-minimal
|
||||
- trusted-firmware-m
|
||||
@@ -0,0 +1,21 @@
|
||||
header:
|
||||
version: 14
|
||||
includes:
|
||||
- ci/debug.yml
|
||||
|
||||
local_conf_header:
|
||||
testimage: |
|
||||
IMAGE_CLASSES += "testimage"
|
||||
TESTIMAGE_AUTO = "1"
|
||||
kvm: |
|
||||
QEMU_USE_KVM = ""
|
||||
slirp: |
|
||||
TEST_RUNQEMUPARAMS = "slirp"
|
||||
TEST_SERVER_IP = "127.0.0.1"
|
||||
QEMU_USE_SLIRP = "1"
|
||||
sshd: |
|
||||
IMAGE_FEATURES:append = " ssh-server-dropbear"
|
||||
sshkeys: |
|
||||
CORE_IMAGE_EXTRA_INSTALL += "ssh-pregen-hostkeys"
|
||||
universally_failing_tests: |
|
||||
TEST_SUITES:remove = "opkg"
|
||||
@@ -0,0 +1,7 @@
|
||||
header:
|
||||
version: 14
|
||||
|
||||
local_conf_header:
|
||||
tftf: |
|
||||
TFA_UBOOT = "0"
|
||||
TFTF_TESTS = "1"
|
||||
@@ -0,0 +1,19 @@
|
||||
header:
|
||||
version: 14
|
||||
includes:
|
||||
- ci/base.yml
|
||||
|
||||
# Target is arm64 and SDK is x86-64 to ensure that we exercise both
|
||||
# architectures
|
||||
|
||||
machine: qemuarm64
|
||||
local_conf_header:
|
||||
toolchains: |
|
||||
SDKMACHINE = "x86_64"
|
||||
|
||||
target:
|
||||
- gcc-aarch64-none-elf
|
||||
- nativesdk-gcc-aarch64-none-elf
|
||||
- gcc-arm-none-eabi
|
||||
- nativesdk-gcc-arm-none-eabi
|
||||
- nativesdk-androidclang
|
||||
@@ -0,0 +1,8 @@
|
||||
header:
|
||||
version: 14
|
||||
|
||||
local_conf_header:
|
||||
bootfirmware: |
|
||||
PREFERRED_PROVIDER_virtual/bootloader = "u-boot"
|
||||
TFA_UBOOT = "1"
|
||||
TFA_UEFI = "0"
|
||||
Executable
+48
@@ -0,0 +1,48 @@
|
||||
#! /usr/bin/env python3
|
||||
|
||||
# Update clones of the repositories we need in KAS_REPO_REF_DIR to speed up fetches
|
||||
|
||||
import sys
|
||||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
import pathlib
|
||||
|
||||
def repo_shortname(url):
|
||||
# Taken from Kas (Repo.__getattr__) to ensure the logic is right
|
||||
from urllib.parse import urlparse
|
||||
url = urlparse(url)
|
||||
return ('{url.netloc}{url.path}'
|
||||
.format(url=url)
|
||||
.replace('@', '.')
|
||||
.replace(':', '.')
|
||||
.replace('/', '.')
|
||||
.replace('*', '.'))
|
||||
|
||||
repositories = (
|
||||
"https://git.yoctoproject.org/git/poky",
|
||||
"https://git.openembedded.org/meta-openembedded",
|
||||
"https://git.yoctoproject.org/git/meta-virtualization",
|
||||
"https://github.com/kraj/meta-clang",
|
||||
)
|
||||
|
||||
if __name__ == "__main__":
|
||||
if "KAS_REPO_REF_DIR" not in os.environ:
|
||||
print("KAS_REPO_REF_DIR needs to be set")
|
||||
sys.exit(1)
|
||||
|
||||
base_repodir = pathlib.Path(os.environ["KAS_REPO_REF_DIR"])
|
||||
|
||||
for repo in repositories:
|
||||
repodir = base_repodir / repo_shortname(repo)
|
||||
|
||||
if "CI_CLEAN_REPOS" in os.environ:
|
||||
print("Cleaning %s..." % repo)
|
||||
shutil.rmtree(repodir, ignore_errors=True)
|
||||
|
||||
if repodir.exists():
|
||||
print("Updating %s..." % repo)
|
||||
subprocess.run(["git", "-C", repodir, "-c", "gc.autoDetach=false", "fetch"], check=True)
|
||||
else:
|
||||
print("Cloning %s..." % repo)
|
||||
subprocess.run(["git", "clone", "--bare", repo, repodir], check=True)
|
||||
@@ -0,0 +1,11 @@
|
||||
header:
|
||||
version: 14
|
||||
includes:
|
||||
- ci/meta-virtualization.yml
|
||||
|
||||
local_conf_header:
|
||||
meta-virt: |
|
||||
DISTRO_FEATURES:append = " virtualization xen"
|
||||
|
||||
target:
|
||||
- xen-image-minimal
|
||||
Reference in New Issue
Block a user