2 eval 'exec perl -wS $0 ${1+"$@"}'
5 use File
::Temp qw
/ tempdir /;
17 rpm
--query
--queryformat
"[trigger%{TRIGGERTYPE} script (through %{TRIGGERSCRIPTPROG}) -- %{TRIGGERNAME} %{TRIGGERVERSION}\n%{TRIGGERSCRIPTS}\n]" --package $package > triggers
18 rpm
--query
--queryformat
"%{PREIN}\n" --package $package > prein
19 rpm
--query
--queryformat
"%{POSTIN}\n" --package $package > postin
20 rpm
--query
--queryformat
"%{PREUN}\n" --package $package > preun
21 rpm
--query
--queryformat
"%{POSTUN}\n" --package $package > postun
22 rpm
--query
--queryformat
"[%{FILEMODES:perms} %{FILEUSERNAME}/%{FILEGROUPNAME} .%{FILENAMES} -> %{FILELINKTOS}\n]" --package $package | sed
's/ -> \$//' | sort --key
=3 -o filelist
24 rpm2cpio
$package | cpio
--extract
--make
-directories
26 rm
--force
`sed --silent 's|^lrw.r..r..-* root/root \\./\\(.*\\) -> .*|\\1 |p' filelist | tr -d "\\012"`
29 # the last step removes all symbolic links from the extracted file tree as they
30 # are handled by diffing the filelist
38 ar x
$package control
.tar
.gz data
.tar
.gz
39 tar
--extract
--ungzip
--file
=control
.tar
.gz
40 rm
--force control control
.tar
.gz
41 tar
--extract
--ungzip
--file
=data
.tar
.gz
42 tar
--list
--verbose
--ungzip
--file
=data
.tar
.gz
| sed
-e
's| root/root .* \./|- root/root ./|' -e
's|^d\\(.*\\)/\$|d\\1|' | sort --key
=3 -o filelist
43 rm
--force data
.tar
.gz
45 rm
--force
`sed --silent 's|^lrw.r..r..- root/root \\./\\(.*\\) -> .*|\\1 |p' filelist | tr -d "\\012"`
48 # the last step removes all symbolic links from the extracted file tree as they
49 # are handled by diffing the filelist
57 sed
-e
'1 d' -e
's/[0-9][0-9]* [0-9][0-9]* [0-9]\\{10\\}\$//' $package/pkgmap
> filelist
58 grep -v
"^PSTAMP=" $package/pkginfo
> pkginfo
59 cp
$package/install/* .
60 if [ -f
$package/archive/none
.bz2
]; then
61 bzcat
$package/archive/none
.bz2
| cpio
-i
-d
63 cp
-pr
$package/reloc/* .
72 cat
$package | gunzip
| tar
-xf
-
76 my $script = basename
($0);
78 die "Usage: $script <package 1> <package 2>\n" unless $#ARGV == 1;
86 # make package paths absolute if necessary
87 $package = $dir . "/" . $package unless $package =~ /^\
//;
89 my $basename = basename
($package);
91 # when comparing identically named packages, append a "-2"
92 unless ( mkdir "$tempdir/$basename", 0777 ) {
93 $basename = $basename . "-2";
94 mkdir "$tempdir/$basename", 0777;
97 # change working directory, unpack the package and change back ..
98 die "Unable to change to unpack directory $tempdir/$basename: $!\n" unless chdir "$tempdir/$basename";
100 if ( $package =~ /\.rpm$/ ) { unpack_rpm
( $package ); }
101 elsif( $package =~ /\.deb$/ ) { unpack_deb
( $package ); }
102 elsif( -f
"$package/pkgmap" ) { unpack_solpkg
( $package ); }
103 elsif( $package =~ /\.tgz$/ ) { unpack_tgz
( $package ); }
105 push @pkgroot, $basename;
111 die "Unable to change to working directory $tempdir: $!\n" unless chdir $tempdir;
113 system "diff -ru @pkgroot[0] @pkgroot[1]";
118 #print STDERR "rm -rf $tempdir\n";