Update of /cvsroot/module-build/CPANPLUS-Dist-Build/lib/CPANPLUS/Dist
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23278/lib/CPANPLUS/Dist
Modified Files:
Build.pm
Log Message:
Move the actual prereq checking to a new prereq_satisfied method
Index: Build.pm
===================================================================
RCS file: /cvsroot/module-build/CPANPLUS-Dist-Build/lib/CPANPLUS/Dist/Build.pm,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- Build.pm 23 Sep 2005 22:16:25 -0000 1.8
+++ Build.pm 24 Sep 2005 14:26:05 -0000 1.9
@@ -276,37 +276,8 @@
$dist->status->_mb_object( $mb );
- ### resolve prereqs ###
- # XXX according to Jos, this should actually be in _resolve_prereqs(), not here.
- my $prereqs = $dist->_find_prereqs( verbose => $verbose );
- my %prereqs_out;
-
- for my $mod (keys %$prereqs) {
- # Check whether the installed version (if any) satisfies this
- # prereq. If not, check whether the latest CPAN version
- # satisfies it. If not, fail.
-
- warn "Checking prereq $mod ($prereqs->{$mod})";
+ $self->status->prereqs( $dist->_find_prereqs( verbose => $verbose ) );
- my $status = Module::Build->check_installed_status($mod, $prereqs->{$mod});
- next if $status->{ok};
-
- # Get the latest version from the CPAN index and check it
- no strict 'refs';
- local ${$mod . '::VERSION'} = $cb->module_tree($mod)->version;
- $status = Module::Build->check_installed_status($mod, $prereqs->{$mod});
- if ($status->{ok}) {
- $prereqs_out{$mod} = $status->{have};
- next;
- }
-
- error(loc("This distribution depends on $mod, but the latest version of $mod on CPAN ".
- "doesn't satisfy the specific version dependency ($prereqs->{$mod}). ".
- "Please try to resolve this dependency manually."));
- $fail++;
- }
-
- $self->status->prereqs( \%prereqs_out );
}
### send out test report? ###
@@ -361,6 +332,34 @@
return { %$href };
}
+sub prereq_satisfied {
+ # Return true if this prereq is satisfied. Return false if it's
+ # not. Also issue an error if the latest CPAN version doesn't
+ # satisfy it.
+
+ my ($dist, %args) = @_;
+ my $mb = $dist->status->_mb_object;
+ my $cb = $dist->parent->parent;
+ my $mod = $args{modobj}->module;
+
+ my $status = $mb->check_installed_status($mod, $args{version});
+ return 1 if $status->{ok};
+
+ # Check the latest version from the CPAN index
+ {
+ no strict 'refs';
+ local ${$mod . '::VERSION'} = $args{modobj}->version;
+ $status = $mb->check_installed_status($mod, $args{version});
+ }
+ unless( $status->{ok} ) {
+ error(loc("This distribution depends on $mod, but the latest version of $mod on CPAN ".
+ "doesn't satisfy the specific version dependency ($args{version}). ".
+ "Please try to resolve this dependency manually."));
+ }
+
+ return 0;
+}
+
=pod
=head2 $dist->create([perl => '/path/to/perl', buildflags => 'EXTRA=FLAGS', prereq_target => TARGET, force => BOOL, verbose => BOOL, skiptest => BOOL])
|