Accepting request 283746 from home:olh:branches:openSUSE:Tools

- 2015.02.02
- Trim VERSION-RELEASE also in rpmlint log
- Adjust regex for spec comparing in src.rpm
- handle also stick and setuid directory from file(1) output

OBS-URL: https://build.opensuse.org/request/show/283746
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Tools/build-compare?expand=0&rev=160
This commit is contained in:
Olaf Hering 2015-02-02 11:33:28 +00:00 committed by Git OBS Bridge
parent dae6fada1c
commit c1156c0dab
5 changed files with 22 additions and 9 deletions

View File

@ -1,3 +1,11 @@
-------------------------------------------------------------------
Mon Feb 2 10:05:40 UTC 2015 - olaf@aepfle.de
- 2015.02.02
- Trim VERSION-RELEASE also in rpmlint log
- Adjust regex for spec comparing in src.rpm
- handle also stick and setuid directory from file(1) output
-------------------------------------------------------------------
Wed Jan 21 08:34:32 UTC 2015 - olaf@aepfle.de

View File

@ -1,7 +1,7 @@
#
# spec file for package build-compare
#
# Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed

View File

@ -608,7 +608,7 @@ check_single_file()
return 1
fi
;;
directory)
directory|setuid, directory|sticky, directory)
# tar might package directories - ignore them here
return 0
;;

View File

@ -62,10 +62,10 @@ bash $SCMPSCRIPT "$osrpm" "$nsrpm" || exit 1
OLDRPMS=($(find "$OLDDIR" -type f -name \*rpm -a ! -name \*src.rpm -a ! -name \*.delta.rpm|sort|grep -v -- -32bit-|grep -v -- -64bit-|grep -v -- '-x86-.*\.ia64\.rpm'))
NEWRPMS=($(find $NEWDIRS -type f -name \*rpm -a ! -name \*src.rpm -a ! -name \*.delta.rpm|sort --field-separator=/ --key=7|grep -v -- -32bit-|grep -v -- -64bit-|grep -v -- '-x86-.*\.ia64\.rpm'))
# Get release from first RPM and keep for rpmlint check
# Get version-release from first RPM and keep for rpmlint check
# Remember to quote the "." for future regexes
release1=$(rpm -qp --nodigest --nosignature --qf "%{RELEASE}" "${OLDRPMS[0]}"|sed -e 's/\./\\./g')
release2=$(rpm -qp --nodigest --nosignature --qf "%{RELEASE}" "${NEWRPMS[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')
SUCCESS=1
rpmqp='rpm -qp --qf %{NAME} --nodigest --nosignature '
@ -106,8 +106,8 @@ if test -e $OLDDIR/rpmlint.log -a -e $OTHERDIR/rpmlint.log; then
echo "comparing $OLDDIR/rpmlint.log and $OTHERDIR/rpmlint.log"
# Sort the files first since the order of messages is not deterministic
# Remove release from files
sort -u $OLDDIR/rpmlint.log|sed -e "s,$release1,@RELEASE@,g" -e "s|/tmp/rpmlint\..*spec|.spec|g" > $file1
sort -u $OTHERDIR/rpmlint.log|sed -e "s,$release2,@RELEASE@,g" -e "s|/tmp/rpmlint\..*spec|.spec|g" > $file2
sort -u $OLDDIR/rpmlint.log|sed -e "s,$ver_rel1,@VERSION@-@RELEASE@,g" -e "s|/tmp/rpmlint\..*spec|.spec|g" > $file1
sort -u $OTHERDIR/rpmlint.log|sed -e "s,$ver_rel2,@VERSION@-@RELEASE@,g" -e "s|/tmp/rpmlint\..*spec|.spec|g" > $file2
if ! cmp -s $file1 $file2; then
echo "rpmlint.log files differ:"
diff -u $file1 $file2 |head -n 20

View File

@ -27,6 +27,10 @@ source $FUNCTIONS
oldrpm=`readlink -f $1`
newrpm=`readlink -f $2`
# Get version-release from first RPM and keep for rpmlint check
# Remember to quote the "." for future regexes
ver_rel_old=$(rpm -qp --nodigest --nosignature --qf "%{RELEASE}" "${oldrpm}"|sed -e 's/\./\\./g')
ver_rel_new=$(rpm -qp --nodigest --nosignature --qf "%{RELEASE}" "${newrpm}"|sed -e 's/\./\\./g')
# For source RPMs, we can just check the metadata in the spec file
# if those are not the same, the source RPM has changed and therefore
@ -36,6 +40,7 @@ cmp_spec
RES=$?
case $RES in
0)
echo "RPM meta information is identical"
exit 0
;;
1)
@ -63,8 +68,8 @@ check_single_file()
local file=$1
case $file in
*.spec)
sed -i -e "s,Release:.*$release1,Release: @RELEASE@," old/$file
sed -i -e "s,Release:.*$release2,Release: @RELEASE@," new/$file
sed -i -e "s,Release:.*${ver_rel_old}$,Release: @RELEASE@," old/$file
sed -i -e "s,Release:.*${ver_rel_new}$,Release: @RELEASE@," new/$file
if ! cmp -s old/$file new/$file; then
echo "$file differs (spec file)"
diff -u old/$file new/$file | head -n 20