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