#!/bin/bash # # SPDX-License-Identifier: GPL-2.0-only # PARENTDIR=`realpath $1` TARGETDIR=`realpath $2` RESULTSDIR=`realpath -m $3` BUILDDIR=`realpath $4` BRANCH=$5 OURDIR=`dirname $0` TIMESTAMP=`date +"%s"` # # CVE Checks # if [ ! -e $PARENTDIR/yocto-metrics ]; then git clone ssh://git@push.yoctoproject.org/yocto-metrics $PARENTDIR/yocto-metrics fi if [ ! -d $RESULTSDIR ]; then mkdir $RESULTSDIR fi mkdir -p $PARENTDIR/yocto-metrics/cve-check/$BRANCH/ cd .. . oe-init-build-env build bitbake world --runall cve_check -R conf/distro/include/cve-extra-exclusions.inc if [ -e tmp/log/cve/cve-summary.json ]; then git -C $PARENTDIR/yocto-metrics rm cve-check/$BRANCH/*.json mkdir -p $PARENTDIR/yocto-metrics/cve-check/$BRANCH cp tmp/log/cve/cve-summary.json $PARENTDIR/yocto-metrics/cve-check/$BRANCH/$TIMESTAMP.json git -C $PARENTDIR/yocto-metrics add cve-check/$BRANCH/$TIMESTAMP.json git -C $PARENTDIR/yocto-metrics commit -asm "Autobuilder adding new CVE data for branch $BRANCH" git -C $PARENTDIR/yocto-metrics push $OURDIR/cve-report.py tmp/log/cve/cve-summary.json > $RESULTSDIR/cve-status-$BRANCH.txt fi if [ "$BRANCH" = "master" ]; then mkdir -p $PARENTDIR/yocto-metrics/cve-check/ $OURDIR/cve-generate-chartdata --json $PARENTDIR/yocto-metrics/cve-count-byday.json --resultsdir $PARENTDIR/yocto-metrics/cve-check/ git -C $PARENTDIR/yocto-metrics add cve-count-byday.json git -C $PARENTDIR/yocto-metrics commit -asm "Autobuilder updating CVE counts" git -C $PARENTDIR/yocto-metrics push cp $PARENTDIR/yocto-metrics/cve-count-byday.json $RESULTSDIR cp $PARENTDIR/yocto-metrics/cve-count-byday-lastyear.json $RESULTSDIR fi