Update of /cvsroot/fink/fink/perlmod/Fink
In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv21182
Modified Files:
ChangeLog PkgVersion.pm
Log Message:
When checking for obsolete-package violations, only examine first in
each ORed alternative cluster
Index: PkgVersion.pm
===================================================================
RCS file: /cvsroot/fink/fink/perlmod/Fink/PkgVersion.pm,v
retrieving revision 1.576
retrieving revision 1.577
diff -u -d -r1.576 -r1.577
--- PkgVersion.pm 8 Dec 2006 02:02:28 -0000 1.576
+++ PkgVersion.pm 8 Dec 2006 03:33:00 -0000 1.577
@@ -2667,20 +2667,11 @@
my $bool = $self->check_obsolete_violations;
-Check if any packages in the dependencies of this package are
-"obsolete". If any violations found, warn about each such
-case and return true. If not, return false.
-
-All providers of each package name are checked and all alternatives
-are tested. Only one warning is issued for each %n:DEP_FIELD:%n'
-combination over the lifetime of the fink process.
+Return a boolean indicating if any dependencies are "obsolete".
+See the atom_is_obsolete method for details about the checking.
=cut
-{
- # track which BuildDependsOnly violation warnings we've issued
- my %obs_warning_cache = (); # hash of "$pkg\0$deptype\0$dependency"=>1
-
sub check_obsolete_violations {
my $self = shift;
@@ -2690,42 +2681,86 @@
$self->{_obsolete_violations} = 0;
foreach my $field (qw/ BuildDepends Depends Suggests Recommends /) {
+ my @alt_sets = split /\s*,\s*/, $self->pkglist_default($field);
- # test all alternatives
- my @atoms = split /\s*[\,|]\s*/, $self->pkglist_default($field);
+ # test each set of alternatives
+ foreach my $alt_set (@alt_sets) {
+ my @atoms = split /\s*\|\s*/, $alt_set;
- foreach my $depname (@atoms) {
- $depname =~ s/\s*\(.*\)//;
- my $package = Fink::Package->package_by_name($depname);
- next unless defined $package; # skip if no satisfiers
- foreach my $dependent ($package->get_all_providers()) {
- if ($dependent->is_obsolete()) {
- $self->{_obsolete_violations} = 1;
+ # check obsolete status of first satisfiable dependency
+ foreach my $atom (@atoms) {
+ if (defined (my $atom_obs =
$self->atom_is_obsolete($atom, $field))) {
+ $self->{_obsolete_violations} = 1 if
$atom_obs;
+ last;
+ }
+ }
+ }
+ }
- if ($config->verbosity_level() > 1) {
- # whine iff this violation
hasn't been whined-about before
- my $cache_key =
$self->get_name() . "\0" . $field . "\0" . $depname;
- if
(!$obs_warning_cache{$cache_key}++) {
- my $dep_providername =
$dependent->get_name();
- print "\nWARNING: The
package " . $self->get_name() . " $field";
- print " on" if $field
=~ /Depends/;
- print " $depname";
- if ($dep_providername
ne $depname) {
- # virtual pkg
- print "\n\t
(which is provided by $dep_providername)";
- }
- print ",\n\t but
$depname is an obsolete package.\n\n";
- }
+ return $self->{_obsolete_violations};
+}
+
+=item atom_is_obsolete
+
+ my $bool = $self->atom_is_obsolete($atom,$field);
+
+Returns a boolean indicating if the first available provider of the
+given dependency $atom in the given $field name is obsolete. All
+versions of all providers of the given package name are checked
+(versioning is disregarded). An undef is returned if nothing satisfies
+the dependency atom.
+
+If any obsolete dependencies are found, issue a warning. Only one
+warning is issued for each %n:DEP_FIELDNAME:%n' combination over the
+lifetime of the fink process.
+
+=cut
+
+{
+ # track which BuildDependsOnly violation warnings we've issued
+ my %obs_warning_cache = (); # hash of "$pkg\0$deptype\0$dependency"=>1
+
+ # used in warning messages
+ my %dep_verbs = (qw/ depends on builddepends on suggests of recommends
of /);
+
+sub atom_is_obsolete {
+ my $self = shift;
+ my $atom = shift;
+ my $field = shift;
+
+ my $depname = $atom;
+ $depname =~ s/\s*\(.*\)//; # strip off versioning (we check all for
now)
+ my $package = Fink::Package->package_by_name($depname);
+ return undef unless defined $package; # skip if no satisfiers
+
+ my $have_obsolete_deps = 0;
+
+ foreach my $dependent ($package->get_all_providers()) {
+ if ($dependent->is_obsolete()) {
+ $have_obsolete_deps = 1;
+
+ if ($config->verbosity_level() > 1) {
+ # whine iff this violation hasn't been
whined-about before
+ my $cache_key = $self->get_name() . "\0" .
$field . "\0" . $depname;
+ if (!$obs_warning_cache{$cache_key}++) {
+ my $dep_providername =
$dependent->get_name();
+ print "\nWARNING: The package " .
$self->get_name() . " has a preferred $field";
+ print " $dep_verbs{lc $field}" if
exists $dep_verbs{lc $field};
+ print " $depname";
+ if ($dep_providername ne $depname) {
+ # virtual pkg
+ print "\n\t (which is provided
by $dep_providername)";
}
+ print ",\n\t but $depname is an
obsolete package.\n\n";
}
}
}
}
- return $self->{_obsolete_violations};
+ return $have_obsolete_deps;
}
-# check_obsolete_violations has lexical private variables
+# atom_is_obsolete has lexical private variables
}
=item match_package
Index: ChangeLog
===================================================================
RCS file: /cvsroot/fink/fink/perlmod/Fink/ChangeLog,v
retrieving revision 1.1413
retrieving revision 1.1414
diff -u -d -r1.1413 -r1.1414
--- ChangeLog 7 Dec 2006 18:17:24 -0000 1.1413
+++ ChangeLog 8 Dec 2006 03:33:00 -0000 1.1414
@@ -1,3 +1,8 @@
+2006-12-07 Daniel Macks <[EMAIL PROTECTED]>
+
+ * PkgVersion.pm: Only check first alternative in each OR set for
+ being obsolete.
+
2006-12-07 Dave Morrison <[EMAIL PROTECTED]>
* SelfUpdate.pm: (Temporarily) disable rsync updating in
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Fink-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fink-commits