- handle -a also in same-build-result.sh

- Find rpmlint.log in more places
- fix logic error in appstream comparison
- rework exit handling in same-build-result.sh
- Fix result in case no rpmlint.log exist

OBS-URL: https://build.opensuse.org/package/show/openSUSE:Tools/build-compare?expand=0&rev=291
This commit is contained in:
Olaf Hering 2022-03-07 10:57:31 +00:00 committed by Git OBS Bridge
parent f7c0d407ba
commit 3645d843bb
4 changed files with 45 additions and 16 deletions

View File

@ -1,6 +1,11 @@
-------------------------------------------------------------------
Fri Mar 4 12:34:56 UTC 2022 - olaf@aepfle.de
- handle -a also in same-build-result.sh
- Find rpmlint.log in more places
- fix logic error in appstream comparison
- rework exit handling in same-build-result.sh
- Fix result in case no rpmlint.log exist
- remove count of checks and packages from rpmlint.log
- remove Check time report from rpmlint.log
- ELF diffing performance improvements

View File

@ -21,7 +21,7 @@ Summary: Build Result Compare Script
License: GPL-2.0+
Group: Development/Tools/Building
Url: https://github.com/openSUSE/build-compare
Version: 20220306T230110.5c8c763
Version: 20220307T115648.b5abdde
Release: 0
Source1: COPYING
Source2: same-build-result.sh

View File

@ -971,7 +971,7 @@ check_single_file()
if test -z "$elfdiff"
then
rm old/$file.objdump new/$file.objdump &
return 1
return 0
fi
watchdog_touch
elfdiff=

View File

@ -14,6 +14,11 @@
CMPSCRIPT=${0%/*}/pkg-diff.sh
SCMPSCRIPT=${0%/*}/srpm-check.sh
declare -a exit_code
# exit_code[0]='' # binaries_differ
# exit_code[1]='' # rpmlint_differs
# exit_code[2]='' # appdata_differs
# exit_code[3]='' # srcrpm_differs
file1=`mktemp`
file2=`mktemp`
_x() {
@ -90,7 +95,13 @@ if test ! -f "$nsrpm"; then
fi
echo "compare $osrpm $nsrpm"
bash $SCMPSCRIPT "$osrpm" "$nsrpm" || exit 1
if bash $SCMPSCRIPT "$osrpm" "$nsrpm"
then
: src.rpm identical
else
test -z "${check_all}" && exit 1
exit_code[3]='srcrpm_differs'
fi
# technically we should not all exclude all -32bit but filter for different archs,
# like done with -x86
@ -121,7 +132,6 @@ NEWRPMS=($( sort --field-separator=/ --key=` sed -n '1s@[^/]@@gp' ${file2} | wc
ver_rel1=$(rpm -qp --nodigest --nosignature --qf "%{VERSION}-%{RELEASE}" "${OLDRPMS[0]}"|sed -e 's/\./\\./g')
ver_rel2=$(rpm -qp --nodigest --nosignature --qf "%{VERSION}-%{RELEASE}" "${NEWRPMS[0]}"|sed -e 's/\./\\./g')
SUCCESS=1
rpmqp='rpm -qp --qf %{NAME} --nodigest --nosignature '
for opac in ${OLDRPMS[*]}; do
npac=${NEWRPMS[0]}
@ -138,7 +148,7 @@ for opac in ${OLDRPMS[*]}; do
echo "skipping -debuginfo package"
;;
*)
bash $CMPSCRIPT $check_all "$opac" "$npac" || SUCCESS=0
bash $CMPSCRIPT $check_all "$opac" "$npac" || exit_code[0]='binaries_differ'
;;
esac
done
@ -148,14 +158,20 @@ if [ -n "${NEWRPMS[0]}" ]; then
exit 1
fi
OTHERDIR=
# Compare rpmlint.log files
if test -d /home/abuild/rpmbuild/OTHER; then
OTHERDIR=/home/abuild/rpmbuild/OTHER
elif test -d /usr/src/packages/OTHER; then
OTHERDIR=/usr/src/packages/OTHER
else
echo "no OTHERDIR"
OTHERDIR=
for newdir in $NEWDIRS
do
test -f "${newdir}/rpmlint.log" || continue
OTHERDIR="${newdir}"
break
done
test -n "$OTHERDIR" || echo "no OTHERDIR"
fi
if test -n "$OTHERDIR"; then
@ -186,33 +202,41 @@ if test -n "$OTHERDIR"; then
if ! cmp -s $file1 $file2; then
echo "rpmlint.log files differ:"
diff -u $file1 $file2 |head -n 20
SUCCESS=0
exit_code[1]='rpmlint_differs'
fi
rm $file1 $file2
elif test -e ${new_log} ; then
echo "rpmlint.log is new"
SUCCESS=0
else
if test -e "${new_log}"
then
exit_code[1]='rpmlint_new'
echo "rpmlint.log is new"
elif test -e "${old_log}"
then
exit_code[1]='rpmlint_old'
echo "rpmlint.log disappeared"
else
echo "No rpmlint.log available"
fi
fi
appdatas=$(cd $OTHERDIR && find . -name "*-appdata.xml")
for xml in $appdatas; do
# compare appstream data
if test -e $OLDDIR/$xml -a -e $OTHERDIR/$xml; then
if test -e $OLDDIR/$xml && test -e $OTHERDIR/$xml; then
file1=$OLDDIR/$xml
file2=$OTHERDIR/$xml
if ! cmp -s $file1 $file2; then
echo "$xml files differ:"
diff -u0 $file1 $file2 |head -n 20
SUCCESS=0
exit_code[2]='appdata_differs'
fi
elif test -e $OTHERDIR/$xml; then
echo "$xml is new"
SUCCESS=0
exit_code[2]='appdata_new'
fi
done
fi
if test $SUCCESS -eq 0; then
if test -n "${exit_code[*]}"; then
exit 1
fi
echo 'compare validated build as identical !'