Permalink
Browse files

releng work for the 0.022 release

  • Loading branch information...
1 parent 624194b commit 3f3e9592db5fda93daa4420c56d0b5099e51147f @agentzh committed Sep 23, 2009
View
@@ -1,3 +1,9 @@
+0.022
+- tonodes: now we automatically expand ~ and ~foo using local USER env if set
+- added support for SSH_BATCH_SSH_CMD env and --ssh option to key2nodes.
+- tonodes now print a warning message while expanding ~ and ~foo locally in the target path.
+- added more docs explaining how to disable StrictHostKeyChecking for ssh
+
0.021
- fixed the homedir mocking bug of the test suite for Mac.
- no longer skipped those tests marked as linux_only on non-linux systems.
View
@@ -11,3 +11,5 @@ pm_to_blib
po/foo\.po$
po/meta\.po$
t/tmp
+^\.rsync$
+
View
@@ -8,7 +8,7 @@ build_requires:
configure_requires:
ExtUtils::MakeMaker: 6.42
distribution_type: module
-generated_by: 'Module::Install version 0.85'
+generated_by: 'Module::Install version 0.91'
license: bsd
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -21,11 +21,12 @@ no_index:
requires:
File::HomeDir: 0
File::Temp: 0
+ Filter::Util::Call: 0
IO::Pty: 0
Net::OpenSSH: 0.34
Set::Scalar: 1.23
Term::ReadKey: 2.30
perl: 5.6.1
resources:
license: http://opensource.org/licenses/bsd-license.php
-version: 0.021
+version: 0.022
View
39 README
@@ -3,7 +3,7 @@ NAME
arithmetic
VERSION
- This document describes SSH::Batch 0.021 released on May 3, 2009.
+ This document describes SSH::Batch 0.022 released on Sep 23, 2009.
SYNOPSIS
The following scripts are provided:
@@ -193,7 +193,8 @@ TIPS
By default, "atnodes" relies on Net::OpenSSH to locate the OpenSSH
client executable "ssh". But you can define the "SSH_BATCH_SSH_CMD"
environment to specify the command explicitly. You can use the
- "-ssh" option to override it further.
+ "-ssh" option to override it further. (The key2nodes script also
+ supports the "SSH_BATCH_SSH_CMD" environment.)
Note that to specify your own "ssh" is also a way to pass more
options to the underlying OpenSSH client executable when using
@@ -203,6 +204,7 @@ TIPS
#!/bin/sh
# to enable X11 forwarding:
exec ssh -X "$@"
+ ^D
$ chmod +x ~/bin/myssh
@@ -212,6 +214,8 @@ TIPS
It's important to use "exec" in your own ssh wrapper script, or you
may see "atnodes" hangs.
+ This trick also works for the key2nodes script.
+
Use wildcard for cluster expressions to save typing
Wildcards in cluster spec could save a lot of typing. Say, if you
have "api10.foo.bar.baz.bah.com.cn" appeared in your ~/.fornodesrc
@@ -276,6 +280,37 @@ TIPS
where 8000 is in the unit of Kbits/sec, so it will not transfer
faster than 1 MByte/sec.
+ Avoid logging manually for the first time
+ When you use key2nodes or atnodes to access remote servers that you
+ have never logged in manually, you would probably see the following
+ errors:
+
+ ===================== foo.com =====================
+ Failed to spawn command.
+
+ ERROR: unable to establish master SSH connection: the authenticity of the target host can't be established, try loging manually first
+
+ A work-around is using "ssh" to login to that "foo.com" machine
+ manually and then try key2nodes or atnodes again.
+
+ Another nicer work-around is to pass the "-o
+ 'StrictHostKeyChecking=no'" option to the underlying ssh executable
+ used by "SSH::Batch". Here's a quick HOW-TO:
+
+ $ cat > ~/bin/myssh
+ #!/bin/sh
+ # to disable StrictHostKeyChecking
+ exec ssh -o 'StrictHostKeyChecking=no' "$@"
+ ^D
+
+ $ chmod +x ~/bin/myssh
+
+ $ export SSH_BATCH_SSH_CMD=~/bin/myssh
+
+ # then we try again
+ $ key2nodes foo.com
+ $ atnodes 'hostname' foo.com
+
PREREQUISITES
This module uses Net::OpenSSH behind the scene, so it requires the
OpenSSH *client* executable (usually spelled "ssh") with multiplexing
View
@@ -18,7 +18,9 @@ my %FeatureMap = (
# various lexical flags
my ( @Missing, @Existing, %DisabledTests, $UnderCPAN, $HasCPANPLUS );
-my ( $Config, $CheckOnly, $SkipInstall, $AcceptDefault, $TestOnly );
+my (
+ $Config, $CheckOnly, $SkipInstall, $AcceptDefault, $TestOnly, $AllDeps
+);
my ( $PostambleActions, $PostambleUsed );
# See if it's a testing or non-interactive session
@@ -73,6 +75,9 @@ sub _init {
elsif ( $arg =~ /^--test(?:only)?$/ ) {
$TestOnly = 1;
}
+ elsif ( $arg =~ /^--all(?:deps)?$/ ) {
+ $AllDeps = 1;
+ }
}
}
@@ -115,7 +120,12 @@ sub import {
)[0]
);
- $UnderCPAN = _check_lock(1); # check for $UnderCPAN
+ # We want to know if we're under CPAN early to avoid prompting, but
+ # if we aren't going to try and install anything anyway then skip the
+ # 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;
while ( my ( $feature, $modules ) = splice( @args, 0, 2 ) ) {
my ( @required, @tests, @skiptests );
@@ -165,15 +175,24 @@ sub import {
}
# XXX: check for conflicts and uninstalls(!) them.
- if (
- defined( my $cur = _version_check( _load($mod), $arg ||= 0 ) ) )
+ my $cur = _load($mod);
+ if (_version_cmp ($cur, $arg) >= 0)
{
print "loaded. ($cur" . ( $arg ? " >= $arg" : '' ) . ")\n";
push @Existing, $mod => $arg;
$DisabledTests{$_} = 1 for map { glob($_) } @skiptests;
}
else {
- print "missing." . ( $arg ? " (would need $arg)" : '' ) . "\n";
+ if (not defined $cur) # indeed missing
+ {
+ print "missing." . ( $arg ? " (would need $arg)" : '' ) . "\n";
+ }
+ else
+ {
+ # no need to check $arg as _version_cmp ($cur, undef) would satisfy >= above
+ print "too old. ($cur < $arg)\n";
+ }
+
push @required, $mod => $arg;
}
}
@@ -187,6 +206,7 @@ sub import {
and (
$CheckOnly
or ($mandatory and $UnderCPAN)
+ or $AllDeps
or _prompt(
qq{==> Auto-install the }
. ( @required / 2 )
@@ -235,21 +255,38 @@ sub import {
*{'main::WriteMakefile'} = \&Write if caller(0) eq 'main';
}
+sub _running_under {
+ my $thing = shift;
+ print <<"END_MESSAGE";
+*** Since we're running under ${thing}, I'll just let it take care
+ of the dependency's installation later.
+END_MESSAGE
+ return 1;
+}
+
# Check to see if we are currently running under CPAN.pm and/or CPANPLUS;
# if we are, then we simply let it taking care of our dependencies
sub _check_lock {
return unless @Missing or @_;
+ my $cpan_env = $ENV{PERL5_CPAN_IS_RUNNING};
+
if ($ENV{PERL5_CPANPLUS_IS_RUNNING}) {
- print <<'END_MESSAGE';
+ return _running_under($cpan_env ? 'CPAN' : 'CPANPLUS');
+ }
-*** Since we're running under CPANPLUS, I'll just let it take care
- of the dependency's installation later.
-END_MESSAGE
- return 1;
+ require CPAN;
+
+ if ($CPAN::VERSION > '1.89') {
+ if ($cpan_env) {
+ return _running_under('CPAN');
+ }
+ return; # CPAN.pm new enough, don't need to check further
}
- _load_cpan();
+ # last ditch attempt, this -will- configure CPAN, very sorry
+
+ _load_cpan(1); # force initialize even though it's already loaded
# Find the CPAN lock-file
my $lock = MM->catfile( $CPAN::Config->{cpan_home}, ".lock" );
@@ -285,7 +322,7 @@ sub install {
while ( my ( $pkg, $ver ) = splice( @_, 0, 2 ) ) {
# grep out those already installed
- if ( defined( _version_check( _load($pkg), $ver ) ) ) {
+ if ( _version_cmp( _load($pkg), $ver ) >= 0 ) {
push @installed, $pkg;
}
else {
@@ -324,7 +361,7 @@ sub install {
# see if we have successfully installed them
while ( my ( $pkg, $ver ) = splice( @modules, 0, 2 ) ) {
- if ( defined( _version_check( _load($pkg), $ver ) ) ) {
+ if ( _version_cmp( _load($pkg), $ver ) >= 0 ) {
push @installed, $pkg;
}
elsif ( $args{do_once} and open( FAILED, '>> .#autoinstall.failed' ) ) {
@@ -379,7 +416,7 @@ sub _install_cpanplus {
my $success;
my $obj = $modtree->{$pkg};
- if ( $obj and defined( _version_check( $obj->{version}, $ver ) ) ) {
+ if ( $obj and _version_cmp( $obj->{version}, $ver ) >= 0 ) {
my $pathname = $pkg;
$pathname =~ s/::/\\W/;
@@ -472,7 +509,7 @@ sub _install_cpan {
my $obj = CPAN::Shell->expand( Module => $pkg );
my $success = 0;
- if ( $obj and defined( _version_check( $obj->cpan_version, $ver ) ) ) {
+ if ( $obj and _version_cmp( $obj->cpan_version, $ver ) >= 0 ) {
my $pathname = $pkg;
$pathname =~ s/::/\\W/;
@@ -536,7 +573,7 @@ sub _update_to {
my $ver = shift;
return
- if defined( _version_check( _load($class), $ver ) ); # no need to upgrade
+ if _version_cmp( _load($class), $ver ) >= 0; # no need to upgrade
if (
_prompt( "==> A newer version of $class ($ver) is required. Install?",
@@ -633,7 +670,7 @@ sub _load {
# Load CPAN.pm and it's configuration
sub _load_cpan {
- return if $CPAN::VERSION;
+ return if $CPAN::VERSION and $CPAN::Config and not @_;
require CPAN;
if ( $CPAN::HandleConfig::VERSION ) {
# Newer versions of CPAN have a HandleConfig module
@@ -645,9 +682,11 @@ sub _load_cpan {
}
# compare two versions, either use Sort::Versions or plain comparison
-sub _version_check {
+# return values same as <=>
+sub _version_cmp {
my ( $cur, $min ) = @_;
- return unless defined $cur;
+ return -1 unless defined $cur; # if 0 keep comparing
+ return 1 unless $min;
$cur =~ s/\s+$//;
@@ -658,16 +697,13 @@ sub _version_check {
) {
# use version.pm if it is installed.
- return (
- ( version->new($cur) >= version->new($min) ) ? $cur : undef );
+ return version->new($cur) <=> version->new($min);
}
elsif ( $Sort::Versions::VERSION or defined( _load('Sort::Versions') ) )
{
# use Sort::Versions as the sorting algorithm for a.b.c versions
- return ( ( Sort::Versions::versioncmp( $cur, $min ) != -1 )
- ? $cur
- : undef );
+ return Sort::Versions::versioncmp( $cur, $min );
}
warn "Cannot reliably compare non-decimal formatted versions.\n"
@@ -676,7 +712,7 @@ sub _version_check {
# plain comparison
local $^W = 0; # shuts off 'not numeric' bugs
- return ( $cur >= $min ? $cur : undef );
+ return $cur <=> $min;
}
# nothing; this usage is deprecated.
@@ -766,4 +802,4 @@ END_MAKE
__END__
-#line 1004
+#line 1056
View
@@ -28,7 +28,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 = '0.85';
+ $VERSION = '0.91';
# Storage for the pseudo-singleton
$MAIN = undef;
@@ -353,7 +353,7 @@ sub _read {
if ( $] >= 5.006 ) {
open( FH, '<', $_[0] ) or die "open($_[0]): $!";
} else {
- open( FH, "< $_[0]" ) or die "open($_[0]): $!";
+ open( FH, "< $_[0]" ) or die "open($_[0]): $!";
}
my $string = do { local $/; <FH> };
close FH or die "close($_[0]): $!";
@@ -384,7 +384,7 @@ sub _write {
if ( $] >= 5.006 ) {
open( FH, '>', $_[0] ) or die "open($_[0]): $!";
} else {
- open( FH, "> $_[0]" ) or die "open($_[0]): $!";
+ open( FH, "> $_[0]" ) or die "open($_[0]): $!";
}
foreach ( 1 .. $#_ ) {
print FH $_[$_] or die "print($_[0]): $!";
@@ -2,13 +2,13 @@
package Module::Install::AutoInstall;
use strict;
-use Module::Install::Base;
+use Module::Install::Base ();
-use vars qw{$VERSION $ISCORE @ISA};
+use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '0.85';
+ $VERSION = '0.91';
+ @ISA = 'Module::Install::Base';
$ISCORE = 1;
- @ISA = qw{Module::Install::Base};
}
sub AutoInstall { $_[0] }
Oops, something went wrong.

0 comments on commit 3f3e959

Please sign in to comment.