pkg-kde: commit - rev 33 - people/jd/scripts
Author: jd-guest
Date: 2004-02-12 17:53:52 +0100 (Thu, 12 Feb 2004)
New Revision: 33
Added:
people/jd/scripts/check-replaces
Removed:
people/jd/scripts/check-conflicts.pl
Log:
It has come to my attention that I want to use Replaces, not Conflicts.
script renamed and altered to read Replaces. The concept that a package
conflicts with another package if they contain the same file is kept.
Deleted: people/jd/scripts/check-conflicts.pl
===================================================================
--- people/jd/scripts/check-conflicts.pl 2004-02-11 23:11:04 UTC (rev 32)
+++ people/jd/scripts/check-conflicts.pl 2004-02-12 16:53:52 UTC (rev 33)
@@ -1,135 +0,0 @@
-#!/usr/bin/perl
-
-#
-# check-conflicts - Checks for conflicting files in packages currently
-# in stable, testing and unstable.
-#
-# (c) 2004 David Pashley <david@davidpashley.com>
-# $Id:$
-#
-#
-# This package is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 dated June, 1991.
-#
-# This package is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this package; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA.
-#
-
-
-use warnings;
-use strict;
-use File::Find;
-use Data::Dumper;
-use Cwd;
-
-$|=1;
-
-my %filelist;
-my %conflicts;
-my %control_conflicts;
-my $dir = getcwd;
-
-sub dh_listpackages { # {{{
- my @packages;
- my $current_package;
- open CONTROL, "debian/control" or die "could not open debian/control: $!\n";
- while (<CONTROL>) {
- chomp;
- if (m/Package: (.*)$/) {
- push @packages, $1;
- $current_package = $1;
- }
- if (m/Conflicts: (.*)$/) {
- my %temp;
- for my $conflict ( split /, /, $1) {
- $conflict =~ m/^([\-a-zA-Z0-9]+)( .*)?/;
- $temp{$1} = $conflict;
- }
- $control_conflicts{$current_package} = \%temp;
- }
- }
- close CONTROL;
- return @packages;
-} # }}}
-
-sub load_filelists { # {{{
-
- for my $package (dh_listpackages) {
- find(\&wanted, "debian/$package");
- }
-} # }}}
-
-sub wanted { # {{{
- if (my ($package,$file) = $File::Find::name =~ m|debian/(.*?)/(.*)|) {
- return if $file =~ m/^DEBIAN/;
- return unless -f "$dir/$File::Find::name";
- if (exists $filelist{$file}) {
- print STDERR "$file is in $package and " .$filelist{$file} ."\n";
- } else {
- # TODO You may actually want this to be true.
- $filelist{$file} = $package;
- }
- }
-} # }}}
-
-sub check_Contents { # {{{
-# Yes I kow it is hacky, but it is also the fastest method
-#Benchmark: timing 10 iterations of Compress::Zlib, IO::Zlib, zcat...
-#Compress::Zlib: 55 wallclock secs ( 54.84 usr + 0.19 sys = 55.03 CPU) @ 0.18/s (n=10)
-# IO::Zlib: 115 wallclock secs (114.48 usr + 0.20 sys = 114.68 CPU) @ 0.09/s (n=10)
-# zcat: 23 wallclock secs ( 14.10 usr 0.57 sys + 7.16 cusr 0.65 csys = 22.48 CPU) @ 0.68/s (n=10)
- my $dist = shift;
- my $contents ="/var/cache/apt/ftp.uk.debian.org_debian_dists_${dist}_Contents-i386.gz";
- open ZCAT, "zcat $contents|" or die "could not open $contents: $!\n";
- while (<ZCAT>){ last if m/^FILE /; } # Skip the preamble
- my ($file, $packages);
- while (my $line = <ZCAT>){
- ($file) = $line =~ m/^(.*?)\s/;
- if (exists $filelist{$file}) {
- ($file, $packages) = $line =~ m/^(.*?)\s+(.*)$/;
- my @packages;
- for my $package (split /,/, $packages) {
- $package =~ s#^.*/##;
- push @packages, $package;
- }
- if (@packages = grep !/\Q$filelist{$file}\E/, @packages) {
- #print $filelist{$file} . " conflicts with ". join (', ', @packages) . " $file\n";
- for my $package (@packages) {
- ${ $conflicts{ $filelist{$file} } }->{$package} = $dist;
- }
- }
- }
- }
- close ZCAT;
-} # }}}
-
-
-load_filelists;
-
-print "parsing Contents.gz: ";
-for my $dist ("stable", "testing", "unstable") {
- print "$dist ";
- check_Contents $dist;
-}
-print "done\n";
-
-#print Dumper(\%conflicts);
-for my $package (sort keys %conflicts) {
- print "$package:\n";
- for my $pkg (sort keys %${$conflicts{$package}}) {
- print "\tconflicts with $pkg in " . ${ $conflicts{ $package } }->{$pkg};
- if (exists $control_conflicts{$package}->{$pkg}) {
- print " currently listed as: $control_conflicts{$package}->{$pkg}";
- }
- print "\n";
- }
-}
-
Copied: people/jd/scripts/check-replaces (from rev 31, people/jd/scripts/check-conflicts.pl)
===================================================================
--- people/jd/scripts/check-conflicts.pl 2004-02-11 21:18:39 UTC (rev 31)
+++ people/jd/scripts/check-replaces 2004-02-12 16:53:52 UTC (rev 33)
@@ -0,0 +1,135 @@
+#!/usr/bin/perl
+
+#
+# check-conflicts - Checks for conflicting files in packages currently
+# in stable, testing and unstable.
+#
+# (c) 2004 David Pashley <david@davidpashley.com>
+# $Id:$
+#
+#
+# This package is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 dated June, 1991.
+#
+# This package is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this package; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+#
+
+
+use warnings;
+use strict;
+use File::Find;
+use Data::Dumper;
+use Cwd;
+
+$|=1;
+
+my %filelist;
+my %conflicts;
+my %replaces;
+my $dir = getcwd;
+
+sub dh_listpackages { # {{{
+ my @packages;
+ my $current_package;
+ open CONTROL, "debian/control" or die "could not open debian/control: $!\n";
+ while (<CONTROL>) {
+ chomp;
+ if (m/Package: (.*)$/) {
+ push @packages, $1;
+ $current_package = $1;
+ }
+ if (m/Replaces: (.*)$/) {
+ my %temp;
+ for my $conflict ( split /, /, $1) {
+ $conflict =~ m/^([\-a-zA-Z0-9]+)( .*)?/;
+ $temp{$1} = $conflict;
+ }
+ $replaces{$current_package} = \%temp;
+ }
+ }
+ close CONTROL;
+ return @packages;
+} # }}}
+
+sub load_filelists { # {{{
+
+ for my $package (dh_listpackages) {
+ find(\&wanted, "debian/$package");
+ }
+} # }}}
+
+sub wanted { # {{{
+ if (my ($package,$file) = $File::Find::name =~ m|debian/(.*?)/(.*)|) {
+ return if $file =~ m/^DEBIAN/;
+ return unless -f "$dir/$File::Find::name";
+ if (exists $filelist{$file}) {
+ print STDERR "$file is in $package and " .$filelist{$file} ."\n";
+ } else {
+ # TODO You may actually want this to be true.
+ $filelist{$file} = $package;
+ }
+ }
+} # }}}
+
+sub check_Contents { # {{{
+# Yes I kow it is hacky, but it is also the fastest method
+#Benchmark: timing 10 iterations of Compress::Zlib, IO::Zlib, zcat...
+#Compress::Zlib: 55 wallclock secs ( 54.84 usr + 0.19 sys = 55.03 CPU) @ 0.18/s (n=10)
+# IO::Zlib: 115 wallclock secs (114.48 usr + 0.20 sys = 114.68 CPU) @ 0.09/s (n=10)
+# zcat: 23 wallclock secs ( 14.10 usr 0.57 sys + 7.16 cusr 0.65 csys = 22.48 CPU) @ 0.68/s (n=10)
+ my $dist = shift;
+ my $contents ="/var/cache/apt/ftp.uk.debian.org_debian_dists_${dist}_Contents-i386.gz";
+ open ZCAT, "zcat $contents|" or die "could not open $contents: $!\n";
+ while (<ZCAT>){ last if m/^FILE /; } # Skip the preamble
+ my ($file, $packages);
+ while (my $line = <ZCAT>){
+ ($file) = $line =~ m/^(.*?)\s/;
+ if (exists $filelist{$file}) {
+ ($file, $packages) = $line =~ m/^(.*?)\s+(.*)$/;
+ my @packages;
+ for my $package (split /,/, $packages) {
+ $package =~ s#^.*/##;
+ push @packages, $package;
+ }
+ if (@packages = grep !/\Q$filelist{$file}\E/, @packages) {
+ #print $filelist{$file} . " conflicts with ". join (', ', @packages) . " $file\n";
+ for my $package (@packages) {
+ ${ $conflicts{ $filelist{$file} } }->{$package} = $dist;
+ }
+ }
+ }
+ }
+ close ZCAT;
+} # }}}
+
+
+load_filelists;
+
+print "parsing Contents.gz: ";
+for my $dist ("stable", "testing", "unstable") {
+ print "$dist ";
+ check_Contents $dist;
+}
+print "done\n";
+
+#print Dumper(\%conflicts);
+for my $package (sort keys %conflicts) {
+ print "$package:\n";
+ for my $pkg (sort keys %${$conflicts{$package}}) {
+ print "\tconflicts with $pkg in " . ${ $conflicts{ $package } }->{$pkg};
+ if (exists $replaces{$package}->{$pkg}) {
+ print " currently listed as: $replaces{$package}->{$pkg}";
+ }
+ print "\n";
+ }
+}
+
Reply to: