[Bps-public-commit] RT-Authen-OpenID branch, rt4, created. 55bb2c0b6db32f70f38d175dc1092ff94d3a8f09

Thomas Sibley trs at bestpractical.com
Mon Mar 11 17:13:01 EDT 2013


The branch, rt4 has been created
        at  55bb2c0b6db32f70f38d175dc1092ff94d3a8f09 (commit)

- Log -----------------------------------------------------------------
commit 38d5253953d6168f20bf05d5e0e281b78a5cd1ca
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Fri Mar 8 17:38:03 2013 -0800

    Update the build toolchain

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..ace61d0
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,14 @@
+blib*
+Makefile
+Makefile.old
+pm_to_blib*
+*.tar.gz
+.lwpcookies
+cover_db
+pod2htm*.tmp
+/RT-Authen-OpenID*
+*.bak
+*.swp
+/MYMETA.*
+/t/tmp
+/xt/tmp
diff --git a/MANIFEST b/MANIFEST
index 941c21a..2234fb1 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -1,9 +1,13 @@
 html/Callbacks/OpenID/autohandler/Auth
+html/Callbacks/OpenID/autohandler/Session
 html/Callbacks/OpenID/Elements/Login/Default
+inc/Module/AutoInstall.pm
 inc/Module/Install.pm
+inc/Module/Install/AutoInstall.pm
 inc/Module/Install/Base.pm
 inc/Module/Install/Can.pm
 inc/Module/Install/Fetch.pm
+inc/Module/Install/Include.pm
 inc/Module/Install/Makefile.pm
 inc/Module/Install/Metadata.pm
 inc/Module/Install/RTx.pm
diff --git a/META.yml b/META.yml
index bb89510..1f7d887 100644
--- a/META.yml
+++ b/META.yml
@@ -3,11 +3,12 @@ abstract: 'Allows RT to do authentication via a service which supports the OpenI
 author:
   - 'Artur Bergman <sky at crucially.net>, Jesse Vincent <jesse at bestpractical.com>'
 build_requires:
-  ExtUtils::MakeMaker: 6.42
+  ExtUtils::MakeMaker: 6.59
 configure_requires:
-  ExtUtils::MakeMaker: 6.42
+  ExtUtils::MakeMaker: 6.59
 distribution_type: module
-generated_by: 'Module::Install version 1.01'
+dynamic_config: 1
+generated_by: 'Module::Install version 1.06'
 license: gpl
 meta-spec:
   url: http://module-build.sourceforge.net/META-spec-v1.4.html
diff --git a/inc/Module/AutoInstall.pm b/inc/Module/AutoInstall.pm
index 60b90ea..aa7aa92 100644
--- a/inc/Module/AutoInstall.pm
+++ b/inc/Module/AutoInstall.pm
@@ -3,11 +3,12 @@ package Module::AutoInstall;
 
 use strict;
 use Cwd                 ();
+use File::Spec          ();
 use ExtUtils::MakeMaker ();
 
 use vars qw{$VERSION};
 BEGIN {
-	$VERSION = '1.03';
+	$VERSION = '1.06';
 }
 
 # special map on pre-defined feature sets
@@ -17,11 +18,14 @@ my %FeatureMap = (
 );
 
 # various lexical flags
-my ( @Missing, @Existing,  %DisabledTests, $UnderCPAN,     $HasCPANPLUS );
+my ( @Missing, @Existing,  %DisabledTests, $UnderCPAN, $InstallDepsTarget, $HasCPANPLUS );
 my (
-    $Config, $CheckOnly, $SkipInstall, $AcceptDefault, $TestOnly, $AllDeps
+    $Config, $CheckOnly, $SkipInstall, $AcceptDefault, $TestOnly, $AllDeps,
+    $UpgradeDeps
 );
-my ( $PostambleActions, $PostambleUsed );
+my ( $PostambleActions, $PostambleActionsNoTest, $PostambleActionsUpgradeDeps,
+    $PostambleActionsUpgradeDepsNoTest, $PostambleActionsListDeps,
+    $PostambleActionsListAllDeps, $PostambleUsed, $NoTest);
 
 # See if it's a testing or non-interactive session
 _accept_default( $ENV{AUTOMATED_TESTING} or ! -t STDIN ); 
@@ -31,6 +35,10 @@ sub _accept_default {
     $AcceptDefault = shift;
 }
 
+sub _installdeps_target {
+    $InstallDepsTarget = shift;
+}
+
 sub missing_modules {
     return @Missing;
 }
@@ -63,6 +71,11 @@ sub _init {
             __PACKAGE__->install( $Config, @Missing = split( /,/, $1 ) );
             exit 0;
         }
+	elsif ( $arg =~ /^--upgradedeps=(.*)$/ ) {
+	    $UpgradeDeps = 1;
+	    __PACKAGE__->install( $Config, @Missing = split( /,/, $1 ) );
+	    exit 0;
+	}
         elsif ( $arg =~ /^--default(?:deps)?$/ ) {
             $AcceptDefault = 1;
         }
@@ -125,7 +138,7 @@ sub import {
     # check entirely since we don't want to have to load (and configure)
     # an old CPAN just for a cosmetic message
 
-    $UnderCPAN = _check_lock(1) unless $SkipInstall;
+    $UnderCPAN = _check_lock(1) unless $SkipInstall || $InstallDepsTarget;
 
     while ( my ( $feature, $modules ) = splice( @args, 0, 2 ) ) {
         my ( @required, @tests, @skiptests );
@@ -175,7 +188,7 @@ sub import {
             }
 
             # XXX: check for conflicts and uninstalls(!) them.
-            my $cur = _load($mod);
+            my $cur = _version_of($mod);
             if (_version_cmp ($cur, $arg) >= 0)
             {
                 print "loaded. ($cur" . ( $arg ? " >= $arg" : '' ) . ")\n";
@@ -207,6 +220,7 @@ sub import {
                 $CheckOnly
                 or ($mandatory and $UnderCPAN)
                 or $AllDeps
+                or $InstallDepsTarget
                 or _prompt(
                     qq{==> Auto-install the }
                       . ( @required / 2 )
@@ -237,10 +251,17 @@ sub import {
         }
     }
 
-    if ( @Missing and not( $CheckOnly or $UnderCPAN ) ) {
+    if ( @Missing and not( $CheckOnly or $UnderCPAN) ) {
         require Config;
-        print
-"*** Dependencies will be installed the next time you type '$Config::Config{make}'.\n";
+        my $make = $Config::Config{make};
+        if ($InstallDepsTarget) {
+            print
+"*** To install dependencies type '$make installdeps' or '$make installdeps_notest'.\n";
+        }
+        else {
+            print
+"*** Dependencies will be installed the next time you type '$make'.\n";
+        }
 
         # make an educated guess of whether we'll need root permission.
         print "    (You may need to do that as the 'root' user.)\n"
@@ -271,6 +292,10 @@ END_MESSAGE
 sub _check_lock {
     return unless @Missing or @_;
 
+    if ($ENV{PERL5_CPANM_IS_RUNNING}) {
+        return _running_under('cpanminus');
+    }
+
     my $cpan_env = $ENV{PERL5_CPAN_IS_RUNNING};
 
     if ($ENV{PERL5_CPANPLUS_IS_RUNNING}) {
@@ -324,7 +349,7 @@ sub install {
     while ( my ( $pkg, $ver ) = splice( @_, 0, 2 ) ) {
 
         # grep out those already installed
-        if ( _version_cmp( _load($pkg), $ver ) >= 0 ) {
+        if ( _version_cmp( _version_of($pkg), $ver ) >= 0 ) {
             push @installed, $pkg;
         }
         else {
@@ -332,6 +357,11 @@ sub install {
         }
     }
 
+    if ($UpgradeDeps) {
+        push @modules, @installed;
+        @installed = ();
+    }
+
     return @installed unless @modules;  # nothing to do
     return @installed if _check_lock(); # defer to the CPAN shell
 
@@ -363,7 +393,7 @@ sub install {
 
     # see if we have successfully installed them
     while ( my ( $pkg, $ver ) = splice( @modules, 0, 2 ) ) {
-        if ( _version_cmp( _load($pkg), $ver ) >= 0 ) {
+        if ( _version_cmp( _version_of($pkg), $ver ) >= 0 ) {
             push @installed, $pkg;
         }
         elsif ( $args{do_once} and open( FAILED, '>> .#autoinstall.failed' ) ) {
@@ -463,6 +493,11 @@ sub _cpanplus_config {
 			} else {
 				die "*** Cannot convert option $key = '$value' to CPANPLUS version.\n";
 			}
+			push @config, 'prereqs', $value;
+		} elsif ( $key eq 'force' ) {
+		    push @config, $key, $value;
+		} elsif ( $key eq 'notest' ) {
+		    push @config, 'skiptest', $value;
 		} else {
 			die "*** Cannot convert option $key to CPANPLUS version.\n";
 		}
@@ -497,10 +532,14 @@ sub _install_cpan {
     # set additional options
     while ( my ( $opt, $arg ) = splice( @config, 0, 2 ) ) {
         ( $args{$opt} = $arg, next )
-          if $opt =~ /^force$/;    # pseudo-option
+          if $opt =~ /^(?:force|notest)$/;    # pseudo-option
         $CPAN::Config->{$opt} = $arg;
     }
 
+    if ($args{notest} && (not CPAN::Shell->can('notest'))) {
+	die "Your version of CPAN is too old to support the 'notest' pragma";
+    }
+
     local $CPAN::Config->{prerequisites_policy} = 'follow';
 
     while ( my ( $pkg, $ver ) = splice( @modules, 0, 2 ) ) {
@@ -519,8 +558,16 @@ sub _install_cpan {
                 delete $INC{$inc};
             }
 
-            my $rv = $args{force} ? CPAN::Shell->force( install => $pkg )
-                                  : CPAN::Shell->install($pkg);
+            my $rv = do {
+		if ($args{force}) {
+		    CPAN::Shell->force( install => $pkg )
+		} elsif ($args{notest}) {
+		    CPAN::Shell->notest( install => $pkg )
+		} else {
+		    CPAN::Shell->install($pkg)
+		}
+	    };
+
             $rv ||= eval {
                 $CPAN::META->instance( 'CPAN::Distribution', $obj->cpan_file, )
                   ->{install}
@@ -575,7 +622,7 @@ sub _update_to {
     my $ver   = shift;
 
     return
-      if _version_cmp( _load($class), $ver ) >= 0;  # no need to upgrade
+      if _version_cmp( _version_of($class), $ver ) >= 0;  # no need to upgrade
 
     if (
         _prompt( "==> A newer version of $class ($ver) is required. Install?",
@@ -660,16 +707,30 @@ sub _can_write {
 
 # load a module and return the version it reports
 sub _load {
-    my $mod  = pop;    # class/instance doesn't matter
+    my $mod  = pop; # method/function doesn't matter
     my $file = $mod;
-
     $file =~ s|::|/|g;
     $file .= '.pm';
-
     local $@;
     return eval { require $file; $mod->VERSION } || ( $@ ? undef: 0 );
 }
 
+# report version without loading a module
+sub _version_of {
+    my $mod = pop; # method/function doesn't matter
+    my $file = $mod;
+    $file =~ s|::|/|g;
+    $file .= '.pm';
+    foreach my $dir ( @INC ) {
+        next if ref $dir;
+        my $path = File::Spec->catfile($dir, $file);
+        next unless -e $path;
+        require ExtUtils::MM_Unix;
+        return ExtUtils::MM_Unix->parse_version($path);
+    }
+    return undef;
+}
+
 # Load CPAN.pm and it's configuration
 sub _load_cpan {
     return if $CPAN::VERSION and $CPAN::Config and not @_;
@@ -763,6 +824,35 @@ sub _make_args {
         : "\$(NOECHO) \$(NOOP)"
     );
 
+    my $deps_list = join( ',', @Missing, @Existing );
+
+    $PostambleActionsUpgradeDeps =
+        "\$(PERL) $0 --config=$config --upgradedeps=$deps_list";
+
+    my $config_notest =
+      join( ',', (UNIVERSAL::isa( $Config, 'HASH' ) ? %{$Config} : @{$Config}),
+	  'notest', 1 )
+      if $Config;
+
+    $PostambleActionsNoTest = (
+        ($missing and not $UnderCPAN)
+        ? "\$(PERL) $0 --config=$config_notest --installdeps=$missing"
+        : "\$(NOECHO) \$(NOOP)"
+    );
+
+    $PostambleActionsUpgradeDepsNoTest =
+        "\$(PERL) $0 --config=$config_notest --upgradedeps=$deps_list";
+
+    $PostambleActionsListDeps =
+        '@$(PERL) -le "print for @ARGV" '
+            . join(' ', map $Missing[$_], grep $_ % 2 == 0, 0..$#Missing);
+
+    my @all = (@Missing, @Existing);
+
+    $PostambleActionsListAllDeps =
+        '@$(PERL) -le "print for @ARGV" '
+            . join(' ', map $all[$_], grep $_ % 2 == 0, 0..$#all);
+
     return %args;
 }
 
@@ -797,11 +887,15 @@ sub Write {
 
 sub postamble {
     $PostambleUsed = 1;
+    my $fragment;
 
-    return <<"END_MAKE";
+    $fragment .= <<"AUTO_INSTALL" if !$InstallDepsTarget;
 
 config :: installdeps
 \t\$(NOECHO) \$(NOOP)
+AUTO_INSTALL
+
+    $fragment .= <<"END_MAKE";
 
 checkdeps ::
 \t\$(PERL) $0 --checkdeps
@@ -809,12 +903,28 @@ checkdeps ::
 installdeps ::
 \t$PostambleActions
 
+installdeps_notest ::
+\t$PostambleActionsNoTest
+
+upgradedeps ::
+\t$PostambleActionsUpgradeDeps
+
+upgradedeps_notest ::
+\t$PostambleActionsUpgradeDepsNoTest
+
+listdeps ::
+\t$PostambleActionsListDeps
+
+listalldeps ::
+\t$PostambleActionsListAllDeps
+
 END_MAKE
 
+    return $fragment;
 }
 
 1;
 
 __END__
 
-#line 1071
+#line 1193
diff --git a/inc/Module/Install.pm b/inc/Module/Install.pm
index 74caf9c..4ecf46b 100644
--- a/inc/Module/Install.pm
+++ b/inc/Module/Install.pm
@@ -31,7 +31,7 @@ BEGIN {
 	# This is not enforced yet, but will be some time in the next few
 	# releases once we can make sure it won't clash with custom
 	# Module::Install extensions.
-	$VERSION = '1.01';
+	$VERSION = '1.06';
 
 	# Storage for the pseudo-singleton
 	$MAIN    = undef;
@@ -451,7 +451,7 @@ sub _version ($) {
 }
 
 sub _cmp ($$) {
-	_version($_[0]) <=> _version($_[1]);
+	_version($_[1]) <=> _version($_[2]);
 }
 
 # Cloned from Params::Util::_CLASS
@@ -467,4 +467,4 @@ sub _CLASS ($) {
 
 1;
 
-# Copyright 2008 - 2011 Adam Kennedy.
+# Copyright 2008 - 2012 Adam Kennedy.
diff --git a/inc/Module/Install/AutoInstall.pm b/inc/Module/Install/AutoInstall.pm
index bc3d172..6efe4fe 100644
--- a/inc/Module/Install/AutoInstall.pm
+++ b/inc/Module/Install/AutoInstall.pm
@@ -6,7 +6,7 @@ use Module::Install::Base ();
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '1.01';
+	$VERSION = '1.06';
 	@ISA     = 'Module::Install::Base';
 	$ISCORE  = 1;
 }
@@ -73,6 +73,17 @@ sub auto_install {
     );
 }
 
+sub installdeps_target {
+    my ($self, @args) = @_;
+
+    $self->include('Module::AutoInstall');
+    require Module::AutoInstall;
+
+    Module::AutoInstall::_installdeps_target(1);
+
+    $self->auto_install(@args);
+}
+
 sub auto_install_now {
     my $self = shift;
     $self->auto_install(@_);
diff --git a/inc/Module/Install/Base.pm b/inc/Module/Install/Base.pm
index d3662c9..802844a 100644
--- a/inc/Module/Install/Base.pm
+++ b/inc/Module/Install/Base.pm
@@ -4,7 +4,7 @@ package Module::Install::Base;
 use strict 'vars';
 use vars qw{$VERSION};
 BEGIN {
-	$VERSION = '1.01';
+	$VERSION = '1.06';
 }
 
 # Suspend handler for "redefined" warnings
diff --git a/inc/Module/Install/Can.pm b/inc/Module/Install/Can.pm
index 276409a..22167b8 100644
--- a/inc/Module/Install/Can.pm
+++ b/inc/Module/Install/Can.pm
@@ -3,13 +3,12 @@ package Module::Install::Can;
 
 use strict;
 use Config                ();
-use File::Spec            ();
 use ExtUtils::MakeMaker   ();
 use Module::Install::Base ();
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '1.01';
+	$VERSION = '1.06';
 	@ISA     = 'Module::Install::Base';
 	$ISCORE  = 1;
 }
@@ -29,7 +28,7 @@ sub can_use {
 	eval { require $mod; $pkg->VERSION($ver || 0); 1 };
 }
 
-# check if we can run some command
+# Check if we can run some command
 sub can_run {
 	my ($self, $cmd) = @_;
 
@@ -38,14 +37,88 @@ sub can_run {
 
 	for my $dir ((split /$Config::Config{path_sep}/, $ENV{PATH}), '.') {
 		next if $dir eq '';
-		my $abs = File::Spec->catfile($dir, $_[1]);
+		require File::Spec;
+		my $abs = File::Spec->catfile($dir, $cmd);
 		return $abs if (-x $abs or $abs = MM->maybe_command($abs));
 	}
 
 	return;
 }
 
-# can we locate a (the) C compiler
+# Can our C compiler environment build XS files
+sub can_xs {
+	my $self = shift;
+
+	# Ensure we have the CBuilder module
+	$self->configure_requires( 'ExtUtils::CBuilder' => 0.27 );
+
+	# Do we have the configure_requires checker?
+	local $@;
+	eval "require ExtUtils::CBuilder;";
+	if ( $@ ) {
+		# They don't obey configure_requires, so it is
+		# someone old and delicate. Try to avoid hurting
+		# them by falling back to an older simpler test.
+		return $self->can_cc();
+	}
+
+	# Do we have a working C compiler
+	my $builder = ExtUtils::CBuilder->new(
+		quiet => 1,
+	);
+	unless ( $builder->have_compiler ) {
+		# No working C compiler
+		return 0;
+	}
+
+	# Write a C file representative of what XS becomes
+	require File::Temp;
+	my ( $FH, $tmpfile ) = File::Temp::tempfile(
+		"compilexs-XXXXX",
+		SUFFIX => '.c',
+	);
+	binmode $FH;
+	print $FH <<'END_C';
+#include "EXTERN.h"
+#include "perl.h"
+#include "XSUB.h"
+
+int main(int argc, char **argv) {
+    return 0;
+}
+
+int boot_sanexs() {
+    return 1;
+}
+
+END_C
+	close $FH;
+
+	# Can the C compiler access the same headers XS does
+	my @libs   = ();
+	my $object = undef;
+	eval {
+		local $^W = 0;
+		$object = $builder->compile(
+			source => $tmpfile,
+		);
+		@libs = $builder->link(
+			objects     => $object,
+			module_name => 'sanexs',
+		);
+	};
+	my $result = $@ ? 0 : 1;
+
+	# Clean up all the build files
+	foreach ( $tmpfile, $object, @libs ) {
+		next unless defined $_;
+		1 while unlink;
+	}
+
+	return $result;
+}
+
+# Can we locate a (the) C compiler
 sub can_cc {
 	my $self   = shift;
 	my @chunks = split(/ /, $Config::Config{cc}) or return;
@@ -78,4 +151,4 @@ if ( $^O eq 'cygwin' ) {
 
 __END__
 
-#line 156
+#line 236
diff --git a/inc/Module/Install/Fetch.pm b/inc/Module/Install/Fetch.pm
index 093cb7a..bee0c4f 100644
--- a/inc/Module/Install/Fetch.pm
+++ b/inc/Module/Install/Fetch.pm
@@ -6,7 +6,7 @@ use Module::Install::Base ();
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '1.01';
+	$VERSION = '1.06';
 	@ISA     = 'Module::Install::Base';
 	$ISCORE  = 1;
 }
diff --git a/inc/Module/Install/Include.pm b/inc/Module/Install/Include.pm
index 90cc979..8310e4c 100644
--- a/inc/Module/Install/Include.pm
+++ b/inc/Module/Install/Include.pm
@@ -6,7 +6,7 @@ use Module::Install::Base ();
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '1.01';
+	$VERSION = '1.06';
 	@ISA     = 'Module::Install::Base';
 	$ISCORE  = 1;
 }
diff --git a/inc/Module/Install/Makefile.pm b/inc/Module/Install/Makefile.pm
index 4c71003..7052f36 100644
--- a/inc/Module/Install/Makefile.pm
+++ b/inc/Module/Install/Makefile.pm
@@ -8,7 +8,7 @@ use Fcntl qw/:flock :seek/;
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '1.01';
+	$VERSION = '1.06';
 	@ISA     = 'Module::Install::Base';
 	$ISCORE  = 1;
 }
@@ -215,18 +215,22 @@ sub write {
 	require ExtUtils::MakeMaker;
 
 	if ( $perl_version and $self->_cmp($perl_version, '5.006') >= 0 ) {
-		# MakeMaker can complain about module versions that include
-		# an underscore, even though its own version may contain one!
-		# Hence the funny regexp to get rid of it.  See RT #35800
-		# for details.
-		my $v = $ExtUtils::MakeMaker::VERSION =~ /^(\d+\.\d+)/;
-		$self->build_requires(     'ExtUtils::MakeMaker' => $v );
-		$self->configure_requires( 'ExtUtils::MakeMaker' => $v );
+		# This previous attempted to inherit the version of
+		# ExtUtils::MakeMaker in use by the module author, but this
+		# was found to be untenable as some authors build releases
+		# using future dev versions of EU:MM that nobody else has.
+		# Instead, #toolchain suggests we use 6.59 which is the most
+		# stable version on CPAN at time of writing and is, to quote
+		# ribasushi, "not terminally fucked, > and tested enough".
+		# TODO: We will now need to maintain this over time to push
+		# the version up as new versions are released.
+		$self->build_requires(     'ExtUtils::MakeMaker' => 6.59 );
+		$self->configure_requires( 'ExtUtils::MakeMaker' => 6.59 );
 	} else {
 		# Allow legacy-compatibility with 5.005 by depending on the
 		# most recent EU:MM that supported 5.005.
-		$self->build_requires(     'ExtUtils::MakeMaker' => 6.42 );
-		$self->configure_requires( 'ExtUtils::MakeMaker' => 6.42 );
+		$self->build_requires(     'ExtUtils::MakeMaker' => 6.36 );
+		$self->configure_requires( 'ExtUtils::MakeMaker' => 6.36 );
 	}
 
 	# Generate the MakeMaker params
@@ -241,7 +245,6 @@ in a module, and provide its file path via 'version_from' (or
 'all_from' if you prefer) in Makefile.PL.
 EOT
 
-	$DB::single = 1;
 	if ( $self->tests ) {
 		my @tests = split ' ', $self->tests;
 		my %seen;
@@ -412,4 +415,4 @@ sub postamble {
 
 __END__
 
-#line 541
+#line 544
diff --git a/inc/Module/Install/Metadata.pm b/inc/Module/Install/Metadata.pm
index 3b01e09..58430f3 100644
--- a/inc/Module/Install/Metadata.pm
+++ b/inc/Module/Install/Metadata.pm
@@ -6,7 +6,7 @@ use Module::Install::Base ();
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '1.01';
+	$VERSION = '1.06';
 	@ISA     = 'Module::Install::Base';
 	$ISCORE  = 1;
 }
@@ -151,15 +151,21 @@ sub install_as_site   { $_[0]->installdirs('site')   }
 sub install_as_vendor { $_[0]->installdirs('vendor') }
 
 sub dynamic_config {
-	my $self = shift;
-	unless ( @_ ) {
-		warn "You MUST provide an explicit true/false value to dynamic_config\n";
-		return $self;
+	my $self  = shift;
+	my $value = @_ ? shift : 1;
+	if ( $self->{values}->{dynamic_config} ) {
+		# Once dynamic we never change to static, for safety
+		return 0;
 	}
-	$self->{values}->{dynamic_config} = $_[0] ? 1 : 0;
+	$self->{values}->{dynamic_config} = $value ? 1 : 0;
 	return 1;
 }
 
+# Convenience command
+sub static_config {
+	shift->dynamic_config(0);
+}
+
 sub perl_version {
 	my $self = shift;
 	return $self->{values}->{perl_version} unless @_;
@@ -170,7 +176,7 @@ sub perl_version {
 	# Normalize the version
 	$version = $self->_perl_version($version);
 
-	# We don't support the reall old versions
+	# We don't support the really old versions
 	unless ( $version >= 5.005 ) {
 		die "Module::Install only supports 5.005 or newer (use ExtUtils::MakeMaker)\n";
 	}
@@ -582,7 +588,7 @@ sub bugtracker_from {
 sub requires_from {
 	my $self     = shift;
 	my $content  = Module::Install::_readperl($_[0]);
-	my @requires = $content =~ m/^use\s+([^\W\d]\w*(?:::\w+)*)\s+([\d\.]+)/mg;
+	my @requires = $content =~ m/^use\s+([^\W\d]\w*(?:::\w+)*)\s+(v?[\d\.]+)/mg;
 	while ( @requires ) {
 		my $module  = shift @requires;
 		my $version = shift @requires;
diff --git a/inc/Module/Install/RTx.pm b/inc/Module/Install/RTx.pm
index 73b9cda..abf6aea 100644
--- a/inc/Module/Install/RTx.pm
+++ b/inc/Module/Install/RTx.pm
@@ -8,13 +8,13 @@ no warnings 'once';
 
 use Module::Install::Base;
 use base 'Module::Install::Base';
-our $VERSION = '0.29';
+our $VERSION = '0.30';
 
 use FindBin;
 use File::Glob     ();
 use File::Basename ();
 
-my @DIRS = qw(etc lib html bin sbin po var);
+my @DIRS = qw(etc lib html static bin sbin po var);
 my @INDEX_DIRS = qw(lib bin sbin);
 
 sub RTx {
@@ -62,10 +62,11 @@ sub RTx {
     unshift @INC, "$RT::LocalPath/lib" if $RT::LocalPath;
     unshift @INC, $lib_path;
 
-    $RT::LocalVarPath  ||= $RT::VarPath;
-    $RT::LocalPoPath   ||= $RT::LocalLexiconPath;
-    $RT::LocalHtmlPath ||= $RT::MasonComponentRoot;
-    $RT::LocalLibPath  ||= "$RT::LocalPath/lib";
+    $RT::LocalVarPath    ||= $RT::VarPath;
+    $RT::LocalPoPath     ||= $RT::LocalLexiconPath;
+    $RT::LocalHtmlPath   ||= $RT::MasonComponentRoot;
+    $RT::LocalStaticPath ||= $RT::StaticPath;
+    $RT::LocalLibPath    ||= "$RT::LocalPath/lib";
 
     my $with_subdirs = $ENV{WITH_SUBDIRS};
     @ARGV = grep { /WITH_SUBDIRS=(.*)/ ? ( ( $with_subdirs = $1 ), 0 ) : 1 }
@@ -129,18 +130,7 @@ install ::
 
     my %has_etc;
     if ( File::Glob::bsd_glob("$FindBin::Bin/etc/schema.*") ) {
-
-        # got schema, load factory module
         $has_etc{schema}++;
-        $self->load('RTxFactory');
-        $self->postamble(<< ".");
-factory ::
-\t\$(NOECHO) \$(PERL) -Ilib -I"$local_lib_path" -I"$lib_path" -Minc::Module::Install -e"RTxFactory(qw($RTx $name))"
-
-dropdb ::
-\t\$(NOECHO) \$(PERL) -Ilib -I"$local_lib_path" -I"$lib_path" -Minc::Module::Install -e"RTxFactory(qw($RTx $name drop))"
-
-.
     }
     if ( File::Glob::bsd_glob("$FindBin::Bin/etc/acl.*") ) {
         $has_etc{acl}++;
@@ -164,28 +154,19 @@ dropdb ::
         print "For first-time installation, type 'make initdb'.\n";
         my $initdb = '';
         $initdb .= <<"." if $has_etc{schema};
-\t\$(NOECHO) \$(PERL) -Ilib -I"$local_lib_path" -I"$lib_path" -Minc::Module::Install -e"RTxInitDB(qw(schema))"
+\t\$(NOECHO) \$(PERL) -Ilib -I"$local_lib_path" -I"$lib_path" -Minc::Module::Install -e"RTxInitDB(qw(schema \$(NAME) \$(VERSION)))"
 .
         $initdb .= <<"." if $has_etc{acl};
-\t\$(NOECHO) \$(PERL) -Ilib -I"$local_lib_path" -I"$lib_path" -Minc::Module::Install -e"RTxInitDB(qw(acl))"
+\t\$(NOECHO) \$(PERL) -Ilib -I"$local_lib_path" -I"$lib_path" -Minc::Module::Install -e"RTxInitDB(qw(acl \$(NAME) \$(VERSION)))"
 .
         $initdb .= <<"." if $has_etc{initialdata};
-\t\$(NOECHO) \$(PERL) -Ilib -I"$local_lib_path" -I"$lib_path" -Minc::Module::Install -e"RTxInitDB(qw(insert))"
+\t\$(NOECHO) \$(PERL) -Ilib -I"$local_lib_path" -I"$lib_path" -Minc::Module::Install -e"RTxInitDB(qw(insert \$(NAME) \$(VERSION)))"
 .
         $self->postamble("initdb ::\n$initdb\n");
         $self->postamble("initialize-database ::\n$initdb\n");
     }
 }
 
-sub RTxInit {
-    unshift @INC, substr( delete( $INC{'RT.pm'} ), 0, -5 ) if $INC{'RT.pm'};
-    require RT;
-    RT::LoadConfig();
-    RT::ConnectToDatabase();
-
-    die "Cannot load RT" unless $RT::Handle and $RT::DatabaseType;
-}
-
 # stolen from RT::Handle so we work on 3.6 (cmp_versions came in with 3.8)
 { my %word = (
     a     => -4,
@@ -228,4 +209,4 @@ sub requires_rt {
 
 __END__
 
-#line 348
+#line 329
diff --git a/inc/Module/Install/Win32.pm b/inc/Module/Install/Win32.pm
index 3139a63..eeaa3fe 100644
--- a/inc/Module/Install/Win32.pm
+++ b/inc/Module/Install/Win32.pm
@@ -6,7 +6,7 @@ use Module::Install::Base ();
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '1.01';
+	$VERSION = '1.06';
 	@ISA     = 'Module::Install::Base';
 	$ISCORE  = 1;
 }
diff --git a/inc/Module/Install/WriteAll.pm b/inc/Module/Install/WriteAll.pm
index 1f724a7..85d8018 100644
--- a/inc/Module/Install/WriteAll.pm
+++ b/inc/Module/Install/WriteAll.pm
@@ -6,7 +6,7 @@ use Module::Install::Base ();
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '1.01';
+	$VERSION = '1.06';
 	@ISA     = qw{Module::Install::Base};
 	$ISCORE  = 1;
 }

commit 1a49c6fd3d7fbdebbd80152e9b8eab1183c89774
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Fri Mar 8 17:43:09 2013 -0800

    Fix indent

diff --git a/html/Callbacks/OpenID/autohandler/Session b/html/Callbacks/OpenID/autohandler/Session
index eb0db57..c414792 100644
--- a/html/Callbacks/OpenID/autohandler/Session
+++ b/html/Callbacks/OpenID/autohandler/Session
@@ -11,9 +11,9 @@ my $check_url;
 
 # Livejournal misencodes responses...
 if ($ARGS{'openid.sig'}) {
-my $sig = $m->cgi_object->param('openid.sig') ||'';
-$sig =~ s/ /+/g;
-$m->cgi_object->param( 'openid.sig' => $sig );
+    my $sig = $m->cgi_object->param('openid.sig') ||'';
+    $sig =~ s/ /+/g;
+    $m->cgi_object->param( 'openid.sig' => $sig );
 }
 
 

commit 8ebc621b8286fcfdb9a5d2f281663fe4fe7b0689
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Fri Mar 8 17:51:17 2013 -0800

    Switch to 3.8-style config and static object access

diff --git a/html/Callbacks/OpenID/Elements/Login/Default b/html/Callbacks/OpenID/Elements/Login/Default
index 8b530b7..26844ef 100644
--- a/html/Callbacks/OpenID/Elements/Login/Default
+++ b/html/Callbacks/OpenID/Elements/Login/Default
@@ -1,5 +1,5 @@
 <%init>
-return unless ($RT::EnableOpenId);
+return unless (RT->Config->Get("EnableOpenId"));
 </%init>
 <h3><&|/l&>Have an <em>OpenID</em>?</&></h3>
 <p><% loc('Log in with it and have a look around.') %></p>
diff --git a/html/Callbacks/OpenID/autohandler/Session b/html/Callbacks/OpenID/autohandler/Session
index c414792..98db1c5 100644
--- a/html/Callbacks/OpenID/autohandler/Session
+++ b/html/Callbacks/OpenID/autohandler/Session
@@ -1,5 +1,5 @@
 <%INIT>
-return unless ($RT::EnableOpenId);
+return unless (RT->Config->Get("EnableOpenId"));
 
 use Net::OpenID::Consumer;
 use LWPx::ParanoidAgent;
@@ -17,26 +17,26 @@ if ($ARGS{'openid.sig'}) {
 }
 
 
-my $root_user = RT::User->new($RT::SystemUser);
+my $root_user = RT::User->new(RT->SystemUser);
 my $csr = Net::OpenID::Consumer->new(
     ua              => LWPx::ParanoidAgent->new,
     args            => \%ARGS,
     cache           => Cache::FileCache->new,
-    consumer_secret => 'x'.$RT::DatabasePassword,
-    required_root   => $RT::WebURL,
+    consumer_secret => 'x'.RT->Config->Get("DatabasePassword"),
+    required_root   => RT->Config->Get("WebURL"),
 );
 
 
 if ($openid_url) {
     if ( my $claimed_identity = $csr->claimed_identity("$openid_url")) {
         $check_url = $claimed_identity->check_url(
-                return_to      => $RT::WebURL,
+                return_to      => RT->Config->Get("WebURL"),
                 delayed_return => 1,
-                trust_root     => $RT::WebURL,
+                trust_root     => RT->Config->Get("WebURL"),
                 );
         RT::Interface::Web::Redirect($check_url);
     } else {
-        $RT::Logger->error("OpenID login failure for $openid_url code $csr->{last_errcode} error $csr->{last_errtext}");
+        RT->Logger->error("OpenID login failure for $openid_url code $csr->{last_errcode} error $csr->{last_errtext}");
         # we should end up skipping the rest now
     }
 }
@@ -67,9 +67,9 @@ if ( ( not $session{'CurrentUser'} or not $session{'CurrentUser'}->id ) && ($use
     $session{'CurrentUser'}->LoadByCols( Name => $user );
     $session{'CurrentUser'}->{'OpenID'} = 1;    
     if ( $session{'CurrentUser'}->id ) {
-        $RT::Logger->info($session{'CurrentUser'}->Name ." logged in with openid"); 
+        RT->Logger->info($session{'CurrentUser'}->Name ." logged in with openid"); 
     } else {
-        my $UserObj = RT::User->new($RT::SystemUser);
+        my $UserObj = RT::User->new(RT->SystemUser);
         my ( $id, $msg ) = $UserObj->Create(
             Name => $user,
 
@@ -77,14 +77,14 @@ if ( ( not $session{'CurrentUser'} or not $session{'CurrentUser'}->id ) && ($use
             #EmailAddress => $user->{'email'},
             Privileged => 0,
         );
-        $RT::Logger->info($user ." attempted an account creation with OpenID: $msg");
+        RT->Logger->info($user ." attempted an account creation with OpenID: $msg");
         if ( $UserObj->id ) {
 
             # created the user, now load them as the current user
             $session{'CurrentUser'}->Load( $UserObj->id );
             $session{'i'}++;
             # redirect the user to their preference page to add more info
-            RT::Interface::Web::Redirect( $RT::WebURL . '/User/Prefs.html' );
+            RT::Interface::Web::Redirect( RT->Config->Get("WebURL") . '/User/Prefs.html' );
         } else {
 
             # we couldn't create the user.  abort abort abort!

commit 5643b5a65ae15304380b3d83c96a03e42fd5b70f
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Fri Mar 8 17:59:20 2013 -0800

    Use $m->redirect; RT::Interface::Web::Redirect() is meant for internal redirects

diff --git a/html/Callbacks/OpenID/autohandler/Session b/html/Callbacks/OpenID/autohandler/Session
index 98db1c5..4ca3a16 100644
--- a/html/Callbacks/OpenID/autohandler/Session
+++ b/html/Callbacks/OpenID/autohandler/Session
@@ -34,7 +34,7 @@ if ($openid_url) {
                 delayed_return => 1,
                 trust_root     => RT->Config->Get("WebURL"),
                 );
-        RT::Interface::Web::Redirect($check_url);
+        $m->redirect($check_url);
     } else {
         RT->Logger->error("OpenID login failure for $openid_url code $csr->{last_errcode} error $csr->{last_errtext}");
         # we should end up skipping the rest now
@@ -44,7 +44,7 @@ if ( $ARGS{"openid.mode"} ) {
     if ( my $setup_url = $csr->user_setup_url ) {
 
         # redirect/link/popup user to $setup_url
-        RT::Interface::Web::Redirect($setup_url);
+        $m->redirect($setup_url);
     } elsif ( $csr->user_cancel ) {
     } elsif ( my $vident = $csr->verified_identity ) {
         $user = $vident->url;

commit 9b6ac3a5647293362aad615201f162b7fee78142
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Fri Mar 8 18:00:19 2013 -0800

    Always start with a fresh session when logging in a user

diff --git a/html/Callbacks/OpenID/autohandler/Session b/html/Callbacks/OpenID/autohandler/Session
index 4ca3a16..a236327 100644
--- a/html/Callbacks/OpenID/autohandler/Session
+++ b/html/Callbacks/OpenID/autohandler/Session
@@ -56,6 +56,8 @@ if ( $ARGS{"openid.mode"} ) {
 # if the user isn't logged in and we got credentials from OpenID, load them
 if ( ( not $session{'CurrentUser'} or not $session{'CurrentUser'}->id ) && ($user) ) {
 
+    RT::Interface::Web::InstantiateNewSession();
+
     # set a global user so we know elsewhere we're using OpenID for auth
     $session{'OpenID'} = $user;
 

commit 5581d51caae021addd2f75f69a1257a8eab6f1d0
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Fri Mar 8 18:00:58 2013 -0800

    Log and display an error message rather than rudely dying

diff --git a/html/Callbacks/OpenID/autohandler/Session b/html/Callbacks/OpenID/autohandler/Session
index a236327..958c9a2 100644
--- a/html/Callbacks/OpenID/autohandler/Session
+++ b/html/Callbacks/OpenID/autohandler/Session
@@ -36,7 +36,9 @@ if ($openid_url) {
                 );
         $m->redirect($check_url);
     } else {
-        RT->Logger->error("OpenID login failure for $openid_url code $csr->{last_errcode} error $csr->{last_errtext}");
+        RT->Logger->error("OpenID login failure for '$openid_url', code $csr->{last_errcode}, error $csr->{last_errtext}");
+        push @{$session{'Actions'}{''}}, loc("That doesn't look like a valid OpenID.  Double check your address?");
+
         # we should end up skipping the rest now
     }
 }
@@ -49,7 +51,8 @@ if ( $ARGS{"openid.mode"} ) {
     } elsif ( my $vident = $csr->verified_identity ) {
         $user = $vident->url;
     } else {
-        die ( "Error validating identity: " . $csr->err );
+        RT->Logger->error("Couldn't validate OpenID: ".$csr->err);
+        push @{$session{'Actions'}{''}}, loc("Error validating identity: [_1]", $csr->err);
     }
 }
 
@@ -91,7 +94,9 @@ if ( ( not $session{'CurrentUser'} or not $session{'CurrentUser'}->id ) && ($use
 
             # we couldn't create the user.  abort abort abort!
             delete $session{'CurrentUser'};
-            die( loc( "Cannot create user: [_1]", $msg ) );
+
+            RT->Logger->error("Couldn't create OpenID user '$user': $msg");
+            push @{$session{'Actions'}{''}}, loc( "Cannot create user: [_1]", $msg );
         }
     }
 }

commit 4e7380afa20de0f048a8017c3978aaee40610522
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Fri Mar 8 18:01:11 2013 -0800

    Remove trailing whitespace

diff --git a/html/Callbacks/OpenID/autohandler/Session b/html/Callbacks/OpenID/autohandler/Session
index 958c9a2..aa63a4a 100644
--- a/html/Callbacks/OpenID/autohandler/Session
+++ b/html/Callbacks/OpenID/autohandler/Session
@@ -70,9 +70,9 @@ if ( ( not $session{'CurrentUser'} or not $session{'CurrentUser'}->id ) && ($use
     # we've got a valid user, so try to load
     $session{'CurrentUser'} = RT::CurrentUser->new();
     $session{'CurrentUser'}->LoadByCols( Name => $user );
-    $session{'CurrentUser'}->{'OpenID'} = 1;    
+    $session{'CurrentUser'}->{'OpenID'} = 1;
     if ( $session{'CurrentUser'}->id ) {
-        RT->Logger->info($session{'CurrentUser'}->Name ." logged in with openid"); 
+        RT->Logger->info($session{'CurrentUser'}->Name ." logged in with openid");
     } else {
         my $UserObj = RT::User->new(RT->SystemUser);
         my ( $id, $msg ) = $UserObj->Create(

commit a6ff6d797fc2b6a5a195644313cc53161ecff870
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Mon Mar 11 11:25:13 2013 -0700

    Preserve any submitted OpenID on error

diff --git a/html/Callbacks/OpenID/Elements/Login/Default b/html/Callbacks/OpenID/Elements/Login/Default
index 26844ef..5d8efbb 100644
--- a/html/Callbacks/OpenID/Elements/Login/Default
+++ b/html/Callbacks/OpenID/Elements/Login/Default
@@ -5,7 +5,7 @@ return unless (RT->Config->Get("EnableOpenId"));
 <p><% loc('Log in with it and have a look around.') %></p>
 <div class="input-row">
     <span class="label"><&|/l&>OpenID</&>:</span>
-    <span class="input"><input name="openid" /></span>
+    <span class="input"><input name="openid" value="<% $DECODED_ARGS->{openid} || "" %>" /></span>
 </div>
 <div class="button-row">
     <span class="input"><input type="submit" class="button" value="<&|/l&>Login with OpenID</&>" /></span>

commit 442101d618c13955450f58dd338313ecc820c2e4
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Mon Mar 11 11:25:16 2013 -0700

    Disable the normal user/pass fields when submitting an OpenID
    
    Otherwise they're submitted with empty values and spurious log messages
    may occur.

diff --git a/html/Callbacks/OpenID/Elements/Login/Default b/html/Callbacks/OpenID/Elements/Login/Default
index 5d8efbb..5a928d6 100644
--- a/html/Callbacks/OpenID/Elements/Login/Default
+++ b/html/Callbacks/OpenID/Elements/Login/Default
@@ -8,5 +8,8 @@ return unless (RT->Config->Get("EnableOpenId"));
     <span class="input"><input name="openid" value="<% $DECODED_ARGS->{openid} || "" %>" /></span>
 </div>
 <div class="button-row">
-    <span class="input"><input type="submit" class="button" value="<&|/l&>Login with OpenID</&>" /></span>
+    <span class="input">
+      <input type="submit"
+          onclick="jQuery(this).closest('form').find('input[name=user],input[name=pass]').attr('disabled','disabled');return true;"
+            class="button" value="<&|/l&>Login with OpenID</&>" /></span>
 </div>

commit e090a41c26ebff643207b14937c9bd364ba856c6
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Mon Mar 11 14:01:41 2013 -0700

    Require Net::OpenID::Consumer 1.13 for better OpenID 2 support

diff --git a/META.yml b/META.yml
index 1f7d887..ec07b3e 100644
--- a/META.yml
+++ b/META.yml
@@ -21,7 +21,7 @@ no_index:
 requires:
   Cache::FileCache: 0
   LWPx::ParanoidAgent: 0
-  Net::OpenID::Consumer: 0
+  Net::OpenID::Consumer: 1.13
   perl: 5.8.0
 resources:
   license: http://opensource.org/licenses/gpl-license.php
diff --git a/Makefile.PL b/Makefile.PL
index 7eec92e..cf3f909 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -6,7 +6,7 @@ name            'RT-Authen-OpenID';
 license         'GPL version 2';
 all_from        'lib/RT/Authen/OpenID.pm';
 
-requires        'Net::OpenID::Consumer';
+requires        'Net::OpenID::Consumer' => '1.13',
 requires        'LWPx::ParanoidAgent';
 requires        'Cache::FileCache';
 

commit 55bb2c0b6db32f70f38d175dc1092ff94d3a8f09
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Mon Mar 11 13:57:27 2013 -0700

    Guard $csr->user_setup_url with $csr->setup_needed, per the new API
    
    This ensures that we're playing by the rules for Net::OpenID::Consumer
    1.030099_006.

diff --git a/html/Callbacks/OpenID/autohandler/Session b/html/Callbacks/OpenID/autohandler/Session
index aa63a4a..986d17c 100644
--- a/html/Callbacks/OpenID/autohandler/Session
+++ b/html/Callbacks/OpenID/autohandler/Session
@@ -43,7 +43,7 @@ if ($openid_url) {
     }
 }
 if ( $ARGS{"openid.mode"} ) {
-    if ( my $setup_url = $csr->user_setup_url ) {
+    if ( $csr->setup_needed and my $setup_url = $csr->user_setup_url ) {
 
         # redirect/link/popup user to $setup_url
         $m->redirect($setup_url);

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list