rurban - support git (and recent perls) 

diff -u  ./configsmoke.pl.orig
--- ./configsmoke.pl.orig	2009-08-10 11:03:31.000000000 +0200
+++ ./configsmoke.pl	2010-04-13 21:32:19.746000000 +0200
@@ -1,4 +1,7 @@
 #!/usr/bin/perl -w
+
+eval 'exec /usr/bin/perl -w -S $0 ${1+"$@"}'
+    if 0; # not running under some shell
 use strict;
 
 use Config;
@@ -20,7 +23,7 @@
 
 # $Id: configsmoke.pl 1241 2009-08-10 09:02:46Z abeltje $
 use vars qw( $VERSION $conf );
-$VERSION = '0.072';
+$VERSION = '0.072_01';
 
 use Getopt::Long;
 my %options = ( 
@@ -127,6 +130,7 @@
 my @syncers = get_avail_sync();
 my $syncmsg = join "\n", @{ { 
     rsync    => "\trsync - Use the rsync(1) program [preferred]",
+    git      => "\tgit - Use git [fast, experimental]",
     ftp      => "\tftp - Use Net::FTP to sync from APC [!slow!]",
     copy     => "\tcopy - Use File::Copy to copy from a local directory",
     hardlink => "\thardlink - Copy from a local directory using link()",
@@ -139,7 +143,7 @@
     my $vdir = $_;
     is_vms and $vdir =~ tr/.//d;
     ( $_ => $vdir )
-} qw( 5.5.x 5.8.x 5.10.x ); # unsupported: 5.6.2
+} qw( 5.5.x 5.8.x 5.10.x 5.12.x 5.13.x ); # unsupported: 5.6.2
 
 my %versions = (
 #    '5.5.x' => { source => 'public.activestate.com::perl-5.005xx',
@@ -171,6 +175,7 @@
 #                 is56x  => 1 },
 
     '5.8.x' => { source =>  'perl5.git.perl.org::perl-5.8.x',
+		 branch => 'maint-5.8',
                  server => 'public.activestate.com',
                  sdir   => '/pub/apc/perl-5.8.x-snap',
                  sfile  => 'perl-5.8.x-latest.tar.gz',
@@ -189,6 +194,7 @@
                  is56x  => 0 },
 
     '5.10.x' => { source =>  'perl5.git.perl.org::perl-5.10.x',
+		  branch => 'maint-5.10',
                   server => 'public.activestate.com',
                   sdir   => '/pub/apc/perl-5.10.x-snap',
                   sfile  => 'perl-5.10.x-latest.tar.gz',
@@ -206,20 +212,40 @@
                             : is_vms ? 'vmsperl.cfg' : 'perl510x.cfg' ),
                   is56x  => 0 },
 
-    '5.11.x' => { source => 'perl5.git.perl.org::perl-current',
+    '5.12.x' => { source =>  'perl5.git.perl.org::perl-5.12.x',
+		  branch => 'maint-5.12',
+                  server => 'public.activestate.com',
+                  sdir   => '/pub/apc/perl-5.12.x-snap',
+                  sfile  => 'perl-5.12.x-latest.tar.gz',
+                  pdir   => '/pub/apc/perl-5.12.x-diffs',
+                  ddir   => File::Spec->catdir( cwd(), File::Spec->updir,
+                                                "perl-$vdirs{'5.12.x'}" ),
+                  ftphost => 'public.activestate.com',
+                  ftpusr  => 'anonymous',
+                  ftppwd  => 'smokers@perl.org',
+                  ftpsdir => '/pub/apc/perl-5.12.x',
+                  ftpcdir => '/pub/apc/perl-5.12.x-diffs',
+ 
+                  text   => 'Perl 5.12 MAINT',
+                  cfg    => ( is_win32 ? 'w32current.cfg'
+                            : is_vms ? 'vmsperl.cfg' : 'perl512x.cfg' ),
+                  is56x  => 0 },
+
+    '5.13.x' => { source => 'perl5.git.perl.org::perl-current',
+		  branch => 'blead',
                   server => 'public.activestate.com',
                   sdir   => '/pub/apc/perl-current-snap',
                   sfile  => 'perl-current-latest.tar.gz',
                   pdir   => '/pub/apc/perl-current-diffs',
                   ddir   => File::Spec->catdir( cwd(), File::Spec->updir,
-                                                'perl-current' ),
+                                                'perl-git' ),
                   ftphost => 'public.activestate.com',
                   ftpusr  => 'anonymous',
                   ftppwd  => 'smokers@perl.org',
                   ftpsdir => '/pub/apc/perl-current',
                   ftpcdir => '/pub/apc/perl-current-diffs',
  
-                  text   => 'Perl 5.12 to-be',
+                  text   => 'Perl 5.14 to-be',
                   cfg    => ( is_win32 ? 'w32current.cfg'
                             : is_vms ? 'vmsperl.cfg' : 'perlcurrent.cfg' ),
                   is56x  => 0 },
@@ -827,7 +853,9 @@
 
 =over 4
 
-=item F<perlcurrent.cfg> for 5.11.x+ on unixy systems
+=item F<perlcurrent.cfg> for 5.13.x+ on unixy systems
+
+=item F<perl512x.cfg> for 5.12.x (MAINT) on unixy systems
 
 =item F<perl510x.cfg> for 5.10.x (MAINT) on unixy systems
 
@@ -987,6 +1015,19 @@
         $config{ $arg } = prompt( $arg );
 
         last SYNCER;
+    };
+
+    /^git$/ && do {
+        $arg = 'branch';
+        $config{ $arg } = prompt( $arg );
+
+        $arg = 'remote';
+        $config{ $arg } = prompt( $arg );
+
+        $arg = 'git';
+        $config{ $arg } = prompt( $arg );
+
+        last SYNCER;
     };
 
     /^ftp$/  && do {
diff -u  ./lib/Test/Smoke/Syncer.pm.orig
--- ./lib/Test/Smoke/Syncer.pm.orig	2009-02-08 12:33:03.000000000 +0100
+++ ./lib/Test/Smoke/Syncer.pm	2010-04-14 18:18:17.605375000 +0200
@@ -3,7 +3,7 @@
 
 # $Id: Syncer.pm 1235 2009-02-08 11:32:39Z abeltje $
 use vars qw( $VERSION );
-$VERSION = '0.027';
+$VERSION = '0.027_01';
 
 use Config;
 use Cwd;
@@ -22,6 +22,12 @@
 
     rsync       => [qw( rsync source opts )],
 
+# these settings have to do synctype==git
+    df_git      => 'git', # you might want a path there
+    df_branch   => 'blead',
+    df_remote   => 'origin', # git remote config
+    git       => [qw( git branch remote )],
+
 # these settings have to do with synctype==snapshot
     df_ftp      => 'Net::FTP',
     df_server   => 'public.activestate.com',
@@ -70,12 +76,12 @@
     ftp        => [qw( ftphost ftpusr ftppwd ftpsdir ftpcdir ftype )],
 
 # misc.
-    valid_type => { rsync => 1, snapshot => 1,
+    valid_type => { rsync => 1, git      => 1, snapshot => 1,
                     copy  => 1, hardlink => 1, ftp => 1 },
 );
 
 {
-    my %allkeys = map { ($_ => 1) } 
+    my %allkeys = map { ($_ => 1) }
         map @{ $CONFIG{ $_ } } => keys %{ $CONFIG{valid_type} };
     push @{ $CONFIG{forest} }, keys %allkeys;
     $CONFIG{valid_type}->{forest} = 1;
@@ -181,6 +187,7 @@
         local *_; $_ = $sync_type;
 
         /^rsync$/    && return Test::Smoke::Syncer::Rsync->new( %fields );
+        /^git$/      && return Test::Smoke::Syncer::Git->new( %fields );
         /^snapshot$/ && return Test::Smoke::Syncer::Snapshot->new( %fields );
         /^copy$/     && return Test::Smoke::Syncer::Copy->new( %fields );
         /^hardlink$/ && return Test::Smoke::Syncer::Hardlink->new( %fields );
@@ -324,6 +331,43 @@
         }
     }
 
+    # There does not seem to be a '.patch', but '.git' and 'make_patchnum.pl'
+    if (-d File::Spec->catfile( $self->{ddir}, ".git") and 
+	-e File::Spec->catfile( $self->{ddir}, "make_patchnum.pl" ))
+    {
+      my $cwd = cwd();
+      chdir $self->{ddir};
+      system "$^X make_patchnum.pl";
+      local *GIT_VERSION_H;
+      my $git_version_h = 'git_version.h';
+      if ( open GIT_VERSION_H, "< $git_version_h" ) {
+        my $declaration_seen = 0;
+        while ( <GIT_VERSION_H> ) {
+            $declaration_seen ||= /define PERL_PATCHNUM /;
+            $declaration_seen && / "(.+)"/ or next;
+            $patch_level = $1 || '?????';
+        }
+	chdir $cwd;
+        # save 'patchlevel.h' mtime, so you can set it on '.patch'
+        my $mtime = ( stat GIT_VERSION_H )[9];
+        close GIT_VERSION_H;
+        # Now create '.patch' and return if $patch_level
+        # The patchlevel is off by one in snapshots
+        if ( $patch_level && $patch_level !~ /-RC\d+$/ ) {
+            if ( open DOTPATCH, "> $dot_patch" ) {
+                print DOTPATCH "$patch_level\n";
+                close DOTPATCH; # no use generating the error
+                utime $mtime, $mtime, $dot_patch;
+            }
+            $self->{patchlevel} = $patch_level;
+            return $self->{patchlevel};
+        } else {
+            $self->{patchlevel} = $patch_level;
+            return $self->{patchlevel}
+        }
+      }
+    }
+
     # There does not seem to be a '.patch', try 'patchlevel.h'
     local *PATCHLEVEL_H;
     my $patchlevel_h = File::Spec->catfile( $self->{ddir}, 'patchlevel.h' );
@@ -413,7 +457,7 @@
 
 =item $syncer->pre_sync
 
-C<pre_sync()> should be called by the C<sync()> methos to setup the
+C<pre_sync()> should be called by the C<sync()> methods to setup the
 sync environment. Currently only useful on I<OpenVMS>.
 
 =cut
@@ -527,6 +571,90 @@
 
     chdir $cwd;
 
+    my $plevel = $self->check_dot_patch;
+    $self->post_sync;
+    return $plevel;
+}
+
+=back
+
+=back
+
+=head1 Test::Smoke::Syncer::Git
+
+This handles syncing with the B<git> program.
+It should only be visible from the "parent-package" so no direct
+user-calls on this.
+
+=over 4
+
+=cut
+
+package Test::Smoke::Syncer::Git;
+
+@Test::Smoke::Syncer::Git::ISA = qw( Test::Smoke::Syncer );
+
+use Cwd;
+
+=item Test::Smoke::Syncer::Git->new( %args )
+
+This creates the new object. Keys for C<%args>:
+
+  * ddir:   destination directory ( ./perl-git )
+  * remote: the remote name, origin = default
+  * branch: the branch name, blead = default
+  * git:    the full path to the git program ( git )
+  * v:      verbose
+
+=cut
+
+sub new {
+    my $proto = shift;
+    my $class = ref $proto ? ref $proto : $proto;
+
+    return bless { @_ }, $class;
+}
+
+sub _gitcmd {
+    my $self = shift;
+    my @args = @_;
+
+    my $redir = $self->{v} ? "" : " >" . File::Spec->devnull;
+    my $command = join " ", $self->{git}, @args;
+    $command .= " --quiet" unless $self->{v};
+    $command .= " $redir";
+    $self->{v} > 1 and print "[$command]\n";
+    if ( system $command ) {
+        my $err = $? >> 8;
+        require Carp;
+        Carp::carp( "Problem during git $args[0] ($err)" );
+    }
+}
+
+=item $object->sync( )
+
+Do the actual sync using the B<git> program.
+
+=cut
+
+sub sync {
+    my $self = shift;
+    $self->pre_sync;
+
+    my $cwd = cwd();
+    chdir $self->{ddir} or do {
+        require Carp;
+        Carp::croak( "[rsync] Cannot chdir($self->{ddir}): $!" );
+    };
+
+    $self->_gitcmd("pull",    "-f", $self->{remote}, "HEAD");
+    $self->_gitcmd("checkout","-f", $self->{branch}); # may try directly remotes/origin/blead
+    #perl5 is generally Makefile safe, but reset it completely
+    $self->_gitcmd("reset", "--hard");
+    $self->_gitcmd("clean", "-dxf");
+
+    chdir $cwd;
+
     my $plevel = $self->check_dot_patch;
     $self->post_sync;
     return $plevel;
diff -u  ./lib/Test/Smoke/Util.pm.orig
--- ./lib/Test/Smoke/Util.pm.orig	2009-10-21 18:54:52.000000000 +0200
+++ ./lib/Test/Smoke/Util.pm	2010-04-13 22:51:42.230375000 +0200
@@ -504,7 +504,8 @@
 sub get_local_patches {
     my( $ddir, $verbose ) = @_;
     $ddir = shift || cwd();
-    my $plevel = catfile( $ddir, 'patchlevel.h' );
+    my $plevel = catfile( $ddir, 'git_version.h' );
+    $plevel = catfile( $ddir, 'patchlevel.h' ) unless -e $plevel;
 
     my @lpatches = ( );
     local *PLEVEL;
@@ -516,7 +517,7 @@
     $verbose and print " open ok\n";
     my( $seen, $patchnum );
     while ( <PLEVEL> ) {
-        $patchnum = $1 if /#define PERL_PATCHNUM\s+(\d+)/;
+        $patchnum = $1 if /#define PERL_PATCHNUM\s+(.+)/;
         $seen && /^\s*,"(.+)"/ and push @lpatches, $1;
         /^\s*static.+?local_patches\[\]/ and $seen++;
     }
diff -u  ./lib/Test/Smoke/perl512x.cfg.orig
--- ./lib/Test/Smoke/perl512x.cfg.orig	2010-04-13 21:26:52.386625000 +0200
+++ ./lib/Test/Smoke/perl512x.cfg	2010-04-13 21:25:58.355375000 +0200
@@ -0,0 +1,53 @@
+# This is a configuration file for the smoke tester.
+# $Id: perl512x.cfg 809 2004-12-03 11:14:47Z abeltje $
+# Lines starting with # are comments.
+# Lines starting with = are section breaks;
+# The rest of the line will be ignored.
+# Lines starting with / signify a pattern to substitute for in Policy.sh
+# They don't count as a normal line
+# This happens to be a section, but because it's *all* just blank lines
+# (comments are ignored) this whole section will be ingored.
+#
+# Each normal line of a section defines a command line argument to Configure
+# A blank line in a normal section means an argument of ""
+# Each line from the first section is tried with each line of the second
+# section with each line of the third section ...
+# As this default configuration file has 3 (non-empty) sections with 2, 5,
+# and 2 lines defining Configure arguments it will build  20 variations of
+# perl, each of them will be tested with $PERLIO = "stdio" and "perlio" so
+# yielding 40 status letters
+
+==
+
+-Duseithreads
+==
+-Uuseperlio
+
+-Duse64bitint
+-Duselongdouble
+-Dusemorebits
+==
+# The pattern must have leading and trailing '/' characters in this
+# configuration file. The smoke tester will globally substitute this pattern
+# with each Congfigure argument in this section  (as well as passing them on
+# the command line to Configure)
+# This is usually used with the cflags parameter in Policy.sh, which defines
+# flags to pass to the C compiler.  The default  Policy.sh contains the line
+# "ccflags='-DDEBUGGING'" and this pattern will cause the value in the '' to
+# be replaced with an empty string and then -DDEBUGGING.
+# (It may seem a bit convaluted making a system to replace  -DDEBUGGING with
+#  the same string  -DDEBUGGING,  but it means that a site's valid Policy.sh
+#  can be used for smoke testing)
+#
+# Hopefully it will not be a problem that the arguments are both substituted
+# into cflags and passed on the commandline to Configure, as  Configure will
+# ignore arguments starting -D that it does not recognise.
+#
+# You can specify the same pattern  in more than one  section.  In this case
+# the substitution replacement will be all  Configure  arguments joined with
+# spaces.   This lets you have one section  testing  ("", "-DDEBUGGING"),  a
+# second testing ("", "-DCRIPPLED_CC") and have cflags set correctly for the
+# 4 combinations.
+/-DDEBUGGING/
+
+-DDEBUGGING
diff -u  ./lib/Test/Smoke/smoke512x_dfconfig.orig
--- ./lib/Test/Smoke/smoke512x_dfconfig.orig	2010-04-13 21:28:11.058500000 +0200
+++ ./lib/Test/Smoke/smoke512x_dfconfig	2010-04-13 21:27:48.464750000 +0200
@@ -0,0 +1,3 @@
+$conf = {
+          'perl_version' => '5.12.x',
+        };
diff -u  ./synctree.pl.orig
--- ./synctree.pl.orig	2008-07-19 11:04:58.000000000 +0200
+++ ./synctree.pl	2010-04-13 21:19:46.667875000 +0200
@@ -1,10 +1,13 @@
-#! /usr/bin/perl -w
+#!/usr/bin/perl -w
+
+eval 'exec /usr/bin/perl -w -S $0 ${1+"$@"}'
+    if 0; # not running under some shell
 use strict;
 $| = 1;
 
 # $Id: synctree.pl 919 2005-12-18 10:06:39Z abeltje $
 use vars qw( $VERSION );
-$VERSION = '0.011';
+$VERSION = '0.011_01';
 
 use File::Spec;
 use FindBin;
@@ -27,7 +30,7 @@
 
 my $defaults = Test::Smoke::Syncer->config( 'all_defaults' );
 
-my %valid_type = map { $_ => 1 } qw( rsync snapshot copy hardlink forest ftp );
+my %valid_type = map { $_ => 1 } qw( rsync git snapshot copy hardlink forest ftp );
 
 =head1 NAME
 
@@ -57,7 +60,7 @@
 =item * B<General options>
 
     -d | --ddir <directory>  Set the directory for the source-tree
-    -t | --type <type>       'rsync', 'snapshot', 'copy', 'ftp' [mandatory]
+    -t | --type <type>       'rsync', 'git', 'snapshot', 'copy', 'ftp' [mandatory]
 
     -v | --verbose <0..2>    Set verbose level
     -h | --help              Show help message (needs Pod::Usage)
@@ -69,6 +72,12 @@
     --rsync <path/to/rsync>  (rsync)
     --opts <rsync-opts>      (-az --delete)
 
+=item * B<options for> -t git
+
+    --branch <name>          (blead)
+    --remote <origin>        (origin)
+    --git <path/to/git>      (git)
+
 =item * B<options for> -t snapshot
 
     --server <ftp-server>    (public.activestate.com)
@@ -124,6 +133,8 @@
 
     'cdir=s',
 
+    'branch=s', 'remote=s',
+
     'ftype=s', 'fdir=s', 'hdir=s',
 
     'help|h', 'man|m',
