1
0
forked from pool/build-compare

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

@@ -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