summaryrefslogtreecommitdiff
path: root/sysui/desktop/util
diff options
context:
space:
mode:
authorRĂ¼diger Timm <rt@openoffice.org>2006-01-13 13:58:41 +0000
committerRĂ¼diger Timm <rt@openoffice.org>2006-01-13 13:58:41 +0000
commitc988487edc2737c53d6cf4c8f5cb6e07d5aaa8a6 (patch)
treef229d1ee43835433374e66a6418459a4e93b204b /sysui/desktop/util
parent0f4af4670dac0a5758561d6ada959d7406866867 (diff)
INTEGRATION: CWS sysui12 (1.1.2); FILE ADDED
2005/11/11 14:37:14 obr 1.1.2.2: sort by path, not by permissions 2005/11/08 07:54:30 obr 1.1.2.1: package diff tool for regression testing
Diffstat (limited to 'sysui/desktop/util')
-rw-r--r--sysui/desktop/util/pkgdiff.pl106
1 files changed, 106 insertions, 0 deletions
diff --git a/sysui/desktop/util/pkgdiff.pl b/sysui/desktop/util/pkgdiff.pl
new file mode 100644
index 000000000000..d4c9642e0f08
--- /dev/null
+++ b/sysui/desktop/util/pkgdiff.pl
@@ -0,0 +1,106 @@
+: # -*- perl -*-
+eval 'exec perl -wS $0 ${1+"$@"}'
+ if 0;
+
+use File::Temp qw/ tempdir /;
+use File::Basename;
+use Cwd;
+
+$tempdir = tempdir();
+$dir = cwd();
+
+sub unpack_rpm
+{
+ my ($package) = @_;
+
+ system << "EOF"
+rpm --query --queryformat "[trigger%{TRIGGERTYPE} script (through %{TRIGGERSCRIPTPROG}) -- %{TRIGGERNAME} %{TRIGGERVERSION}\n%{TRIGGERSCRIPTS}\n]" --package $package > triggers
+rpm --query --queryformat "%{PREIN}\n" --package $package > prein
+rpm --query --queryformat "%{POSTIN}\n" --package $package > postin
+rpm --query --queryformat "%{PREUN}\n" --package $package > preun
+rpm --query --queryformat "%{POSTUN}\n" --package $package > postun
+rpm --query --queryformat "[%{FILEMODES:perms} %{FILEUSERNAME}/%{FILEGROUPNAME} .%{FILENAMES} -> %{FILELINKTOS}\n]" --package $package | sed 's/ -> \$//' | sort --key=3 -o filelist
+
+rpm2cpio $package | cpio --extract --make-directories
+
+rm --force `sed --silent 's|^lrw.r..r..- root/root \\./\\(.*\\) -> .*|\\1 |p' filelist | tr -d "\\012"`
+EOF
+
+# the last step removes all symbolic links from the extracted file tree as they
+# are handled by diffing the filelist
+}
+
+sub unpack_deb
+{
+ my ($package) = @_;
+
+ system << "EOF"
+ar x $package control.tar.gz data.tar.gz
+tar --extract --ungzip --file=control.tar.gz
+rm --force control control.tar.gz
+tar --extract --ungzip --file=data.tar.gz
+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
+rm --force data.tar.gz
+
+rm --force `sed --silent 's|^lrw.r..r..- root/root \\./\\(.*\\) -> .*|\\1 |p' filelist | tr -d "\\012"`
+EOF
+
+# the last step removes all symbolic links from the extracted file tree as they
+# are handled by diffing the filelist
+}
+
+sub unpack_solpkg
+{
+ my ($package) = @_;
+
+ system << "EOF"
+sed -e '1 d' -e 's/[0-9][0-9]* [0-9][0-9]* [0-9]\\{10\\}\$//' $package/pkgmap > filelist
+grep -v "^PSTAMP=" $package/pkginfo > pkginfo
+cp $package/install/* .
+bzcat $package/archive/none.bz2 | cpio -i -d
+EOF
+}
+
+my $script = basename($0);
+
+die "Usage: $script <package 1> <package 2>\n" unless $#ARGV == 1;
+
+my @pkgroot = ();
+
+while ( $#ARGV >= 0 )
+{
+ my $package = shift;
+
+ # make package paths absolute if necessary
+ $package = $dir . "/" . $package unless $package =~ /^\//;
+
+ my $basename = basename($package);
+
+ # when comparing identically named packages, append a "-2"
+ unless ( mkdir "$tempdir/$basename", 0777 ) {
+ $basename = $basename . "-2";
+ mkdir "$tempdir/$basename", 0777;
+ }
+
+ # change working directory, unpack the package and change back ..
+ die "Unable to change to unpack directory $tempdir/$basename: $!\n" unless chdir "$tempdir/$basename";
+
+ if ( $package =~ /\.rpm$/ ) { unpack_rpm( $package ); }
+ elsif( $package =~ /\.deb$/ ) { unpack_deb( $package ); }
+ elsif( -f "$package/pkgmap" ) { unpack_solpkg( $package ); }
+
+ push @pkgroot, $basename;
+ chdir $dir;
+}
+
+# print "$0\n";
+
+die "Unable to change to working directory $tempdir: $!\n" unless chdir $tempdir;
+
+system "diff -ru @pkgroot[0] @pkgroot[1]";
+system "rm -rf *";
+
+chdir $dir;
+rmdir $tempdir;
+#print STDERR "rm -rf $tempdir\n";
+