summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/build-compare/files
diff options
context:
space:
mode:
authorRobert Yang <liezhi.yang@windriver.com>2019-08-30 15:35:30 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-09-06 14:58:09 +0100
commit35c8b87b1ca2d181e9aa77d83541f29ea76481a2 (patch)
tree25ddceda74d15076e3adc9c43adc577aedcc9c30 /meta/recipes-devtools/build-compare/files
parent2cd5daffe06b430b33240a99e5dcfd6eb66c8f45 (diff)
downloadpoky-35c8b87b1ca2d181e9aa77d83541f29ea76481a2.tar.gz
build-compare: 2015.02.10 -> 2019.08.14
* Removed the following patches which are already merged by upstream: 0001-Add-support-for-deb-and-ipk-packaging.patch Rename-rpm-check.sh-to-pkg-diff.sh.patch functions.sh-improve-deb-and-ipk-checking.patch functions.sh-remove-space-at-head.patch functions.sh-run-rpm-once-to-make-it-faster.patch pkg-diff.sh-check-for-fifo-named-pipe.patch pkg-diff.sh-check_single_file-return-at-once-when-sa.patch pkg-diff.sh-remove-space-in-the-end-for-ftype.patch * Rebased Ignore-DWARF-sections.patch This version is very outstanding when compare binary packages, e.g.: PRSERV_HOST = "localhost:0" INHERIT += "packagefeed-stability" PACKAGE_CLASSES = "package_ipk $ bitbake opkg $ find tmp/deploy/ipk >/tmp/ipk_1 Add a "bbnote 'hello'" to autotools.bbclass' autotools_do_configure. * BEFORE the upgrading, the result is: $ diff /tmp/ipk_1 /tmp/ipk_2 -Nur | diffstat ipk_2 | 1570 +++++++++++++++++++++++++++++++++--------------------------------- 1 file changed, 785 insertions(+), 785 deletions(-) * AFTER the upgrading, the result is: $ bitbake opkg $ find tmp/deploy/ipk >/tmp/ipk_2 $ diff /tmp/ipk_1 /tmp/ipk_2 -Nur No output And if we really modifed a recipe such as opkg, then it would show that it is changed. For a full world build AFTER the upgrading: $ diff /tmp/ipk_6 /tmp/ipk_7 -Nur | diffstat ipk_7 | 2090 +++++++++++++++++++++++++++++++++--------------------------------- 1 file changed, 1045 insertions(+), 1045 deletions(-) There are 10968 packages in totall, 1045 ones have been changed, so we can still improve it in the future. (From OE-Core rev: 4c77fdfc0b3b31105a4dfd1a4634f8464b52d933) Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/build-compare/files')
-rw-r--r--meta/recipes-devtools/build-compare/files/0001-Add-support-for-deb-and-ipk-packaging.patch64
-rw-r--r--meta/recipes-devtools/build-compare/files/Ignore-DWARF-sections.patch17
-rw-r--r--meta/recipes-devtools/build-compare/files/Rename-rpm-check.sh-to-pkg-diff.sh.patch1599
-rw-r--r--meta/recipes-devtools/build-compare/files/functions.sh-improve-deb-and-ipk-checking.patch117
-rw-r--r--meta/recipes-devtools/build-compare/files/functions.sh-remove-space-at-head.patch41
-rw-r--r--meta/recipes-devtools/build-compare/files/functions.sh-run-rpm-once-to-make-it-faster.patch361
-rw-r--r--meta/recipes-devtools/build-compare/files/pkg-diff.sh-check-for-fifo-named-pipe.patch35
-rw-r--r--meta/recipes-devtools/build-compare/files/pkg-diff.sh-check_single_file-return-at-once-when-sa.patch37
-rw-r--r--meta/recipes-devtools/build-compare/files/pkg-diff.sh-remove-space-in-the-end-for-ftype.patch32
9 files changed, 7 insertions, 2296 deletions
diff --git a/meta/recipes-devtools/build-compare/files/0001-Add-support-for-deb-and-ipk-packaging.patch b/meta/recipes-devtools/build-compare/files/0001-Add-support-for-deb-and-ipk-packaging.patch
deleted file mode 100644
index 82fd8169ff..0000000000
--- a/meta/recipes-devtools/build-compare/files/0001-Add-support-for-deb-and-ipk-packaging.patch
+++ /dev/null
@@ -1,64 +0,0 @@
1From 02dbc7e3478e409d6f5e3e1c53daddf8838be999 Mon Sep 17 00:00:00 2001
2From: Paul Eggleton <paul.eggleton@linux.intel.com>
3Date: Tue, 1 Sep 2015 12:04:33 +0100
4Subject: [PATCH] Add support for deb and ipk packaging
5
6Upstream-Status: Submitted [https://github.com/openSUSE/build-compare/pull/10]
7
8Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
9---
10 functions.sh | 15 +++++++++++++++
11 pkg-diff.sh | 6 ++++++
12 2 files changed, 21 insertions(+)
13
14diff --git a/functions.sh b/functions.sh
15index 06079df..85c9003 100644
16--- a/functions.sh
17+++ b/functions.sh
18@@ -85,6 +85,13 @@ function unpackage()
19 CPIO_OPTS="--extract --unconditional --preserve-modification-time --make-directories --quiet"
20 rpm2cpio $file | cpio ${CPIO_OPTS}
21 ;;
22+ *.ipk|*.deb)
23+ ar x $file
24+ tar xf control.tar.gz
25+ rm control.tar.gz
26+ tar xf data.tar.gz
27+ rm data.tar.gz
28+ ;;
29 esac
30 popd 1>/dev/null
31 }
32@@ -255,4 +262,12 @@ function cmp_spec ()
33 rm $file1 $file2
34 return $RES
35 }
36+
37+function adjust_controlfile() {
38+ cat $1/control | sed '/^Version: /d' > $1/control.fixed
39+ mv $1/control.fixed $1/control
40+ cat $2/control | sed '/^Version: /d' > $2/control.fixed
41+ mv $2/control.fixed $2/control
42+}
43+
44 # vim: tw=666 ts=2 et
45diff --git a/pkg-diff.sh b/pkg-diff.sh
46index 0f1fa76..3cf10aa 100644
47--- a/pkg-diff.sh
48+++ b/pkg-diff.sh
49@@ -138,6 +138,12 @@ echo "Extracting packages"
50 unpackage $oldpkg $dir/old
51 unpackage $newpkg $dir/new
52
53+case $oldpkg in
54+ *.deb|*.ipk)
55+ adjust_controlfile $dir/old $dir/new
56+ ;;
57+esac
58+
59 # files is set in cmp_spec for rpms, so if RES is empty we should assume
60 # it wasn't an rpm and pick all files for comparison.
61 if [ -z $RES ]; then
62--
632.1.0
64
diff --git a/meta/recipes-devtools/build-compare/files/Ignore-DWARF-sections.patch b/meta/recipes-devtools/build-compare/files/Ignore-DWARF-sections.patch
index 7dda1acbf2..2fb62ae8ce 100644
--- a/meta/recipes-devtools/build-compare/files/Ignore-DWARF-sections.patch
+++ b/meta/recipes-devtools/build-compare/files/Ignore-DWARF-sections.patch
@@ -23,18 +23,15 @@ Signed-off-by: Randy Witt <randy.e.witt@linux.intel.com>
23 1 file changed, 1 insertion(+), 1 deletion(-) 23 1 file changed, 1 insertion(+), 1 deletion(-)
24 24
25diff --git a/pkg-diff.sh b/pkg-diff.sh 25diff --git a/pkg-diff.sh b/pkg-diff.sh
26index 56035c1..0f1fa76 100755 26index 9c2125e..b0d77c8 100755
27--- a/pkg-diff.sh 27--- a/pkg-diff.sh
28+++ b/pkg-diff.sh 28+++ b/pkg-diff.sh
29@@ -658,7 +658,7 @@ check_single_file() 29@@ -851,7 +851,7 @@ check_single_file()
30 echo "" >$file1 30 echo "" >$file1
31 echo "" >$file2 31 echo "" >$file2
32 # Don't compare .build-id and .gnu_debuglink sections 32 # Don't compare .build-id, .gnu_debuglink and .gnu_debugdata 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" " ")" 33- sections="$($OBJDUMP -s new/$file | grep "Contents of section .*:" | sed -r "s,.* (.*):,\1,g" | grep -v -e "\.build-id" -e "\.gnu_debuglink" -e "\.gnu_debugdata" | 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" " ")" 34+ sections="$($OBJDUMP -s new/$file | grep "Contents of section .*:" | sed -r "s,.* (.*):,\1,g" | grep -v -e "\.build-id" -e "\.gnu_debuglink" -e "\.gnu_debugdata" -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 35 for section in $sections; do
36 objdump -s -j $section old/$file | sed "s,^old/,," > $file1 36 $OBJDUMP -s -j $section old/$file | sed "s,^old/,," > $file1
37 objdump -s -j $section new/$file | sed "s,^new/,," > $file2 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
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
diff --git a/meta/recipes-devtools/build-compare/files/functions.sh-improve-deb-and-ipk-checking.patch b/meta/recipes-devtools/build-compare/files/functions.sh-improve-deb-and-ipk-checking.patch
deleted file mode 100644
index 05420f89f7..0000000000
--- a/meta/recipes-devtools/build-compare/files/functions.sh-improve-deb-and-ipk-checking.patch
+++ /dev/null
@@ -1,117 +0,0 @@
1From b4eb7fde10318162bd2d02b9017ef51746752a91 Mon Sep 17 00:00:00 2001
2From: Robert Yang <liezhi.yang@windriver.com>
3Date: Thu, 14 Jul 2016 23:14:21 -0700
4Subject: [PATCH 4/4] functions.sh: improve deb and ipk checking
5
6* The deb and ipk's depends version string is like:
7 Depends: libc6 (>= 2.24)
8 Update trim_release_old and trim_release_new to match the bracket in
9 the end ")".
10
11* The deb's data tarball now is .tar.xz, and ipk's is .tar.gz.
12
13* Update adjust_controlfile() to make ituse trim_release_old and
14 trim_release_new.
15
16Upstream-Status: Submitted [https://github.com/openSUSE/build-compare/pull/10]
17
18Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
19---
20 functions.sh | 45 ++++++++++++++++++++++++++++-----------------
21 1 file changed, 28 insertions(+), 17 deletions(-)
22
23diff --git a/functions.sh b/functions.sh
24index aa572f9..fe493ba 100755
25--- a/functions.sh
26+++ b/functions.sh
27@@ -78,7 +78,7 @@ check_header()
28 function trim_release_old()
29 {
30 sed -e "
31- /\(\/boot\|\/lib\/modules\|\/lib\/firmware\|\/usr\/src\|$version_release_old_regex_l\$\)/{s,$version_release_old_regex_l,@VERSION@-@RELEASE_LONG@,g;s,$version_release_old_regex_s,@VERSION@-@RELEASE_SHORT@,g}
32+ /\(\/boot\|\/lib\/modules\|\/lib\/firmware\|\/usr\/src\|$version_release_old_regex_l\$\|$version_release_old_regex_l)\)/{s,$version_release_old_regex_l,@VERSION@-@RELEASE_LONG@,g;s,$version_release_old_regex_s,@VERSION@-@RELEASE_SHORT@,g}
33 s/\(\/var\/adm\/update-scripts\/\)${name_ver_rel_old_regex_l}\([^[:blank:]]\+\)/\1@NAME_VER_REL@\2/g
34 s/^ *//g
35 "
36@@ -86,7 +86,7 @@ function trim_release_old()
37 function trim_release_new()
38 {
39 sed -e "
40- /\(\/boot\|\/lib\/modules\|\/lib\/firmware\|\/usr\/src\|$version_release_new_regex_l\$\)/{s,$version_release_new_regex_l,@VERSION@-@RELEASE_LONG@,g;s,$version_release_new_regex_s,@VERSION@-@RELEASE_SHORT@,g}
41+ /\(\/boot\|\/lib\/modules\|\/lib\/firmware\|\/usr\/src\|$version_release_new_regex_l\$\|$version_release_new_regex_l)\)/{s,$version_release_new_regex_l,@VERSION@-@RELEASE_LONG@,g;s,$version_release_new_regex_s,@VERSION@-@RELEASE_SHORT@,g}
42 s/\(\/var\/adm\/update-scripts\/\)${name_ver_rel_new_regex_l}\([^[:blank:]]\+\)/\1@NAME_VER_REL@\2/g
43 s/^ *//g
44 "
45@@ -133,8 +133,8 @@ function unpackage()
46 ar x $file
47 tar xf control.tar.gz
48 rm control.tar.gz
49- tar xf data.tar.gz
50- rm data.tar.gz
51+ tar xf data.tar.[xg]z
52+ rm data.tar.[xg]z
53 ;;
54 esac
55 popd 1>/dev/null
56@@ -164,6 +164,22 @@ function get_value()
57 sed -n -e "/^___${1}___/,/^___${1}___/p" $2 | sed -e "/^___${1}___/d"
58 }
59
60+# Set version_release_old_regex_s, version_release_old_regex_l and
61+# name_ver_rel_old_regex_l, also the new ones.
62+function set_regex() {
63+ # Remember to quote the . which is in release
64+ # Short version without B_CN
65+ version_release_old_regex_s=${version_release_old%.*}
66+ version_release_old_regex_s=${version_release_old_regex_s//./\\.}
67+ version_release_new_regex_s=${version_release_new%.*}
68+ version_release_new_regex_s=${version_release_new_regex_s//./\\.}
69+ # Long version with B_CNT
70+ version_release_old_regex_l=${version_release_old//./\\.}
71+ version_release_new_regex_l=${version_release_new//./\\.}
72+ name_ver_rel_old_regex_l=${name_ver_rel_old//./\\.}
73+ name_ver_rel_new_regex_l=${name_ver_rel_new//./\\.}
74+}
75+
76 # Compare just the rpm meta data of two rpms
77 # Returns:
78 # 0 in case of same content
79@@ -194,17 +210,7 @@ function cmp_spec ()
80 version_release_old="$(get_value QF_VER_REL $spec_old)"
81 name_ver_rel_old="$(get_value QF_NAME_VER_REL $spec_old)"
82
83- # Remember to quote the . which is in release
84- # Short version without B_CN
85- version_release_old_regex_s=${version_release_old%.*}
86- version_release_old_regex_s=${version_release_old_regex_s//./\\.}
87- version_release_new_regex_s=${version_release_new%.*}
88- version_release_new_regex_s=${version_release_new_regex_s//./\\.}
89- # Long version with B_CNT
90- version_release_old_regex_l=${version_release_old//./\\.}
91- version_release_new_regex_l=${version_release_new//./\\.}
92- name_ver_rel_old_regex_l=${name_ver_rel_old//./\\.}
93- name_ver_rel_new_regex_l=${name_ver_rel_new//./\\.}
94+ set_regex
95
96 # Check the whole spec file at first, return 0 immediately if the
97 # are the same.
98@@ -285,9 +291,14 @@ function cmp_spec ()
99 }
100
101 function adjust_controlfile() {
102- cat $1/control | sed '/^Version: /d' > $1/control.fixed
103+ version_release_old="`sed -ne 's/^Version: \(.*\)/\1/p' $1/control`"
104+ name_ver_rel_old="`sed -n -e 's/^Package: \(.*\)/\1/p' $1/control`-`sed -n -e 's/^Version: \(.*\)/\1/p' $1/control`"
105+ version_release_new="`sed -ne 's/^Version: \(.*\)/\1/p' $2/control`"
106+ name_ver_rel_new="`sed -n -e 's/^Package: \(.*\)/\1/p' $2/control`-`sed -n -e 's/^Version: \(.*\)/\1/p' $2/control`"
107+ set_regex
108+ cat $1/control | trim_release_old > $1/control.fixed
109 mv $1/control.fixed $1/control
110- cat $2/control | sed '/^Version: /d' > $2/control.fixed
111+ cat $2/control | trim_release_new > $2/control.fixed
112 mv $2/control.fixed $2/control
113 }
114
115--
1162.9.0
117
diff --git a/meta/recipes-devtools/build-compare/files/functions.sh-remove-space-at-head.patch b/meta/recipes-devtools/build-compare/files/functions.sh-remove-space-at-head.patch
deleted file mode 100644
index 02e96bab5a..0000000000
--- a/meta/recipes-devtools/build-compare/files/functions.sh-remove-space-at-head.patch
+++ /dev/null
@@ -1,41 +0,0 @@
1From 402a821e604f280e62c34bf4d40c6d1b4c6c892d Mon Sep 17 00:00:00 2001
2From: Robert Yang <liezhi.yang@windriver.com>
3Date: Mon, 4 Jul 2016 20:11:33 -0700
4Subject: [PATCH] functions.sh: remove space at head
5
6The command like:
7rpm -qp --nodigest --nosignature --qf '<foo> [%{REQUIRENAME}\n]\n'
8 ^^space
9
10The space will be printed, and will impact the check result, so remove it.
11
12Upstream-Status: Submitted [https://github.com/openSUSE/build-compare/pull/9]
13
14Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
15---
16 functions.sh | 2 ++
17 1 file changed, 2 insertions(+)
18
19diff --git a/functions.sh b/functions.sh
20index 85c9003..b1069d2 100644
21--- a/functions.sh
22+++ b/functions.sh
23@@ -26,6 +26,7 @@ function trim_release_old()
24 sed -e "
25 /\(\/boot\|\/lib\/modules\|\/lib\/firmware\|\/usr\/src\|$version_release_old_regex_l\$\)/{s,$version_release_old_regex_l,@VERSION@-@RELEASE_LONG@,g;s,$version_release_old_regex_s,@VERSION@-@RELEASE_SHORT@,g}
26 s/\(\/var\/adm\/update-scripts\/\)${name_ver_rel_old_regex_l}\([^[:blank:]]\+\)/\1@NAME_VER_REL@\2/g
27+ s/^ *//g
28 "
29 }
30 function trim_release_new()
31@@ -33,6 +34,7 @@ function trim_release_new()
32 sed -e "
33 /\(\/boot\|\/lib\/modules\|\/lib\/firmware\|\/usr\/src\|$version_release_new_regex_l\$\)/{s,$version_release_new_regex_l,@VERSION@-@RELEASE_LONG@,g;s,$version_release_new_regex_s,@VERSION@-@RELEASE_SHORT@,g}
34 s/\(\/var\/adm\/update-scripts\/\)${name_ver_rel_new_regex_l}\([^[:blank:]]\+\)/\1@NAME_VER_REL@\2/g
35+ s/^ *//g
36 "
37 }
38 # Get single directory or filename with long or short release string
39--
402.9.0
41
diff --git a/meta/recipes-devtools/build-compare/files/functions.sh-run-rpm-once-to-make-it-faster.patch b/meta/recipes-devtools/build-compare/files/functions.sh-run-rpm-once-to-make-it-faster.patch
deleted file mode 100644
index f5b99d9447..0000000000
--- a/meta/recipes-devtools/build-compare/files/functions.sh-run-rpm-once-to-make-it-faster.patch
+++ /dev/null
@@ -1,361 +0,0 @@
1From f34d632c427b1e1570ef9136454fc01d8c9f10a6 Mon Sep 17 00:00:00 2001
2From: Robert Yang <liezhi.yang@windriver.com>
3Date: Thu, 7 Jul 2016 19:34:09 -0700
4Subject: [PATCH] functions.sh: run rpm once to make it faster
5
6The rpm tool is a heavy process, it ran 16 (or 17 for kernel)
7"rpm -qp" times when the pkgs are identical, now we only run
8"rpm -qp --qf <all we need>" twice (one is for old pkg, and one is for
9new), save the results to spec_old and spec_new, then use sed command to
10get what we need later, this can make it 75% faster when the pkgs are
11identical. Here is the rough data on my host Ubuntu 14.04.4, 32 cores
12CPU and 128G mem:
13* When the pkgs are identical:
14 - Before the patch: 1s
15 - After the patch: 0.26s
16 I compare the whole spec firstly, and return 0 if they are the same,
17 or go on checking one by one if not, without this, it would be 0.46s,
18 the gain is great when there are lot of packages, usually, we have
19 more than 10,000 rpms to compare.
20
21* When the pkgs are different:
22 That depends on where is the different, if the different is at the
23 comparing rpmtags stage:
24 - Before the patch: 0.26s
25 - After the patch: 0.29s
26 Increased 0.03s, but if the different is happend later than comparing
27 rpmtags, it will save time.
28
29Upstream-Status: Submitted [https://github.com/openSUSE/build-compare/pull/9]
30
31Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
32---
33 functions.sh | 245 ++++++++++++++++++++++++++++++++---------------------------
34 1 file changed, 132 insertions(+), 113 deletions(-)
35 mode change 100644 => 100755 functions.sh
36
37diff --git a/functions.sh b/functions.sh
38old mode 100644
39new mode 100755
40index b1069d2..aa572f9
41--- a/functions.sh
42+++ b/functions.sh
43@@ -10,9 +10,63 @@
44
45 RPM="rpm -qp --nodigest --nosignature"
46
47-check_header()
48+# Name, Version, Release
49+QF_NAME="%{NAME}"
50+QF_VER_REL="%{VERSION}-%{RELEASE}"
51+QF_NAME_VER_REL="%{NAME}-%{VERSION}-%{RELEASE}"
52+
53+# provides destroy this because at least the self-provide includes the
54+# -buildnumber :-(
55+QF_PROVIDES="[%{PROVIDENAME} %{PROVIDEFLAGS} %{PROVIDEVERSION}\\n]\\n"
56+QF_PROVIDES="$QF_PROVIDES [%{REQUIRENAME} %{REQUIREFLAGS} %{REQUIREVERSION}\\n]\\n"
57+QF_PROVIDES="$QF_PROVIDES [%{CONFLICTNAME} %{CONFLICTFLAGS} %{CONFLICTVERSION}\\n]\\n"
58+QF_PROVIDES="$QF_PROVIDES [%{OBSOLETENAME} %{OBSOLETEFLAGS} %{OBSOLETEVERSION}\\n]\\n"
59+
60+# don't look at RELEASE, it contains our build number
61+QF_TAGS="%{NAME} %{VERSION} %{EPOCH}\\n"
62+QF_TAGS="$QF_TAGS %{SUMMARY}\\n%{DESCRIPTION}\\n"
63+# the DISTURL tag can be used as checkin ID
64+QF_TAGS="$QF_TAGS %{VENDOR} %{DISTRIBUTION} %{DISTURL}"
65+QF_TAGS="$QF_TAGS %{LICENSE} %{LICENSE}\\n"
66+QF_TAGS="$QF_TAGS %{GROUP} %{URL} %{EXCLUDEARCH} %{EXCLUDEOS} %{EXCLUSIVEARCH}\\n"
67+QF_TAGS="$QF_TAGS %{EXCLUSIVEOS} %{RPMVERSION} %{PLATFORM}\\n"
68+QF_TAGS="$QF_TAGS %{PAYLOADFORMAT} %{PAYLOADCOMPRESSOR} %{PAYLOADFLAGS}\\n"
69+
70+# XXX We also need to check the existence (but not the content (!))
71+# of SIGGPG (and perhaps the other SIG*)
72+# XXX We don't look at triggers
73+QF_TAGS="$QF_TAGS [%{VERIFYSCRIPTPROG} %{VERIFYSCRIPT}]\\n"
74+# Only the first ChangeLog entry; should be enough
75+QF_TAGS="$QF_TAGS %{CHANGELOGTIME} %{CHANGELOGNAME} %{CHANGELOGTEXT}\\n"
76+
77+# scripts, might contain release number
78+QF_SCRIPT="[%{PREINPROG} %{PREIN}\\n]\\n[%{POSTINPROG} %{POSTIN}\\n]\\n[%{PREUNPROG} %{PREUN}\\n]\\n[%{POSTUNPROG} %{POSTUN}\\n]\\n"
79+
80+# Now the files. We leave out mtime and size. For normal files
81+# the size will influence the MD5 anyway. For directories the sizes can
82+# differ, depending on which file system the package was built. To not
83+# have to filter out directories we simply ignore all sizes.
84+# Also leave out FILEDEVICES, FILEINODES (depends on the build host),
85+# FILECOLORS, FILECLASS (normally useful but file output contains mtimes),
86+# FILEDEPENDSX and FILEDEPENDSN.
87+# Also FILELANGS (or?)
88+QF_FILELIST="[%{FILENAMES} %{FILEFLAGS} %{FILESTATES} %{FILEMODES:octal} %{FILEUSERNAME} %{FILEGROUPNAME} %{FILERDEVS} %{FILEVERIFYFLAGS} %{FILELINKTOS}\n]\\n"
89+# ??? what to do with FILEPROVIDE and FILEREQUIRE?
90+
91+QF_CHECKSUM="[%{FILENAMES} %{FILEMD5S} %{FILEFLAGS}\n]\\n"
92+
93+QF_ALL="\n___QF_NAME___\n${QF_NAME}\n___QF_NAME___\n"
94+QF_ALL="$QF_ALL\n___QF_TAGS___\n${QF_TAGS}\n___QF_TAGS___\n"
95+QF_ALL="$QF_ALL\n___QF_VER_REL___\n${QF_VER_REL}\n___QF_VER_REL___\n"
96+QF_ALL="$QF_ALL\n___QF_NAME_VER_REL___\n${QF_NAME_VER_REL}\n___QF_NAME_VER_REL___\n"
97+QF_ALL="$QF_ALL\n___QF_PROVIDES___\n${QF_PROVIDES}\n___QF_PROVIDES___\n"
98+QF_ALL="$QF_ALL\n___QF_SCRIPT___\n${QF_SCRIPT}\n___QF_SCRIPT___\n"
99+QF_ALL="$QF_ALL\n___QF_FILELIST___\n${QF_FILELIST}\n___QF_FILELIST___\n"
100+QF_ALL="$QF_ALL\n___QF_CHECKSUM___\n${QF_CHECKSUM}\n___QF_CHECKSUM___\n"
101+
102+check_header()
103 {
104- $RPM --qf "$QF" "$1"
105+ $RPM --qf "$1" "$2"
106 }
107
108 # Trim version-release string:
109@@ -47,18 +101,6 @@ function grep_release_new()
110 grep -E "(/boot|/lib/modules|/lib/firmware|/usr/src)/[^/]+(${version_release_new_regex_l}(\$|[^/]+\$)|${version_release_new_regex_s}(\$|[^/]+\$))"
111 }
112
113-function check_provides()
114-{
115- local pkg=$1
116- # provides destroy this because at least the self-provide includes the
117- # -buildnumber :-(
118- QF="[%{PROVIDENAME} %{PROVIDEFLAGS} %{PROVIDEVERSION}\\n]\\n"
119- QF="$QF [%{REQUIRENAME} %{REQUIREFLAGS} %{REQUIREVERSION}\\n]\\n"
120- QF="$QF [%{CONFLICTNAME} %{CONFLICTFLAGS} %{CONFLICTVERSION}\\n]\\n"
121- QF="$QF [%{OBSOLETENAME} %{OBSOLETEFLAGS} %{OBSOLETEVERSION}\\n]\\n"
122- check_header "$pkg"
123-}
124-
125 #usage unpackage <file> $dir
126 # Unpack files in directory $dir
127 # like /usr/bin/unpackage - just for one file and with no options
128@@ -98,6 +140,30 @@ function unpackage()
129 popd 1>/dev/null
130 }
131
132+# Run diff command on the files
133+# $1: printed info
134+# $2: file1
135+# $3: file2
136+function comp_file()
137+{
138+ echo "comparing $1"
139+ if ! diff -au $2 $3; then
140+ if test -z "$check_all"; then
141+ rm $2 $3 $spec_old $spec_new
142+ return 1
143+ fi
144+ fi
145+ return 0
146+}
147+
148+# Get var's value from specfile.
149+# $1: var name
150+# $2: specfile
151+function get_value()
152+{
153+ sed -n -e "/^___${1}___/,/^___${1}___/p" $2 | sed -e "/^___${1}___/d"
154+}
155+
156 # Compare just the rpm meta data of two rpms
157 # Returns:
158 # 0 in case of same content
159@@ -107,56 +173,29 @@ function unpackage()
160 function cmp_spec ()
161 {
162 local RES
163- local file1 file2
164+ local file_old file_new
165 local f
166 local sh=$1
167 local oldrpm=$2
168 local newrpm=$3
169
170- QF="%{NAME}"
171-
172- # don't look at RELEASE, it contains our build number
173- QF="$QF %{VERSION} %{EPOCH}\\n"
174- QF="$QF %{SUMMARY}\\n%{DESCRIPTION}\\n"
175- QF="$QF %{VENDOR} %{DISTRIBUTION} %{DISTURL}"
176- QF="$QF %{LICENSE} %{LICENSE}\\n"
177- QF="$QF %{GROUP} %{URL} %{EXCLUDEARCH} %{EXCLUDEOS} %{EXCLUSIVEARCH}\\n"
178- QF="$QF %{EXCLUSIVEOS} %{RPMVERSION} %{PLATFORM}\\n"
179- QF="$QF %{PAYLOADFORMAT} %{PAYLOADCOMPRESSOR} %{PAYLOADFLAGS}\\n"
180-
181-
182- # XXX We also need to check the existence (but not the content (!))
183- # of SIGGPG (and perhaps the other SIG*)
184-
185- # XXX We don't look at triggers
186-
187- QF="$QF [%{VERIFYSCRIPTPROG} %{VERIFYSCRIPT}]\\n"
188-
189- # Only the first ChangeLog entry; should be enough
190- QF="$QF %{CHANGELOGTIME} %{CHANGELOGNAME} %{CHANGELOGTEXT}\\n"
191-
192- file1=`mktemp`
193- file2=`mktemp`
194-
195- check_header $oldrpm > $file1
196- check_header $newrpm > $file2
197-
198- # the DISTURL tag can be used as checkin ID
199- #echo "$QF"
200- echo "comparing rpmtags"
201- if ! diff -au $file1 $file2; then
202- if test -z "$check_all"; then
203- rm $file1 $file2
204- return 1
205- fi
206- fi
207-
208+ file_old=`mktemp`
209+ file_new=`mktemp`
210+ spec_old=`mktemp`
211+ spec_new=`mktemp`
212+
213+ check_header "$QF_ALL" $oldrpm > $spec_old
214+ check_header "$QF_ALL" $newrpm > $spec_new
215+
216+ name_new="$(get_value QF_NAME $spec_new)"
217+ version_release_new="$(get_value QF_VER_REL $spec_new)"
218+ name_ver_rel_new="$(get_value QF_NAME_VER_REL $spec_new)"
219+
220+ version_release_old="$(get_value QF_VER_REL $spec_old)"
221+ name_ver_rel_old="$(get_value QF_NAME_VER_REL $spec_old)"
222+
223 # Remember to quote the . which is in release
224- version_release_old=$($RPM --qf "%{VERSION}-%{RELEASE}" "$oldrpm")
225- version_release_new=$($RPM --qf "%{VERSION}-%{RELEASE}" "$newrpm")
226- name_ver_rel_old=$($RPM --qf "%{NAME}-%{VERSION}-%{RELEASE}" "$oldrpm")
227- name_ver_rel_new=$($RPM --qf "%{NAME}-%{VERSION}-%{RELEASE}" "$newrpm")
228- # Short version without B_CNT
229+ # Short version without B_CN
230 version_release_old_regex_s=${version_release_old%.*}
231 version_release_old_regex_s=${version_release_old_regex_s//./\\.}
232 version_release_new_regex_s=${version_release_new%.*}
233@@ -166,10 +205,27 @@ function cmp_spec ()
234 version_release_new_regex_l=${version_release_new//./\\.}
235 name_ver_rel_old_regex_l=${name_ver_rel_old//./\\.}
236 name_ver_rel_new_regex_l=${name_ver_rel_new//./\\.}
237+
238+ # Check the whole spec file at first, return 0 immediately if the
239+ # are the same.
240+ cat $spec_old | trim_release_old > $file_old
241+ cat $spec_new | trim_release_new > $file_new
242+ echo "comparing the whole specfile"
243+ if diff -au $spec_old $spec_new; then
244+ if test -z "$check_all"; then
245+ rm $file_old $file_new $spec_old $spec_new
246+ return 0
247+ fi
248+ fi
249+
250+ get_value QF_TAGS $spec_old > $file_old
251+ get_value QF_TAGS $spec_new > $file_new
252+ comp_file rpmtags $file_old $file_new || return 1
253+
254 # This might happen when?!
255 echo "comparing RELEASE"
256 if [ "${version_release_old%.*}" != "${version_release_new%.*}" ] ; then
257- case $($RPM --qf '%{NAME}' "$newrpm") in
258+ case $name_new in
259 kernel-*)
260 # Make sure all kernel packages have the same %RELEASE
261 echo "release prefix mismatch"
262@@ -181,71 +237,34 @@ function cmp_spec ()
263 *) ;;
264 esac
265 fi
266-
267- check_provides $oldrpm | trim_release_old | sort > $file1
268- check_provides $newrpm | trim_release_new | sort > $file2
269-
270- echo "comparing PROVIDES"
271- if ! diff -au $file1 $file2; then
272- if test -z "$check_all"; then
273- rm $file1 $file2
274- return 1
275- fi
276- fi
277
278- # scripts, might contain release number
279- QF="[%{PREINPROG} %{PREIN}\\n]\\n[%{POSTINPROG} %{POSTIN}\\n]\\n[%{PREUNPROG} %{PREUN}\\n]\\n[%{POSTUNPROG} %{POSTUN}\\n]\\n"
280- check_header $oldrpm | trim_release_old > $file1
281- check_header $newrpm | trim_release_new > $file2
282+ get_value QF_PROVIDES $spec_old | trim_release_old | sort > $file_old
283+ get_value QF_PROVIDES $spec_new | trim_release_new | sort > $file_new
284+ comp_file PROVIDES $file_old $file_new || return 1
285+
286+ get_value QF_SCRIPT $spec_old | trim_release_old > $file_old
287+ get_value QF_SCRIPT $spec_new | trim_release_new > $file_new
288+ comp_file scripts $file_old $file_new || return 1
289
290- echo "comparing scripts"
291- if ! diff -au $file1 $file2; then
292- if test -z "$check_all"; then
293- rm $file1 $file2
294- return 1
295- fi
296- fi
297-
298 # First check the file attributes and later the md5s
299-
300- # Now the files. We leave out mtime and size. For normal files
301- # the size will influence the MD5 anyway. For directories the sizes can
302- # differ, depending on which file system the package was built. To not
303- # have to filter out directories we simply ignore all sizes.
304- # Also leave out FILEDEVICES, FILEINODES (depends on the build host),
305- # FILECOLORS, FILECLASS (normally useful but file output contains mtimes),
306- # FILEDEPENDSX and FILEDEPENDSN.
307- # Also FILELANGS (or?)
308- QF="[%{FILENAMES} %{FILEFLAGS} %{FILESTATES} %{FILEMODES:octal} %{FILEUSERNAME} %{FILEGROUPNAME} %{FILERDEVS} %{FILEVERIFYFLAGS} %{FILELINKTOS}\n]\\n"
309- # ??? what to do with FILEPROVIDE and FILEREQUIRE?
310-
311- check_header $oldrpm | trim_release_old > $file1
312- check_header $newrpm | trim_release_new > $file2
313-
314- echo "comparing filelist"
315- if ! diff -au $file1 $file2; then
316- if test -z "$check_all"; then
317- rm $file1 $file2
318- return 1
319- fi
320- fi
321-
322+ get_value QF_FILELIST $spec_old | trim_release_old > $file_old
323+ get_value QF_FILELIST $spec_new | trim_release_new > $file_new
324+ comp_file filelist $file_old $file_new || return 1
325+
326 # now the md5sums. if they are different, we check more detailed
327 # if there are different filenames, we will already have aborted before
328 # file flag 64 means "ghost", filter those out.
329- QF="[%{FILENAMES} %{FILEMD5S} %{FILEFLAGS}\n]\\n"
330- check_header $oldrpm |grep -v " 64$"| trim_release_old > $file1
331- check_header $newrpm |grep -v " 64$"| trim_release_new > $file2
332-
333+ get_value QF_CHECKSUM $spec_old | grep -v " 64$" | trim_release_old > $file_old
334+ get_value QF_CHECKSUM $spec_new | grep -v " 64$" | trim_release_new > $file_new
335 RES=2
336 # done if the same
337 echo "comparing file checksum"
338- if cmp -s $file1 $file2; then
339+ if cmp -s $file_old $file_new; then
340 RES=0
341 fi
342-
343+
344 # Get only files with different MD5sums
345- files=`diff -U0 $file1 $file2 | fgrep -v +++ | grep ^+ | cut -b2- | awk '{print $1}'`
346+ files=`diff -U0 $file_old $file_new | fgrep -v +++ | grep ^+ | cut -b2- | awk '{print $1}'`
347
348 if test -f "$sh"; then
349 echo "creating rename script"
350@@ -261,7 +280,7 @@ function cmp_spec ()
351 done >> "${sh}"
352 fi
353 #
354- rm $file1 $file2
355+ rm $file_old $file_new
356 return $RES
357 }
358
359--
3602.9.0
361
diff --git a/meta/recipes-devtools/build-compare/files/pkg-diff.sh-check-for-fifo-named-pipe.patch b/meta/recipes-devtools/build-compare/files/pkg-diff.sh-check-for-fifo-named-pipe.patch
deleted file mode 100644
index e4f0c54163..0000000000
--- a/meta/recipes-devtools/build-compare/files/pkg-diff.sh-check-for-fifo-named-pipe.patch
+++ /dev/null
@@ -1,35 +0,0 @@
1From a78fe4f792a9ac9f4d364e836c8855f48561d6f2 Mon Sep 17 00:00:00 2001
2From: Robert Yang <liezhi.yang@windriver.com>
3Date: Thu, 14 Jul 2016 19:52:18 -0700
4Subject: [PATCH 3/4] pkg-diff.sh: check for fifo(named pipe)
5
6Otherwise "cmp -s fifo1 fifo2" will wait for inputing forever.
7
8Upstream-Status: Submitted [https://github.com/openSUSE/build-compare/pull/10]
9
10Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
11---
12 pkg-diff.sh | 7 +++++++
13 1 file changed, 7 insertions(+)
14
15diff --git a/pkg-diff.sh b/pkg-diff.sh
16index 5dd3a38..1f353aa 100644
17--- a/pkg-diff.sh
18+++ b/pkg-diff.sh
19@@ -735,6 +735,13 @@ check_single_file()
20 return 1
21 fi
22 ;;
23+ fifo*pipe*)
24+ ftype_new="`/usr/bin/file new/$file | sed -e 's@^[^:]\+:[[:blank:]]*@@' -e 's@[[:blank:]]*$@@'`"
25+ if [ "$ftype_new" = "$ftype" ]; then
26+ return 0
27+ fi
28+ return 1
29+ ;;
30 *)
31 if ! diff_two_files; then
32 return 1
33--
342.9.0
35
diff --git a/meta/recipes-devtools/build-compare/files/pkg-diff.sh-check_single_file-return-at-once-when-sa.patch b/meta/recipes-devtools/build-compare/files/pkg-diff.sh-check_single_file-return-at-once-when-sa.patch
deleted file mode 100644
index b42af2531d..0000000000
--- a/meta/recipes-devtools/build-compare/files/pkg-diff.sh-check_single_file-return-at-once-when-sa.patch
+++ /dev/null
@@ -1,37 +0,0 @@
1From 657983ef9ca8f8354172682e17408c4f6b5bc667 Mon Sep 17 00:00:00 2001
2From: Robert Yang <liezhi.yang@windriver.com>
3Date: Thu, 14 Jul 2016 19:46:08 -0700
4Subject: [PATCH 1/4] pkg-diff.sh: check_single_file(): return at once when
5 same
6
7If the two files are the same, return at once, this can save a lot of
8time when there are archives inside archives.
9
10Upstream-Status: Submitted [https://github.com/openSUSE/build-compare/pull/10]
11
12Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
13---
14 pkg-diff.sh | 7 +++++++
15 1 file changed, 7 insertions(+)
16
17diff --git a/pkg-diff.sh b/pkg-diff.sh
18index 3cf10aa..402d4a4 100644
19--- a/pkg-diff.sh
20+++ b/pkg-diff.sh
21@@ -293,6 +293,13 @@ check_compressed_file()
22 check_single_file()
23 {
24 local file="$1"
25+
26+ # If the two files are the same, return at once.
27+ if [ -f old/$file -a -f new/$file ]; then
28+ if cmp -s old/$file new/$file; then
29+ return 0
30+ fi
31+ fi
32 case $file in
33 *.spec)
34 sed -i -e "s,Release:.*$release1,Release: @RELEASE@," old/$file
35--
362.9.0
37
diff --git a/meta/recipes-devtools/build-compare/files/pkg-diff.sh-remove-space-in-the-end-for-ftype.patch b/meta/recipes-devtools/build-compare/files/pkg-diff.sh-remove-space-in-the-end-for-ftype.patch
deleted file mode 100644
index 8077172333..0000000000
--- a/meta/recipes-devtools/build-compare/files/pkg-diff.sh-remove-space-in-the-end-for-ftype.patch
+++ /dev/null
@@ -1,32 +0,0 @@
1From 836a6783df9c582a834fca239f227063a5687715 Mon Sep 17 00:00:00 2001
2From: Robert Yang <liezhi.yang@windriver.com>
3Date: Thu, 14 Jul 2016 19:49:12 -0700
4Subject: [PATCH 2/4] pkg-diff.sh: remove space in the end for ftype
5
6Versions of file like 5.14 returns a " " in the end, for example:
7ftype="directory ", but we need ftype="directory", remove the space to
8fix the problem.
9
10Upstream-Status: Submitted [https://github.com/openSUSE/build-compare/pull/10]
11
12Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
13---
14 pkg-diff.sh | 2 +-
15 1 file changed, 1 insertion(+), 1 deletion(-)
16
17diff --git a/pkg-diff.sh b/pkg-diff.sh
18index 402d4a4..5dd3a38 100644
19--- a/pkg-diff.sh
20+++ b/pkg-diff.sh
21@@ -633,7 +633,7 @@ check_single_file()
22 ;;
23 esac
24
25- ftype=`/usr/bin/file old/$file | sed 's@^[^:]\+:[[:blank:]]*@@'`
26+ ftype=`/usr/bin/file old/$file | sed -e 's@^[^:]\+:[[:blank:]]*@@' -e 's@[[:blank:]]*$@@'`
27 case $ftype in
28 PE32\ executable*Mono\/\.Net\ assembly*)
29 echo "PE32 Mono/.Net assembly: $file"
30--
312.9.0
32