@@ -0,0 +1,461 @@
+#! /bin/bash
+#
+# Copyright (c) 2009 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
+
+RPM="rpm -qp --nodigest --nosignature"
+
+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
+
+oldrpm=`readlink -f $1`
+newrpm=`readlink -f $2`
+
+if test ! -f $oldrpm; then
+ echo "can't open $oldrpm"
+ exit 1
+fi
+
+if test ! -f $newrpm; then
+ echo "can't open $newrpm"
+ 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()
+{
+ local file
+ file=$1
+
+ if [[ $(type -p fastjar) ]]; then
+ UNJAR=fastjar
+ elif [[ $(type -p jar) ]]; then
+ UNJAR=jar
+ elif [[ $(type -p unzip) ]]; then
+ UNJAR=unzip
+ else
+ echo "ERROR: jar, fastjar, or unzip is not installed (trying file $file)"
+ exit 1
+ fi
+
+ case $UNJAR in
+ jar|fastjar)
+ # echo jar -xf $file
+ ${UNJAR} -xf $file
+ ;;
+ unzip)
+ unzip -oqq $file
+ ;;
+ esac
+}
+
+# list files in directory
+#usage unjar_l <file>
+function unjar_l()
+{
+ local file
+ file=$1
+
+ if [[ $(type -p fastjar) ]]; then
+ UNJAR=fastjar
+ elif [[ $(type -p jar) ]]; then
+ UNJAR=jar
+ elif [[ $(type -p unzip) ]]; then
+ UNJAR=unzip
+ else
+ echo "ERROR: jar, fastjar, or unzip is not installed (trying file $file)"
+ exit 1
+ fi
+
+ case $UNJAR in
+ jar|fastjar)
+ ${UNJAR} -tf $file
+ ;;
+ unzip)
+ unzip -l $file
+ ;;
+ esac
+}
+
+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>/'
+}
+
+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
|