forked from pool/build-compare
- 2015.02.10
- Trim objdump output properly - Trim .TH also in localized man pages (bnc#915941) - Print section differences even if assembly has differences. - Add support for nested rpms. - Make rpm-check work for "packages" other than rpm. - Tell which section was different when doing ELF comparisons. - Error when one of the rpms is not found OBS-URL: https://build.opensuse.org/package/show/openSUSE:Tools/build-compare?expand=0&rev=173
This commit is contained in:
parent
2edf4d28d7
commit
6cffad1656
@ -1,3 +1,19 @@
|
||||
-------------------------------------------------------------------
|
||||
Tue Feb 10 15:35:25 UTC 2015 - olaf@aepfle.de
|
||||
|
||||
- 2015.02.10
|
||||
- Trim objdump output properly
|
||||
- Trim .TH also in localized man pages (bnc#915941)
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Feb 10 15:33:32 UTC 2015 - randy.e.witt@linux.intel.com
|
||||
|
||||
- Print section differences even if assembly has differences.
|
||||
- Add support for nested rpms.
|
||||
- Make rpm-check work for "packages" other than rpm.
|
||||
- Tell which section was different when doing ELF comparisons.
|
||||
- Error when one of the rpms is not found
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Feb 6 10:35:56 UTC 2015 - olaf@aepfle.de
|
||||
|
||||
|
@ -21,7 +21,7 @@ Summary: Build Result Compare Script
|
||||
License: GPL-2.0+
|
||||
Group: Development/Tools/Building
|
||||
Url: https://github.com/openSUSE/build-compare
|
||||
Version: 2015.02.06
|
||||
Version: 2015.02.10
|
||||
Release: 0
|
||||
Source1: COPYING
|
||||
Source2: same-build-result.sh
|
||||
|
30
functions.sh
30
functions.sh
@ -57,19 +57,35 @@ function check_provides()
|
||||
check_header "$pkg"
|
||||
}
|
||||
|
||||
#usage unrpm <file> $dir
|
||||
# Unpack rpm files in directory $dir
|
||||
# like /usr/bin/unrpm - just for one file and with no options
|
||||
function unrpm()
|
||||
#usage unpackage <file> $dir
|
||||
# Unpack files in directory $dir
|
||||
# like /usr/bin/unpackage - just for one file and with no options
|
||||
function unpackage()
|
||||
{
|
||||
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}
|
||||
case $file in
|
||||
*.bz2)
|
||||
bzip2 -d $file
|
||||
;;
|
||||
*.gz)
|
||||
gzip -d $file
|
||||
;;
|
||||
*.xz)
|
||||
xz -d $file
|
||||
;;
|
||||
*.tar|*.tar.bz2|*.tar.gz|*.tgz|*.tbz2)
|
||||
tar xf $file
|
||||
;;
|
||||
*.rpm)
|
||||
CPIO_OPTS="--extract --unconditional --preserve-modification-time --make-directories --quiet"
|
||||
rpm2cpio $file | cpio ${CPIO_OPTS}
|
||||
;;
|
||||
esac
|
||||
popd 1>/dev/null
|
||||
}
|
||||
|
||||
@ -85,6 +101,8 @@ function cmp_spec ()
|
||||
local file1 file2
|
||||
local f
|
||||
local sh=$1
|
||||
local oldrpm=$2
|
||||
local newrpm=$3
|
||||
|
||||
QF="%{NAME}"
|
||||
|
||||
|
103
rpm-check.sh
103
rpm-check.sh
@ -20,19 +20,21 @@ if test "$#" != 2; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
self_script=$(cd $(dirname $0); echo $(pwd)/$(basename $0))
|
||||
|
||||
source $FUNCTIONS
|
||||
|
||||
oldrpm=`readlink -f $1`
|
||||
newrpm=`readlink -f $2`
|
||||
oldpkg=`readlink -f $1`
|
||||
newpkg=`readlink -f $2`
|
||||
rename_script=`mktemp`
|
||||
|
||||
if test ! -f $oldrpm; then
|
||||
echo "can't open $oldrpm"
|
||||
if test ! -f "$oldpkg"; then
|
||||
echo "can't open $1"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test ! -f $newrpm; then
|
||||
echo "can't open $newrpm"
|
||||
if test ! -f "$newpkg"; then
|
||||
echo "can't open $2"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@ -97,28 +99,34 @@ 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 $rename_script
|
||||
RES=$?
|
||||
case $RES in
|
||||
0)
|
||||
echo "RPM meta information is identical"
|
||||
if test -z "$check_all"; then
|
||||
exit 0
|
||||
fi
|
||||
;;
|
||||
1)
|
||||
echo "RPM meta information is different"
|
||||
if test -z "$check_all"; then
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
2)
|
||||
echo "RPM file checksum differs."
|
||||
RES=0
|
||||
;;
|
||||
*)
|
||||
echo "Wrong exit code!"
|
||||
exit 1
|
||||
echo "Comparing `basename $oldpkg` to `basename $newpkg`"
|
||||
|
||||
case $oldpkg in
|
||||
*.rpm)
|
||||
cmp_spec $rename_script $oldpkg $newpkg
|
||||
RES=$?
|
||||
case $RES in
|
||||
0)
|
||||
echo "RPM meta information is identical"
|
||||
if test -z "$check_all"; then
|
||||
exit 0
|
||||
fi
|
||||
;;
|
||||
1)
|
||||
echo "RPM meta information is different"
|
||||
if test -z "$check_all"; then
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
2)
|
||||
echo "RPM file checksum differs."
|
||||
RES=0
|
||||
;;
|
||||
*)
|
||||
echo "Wrong exit code!"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
||||
@ -127,8 +135,18 @@ file2=`mktemp`
|
||||
|
||||
dir=`mktemp -d`
|
||||
echo "Extracting packages"
|
||||
unrpm $oldrpm $dir/old
|
||||
unrpm $newrpm $dir/new
|
||||
unpackage $oldpkg $dir/old
|
||||
unpackage $newpkg $dir/new
|
||||
|
||||
# files is set in cmp_spec for rpms, so if RES is empty we should assume
|
||||
# it wasn't an rpm and pick all files for comparison.
|
||||
if [ -z $RES ]; then
|
||||
oldfiles=`cd $dir/old; find . -type f`
|
||||
newfiles=`cd $dir/new; find . -type f`
|
||||
|
||||
files=`echo -e "$oldfiles\n$newfiles" | sort -u`
|
||||
fi
|
||||
|
||||
cd $dir
|
||||
bash $rename_script
|
||||
|
||||
@ -388,6 +406,10 @@ check_single_file()
|
||||
check_single_file ${file/.gz/}
|
||||
return $?
|
||||
;;
|
||||
*.rpm)
|
||||
$self_script -a old/$file new/$file
|
||||
return $?
|
||||
;;
|
||||
*png)
|
||||
# Try to remove timestamps, only if convert from ImageMagick is installed
|
||||
if [[ $(type -p convert) ]]; then
|
||||
@ -484,7 +506,7 @@ check_single_file()
|
||||
trim_man_first_line $f
|
||||
done
|
||||
;;
|
||||
/usr/share/man/man*/*|/usr/lib/texmf/doc/man/*/*)
|
||||
/usr/share/man/*/man*|/usr/share/man/man*|/usr/lib/texmf/doc/man/*/*)
|
||||
|
||||
for f in old/$file new/$file; do
|
||||
trim_man_TH $f
|
||||
@ -623,26 +645,29 @@ check_single_file()
|
||||
break
|
||||
fi
|
||||
fi
|
||||
elfdiff=
|
||||
sed -i -e "s,old/,," $file1
|
||||
objdump -d --no-show-raw-insn new/$file | filter_disasm > $file2
|
||||
sed -i -e "s,new/,," $file2
|
||||
if ! diff -u $file1 $file2 > $dfile; then
|
||||
echo "$file differs in assembler output"
|
||||
head -n 200 $dfile
|
||||
return 1
|
||||
elfdiff="1"
|
||||
fi
|
||||
echo "" >$file1
|
||||
echo "" >$file2
|
||||
# Don't compare .build-id and .gnu_debuglink sections
|
||||
sections="$(objdump -s new/$file | grep "Contents of section .*:" | sed -r "s,.* (.*):,\1,g" | grep -v -e "\.build-id" -e "\.gnu_debuglink" | tr "\n" " ")"
|
||||
for section in $sections; do
|
||||
objdump -s -j $section old/$file | sed "s,old/,," >> $file1
|
||||
objdump -s -j $section new/$file | sed "s,new/,," >> $file2
|
||||
objdump -s -j $section old/$file | sed "s,^old/,," > $file1
|
||||
objdump -s -j $section new/$file | sed "s,^new/,," > $file2
|
||||
if ! diff -u $file1 $file2 > $dfile; then
|
||||
echo "$file differs in ELF section $section"
|
||||
head -n 200 $dfile
|
||||
elfdiff="1"
|
||||
fi
|
||||
done
|
||||
if ! diff -u $file1 $file2 > $dfile; then
|
||||
echo "$file differs in ELF sections"
|
||||
head -n 200 $dfile
|
||||
else
|
||||
if test -z "$elfdiff"; then
|
||||
echo "$file: only difference was in build-id or gnu_debuglink, GOOD."
|
||||
return 0
|
||||
fi
|
||||
@ -733,7 +758,7 @@ fi
|
||||
rm $file1 $file2 $dfile $rename_script
|
||||
rm -rf $dir
|
||||
if test "$ret" = 0; then
|
||||
echo "RPM content is identical"
|
||||
echo "Package content is identical"
|
||||
fi
|
||||
exit $ret
|
||||
# vim: tw=666 ts=2 et
|
||||
|
Loading…
x
Reference in New Issue
Block a user