Add capability for checking CVE json

* Add capability for checking CVE kernels.json
* Stop spam of console when missing a file
* Fix weird indentation in some places

Change-Id: I6181649c604f2b46082257d4e021bd8dcee16937
This commit is contained in:
Harry Youd
2017-05-14 14:46:30 +01:00
parent ceb8610b53
commit e0f5ea8f53

View File

@@ -6,6 +6,7 @@
updaterrepolocation="../updater" updaterrepolocation="../updater"
wikirepolocation="../wiki" wikirepolocation="../wiki"
jenkinsrepolocation="../jenkins" jenkinsrepolocation="../jenkins"
cverepolocation="../cve"
showallmaintainers=false showallmaintainers=false
if ! [ -z $1 ]; then showallmaintainers=true; fi if ! [ -z $1 ]; then showallmaintainers=true; fi
if ! [ -d $wikirepolocation ]; then if ! [ -d $wikirepolocation ]; then
@@ -24,7 +25,7 @@ hudsonlist=$(cat $jenkinsrepolocation/lineage-build-targets | cut -f1 -d ' ' | s
# Print list of maintainers if told to # Print list of maintainers if told to
if [ $showallmaintainers == true ]; then if [ $showallmaintainers == true ]; then
echo "## Maintainers of all devices in hudson according to the wiki:" echo "## Maintainers of all devices in hudson according to the wiki:"
for codename in $hudsonlist; do for codename in $hudsonlist; do
if [ -f $wikirepolocation/_data/devices/$codename.yml ]; then if [ -f $wikirepolocation/_data/devices/$codename.yml ]; then
wiki_maintainers=$(grep maintainer $wikirepolocation/_data/devices/$codename.yml | cut -d ':' -f2 | awk '{$1=$1};1') wiki_maintainers=$(grep maintainer $wikirepolocation/_data/devices/$codename.yml | cut -d ':' -f2 | awk '{$1=$1};1')
@@ -35,7 +36,7 @@ echo "## Maintainers of all devices in hudson according to the wiki:"
printf "%-15s%-40s\n" "$codename:" "$wiki_maintainers" printf "%-15s%-40s\n" "$codename:" "$wiki_maintainers"
fi fi
done done
printf "\n" printf "\n"
fi fi
# Check if a wiki page exists for each device # Check if a wiki page exists for each device
@@ -85,15 +86,33 @@ printf "\n"
# Check that devices have an update page # Check that devices have an update page
echo "## Devices present in hudson, but don't have an update page:" echo "## Devices present in hudson, but don't have an update page:"
updaterfail=0 updaterfail=0
for codename in $hudsonlist; do if [ -f $updaterrepolocation/devices.json ]; then
if [ -f $updaterrepolocation/devices.json ]; then for codename in $hudsonlist; do
if ! grep -q "model\": \"$codename\"" $updaterrepolocation/devices.json; then if ! grep -q "model\": \"$codename\"" $updaterrepolocation/devices.json; then
echo $codename echo $codename
((updaterfail++)) ((updaterfail++))
fi fi
else done
else
echo "$updaterrepolocation/devices.json doesn't exist" echo "$updaterrepolocation/devices.json doesn't exist"
((updaterfail++)) ((updaterfail++))
fi fi
done
if [ $updaterfail = 0 ]; then echo "none"; else echo "total = $updaterfail"; fi if [ $updaterfail = 0 ]; then echo "none"; else echo "total = $updaterfail"; fi
printf "\n"
# Check that devices are listed in CVE tracker
echo "## Devices present in hudson, but don't have a kernel listed for them in CVE tracker:"
cvefail=0
if [ -f $cverepolocation/kernels.json ]; then
for codename in $hudsonlist; do
if ! grep -q "android_device_"'.*'"_$codename" $cverepolocation/kernels.json; then
echo $codename
((cvefail++))
fi
done
else
echo "$cverepolocation/kernels.json doesn't exist"
((cvefail++))
fi
if [ $cvefail = 0 ]; then echo "none"; else echo "total = $cvefail"; fi