In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/6f8f872e565093e8c0e9fdbbbfcebd7c65679c2e?hp=73949fca082fe50bf47755c5ffa328259057ae36>

- Log -----------------------------------------------------------------
commit 6f8f872e565093e8c0e9fdbbbfcebd7c65679c2e
Author: Matthew Horsfall <[email protected]>
Date:   Mon Jun 8 13:07:48 2015 -0400

    bisect-runner.pl: Fix pod.t failures

M       Porting/bisect-runner.pl

commit 63caac6344a12a80c9870a486184342770262f6b
Author: Matthew Horsfall <[email protected]>
Date:   Mon Jun 8 12:43:28 2015 -0400

    bisect.pl: More doc/comment fixups

M       Porting/bisect-runner.pl

commit e815a521be47b9d3908f8c2394e1acbf7e02a577
Author: Matthew Horsfall <[email protected]>
Date:   Mon Jun 8 12:30:50 2015 -0400

    bisect.pl: Slight pod fix to CPAN::MyConfig mentions

M       Porting/bisect-runner.pl

commit c513477368008913839f704b793c43889f25e450
Author: Matthew Horsfall <[email protected]>
Date:   Mon Jun 8 11:45:04 2015 -0400

    bisect.pl: Allow custom CPAN::MyConfig when using --module/--with-module

M       Porting/bisect-runner.pl
M       Porting/bisect.pl

commit 3e0de0e5d9eb8d3519c1e3956d742daf071f7e21
Author: Matthew Horsfall <[email protected]>
Date:   Mon Jun 8 11:21:08 2015 -0400

    bisect.pl: CPAN already writes out CPAN::MyConfig, no need to do it again.

M       Porting/bisect.pl

commit effe640e5d4723ca15c089ab4d60e81bf349aa37
Author: Matthew Horsfall (alh) <[email protected]>
Date:   Sun Apr 19 11:07:54 2015 -0400

    When bisecting with modules, actually use a fresh build dir every build.

M       Porting/bisect-runner.pl

commit 176804e8642f1157c7c52a6bc92259ade24db171
Author: Matthew Horsfall (alh) <[email protected]>
Date:   Sun Apr 19 09:43:21 2015 -0400

    Don't let PERL_MM_OPT/PERL_MB_OPT interfere with bisecting.
    
    INSTALL_BASE for example would cause modules to be installed in the
    wrong place during a bisect.

M       Porting/bisect-runner.pl

commit 120bcf3c851ec91fb9adb04a6383a7c979ae074b
Author: Matthew Horsfall (alh) <[email protected]>
Date:   Sun Apr 19 06:52:46 2015 -0400

    Add notes about bisecting modules that need displays.
    
    Thanks to Andreas for the examples.

M       Porting/bisect-runner.pl

commit fbaf67930c1f5f25ba2b8eaa8574ff86245a343e
Author: Matthew Horsfall (alh) <[email protected]>
Date:   Sun Apr 19 06:34:00 2015 -0400

    For bisecting, create a CPAN::MyConfig under --module or --with-module.
    
    If you bisect with --module or --with-module, older perls need a
    CPAN::MyConfig, otherwise they will stop to ask for user input. This
    commit adds the ability to automatically create one if necessary (with
    some user interaction required.)

M       Porting/bisect-runner.pl
M       Porting/bisect.pl

commit 6822d2c940f8384c8479d9087e76f4bb650a78f6
Author: Matthew Horsfall (alh) <[email protected]>
Date:   Sat Apr 18 15:56:34 2015 -0400

    When bisecting with --module=, don't stop to ask user for input

M       Porting/bisect-runner.pl

commit 4b71a10e70d92312946187a11b1afe4c4b75e706
Author: Matthew Horsfall (alh) <[email protected]>
Date:   Sat Apr 18 15:26:31 2015 -0400

    Allow installing modules from CPAN to be used inside of bisect tests.
    
    For example:
    
      .../Porting/bisect.pl --with-module=Moose -e 'use Moose; 1;'
    
    This is different from --module in that --module only tests that a
    cpan module can or cannot install properly (and pass its tests).

M       Porting/bisect-runner.pl

commit 56bdf8a717c3a6eadb66b1cc1e34a4e0ae4bd315
Author: Matthew Horsfall (alh) <[email protected]>
Date:   Sat Apr 18 09:54:23 2015 -0400

    Adapt Andreas' cpan bisector tool for perl core.
    
    Original can be seen in bin/makeperl.pl of 
http://repo.or.cz/r/andk-cpan-tools.git
    
    Now we can:
    
      .../Porting/bisect.pl --module=autobox
    
    And see when it broke!

M       Porting/bisect-runner.pl
-----------------------------------------------------------------------

Summary of changes:
 Porting/bisect-runner.pl | 140 ++++++++++++++++++++++++++++++++++++++++++++++-
 Porting/bisect.pl        |  48 +++++++++++++++-
 2 files changed, 185 insertions(+), 3 deletions(-)

diff --git a/Porting/bisect-runner.pl b/Porting/bisect-runner.pl
index 383f999..c640d0c 100755
--- a/Porting/bisect-runner.pl
+++ b/Porting/bisect-runner.pl
@@ -4,6 +4,8 @@ use strict;
 use Getopt::Long qw(:config bundling no_auto_abbrev);
 use Pod::Usage;
 use Config;
+use File::Temp qw(tempdir);
+use File::Spec;
 
 my @targets
     = qw(none config.sh config.h miniperl lib/Config.pm Fcntl perl test_prep);
@@ -64,6 +66,7 @@ unless(GetOptions(\%options,
                   'test-build', 'validate',
                   'all-fixups', 'early-fixup=s@', 'late-fixup=s@', 'valgrind',
                   'check-args', 'check-shebang!', 'usage|help|?', 'gold=s',
+                  'module=s', 'with-module=s', 'cpan-config-dir=s',
                   'A=s@',
                   'D=s@' => sub {
                       my (undef, $val) = @_;
@@ -124,7 +127,7 @@ if (defined $target && $target =~ /\.t\z/) {
 }
 
 pod2usage(exitval => 255, verbose => 1)
-    unless @ARGV || $match || $options{'test-build'} || defined 
$options{'one-liner'};
+    unless @ARGV || $match || $options{'test-build'} || defined 
$options{'one-liner'} || defined $options{module};
 pod2usage(exitval => 255, verbose => 1)
     if !$options{'one-liner'} && ($options{l} || $options{w});
 
@@ -160,6 +163,12 @@ bisect.pl - use git bisect to pinpoint changes
  .../Porting/bisect.pl --test-build -Dd_dosuid
  # When did this test program start generating errors from valgrind?
  .../Porting/bisect.pl --valgrind ../test_prog.pl
+ # When did these cpan modules start failing to compile/pass tests?
+ .../Porting/bisect.pl --module=autobox,Moose
+ # When did this code stop working in blead with these modules?
+ .../Porting/bisect.pl --with-module=Moose,Moo -e 'use Moose; 1;'
+ # Like the above 2 but with custom CPAN::MyConfig
+ .../Porting/bisect.pl --module=Moo --cpan-config-dir=/home/blah/custom/
 
 =head1 DESCRIPTION
 
@@ -539,6 +548,69 @@ even link.
 
 =item *
 
+--module module1,module2,...
+
+Install this (or these) module(s), die when it (the last of those)
+cannot be updated to the current version.
+
+Misnomer. the argument can be any argument that can be passed to CPAN
+shell's install command. B<But>: since we only have the uptodate
+command to verify that an install has taken place, we are unable to
+determine success for arguments like
+MSCHWERN/Test-Simple-1.005000_005.tar.gz.
+
+In so far, it is not such a misnomer.
+
+Note that this and I<--with-module> will both require a C<CPAN::MyConfig>.
+If F<$ENV{HOME}/.cpan/CPAN/MyConfig.pm> does not exist, a CPAN shell will
+be started up for you so you can configure one. Feel free to let
+CPAN pick defaults for you. Enter 'quit' when you are done, and
+then everything should be all set. Alternatively, you may
+specify a custom C<CPAN::MyConfig> by using I<--cpan-config-dir>.
+
+Also, if you want to bisect a module that needs a display (like
+TK) and you don't want random screens appearing and disappearing
+on your computer while you're working, you can do something like
+this:
+
+In a terminal:
+
+  $ while true; do date ; if ! ps auxww | grep -v grep | grep -q Xvfb;\
+    then Xvfb :121 & fi; echo -n 'sleeping 60 '; sleep 60; done
+
+And then:
+
+  DISPLAY=":121" .../Porting/bisect.pl --module=TK
+
+(Some display alternatives are vncserver and Xnest.)
+
+=item *
+
+--with-module module1,module2,...
+
+Like I<--module> above, except this simply installs the requested
+modules and they can then be used in other tests.
+
+For example:
+
+  .../Porting/bisect.pl --with-module=Moose -e 'use Moose; ...'
+
+=item *
+
+--cpan-config-dir /home/blah/custom
+
+If defined, this will cause L<CPAN> to look for F<CPAN/MyConfig.pm> inside of
+the specified directory, instead of using the default config of
+F<$ENV{HOME}/.cpan/>.
+
+If no default config exists, a L<CPAN> shell will be fired up for you to
+configure things. Letting L<CPAN> automatically configure things for you
+should work well enough. You probably want to choose I<manual> instead of
+I<local::lib> if it asks. When you're finished with configuration, just
+type I<q> and hit I<ENTER> and the bisect should continue.
+
+=item *
+
 --force-manifest
 
 By default, a build will "skip" if any files listed in F<MANIFEST> are not
@@ -1305,6 +1377,16 @@ foreach my $key (sort keys %defines) {
 }
 push @ARGS, map {"-A$_"} @{$options{A}};
 
+my $prefix;
+
+# Testing a module? We need to install perl/cpan modules to a temp dir
+if ($options{module} || $options{'with-module'}) {
+  $prefix = tempdir(CLEANUP => 1);
+
+  push @ARGS, "-Dprefix=$prefix";
+  push @ARGS, "-Uversiononly", "-Dinstallusrbinperl=n";
+}
+
 # If a file in MANIFEST is missing, Configure asks if you want to
 # continue (the default being 'n'). With stdin closed or /dev/null,
 # it exits immediately and the check for config.sh below will skip.
@@ -1380,6 +1462,62 @@ if ($target ne 'miniperl') {
     system "$options{make} $j $real_target </dev/null";
 }
 
+# Testing a cpan module? See if it will install
+if ($options{module} || $options{'with-module'}) {
+  # First we need to install this perl somewhere
+  system_or_die('./installperl');
+
+  my @m = split(',', $options{module} || $options{'with-module'});
+
+  my $bdir = File::Temp::tempdir(
+    CLEANUP => 1,
+  ) or die $!;
+
+  # Don't ever stop to ask the user for input
+  $ENV{AUTOMATED_TESTING} = 1;
+  $ENV{PERL_MM_USE_DEFAULT} = 1;
+
+  # Don't let these interfere with our cpan installs
+  delete $ENV{PERL_MB_OPT};
+  delete $ENV{PERL_MM_OPT};
+
+  # Make sure we load up our CPAN::MyConfig and then
+  # override the build_dir so we have a fresh one
+  # every build
+  my $cdir = $options{'cpan-config-dir'}
+          || File::Spec->catfile($ENV{HOME},".cpan");
+
+  my @cpanshell = (
+    "$prefix/bin/perl",
+    "-I", "$cdir",
+    "-MCPAN::MyConfig",
+    "-MCPAN",
+    "-e","\$CPAN::Config->{build_dir}=q{$bdir};",
+    "-e",
+  );
+
+  for (@m) {
+    s/-/::/g if /-/ and !m|/|;
+  }
+  my $install = join ",", map { "'$_'" } @m;
+  my $last = $m[-1];
+  my $shellcmd = "install($install); die unless CPAN::Shell->expand(Module => 
'$last')->uptodate;";
+
+  if ($options{module}) {
+    run_report_and_exit(@cpanshell, $shellcmd);
+  } else {
+    my $ret = run_with_options({setprgp => $options{setpgrp},
+                                timeout => $options{timeout},
+                               }, @cpanshell, $shellcmd);
+    $ret &= 0xff if $options{crash};
+
+    # Failed? Give up
+    if ($ret) {
+      report_and_exit(!$ret, 'zero exit from', 'non-zero exit from', "@_");
+    }
+  }
+}
+
 my $expected_file_found = $expected_file =~ /perl$/
     ? -x $expected_file : -r $expected_file;
 
diff --git a/Porting/bisect.pl b/Porting/bisect.pl
index 6e52a4c..68d68d1 100755
--- a/Porting/bisect.pl
+++ b/Porting/bisect.pl
@@ -10,14 +10,37 @@ Documentation for this is in bisect-runner.pl
 # The default, auto_abbrev will treat -e as an abbreviation of --end
 # Which isn't what we want.
 use Getopt::Long qw(:config pass_through no_auto_abbrev);
+use File::Spec;
+use File::Path qw(mkpath);
+
+my ($start, $end, $validate, $usage, $bad, $jobs, $make, $gold,
+    $module, $with_module);
+
+my $need_cpan_config;
+my $cpan_config_dir;
 
-my ($start, $end, $validate, $usage, $bad, $jobs, $make, $gold);
 $bad = !GetOptions('start=s' => \$start, 'end=s' => \$end,
                    'jobs|j=i' => \$jobs, 'make=s' => \$make, 'gold=s' => 
\$gold,
-                   validate => \$validate, 'usage|help|?' => \$usage);
+                   validate => \$validate, 'usage|help|?' => \$usage,
+                   'module=s' => \$module, 'with-module=s' => \$with_module,
+                   'cpan-config-dir=s' => \$cpan_config_dir);
 unshift @ARGV, '--help' if $bad || $usage;
 unshift @ARGV, '--validate' if $validate;
 
+if ($module || $with_module) {
+  unshift @ARGV, '--module', $module if defined $module;
+  unshift @ARGV, '--with-module', $with_module if defined $with_module;
+
+  if ($cpan_config_dir) {
+    my $c = File::Spec->catfile($cpan_config_dir, 'CPAN', 'MyConfig.pm');
+    die "--cpan-config-dir: $c does not exist\n" unless -e $c;
+
+    unshift @ARGV, '--cpan-config-dir', $cpan_config_dir;
+  } else {
+    $need_cpan_config = 1;
+  }
+}
+
 my $runner = $0;
 $runner =~ s/bisect\.pl/bisect-runner.pl/;
 
@@ -49,6 +72,27 @@ if (!defined $jobs &&
 unshift @ARGV, '--jobs', $jobs if defined $jobs;
 unshift @ARGV, '--make', $make if defined $make;
 
+if ($need_cpan_config) {
+  # Make sure we have a CPAN::MyConfig so if we start at an old
+  # revision CPAN doesn't ask for user input to configure itself
+
+  my $cdir = File::Spec->catdir($ENV{HOME},".cpan","CPAN");
+  my $cfile = File::Spec->catfile($cdir, "MyConfig.pm");
+
+  unless (-e $cfile) {
+    printf <<EOF;
+I could not find a CPAN::MyConfig. We need to create one now so that
+you can bisect with --module or --with-module. I'll boot up the CPAN
+shell for you. Feel free to use defaults or change things as needed.
+We recommend using 'manual' over 'local::lib' if it asks.
+
+Type 'quit' when finished.
+
+EOF
+    system("$^X -MCPAN -e shell");
+  }
+}
+
 # We try these in this order for the start revision if none is specified.
 my @stable = map {chomp $_; $_} grep {/v5\.[0-9]+[02468]\.0$/} `git tag -l`;
 die "git tag -l didn't seem to return any tags for stable releases"

--
Perl5 Master Repository

Reply via email to