root/build-tools/audit-pkgs
Dean Troyer cfe45dadae StarlingX open source release updates
Signed-off-by: Dean Troyer <dtroyer@gmail.com>
2018-06-01 07:45:23 -07:00

71 lines
2.4 KiB
Bash
Executable File

#!/bin/bash
rpm_compare () {
local r="$1"
local r2="$2"
local line
local f=$(basename $r)
local f2=$(basename $r2)
rpm -q --dump --nosignature -p $r | awk ' { print $1 "\n" $1 " " $5 " " $6 " " $7 " " $8 " " $9 " " $10 " " $11 } ' > /tmp/dump.new
rpm -q --dump --nosignature -p $r2 | awk ' { print $1 "\n" $1 " " $5 " " $6 " " $7 " " $8 " " $9 " " $10 " " $11 } ' > /tmp/dump.old
first_line=1
diff -y -W 200 --suppress-common-lines /tmp/dump.new /tmp/dump.old | grep '|' |
while read -r line; do
left=$(echo "$line" | awk -F '|' '{ print $1 }')
right=$(echo "$line" | awk -F '|' '{ print $2 }')
left_f=$(echo "$left" | awk '{ print $1 }')
right_f=$(echo "$right" | awk '{ print $1 }')
if [ "$left_f" != "$right_f" ];then
continue
fi
if [ $first_line -eq 1 ]; then
echo ""
echo "$f vs $f2"
first_line=0
fi
echo "$line"
done
}
echo ""
echo "======================================================"
echo "Auditing built packages vs unpatched upstream packages"
echo "======================================================"
for r in $(find $MY_WORKSPACE/*/rpmbuild/RPMS -name '*.rpm' | grep -v '.src.rpm' | grep -v debuginfo); do
f=$(basename $r)
f2=$(echo $f | sed 's#[.]tis[.][0-9]*[.]#.#' | sed 's#[.]tis[.]#.#')
r2=$(find $MY_REPO/cgcs-centos-repo/Binary/ -name $f2)
if [ "$r2" == "" ]; then
# Probably one of our own
# echo "Couldn't find '$f2'"
continue
fi
rpm_compare "$r" "$r2"
done
echo ""
echo "============================"
echo "Auditing built for conflicts"
echo "============================"
grep 'conflicts with file from package' -r --binary-files=without-match $MY_WORKSPACE/*/results/ |
while read -r line; do
w=$(echo "$line" | awk '{ print $8 }')".rpm"
w2=$(echo "$line" | awk '{ print $14 }')".rpm"
echo "$w $w2"
done | sort --unique | sed 's#bash-completion-1:#bash-completion-#' |
while read -r line2; do
f=$(echo "$line2" | awk '{ print $1 }')
f2=$(echo "$line2" | awk '{ print $2 }')
r=$(find $MY_REPO/cgcs-centos-repo/Binary/ $MY_WORKSPACE/*/rpmbuild/RPMS -name $f)
r2=$(find $MY_REPO/cgcs-centos-repo/Binary/ $MY_WORKSPACE/*/rpmbuild/RPMS -name $f2)
# echo ""
# echo "$f vs $f2"
# echo "$r vs $r2"
if [ "$r" != "" ] && [ "$r2" != "" ]; then
rpm_compare "$r" "$r2"
fi
done