summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/build-compare/files/Rename-rpm-check.sh-to-pkg-diff.sh.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/build-compare/files/Rename-rpm-check.sh-to-pkg-diff.sh.patch')
-rw-r--r--meta/recipes-devtools/build-compare/files/Rename-rpm-check.sh-to-pkg-diff.sh.patch1599
1 files changed, 0 insertions, 1599 deletions
diff --git a/meta/recipes-devtools/build-compare/files/Rename-rpm-check.sh-to-pkg-diff.sh.patch b/meta/recipes-devtools/build-compare/files/Rename-rpm-check.sh-to-pkg-diff.sh.patch
deleted file mode 100644
index cff3a9e236..0000000000
--- a/meta/recipes-devtools/build-compare/files/Rename-rpm-check.sh-to-pkg-diff.sh.patch
+++ /dev/null
@@ -1,1599 +0,0 @@
1From 4de3df5a1b361cd09a081f0e0bdb94cbf684ed48 Mon Sep 17 00:00:00 2001
2From: Robert Yang <liezhi.yang@windriver.com>
3Date: Thu, 19 Feb 2015 00:34:47 -0800
4Subject: [PATCH] Rename rpm-check.sh to pkg-diff.sh.
5
6The tool now accepts package input other than rpm, so change the name
7which could be misleading.
8
9Upstream-Status: Submitted [https://github.com/openSUSE/build-compare/pulls]
10
11Signed-off-by: Randy Witt <randy.e.witt@linux.intel.com>
12
13Updated for rpm-check.sh.
14
15Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
16---
17 build-compare.spec | 2 +-
18 pkg-diff.sh | 765 ++++++++++++++++++++++++++++++++++++++++++++++++++
19 rpm-check.sh | 764 -------------------------------------------------
20 same-build-result.sh | 4 +-
21 4 files changed, 768 insertions(+), 767 deletions(-)
22 create mode 100644 pkg-diff.sh
23 delete mode 100755 rpm-check.sh
24
25diff --git a/build-compare.spec b/build-compare.spec
26index 14a97e9..5f47ca1 100644
27--- a/build-compare.spec
28+++ b/build-compare.spec
29@@ -25,7 +25,7 @@ Version: 2015.02.10
30 Release: 0
31 Source1: COPYING
32 Source2: same-build-result.sh
33-Source3: rpm-check.sh
34+Source3: pkg-diff.sh
35 Source4: functions.sh
36 Source5: srpm-check.sh
37 BuildRoot: %{_tmppath}/%{name}-%{version}-build
38diff --git a/pkg-diff.sh b/pkg-diff.sh
39new file mode 100644
40index 0000000..56035c1
41--- /dev/null
42+++ b/pkg-diff.sh
43@@ -0,0 +1,765 @@
44+#! /bin/bash
45+#
46+# Copyright (c) 2009, 2010, 2011, 2012 SUSE Linux Product GmbH, Germany.
47+# Licensed under GPL v2, see COPYING file for details.
48+#
49+# Written by Michael Matz and Stephan Coolo
50+# Enhanced by Andreas Jaeger
51+
52+FUNCTIONS=${0%/*}/functions.sh
53+
54+check_all=
55+case $1 in
56+ -a | --check-all)
57+ check_all=1
58+ shift
59+esac
60+
61+if test "$#" != 2; then
62+ echo "usage: $0 [-a|--check-all] old.rpm new.rpm"
63+ exit 1
64+fi
65+
66+self_script=$(cd $(dirname $0); echo $(pwd)/$(basename $0))
67+
68+source $FUNCTIONS
69+
70+oldpkg=`readlink -f $1`
71+newpkg=`readlink -f $2`
72+rename_script=`mktemp`
73+
74+if test ! -f "$oldpkg"; then
75+ echo "can't open $1"
76+ exit 1
77+fi
78+
79+if test ! -f "$newpkg"; then
80+ echo "can't open $2"
81+ exit 1
82+fi
83+
84+#usage unjar <file>
85+function unjar()
86+{
87+ local file
88+ file=$1
89+
90+ if [[ $(type -p fastjar) ]]; then
91+ UNJAR=fastjar
92+ elif [[ $(type -p jar) ]]; then
93+ UNJAR=jar
94+ elif [[ $(type -p unzip) ]]; then
95+ UNJAR=unzip
96+ else
97+ echo "ERROR: jar, fastjar, or unzip is not installed (trying file $file)"
98+ exit 1
99+ fi
100+
101+ case $UNJAR in
102+ jar|fastjar)
103+ # echo jar -xf $file
104+ ${UNJAR} -xf $file
105+ ;;
106+ unzip)
107+ unzip -oqq $file
108+ ;;
109+ esac
110+}
111+
112+# list files in directory
113+#usage unjar_l <file>
114+function unjar_l()
115+{
116+ local file
117+ file=$1
118+
119+ if [[ $(type -p fastjar) ]]; then
120+ UNJAR=fastjar
121+ elif [[ $(type -p jar) ]]; then
122+ UNJAR=jar
123+ elif [[ $(type -p unzip) ]]; then
124+ UNJAR=unzip
125+ else
126+ echo "ERROR: jar, fastjar, or unzip is not installed (trying file $file)"
127+ exit 1
128+ fi
129+
130+ case $UNJAR in
131+ jar|fastjar)
132+ ${UNJAR} -tf $file
133+ ;;
134+ unzip)
135+ unzip -l $file
136+ ;;
137+ esac
138+}
139+
140+filter_disasm()
141+{
142+ 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>/'
143+}
144+
145+echo "Comparing `basename $oldpkg` to `basename $newpkg`"
146+
147+case $oldpkg in
148+ *.rpm)
149+ cmp_spec $rename_script $oldpkg $newpkg
150+ RES=$?
151+ case $RES in
152+ 0)
153+ echo "RPM meta information is identical"
154+ if test -z "$check_all"; then
155+ exit 0
156+ fi
157+ ;;
158+ 1)
159+ echo "RPM meta information is different"
160+ if test -z "$check_all"; then
161+ exit 1
162+ fi
163+ ;;
164+ 2)
165+ echo "RPM file checksum differs."
166+ RES=0
167+ ;;
168+ *)
169+ echo "Wrong exit code!"
170+ exit 1
171+ ;;
172+ esac
173+ ;;
174+esac
175+
176+file1=`mktemp`
177+file2=`mktemp`
178+
179+dir=`mktemp -d`
180+echo "Extracting packages"
181+unpackage $oldpkg $dir/old
182+unpackage $newpkg $dir/new
183+
184+# files is set in cmp_spec for rpms, so if RES is empty we should assume
185+# it wasn't an rpm and pick all files for comparison.
186+if [ -z $RES ]; then
187+ oldfiles=`cd $dir/old; find . -type f`
188+ newfiles=`cd $dir/new; find . -type f`
189+
190+ files=`echo -e "$oldfiles\n$newfiles" | sort -u`
191+fi
192+
193+cd $dir
194+bash $rename_script
195+
196+dfile=`mktemp`
197+
198+diff_two_files()
199+{
200+ if ! cmp -s old/$file new/$file; then
201+ echo "$file differs ($ftype)"
202+ hexdump -C old/$file > $file1
203+ hexdump -C new/$file > $file2
204+ diff -u $file1 $file2 | head -n 200
205+ return 1
206+ fi
207+ return 0
208+}
209+
210+trim_man_first_line()
211+{
212+ # Handles the first line if it is like:
213+ #.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28)
214+ #.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.43.3.
215+ local f=$1
216+ sed -i -e '1{
217+ s|^\.\\"[[:blank:]]\+Automatically[[:blank:]]generated[[:blank:]]by[[:blank:]]Pod::Man[[:blank:]].*|.\\" Overly verbose Pod::Man|
218+ 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|
219+ }' $f
220+}
221+
222+trim_man_TH()
223+{
224+ # Handles lines like:
225+ # .TH debhelper 7 "2010-02-27" "7.4.15" "Debhelper"
226+ # .TH DIRMNGR-CLIENT 1 2010-02-27 "Dirmngr 1.0.3" "GNU Privacy Guard"
227+ # .TH ccmake 1 "March 06, 2010" "ccmake 2.8.1-rc3"
228+ # .TH QEMU-IMG 1 "2010-03-14" " " " "
229+ # .TH kdecmake 1 "May 07, 2010" "cmake 2.8.1"
230+ # .TH "appender.h" 3 "12 May 2010" "Version 1.2.1" "log4c" \" -*- nroff -*-
231+ # .TH "appender.h" 3 "Tue Aug 31 2010" "Version 1.2.1" "log4c" \" -*- nroff -*-
232+ # .TH "OFFLINEIMAP" "1" "11 May 2010" "John Goerzen" "OfflineIMAP Manual"
233+ # .TH gv 3guile "13 May 2010"
234+ #.TH "GIT\-ARCHIMPORT" "1" "09/13/2010" "Git 1\&.7\&.1" "Git Manual"
235+ # .TH LDIRECTORD 8 "2010-10-20" "perl v5.12.2" "User Contributed Perl Documentation"
236+ # .TH ccmake 1 "February 05, 2012" "ccmake 2.8.7"
237+ # .TH "appender.h" 3 "Tue Aug 31 2010" "Version 1.2.1" "log4c" \" -*- nroff -*-
238+ # .TH ARCH "1" "September 2010" "GNU coreutils 8.5" "User Commands"
239+ # .TH "GCM-CALIBRATE" "1" "03 February 2012" "" ""
240+ #.TH Locale::Po4a::Xml.pm 3pm "2015-01-30" "Po4a Tools" "Po4a Tools"
241+ local f=$1
242+ # (.TH quoted section) (quoted_date)(*)
243+ sed -i -e 's|^\([[:blank:]]*\.TH[[:blank:]]\+"[^"]\+"[[:blank:]]\+[^[:blank:]]\+\)[[:blank:]]\+\("[^"]\+"\)\([[:blank:]]\+.*\)\?|\1 "qq2000-01-01"\3|' $f
244+ # (.TH unquoted section) (quoted_date)(*)
245+ sed -i -e 's|^\([[:blank:]]*\.TH[[:blank:]]\+[^"][^[:blank:]]\+[[:blank:]]\+[^[:blank:]]\+\)[[:blank:]]\+\("[^"]\+"\)\([[:blank:]]\+.*\)\?|\1 "uq2000-02-02"\3|' $f
246+ # (.TH quoted section) (unquoted_date)(*)
247+ sed -i -e 's|^\([[:blank:]]*\.TH[[:blank:]]\+"[^"]\+"[[:blank:]]\+[^[:blank:]]\+\)[[:blank:]]\+\([^"][^[:blank:]]\+\)\([[:blank:]]\+.*\)\?|\1 qu2000-03-03\3|' $f
248+ # (.TH unquoted section) (unquoted_date)(*)
249+ sed -i -e 's|^\([[:blank:]]*\.TH[[:blank:]]\+[^"][^[:blank:]]\+[[:blank:]]\+[^[:blank:]]\+\)[[:blank:]]\+\([^"][^[:blank:]]\+\)\([[:blank:]]\+.*\)\?|\1 uu2000-04-04\3|' $f
250+}
251+
252+strip_numbered_anchors()
253+{
254+ # Remove numbered anchors on Docbook / HTML files.
255+ # This should be save since we remove them from old and new files.
256+ # A trailing </a> or </div> tag will stay also on both files.
257+ for f in old/$file new/$file; do
258+ sed -i -e 's%<[ ]*a[ ]\+name[^<]*[0-9]\+[^<]*%%g' \
259+ -e 's%<[ ]*a[ ]\+href[^<]*#[^<]*[0-9]\+[^<]*%%g' \
260+ -e 's%<[^<]*id="ftn\.[^<]*[0-9]\+[^<]*%%g' $f
261+ done
262+}
263+
264+
265+check_compressed_file()
266+{
267+ local file=$1
268+ local ext=$2
269+ local tmpdir=`mktemp -d`
270+ local ftype
271+ local ret=0
272+ echo "$ext file with odd filename: $file"
273+ if test -n "$tmpdir"; then
274+ mkdir $tmpdir/{old,new}
275+ cp --parents --dereference old/$file $tmpdir/
276+ cp --parents --dereference new/$file $tmpdir/
277+ if pushd $tmpdir > /dev/null ; then
278+ case "$ext" in
279+ bz2)
280+ mv old/$file{,.bz2}
281+ mv new/$file{,.bz2}
282+ bzip2 -d old/$file.bz2
283+ bzip2 -d new/$file.bz2
284+ ;;
285+ gzip)
286+ mv old/$file{,.gz}
287+ mv new/$file{,.gz}
288+ gzip -d old/$file.gz
289+ gzip -d new/$file.gz
290+ ;;
291+ xz)
292+ mv old/$file{,.xz}
293+ mv new/$file{,.xz}
294+ xz -d old/$file.xz
295+ xz -d new/$file.xz
296+ ;;
297+ esac
298+ ftype=`/usr/bin/file old/$file | sed 's@^[^:]\+:[[:blank:]]*@@'`
299+ case $ftype in
300+ POSIX\ tar\ archive)
301+ echo "$ext content is: $ftype"
302+ mv old/$file{,.tar}
303+ mv new/$file{,.tar}
304+ if ! check_single_file ${file}.tar; then
305+ ret=1
306+ fi
307+ ;;
308+ ASCII\ cpio\ archive\ *)
309+ echo "$ext content is: $ftype"
310+ mv old/$file{,.cpio}
311+ mv new/$file{,.cpio}
312+ if ! check_single_file ${file}.cpio; then
313+ ret=1
314+ fi
315+ ;;
316+ *)
317+ echo "unhandled $ext content: $ftype"
318+ if ! diff_two_files; then
319+ ret=1
320+ fi
321+ ;;
322+ esac
323+ popd > /dev/null
324+ fi
325+ rm -rf "$tmpdir"
326+ fi
327+ return $ret
328+}
329+
330+check_single_file()
331+{
332+ local file="$1"
333+ case $file in
334+ *.spec)
335+ sed -i -e "s,Release:.*$release1,Release: @RELEASE@," old/$file
336+ sed -i -e "s,Release:.*$release2,Release: @RELEASE@," new/$file
337+ ;;
338+ *.exe.mdb|*.dll.mdb)
339+ # Just debug information, we can skip them
340+ echo "$file skipped as debug file."
341+ return 0
342+ ;;
343+ *.a)
344+ flist=`ar t new/$file`
345+ pwd=$PWD
346+ fdir=`dirname $file`
347+ cd old/$fdir
348+ ar x `basename $file`
349+ cd $pwd/new/$fdir
350+ ar x `basename $file`
351+ cd $pwd
352+ for f in $flist; do
353+ if ! check_single_file $fdir/$f; then
354+ return 1
355+ fi
356+ done
357+ return 0
358+ ;;
359+ *.cpio)
360+ flist=`cpio --quiet --list --force-local < "new/$file"`
361+ pwd=$PWD
362+ fdir=$file.extract.$PPID.$$
363+ mkdir old/$fdir new/$fdir
364+ cd old/$fdir
365+ cpio --quiet --extract --force-local < "../${file##*/}"
366+ cd $pwd/new/$fdir
367+ cpio --quiet --extract --force-local < "../${file##*/}"
368+ cd $pwd
369+ local ret=0
370+ for f in $flist; do
371+ if ! check_single_file $fdir/$f; then
372+ ret=1
373+ if test -z "$check_all"; then
374+ break
375+ fi
376+ fi
377+ done
378+ rm -rf old/$fdir new/$fdir
379+ return $ret
380+ ;;
381+ *.tar|*.tar.bz2|*.tar.gz|*.tgz|*.tbz2)
382+ flist=`tar tf new/$file`
383+ pwd=$PWD
384+ fdir=`dirname $file`
385+ cd old/$fdir
386+ tar xf `basename $file`
387+ cd $pwd/new/$fdir
388+ tar xf `basename $file`
389+ cd $pwd
390+ local ret=0
391+ for f in $flist; do
392+ if ! check_single_file $fdir/$f; then
393+ ret=1
394+ if test -z "$check_all"; then
395+ break
396+ fi
397+ fi
398+ done
399+ return $ret
400+ ;;
401+ *.zip|*.jar|*.war)
402+ cd old
403+ unjar_l ./$file |sort > flist
404+ # 10-05-2010 14:39
405+ sed -i -e "s, [0-9][0-9]-[0-9][0-9]-[0-9]\+ [0-9][0-9]:[0-9][0-9] , date ," flist
406+ # 2012-02-03 07:59
407+ 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
408+ cd ../new
409+ unjar_l ./$file |sort> flist
410+ sed -i -e "s, [0-9][0-9]-[0-9][0-9]-[0-9]\+ [0-9][0-9]:[0-9][0-9] , date ,; " flist
411+ 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
412+ cd ..
413+ if ! cmp -s old/flist new/flist; then
414+ echo "$file has different file list"
415+ diff -u old/flist new/flist
416+ return 1
417+ fi
418+ flist=`grep date new/flist | sed -e 's,.* date ,,'`
419+ pwd=$PWD
420+ fdir=`dirname $file`
421+ cd old/$fdir
422+ unjar `basename $file`
423+ cd $pwd/new/$fdir
424+ unjar `basename $file`
425+ cd $pwd
426+ local ret=0
427+ for f in $flist; do
428+ if test -f new/$fdir/$f && ! check_single_file $fdir/$f; then
429+ ret=1
430+ if test -z "$check_all"; then
431+ break
432+ fi
433+ fi
434+ done
435+ return $ret;;
436+ *.pyc|*.pyo)
437+ perl -e "open fh, '+<', 'old/$file'; seek fh, 4, SEEK_SET; print fh '0000';"
438+ perl -e "open fh, '+<', 'new/$file'; seek fh, 4, SEEK_SET; print fh '0000';"
439+ ;;
440+ *.bz2)
441+ bunzip2 -c old/$file > old/${file/.bz2/}
442+ bunzip2 -c new/$file > new/${file/.bz2/}
443+ check_single_file ${file/.bz2/}
444+ return $?
445+ ;;
446+ *.gz)
447+ gunzip -c old/$file > old/${file/.gz/}
448+ gunzip -c new/$file > new/${file/.gz/}
449+ check_single_file ${file/.gz/}
450+ return $?
451+ ;;
452+ *.rpm)
453+ $self_script -a old/$file new/$file
454+ return $?
455+ ;;
456+ *png)
457+ # Try to remove timestamps, only if convert from ImageMagick is installed
458+ if [[ $(type -p convert) ]]; then
459+ convert old/$file +set date:create +set date:modify old/${file/.png/_n.png}
460+ convert old/$file +set date:create +set date:modify new/${file/.png/_n.png}
461+ if ! cmp -s old/${file/.png/_n.png} new/${file/.png/_n.png}; then
462+ echo "$file differs ($ftype)"
463+ hexdump -C old/${file/.png/_n.png} > $file1
464+ hexdump -C new/${file/.png/_n.png} > $file2
465+ diff -u $file1 $file2 | head -n 20
466+ return 1
467+ fi
468+ return 0
469+ fi
470+ ;;
471+ /usr/share/locale/*/LC_MESSAGES/*.mo|/usr/share/locale-bundle/*/LC_MESSAGES/*.mo)
472+ for f in old/$file new/$file; do
473+ sed -i -e "s,POT-Creation-Date: ....-..-.. ..:..+....,POT-Creation-Date: 1970-01-01 00:00+0000," $f
474+ done
475+ ;;
476+ /usr/share/doc/packages/*/*.html|\
477+ /usr/share/doc/kde/HTML/*/*/*.html|/usr/share/doc/*/html/*.html)
478+ for f in old/$file new/$file; do
479+ # texi2html output, e.g. in kvm, indent, qemu
480+ sed -i -e "s|^<!-- Created on .*, 20.. by texi2html .\...|<!-- Created on August 7, 2009 by texi2html 1.82|" $f
481+ sed -i -e 's|^ *This document was generated by <em>Autobuild</em> on <em>.*, 20..</em> using <a href="http://www.nongnu.org/texi2html/"><em>texi2html .\...</em></a>.$| This document was generated by <em>Autobuild</em> on <em>August 7, 2009</em> using <a href="http://www.nongnu.org/texi2html/"><em>texi2html 1.82</em></a>.|' $f
482+ # doxygen docu, e.g. in libssh and log4c
483+ sed -i -e 's|Generated on ... ... [0-9]* [0-9]*:[0-9][0-9]:[0-9][0-9] 20[0-9][0-9] for |Generated on Mon May 10 20:45:00 2010 for |' $f
484+ # Generated on Sat Aug 14 2010 16:49:48 for libssh
485+ sed -i -e 's|Generated on ... ... [0-9]* 20[0-9][0-9] [0-9]*:[0-9][0-9]:[0-9][0-9] for |Generated on Mon May 10 20:45:00 2010 for |' $f
486+ done
487+ strip_numbered_anchors
488+ ;;
489+ /usr/share/javadoc/*.html |\
490+ /usr/share/javadoc/*/*.html|/usr/share/javadoc/*/*/*.html)
491+ strip_numbered_anchors
492+ # There are more timestamps in html, so far we handle only some primitive versions.
493+ for f in old/$file new/$file; do
494+ # Javadoc:
495+ # <head>
496+ # <!-- Generated by javadoc (version 1.7.0_75) on Tue Feb 03 02:20:12 GMT 2015 -->
497+ # <!-- Generated by javadoc on Tue Feb 03 00:02:48 GMT 2015 -->
498+ # <meta name="date" content="2015-02-03">
499+ # </head>
500+ sed -i -e '
501+ /^<head>/{
502+ : next
503+ n
504+ /^<\/head>/{
505+ b end_head
506+ }
507+ s/^\(<!-- Generated by javadoc\) \((\(build\|version\) [0-9._]\+) on ... ... .. ..:..:.. \(GMT\|UTC\) ....\) \(-->\)/\1 some-date-removed-by-build-compare \5/
508+ t next
509+ s/^\(<!-- Generated by javadoc\) \(on ... ... .. ..:..:.. \(GMT\|UTC\) ....\) \(-->\)/\1 some-date-removed-by-build-compare \3/
510+ t next
511+ s/^<meta name="date" content="[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}">/<meta name="date" content="some-date-removed-by-build-compare">/
512+ b next
513+ }
514+ : end_head
515+ ' $f
516+ # Gjdoc HtmlDoclet:
517+ sed -i -e 's%Generated by Gjdoc HtmlDoclet [0-9,.]*, part of <a href="http://www.gnu.org/software/classpath/cp-tools/" title="" target="_top">GNU Classpath Tools</a>, on .*, 20.. [0-9]*:..:.. \(a\|p\)\.m\. GMT.%Generated by Gjdoc.%' $f
518+ sed -i -e 's%<!DOCTYPE html PUBLIC "-//gnu.org///DTD XHTML 1.1 plus Target 1.0//EN"\(.*\)GNU Classpath Tools</a>, on [A-Z][a-z]* [0-9]*, 20?? [0-9]*:??:?? \(a|p\)\.m\. GMT.</p>%<!DOCTYPE html PUBLIC "-//gnu.org///DTD XHTML 1.1 plus Target 1.0//EN"\1GNU Classpath Tools</a>, on January 1, 2009 0:00:00 a.m. GMT.</p>%' $f
519+ sed -i -e 's%<!DOCTYPE html PUBLIC "-//gnu.org///DTD\(.*GNU Classpath Tools</a>\), on [a-zA-Z]* [0-9][0-9], 20.. [0-9]*:..:.. \(a\|p\)\.m\. GMT.</p>%<!DOCTYPE html PUBLIC "-//gnu.org///DTD\1,on May 1, 2010 1:11:42 p.m. GMT.</p>%' $f
520+ # deprecated-list is randomly ordered, sort it for comparison
521+ case $f in
522+ */deprecated-list.html)
523+ sort -o $f $f
524+ ;;
525+ esac
526+ done
527+ ;;
528+ /usr/share/javadoc/gjdoc.properties |\
529+ /usr/share/javadoc/*/gjdoc.properties)
530+ for f in old/$file new/$file; do
531+ sed -i -e 's|^#[A-Z][a-z]\{2\} [A-Z][a-z]\{2\} [0-9]\{2\} ..:..:.. GMT 20..$|#Fri Jan 01 11:27:36 GMT 2009|' $f
532+ done
533+ ;;
534+ */fonts.scale|*/fonts.dir|*/encodings.dir)
535+ for f in old/$file new/$file; do
536+ # sort files before comparing
537+ sort -o $f $f
538+ done
539+ ;;
540+ /var/adm/perl-modules/*)
541+ for f in old/$file new/$file; do
542+ sed -i -e 's|^=head2 ... ... .. ..:..:.. ....: C<Module>|=head2 Wed Jul 1 00:00:00 2009: C<Module>|' $f
543+ done
544+ ;;
545+ /usr/share/man/man3/*3pm)
546+ for f in old/$file new/$file; do
547+ sed -i -e 's| 3 "20..-..-.." "perl v5....." "User Contributed Perl Documentation"$| 3 "2009-01-01" "perl v5.10.0" "User Contributed Perl Documentation"|' $f
548+ trim_man_TH $f
549+ trim_man_first_line $f
550+ done
551+ ;;
552+ /usr/share/man/*/man*|/usr/share/man/man*|/usr/lib/texmf/doc/man/*/*)
553+
554+ for f in old/$file new/$file; do
555+ trim_man_TH $f
556+ trim_man_first_line $f
557+ # generated by docbook xml:
558+ #.\" Date: 09/13/2010
559+ sed -i -e 's|Date: [0-1][0-9]/[0-9][0-9]/201[0-9]|Date: 09/13/2010|' $f
560+ done
561+ ;;
562+ *.elc)
563+ # emacs lisp files
564+ for f in old/$file new/$file; do
565+ sed -i -e 's|Compiled by abuild@.* on ... ... .. ..:..:.. 20..$|compiled by abuild@buildhost on Wed Jul 01 00:00:00 2009|' $f
566+ done
567+ ;;
568+ /var/lib/texmf/web2c/*/*fmt |\
569+ /var/lib/texmf/web2c/metafont/*.base|\
570+ /var/lib/texmf/web2c/metapost/*.mem)
571+ # binary dump of TeX and Metafont formats, we can ignore them for good
572+ echo "difference in $file ignored."
573+ return 0
574+ ;;
575+ */libtool)
576+ for f in old/$file new/$file; do
577+ sed -i -e 's|^# Libtool was configured on host [A-Za-z0-9]*:$|# Libtool was configured on host x42:|' $f
578+ done
579+ ;;
580+ /etc/mail/*cf|/etc/sendmail.cf)
581+ # from sendmail package
582+ for f in old/$file new/$file; do
583+ # - ##### built by abuild@build33 on Thu May 6 11:21:17 UTC 2010
584+ 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
585+ done
586+ ;;
587+ /usr/share/doc/kde/HTML/*/*/index.cache|/usr/share/doc/kde/HTML/*/*/*/index.cache|\
588+ /usr/share/gtk-doc/html/*/*.html|/usr/share/gtk-doc/html/*/*.devhelp2)
589+ # various kde and gtk packages
590+ strip_numbered_anchors
591+ ;;
592+ */created.rid)
593+ # ruby documentation
594+ # file just contains a timestamp and nothing else, so ignore it
595+ echo "Ignore $file"
596+ return 0
597+ ;;
598+ */rdoc/files/*.html)
599+ # ruby documentation
600+ # <td>Mon Sep 20 19:02:43 +0000 2010</td>
601+ for f in old/$file new/$file; do
602+ 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>Mon Sep 20 19:02:43 +0000 2010</td>%g' $f
603+ done
604+ strip_numbered_anchors
605+ ;;
606+ */Linux*Env.Set.sh)
607+ # LibreOffice files, contains:
608+ # Generated on: Mon Apr 18 13:19:22 UTC 2011
609+ for f in old/$file new/$file; do
610+ sed -i -e 's%^# Generated on:.*UTC 201[0-9] *$%# Generated on: Sometime%g' $f
611+ done
612+ ;;
613+ /usr/lib/libreoffice/solver/inc/*/deliver.log)
614+ # LibreOffice log file
615+ echo "Ignore $file"
616+ return 0
617+ ;;
618+ /var/adm/update-messages/*|/var/adm/update-scripts/*)
619+ # encode version-release inside
620+ oldfn=`echo "$file"|sed -e s/-$release2/-$release1/;`
621+
622+ # fetchmsttfonts embeds the release number in the update shell script.
623+ echo sed -i -e "s/-$release1/-$release2/g;" "old/$oldfn"
624+ sed -i -e "s/-$release1/-$release2/g;" "old/$oldfn"
625+
626+ if ! diff -u old/$oldfn new/$file; then
627+ echo "$oldfn is not same as $file"
628+ return 1
629+ fi
630+ echo "$file and $oldfn are same"
631+ return 0
632+ ;;
633+ *.ps)
634+ for f in "old/$file" "new/$file"; do
635+ sed -i -e '
636+ /^%%CreationDate:[[:blank:]]/d
637+ /^%%Creator:[[:blank:]]groff[[:blank:]]version[[:blank:]]/d
638+ /^%DVIPSSource:[[:blank:]]/d
639+ ' "$f"
640+ done
641+ ;;
642+ *pdf)
643+ # PDF files contain a unique ID, remove it
644+ # Format of the ID is:
645+ # /ID [<9ACE247A70CF9BEAFEE15E116259BD6D> <9ACE247A70CF9BEAFEE15E116259BD6D>]
646+ # with optional spaces. pdftex creates also:
647+ # /CreationDate (D:20120103083206Z)
648+ # /ModDate (D:20120103083206Z)
649+ # and possibly XML metadata as well
650+ for f in "old/$file" "new/$file"; do
651+ sed -i \
652+ '/obj/,/endobj/{
653+ s%/ID \?\[ \?<[^>]\+> \?<[^>]\+> \?\]%/IDrandom%g;
654+ s%/CreationDate \?(D:[^)]*)%/CreationDate (D: XXX)%g;
655+ s%/ModDate \?(D:[^)]*)%/ModDate (D: XXX)%g;
656+ s%<pdf:CreationDate>[^<]*</pdf:CreationDate>%<pdf:CreationDate>XXX</pdf:CreationDate>%g;
657+ s%<pdf:ModDate>[^<]*</pdf:ModDate>%<pdf:ModDate>XXX</pdf:ModDate>%g;
658+ s%<xap:CreateDate>[^<]*</xap:CreateDate>%<xap:CreateDate>XXX</xap:CreateDate>%g;
659+ s%<xap:ModifyDate>[^<]*</xap:ModifyDate>%<xap:ModifyDate>XXX</xap:ModifyDate>%g;
660+ s%<xap:MetadataDate>[^<]*</xap:MetadataDate>%<xap:MetadataDate>XXX</xap:MetadataDate>%g;
661+ }' "$f"
662+ done
663+ ;;
664+ esac
665+
666+ ftype=`/usr/bin/file old/$file | sed 's@^[^:]\+:[[:blank:]]*@@'`
667+ case $ftype in
668+ PE32\ executable*Mono\/\.Net\ assembly*)
669+ echo "PE32 Mono/.Net assembly: $file"
670+ if [ -x /usr/bin/monodis ] ; then
671+ monodis old/$file 2>/dev/null|sed -e 's/GUID = {.*}/GUID = { 42 }/;'> ${file1}
672+ monodis new/$file 2>/dev/null|sed -e 's/GUID = {.*}/GUID = { 42 }/;'> ${file2}
673+ if ! cmp -s ${file1} ${file2}; then
674+ echo "$file differs ($ftype)"
675+ diff -u ${file1} ${file2}
676+ return 1
677+ fi
678+ else
679+ echo "Cannot compare, no monodis installed"
680+ return 1
681+ fi
682+ ;;
683+ ELF*executable*|ELF*[LM]SB\ shared\ object*)
684+ objdump -d --no-show-raw-insn old/$file | filter_disasm > $file1
685+ if ! test -s $file1; then
686+ # objdump has no idea how to handle it
687+ if ! diff_two_files; then
688+ ret=1
689+ break
690+ fi
691+ fi
692+ elfdiff=
693+ sed -i -e "s,old/,," $file1
694+ objdump -d --no-show-raw-insn new/$file | filter_disasm > $file2
695+ sed -i -e "s,new/,," $file2
696+ if ! diff -u $file1 $file2 > $dfile; then
697+ echo "$file differs in assembler output"
698+ head -n 200 $dfile
699+ elfdiff="1"
700+ fi
701+ echo "" >$file1
702+ echo "" >$file2
703+ # Don't compare .build-id and .gnu_debuglink sections
704+ sections="$(objdump -s new/$file | grep "Contents of section .*:" | sed -r "s,.* (.*):,\1,g" | grep -v -e "\.build-id" -e "\.gnu_debuglink" | tr "\n" " ")"
705+ for section in $sections; do
706+ objdump -s -j $section old/$file | sed "s,^old/,," > $file1
707+ objdump -s -j $section new/$file | sed "s,^new/,," > $file2
708+ if ! diff -u $file1 $file2 > $dfile; then
709+ echo "$file differs in ELF section $section"
710+ head -n 200 $dfile
711+ elfdiff="1"
712+ fi
713+ done
714+ if test -z "$elfdiff"; then
715+ echo "$file: only difference was in build-id or gnu_debuglink, GOOD."
716+ return 0
717+ fi
718+ return 1
719+ ;;
720+ *ASCII*|*text*)
721+ if ! cmp -s old/$file new/$file; then
722+ echo "$file differs ($ftype)"
723+ diff -u old/$file new/$file | head -n 200
724+ return 1
725+ fi
726+ ;;
727+ directory|setuid,\ directory|sticky,\ directory)
728+ # tar might package directories - ignore them here
729+ return 0
730+ ;;
731+ bzip2\ compressed\ data*)
732+ if ! check_compressed_file "$file" "bz2"; then
733+ return 1
734+ fi
735+ ;;
736+ gzip\ compressed\ data*)
737+ if ! check_compressed_file "$file" "gzip"; then
738+ return 1
739+ fi
740+ ;;
741+ XZ\ compressed\ data*)
742+ if ! check_compressed_file "$file" "xz"; then
743+ return 1
744+ fi
745+ ;;
746+ POSIX\ tar\ archive)
747+ mv old/$file{,.tar}
748+ mv new/$file{,.tar}
749+ if ! check_single_file ${file}.tar; then
750+ return 1
751+ fi
752+ ;;
753+ cpio\ archive)
754+ mv old/$file{,.cpio}
755+ mv new/$file{,.cpio}
756+ if ! check_single_file ${file}.cpio; then
757+ return 1
758+ fi
759+ ;;
760+ symbolic\ link\ to\ *)
761+ readlink "old/$file" > $file1
762+ readlink "new/$file" > $file2
763+ if ! diff -u $file1 $file2; then
764+ echo "symlink target for $file differs"
765+ return 1
766+ fi
767+ ;;
768+ *)
769+ if ! diff_two_files; then
770+ return 1
771+ fi
772+ ;;
773+ esac
774+ return 0
775+}
776+
777+# We need /proc mounted for some tests, so check that it's mounted and
778+# complain if not.
779+PROC_MOUNTED=0
780+if [ ! -d /proc/self/ ]; then
781+ echo "/proc is not mounted"
782+ mount -orw -n -tproc none /proc
783+ PROC_MOUNTED=1
784+fi
785+
786+# preserve cmp_spec result for check_all runs
787+ret=$RES
788+for file in $files; do
789+ if ! check_single_file $file; then
790+ ret=1
791+ if test -z "$check_all"; then
792+ break
793+ fi
794+ fi
795+done
796+
797+if [ "$PROC_MOUNTED" -eq "1" ]; then
798+ echo "Unmounting proc"
799+ umount /proc
800+fi
801+
802+rm $file1 $file2 $dfile $rename_script
803+rm -rf $dir
804+if test "$ret" = 0; then
805+ echo "Package content is identical"
806+fi
807+exit $ret
808+# vim: tw=666 ts=2 et
809diff --git a/rpm-check.sh b/rpm-check.sh
810deleted file mode 100755
811index dd47642..0000000
812--- a/rpm-check.sh
813+++ /dev/null
814@@ -1,764 +0,0 @@
815-#! /bin/bash
816-#
817-# Copyright (c) 2009, 2010, 2011, 2012 SUSE Linux Product GmbH, Germany.
818-# Licensed under GPL v2, see COPYING file for details.
819-#
820-# Written by Michael Matz and Stephan Coolo
821-# Enhanced by Andreas Jaeger
822-
823-FUNCTIONS=${0%/*}/functions.sh
824-
825-check_all=
826-case $1 in
827- -a | --check-all)
828- check_all=1
829- shift
830-esac
831-
832-if test "$#" != 2; then
833- echo "usage: $0 [-a|--check-all] old.rpm new.rpm"
834- exit 1
835-fi
836-
837-self_script=$(cd $(dirname $0); echo $(pwd)/$(basename $0))
838-
839-source $FUNCTIONS
840-
841-oldpkg=`readlink -f $1`
842-newpkg=`readlink -f $2`
843-rename_script=`mktemp`
844-
845-if test ! -f "$oldpkg"; then
846- echo "can't open $1"
847- exit 1
848-fi
849-
850-if test ! -f "$newpkg"; then
851- echo "can't open $2"
852- exit 1
853-fi
854-
855-#usage unjar <file>
856-function unjar()
857-{
858- local file
859- file=$1
860-
861- if [[ $(type -p fastjar) ]]; then
862- UNJAR=fastjar
863- elif [[ $(type -p jar) ]]; then
864- UNJAR=jar
865- elif [[ $(type -p unzip) ]]; then
866- UNJAR=unzip
867- else
868- echo "ERROR: jar, fastjar, or unzip is not installed (trying file $file)"
869- exit 1
870- fi
871-
872- case $UNJAR in
873- jar|fastjar)
874- # echo jar -xf $file
875- ${UNJAR} -xf $file
876- ;;
877- unzip)
878- unzip -oqq $file
879- ;;
880- esac
881-}
882-
883-# list files in directory
884-#usage unjar_l <file>
885-function unjar_l()
886-{
887- local file
888- file=$1
889-
890- if [[ $(type -p fastjar) ]]; then
891- UNJAR=fastjar
892- elif [[ $(type -p jar) ]]; then
893- UNJAR=jar
894- elif [[ $(type -p unzip) ]]; then
895- UNJAR=unzip
896- else
897- echo "ERROR: jar, fastjar, or unzip is not installed (trying file $file)"
898- exit 1
899- fi
900-
901- case $UNJAR in
902- jar|fastjar)
903- ${UNJAR} -tf $file
904- ;;
905- unzip)
906- unzip -l $file
907- ;;
908- esac
909-}
910-
911-filter_disasm()
912-{
913- 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>/'
914-}
915-
916-echo "Comparing `basename $oldpkg` to `basename $newpkg`"
917-
918-case $oldpkg in
919- *.rpm)
920- cmp_spec $rename_script $oldpkg $newpkg
921- RES=$?
922- case $RES in
923- 0)
924- echo "RPM meta information is identical"
925- if test -z "$check_all"; then
926- exit 0
927- fi
928- ;;
929- 1)
930- echo "RPM meta information is different"
931- if test -z "$check_all"; then
932- exit 1
933- fi
934- ;;
935- 2)
936- echo "RPM file checksum differs."
937- RES=0
938- ;;
939- *)
940- echo "Wrong exit code!"
941- exit 1
942- ;;
943- esac
944- ;;
945-esac
946-
947-file1=`mktemp`
948-file2=`mktemp`
949-
950-dir=`mktemp -d`
951-echo "Extracting packages"
952-unpackage $oldpkg $dir/old
953-unpackage $newpkg $dir/new
954-
955-# files is set in cmp_spec for rpms, so if RES is empty we should assume
956-# it wasn't an rpm and pick all files for comparison.
957-if [ -z $RES ]; then
958- oldfiles=`cd $dir/old; find . -type f`
959- newfiles=`cd $dir/new; find . -type f`
960-
961- files=`echo -e "$oldfiles\n$newfiles" | sort -u`
962-fi
963-
964-cd $dir
965-bash $rename_script
966-
967-dfile=`mktemp`
968-
969-diff_two_files()
970-{
971- if ! cmp -s old/$file new/$file; then
972- echo "$file differs ($ftype)"
973- hexdump -C old/$file > $file1
974- hexdump -C new/$file > $file2
975- diff -u $file1 $file2 | head -n 200
976- return 1
977- fi
978- return 0
979-}
980-
981-trim_man_first_line()
982-{
983- # Handles the first line if it is like:
984- #.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28)
985- #.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.43.3.
986- local f=$1
987- sed -i -e '1{
988- s|^\.\\"[[:blank:]]\+Automatically[[:blank:]]generated[[:blank:]]by[[:blank:]]Pod::Man[[:blank:]].*|.\\" Overly verbose Pod::Man|
989- 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|
990- }' $f
991-}
992-
993-trim_man_TH()
994-{
995- # Handles lines like:
996- # .TH debhelper 7 "2010-02-27" "7.4.15" "Debhelper"
997- # .TH DIRMNGR-CLIENT 1 2010-02-27 "Dirmngr 1.0.3" "GNU Privacy Guard"
998- # .TH ccmake 1 "March 06, 2010" "ccmake 2.8.1-rc3"
999- # .TH QEMU-IMG 1 "2010-03-14" " " " "
1000- # .TH kdecmake 1 "May 07, 2010" "cmake 2.8.1"
1001- # .TH "appender.h" 3 "12 May 2010" "Version 1.2.1" "log4c" \" -*- nroff -*-
1002- # .TH "appender.h" 3 "Tue Aug 31 2010" "Version 1.2.1" "log4c" \" -*- nroff -*-
1003- # .TH "OFFLINEIMAP" "1" "11 May 2010" "John Goerzen" "OfflineIMAP Manual"
1004- # .TH gv 3guile "13 May 2010"
1005- #.TH "GIT\-ARCHIMPORT" "1" "09/13/2010" "Git 1\&.7\&.1" "Git Manual"
1006- # .TH LDIRECTORD 8 "2010-10-20" "perl v5.12.2" "User Contributed Perl Documentation"
1007- # .TH ccmake 1 "February 05, 2012" "ccmake 2.8.7"
1008- # .TH "appender.h" 3 "Tue Aug 31 2010" "Version 1.2.1" "log4c" \" -*- nroff -*-
1009- # .TH ARCH "1" "September 2010" "GNU coreutils 8.5" "User Commands"
1010- # .TH "GCM-CALIBRATE" "1" "03 February 2012" "" ""
1011- #.TH Locale::Po4a::Xml.pm 3pm "2015-01-30" "Po4a Tools" "Po4a Tools"
1012- local f=$1
1013- # (.TH quoted section) (quoted_date)(*)
1014- sed -i -e 's|^\([[:blank:]]*\.TH[[:blank:]]\+"[^"]\+"[[:blank:]]\+[^[:blank:]]\+\)[[:blank:]]\+\("[^"]\+"\)\([[:blank:]]\+.*\)\?|\1 "qq2000-01-01"\3|' $f
1015- # (.TH unquoted section) (quoted_date)(*)
1016- sed -i -e 's|^\([[:blank:]]*\.TH[[:blank:]]\+[^"][^[:blank:]]\+[[:blank:]]\+[^[:blank:]]\+\)[[:blank:]]\+\("[^"]\+"\)\([[:blank:]]\+.*\)\?|\1 "uq2000-02-02"\3|' $f
1017- # (.TH quoted section) (unquoted_date)(*)
1018- sed -i -e 's|^\([[:blank:]]*\.TH[[:blank:]]\+"[^"]\+"[[:blank:]]\+[^[:blank:]]\+\)[[:blank:]]\+\([^"][^[:blank:]]\+\)\([[:blank:]]\+.*\)\?|\1 qu2000-03-03\3|' $f
1019- # (.TH unquoted section) (unquoted_date)(*)
1020- sed -i -e 's|^\([[:blank:]]*\.TH[[:blank:]]\+[^"][^[:blank:]]\+[[:blank:]]\+[^[:blank:]]\+\)[[:blank:]]\+\([^"][^[:blank:]]\+\)\([[:blank:]]\+.*\)\?|\1 uu2000-04-04\3|' $f
1021-}
1022-
1023-strip_numbered_anchors()
1024-{
1025- # Remove numbered anchors on Docbook / HTML files.
1026- # This should be save since we remove them from old and new files.
1027- # A trailing </a> or </div> tag will stay also on both files.
1028- for f in old/$file new/$file; do
1029- sed -i -e 's%<[ ]*a[ ]\+name[^<]*[0-9]\+[^<]*%%g' \
1030- -e 's%<[ ]*a[ ]\+href[^<]*#[^<]*[0-9]\+[^<]*%%g' \
1031- -e 's%<[^<]*id="ftn\.[^<]*[0-9]\+[^<]*%%g' $f
1032- done
1033-}
1034-
1035-
1036-check_compressed_file()
1037-{
1038- local file=$1
1039- local ext=$2
1040- local tmpdir=`mktemp -d`
1041- local ftype
1042- local ret=0
1043- echo "$ext file with odd filename: $file"
1044- if test -n "$tmpdir"; then
1045- mkdir $tmpdir/{old,new}
1046- cp --parents --dereference old/$file $tmpdir/
1047- cp --parents --dereference new/$file $tmpdir/
1048- if pushd $tmpdir > /dev/null ; then
1049- case "$ext" in
1050- bz2)
1051- mv old/$file{,.bz2}
1052- mv new/$file{,.bz2}
1053- bzip2 -d old/$file.bz2
1054- bzip2 -d new/$file.bz2
1055- ;;
1056- gzip)
1057- mv old/$file{,.gz}
1058- mv new/$file{,.gz}
1059- gzip -d old/$file.gz
1060- gzip -d new/$file.gz
1061- ;;
1062- xz)
1063- mv old/$file{,.xz}
1064- mv new/$file{,.xz}
1065- xz -d old/$file.xz
1066- xz -d new/$file.xz
1067- ;;
1068- esac
1069- ftype=`/usr/bin/file old/$file | sed 's@^[^:]\+:[[:blank:]]*@@'`
1070- case $ftype in
1071- POSIX\ tar\ archive)
1072- echo "$ext content is: $ftype"
1073- mv old/$file{,.tar}
1074- mv new/$file{,.tar}
1075- if ! check_single_file ${file}.tar; then
1076- ret=1
1077- fi
1078- ;;
1079- ASCII\ cpio\ archive\ *)
1080- echo "$ext content is: $ftype"
1081- mv old/$file{,.cpio}
1082- mv new/$file{,.cpio}
1083- if ! check_single_file ${file}.cpio; then
1084- ret=1
1085- fi
1086- ;;
1087- *)
1088- echo "unhandled $ext content: $ftype"
1089- if ! diff_two_files; then
1090- ret=1
1091- fi
1092- ;;
1093- esac
1094- popd > /dev/null
1095- fi
1096- rm -rf "$tmpdir"
1097- fi
1098- return $ret
1099-}
1100-
1101-check_single_file()
1102-{
1103- local file="$1"
1104- case $file in
1105- *.spec)
1106- sed -i -e "s,Release:.*$release1,Release: @RELEASE@," old/$file
1107- sed -i -e "s,Release:.*$release2,Release: @RELEASE@," new/$file
1108- ;;
1109- *.exe.mdb|*.dll.mdb)
1110- # Just debug information, we can skip them
1111- echo "$file skipped as debug file."
1112- return 0
1113- ;;
1114- *.a)
1115- flist=`ar t new/$file`
1116- pwd=$PWD
1117- fdir=`dirname $file`
1118- cd old/$fdir
1119- ar x `basename $file`
1120- cd $pwd/new/$fdir
1121- ar x `basename $file`
1122- cd $pwd
1123- for f in $flist; do
1124- if ! check_single_file $fdir/$f; then
1125- return 1
1126- fi
1127- done
1128- return 0
1129- ;;
1130- *.cpio)
1131- flist=`cpio --quiet --list --force-local < "new/$file"`
1132- pwd=$PWD
1133- fdir=$file.extract.$PPID.$$
1134- mkdir old/$fdir new/$fdir
1135- cd old/$fdir
1136- cpio --quiet --extract --force-local < "../${file##*/}"
1137- cd $pwd/new/$fdir
1138- cpio --quiet --extract --force-local < "../${file##*/}"
1139- cd $pwd
1140- local ret=0
1141- for f in $flist; do
1142- if ! check_single_file $fdir/$f; then
1143- ret=1
1144- if test -z "$check_all"; then
1145- break
1146- fi
1147- fi
1148- done
1149- rm -rf old/$fdir new/$fdir
1150- return $ret
1151- ;;
1152- *.tar|*.tar.bz2|*.tar.gz|*.tgz|*.tbz2)
1153- flist=`tar tf new/$file`
1154- pwd=$PWD
1155- fdir=`dirname $file`
1156- cd old/$fdir
1157- tar xf `basename $file`
1158- cd $pwd/new/$fdir
1159- tar xf `basename $file`
1160- cd $pwd
1161- local ret=0
1162- for f in $flist; do
1163- if ! check_single_file $fdir/$f; then
1164- ret=1
1165- if test -z "$check_all"; then
1166- break
1167- fi
1168- fi
1169- done
1170- return $ret
1171- ;;
1172- *.zip|*.jar|*.war)
1173- cd old
1174- unjar_l ./$file |sort > flist
1175- # 10-05-2010 14:39
1176- sed -i -e "s, [0-9][0-9]-[0-9][0-9]-[0-9]\+ [0-9][0-9]:[0-9][0-9] , date ," flist
1177- # 2012-02-03 07:59
1178- 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
1179- cd ../new
1180- unjar_l ./$file |sort> flist
1181- sed -i -e "s, [0-9][0-9]-[0-9][0-9]-[0-9]\+ [0-9][0-9]:[0-9][0-9] , date ,; " flist
1182- 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
1183- cd ..
1184- if ! cmp -s old/flist new/flist; then
1185- echo "$file has different file list"
1186- diff -u old/flist new/flist
1187- return 1
1188- fi
1189- flist=`grep date new/flist | sed -e 's,.* date ,,'`
1190- pwd=$PWD
1191- fdir=`dirname $file`
1192- cd old/$fdir
1193- unjar `basename $file`
1194- cd $pwd/new/$fdir
1195- unjar `basename $file`
1196- cd $pwd
1197- local ret=0
1198- for f in $flist; do
1199- if test -f new/$fdir/$f && ! check_single_file $fdir/$f; then
1200- ret=1
1201- if test -z "$check_all"; then
1202- break
1203- fi
1204- fi
1205- done
1206- return $ret;;
1207- *.pyc|*.pyo)
1208- perl -e "open fh, '+<', 'old/$file'; seek fh, 4, SEEK_SET; print fh '0000';"
1209- perl -e "open fh, '+<', 'new/$file'; seek fh, 4, SEEK_SET; print fh '0000';"
1210- ;;
1211- *.bz2)
1212- bunzip2 -c old/$file > old/${file/.bz2/}
1213- bunzip2 -c new/$file > new/${file/.bz2/}
1214- check_single_file ${file/.bz2/}
1215- return $?
1216- ;;
1217- *.gz)
1218- gunzip -c old/$file > old/${file/.gz/}
1219- gunzip -c new/$file > new/${file/.gz/}
1220- check_single_file ${file/.gz/}
1221- return $?
1222- ;;
1223- *.rpm)
1224- $self_script -a old/$file new/$file
1225- return $?
1226- ;;
1227- *png)
1228- # Try to remove timestamps, only if convert from ImageMagick is installed
1229- if [[ $(type -p convert) ]]; then
1230- convert old/$file +set date:create +set date:modify old/${file/.png/_n.png}
1231- convert old/$file +set date:create +set date:modify new/${file/.png/_n.png}
1232- if ! cmp -s old/${file/.png/_n.png} new/${file/.png/_n.png}; then
1233- echo "$file differs ($ftype)"
1234- hexdump -C old/${file/.png/_n.png} > $file1
1235- hexdump -C new/${file/.png/_n.png} > $file2
1236- diff -u $file1 $file2 | head -n 20
1237- return 1
1238- fi
1239- return 0
1240- fi
1241- ;;
1242- /usr/share/locale/*/LC_MESSAGES/*.mo|/usr/share/locale-bundle/*/LC_MESSAGES/*.mo)
1243- for f in old/$file new/$file; do
1244- sed -i -e "s,POT-Creation-Date: ....-..-.. ..:..+....,POT-Creation-Date: 1970-01-01 00:00+0000," $f
1245- done
1246- ;;
1247- /usr/share/doc/packages/*/*.html|\
1248- /usr/share/doc/kde/HTML/*/*/*.html|/usr/share/doc/*/html/*.html)
1249- for f in old/$file new/$file; do
1250- # texi2html output, e.g. in kvm, indent, qemu
1251- sed -i -e "s|^<!-- Created on .*, 20.. by texi2html .\...|<!-- Created on August 7, 2009 by texi2html 1.82|" $f
1252- sed -i -e 's|^ *This document was generated by <em>Autobuild</em> on <em>.*, 20..</em> using <a href="http://www.nongnu.org/texi2html/"><em>texi2html .\...</em></a>.$| This document was generated by <em>Autobuild</em> on <em>August 7, 2009</em> using <a href="http://www.nongnu.org/texi2html/"><em>texi2html 1.82</em></a>.|' $f
1253- # doxygen docu, e.g. in libssh and log4c
1254- sed -i -e 's|Generated on ... ... [0-9]* [0-9]*:[0-9][0-9]:[0-9][0-9] 20[0-9][0-9] for |Generated on Mon May 10 20:45:00 2010 for |' $f
1255- # Generated on Sat Aug 14 2010 16:49:48 for libssh
1256- sed -i -e 's|Generated on ... ... [0-9]* 20[0-9][0-9] [0-9]*:[0-9][0-9]:[0-9][0-9] for |Generated on Mon May 10 20:45:00 2010 for |' $f
1257- done
1258- strip_numbered_anchors
1259- ;;
1260- /usr/share/javadoc/*.html |\
1261- /usr/share/javadoc/*/*.html|/usr/share/javadoc/*/*/*.html)
1262- strip_numbered_anchors
1263- # There are more timestamps in html, so far we handle only some primitive versions.
1264- for f in old/$file new/$file; do
1265- # Javadoc:
1266- # <head>
1267- # <!-- Generated by javadoc (version 1.7.0_75) on Tue Feb 03 02:20:12 GMT 2015 -->
1268- # <!-- Generated by javadoc on Tue Feb 03 00:02:48 GMT 2015 -->
1269- # <meta name="date" content="2015-02-03">
1270- # </head>
1271- sed -i -e '
1272- /^<head>/{
1273- : next
1274- n
1275- /^<\/head>/{
1276- b end_head
1277- }
1278- s/^\(<!-- Generated by javadoc\) \((\(build\|version\) [0-9._]\+) on ... ... .. ..:..:.. \(GMT\|UTC\) ....\) \(-->\)/\1 some-date-removed-by-build-compare \5/
1279- t next
1280- s/^\(<!-- Generated by javadoc\) \(on ... ... .. ..:..:.. \(GMT\|UTC\) ....\) \(-->\)/\1 some-date-removed-by-build-compare \3/
1281- t next
1282- s/^<meta name="date" content="[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}">/<meta name="date" content="some-date-removed-by-build-compare">/
1283- b next
1284- }
1285- : end_head
1286- ' $f
1287- # Gjdoc HtmlDoclet:
1288- sed -i -e 's%Generated by Gjdoc HtmlDoclet [0-9,.]*, part of <a href="http://www.gnu.org/software/classpath/cp-tools/" title="" target="_top">GNU Classpath Tools</a>, on .*, 20.. [0-9]*:..:.. \(a\|p\)\.m\. GMT.%Generated by Gjdoc.%' $f
1289- sed -i -e 's%<!DOCTYPE html PUBLIC "-//gnu.org///DTD XHTML 1.1 plus Target 1.0//EN"\(.*\)GNU Classpath Tools</a>, on [A-Z][a-z]* [0-9]*, 20?? [0-9]*:??:?? \(a|p\)\.m\. GMT.</p>%<!DOCTYPE html PUBLIC "-//gnu.org///DTD XHTML 1.1 plus Target 1.0//EN"\1GNU Classpath Tools</a>, on January 1, 2009 0:00:00 a.m. GMT.</p>%' $f
1290- sed -i -e 's%<!DOCTYPE html PUBLIC "-//gnu.org///DTD\(.*GNU Classpath Tools</a>\), on [a-zA-Z]* [0-9][0-9], 20.. [0-9]*:..:.. \(a\|p\)\.m\. GMT.</p>%<!DOCTYPE html PUBLIC "-//gnu.org///DTD\1,on May 1, 2010 1:11:42 p.m. GMT.</p>%' $f
1291- # deprecated-list is randomly ordered, sort it for comparison
1292- case $f in
1293- */deprecated-list.html)
1294- sort -o $f $f
1295- ;;
1296- esac
1297- done
1298- ;;
1299- /usr/share/javadoc/gjdoc.properties |\
1300- /usr/share/javadoc/*/gjdoc.properties)
1301- for f in old/$file new/$file; do
1302- sed -i -e 's|^#[A-Z][a-z]\{2\} [A-Z][a-z]\{2\} [0-9]\{2\} ..:..:.. GMT 20..$|#Fri Jan 01 11:27:36 GMT 2009|' $f
1303- done
1304- ;;
1305- */fonts.scale|*/fonts.dir|*/encodings.dir)
1306- for f in old/$file new/$file; do
1307- # sort files before comparing
1308- sort -o $f $f
1309- done
1310- ;;
1311- /var/adm/perl-modules/*)
1312- for f in old/$file new/$file; do
1313- sed -i -e 's|^=head2 ... ... .. ..:..:.. ....: C<Module>|=head2 Wed Jul 1 00:00:00 2009: C<Module>|' $f
1314- done
1315- ;;
1316- /usr/share/man/man3/*3pm)
1317- for f in old/$file new/$file; do
1318- sed -i -e 's| 3 "20..-..-.." "perl v5....." "User Contributed Perl Documentation"$| 3 "2009-01-01" "perl v5.10.0" "User Contributed Perl Documentation"|' $f
1319- trim_man_TH $f
1320- trim_man_first_line $f
1321- done
1322- ;;
1323- /usr/share/man/*/man*|/usr/share/man/man*|/usr/lib/texmf/doc/man/*/*)
1324-
1325- for f in old/$file new/$file; do
1326- trim_man_TH $f
1327- trim_man_first_line $f
1328- # generated by docbook xml:
1329- #.\" Date: 09/13/2010
1330- sed -i -e 's|Date: [0-1][0-9]/[0-9][0-9]/201[0-9]|Date: 09/13/2010|' $f
1331- done
1332- ;;
1333- *.elc)
1334- # emacs lisp files
1335- for f in old/$file new/$file; do
1336- sed -i -e 's|Compiled by abuild@.* on ... ... .. ..:..:.. 20..$|compiled by abuild@buildhost on Wed Jul 01 00:00:00 2009|' $f
1337- done
1338- ;;
1339- /var/lib/texmf/web2c/*/*fmt |\
1340- /var/lib/texmf/web2c/metafont/*.base|\
1341- /var/lib/texmf/web2c/metapost/*.mem)
1342- # binary dump of TeX and Metafont formats, we can ignore them for good
1343- echo "difference in $file ignored."
1344- return 0
1345- ;;
1346- */libtool)
1347- for f in old/$file new/$file; do
1348- sed -i -e 's|^# Libtool was configured on host [A-Za-z0-9]*:$|# Libtool was configured on host x42:|' $f
1349- done
1350- ;;
1351- /etc/mail/*cf|/etc/sendmail.cf)
1352- # from sendmail package
1353- for f in old/$file new/$file; do
1354- # - ##### built by abuild@build33 on Thu May 6 11:21:17 UTC 2010
1355- 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
1356- done
1357- ;;
1358- /usr/share/doc/kde/HTML/*/*/index.cache|/usr/share/doc/kde/HTML/*/*/*/index.cache|\
1359- /usr/share/gtk-doc/html/*/*.html|/usr/share/gtk-doc/html/*/*.devhelp2)
1360- # various kde and gtk packages
1361- strip_numbered_anchors
1362- ;;
1363- */created.rid)
1364- # ruby documentation
1365- # file just contains a timestamp and nothing else, so ignore it
1366- echo "Ignore $file"
1367- return 0
1368- ;;
1369- */rdoc/files/*.html)
1370- # ruby documentation
1371- # <td>Mon Sep 20 19:02:43 +0000 2010</td>
1372- for f in old/$file new/$file; do
1373- 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>Mon Sep 20 19:02:43 +0000 2010</td>%g' $f
1374- done
1375- strip_numbered_anchors
1376- ;;
1377- */Linux*Env.Set.sh)
1378- # LibreOffice files, contains:
1379- # Generated on: Mon Apr 18 13:19:22 UTC 2011
1380- for f in old/$file new/$file; do
1381- sed -i -e 's%^# Generated on:.*UTC 201[0-9] *$%# Generated on: Sometime%g' $f
1382- done
1383- ;;
1384- /usr/lib/libreoffice/solver/inc/*/deliver.log)
1385- # LibreOffice log file
1386- echo "Ignore $file"
1387- return 0
1388- ;;
1389- /var/adm/update-messages/*|/var/adm/update-scripts/*)
1390- # encode version-release inside
1391- oldfn=`echo "$file"|sed -e s/-$release2/-$release1/;`
1392-
1393- # fetchmsttfonts embeds the release number in the update shell script.
1394- echo sed -i -e "s/-$release1/-$release2/g;" "old/$oldfn"
1395- sed -i -e "s/-$release1/-$release2/g;" "old/$oldfn"
1396-
1397- if ! diff -u old/$oldfn new/$file; then
1398- echo "$oldfn is not same as $file"
1399- return 1
1400- fi
1401- echo "$file and $oldfn are same"
1402- return 0
1403- ;;
1404- *.ps)
1405- for f in "old/$file" "new/$file"; do
1406- sed -i -e '
1407- /^%%CreationDate:[[:blank:]]/d
1408- /^%%Creator:[[:blank:]]groff[[:blank:]]version[[:blank:]]/d
1409- ' "$f"
1410- done
1411- ;;
1412- *pdf)
1413- # PDF files contain a unique ID, remove it
1414- # Format of the ID is:
1415- # /ID [<9ACE247A70CF9BEAFEE15E116259BD6D> <9ACE247A70CF9BEAFEE15E116259BD6D>]
1416- # with optional spaces. pdftex creates also:
1417- # /CreationDate (D:20120103083206Z)
1418- # /ModDate (D:20120103083206Z)
1419- # and possibly XML metadata as well
1420- for f in "old/$file" "new/$file"; do
1421- sed -i \
1422- '/obj/,/endobj/{
1423- s%/ID \?\[ \?<[^>]\+> \?<[^>]\+> \?\]%/IDrandom%g;
1424- s%/CreationDate \?(D:[^)]*)%/CreationDate (D: XXX)%g;
1425- s%/ModDate \?(D:[^)]*)%/ModDate (D: XXX)%g;
1426- s%<pdf:CreationDate>[^<]*</pdf:CreationDate>%<pdf:CreationDate>XXX</pdf:CreationDate>%g;
1427- s%<pdf:ModDate>[^<]*</pdf:ModDate>%<pdf:ModDate>XXX</pdf:ModDate>%g;
1428- s%<xap:CreateDate>[^<]*</xap:CreateDate>%<xap:CreateDate>XXX</xap:CreateDate>%g;
1429- s%<xap:ModifyDate>[^<]*</xap:ModifyDate>%<xap:ModifyDate>XXX</xap:ModifyDate>%g;
1430- s%<xap:MetadataDate>[^<]*</xap:MetadataDate>%<xap:MetadataDate>XXX</xap:MetadataDate>%g;
1431- }' "$f"
1432- done
1433- ;;
1434- esac
1435-
1436- ftype=`/usr/bin/file old/$file | sed 's@^[^:]\+:[[:blank:]]*@@'`
1437- case $ftype in
1438- PE32\ executable*Mono\/\.Net\ assembly*)
1439- echo "PE32 Mono/.Net assembly: $file"
1440- if [ -x /usr/bin/monodis ] ; then
1441- monodis old/$file 2>/dev/null|sed -e 's/GUID = {.*}/GUID = { 42 }/;'> ${file1}
1442- monodis new/$file 2>/dev/null|sed -e 's/GUID = {.*}/GUID = { 42 }/;'> ${file2}
1443- if ! cmp -s ${file1} ${file2}; then
1444- echo "$file differs ($ftype)"
1445- diff -u ${file1} ${file2}
1446- return 1
1447- fi
1448- else
1449- echo "Cannot compare, no monodis installed"
1450- return 1
1451- fi
1452- ;;
1453- ELF*executable*|ELF*[LM]SB\ shared\ object*)
1454- objdump -d --no-show-raw-insn old/$file | filter_disasm > $file1
1455- if ! test -s $file1; then
1456- # objdump has no idea how to handle it
1457- if ! diff_two_files; then
1458- ret=1
1459- break
1460- fi
1461- fi
1462- elfdiff=
1463- sed -i -e "s,old/,," $file1
1464- objdump -d --no-show-raw-insn new/$file | filter_disasm > $file2
1465- sed -i -e "s,new/,," $file2
1466- if ! diff -u $file1 $file2 > $dfile; then
1467- echo "$file differs in assembler output"
1468- head -n 200 $dfile
1469- elfdiff="1"
1470- fi
1471- echo "" >$file1
1472- echo "" >$file2
1473- # Don't compare .build-id and .gnu_debuglink sections
1474- sections="$(objdump -s new/$file | grep "Contents of section .*:" | sed -r "s,.* (.*):,\1,g" | grep -v -e "\.build-id" -e "\.gnu_debuglink" | tr "\n" " ")"
1475- for section in $sections; do
1476- objdump -s -j $section old/$file | sed "s,^old/,," > $file1
1477- objdump -s -j $section new/$file | sed "s,^new/,," > $file2
1478- if ! diff -u $file1 $file2 > $dfile; then
1479- echo "$file differs in ELF section $section"
1480- head -n 200 $dfile
1481- elfdiff="1"
1482- fi
1483- done
1484- if test -z "$elfdiff"; then
1485- echo "$file: only difference was in build-id or gnu_debuglink, GOOD."
1486- return 0
1487- fi
1488- return 1
1489- ;;
1490- *ASCII*|*text*)
1491- if ! cmp -s old/$file new/$file; then
1492- echo "$file differs ($ftype)"
1493- diff -u old/$file new/$file | head -n 200
1494- return 1
1495- fi
1496- ;;
1497- directory|setuid,\ directory|sticky,\ directory)
1498- # tar might package directories - ignore them here
1499- return 0
1500- ;;
1501- bzip2\ compressed\ data*)
1502- if ! check_compressed_file "$file" "bz2"; then
1503- return 1
1504- fi
1505- ;;
1506- gzip\ compressed\ data*)
1507- if ! check_compressed_file "$file" "gzip"; then
1508- return 1
1509- fi
1510- ;;
1511- XZ\ compressed\ data*)
1512- if ! check_compressed_file "$file" "xz"; then
1513- return 1
1514- fi
1515- ;;
1516- POSIX\ tar\ archive)
1517- mv old/$file{,.tar}
1518- mv new/$file{,.tar}
1519- if ! check_single_file ${file}.tar; then
1520- return 1
1521- fi
1522- ;;
1523- cpio\ archive)
1524- mv old/$file{,.cpio}
1525- mv new/$file{,.cpio}
1526- if ! check_single_file ${file}.cpio; then
1527- return 1
1528- fi
1529- ;;
1530- symbolic\ link\ to\ *)
1531- readlink "old/$file" > $file1
1532- readlink "new/$file" > $file2
1533- if ! diff -u $file1 $file2; then
1534- echo "symlink target for $file differs"
1535- return 1
1536- fi
1537- ;;
1538- *)
1539- if ! diff_two_files; then
1540- return 1
1541- fi
1542- ;;
1543- esac
1544- return 0
1545-}
1546-
1547-# We need /proc mounted for some tests, so check that it's mounted and
1548-# complain if not.
1549-PROC_MOUNTED=0
1550-if [ ! -d /proc/self/ ]; then
1551- echo "/proc is not mounted"
1552- mount -orw -n -tproc none /proc
1553- PROC_MOUNTED=1
1554-fi
1555-
1556-# preserve cmp_spec result for check_all runs
1557-ret=$RES
1558-for file in $files; do
1559- if ! check_single_file $file; then
1560- ret=1
1561- if test -z "$check_all"; then
1562- break
1563- fi
1564- fi
1565-done
1566-
1567-if [ "$PROC_MOUNTED" -eq "1" ]; then
1568- echo "Unmounting proc"
1569- umount /proc
1570-fi
1571-
1572-rm $file1 $file2 $dfile $rename_script
1573-rm -rf $dir
1574-if test "$ret" = 0; then
1575- echo "Package content is identical"
1576-fi
1577-exit $ret
1578-# vim: tw=666 ts=2 et
1579diff --git a/same-build-result.sh b/same-build-result.sh
1580index c8907e2..7e9bd4f 100644
1581--- a/same-build-result.sh
1582+++ b/same-build-result.sh
1583@@ -7,11 +7,11 @@
1584 # Enhanced by Andreas Jaeger <aj@suse.de>
1585 #
1586 # The script decides if the new build differes from the former one,
1587-# using rpm-check.sh.
1588+# using pkg-diff.sh.
1589 # The script is called as part of the build process as:
1590 # /usr/lib/build/same-build-result.sh /.build.oldpackages /usr/src/packages/RPMS /usr/src/packages/SRPMS
1591
1592-CMPSCRIPT=${0%/*}/rpm-check.sh
1593+CMPSCRIPT=${0%/*}/pkg-diff.sh
1594 SCMPSCRIPT=${0%/*}/srpm-check.sh
1595
1596 check_all=1
1597--
15981.7.9.5
1599