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
2010-09-21 13:12:14 +02:00
FUNCTIONS = ${ 0 %/* } /functions.sh
2009-02-04 04:29:06 +01:00
2009-05-07 17:38:41 +02:00
check_all =
case $1 in
-a | --check-all)
check_all = 1
shift
esac
2009-02-04 04:29:06 +01:00
if test " $# " != 2; then
2009-05-07 17:38:41 +02:00
echo " usage: $0 [-a|--check-all] old.rpm new.rpm "
2009-02-04 04:29:06 +01:00
exit 1
fi
2010-09-21 13:12:14 +02:00
source $FUNCTIONS
2009-02-04 04:29:06 +01:00
oldrpm = ` readlink -f $1 `
newrpm = ` readlink -f $2 `
2014-11-24 13:18:21 +01:00
rename_script = ` mktemp`
2009-02-04 04:29:06 +01:00
if test ! -f $oldrpm ; then
echo " can't open $oldrpm "
exit 1
fi
if test ! -f $newrpm ; then
echo " can't open $newrpm "
exit 1
fi
2009-07-23 16:35:14 +02:00
#usage unjar <file>
function unjar( )
{
local file
file = $1
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
case $UNJAR in
jar| fastjar)
# echo jar -xf $file
${ UNJAR } -xf $file
; ;
unzip)
unzip -oqq $file
; ;
esac
}
# list files in directory
#usage unjar_l <file>
function unjar_l( )
{
local file
file = $1
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
case $UNJAR in
jar| fastjar)
${ UNJAR } -tf $file
; ;
unzip)
unzip -l $file
; ;
esac
}
2009-02-04 04:29:06 +01:00
filter_disasm( )
{
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>/'
}
2014-11-24 13:18:21 +01:00
cmp_spec $rename_script
2010-09-21 13:12:14 +02:00
RES = $?
case $RES in
0)
2014-11-27 07:24:39 +01:00
echo "RPM meta information is identical"
2014-11-24 13:18:21 +01:00
if test -z " $check_all " ; then
exit 0
fi
2010-09-21 13:12:14 +02:00
; ;
1)
2010-10-28 11:50:21 +02:00
echo "RPM meta information is different"
2014-11-11 14:22:49 +01:00
if test -z " $check_all " ; then
exit 1
fi
2010-09-21 13:12:14 +02:00
; ;
2)
2014-11-27 07:24:39 +01:00
echo "RPM file checksum differs."
RES = 0
2010-09-21 13:12:14 +02:00
; ;
*)
echo "Wrong exit code!"
exit 1
; ;
esac
2009-02-04 04:29:06 +01:00
file1 = ` mktemp`
file2 = ` mktemp`
dir = ` mktemp -d`
2014-11-24 13:18:21 +01:00
echo "Extracting packages"
2010-09-21 13:12:14 +02:00
unrpm $oldrpm $dir /old
unrpm $newrpm $dir /new
2009-02-04 04:29:06 +01:00
cd $dir
2014-11-24 13:18:21 +01:00
bash $rename_script
2009-02-04 04:29:06 +01:00
dfile = ` mktemp`
2009-05-07 17:38:41 +02:00
diff_two_files( )
{
if ! cmp -s old/$file new/$file ; then
echo " $file differs ( $ftype ) "
hexdump -C old/$file > $file1
hexdump -C new/$file > $file2
diff -u $file1 $file2 | head -n 200
return 1
fi
return 0
}
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
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
# (.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.
# This should be save since we remove them from old and new files.
# A trailing </a> or </div> tag will stay also on both files.
for f in old/$file new/$file ; do
sed -i -e 's%<[ ]*a[ ]\+name[^<]*[0-9]\+[^<]*%%g' \
-e 's%<[ ]*a[ ]\+href[^<]*#[^<]*[0-9]\+[^<]*%%g' \
-e 's%<[^<]*id="ftn\.[^<]*[0-9]\+[^<]*%%g' $f
done
}
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
2014-11-27 07:24:39 +01:00
echo " $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}
bzip2 -d old/$file .bz2
bzip2 -d new/$file .bz2
; ;
gzip)
mv old/$file { ,.gz}
mv new/$file { ,.gz}
gzip -d old/$file .gz
gzip -d new/$file .gz
; ;
xz)
mv old/$file { ,.xz}
mv new/$file { ,.xz}
xz -d old/$file .xz
xz -d new/$file .xz
; ;
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)
2014-11-27 07:24:39 +01:00
echo " $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\ *)
2014-11-27 07:24:39 +01:00
echo " $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
; ;
2014-11-11 14:22:49 +01:00
*)
2014-11-27 07:24:39 +01:00
echo " 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
}
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 "
2009-02-04 04:29:06 +01:00
case $file in
*.spec)
sed -i -e " s,Release:.* $release1 ,Release: @RELEASE@, " old/$file
sed -i -e " s,Release:.* $release2 ,Release: @RELEASE@, " new/$file
; ;
2010-03-26 02:29:16 +01:00
*.exe.mdb| *.dll.mdb)
# Just debug information, we can skip them
echo " $file skipped as debug file. "
2010-03-05 18:26:25 +01:00
return 0
; ;
2009-02-04 04:29:06 +01:00
*.a)
flist = ` ar t new/$file `
pwd = $PWD
fdir = ` dirname $file `
cd old/$fdir
ar x ` basename $file `
cd $pwd /new/$fdir
ar x ` basename $file `
cd $pwd
for f in $flist ; do
2009-07-14 17:58:02 +02:00
if ! check_single_file $fdir /$f ; then
return 1
fi
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)
flist = ` cpio --quiet --list --force-local < " new/ $file " `
pwd = $PWD
2015-01-19 10:54:08 +01:00
fdir = $file .extract.$PPID .$$
mkdir old/$fdir new/$fdir
2014-11-24 13:18:21 +01:00
cd old/$fdir
2015-01-19 10:54:08 +01:00
cpio --quiet --extract --force-local < " ../ ${ file ##*/ } "
2014-11-24 13:18:21 +01:00
cd $pwd /new/$fdir
2015-01-19 10:54:08 +01:00
cpio --quiet --extract --force-local < " ../ ${ file ##*/ } "
2014-11-24 13:18:21 +01:00
cd $pwd
local ret = 0
for f in $flist ; do
if ! check_single_file $fdir /$f ; then
ret = 1
if test -z " $check_all " ; then
break
fi
fi
done
2015-01-19 10:54:08 +01:00
rm -rf old/$fdir new/$fdir
2014-11-24 13:18:21 +01:00
return $ret
; ;
2009-05-07 17:38:41 +02:00
*.tar| *.tar.bz2| *.tar.gz| *.tgz| *.tbz2)
flist = ` tar tf new/$file `
pwd = $PWD
fdir = ` dirname $file `
cd old/$fdir
tar xf ` basename $file `
cd $pwd /new/$fdir
tar xf ` basename $file `
cd $pwd
local ret = 0
for f in $flist ; do
if ! check_single_file $fdir /$f ; then
ret = 1
if test -z " $check_all " ; then
break
fi
fi
done
2009-07-27 18:43:38 +02:00
return $ret
; ;
2009-07-14 17:58:02 +02:00
*.zip| *.jar)
cd old
2009-08-05 00:33:08 +02:00
unjar_l ./$file | sort > flist
2010-10-24 13:53:03 +02:00
# 10-05-2010 14:39
sed -i -e "s, [0-9][0-9]-[0-9][0-9]-[0-9]\+ [0-9][0-9]:[0-9][0-9] , date ," flist
2012-02-06 11:15:46 +01:00
# 2012-02-03 07:59
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
2009-07-14 17:58:02 +02:00
cd ../new
2009-08-05 00:33:08 +02:00
unjar_l ./$file | sort> flist
2010-10-24 13:53:03 +02:00
sed -i -e "s, [0-9][0-9]-[0-9][0-9]-[0-9]\+ [0-9][0-9]:[0-9][0-9] , date ,; " flist
2012-02-06 11:15:46 +01:00
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
2009-07-14 17:58:02 +02:00
cd ..
if ! cmp -s old/flist new/flist; then
echo " $file has different file list "
diff -u old/flist new/flist
return 1
fi
flist = ` grep date new/flist | sed -e 's,.* date ,,' `
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
local ret = 0
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
done
return $ret ; ;
2009-02-04 04:29:06 +01:00
*.pyc| *.pyo)
2015-02-03 17:50:57 +01:00
perl -e " open fh, '+<', 'old/ $file '; seek fh, 4, SEEK_SET; print fh '0000'; "
perl -e " open fh, '+<', 'new/ $file '; seek fh, 4, SEEK_SET; print fh '0000'; "
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
; ;
2010-08-30 12:44:04 +02:00
*png)
# Try to remove timestamps, only if convert from ImageMagick is installed
if [ [ $( type -p convert) ] ] ; then
convert old/$file +set date:create +set date:modify old/${ file /.png/_n.png }
convert old/$file +set date:create +set date:modify new/${ file /.png/_n.png }
if ! cmp -s old/${ file /.png/_n.png } new/${ file /.png/_n.png } ; then
echo " $file differs ( $ftype ) "
hexdump -C old/${ file /.png/_n.png } > $file1
hexdump -C new/${ file /.png/_n.png } > $file2
diff -u $file1 $file2 | head -n 20
return 1
fi
return 0
fi
; ;
2009-05-07 17:38:41 +02:00
/usr/share/locale/*/LC_MESSAGES/*.mo| /usr/share/locale-bundle/*/LC_MESSAGES/*.mo)
2009-07-23 16:35:14 +02:00
for f in old/$file new/$file ; do
sed -i -e "s,POT-Creation-Date: ....-..-.. ..:..+....,POT-Creation-Date: 1970-01-01 00:00+0000," $f
done
; ;
2010-09-11 11:45:06 +02:00
/usr/share/doc/packages/*/*.html| \
/usr/share/doc/kde/HTML/*/*/*.html| /usr/share/doc/*/html/*.html)
2009-08-26 17:01:46 +02:00
for f in old/$file new/$file ; do
2010-05-14 00:47:00 +02:00
# texi2html output, e.g. in kvm, indent, qemu
2010-09-03 16:16:34 +02:00
sed -i -e "s|^<!-- Created on .*, 20.. by texi2html .\...|<!-- Created on August 7, 2009 by texi2html 1.82|" $f
2010-05-12 10:54:49 +02:00
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
2010-05-14 00:47:00 +02:00
# doxygen docu, e.g. in libssh and log4c
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
2010-08-30 12:44:04 +02:00
# Generated on Sat Aug 14 2010 16:49:48 for libssh
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
2009-08-26 17:01:46 +02:00
done
2014-08-19 19:41:06 +02:00
strip_numbered_anchors
2009-08-26 17:01:46 +02:00
; ;
2010-05-14 00:47:00 +02:00
/usr/share/javadoc/*.html | \
2009-07-23 16:35:14 +02:00
/usr/share/javadoc/*/*.html| /usr/share/javadoc/*/*/*.html)
2014-08-19 19:41:06 +02:00
strip_numbered_anchors
2009-07-23 16:35:14 +02:00
# There are more timestamps in html, so far we handle only some primitive versions.
for f in old/$file new/$file ; do
# Javadoc:
2010-05-12 10:54:49 +02:00
sed -i -e "s,^<!-- Generated by javadoc (build [0-9._]*) on ... ... .. ..:..:.. UTC .... -->,^<!-- Generated by javadoc (build 1.6.0_0) on Sun Jul 01 00:00:00 UTC 2000 -->," $f
2009-07-23 16:35:14 +02:00
sed -i -e 's|^<!-- Generated by javadoc on ... ... .. ..:..:.. UTC ....-->$|<!-- Generated by javadoc on Sun Jul 01 00:00:00 UTC 2000-->|' $f
sed -i -e 's|<META NAME="date" CONTENT="20..-..-..">|<META NAME="date" CONTENT="1970-01-01">|' $f
# Gjdoc HtmlDoclet:
2009-11-18 12:04:47 +01:00
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
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
2010-05-14 00:47:00 +02:00
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
2010-05-12 10:54:49 +02:00
# deprecated-list is randomly ordered, sort it for comparison
case $f in
*/deprecated-list.html)
2014-08-19 19:41:06 +02:00
sort -o $f $f
2010-05-12 10:54:49 +02:00
; ;
esac
2009-11-18 12:04:47 +01:00
done
; ;
2010-05-14 00:47:00 +02:00
/usr/share/javadoc/gjdoc.properties | \
2009-11-18 12:04:47 +01:00
/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
2009-07-23 16:35:14 +02:00
done
; ;
*/fonts.scale| */fonts.dir| */encodings.dir)
for f in old/$file new/$file ; do
# sort files before comparing
2010-09-24 00:01:42 +02:00
sort -o $f $f
2009-07-23 16:35:14 +02:00
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
2015-02-03 14:39:06 +01:00
trim_man_TH $f
trim_man_first_line $f
2009-07-23 16:35:14 +02:00
done
; ;
2010-10-28 11:50:21 +02:00
/usr/share/man/man*/*| /usr/lib/texmf/doc/man/*/*)
2015-01-19 10:54:08 +01:00
for f in old/$file new/$file ; do
2015-02-03 14:39:06 +01:00
trim_man_TH $f
trim_man_first_line $f
# generated by docbook xml:
#.\" Date: 09/13/2010
2010-09-21 13:12:14 +02:00
sed -i -e 's|Date: [0-1][0-9]/[0-9][0-9]/201[0-9]|Date: 09/13/2010|' $f
2010-03-05 18:23:23 +01:00
done
; ;
2009-07-23 16:35:14 +02:00
*.elc)
# emacs lisp files
for f in old/$file new/$file ; do
sed -i -e 's|Compiled by abuild@.* on ... ... .. ..:..:.. 20..$|compiled by abuild@buildhost on Wed Jul 01 00:00:00 2009|' $f
done
; ;
2010-10-28 11:50:21 +02:00
/var/lib/texmf/web2c/*/*fmt | \
/var/lib/texmf/web2c/metafont/*.base| \
/var/lib/texmf/web2c/metapost/*.mem)
# binary dump of TeX and Metafont formats, we can ignore them for good
2010-09-24 00:01:42 +02:00
echo " difference in $file ignored. "
return 0
2009-05-07 17:38:41 +02:00
; ;
2009-12-16 15:59:32 +01:00
*/libtool)
for f in old/$file new/$file ; do
sed -i -e 's|^# Libtool was configured on host [a-z0-9]*:$|Libtool was configured on host x42:|' $f
done
; ;
2010-05-12 10:54:49 +02:00
/etc/mail/*cf| /etc/sendmail.cf)
2010-05-08 12:05:08 +02:00
# from sendmail package
for f in old/$file new/$file ; do
# - ##### built by abuild@build33 on Thu May 6 11:21:17 UTC 2010
2010-05-12 10:54:49 +02:00
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
2010-05-08 12:05:08 +02:00
done
; ;
2012-04-05 10:31:42 +02:00
/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
2014-08-19 19:41:06 +02:00
strip_numbered_anchors
2010-05-12 10:54:49 +02:00
; ;
2010-09-21 13:12:14 +02:00
*/created.rid)
# ruby documentation
# file just contains a timestamp and nothing else, so ignore it
echo " Ignore $file "
return 0
; ;
*/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
2014-08-19 19:41:06 +02:00
strip_numbered_anchors
2010-09-21 13:12:14 +02:00
; ;
2011-04-19 15:38:44 +02:00
*/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
; ;
/usr/lib/libreoffice/solver/inc/*/deliver.log)
# LibreOffice log file
echo " Ignore $file "
return 0
; ;
2014-07-17 20:31:37 +02:00
/var/adm/update-messages/*| /var/adm/update-scripts/*)
# encode version-release inside
oldfn = ` echo " $file " | sed -e s/-$release2 /-$release1 /; `
# fetchmsttfonts embeds the release number in the update shell script.
echo sed -i -e " s/- $release1 /- $release2 /g; " " old/ $oldfn "
sed -i -e " s/- $release1 /- $release2 /g; " " old/ $oldfn "
if ! diff -u old/$oldfn new/$file ; then
echo " $oldfn is not same as $file "
return 1
fi
echo " $file and $oldfn are same "
return 0
; ;
2015-02-04 17:13:15 +01:00
*.ps)
for f in " old/ $file " " new/ $file " ; do
sed -i -e '
/^%%CreationDate:[ [ :blank:] ] /d
/^%%Creator:[ [ :blank:] ] groff[ [ :blank:] ] version[ [ :blank:] ] /d
' " $f "
done
; ;
2012-05-07 13:33:30 +02:00
*pdf)
# PDF files contain a unique ID, remove it
# Format of the ID is:
# /ID [<9ACE247A70CF9BEAFEE15E116259BD6D> <9ACE247A70CF9BEAFEE15E116259BD6D>]
2012-05-08 14:40:43 +02:00
# with optional spaces. pdftex creates also:
2012-05-07 16:54:19 +02:00
# /CreationDate (D:20120103083206Z)
# /ModDate (D:20120103083206Z)
2012-05-08 14:40:43 +02:00
# and possibly XML metadata as well
for f in " old/ $file " " new/ $file " ; do
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 "
2012-05-07 13:33:30 +02:00
done
; ;
2009-02-04 04:29:06 +01:00
esac
2015-01-21 13:54:20 +01:00
ftype = ` /usr/bin/file old/$file | sed '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*)
2010-03-26 02:29:16 +01:00
echo " PE32 Mono/.Net assembly: $file "
if [ -x /usr/bin/monodis ] ; then
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
echo " $file differs ( $ftype ) "
diff -u ${ file1 } ${ file2 }
return 1
fi
else
echo "Cannot compare, no monodis installed"
return 1
fi
; ;
2015-01-21 13:54:20 +01:00
ELF*executable*| ELF*[ LM] SB\ shared\ object*)
2009-02-06 20:32:42 +01:00
objdump -d --no-show-raw-insn old/$file | filter_disasm > $file1
2009-05-07 17:38:41 +02:00
if ! test -s $file1 ; then
# objdump has no idea how to handle it
2009-07-14 17:58:02 +02:00
if ! diff_two_files; then
2009-05-07 17:38:41 +02:00
ret = 1
break
fi
fi
2009-02-04 04:29:06 +01:00
sed -i -e "s,old/,," $file1
2009-02-06 20:32:42 +01:00
objdump -d --no-show-raw-insn new/$file | filter_disasm > $file2
2009-02-04 04:29:06 +01:00
sed -i -e "s,new/,," $file2
if ! diff -u $file1 $file2 > $dfile ; then
echo " $file differs in assembler output "
2009-02-06 15:22:35 +01:00
head -n 200 $dfile
2009-05-07 17:38:41 +02:00
return 1
2009-02-04 04:29:06 +01:00
fi
2014-07-03 12:49:49 +02:00
echo "" >$file1
echo "" >$file2
# Don't compare .build-id and .gnu_debuglink sections
2014-11-24 13:18:21 +01:00
sections = " $( objdump -s new/$file | grep "Contents of section .*:" | sed -r "s,.* (.*):,\1,g" | grep -v -e "\.build-id" -e "\.gnu_debuglink" | tr "\n" " " ) "
for section in $sections ; do
2014-07-03 12:49:49 +02:00
objdump -s -j $section old/$file | sed "s,old/,," >> $file1
objdump -s -j $section new/$file | sed "s,new/,," >> $file2
done
2009-02-04 04:29:06 +01:00
if ! diff -u $file1 $file2 > $dfile ; then
echo " $file differs in ELF sections "
head -n 200 $dfile
else
2014-07-22 09:29:15 +02:00
echo " $file : only difference was in build-id or gnu_debuglink, GOOD. "
return 0
2009-02-04 04:29:06 +01:00
fi
2009-05-07 17:38:41 +02:00
return 1
2009-02-04 04:29:06 +01:00
; ;
*ASCII*| *text*)
if ! cmp -s old/$file new/$file ; then
echo " $file differs ( $ftype ) "
2009-02-06 15:22:35 +01:00
diff -u old/$file new/$file | head -n 200
2009-05-07 17:38:41 +02:00
return 1
2009-02-04 04:29:06 +01:00
fi
; ;
2015-02-02 12:57:59 +01:00
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-01-21 13:54:20 +01:00
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
echo " symlink target for $file differs "
return 1
fi
; ;
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
}
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
2014-11-24 13:18:21 +01:00
# preserve cmp_spec result for check_all runs
ret = $RES
2009-02-04 04:29:06 +01:00
for file in $files ; do
2009-05-07 17:38:41 +02:00
if ! check_single_file $file ; then
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-24 13:18:21 +01:00
rm $file1 $file2 $dfile $rename_script
2015-01-21 13:54:20 +01:00
rm -rf $dir
2014-11-27 07:24:39 +01:00
if test " $ret " = 0; then
echo "RPM content is identical"
fi
2009-02-04 04:29:06 +01:00
exit $ret