2009-02-04 04:29:06 +01:00
#! /bin/bash
#
2012-05-07 13:33:30 +02:00
# Copyright (c) 2009, 2010, 2011, 2012 SUSE Linux Product GmbH, Germany.
2009-07-23 16:35:14 +02:00
# Licensed under GPL v2, see COPYING file for details.
2009-02-04 04:29:06 +01:00
#
# Written by Michael Matz and Stephan Coolo
2009-07-23 16:35:14 +02:00
# Enhanced by Andreas Jaeger
2020-01-08 17:55:30 +01:00
declare -i watchdog_host_timeout_seconds = '3600'
2020-01-08 19:55:35 +01:00
declare -i watchdog_touch_percent_prior_timeout = '96'
2020-01-08 17:55:30 +01:00
declare -i watchdog_next_touch_seconds = 0
2009-07-23 16:35:14 +02:00
2020-01-08 17:55:30 +01:00
function watchdog_reset
{
local uptime idle
local -i next_touch now
2009-02-04 04:29:06 +01:00
2020-01-08 17:55:30 +01:00
read uptime idle < /proc/uptime
2016-08-05 15:48:32 +02:00
2020-01-08 17:55:30 +01:00
now = " ${ uptime %.* } "
next_touch = $(( ${ now } + ( ( ${ watchdog_host_timeout_seconds } * ${ watchdog_touch_percent_prior_timeout } ) / 100 ) ))
watchdog_next_touch_seconds = ${ next_touch }
2015-04-28 14:48:08 +02:00
}
2020-01-08 17:55:30 +01:00
function watchdog_touch
{
local uptime idle
local -i next_touch now
2015-02-10 16:54:31 +01:00
2020-01-08 17:55:30 +01:00
read uptime idle < /proc/uptime
2010-09-21 13:12:14 +02:00
2020-01-08 17:55:30 +01:00
now = " ${ uptime %.* } "
if test " ${ now } " -lt " ${ watchdog_next_touch_seconds } "
then
return
fi
echo 'build-compare touching host-watchdog.'
watchdog_reset
}
2009-02-04 04:29:06 +01:00
2020-01-08 17:55:30 +01:00
function wprint
{
echo " $@ "
watchdog_reset
}
2009-02-04 04:29:06 +01:00
2019-02-19 10:32:50 +01:00
function findunjarbin
2009-07-23 16:35:14 +02:00
{
if [ [ $( type -p fastjar) ] ] ; then
UNJAR = fastjar
elif [ [ $( type -p jar) ] ] ; then
UNJAR = jar
elif [ [ $( type -p unzip) ] ] ; then
UNJAR = unzip
else
echo " ERROR: jar, fastjar, or unzip is not installed (trying file $file ) "
exit 1
fi
2019-02-19 10:32:50 +01:00
}
#usage unjar <file>
function unjar( )
{
local file
file = $1
2009-07-23 16:35:14 +02:00
2019-02-19 10:32:50 +01:00
findunjarbin
2009-07-23 16:35:14 +02:00
case $UNJAR in
jar| fastjar)
# echo jar -xf $file
${ UNJAR } -xf $file
; ;
unzip)
unzip -oqq $file
; ;
esac
}
2019-02-19 10:32:50 +01:00
# list files in given jar file
2009-07-23 16:35:14 +02:00
#usage unjar_l <file>
function unjar_l( )
{
local file
file = $1
2019-02-19 10:32:50 +01:00
findunjarbin
2009-07-23 16:35:14 +02:00
case $UNJAR in
jar| fastjar)
${ UNJAR } -tf $file
; ;
unzip)
2019-02-19 10:32:50 +01:00
unzip -Z -1 $file
2009-07-23 16:35:14 +02:00
; ;
esac
}
2009-02-04 04:29:06 +01:00
filter_disasm( )
{
2020-01-08 17:55:30 +01:00
[ [ $nofilter ] ] && return
sed -e '
s/^ *[ 0-9a-f] \+ ://
s/\$ 0x[ 0-9a-f] \+ /$something /
s/callq *[ 0-9a-f] \+ /callq /
s/# *[ 0-9a-f] \+ /# /
s/\( 0x\) \? [ 0-9a-f] \+ ( /offset( /
s/[ 0-9a-f] \+ </</
s/^<\( .*\) >:/\1 :/
s/<\( .*\) +0x[ 0-9a-f] \+ >/<\1 + ofs>/
'
2009-02-04 04:29:06 +01:00
}
2017-07-27 14:10:36 +02:00
filter_xenefi( ) {
# PE32+ executable (EFI application) x86-64 (stripped to external PDB), for MS Windows
perl -e " open fh, '+<', ' $f '; seek fh, 0x80 + 0x08, SEEK_SET; print fh 'time'; seek fh, 0x80 + 0x58, SEEK_SET; print fh 'chck'; "
}
filter_pyc( ) {
perl -e " open fh, '+<', ' $f '; seek fh, 4, SEEK_SET; print fh '0000'; "
}
filter_dvi( ) {
# Opcodes 247: pre; i[1], num[4], den[4], mag[4], k[1], x[k]
perl -e "
my \$ rec;
open fh, '+<' , '$f' ;
my \$ dummy = read fh, \$ rec, 15;
( \$ pre, \$ i, \$ num, \$ den, \$ mag, \$ k) = unpack( 'C2 N3 C' , \$ rec) ;
seek fh, 15, SEEK_SET;
while ( \$ k > 0) {
print fh '0' ;
\$ k--;
}
"
}
filter_png( ) {
convert " $f " +set date:create +set date:modify " ${ f } . $PPID . $$ "
mv -f " ${ f } . $PPID . $$ " " ${ f } "
}
filter_emacs_lisp( ) {
sed -i -e '
s| ^; ; ; .ompiled by abuild@.* on ... ... .. ..:..:.. ....| ; ; ; compiled by abuild@buildhost on Wed Jul 01 00:00:00 2009|
s| ^; ; ; from file .*\. el| ; ; ; from file /home/abuild/rpmbuild/BUILD/anthy-9100h/src-util/elc.8411/anthy-azik.el|
s| ^; ; ; emacs version .*| ; ; ; emacs version 21.5 ( beta34) "kale" XEmacs Lucid.|
s| ^; ; ; bytecomp version .*| ; ; ; bytecomp version 2.28 XEmacs; 2009-08-09.|
' " $f "
}
filter_pdf( ) {
# PDF files contain a unique ID, remove it
# Format of the ID is:
# /ID [<9ACE247A70CF9BEAFEE15E116259BD6D> <9ACE247A70CF9BEAFEE15E116259BD6D>]
# with optional spaces. pdftex creates also:
# /CreationDate (D:20120103083206Z)
# /ModDate (D:20120103083206Z)
# and possibly XML metadata as well
sed -i \
' /obj/,/endobj/{
s%/ID \? \[ \? <[ ^>] \+ > \? <[ ^>] \+ > \? \] %/IDrandom%g;
s%/CreationDate \? ( D:[ ^) ] *) %/CreationDate ( D: XXX) %g;
s%/ModDate \? ( D:[ ^) ] *) %/ModDate ( D: XXX) %g;
s%<pdf:CreationDate>[ ^<] *</pdf:CreationDate>%<pdf:CreationDate>XXX</pdf:CreationDate>%g;
s%<pdf:ModDate>[ ^<] *</pdf:ModDate>%<pdf:ModDate>XXX</pdf:ModDate>%g;
s%<xap:CreateDate>[ ^<] *</xap:CreateDate>%<xap:CreateDate>XXX</xap:CreateDate>%g;
s%<xap:ModifyDate>[ ^<] *</xap:ModifyDate>%<xap:ModifyDate>XXX</xap:ModifyDate>%g;
s%<xap:MetadataDate>[ ^<] *</xap:MetadataDate>%<xap:MetadataDate>XXX</xap:MetadataDate>%g;
} ' " $f "
}
filter_ps( ) {
sed -i -e '
/^%%CreationDate:[ [ :blank:] ] /d
/^%%Creator:[ [ :blank:] ] groff[ [ :blank:] ] version[ [ :blank:] ] /d
/^%DVIPSSource:[ [ :blank:] ] /d
' " $f "
}
filter_mo( ) {
sed -i -e "s,POT-Creation-Date: ....-..-.. ..:..+....,POT-Creation-Date: 1970-01-01 00:00+0000," " $f "
}
filter_linuxrc_config( ) {
sed -i '/^InitrdID:/s@^.*@InitrdID: something@' " $f "
}
# call specified filter on old and new file
filter_generic( )
{
filtertype = $1
[ [ $nofilter ] ] && return
local f
for f in " old/ $file " " new/ $file " ; do
eval " filter_ $filtertype $f "
done
}
2020-01-08 17:55:30 +01:00
# returns 0 if both files are identical
# returns 1 if files differ or one is missing
# returns 2 if files must be processed further
verify_before_processing( )
2009-05-07 17:38:41 +02:00
{
2020-01-08 17:55:30 +01:00
local file = " $1 "
local cmpout = " $2 "
2018-05-28 15:38:08 +02:00
2019-02-19 10:32:50 +01:00
if test ! -e " old/ $file " ; then
2020-01-08 17:55:30 +01:00
wprint " Missing in old package: $file "
2015-03-20 20:33:05 +01:00
return 1
2009-05-07 17:38:41 +02:00
fi
2019-02-19 10:32:50 +01:00
if test ! -e " new/ $file " ; then
2020-01-08 17:55:30 +01:00
wprint " Missing in new package: $file "
2015-03-20 20:33:05 +01:00
return 1
fi
2020-01-08 17:55:30 +01:00
if cmp -b " old/ $file " " new/ $file " > " ${ cmpout } " ; then
2015-03-20 20:33:05 +01:00
return 0
fi
2020-01-08 17:55:30 +01:00
if test -s " ${ cmpout } " ; then
# cmp produced output for futher processing
return 2
2018-05-28 15:38:08 +02:00
fi
2015-03-20 20:33:05 +01:00
2020-01-08 17:55:30 +01:00
# cmp failed
return 1
}
diff_two_files( )
{
local offset length
verify_before_processing " ${ file } " " ${ dfile } "
case " $? " in
0) return 0 ; ;
1) return 1 ; ;
*) ; ;
esac
2018-05-28 15:38:08 +02:00
offset = ` sed 's@^.*differ: byte @@;s@,.*@@' < $dfile `
2020-01-08 17:55:30 +01:00
wprint " $file differs at offset ' $offset ' ( $ftype ) "
2018-05-28 15:38:08 +02:00
offset = $(( ( $offset >> 6 ) << 6 ))
length = 512
2020-01-08 17:55:30 +01:00
diff -u \
<( hexdump -C -s $offset -n $length " old/ $file " ) \
<( hexdump -C -s $offset -n $length " new/ $file " ) | $buildcompare_head
2015-03-20 20:33:05 +01:00
return 1
2009-05-07 17:38:41 +02:00
}
2009-02-04 04:29:06 +01:00
2015-02-03 14:39:06 +01:00
trim_man_first_line( )
{
# Handles the first line if it is like:
#.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28)
#.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.43.3.
local f = $1
2017-07-27 14:10:36 +02:00
[ [ $nofilter ] ] && return
2015-02-03 14:39:06 +01:00
sed -i -e ' 1{
s| ^\. \\ "[[:blank:]]\+Automatically[[:blank:]]generated[[:blank:]]by[[:blank:]]Pod::Man[[:blank:]].*|.\\" Overly verbose Pod::Man|
s| ^\. \\ "[[:blank:]]\+DO[[:blank:]]NOT[[:blank:]]MODIFY[[:blank:]]THIS[[:blank:]]FILE![[:blank:]]\+It[[:blank:]]was[[:blank:]]generated[[:blank:]]by[[:blank:]]help2man[[:blank:]].*|.\\" Overly verbose help2man|
} ' $f
}
trim_man_TH( )
{
# Handles lines like:
# .TH debhelper 7 "2010-02-27" "7.4.15" "Debhelper"
# .TH DIRMNGR-CLIENT 1 2010-02-27 "Dirmngr 1.0.3" "GNU Privacy Guard"
# .TH ccmake 1 "March 06, 2010" "ccmake 2.8.1-rc3"
# .TH QEMU-IMG 1 "2010-03-14" " " " "
# .TH kdecmake 1 "May 07, 2010" "cmake 2.8.1"
# .TH "appender.h" 3 "12 May 2010" "Version 1.2.1" "log4c" \" -*- nroff -*-
# .TH "appender.h" 3 "Tue Aug 31 2010" "Version 1.2.1" "log4c" \" -*- nroff -*-
# .TH "OFFLINEIMAP" "1" "11 May 2010" "John Goerzen" "OfflineIMAP Manual"
# .TH gv 3guile "13 May 2010"
#.TH "GIT\-ARCHIMPORT" "1" "09/13/2010" "Git 1\&.7\&.1" "Git Manual"
# .TH LDIRECTORD 8 "2010-10-20" "perl v5.12.2" "User Contributed Perl Documentation"
# .TH ccmake 1 "February 05, 2012" "ccmake 2.8.7"
# .TH "appender.h" 3 "Tue Aug 31 2010" "Version 1.2.1" "log4c" \" -*- nroff -*-
# .TH ARCH "1" "September 2010" "GNU coreutils 8.5" "User Commands"
# .TH "GCM-CALIBRATE" "1" "03 February 2012" "" ""
#.TH Locale::Po4a::Xml.pm 3pm "2015-01-30" "Po4a Tools" "Po4a Tools"
local f = $1
2017-07-27 14:10:36 +02:00
[ [ $nofilter ] ] && return
2015-02-03 14:39:06 +01:00
# (.TH quoted section) (quoted_date)(*)
sed -i -e 's|^\([[:blank:]]*\.TH[[:blank:]]\+"[^"]\+"[[:blank:]]\+[^[:blank:]]\+\)[[:blank:]]\+\("[^"]\+"\)\([[:blank:]]\+.*\)\?|\1 "qq2000-01-01"\3|' $f
# (.TH unquoted section) (quoted_date)(*)
sed -i -e 's|^\([[:blank:]]*\.TH[[:blank:]]\+[^"][^[:blank:]]\+[[:blank:]]\+[^[:blank:]]\+\)[[:blank:]]\+\("[^"]\+"\)\([[:blank:]]\+.*\)\?|\1 "uq2000-02-02"\3|' $f
# (.TH quoted section) (unquoted_date)(*)
sed -i -e 's|^\([[:blank:]]*\.TH[[:blank:]]\+"[^"]\+"[[:blank:]]\+[^[:blank:]]\+\)[[:blank:]]\+\([^"][^[:blank:]]\+\)\([[:blank:]]\+.*\)\?|\1 qu2000-03-03\3|' $f
# (.TH unquoted section) (unquoted_date)(*)
sed -i -e 's|^\([[:blank:]]*\.TH[[:blank:]]\+[^"][^[:blank:]]\+[[:blank:]]\+[^[:blank:]]\+\)[[:blank:]]\+\([^"][^[:blank:]]\+\)\([[:blank:]]\+.*\)\?|\1 uu2000-04-04\3|' $f
}
2014-08-19 19:41:06 +02:00
strip_numbered_anchors( )
{
# Remove numbered anchors on Docbook / HTML files.
2016-08-25 16:29:40 +02:00
# <a id="idp270624" name=
# "idp270624"></a>
# <a href="#ftn.id32751" class="footnote" id="id32751">
# <a href="#id32751" class="para">
# <a href="#tex">1 TeX</a>
2016-12-14 10:06:25 +01:00
# <a href="dh-manual.html#id599116">
2016-08-25 18:29:08 +02:00
# <a id="id479058">
2016-08-25 16:29:40 +02:00
# <div id="ftn.id43927" class="footnote">
2016-08-25 18:29:08 +02:00
# <div class="section" id="id46">
2016-08-25 16:29:40 +02:00
2017-07-27 14:10:36 +02:00
[ [ $nofilter ] ] && return
2014-08-19 19:41:06 +02:00
for f in old/$file new/$file ; do
2016-08-25 16:29:40 +02:00
sed -ie '
1 {
: N
$ {
2016-08-25 18:29:08 +02:00
s@\( <a[ ^>] \+ id = \n \? "\)\(id[a-z0-9]\+\)\(" [ ^>] *>\) @\1 a_idN\3 @g
s@\( <a[ ^>] \+ name = \n \? "\)\(id[a-z0-9]\+\)\(" [ ^>] *>\) @\1 a_nameN\3 @g
s@\( <a[ ^>] \+ href = "#\)\([^" ] \+ \) \( " [^>]*>\)@\1href_anchor\3@g
2016-12-14 10:06:25 +01:00
s@\( <a[ ^>] \+ href = "[^#]\+#\)\([^" ] \+ \) \( " [^>]*>\)@\1href_anchor\3@g
s@\( <div[ ^>] \+ id = "\)\([\.a-z0-9]\+\)\(" [ ^>] *>\) @\1 div_idN\3 @g
2016-08-25 16:29:40 +02:00
}
N
b N
} ' $f &
2014-08-19 19:41:06 +02:00
done
2016-08-25 16:29:40 +02:00
wait
2014-08-19 19:41:06 +02:00
}
2014-11-27 07:24:39 +01:00
check_compressed_file( )
2014-11-11 14:22:49 +01:00
{
local file = $1
2014-11-27 07:24:39 +01:00
local ext = $2
2014-11-11 14:22:49 +01:00
local tmpdir = ` mktemp -d`
local ftype
local ret = 0
2020-01-08 17:55:30 +01:00
wprint " $ext file with odd filename: $file "
2014-11-11 14:22:49 +01:00
if test -n " $tmpdir " ; then
mkdir $tmpdir /{ old,new}
cp --parents --dereference old/$file $tmpdir /
cp --parents --dereference new/$file $tmpdir /
if pushd $tmpdir > /dev/null ; then
2014-11-27 07:24:39 +01:00
case " $ext " in
bz2)
mv old/$file { ,.bz2}
mv new/$file { ,.bz2}
2015-04-28 14:48:08 +02:00
bzip2 -d old/$file .bz2 &
bzip2 -d new/$file .bz2 &
wait
2014-11-27 07:24:39 +01:00
; ;
gzip)
mv old/$file { ,.gz}
mv new/$file { ,.gz}
2015-04-28 14:48:08 +02:00
gzip -d old/$file .gz &
gzip -d new/$file .gz &
wait
2014-11-27 07:24:39 +01:00
; ;
xz)
mv old/$file { ,.xz}
mv new/$file { ,.xz}
2015-04-28 14:48:08 +02:00
xz -d old/$file .xz &
xz -d new/$file .xz &
wait
2014-11-27 07:24:39 +01:00
; ;
esac
2015-01-21 13:54:20 +01:00
ftype = ` /usr/bin/file old/$file | sed 's@^[^:]\+:[[:blank:]]*@@' `
2014-11-11 14:22:49 +01:00
case $ftype in
2015-01-21 13:54:20 +01:00
POSIX\ tar\ archive)
2020-01-08 17:55:30 +01:00
wprint " $ext content is: $ftype "
2014-11-11 14:22:49 +01:00
mv old/$file { ,.tar}
mv new/$file { ,.tar}
if ! check_single_file ${ file } .tar; then
ret = 1
fi
; ;
2015-01-21 13:54:20 +01:00
ASCII\ cpio\ archive\ *)
2020-01-08 17:55:30 +01:00
wprint " $ext content is: $ftype "
2014-11-24 13:18:21 +01:00
mv old/$file { ,.cpio}
mv new/$file { ,.cpio}
if ! check_single_file ${ file } .cpio; then
ret = 1
fi
; ;
2016-08-24 15:40:34 +02:00
fifo*pipe*)
ftype_new = " `/usr/bin/file new/ $file | sed -e 's@^[^:]\+:[[:blank:]]*@@' -e 's@[[:blank:]]* $@ @'` "
2020-01-08 17:55:30 +01:00
if [ " $ftype_new " != " $ftype " ] ; then
ret = 1
2016-08-24 15:40:34 +02:00
fi
; ;
2014-11-11 14:22:49 +01:00
*)
2020-01-08 17:55:30 +01:00
wprint " unhandled $ext content: $ftype "
2014-11-11 14:22:49 +01:00
if ! diff_two_files; then
ret = 1
fi
; ;
esac
popd > /dev/null
fi
rm -rf " $tmpdir "
fi
return $ret
}
2020-01-08 17:55:30 +01:00
# returns 0 if file should be skipped
file_is_on_ignorelist( )
{
local file = " $1 "
local ret = 0
case " ${ file } " in
# Just debug information, we can skip them
*.exe.mdb| *.dll.mdb) ; ;
# binary dump of TeX and Metafont formats, we can ignore them for good
/var/lib/texmf/web2c/*/*fmt| \
/var/lib/texmf/web2c/metafont/*.base| \
/var/lib/texmf/web2c/metapost/*.mem) ; ;
# ruby documentation, file just contains a timestamp and nothing else
*/created.rid) ; ;
# R binary cache of DESCRIPTION
/usr/lib*/R/library/*/Meta/package.rds) ; ;
# binary cache of interpreted R code
/usr/lib*/R/library/*/R/*.rd[ bx] ) ; ;
# LibreOffice log file
/usr/lib/libreoffice/solver/inc/*/deliver.log) ; ;
# packaged by libguestfs
*/ld.so.cache| */etc/machine-id) ; ;
# everything else will be processed
*) ret = 1 ; ;
esac
return ${ ret }
}
# void
normalize_file( )
{
local file = " $1 "
local f
case " $file " in
*.spec)
sed -i -e " s,Release:.* $release1 ,Release: @RELEASE@, " " old/ $file "
sed -i -e " s,Release:.* $release2 ,Release: @RELEASE@, " " new/ $file "
; ;
*/xen*.efi)
filter_generic xenefi
; ;
*.pyc| *.pyo)
filter_generic pyc
; ;
*.dvi)
filter_generic dvi
; ;
*png)
# Try to remove timestamps, only if convert from ImageMagick is installed
if [ [ $( type -p convert) ] ] ; then
filter_generic png
fi
; ;
/usr/share/locale/*/LC_MESSAGES/*.mo| \
/usr/share/locale-bundle/*/LC_MESSAGES/*.mo| \
/usr/share/vdr/locale/*/LC_MESSAGES/*.mo)
filter_generic mo
; ;
*/rdoc/files/*.html)
# ruby documentation
# <td>Mon Sep 20 19:02:43 +0000 2010</td>
for f in old/$file new/$file ; do
sed -i -e 's%<td>[A-Z][a-z][a-z] [A-Z][a-z][a-z] [0-9]\+ [0-9]\+:[0-9]\+:[0-9]\+ +0000 201[0-9]</td>%<td>Mon Sep 20 19:02:43 +0000 2010</td>%g' $f
done
strip_numbered_anchors
; ;
/usr/share/doc/HTML/*/*/index.cache| \
/usr/share/doc//HTML/*/*/*/index.cache| \
/usr/share/doc/kde/HTML/*/*/index.cache| \
/usr/share/doc/kde/HTML/*/*/*/index.cache| \
/usr/share/gtk-doc/html/*/*.html| \
/usr/share/gtk-doc/html/*/*.devhelp2)
# various kde and gtk packages
strip_numbered_anchors
; ;
/usr/share/doc/packages/*/*.html| \
/usr/share/doc/packages/*/*/*.html| \
/usr/share/doc/*/html/*.html| \
/usr/share/doc/kde/HTML/*/*/*.html)
for f in old/$file new/$file ; do
sed -i -e '
s| META NAME = "Last-modified" CONTENT = "[^" ] \+ "|META NAME=" Last-modified" CONTENT=" Thu Mar 3 10:32:44 2016" |
s| <!-- Created on [ ^,] \+ , [ 0-9] \+ [ 0-9] \+ by texi2html [ 0-9\. ] \+ -->| <!-- Created on July, 14 2015 by texi2html 1.78 -->|
s| <!-- Created on [ ^,] \+ , [ 0-9] \+ by texi2html [ 0-9\. ] \+ $| <!-- Created on October 1, 2015 by texi2html 5.0|
s| ^<!-- Created on .*, 20.. by texi2html .\. ..| <!-- Created on August 7, 2009 by texi2html 1.82|
s| This document was generated by <em>Autobuild</em> on <em>[ ^,] \+ , [ 0-9] \+ [ 0-9] \+ </em> using <a href = "http://www.nongnu.org/texi2html/" ><em>texi2html [ 0-9\. ] \+ </em></a>.| This document was generated by <em>Autobuild</em> on <em>July, 15 2015</em> using <a href = "http://www.nongnu.org/texi2html/" ><em>texi2html 1.78</em></a>.|
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>.|
s| ^ *This document was generated on <i>[ a-zA-Z] \+ [ 0-9] \+ , [ 0-9] \+ </i> using <a href = "http://www.nongnu.org/texi2html/" ><i>texi2html [ 0-9\. ] \+ </i></a>.| This document was generated on <i>October 1, 2015</i> using <a href = "http://www.nongnu.org/texi2html/" ><i>texi2html 5.0</i></a>.|
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 |
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
done
strip_numbered_anchors
; ;
/usr/*/javadoc/*.html)
strip_numbered_anchors
# There are more timestamps in html, so far we handle only some primitive versions.
for f in old/$file new/$file ; do
# Javadoc:
# <head>
# <!-- Generated by javadoc (version 1.7.0_75) on Tue Feb 03 02:20:12 GMT 2015 -->
# <!-- Generated by javadoc on Tue Feb 03 00:02:48 GMT 2015 -->
# <!-- Generated by javadoc (1.8.0_72) on Thu Mar 03 12:50:28 GMT 2016 -->
# <!-- Generated by javadoc (10-internal) on Wed Feb 07 06:33:41 GMT 2018 -->
# <meta name="dc.created" content="2019-02-07">
# <meta name="date" content="2015-02-03">
# </head>
sed -i -e '
/^<head>/{
: next
n
/^<\/ head>/{
b end_head
}
s/^<!-- Generated by javadoc ( [ 0-9._] \+ ) on ... ... .. ..:..:.. \( GMT\| UTC\) .... -->/<!-- Generated by javadoX ( 1.8.0_72) on Thu Mar 03 12:50:28 GMT 2016 -->/
t next
s/^\( <!-- Generated by javadoc\) \( ( \( build\| version\) [ 0-9._] \+ ) on ... ... .. ..:..:.. \( GMT\| UTC\) ....\) \( -->\) /\1 some-date-removed-by-build-compare \5 /
t next
s/^\( <!-- Generated by javadoc\) ( [ 0-9._] \+ -internal) on ... ... .. ..:..:.. \( GMT\| UTC\) .... \( -->\) /\1 some-date-removed-by-build-compare \3 /
t next
s/^\( <!-- Generated by javadoc\) \( on ... ... .. ..:..:.. \( GMT\| UTC\) ....\) \( -->\) /\1 some-date-removed-by-build-compare \3 /
t next
s/^<meta name = "dc.created" content = "[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}" >/<meta name = "dc.created" content = "some-date-removed-by-build-compare" >/
t next
s/^<meta name = "date" content = "[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}" >/<meta name = "date" content = "some-date-removed-by-build-compare" >/
b next
}
: end_head
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.%
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" \1 GNU Classpath Tools</a>, on January 1, 2009 0:00:00 a.m. GMT.</p>%
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
# deprecated-list is randomly ordered, sort it for comparison
case $f in
*/deprecated-list.html)
[ [ $nofilter ] ] || sort -o $f $f
; ;
esac
done
; ;
/usr/share/javadoc/gjdoc.properties| \
/usr/share/javadoc/*/gjdoc.properties)
for f in old/$file new/$file ; do
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
done
; ;
*/fonts.scale| \
*/fonts.dir| \
*/encodings.dir)
for f in old/$file new/$file ; do
# sort files before comparing
[ [ $nofilter ] ] || sort -o $f $f
done
; ;
/var/adm/perl-modules/*)
for f in old/$file new/$file ; do
sed -i -e 's|^=head2 ... ... .. ..:..:.. ....: C<Module>|=head2 Wed Jul 1 00:00:00 2009: C<Module>|' $f
done
; ;
/usr/share/man/man3/*3pm)
for f in old/$file new/$file ; do
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
trim_man_TH $f
trim_man_first_line $f
done
; ;
*/share/man/*| \
/usr/lib/texmf/doc/man/*/*)
for f in old/$file new/$file ; do
trim_man_TH $f
trim_man_first_line $f
# generated by docbook xml:
#.\" Date: 09/13/2010
2020-01-09 12:50:18 +01:00
sed -i -e 's|Date: [0-1][0-9]/[0-9][0-9]/[0-9][0-9][0-9][0-9]|Date: 09/13/2010|' $f
2020-01-08 17:55:30 +01:00
done
; ;
*.elc)
filter_generic emacs_lisp
; ;
*/libtool)
for f in old/$file new/$file ; do
sed -i -e 's|^# Libtool was configured on host [A-Za-z0-9]*:$|# Libtool was configured on host x42:|' $f
done
; ;
/etc/mail/*cf| \
/etc/sendmail.cf)
# from sendmail package
for f in old/$file new/$file ; do
# - ##### built by abuild@build33 on Thu May 6 11:21:17 UTC 2010
sed -i -e 's|built by abuild@[a-z0-9]* on ... ... [0-9]* [0-9]*:[0-9][0-9]:[0-9][0-9] .* 20[0-9][0-9]|built by abuild@build42 on Thu May 6 11:21:17 UTC 2010|' $f
done
; ;
/usr/lib*/R/library/*/DESCRIPTION)
# Simulate R CMD INSTALL --built-timestamp=''
# Built: R 3.6.1; x86_64-suse-linux-gnu; 2019-08-13 04:19:49 UTC; unix
sed -i -e 's|\(Built: [^;]*; [^;]*; \)20[0-9][0-9]-[01][0-9]-[0123][0-9] [012][0-9]:[0-5][0-9]:[0-5][0-9] UTC\(; .*\)$|\1\2|' old/$file new/$file
; ;
*/Linux*Env.Set.sh)
# LibreOffice files, contains:
# Generated on: Mon Apr 18 13:19:22 UTC 2011
for f in old/$file new/$file ; do
sed -i -e 's%^# Generated on:.*UTC 201[0-9] *$%# Generated on: Sometime%g' $f
done
; ;
/var/adm/update-messages/*| \
/var/adm/update-scripts/*)
# fetchmsttfonts embeds the release number in the update shell script.
sed -i " s/ ${ name_ver_rel_old_regex_l } /@NAME_VER_REL@/ " old/$file
sed -i " s/ ${ name_ver_rel_new_regex_l } /@NAME_VER_REL@/ " new/$file
; ;
*.ps)
filter_generic ps
; ;
*pdf)
filter_generic pdf
; ;
*/linuxrc.config)
filter_generic linuxrc_config
; ;
*/etc/hosts)
# packaged by libguestfs
sed -i 's/^127.0.0.1[[:blank:]].*/127.0.0.1 hst/' " old/ $file "
sed -i 's/^127.0.0.1[[:blank:]].*/127.0.0.1 hst/' " new/ $file "
; ;
esac
}
2009-02-04 04:29:06 +01:00
check_single_file( )
2014-08-19 19:41:06 +02:00
{
2012-05-08 14:40:43 +02:00
local file = " $1 "
2018-07-06 16:02:40 +02:00
local ret = 0
2020-01-08 17:55:30 +01:00
local i
local failed
local objdump_failed
local elfdiff
local sections
local -a pipestatus
2016-08-24 15:40:34 +02:00
2020-01-08 17:55:30 +01:00
if file_is_on_ignorelist " ${ file } "
then
return 0
2016-08-24 15:40:34 +02:00
fi
2020-01-08 17:55:30 +01:00
verify_before_processing " ${ file } " " ${ dfile } "
case " $? " in
0) return 0 ; ;
1) return 1 ; ;
*) ; ;
esac
normalize_file " ${ file } "
2019-02-19 10:32:50 +01:00
case " $file " in
2009-02-04 04:29:06 +01:00
*.a)
2019-02-19 10:32:50 +01:00
flist = ` ar t " new/ $file " `
2009-02-04 04:29:06 +01:00
pwd = $PWD
2019-02-19 10:32:50 +01:00
fdir = ` dirname " $file " `
cd " old/ $fdir "
ar x ` basename " $file " `
cd " $pwd /new/ $fdir "
ar x ` basename " $file " `
cd " $pwd "
2009-02-04 04:29:06 +01:00
for f in $flist ; do
2019-02-19 10:32:50 +01:00
if ! check_single_file " $fdir / $f " ; then
2009-07-14 17:58:02 +02:00
return 1
fi
2020-01-08 17:55:30 +01:00
watchdog_touch
2009-02-04 04:29:06 +01:00
done
2009-07-23 16:35:14 +02:00
return 0
2009-07-14 17:58:02 +02:00
; ;
2014-11-24 13:18:21 +01:00
*.cpio)
2017-07-27 14:10:36 +02:00
flist = ` cpio --quiet --list --force-local < " new/ $file " | $sort `
2014-11-24 13:18:21 +01:00
pwd = $PWD
2019-02-19 10:32:50 +01:00
fdir = " $file .extract. $PPID . $$ "
mkdir " old/ $fdir " " new/ $fdir "
cd " old/ $fdir "
2015-01-19 10:54:08 +01:00
cpio --quiet --extract --force-local < " ../ ${ file ##*/ } "
2019-02-19 10:32:50 +01:00
cd " $pwd /new/ $fdir "
2015-01-19 10:54:08 +01:00
cpio --quiet --extract --force-local < " ../ ${ file ##*/ } "
2019-02-19 10:32:50 +01:00
cd " $pwd "
2014-11-24 13:18:21 +01:00
for f in $flist ; do
2019-02-19 10:32:50 +01:00
if ! check_single_file " $fdir / $f " ; then
2014-11-24 13:18:21 +01:00
ret = 1
if test -z " $check_all " ; then
break
fi
fi
2020-01-08 17:55:30 +01:00
watchdog_touch
2014-11-24 13:18:21 +01:00
done
2019-02-19 10:32:50 +01:00
rm -rf " old/ $fdir " " new/ $fdir "
2014-11-24 13:18:21 +01:00
return $ret
; ;
2015-04-28 14:48:08 +02:00
*.squashfs)
2017-07-27 14:10:36 +02:00
flist = ` unsquashfs -no-progress -ls -dest '' " new/ $file " | grep -Ev '^(Parallel unsquashfs:|[0-9]+ inodes )' | $sort `
2019-02-19 10:32:50 +01:00
fdir = " $file .extract. $PPID . $$ "
unsquashfs -no-progress -dest " old/ $fdir " " old/ $file "
unsquashfs -no-progress -dest " new/ $fdir " " new/ $file "
2015-04-28 14:48:08 +02:00
for f in $flist ; do
2019-02-19 10:32:50 +01:00
if ! check_single_file " $fdir / $f " ; then
2015-04-28 14:48:08 +02:00
ret = 1
if test -z " $check_all " ; then
break
fi
fi
2020-01-08 17:55:30 +01:00
watchdog_touch
2015-04-28 14:48:08 +02:00
done
2019-02-19 10:32:50 +01:00
rm -rf " old/ $fdir " " new/ $fdir "
2015-04-28 14:48:08 +02:00
return $ret
; ;
2009-05-07 17:38:41 +02:00
*.tar| *.tar.bz2| *.tar.gz| *.tgz| *.tbz2)
2019-02-19 10:32:50 +01:00
flist = ` tar tf " new/ $file " `
2009-05-07 17:38:41 +02:00
pwd = $PWD
2019-02-19 10:32:50 +01:00
fdir = ` dirname " $file " `
cd " old/ $fdir "
tar xf ` basename " $file " `
cd " $pwd /new/ $fdir "
tar xf ` basename " $file " `
cd " $pwd "
2009-05-07 17:38:41 +02:00
for f in $flist ; do
2019-02-19 10:32:50 +01:00
if ! check_single_file " $fdir / $f " ; then
2009-05-07 17:38:41 +02:00
ret = 1
if test -z " $check_all " ; then
break
fi
fi
2020-01-08 17:55:30 +01:00
watchdog_touch
2009-05-07 17:38:41 +02:00
done
2009-07-27 18:43:38 +02:00
return $ret
; ;
2017-12-04 11:23:41 +01:00
*.zip| *.egg| *.jar| *.war)
2017-07-27 14:10:36 +02:00
for dir in old new ; do
(
cd $dir
unjar_l ./$file | $sort > flist
)
done
2009-07-14 17:58:02 +02:00
if ! cmp -s old/flist new/flist; then
2020-01-08 17:55:30 +01:00
wprint " $file has different file list "
2009-07-14 17:58:02 +02:00
diff -u old/flist new/flist
return 1
fi
2019-02-19 10:32:50 +01:00
flist = ` cat new/flist`
2009-07-14 17:58:02 +02:00
pwd = $PWD
fdir = ` dirname $file `
cd old/$fdir
2009-07-23 16:35:14 +02:00
unjar ` basename $file `
2009-07-14 17:58:02 +02:00
cd $pwd /new/$fdir
2009-07-23 16:35:14 +02:00
unjar ` basename $file `
2009-07-14 17:58:02 +02:00
cd $pwd
for f in $flist ; do
if test -f new/$fdir /$f && ! check_single_file $fdir /$f ; then
ret = 1
if test -z " $check_all " ; then
break
fi
fi
2020-01-08 17:55:30 +01:00
watchdog_touch
2009-07-14 17:58:02 +02:00
done
return $ret ; ;
2009-02-04 04:29:06 +01:00
*.bz2)
2009-02-09 02:05:51 +01:00
bunzip2 -c old/$file > old/${ file /.bz2/ }
bunzip2 -c new/$file > new/${ file /.bz2/ }
2009-02-04 04:29:06 +01:00
check_single_file ${ file /.bz2/ }
2009-07-14 17:58:02 +02:00
return $?
; ;
2009-02-04 04:29:06 +01:00
*.gz)
2009-02-09 02:05:51 +01:00
gunzip -c old/$file > old/${ file /.gz/ }
gunzip -c new/$file > new/${ file /.gz/ }
2009-02-04 04:29:06 +01:00
check_single_file ${ file /.gz/ }
2009-07-23 16:35:14 +02:00
return $?
2009-07-14 17:58:02 +02:00
; ;
2015-02-10 16:54:31 +01:00
*.rpm)
$self_script -a old/$file new/$file
return $?
; ;
2009-02-04 04:29:06 +01:00
esac
2019-02-19 10:32:50 +01:00
ftype = ` /usr/bin/file " old/ $file " | sed -e 's@^[^:]\+:[[:blank:]]*@@' -e 's@[[:blank:]]*$@@' `
2009-02-04 04:29:06 +01:00
case $ftype in
2015-01-21 13:54:20 +01:00
PE32\ executable*Mono\/ \. Net\ assembly*)
2020-01-08 17:55:30 +01:00
wprint " PE32 Mono/.Net assembly: $file "
2010-03-26 02:29:16 +01:00
if [ -x /usr/bin/monodis ] ; then
2019-02-19 10:32:50 +01:00
monodis " old/ $file " 2>/dev/null| sed -e 's/GUID = {.*}/GUID = { 42 }/;' > ${ file1 }
monodis " new/ $file " 2>/dev/null| sed -e 's/GUID = {.*}/GUID = { 42 }/;' > ${ file2 }
if ! cmp -s " ${ file1 } " " ${ file2 } " ; then
2020-01-08 17:55:30 +01:00
wprint " $file differs ( $ftype ) "
2019-02-19 10:32:50 +01:00
diff --speed-large-files -u " ${ file1 } " " ${ file2 } "
2010-03-26 02:29:16 +01:00
return 1
fi
else
2020-01-08 17:55:30 +01:00
wprint "Cannot compare, no monodis installed"
2010-03-26 02:29:16 +01:00
return 1
fi
; ;
2018-07-04 07:59:33 +02:00
ELF*executable*| \
ELF*[ LM] SB\ relocatable*| \
ELF*[ LM] SB\ shared\ object*| \
setuid\ ELF*[ LM] SB\ shared\ object*| \
ELF*[ LM] SB\ pie\ executable*| \
setuid\ ELF*[ LM] SB\ pie\ executable*)
2020-01-08 17:55:30 +01:00
diff --speed-large-files --unified \
<( $OBJDUMP -d --no-show-raw-insn old/$file |
filter_disasm |
sed -e "s,old/,," ;
echo " ${ PIPESTATUS [@] } " > $file1
) \
<( $OBJDUMP -d --no-show-raw-insn new/$file |
filter_disasm |
sed -e "s,new/,," ;
echo " ${ PIPESTATUS [@] } " > $file2
) > $dfile
ret = $?
failed =
read i < ${ file1 }
pipestatus = ( $i )
objdump_failed = " ${ pipestatus [0] } "
i = 0
while test $i -lt ${# pipestatus [@] }
do
if test " ${ pipestatus [ $i ] } " != "0"
then
wprint " ELF: pipe command # $i failed with ${ pipestatus [ $i ] } for old/ $file "
failed = 'failed'
fi
: $(( i++ ))
done
read i < ${ file2 }
pipestatus = ( $i )
objdump_failed = " ${ objdump_failed } ${ pipestatus [0] } "
i = 0
while test $i -lt ${# pipestatus [@] }
do
if test " ${ pipestatus [ $i ] } " != "0"
then
wprint " ELF: pipe command # $i failed with ${ pipestatus [ $i ] } for new/ $file "
failed = 'failed'
fi
: $(( i++ ))
done
if test " ${ objdump_failed } " != "00" || test -n " ${ failed } "
then
# objdump had no idea how to handle it
if diff_two_files; then
2014-07-22 09:29:15 +02:00
return 0
2020-01-08 17:55:30 +01:00
fi
return 1
fi
elfdiff =
if test " $ret " != "0"
then
wprint " $file differs in assembler output "
$buildcompare_head $dfile
elfdiff = 'elfdiff'
fi
sections = " $(
$OBJDUMP -s new/$file |
sed -n --regexp-extended -e '
/Contents of section .*:/ {
s,.* ( .*) :,\1 ,g
/\. build-id/d
/\. gnu_debuglink/d
/\. gnu_debugdata/d
p
}
'
) "
for section in $sections
do
diff --unified \
<( $OBJDUMP -s -j $section old/$file |
sed -e "s,^old/,," ;
echo " ${ PIPESTATUS [@] } " > $file1 ) \
<( $OBJDUMP -s -j $section new/$file |
sed -e "s,^new/,," ;
echo " ${ PIPESTATUS [@] } " > $file2
) > $dfile
ret = $?
failed =
read i < ${ file1 }
pipestatus = ( $i )
objdump_failed = " ${ pipestatus [0] } "
i = 0
while test $i -lt ${# pipestatus [@] }
do
if test " ${ pipestatus [ $i ] } " != "0"
then
wprint " ELF section: pipe command # $i failed with ${ pipestatus [ $i ] } for old/ $file "
failed = 'failed'
fi
: $(( i++ ))
done
read i < ${ file2 }
pipestatus = ( $i )
objdump_failed = " ${ objdump_failed } ${ pipestatus [0] } "
i = 0
while test $i -lt ${# pipestatus [@] }
do
if test " ${ pipestatus [ $i ] } " != "0"
then
wprint " ELF section: pipe command # $i failed with ${ pipestatus [ $i ] } for new/ $file "
failed = 'failed'
fi
: $(( i++ ))
done
if test -n " ${ failed } "
then
elfdiff = 'elfdiff'
break
fi
if test " $ret " != "0"
then
wprint " $file differs in ELF section $section "
$buildcompare_head $dfile
elfdiff = 'elfdiff'
else
watchdog_touch
fi
done
if test -n " $elfdiff " ; then
return 1
fi
return 0
; ;
2009-02-04 04:29:06 +01:00
*ASCII*| *text*)
2019-02-19 10:32:50 +01:00
if ! cmp -s " old/ $file " " new/ $file " ; then
2020-01-08 17:55:30 +01:00
wprint " $file differs ( $ftype ) "
2019-02-19 10:32:50 +01:00
diff -u " old/ $file " " new/ $file " | $buildcompare_head
2009-05-07 17:38:41 +02:00
return 1
2009-02-04 04:29:06 +01:00
fi
; ;
2015-04-13 10:56:50 +02:00
directory| setuid\ directory| setuid,\ directory| sticky,\ directory)
2009-07-27 18:43:38 +02:00
# tar might package directories - ignore them here
return 0
; ;
2015-01-21 13:54:20 +01:00
bzip2\ compressed\ data*)
2014-11-27 07:24:39 +01:00
if ! check_compressed_file " $file " "bz2" ; then
return 1
fi
; ;
2015-01-21 13:54:20 +01:00
gzip\ compressed\ data*)
2014-11-27 07:24:39 +01:00
if ! check_compressed_file " $file " "gzip" ; then
return 1
fi
; ;
2015-01-21 13:54:20 +01:00
XZ\ compressed\ data*)
2014-11-27 07:24:39 +01:00
if ! check_compressed_file " $file " "xz" ; then
2014-11-11 14:22:49 +01:00
return 1
fi
; ;
2015-02-04 17:13:15 +01:00
POSIX\ tar\ archive)
mv old/$file { ,.tar}
mv new/$file { ,.tar}
if ! check_single_file ${ file } .tar; then
return 1
fi
; ;
2015-01-21 13:54:20 +01:00
cpio\ archive)
2015-01-19 10:54:08 +01:00
mv old/$file { ,.cpio}
mv new/$file { ,.cpio}
if ! check_single_file ${ file } .cpio; then
return 1
fi
; ;
2015-04-28 14:48:08 +02:00
Squashfs\ filesystem,*)
2020-01-08 17:55:30 +01:00
wprint " $file ( $ftype ) "
2015-04-28 14:48:08 +02:00
mv old/$file { ,.squashfs}
mv new/$file { ,.squashfs}
if ! check_single_file ${ file } .squashfs; then
return 1
fi
; ;
2016-09-21 09:20:50 +02:00
broken\ symbolic\ link\ to\ *| symbolic\ link\ to\ *)
2014-11-24 13:18:21 +01:00
readlink " old/ $file " > $file1
readlink " new/ $file " > $file2
if ! diff -u $file1 $file2 ; then
2020-01-08 17:55:30 +01:00
wprint " symlink target for $file differs "
2014-11-24 13:18:21 +01:00
return 1
fi
; ;
2015-04-28 14:48:08 +02:00
block\ special\ *)
; ;
character\ special\ *)
; ;
2009-02-04 04:29:06 +01:00
*)
2009-07-14 17:58:02 +02:00
if ! diff_two_files; then
2009-07-23 16:35:14 +02:00
return 1
2009-02-04 04:29:06 +01:00
fi
; ;
esac
2009-05-07 17:38:41 +02:00
return 0
2009-02-04 04:29:06 +01:00
}
2020-01-08 17:55:30 +01:00
FUNCTIONS = ${ 0 %/* } /functions.sh
: ${ buildcompare_head : = "head -n 200" }
nofilter = ${ buildcompare_nofilter }
sort = sort
[ [ $nofilter ] ] && sort = cat
check_all =
case $1 in
-a | --check-all)
check_all = 1
shift
esac
if test " $# " != 2; then
echo " usage: $0 [-a|--check-all] old.rpm new.rpm "
exit 1
fi
test -z $OBJDUMP && OBJDUMP = objdump
# Always clean up on exit
local_tmpdir = ` mktemp -d`
if test -z " ${ local_tmpdir } "
then
exit 1
fi
function _exit( )
{
chmod -R u+w " ${ local_tmpdir } "
rm -rf " ${ local_tmpdir } "
}
trap _exit EXIT
# Let further mktemp refer to private tmpdir
export TMPDIR = $local_tmpdir
self_script = $( cd $( dirname $0 ) ; echo $( pwd ) /$( basename $0 ) )
source $FUNCTIONS
oldpkg = ` readlink -f $1 `
newpkg = ` readlink -f $2 `
rename_script = ` mktemp`
file1 = ` mktemp`
file2 = ` mktemp`
dir = ` mktemp -d`
dfile = ` mktemp`
if test ! -f " $oldpkg " ; then
echo " can't open $1 "
exit 1
fi
if test ! -f " $newpkg " ; then
echo " can't open $2 "
exit 1
fi
echo " Comparing `basename $oldpkg ` to `basename $newpkg ` "
case $oldpkg in
*.rpm)
cmp_rpm_meta " $rename_script " " $oldpkg " " $newpkg "
RES = $?
case $RES in
0)
echo "RPM meta information is identical"
if test -z " $check_all " ; then
exit 0
fi
; ;
1)
echo "RPM meta information is different"
if test -z " $check_all " ; then
exit 1
fi
; ;
2)
echo "RPM file checksum differs."
RES = 0
; ;
*)
echo "Wrong exit code!"
exit 1
; ;
esac
; ;
esac
wprint "Extracting packages"
unpackage $oldpkg $dir /old
unpackage $newpkg $dir /new
case $oldpkg in
*.deb| *.ipk)
adjust_controlfile $dir /old $dir /new
; ;
esac
# files is set in cmp_rpm_meta for rpms, so if RES is empty we should assume
# it wasn't an rpm and pick all files for comparison.
if [ -z $RES ] ; then
oldfiles = ` cd $dir /old; find . -type f`
newfiles = ` cd $dir /new; find . -type f`
files = ` echo -e " $oldfiles \n $newfiles " | sort -u`
fi
cd $dir
bash $rename_script
2010-03-26 02:29:16 +01:00
# We need /proc mounted for some tests, so check that it's mounted and
# complain if not.
PROC_MOUNTED = 0
if [ ! -d /proc/self/ ] ; then
echo "/proc is not mounted"
mount -orw -n -tproc none /proc
PROC_MOUNTED = 1
fi
2017-11-06 17:16:43 +01:00
# preserve cmp_rpm_meta result for check_all runs
2014-11-24 13:18:21 +01:00
ret = $RES
2019-02-19 10:32:50 +01:00
readarray -t filesarray <<< " $files "
for file in " ${ filesarray [@] } " ; do
if ! check_single_file " $file " ; then
2009-05-07 17:38:41 +02:00
ret = 1
if test -z " $check_all " ; then
2009-07-23 16:35:14 +02:00
break
2009-05-07 17:38:41 +02:00
fi
fi
2009-02-04 04:29:06 +01:00
done
2010-03-26 02:29:16 +01:00
if [ " $PROC_MOUNTED " -eq "1" ] ; then
echo "Unmounting proc"
umount /proc
fi
2014-11-27 07:24:39 +01:00
if test " $ret " = 0; then
2015-02-10 16:54:31 +01:00
echo "Package content is identical"
2014-11-27 07:24:39 +01:00
fi
2009-02-04 04:29:06 +01:00
exit $ret
2015-03-20 20:33:05 +01:00
# vim: tw=666 ts=2 shiftwidth=2 et