Accepting request 48629 from openSUSE:Tools

checked in (request 48629)

OBS-URL: https://build.opensuse.org/request/show/48629
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Tools/build-compare?expand=0&rev=82
This commit is contained in:
OBS User autobuild 2010-09-21 11:12:13 +00:00 committed by Git OBS Bridge
parent db6bdf3c66
commit 0baab13ece
6 changed files with 131 additions and 306 deletions

View File

@ -1,25 +1,3 @@
-------------------------------------------------------------------
Mon Sep 20 19:24:10 UTC 2010 - aj@suse.de
- Handle man pages generated from docbook.
- Handle rubygem documentation.
-------------------------------------------------------------------
Mon Sep 20 18:45:01 UTC 2010 - aj@suse.de
- Create common file functions.sh and cleanup code.
-------------------------------------------------------------------
Mon Sep 20 15:21:55 UTC 2010 - lnussel@suse.de
- exclude delta rpms
-------------------------------------------------------------------
Mon Sep 20 07:58:59 UTC 2010 - aj@suse.de
- Create script for just checking source rpms.
-------------------------------------------------------------------
Thu Sep 9 20:02:33 UTC 2010 - aj@suse.de

View File

@ -25,11 +25,9 @@ AutoReqProv: on
Summary: Build Result Compare Script
Version: 2009.10.14
Release: 21
Source1: COPYING
Source2: same-build-result.sh
Source3: rpm-check.sh
Source4: functions.sh
Source5: srpm-check.sh
Source: same-build-result.sh
Source1: rpm-check.sh
Source2: COPYING
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch
@ -47,8 +45,8 @@ mkdir $RPM_BUILD_DIR/%name-%version
%install
mkdir -p $RPM_BUILD_ROOT/usr/lib/build/ $RPM_BUILD_ROOT/%_defaultdocdir/%name
install -m 0755 %SOURCE2 %SOURCE3 %SOURCE4 %SOURCE5 $RPM_BUILD_ROOT/usr/lib/build/
install -m 0644 %SOURCE1 $RPM_BUILD_ROOT/%_defaultdocdir/%name/
install -m 0755 %SOURCE0 %SOURCE1 $RPM_BUILD_ROOT/usr/lib/build/
install -m 0644 %SOURCE2 $RPM_BUILD_ROOT/%_defaultdocdir/%name/
%files
%defattr(-,root,root)

View File

@ -1,138 +0,0 @@
#! /bin/bash
#
# Copyright (c) 2009, 2010 SUSE Linux Product GmbH, Germany.
# Licensed under GPL v2, see COPYING file for details.
#
# Written by Michael Matz and Stephan Coolo
# Enhanced by Andreas Jaeger
# library of functions used by scripts
RPM="rpm -qp --nodigest --nosignature"
check_header()
{
$RPM --qf "$QF" "$1"
}
function check_provides()
{
# provides destroy this because at least the self-provide includes the
# -buildnumber :-(
QF="[%{PROVIDENAME} %{PROVIDEFLAGS} %{PROVIDEVERSION}\\n]\\n"
QF="$QF [%{REQUIRENAME} %{REQUIREFLAGS} %{REQUIREVERSION}\\n]\\n"
QF="$QF [%{CONFLICTNAME} %{CONFLICTFLAGS} %{CONFLICTVERSION}\\n]\\n"
QF="$QF [%{OBSOLETENAME} %{OBSOLETEFLAGS} %{OBSOLETEVERSION}\\n]\\n"
check_header "$1" | sed -e "s,-$2$,-@RELEASE@,"
}
#usage unrpm <file> $dir
# Unpack rpm files in directory $dir
# like /usr/bin/unrpm - just for one file and with no options
function unrpm()
{
local file
local dir
file=$1
dir=$2
CPIO_OPTS="--extract --unconditional --preserve-modification-time --make-directories --quiet"
mkdir -p $dir
pushd $dir 1>/dev/null
rpm2cpio $file | cpio ${CPIO_OPTS}
popd 1>/dev/null
}
# Compare just the rpm meta data of two rpms
# Returns:
# 0 in case of same content
# 1 in case of errors or difference
# 2 in case of differences that need further investigation
# Sets $files with list of files that need further investigation
function cmp_spec ()
{
QF="%{NAME}"
# don't look at RELEASE, it contains our build number
QF="$QF %{VERSION} %{EPOCH}\\n"
QF="$QF %{SUMMARY}\\n%{DESCRIPTION}\\n"
QF="$QF %{VENDOR} %{DISTRIBUTION} %{DISTURL}"
QF="$QF %{LICENSE} %{LICENSE}\\n"
QF="$QF %{GROUP} %{URL} %{EXCLUDEARCH} %{EXCLUDEOS} %{EXCLUSIVEARCH}\\n"
QF="$QF %{EXCLUSIVEOS} %{RPMVERSION} %{PLATFORM}\\n"
QF="$QF %{PAYLOADFORMAT} %{PAYLOADCOMPRESSOR} %{PAYLOADFLAGS}\\n"
QF="$QF [%{PREINPROG} %{PREIN}\\n]\\n[%{POSTINPROG} %{POSTIN}\\n]\\n[%{PREUNPROG} %{PREUN}\\n]\\n[%{POSTUNPROG} %{POSTUN}\\n]\\n"
# XXX We also need to check the existence (but not the content (!))
# of SIGGPG (and perhaps the other SIG*)
# XXX We don't look at triggers
QF="$QF [%{VERIFYSCRIPTPROG} %{VERIFYSCRIPT}]\\n"
# Only the first ChangeLog entry; should be enough
QF="$QF %{CHANGELOGTIME} %{CHANGELOGNAME} %{CHANGELOGTEXT}\\n"
file1=`mktemp`
file2=`mktemp`
check_header $oldrpm > $file1
check_header $newrpm > $file2
# the DISTURL tag can be used as checkin ID
#echo "$QF"
if ! diff -au $file1 $file2; then
rm $file1 $file2
return 1
fi
release1=`$RPM --qf "%{RELEASE}" "$oldrpm"`
release2=`$RPM --qf "%{RELEASE}" "$newrpm"`
check_provides $oldrpm $release1 > $file1
check_provides $newrpm $release2 > $file2
if ! diff -au $file1 $file2; then
rm $file1 $file2
return 1
fi
# First check the file attributes and later the md5s
# Now the files. We leave out mtime and size. For normal files
# the size will influence the MD5 anyway. For directories the sizes can
# differ, depending on which file system the package was built. To not
# have to filter out directories we simply ignore all sizes.
# Also leave out FILEDEVICES, FILEINODES (depends on the build host),
# FILECOLORS, FILECLASS (???), FILEDEPENDSX and FILEDEPENDSN.
# Also FILELANGS (or?)
QF="[%{FILENAMES} %{FILEFLAGS} %{FILESTATES} %{FILEMODES:octal} %{FILEUSERNAME} %{FILEGROUPNAME} %{FILERDEVS} %{FILEVERIFYFLAGS} %{FILELINKTOS}\n]\\n"
# ??? what to do with FILEPROVIDE and FILEREQUIRE?
check_header $oldrpm > $file1
check_header $newrpm > $file2
if ! diff -au $file1 $file2; then
rm $file1 $file2
return 1
fi
# now the md5sums. if they are different, we check more detailed
# if there are different filenames, we will already have aborted before
QF="[%{FILENAMES} %{FILEMD5S}\n]\\n"
check_header $oldrpm > $file1
check_header $newrpm > $file2
RES=2
# done if the same
if cmp -s $file1 $file2; then
RES=0
fi
# Get only files with different MD5sums
files=`diff -U0 $file1 $file2 | fgrep -v +++ | grep ^+ | cut -b2- | awk '{print $1}'`
rm $file1 $file2
return $RES
}

View File

@ -6,7 +6,7 @@
# Written by Michael Matz and Stephan Coolo
# Enhanced by Andreas Jaeger
FUNCTIONS=${0%/*}/functions.sh
RPM="rpm -qp --nodigest --nosignature"
check_all=
case $1 in
@ -20,8 +20,6 @@ if test "$#" != 2; then
exit 1
fi
source $FUNCTIONS
oldrpm=`readlink -f $1`
newrpm=`readlink -f $2`
@ -35,6 +33,18 @@ if test ! -f $newrpm; then
exit 1
fi
#usage unrpm <file>
# Unpack rpm files in current directory
# like /usr/bin/unrpm - just for one file and with no options
function unrpm()
{
local file
file=$1
CPIO_OPTS="--extract --unconditional --preserve-modification-time --make-directories --quiet"
rpm2cpio $file | cpio ${CPIO_OPTS}
}
#usage unjar <file>
function unjar()
{
@ -96,30 +106,115 @@ filter_disasm()
sed -e 's/^ *[0-9a-f]\+://' -e 's/\$0x[0-9a-f]\+/$something/' -e 's/callq *[0-9a-f]\+/callq /' -e 's/# *[0-9a-f]\+/# /' -e 's/\(0x\)\?[0-9a-f]\+(/offset(/' -e 's/[0-9a-f]\+ </</' -e 's/^<\(.*\)>:/\1:/' -e 's/<\(.*\)+0x[0-9a-f]\+>/<\1 + ofs>/'
}
cmp_spec $1 $2
RES=$?
case $RES in
0)
exit 0
;;
1)
exit 1
;;
2)
;;
*)
echo "Wrong exit code!"
exit 1
;;
esac
QF="%{NAME}"
# don't look at RELEASE, it contains our build number
QF="$QF %{VERSION} %{EPOCH}\\n"
QF="$QF %{SUMMARY}\\n%{DESCRIPTION}\\n"
QF="$QF %{VENDOR} %{DISTRIBUTION} %{DISTURL}"
QF="$QF %{LICENSE} %{LICENSE}\\n"
QF="$QF %{GROUP} %{URL} %{EXCLUDEARCH} %{EXCLUDEOS} %{EXCLUSIVEARCH}\\n"
QF="$QF %{EXCLUSIVEOS} %{RPMVERSION} %{PLATFORM}\\n"
QF="$QF %{PAYLOADFORMAT} %{PAYLOADCOMPRESSOR} %{PAYLOADFLAGS}\\n"
QF="$QF [%{PREINPROG} %{PREIN}\\n]\\n[%{POSTINPROG} %{POSTIN}\\n]\\n[%{PREUNPROG} %{PREUN}\\n]\\n[%{POSTUNPROG} %{POSTUN}\\n]\\n"
# XXX We also need to check the existence (but not the content (!))
# of SIGGPG (and perhaps the other SIG*)
# XXX We don't look at triggers
QF="$QF [%{VERIFYSCRIPTPROG} %{VERIFYSCRIPT}]\\n"
# Only the first ChangeLog entry; should be enough
QF="$QF %{CHANGELOGTIME} %{CHANGELOGNAME} %{CHANGELOGTEXT}\\n"
file1=`mktemp`
file2=`mktemp`
check_header()
{
$RPM --qf "$QF" "$1"
}
check_header $oldrpm > $file1
check_header $newrpm > $file2
# the DISTURL tag can be used as checkin ID
#echo "$QF"
if ! diff -au $file1 $file2; then
rm $file1 $file2
exit 1
fi
release1=`$RPM --qf "%{RELEASE}" "$oldrpm"`
release2=`$RPM --qf "%{RELEASE}" "$newrpm"`
check_provides()
{
# provides destroy this because at least the self-provide includes the
# -buildnumber :-(
QF="[%{PROVIDENAME} %{PROVIDEFLAGS} %{PROVIDEVERSION}\\n]\\n"
QF="$QF [%{REQUIRENAME} %{REQUIREFLAGS} %{REQUIREVERSION}\\n]\\n"
QF="$QF [%{CONFLICTNAME} %{CONFLICTFLAGS} %{CONFLICTVERSION}\\n]\\n"
QF="$QF [%{OBSOLETENAME} %{OBSOLETEFLAGS} %{OBSOLETEVERSION}\\n]\\n"
check_header "$1" | sed -e "s,-$2$,-@RELEASE@,"
}
check_provides $oldrpm $release1 > $file1
check_provides $newrpm $release2 > $file2
if ! diff -au $file1 $file2; then
rm $file1 $file2
exit 1
fi
# First check the file attributes and later the md5s
# Now the files. We leave out mtime and size. For normal files
# the size will influence the MD5 anyway. For directories the sizes can
# differ, depending on which file system the package was built. To not
# have to filter out directories we simply ignore all sizes.
# Also leave out FILEDEVICES, FILEINODES (depends on the build host),
# FILECOLORS, FILECLASS (???), FILEDEPENDSX and FILEDEPENDSN.
# Also FILELANGS (or?)
QF="[%{FILENAMES} %{FILEFLAGS} %{FILESTATES} %{FILEMODES:octal} %{FILEUSERNAME} %{FILEGROUPNAME} %{FILERDEVS} %{FILEVERIFYFLAGS} %{FILELINKTOS}\n]\\n"
# ??? what to do with FILEPROVIDE and FILEREQUIRE?
check_header $oldrpm > $file1
check_header $newrpm > $file2
if ! diff -au $file1 $file2; then
rm $file1 $file2
exit 1
fi
# now the md5sums. if they are different, we check more detailed
# if there are different filenames, we will already have aborted before
QF="[%{FILENAMES} %{FILEMD5S}\n]\\n"
check_header $oldrpm > $file1
check_header $newrpm > $file2
# done if the same
if cmp -s $file1 $file2; then
rm $file1 $file2
exit 0
fi
files=`diff -U0 $file1 $file2 | fgrep -v +++ | grep ^+ | cut -b2- | awk '{print $1}'`
dir=`mktemp -d`
unrpm $oldrpm $dir/old
unrpm $newrpm $dir/new
cd $dir
mkdir old
cd old
unrpm $oldrpm
cd ..
mkdir new
cd new
unrpm $newrpm
cd ..
dfile=`mktemp`
@ -320,12 +415,8 @@ check_single_file()
# .TH "OFFLINEIMAP" "1" "11 May 2010" "John Goerzen" "OfflineIMAP Manual"
# .TH gv 3guile "13 May 2010"
# .TH ARCH "1" "September 2010" "GNU coreutils 8.5" "User Commands"
#.TH "GIT\-ARCHIMPORT" "1" "09/13/2010" "Git 1\&.7\&.1" "Git Manual"
for f in old/$file new/$file; do
sed -i -e 's/.TH "\?\([^ "]*\)"\? "\?\([0-9][a-z]*\)"\? "\?\(20[0-9][0-9]-[0-9][0-9]-[0-9][0-9]\|[A-Z][a-z]* [0-9][0-9], 20[0-9][0-9]\|[0-9]* [A-Z][a-z]* 20[0-9][0-9]\|[A-Z][a-z][a-z] [A-Z][a-z][a-z] [0-9]\+ 20[0-9][0-9]\|[A-Z][a-z]* 20[0-9][0-9]\|[0-1][0-9]/[0-9][0-9]/201[0-9]\)"\? /.TH \1 \2 "2000-01-01" /' $f
# generated by docbook xml:
#.\" Date: 09/13/2010
sed -i -e 's|Date: [0-1][0-9]/[0-9][0-9]/201[0-9]|Date: 09/13/2010|' $f
sed -i -e 's/.TH "\?\([^ "]*\)"\? "\?\([0-9][a-z]*\)"\? "\?\(20[0-9][0-9]-[0-9][0-9]-[0-9][0-9]\|[A-Z][a-z]* [0-9][0-9], 20[0-9][0-9]\|[0-9]* [A-Z][a-z]* 20[0-9][0-9]\|[A-Z][a-z]* [A-Z][a-z]* [0-9]\+ 20[0-9][0-9]\|[A-Z][a-z]* 20[0-9][0-9]\)"\? /.TH \1 \2 "2000-01-01" /' $f
done
;;
*.elc)
@ -371,19 +462,7 @@ check_single_file()
sed -i -e 's%href="#\([a-z]*\.\)\?id[0-9]*">%href="#\1id0000000">%g' $f
done
;;
*/created.rid)
# ruby documentation
# file just contains a timestamp and nothing else, so ignore it
echo "Ignore $file"
return 0
;;
*/rdoc/files/*.html)
# ruby documentation
# <td>MonSep2019:02:43+00002010</td>
for f in old/$file new/$file; do
sed -i -e 's%<td>[A-Z][a-z][a-z] [A-Z][a-z][a-z] [0-9]\+ [0-9]\+:[0-9]\+:[0-9]\+ +0000 201[0-9]</td>%<td>MonSep2019:02:43+00002010</td>%g' $f
done
;;
esac
ftype=`/usr/bin/file old/$file | cut -d: -f2-`
@ -479,3 +558,4 @@ fi
rm $file1 $file2 $dfile
rm -r $dir
exit $ret

View File

@ -1,6 +1,6 @@
#!/bin/bash
#
# Copyright (c) 2009, 2010 SUSE Linux Product Gmbh, Germany.
# Copyright (c) 2009 SUSE Linux Product Gmbh, Germany.
# Licensed under GPL v2, see COPYING file for details.
#
# Written by Adrian Schroeter <adrian@suse.de>
@ -11,7 +11,6 @@
# /usr/lib/build/same-build-result.sh /.build.oldpackages /usr/src/packages/RPMS /usr/src/packages/SRPMS
CMPSCRIPT=${0%/*}/rpm-check.sh
SCMPSCRIPT=${0%/*}/srpm-check.sh
OLDDIR="$1"
shift
@ -28,9 +27,9 @@ if [ -z "$NEWDIRS" ]; then
exit 1
fi
if test `find $NEWDIRS -name '*.rpm' -and ! -name '*.delta.rpm' | wc -l` != `find $OLDDIR -name '*.rpm' -and ! -name '*.delta.rpm' | wc -l`; then
if test `find $NEWDIRS -name *.rpm | wc -l` != `find $OLDDIR -name *.rpm | wc -l`; then
echo "different number of subpackages"
find $OLDDIR $NEWDIRS -name '*.rpm' -and ! -name '*.delta.rpm'
find $OLDDIR $NEWDIRS -name *.rpm
exit 1
fi
@ -48,7 +47,7 @@ if test ! -f "$nsrpm"; then
fi
echo "compare $osrpm $nsrpm"
bash $SCMPSCRIPT "$osrpm" "$nsrpm" || exit 1
bash $CMPSCRIPT "$osrpm" "$nsrpm" || exit 1
# technically we should not all exclude all -32bit but filter for different archs,
# like done with -x86
@ -57,8 +56,8 @@ bash $SCMPSCRIPT "$osrpm" "$nsrpm" || exit 1
# problem: a package can contain both noarch and arch subpackages, so we have to
# take care of proper sorting of NEWRPMS, e.g. noarch/x.rpm and x86_64/w.rpm since OLDRPMS
# has all the packages in a single directory and would sort this as w.rpm, x.rpm.
OLDRPMS=($(find "$OLDDIR" -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 -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'))
OLDRPMS=($(find "$OLDDIR" -name \*rpm -a ! -name \*src.rpm|sort|grep -v -- -32bit-|grep -v -- -64bit-|grep -v -- '-x86-.*\.ia64\.rpm'))
NEWRPMS=($(find $NEWDIRS -name \*rpm -a ! -name \*src.rpm|sort --field-separator=/ --key=7|grep -v -- -32bit-|grep -v -- -64bit-|grep -v -- '-x86-.*\.ia64\.rpm'))
rpmqp='rpm -qp --qf %{NAME} --nodigest --nosignature '
for opac in ${OLDRPMS[*]}; do
@ -81,3 +80,4 @@ fi
echo compare validated built as identical !
exit 0

View File

@ -1,93 +0,0 @@
#!/bin/bash
#
# Copyright (c) 2009, 2010 SUSE Linux Product GmbH, Germany.
# Licensed under GPL v2, see COPYING file for details.
#
# Written by Michael Matz and Stephan Coolo
# Enhanced by Andreas Jaeger
# Compare two source RPMs
FUNCTIONS=${0%/*}/functions.sh
check_all=
case $1 in
-a | --check-all)
check_all=1
shift
esac
if test "$#" != 2; then
echo "usage: $0 [-a|--check-all] old.rpm new.rpm"
exit 1
fi
source $FUNCTIONS
oldrpm=`readlink -f $1`
newrpm=`readlink -f $2`
# 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
# the resulting files are needed.
cmp_spec $1 $2
RES=$?
case $RES in
0)
exit 0
;;
1)
exit 1
;;
2)
;;
*)
echo "Wrong exit code!"
exit 1
;;
esac
# Now check that only the spec file has a changed release number and
# nothing else
dir=`mktemp -d`
unrpm $oldrpm $dir/old
unrpm $newrpm $dir/new
cd $dir
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
if ! cmp -s old/$file new/$file; then
echo "$file differs (spec file)"
diff -u old/$file new/$file | head -n 200
return 1
fi
return 0
;;
*)
echo "$file differs"
# Nothing else should be changed
;;
esac
return 1
}
ret=0
for file in $files; do
if ! check_single_file $file; then
ret=1
if test -z "$check_all"; then
break
fi
fi
done
rm -r $dir
exit $ret