- 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 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 count of checks and packages from rpmlint.log
- remove Check time report from rpmlint.log - remove Check time report from rpmlint.log
- ELF diffing performance improvements - ELF diffing performance improvements

View File

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

View File

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

View File

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