Accepting request 368652 from openSUSE:Tools

- Remove hacks from /var/adm/update-scripts|messages case

- Handle /var/adm/update-messages in scripts and filelist

- Whitespace in javadoc case
- Whitespace changes in html case
- Move case kde/gtk html up in the case list
- Move case rdoc html up in the case list
- Add option -a to same-build-result.sh and loop through all rpms
- Rework sorting of rpm files in same-build-result.sh
- Better diagnostic if number of subpackages changes
- Create tmpfiles earlier in same-build-result.sh
- Handle all javadoc html files

- Handle yet another variant of elc timestamps

- Handle timestamp in dvi files
- Handle Last-modified HTML META tag
- Handle yet another variant of javadoc timestamps

OBS-URL: https://build.opensuse.org/request/show/368652
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/build-compare?expand=0&rev=94
This commit is contained in:
Dominique Leuenberger 2016-03-21 11:44:14 +00:00 committed by Git OBS Bridge
commit 74207d3eb5
5 changed files with 184 additions and 101 deletions

View File

@ -1,3 +1,38 @@
-------------------------------------------------------------------
Tue Mar 8 18:00:40 UTC 2016 - olaf@aepfle.de
- Remove hacks from /var/adm/update-scripts|messages case
-------------------------------------------------------------------
Tue Mar 8 16:48:48 UTC 2016 - olaf@aepfle.de
- Handle /var/adm/update-messages in scripts and filelist
-------------------------------------------------------------------
Mon Mar 7 11:56:28 UTC 2016 - olaf@aepfle.de
- Whitespace in javadoc case
- Whitespace changes in html case
- Move case kde/gtk html up in the case list
- Move case rdoc html up in the case list
- Add option -a to same-build-result.sh and loop through all rpms
- Rework sorting of rpm files in same-build-result.sh
- Better diagnostic if number of subpackages changes
- Create tmpfiles earlier in same-build-result.sh
- Handle all javadoc html files
-------------------------------------------------------------------
Fri Mar 4 18:50:32 UTC 2016 - olaf@aepfle.de
- Handle yet another variant of elc timestamps
-------------------------------------------------------------------
Thu Mar 3 12:44:04 UTC 2016 - olaf@aepfle.de
- Handle timestamp in dvi files
- Handle Last-modified HTML META tag
- Handle yet another variant of javadoc timestamps
------------------------------------------------------------------- -------------------------------------------------------------------
Fri Jan 1 10:11:14 UTC 2016 - schwab@suse.de Fri Jan 1 10:11:14 UTC 2016 - schwab@suse.de

View File

@ -21,7 +21,7 @@ Summary: Build Result Compare Script
License: GPL-2.0+ License: GPL-2.0+
Group: Development/Tools/Building Group: Development/Tools/Building
Url: https://github.com/openSUSE/build-compare Url: https://github.com/openSUSE/build-compare
Version: 20160104T085658.0b929c8 Version: 20160308T194108.4a952dd
Release: 0 Release: 0
Source1: COPYING Source1: COPYING
Source2: same-build-result.sh Source2: same-build-result.sh

View File

@ -26,6 +26,7 @@ function trim_release_old()
sed -e " sed -e "
/\(\/boot\|\/lib\/modules\|\/lib\/firmware\|\/usr\/src\|$version_release_old_regex_l\$\)/{s,$version_release_old_regex_l,@VERSION@-@RELEASE_LONG@,g;s,$version_release_old_regex_s,@VERSION@-@RELEASE_SHORT@,g} /\(\/boot\|\/lib\/modules\|\/lib\/firmware\|\/usr\/src\|$version_release_old_regex_l\$\)/{s,$version_release_old_regex_l,@VERSION@-@RELEASE_LONG@,g;s,$version_release_old_regex_s,@VERSION@-@RELEASE_SHORT@,g}
s/\(\/var\/adm\/update-scripts\/\)${name_ver_rel_old_regex_l}\([^[:blank:]]\+\)/\1@NAME_VER_REL@\2/g s/\(\/var\/adm\/update-scripts\/\)${name_ver_rel_old_regex_l}\([^[:blank:]]\+\)/\1@NAME_VER_REL@\2/g
s/\(\/var\/adm\/update-messages\/\)${name_ver_rel_old_regex_l}\([^[:blank:]]\+\)/\1@NAME_VER_REL@\2/g
" "
} }
function trim_release_new() function trim_release_new()
@ -33,16 +34,17 @@ function trim_release_new()
sed -e " sed -e "
/\(\/boot\|\/lib\/modules\|\/lib\/firmware\|\/usr\/src\|$version_release_new_regex_l\$\)/{s,$version_release_new_regex_l,@VERSION@-@RELEASE_LONG@,g;s,$version_release_new_regex_s,@VERSION@-@RELEASE_SHORT@,g} /\(\/boot\|\/lib\/modules\|\/lib\/firmware\|\/usr\/src\|$version_release_new_regex_l\$\)/{s,$version_release_new_regex_l,@VERSION@-@RELEASE_LONG@,g;s,$version_release_new_regex_s,@VERSION@-@RELEASE_SHORT@,g}
s/\(\/var\/adm\/update-scripts\/\)${name_ver_rel_new_regex_l}\([^[:blank:]]\+\)/\1@NAME_VER_REL@\2/g s/\(\/var\/adm\/update-scripts\/\)${name_ver_rel_new_regex_l}\([^[:blank:]]\+\)/\1@NAME_VER_REL@\2/g
s/\(\/var\/adm\/update-messages\/\)${name_ver_rel_new_regex_l}\([^[:blank:]]\+\)/\1@NAME_VER_REL@\2/g
" "
} }
# Get single directory or filename with long or short release string # Get single directory or filename with long or short release string
function grep_release_old() function grep_release_old()
{ {
grep -E "(/boot|/lib/modules|/lib/firmware|/usr/src)/[^/]*(${version_release_old_regex_l}(\$|[^/]+\$)|${version_release_old_regex_s}(\$|[^/]+\$))" grep -E "(/boot|/lib/modules|/lib/firmware|/usr/src|/var/adm/update-scripts)/[^/]*(${version_release_old_regex_l}(\$|[^/]+\$)|${version_release_old_regex_s}(\$|[^/]+\$))"
} }
function grep_release_new() function grep_release_new()
{ {
grep -E "(/boot|/lib/modules|/lib/firmware|/usr/src)/[^/]*(${version_release_new_regex_l}(\$|[^/]+\$)|${version_release_new_regex_s}(\$|[^/]+\$))" grep -E "(/boot|/lib/modules|/lib/firmware|/usr/src|/var/adm/update-scripts)/[^/]*(${version_release_new_regex_l}(\$|[^/]+\$)|${version_release_new_regex_s}(\$|[^/]+\$))"
} }
function check_provides() function check_provides()

View File

@ -440,6 +440,31 @@ check_single_file()
perl -e "open fh, '+<', 'old/$file'; seek fh, 4, SEEK_SET; print fh '0000';" 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';" perl -e "open fh, '+<', 'new/$file'; seek fh, 4, SEEK_SET; print fh '0000';"
;; ;;
*.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--;
}
"
;;
*.bz2) *.bz2)
bunzip2 -c old/$file > old/${file/.bz2/} bunzip2 -c old/$file > old/${file/.bz2/}
bunzip2 -c new/$file > new/${file/.bz2/} bunzip2 -c new/$file > new/${file/.bz2/}
@ -474,12 +499,26 @@ check_single_file()
sed -i -e "s,POT-Creation-Date: ....-..-.. ..:..+....,POT-Creation-Date: 1970-01-01 00:00+0000," $f sed -i -e "s,POT-Creation-Date: ....-..-.. ..:..+....,POT-Creation-Date: 1970-01-01 00:00+0000," $f
done done
;; ;;
*/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
strip_numbered_anchors
;;
/usr/share/doc/kde/HTML/*/*/index.cache|/usr/share/doc/kde/HTML/*/*/*/index.cache|\
/usr/share/gtk-doc/html/*/*.html|/usr/share/gtk-doc/html/*/*.devhelp2)
# various kde and gtk packages
strip_numbered_anchors
;;
/usr/share/doc/packages/*/*.html|\ /usr/share/doc/packages/*/*.html|\
/usr/share/doc/packages/*/*/*.html|\ /usr/share/doc/packages/*/*/*.html|\
/usr/share/doc/*/html/*.html|\ /usr/share/doc/*/html/*.html|\
/usr/share/doc/kde/HTML/*/*/*.html) /usr/share/doc/kde/HTML/*/*/*.html)
for f in old/$file new/$file; do for f in old/$file new/$file; do
sed -i -e ' sed -i -e '
s|META NAME="Last-modified" CONTENT="[^"]\+"|META NAME="Last-modified" CONTENT="Thu Mar 3 10:32:44 2016"|
s|<!-- Created on [^,]\+, [0-9]\+ [0-9]\+ by texi2html [0-9\.]\+ -->|<!-- Created on July, 14 2015 by texi2html 1.78 -->| s|<!-- Created on [^,]\+, [0-9]\+ [0-9]\+ by texi2html [0-9\.]\+ -->|<!-- Created on July, 14 2015 by texi2html 1.78 -->|
s|<!-- Created on [^,]\+, [0-9]\+ by texi2html [0-9\.]\+$|<!-- Created on October 1, 2015 by texi2html 5.0| s|<!-- Created on [^,]\+, [0-9]\+ by texi2html [0-9\.]\+$|<!-- Created on October 1, 2015 by texi2html 5.0|
s|^<!-- Created on .*, 20.. by texi2html .\...|<!-- Created on August 7, 2009 by texi2html 1.82| s|^<!-- Created on .*, 20.. by texi2html .\...|<!-- Created on August 7, 2009 by texi2html 1.82|
@ -492,8 +531,7 @@ check_single_file()
done done
strip_numbered_anchors strip_numbered_anchors
;; ;;
/usr/share/javadoc/*.html |\ /usr/*/javadoc/*.html)
/usr/share/javadoc/*/*.html|/usr/share/javadoc/*/*/*.html)
strip_numbered_anchors strip_numbered_anchors
# There are more timestamps in html, so far we handle only some primitive versions. # There are more timestamps in html, so far we handle only some primitive versions.
for f in old/$file new/$file; do for f in old/$file new/$file; do
@ -501,6 +539,7 @@ check_single_file()
# <head> # <head>
# <!-- Generated by javadoc (version 1.7.0_75) on Tue Feb 03 02:20:12 GMT 2015 --> # <!-- Generated by javadoc (version 1.7.0_75) on Tue Feb 03 02:20:12 GMT 2015 -->
# <!-- Generated by javadoc on Tue Feb 03 00:02:48 GMT 2015 --> # <!-- Generated by javadoc on Tue Feb 03 00:02:48 GMT 2015 -->
# <!-- Generated by javadoc (1.8.0_72) on Thu Mar 03 12:50:28 GMT 2016 -->
# <meta name="date" content="2015-02-03"> # <meta name="date" content="2015-02-03">
# </head> # </head>
sed -i -e ' sed -i -e '
@ -510,6 +549,8 @@ check_single_file()
/^<\/head>/{ /^<\/head>/{
b end_head b end_head
} }
s/^<!-- Generated by javadoc ([0-9._]\+) on ... ... .. ..:..:.. \(GMT\|UTC\) .... -->/<!-- Generated by javadoX (1.8.0_72) on Thu Mar 03 12:50:28 GMT 2016 -->/
t next
s/^\(<!-- Generated by javadoc\) \((\(build\|version\) [0-9._]\+) on ... ... .. ..:..:.. \(GMT\|UTC\) ....\) \(-->\)/\1 some-date-removed-by-build-compare \5/ s/^\(<!-- Generated by javadoc\) \((\(build\|version\) [0-9._]\+) on ... ... .. ..:..:.. \(GMT\|UTC\) ....\) \(-->\)/\1 some-date-removed-by-build-compare \5/
t next t next
s/^\(<!-- Generated by javadoc\) \(on ... ... .. ..:..:.. \(GMT\|UTC\) ....\) \(-->\)/\1 some-date-removed-by-build-compare \3/ s/^\(<!-- Generated by javadoc\) \(on ... ... .. ..:..:.. \(GMT\|UTC\) ....\) \(-->\)/\1 some-date-removed-by-build-compare \3/
@ -568,7 +609,12 @@ check_single_file()
*.elc) *.elc)
# emacs lisp files # emacs lisp files
for f in old/$file new/$file; do for f in old/$file new/$file; do
sed -i -e 's|Compiled by abuild@.* on ... ... .. ..:..:.. 20..$|compiled by abuild@buildhost on Wed Jul 01 00:00:00 2009|' $f 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 done
;; ;;
/var/lib/texmf/web2c/*/*fmt |\ /var/lib/texmf/web2c/*/*fmt |\
@ -590,25 +636,12 @@ check_single_file()
sed -i -e 's|built by abuild@[a-z0-9]* on ... ... [0-9]* [0-9]*:[0-9][0-9]:[0-9][0-9] .* 20[0-9][0-9]|built by abuild@build42 on Thu May 6 11:21:17 UTC 2010|' $f sed -i -e 's|built by abuild@[a-z0-9]* on ... ... [0-9]* [0-9]*:[0-9][0-9]:[0-9][0-9] .* 20[0-9][0-9]|built by abuild@build42 on Thu May 6 11:21:17 UTC 2010|' $f
done done
;; ;;
/usr/share/doc/kde/HTML/*/*/index.cache|/usr/share/doc/kde/HTML/*/*/*/index.cache|\
/usr/share/gtk-doc/html/*/*.html|/usr/share/gtk-doc/html/*/*.devhelp2)
# various kde and gtk packages
strip_numbered_anchors
;;
*/created.rid) */created.rid)
# ruby documentation # ruby documentation
# file just contains a timestamp and nothing else, so ignore it # file just contains a timestamp and nothing else, so ignore it
echo "Ignore $file" echo "Ignore $file"
return 0 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
strip_numbered_anchors
;;
*/Linux*Env.Set.sh) */Linux*Env.Set.sh)
# LibreOffice files, contains: # LibreOffice files, contains:
# Generated on: Mon Apr 18 13:19:22 UTC 2011 # Generated on: Mon Apr 18 13:19:22 UTC 2011
@ -622,19 +655,9 @@ check_single_file()
return 0 return 0
;; ;;
/var/adm/update-messages/*|/var/adm/update-scripts/*) /var/adm/update-messages/*|/var/adm/update-scripts/*)
# encode version-release inside
oldfn=`echo "$file"|sed -e s/-$release2/-$release1/;`
# fetchmsttfonts embeds the release number in the update shell script. # fetchmsttfonts embeds the release number in the update shell script.
echo sed -i -e "s/-$release1/-$release2/g;" "old/$oldfn" sed -i "s/${name_ver_rel_old_regex_l}/@NAME_VER_REL@/" old/$file
sed -i -e "s/-$release1/-$release2/g;" "old/$oldfn" sed -i "s/${name_ver_rel_new_regex_l}/@NAME_VER_REL@/" new/$file
if ! diff -u old/$oldfn new/$file; then
echo "$oldfn is not same as $file"
return 1
fi
echo "$file and $oldfn are same"
return 0
;; ;;
*.ps) *.ps)
for f in "old/$file" "new/$file"; do for f in "old/$file" "new/$file"; do

View File

@ -14,7 +14,20 @@
CMPSCRIPT=${0%/*}/pkg-diff.sh CMPSCRIPT=${0%/*}/pkg-diff.sh
SCMPSCRIPT=${0%/*}/srpm-check.sh SCMPSCRIPT=${0%/*}/srpm-check.sh
check_all=1 file1=`mktemp`
file2=`mktemp`
_x() {
rm -f ${file1} ${file2}
}
trap _x EXIT
#
check_all=
if test "$1" = "-a"
then
check_all="-a"
shift
fi
#
OLDDIR="$1" OLDDIR="$1"
shift shift
NEWDIRS="$*" NEWDIRS="$*"
@ -32,7 +45,9 @@ 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' -and ! -name '*.delta.rpm' | wc -l` != `find $OLDDIR -name '*.rpm' -and ! -name '*.delta.rpm' | wc -l`; then
echo "different number of subpackages" echo "different number of subpackages"
find $OLDDIR $NEWDIRS -name '*.rpm' -and ! -name '*.delta.rpm' find $OLDDIR -name '*.rpm' -and ! -name '*.delta.rpm' -print0 | xargs -0 rpm -qp --qf '%{NAME}\n' | sort > ${file1}
find $NEWDIRS -name '*.rpm' -and ! -name '*.delta.rpm' -print0 | xargs -0 rpm -qp --qf '%{NAME}\n' | sort > ${file2}
diff -u ${file1} ${file2}
exit 1 exit 1
fi fi
@ -59,8 +74,22 @@ bash $SCMPSCRIPT "$osrpm" "$nsrpm" || exit 1
# problem: a package can contain both noarch and arch subpackages, so we have to # 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 # 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. # has all the packages in a single directory and would sort this as w.rpm, x.rpm.
OLDRPMS=($(find "$OLDDIR" -type f -name \*rpm -a ! -name \*src.rpm -a ! -name \*.delta.rpm|sort|grep -v -- -32bit-|grep -v -- -64bit-|grep -v -- '-x86-.*\.ia64\.rpm')) find $OLDDIR -type f -name '*.rpm' \
NEWRPMS=($(find $NEWDIRS -type f -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')) -a ! -name '*src.rpm' \
-a ! -name '*.delta.rpm' \
-a ! -name '*-32bit-*' \
-a ! -name '*-64bit-*' \
-a ! -name '*-x86-*.ia64.rpm' \
> ${file1}
find $NEWDIRS -type f -name '*.rpm' \
-a ! -name '*src.rpm' \
-a ! -name '*.delta.rpm' \
-a ! -name '*-32bit-*' \
-a ! -name '*-64bit-*' \
-a ! -name '*-x86-*.ia64.rpm' \
> ${file2}
OLDRPMS=($( sort --field-separator=/ --key=` sed -n '1s@[^/]@@gp' ${file1} | wc -c ` ${file1} ))
NEWRPMS=($( sort --field-separator=/ --key=` sed -n '1s@[^/]@@gp' ${file2} | wc -c ` ${file2} ))
# Get version-release from first RPM and keep for rpmlint check # Get version-release from first RPM and keep for rpmlint check
# Remember to quote the "." for future regexes # Remember to quote the "." for future regexes
@ -84,11 +113,7 @@ for opac in ${OLDRPMS[*]}; do
echo "skipping -debuginfo package" echo "skipping -debuginfo package"
;; ;;
*) *)
bash $CMPSCRIPT "$opac" "$npac" || SUCCESS=0 bash $CMPSCRIPT $check_all "$opac" "$npac" || SUCCESS=0
if test $SUCCESS -eq 0 -a -z "$check_all"; then
echo "differences between $opac and $npac"
exit 1
fi
;; ;;
esac esac
done done
@ -110,8 +135,6 @@ fi
if test -n "$OTHERDIR"; then if test -n "$OTHERDIR"; then
if test -e $OLDDIR/rpmlint.log -a -e $OTHERDIR/rpmlint.log; then if test -e $OLDDIR/rpmlint.log -a -e $OTHERDIR/rpmlint.log; then
file1=`mktemp`
file2=`mktemp`
echo "comparing $OLDDIR/rpmlint.log and $OTHERDIR/rpmlint.log" echo "comparing $OLDDIR/rpmlint.log and $OTHERDIR/rpmlint.log"
# Sort the files first since the order of messages is not deterministic # Sort the files first since the order of messages is not deterministic
# Remove release from files # Remove release from files