Add file missed in previous commit.
[p5sagit/p5-mst-13.2.git] / lib / CPAN / Distribution.pm
index ef89f6f..0433e33 100644 (file)
@@ -843,6 +843,7 @@ sub try_download {
                     delete $self->{build_dir};
                     return;
                 }
+                binmode($writefh);
                 while (my $x = $readfh->READLINE) {
                     print $writefh $x;
                 }
@@ -2515,6 +2516,10 @@ sub unsat_prereq {
             $available_version = $];
             $available_file = CPAN::find_perl();
         } else {
+            if (CPAN::_sqlite_running()) {
+                CPAN::Index->reload;
+                $CPAN::SQLite->search("CPAN::Module",$need_module);
+            }
             $nmo = $CPAN::META->instance("CPAN::Module",$need_module);
             next if $nmo->uptodate;
             $available_file = $nmo->available_file;
@@ -2694,7 +2699,10 @@ sub read_yaml {
         $CPAN::Frontend->mywarn("Warning: cannot determine META.yml without a build_dir.\n");
         return;
     }
-    my $yaml = File::Spec->catfile($build_dir,"META.yml");
+    # if MYMETA.yml exists, that takes precedence over META.yml
+    my $meta = File::Spec->catfile($build_dir,"META.yml");
+    my $mymeta = File::Spec->catfile($build_dir,"MYMETA.yml");
+    my $yaml = -f $mymeta ? $mymeta : $meta;
     $self->debug("yaml[$yaml]") if $CPAN::DEBUG;
     return unless -f $yaml;
     eval { $self->{yaml_content} = CPAN->_yaml_loadfile($yaml)->[0]; };
@@ -2713,8 +2721,11 @@ sub read_yaml {
             $self->{yaml_content} = +{};
         }
     }
-    if (not exists $self->{yaml_content}{dynamic_config}
-        or $self->{yaml_content}{dynamic_config}
+    # MYMETA.yml is not dynamic by definition
+    if ( $yaml ne $mymeta && 
+         ( not exists $self->{yaml_content}{dynamic_config}
+           or $self->{yaml_content}{dynamic_config}
+         )
        ) {
         $self->{yaml_content} = undef;
     }
@@ -3369,7 +3380,7 @@ sub install {
             $want_install =
                 CPAN::Shell::colorable_makemaker_prompt
                       ("$id is just needed temporarily during building or testing. ".
-                       "Do you want to install it permanently? (Y/n)",
+                       "Do you want to install it permanently?",
                        $default);
         }
     }