diff --git a/build-compare.changes b/build-compare.changes index ec56918..7d73c49 100644 --- a/build-compare.changes +++ b/build-compare.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Thu Jul 27 12:05:25 UTC 2017 - olaf@aepfle.de + +- Compare also supplements and recomments (issue#18) + ------------------------------------------------------------------- Fri Mar 31 13:44:11 UTC 2017 - olaf@aepfle.de diff --git a/build-compare.spec b/build-compare.spec index dbe15a0..0c266d3 100644 --- a/build-compare.spec +++ b/build-compare.spec @@ -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: 20170331T154431.96db83e +Version: 20170727T140623.5b2169e Release: 0 Source1: COPYING Source2: same-build-result.sh diff --git a/functions.sh b/functions.sh index b67cbb8..5b46274 100644 --- a/functions.sh +++ b/functions.sh @@ -21,6 +21,8 @@ QF_PROVIDES="[%{PROVIDENAME} %{PROVIDEFLAGS} %{PROVIDEVERSION}\\n]\\n" QF_PROVIDES="${QF_PROVIDES}[%{REQUIRENAME} %{REQUIREFLAGS} %{REQUIREVERSION}\\n]\\n" QF_PROVIDES="${QF_PROVIDES}[%{CONFLICTNAME} %{CONFLICTFLAGS} %{CONFLICTVERSION}\\n]\\n" QF_PROVIDES="${QF_PROVIDES}[%{OBSOLETENAME} %{OBSOLETEFLAGS} %{OBSOLETEVERSION}\\n]\\n" +QF_PROVIDES="${QF_PROVIDES}[%{RECOMMENDNAME} %{RECOMMENDFLAGS} %{RECOMMENDVERSION}\\n]\\n" +QF_PROVIDES="${QF_PROVIDES}[%{SUPPLEMENTNAME} %{SUPPLEMENTFLAGS} %{SUPPLEMENTVERSION}\\n]\\n" # don't look at RELEASE, it contains our build number QF_TAGS="%{NAME} %{VERSION} %{EPOCH}\\n" diff --git a/pkg-diff.sh b/pkg-diff.sh index a33f3f9..fde4823 100644 --- a/pkg-diff.sh +++ b/pkg-diff.sh @@ -7,6 +7,10 @@ # Enhanced by Andreas Jaeger FUNCTIONS=${0%/*}/functions.sh +: ${buildcompare_head:="head -n 200"} +nofilter=${buildcompare_nofilter} +sort=sort +[[ $nofilter ]] && sort=cat check_all= case $1 in @@ -114,9 +118,107 @@ function unjar_l() filter_disasm() { local file=$1 + [[ $nofilter ]] && return sed -i -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]\+ :/\1:/' -e 's/<\(.*\)+0x[0-9a-f]\+>/<\1 + ofs>/' ${file} } +filter_zip_flist() +{ + local file=$1 + [[ $nofilter ]] && return + # 10-05-2010 14:39 + sed -i -e "s, [0-9][0-9]-[0-9][0-9]-[0-9]\+ [0-9][0-9]:[0-9][0-9] , date ," $file + # 2012-02-03 07:59 + sed -i -e "s, 20[0-9][0-9]-[0-9][0-9]-[0-9][0-9] [0-9][0-9]:[0-9][0-9] , date ," $file +} + +filter_xenefi() { + # PE32+ executable (EFI application) x86-64 (stripped to external PDB), for MS Windows + perl -e "open fh, '+<', '$f'; seek fh, 0x80 + 0x08, SEEK_SET; print fh 'time'; seek fh, 0x80 + 0x58, SEEK_SET; print fh 'chck';" +} + +filter_pyc() { + perl -e "open fh, '+<', '$f'; seek fh, 4, SEEK_SET; print fh '0000';" +} + +filter_dvi() { + # Opcodes 247: pre; i[1], num[4], den[4], mag[4], k[1], x[k] + perl -e " + my \$rec; + open fh, '+<', '$f'; + my \$dummy = read fh, \$rec, 15; + (\$pre, \$i, \$num, \$den, \$mag, \$k) = unpack('C2 N3 C', \$rec); + seek fh, 15, SEEK_SET; + while (\$k > 0) { + print fh '0'; + \$k--; + } + " +} + +filter_png() { + convert "$f" +set date:create +set date:modify "${f}.$PPID.$$" + mv -f "${f}.$PPID.$$" "${f}" +} + +filter_emacs_lisp() { + sed -i -e ' + s|^;;; .ompiled by abuild@.* on ... ... .. ..:..:.. ....|;;; compiled by abuild@buildhost on Wed Jul 01 00:00:00 2009| + s|^;;; from file .*\.el|;;; from file /home/abuild/rpmbuild/BUILD/anthy-9100h/src-util/elc.8411/anthy-azik.el| + s|^;;; emacs version .*|;;; emacs version 21.5 (beta34) "kale" XEmacs Lucid.| + s|^;;; bytecomp version .*|;;; bytecomp version 2.28 XEmacs; 2009-08-09.| + ' "$f" +} + +filter_pdf() { + # PDF files contain a unique ID, remove it + # Format of the ID is: + # /ID [<9ACE247A70CF9BEAFEE15E116259BD6D> <9ACE247A70CF9BEAFEE15E116259BD6D>] + # with optional spaces. pdftex creates also: + # /CreationDate (D:20120103083206Z) + # /ModDate (D:20120103083206Z) + # and possibly XML metadata as well + sed -i \ + '/obj/,/endobj/{ + s%/ID \?\[ \?<[^>]\+> \?<[^>]\+> \?\]%/IDrandom%g; + s%/CreationDate \?(D:[^)]*)%/CreationDate (D: XXX)%g; + s%/ModDate \?(D:[^)]*)%/ModDate (D: XXX)%g; + s%[^<]*%XXX%g; + s%[^<]*%XXX%g; + s%[^<]*%XXX%g; + s%[^<]*%XXX%g; + s%[^<]*%XXX%g; + }' "$f" +} + +filter_ps() { + sed -i -e ' + /^%%CreationDate:[[:blank:]]/d + /^%%Creator:[[:blank:]]groff[[:blank:]]version[[:blank:]]/d + /^%DVIPSSource:[[:blank:]]/d + ' "$f" +} + +filter_mo() { + sed -i -e "s,POT-Creation-Date: ....-..-.. ..:..+....,POT-Creation-Date: 1970-01-01 00:00+0000," "$f" +} + +filter_linuxrc_config() { + sed -i '/^InitrdID:/s@^.*@InitrdID: something@' "$f" +} + +# call specified filter on old and new file +filter_generic() +{ + filtertype=$1 + [[ $nofilter ]] && return + local f + for f in "old/$file" "new/$file" ; do + eval "filter_$filtertype $f" + done +} + + echo "Comparing `basename $oldpkg` to `basename $newpkg`" case $oldpkg in @@ -195,7 +297,7 @@ diff_two_files() hexdump -C old/$file > $file1 & hexdump -C new/$file > $file2 & wait - diff -u $file1 $file2 | head -n 200 + diff -u $file1 $file2 | $buildcompare_head return 1 } @@ -205,6 +307,7 @@ trim_man_first_line() #.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28) #.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.43.3. local f=$1 + [[ $nofilter ]] && return sed -i -e '1{ s|^\.\\"[[:blank:]]\+Automatically[[:blank:]]generated[[:blank:]]by[[:blank:]]Pod::Man[[:blank:]].*|.\\" Overly verbose Pod::Man| s|^\.\\"[[:blank:]]\+DO[[:blank:]]NOT[[:blank:]]MODIFY[[:blank:]]THIS[[:blank:]]FILE![[:blank:]]\+It[[:blank:]]was[[:blank:]]generated[[:blank:]]by[[:blank:]]help2man[[:blank:]].*|.\\" Overly verbose help2man| @@ -231,6 +334,7 @@ trim_man_TH() # .TH "GCM-CALIBRATE" "1" "03 February 2012" "" "" #.TH Locale::Po4a::Xml.pm 3pm "2015-01-30" "Po4a Tools" "Po4a Tools" local f=$1 + [[ $nofilter ]] && return # (.TH quoted section) (quoted_date)(*) sed -i -e 's|^\([[:blank:]]*\.TH[[:blank:]]\+"[^"]\+"[[:blank:]]\+[^[:blank:]]\+\)[[:blank:]]\+\("[^"]\+"\)\([[:blank:]]\+.*\)\?|\1 "qq2000-01-01"\3|' $f # (.TH unquoted section) (quoted_date)(*) @@ -254,6 +358,7 @@ strip_numbered_anchors() #
#
+ [[ $nofilter ]] && return for f in old/$file new/$file; do sed -ie ' 1 { @@ -385,7 +490,7 @@ check_single_file() return 0 ;; *.cpio) - flist=`cpio --quiet --list --force-local < "new/$file" | sort` + flist=`cpio --quiet --list --force-local < "new/$file" | $sort` pwd=$PWD fdir=$file.extract.$PPID.$$ mkdir old/$fdir new/$fdir @@ -407,7 +512,7 @@ check_single_file() return $ret ;; *.squashfs) - flist=`unsquashfs -no-progress -ls -dest '' "new/$file" | grep -Ev '^(Parallel unsquashfs:|[0-9]+ inodes )' | sort` + flist=`unsquashfs -no-progress -ls -dest '' "new/$file" | grep -Ev '^(Parallel unsquashfs:|[0-9]+ inodes )' | $sort` fdir=$file.extract.$PPID.$$ unsquashfs -no-progress -dest old/$fdir "old/$file" unsquashfs -no-progress -dest new/$fdir "new/$file" @@ -444,17 +549,13 @@ check_single_file() return $ret ;; *.zip|*.jar|*.war) - cd old - unjar_l ./$file |sort > flist - # 10-05-2010 14:39 - sed -i -e "s, [0-9][0-9]-[0-9][0-9]-[0-9]\+ [0-9][0-9]:[0-9][0-9] , date ," flist - # 2012-02-03 07:59 - sed -i -e "s, 20[0-9][0-9]-[0-9][0-9]-[0-9][0-9] [0-9][0-9]:[0-9][0-9] , date ," flist - cd ../new - unjar_l ./$file |sort> flist - sed -i -e "s, [0-9][0-9]-[0-9][0-9]-[0-9]\+ [0-9][0-9]:[0-9][0-9] , date ,; " flist - sed -i -e "s, 20[0-9][0-9]-[0-9][0-9]-[0-9][0-9] [0-9][0-9]:[0-9][0-9] , date ," flist - cd .. + for dir in old new ; do + ( + cd $dir + unjar_l ./$file | $sort > flist + filter_zip_flist flist + ) + done if ! cmp -s old/flist new/flist; then echo "$file has different file list" diff -u old/flist new/flist @@ -479,38 +580,13 @@ check_single_file() done return $ret;; */xen*.efi) - # PE32+ executable (EFI application) x86-64 (stripped to external PDB), for MS Windows - perl -e "open fh, '+<', 'old/$file'; seek fh, 0x80 + 0x08, SEEK_SET; print fh 'time'; seek fh, 0x80 + 0x58, SEEK_SET; print fh 'chck';" - perl -e "open fh, '+<', 'new/$file'; seek fh, 0x80 + 0x08, SEEK_SET; print fh 'time'; seek fh, 0x80 + 0x58, SEEK_SET; print fh 'chck';" + filter_generic xenefi ;; *.pyc|*.pyo) - perl -e "open fh, '+<', 'old/$file'; seek fh, 4, SEEK_SET; print fh '0000';" - perl -e "open fh, '+<', 'new/$file'; seek fh, 4, SEEK_SET; print fh '0000';" + filter_generic pyc ;; *.dvi) - # Opcodes 247: pre; i[1], num[4], den[4], mag[4], k[1], x[k] - perl -e " - my \$rec; - open fh, '+<', 'old/$file'; - my \$dummy = read fh, \$rec, 15; - (\$pre, \$i, \$num, \$den, \$mag, \$k) = unpack('C2 N3 C', \$rec); - seek fh, 15, SEEK_SET; - while (\$k > 0) { - print fh '0'; - \$k--; - } - " - perl -e " - my \$rec; - open fh, '+<', 'new/$file'; - my \$dummy = read fh, \$rec, 15; - (\$pre, \$i, \$num, \$den, \$mag, \$k) = unpack('C2 N3 C', \$rec); - seek fh, 15, SEEK_SET; - while (\$k > 0) { - print fh '0'; - \$k--; - } - " + filter_generic dvi ;; *.bz2) bunzip2 -c old/$file > old/${file/.bz2/} @@ -531,10 +607,7 @@ check_single_file() *png) # Try to remove timestamps, only if convert from ImageMagick is installed if [[ $(type -p convert) ]]; then - convert old/$file +set date:create +set date:modify old/${file}.$PPID.$$ - convert new/$file +set date:create +set date:modify new/${file}.$PPID.$$ - mv -f old/${file}.$PPID.$$ old/${file} - mv -f new/${file}.$PPID.$$ new/${file} + filter_generic png if ! diff_two_files; then return 1 fi @@ -542,9 +615,7 @@ check_single_file() fi ;; /usr/share/locale/*/LC_MESSAGES/*.mo|/usr/share/locale-bundle/*/LC_MESSAGES/*.mo|/usr/share/vdr/locale/*/LC_MESSAGES/*.mo) - for f in old/$file new/$file; do - sed -i -e "s,POT-Creation-Date: ....-..-.. ..:..+....,POT-Creation-Date: 1970-01-01 00:00+0000," $f - done + filter_generic mo ;; */rdoc/files/*.html) # ruby documentation @@ -615,7 +686,7 @@ check_single_file() # deprecated-list is randomly ordered, sort it for comparison case $f in */deprecated-list.html) - sort -o $f $f + [[ $nofilter ]] || sort -o $f $f ;; esac done @@ -629,7 +700,7 @@ check_single_file() */fonts.scale|*/fonts.dir|*/encodings.dir) for f in old/$file new/$file; do # sort files before comparing - sort -o $f $f + [[ $nofilter ]] || sort -o $f $f done ;; /var/adm/perl-modules/*) @@ -655,15 +726,7 @@ check_single_file() done ;; *.elc) - # emacs lisp files - for f in old/$file new/$file; do - sed -i -e ' - s|^;;; .ompiled by abuild@.* on ... ... .. ..:..:.. ....|;;; compiled by abuild@buildhost on Wed Jul 01 00:00:00 2009| - s|^;;; from file .*\.el|;;; from file /home/abuild/rpmbuild/BUILD/anthy-9100h/src-util/elc.8411/anthy-azik.el| - s|^;;; emacs version .*|;;; emacs version 21.5 (beta34) "kale" XEmacs Lucid.| - s|^;;; bytecomp version .*|;;; bytecomp version 2.28 XEmacs; 2009-08-09.| - ' $f - done + filter_generic emacs_lisp ;; /var/lib/texmf/web2c/*/*fmt |\ /var/lib/texmf/web2c/metafont/*.base|\ @@ -708,40 +771,14 @@ check_single_file() sed -i "s/${name_ver_rel_new_regex_l}/@NAME_VER_REL@/" new/$file ;; *.ps) - for f in "old/$file" "new/$file"; do - sed -i -e ' - /^%%CreationDate:[[:blank:]]/d - /^%%Creator:[[:blank:]]groff[[:blank:]]version[[:blank:]]/d - /^%DVIPSSource:[[:blank:]]/d - ' "$f" - done - ;; + filter_generic ps + ;; *pdf) - # PDF files contain a unique ID, remove it - # Format of the ID is: - # /ID [<9ACE247A70CF9BEAFEE15E116259BD6D> <9ACE247A70CF9BEAFEE15E116259BD6D>] - # with optional spaces. pdftex creates also: - # /CreationDate (D:20120103083206Z) - # /ModDate (D:20120103083206Z) - # and possibly XML metadata as well - for f in "old/$file" "new/$file"; do - sed -i \ - '/obj/,/endobj/{ - s%/ID \?\[ \?<[^>]\+> \?<[^>]\+> \?\]%/IDrandom%g; - s%/CreationDate \?(D:[^)]*)%/CreationDate (D: XXX)%g; - s%/ModDate \?(D:[^)]*)%/ModDate (D: XXX)%g; - s%[^<]*%XXX%g; - s%[^<]*%XXX%g; - s%[^<]*%XXX%g; - s%[^<]*%XXX%g; - s%[^<]*%XXX%g; - }' "$f" - done + filter_generic pdf ;; */linuxrc.config) echo "${file}" - sed -i '/^InitrdID:/s@^.*@InitrdID: something@' "old/$file" - sed -i '/^InitrdID:/s@^.*@InitrdID: something@' "new/$file" + filter_generic linuxrc_config ;; */ld.so.cache|*/etc/machine-id) # packaged by libguestfs @@ -789,7 +826,7 @@ check_single_file() elfdiff= if ! diff --speed-large-files -u $file1 $file2 > $dfile; then echo "$file differs in assembler output" - head -n 200 $dfile + $buildcompare_head $dfile elfdiff="1" fi echo "" >$file1 @@ -801,7 +838,7 @@ check_single_file() $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 + $buildcompare_head $dfile elfdiff="1" fi done @@ -814,7 +851,7 @@ check_single_file() *ASCII*|*text*) if ! cmp -s old/$file new/$file; then echo "$file differs ($ftype)" - diff -u old/$file new/$file | head -n 200 + diff -u old/$file new/$file | $buildcompare_head return 1 fi ;;