r37082 - in /trunk/libnet-ssh2-perl: Changes MANIFEST MANIFEST.SKIP META.yml Makefile.PL SSH2.xs TODO debian/changelog fallback/ inc/ lib/Net/SSH2.pm t/Net-SSH2.t

ryan52-guest at users.alioth.debian.org ryan52-guest at users.alioth.debian.org
Mon Jun 1 05:21:52 UTC 2009


Author: ryan52-guest
Date: Mon Jun  1 05:21:47 2009
New Revision: 37082

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=37082
Log:
New upstream release

Added:
    trunk/libnet-ssh2-perl/MANIFEST.SKIP
      - copied unchanged from r37081, branches/upstream/libnet-ssh2-perl/current/MANIFEST.SKIP
    trunk/libnet-ssh2-perl/inc/
      - copied from r37081, branches/upstream/libnet-ssh2-perl/current/inc/
Removed:
    trunk/libnet-ssh2-perl/fallback/
Modified:
    trunk/libnet-ssh2-perl/Changes
    trunk/libnet-ssh2-perl/MANIFEST
    trunk/libnet-ssh2-perl/META.yml
    trunk/libnet-ssh2-perl/Makefile.PL
    trunk/libnet-ssh2-perl/SSH2.xs
    trunk/libnet-ssh2-perl/TODO
    trunk/libnet-ssh2-perl/debian/changelog
    trunk/libnet-ssh2-perl/lib/Net/SSH2.pm
    trunk/libnet-ssh2-perl/t/Net-SSH2.t

Modified: trunk/libnet-ssh2-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-ssh2-perl/Changes?rev=37082&op=diff
==============================================================================
--- trunk/libnet-ssh2-perl/Changes (original)
+++ trunk/libnet-ssh2-perl/Changes Mon Jun  1 05:21:47 2009
@@ -2,6 +2,12 @@
 
 Developer/maintainer: David B. Robins <dbrobins at cpan.org>.
 Project started 2005-10-23 in Redmond, Washington, USA.
+
+0.20  2009-06-01 04:17:37
+        - Added patch from sisyphus for win32 support for tests.
+        - Link to some extra libs in case of static build (also from sisyphus.)
+        - Added Timeout to socket options.
+        - Added "sock" accessor for underlying socket.
 
 0.19  2009-04-11 01:03:39
         - Updated for perl 5.10 and 5.6 compatibility.

Modified: trunk/libnet-ssh2-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-ssh2-perl/MANIFEST?rev=37082&op=diff
==============================================================================
--- trunk/libnet-ssh2-perl/MANIFEST (original)
+++ trunk/libnet-ssh2-perl/MANIFEST Mon Jun  1 05:21:47 2009
@@ -1,20 +1,29 @@
 Changes
+example/read.pl
+inc/Devel/CheckLib.pm
+inc/Module/Install.pm
+inc/Module/Install/Base.pm
+inc/Module/Install/Can.pm
+inc/Module/Install/CheckLib.pm
+inc/Module/Install/Fetch.pm
+inc/Module/Install/Makefile.pm
+inc/Module/Install/Metadata.pm
+inc/Module/Install/Win32.pm
+inc/Module/Install/WriteAll.pm
+lib/Net/SSH2.pm
+lib/Net/SSH2/Channel.pm
+lib/Net/SSH2/Dir.pm
+lib/Net/SSH2/File.pm
+lib/Net/SSH2/Listener.pm
+lib/Net/SSH2/PublicKey.pm
+lib/Net/SSH2/SFTP.pm
 Makefile.PL
-MANIFEST
+MANIFEST			This list of files
+MANIFEST.SKIP
+META.yml
 ppport.h
 README
 SSH2.xs
+t/Net-SSH2.t
+TODO
 typemap
-t/Net-SSH2.t
-lib/Net/SSH2.pm
-lib/Net/SSH2/Channel.pm
-lib/Net/SSH2/SFTP.pm
-lib/Net/SSH2/File.pm
-lib/Net/SSH2/Dir.pm
-lib/Net/SSH2/Listener.pm
-lib/Net/SSH2/PublicKey.pm
-example/read.pl
-fallback/const-c.inc
-fallback/const-xs.inc
-META.yml                                 Module meta-data (added by MakeMaker)
-TODO

Modified: trunk/libnet-ssh2-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-ssh2-perl/META.yml?rev=37082&op=diff
==============================================================================
--- trunk/libnet-ssh2-perl/META.yml (original)
+++ trunk/libnet-ssh2-perl/META.yml Mon Jun  1 05:21:47 2009
@@ -1,24 +1,41 @@
---- #YAML:1.0
-name:               Net-SSH2
-version:            0.19
-abstract:           Support for the SSH 2 protocol via libssh2.
+---
+abstract: 'Support for the SSH 2 protocol via libssh2.'
 author:
-    - David B. Robins <dbrobins at cpan.org>
-license:            unknown
-distribution_type:  module
+  - 'David B. Robins, <dbrobins at cpan.org>'
+build_requires:
+  ExtUtils::MakeMaker: 6.42
 configure_requires:
-    ExtUtils::MakeMaker:  0
-build_requires:
-    ExtUtils::MakeMaker:  0
+  ExtUtils::MakeMaker: 6.42
+distribution_type: module
+generated_by: 'Module::Install version 0.91'
+license: perl
+meta-spec:
+  url: http://module-build.sourceforge.net/META-spec-v1.4.html
+  version: 1.4
+name: Net-SSH2
+no_index:
+  directory:
+    - example
+    - inc
+    - t
+provides:
+  Net::SSH2:
+    file: lib/Net/SSH2.pm
+    version: 0.20
+  Net::SSH2::Channel:
+    file: lib/Net/SSH2/Channel.pm
+  Net::SSH2::Dir:
+    file: lib/Net/SSH2/Dir.pm
+  Net::SSH2::File:
+    file: lib/Net/SSH2/File.pm
+  Net::SSH2::Listener:
+    file: lib/Net/SSH2/Listener.pm
+  Net::SSH2::PublicKey:
+    file: lib/Net/SSH2/PublicKey.pm
+  Net::SSH2::SFTP:
+    file: lib/Net/SSH2/SFTP.pm
 requires:
-    File::Basename:  0
-    IO::File:        0
-    Socket:          0
-no_index:
-    directory:
-        - t
-        - inc
-generated_by:       ExtUtils::MakeMaker version 6.50
-meta-spec:
-    url:      http://module-build.sourceforge.net/META-spec-v1.4.html
-    version:  1.4
+  perl: 5.6.0
+resources:
+  license: http://dev.perl.org/licenses/
+version: 0.20

Modified: trunk/libnet-ssh2-perl/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-ssh2-perl/Makefile.PL?rev=37082&op=diff
==============================================================================
--- trunk/libnet-ssh2-perl/Makefile.PL (original)
+++ trunk/libnet-ssh2-perl/Makefile.PL Mon Jun  1 05:21:47 2009
@@ -1,68 +1,60 @@
-use 5.006;
-use ExtUtils::MakeMaker;
-
-# we need libSSH2; check for it, if missing, try to install it
+use inc::Module::Install;
 use Cwd;
 use Config;
+
+# override library and include directory here if desired
+my $lib = '';
+my $inc = '';
+my $extra_libs = '-lz -lssl -lcrypto';
 
 # Windows, as usual, is a special case
 my $win32 = ($^O eq 'MSWin32');
 my @define = $win32 ? (DEFINE => '-DLIBSSH2_WIN32') : ();
 
-# override library and include directory here if desired
-my $lib = '';
-my $inc = '';
+name 'Net-SSH2';
+all_from 'lib/Net/SSH2.pm';
+perl_version '5.006000';
 
-# try to find libSSH2 if we're not given a location
-unless($lib and $inc) {
-    for my $prefix($Config{siteprefixexp},$Config{prefixexp},
-     '/usr','/usr/local','/opt',$ENV{HOME}) {
-        $lib ||= "$prefix/lib"
-         if -f "$prefix/lib/libssh2$Config{_a}" or
-            -f "$prefix/lib/libssh2.$Config{so}";
-        $lib ||= "$prefix/lib64"
-         if -f "$prefix/lib64/libssh2$Config{_a}" or
-            -f "$prefix/lib64/libssh2.$Config{so}";
-        $inc ||= "$prefix/include"
-         if -f "$prefix/include/libssh2.h";
-        last if $lib and $inc;
-    }
+my @search_paths = (
+  $Config{siteprefixexp}, $Config{prefixexp},
+  '/usr', '/usr/local', '/opt',
+  $ENV{HOME}
+);
+
+my @search_libs = map "$_/lib", @search_paths;
+my @search_incs = map "$_/include", @search_paths;
+
+print <<'EOF';
+
+The libssh2 library is required by this module.  If you don't have it, you can
+download it from http://www.libssh2.org; you may also need OpenSSL, which can be
+obtained from http://www.openssl.org.
+
+On Debian do:
+sudo aptitude install libssh2-1-dev
+
+EOF
+
+checklibs 
+    lib => 'ssh2',
+    header => 'libssh2.h',
+    libpath => [@search_libs, $lib],
+    incpath => [@search_incs, $inc];
+
+if (!$lib && !$inc) {
+    $lib = (join ' ', map "-L$_", @search_libs) . " -lssh2 $extra_libs";
+    $inc =  join ' ', map "-I$_", @search_incs;
+} else {
+    $lib = "-L$lib -lssh2 $extra_libs" if $lib;
+    $inc = "-I$inc" if $inc;
 }
 
-unless ($lib and $inc) {
-    my $missing = join ' or ', $lib ? () : 'libssh2', $inc ? () : 'libssh2.h';
-    print <<ERROR;
-I can't find $missing.
+auto_provides;
+libs $lib;
+inc "$inc -I.";
+makemaker_args @define;
+WriteAll;
 
-Either libSSH2 is not installed, or it is installed incorrectly.  LibSSH2 is
-required by Net::SSH2.  You can download it from http://www.libssh2.org; you
-may also need OpenSSL, which can be obtained from http://www.openssl.org.
-
-ERROR
-    die "Quitting since I can't find $missing";
-}
-
-$lib = "-L$lib -lssh2";
-$inc = "-I$inc";
-print "Net::SSH2: using library $lib and include path $inc.\n";
-
-# See lib/ExtUtils/MakeMaker.pm for details of how to influence
-# the contents of the Makefile that is written.
-WriteMakefile(
-    NAME              => 'Net::SSH2',
-    VERSION_FROM      => 'lib/Net/SSH2.pm', # finds $VERSION
-    PREREQ_PM         => {
-                            'Socket'            => 0,
-                            'IO::File'          => 0,
-                            'File::Basename'    => 0,
-                         },
-    ($] >= 5.005 ?     ## Add these new keywords supported since 5.005
-      (ABSTRACT_FROM  => 'lib/Net/SSH2.pm', # retrieve abstract from module
-       AUTHOR         => 'David B. Robins <dbrobins at cpan.org>') : ()),
-    LIBS              => [$lib],
-    INC               => "$inc -I.",
-    @define,
-);
 if  (eval {require ExtUtils::Constant; 1}) {
   # If you edit these definitions to change the constants used by this module,
   # you will need to use the generated const-c.inc and const-xs.inc

Modified: trunk/libnet-ssh2-perl/SSH2.xs
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-ssh2-perl/SSH2.xs?rev=37082&op=diff
==============================================================================
--- trunk/libnet-ssh2-perl/SSH2.xs (original)
+++ trunk/libnet-ssh2-perl/SSH2.xs Mon Jun  1 05:21:47 2009
@@ -712,9 +712,21 @@
 CODE:
     clear_error(ss);
     success = !libssh2_session_startup(ss->session, socket);
-    if (success && store)
+    if (success && store) {
         ss->socket = SvREFCNT_inc(SvRV(store));
+    }
     XSRETURN_IV(success);
+
+SV *
+net_ss_sock(SSH2* ss)
+CODE:
+    if (ss->socket) {
+        RETVAL = newRV_inc((SV *)ss->socket);
+    } else {
+        RETVAL = &PL_sv_undef;
+    }
+OUTPUT:
+    RETVAL
 
 void
 net_ss_disconnect(SSH2* ss, const char* description = "", \

Modified: trunk/libnet-ssh2-perl/TODO
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-ssh2-perl/TODO?rev=37082&op=diff
==============================================================================
--- trunk/libnet-ssh2-perl/TODO (original)
+++ trunk/libnet-ssh2-perl/TODO Mon Jun  1 05:21:47 2009
@@ -1,3 +1,4 @@
 Polling sometimes doesn't work.
 Segfaults on exit sometimes.
 sftp is incredibly slow.
+Detect static build on Win32 and not define -DLIBSSH2_WIN32

Modified: trunk/libnet-ssh2-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-ssh2-perl/debian/changelog?rev=37082&op=diff
==============================================================================
--- trunk/libnet-ssh2-perl/debian/changelog (original)
+++ trunk/libnet-ssh2-perl/debian/changelog Mon Jun  1 05:21:47 2009
@@ -1,3 +1,9 @@
+libnet-ssh2-perl (0.20-1) UNRELEASED; urgency=low
+
+  * New upstream release
+
+ -- Ryan Niebur <ryanryan52 at gmail.com>  Sun, 31 May 2009 22:21:37 -0700
+
 libnet-ssh2-perl (0.19-1) unstable; urgency=low
 
   * New upstream release

Modified: trunk/libnet-ssh2-perl/lib/Net/SSH2.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-ssh2-perl/lib/Net/SSH2.pm?rev=37082&op=diff
==============================================================================
--- trunk/libnet-ssh2-perl/lib/Net/SSH2.pm (original)
+++ trunk/libnet-ssh2-perl/lib/Net/SSH2.pm Mon Jun  1 05:21:47 2009
@@ -12,8 +12,7 @@
 use IO::File;
 use File::Basename;
 
-our @ISA = qw(Exporter);
-
+use base 'Exporter';
 
 # constants
 
@@ -189,8 +188,7 @@
 
 our @EXPORT_OK = @{$EXPORT_TAGS{all}};
 
-our $VERSION = '0.19';
-
+our $VERSION = '0.20';
 
 # methods
 
@@ -213,7 +211,11 @@
     }
     if (@_ == 2) {
         require IO::Socket::INET;
-        $sock = IO::Socket::INET->new(PeerHost => $_[0], PeerPort => $_[1]);
+        $sock = IO::Socket::INET->new(
+	    PeerHost => $_[0],
+	    PeerPort => $_[1],
+	    Timeout  => 30,
+	);
         croak "Net::SSH2::connect: failed to connect to $_[0]:$_[1]: $!"
          unless $sock;
 
@@ -529,6 +531,11 @@
 Returns the last error code; returns false if no error.  In list context,
 returns (code, error name, error string).
 
+=head2 sock
+
+Returns a reference to the underlying L<IO::Socket::INET> object, or C<undef> if
+not yet connected.
+
 =head2 method ( type [, values... ] )
 
 Sets or returns a method preference; for get, pass in the type only; to set,

Modified: trunk/libnet-ssh2-perl/t/Net-SSH2.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-ssh2-perl/t/Net-SSH2.t?rev=37082&op=diff
==============================================================================
--- trunk/libnet-ssh2-perl/t/Net-SSH2.t (original)
+++ trunk/libnet-ssh2-perl/t/Net-SSH2.t Mon Jun  1 05:21:47 2009
@@ -4,7 +4,7 @@
 
 #########################
 
-use Test::More tests => 72;
+use Test::More tests => 74;
 
 use strict;
 use File::Basename;
@@ -46,9 +46,11 @@
 is($ssh2->poll(0), 0, 'poll indefinite');
 is($ssh2->poll(250), 0, 'poll 1/4 second');
 
+is($ssh2->sock, undef, '->sock is undef before connect');
+
 # (1) connect
 SKIP: { # SKIP-connect
-skip '- non-interactive session', 61 unless $host or -t STDOUT;
+skip '- non-interactive session', 62 unless $host or -t STDOUT;
 $| = 1;
 unless ($host) {
     print <<TEST;
@@ -62,8 +64,10 @@
     print "\n";
 }
 SKIP: { # SKIP-server
-skip '- no server daemon available', 61 unless $host;
+skip '- no server daemon available', 62 unless $host;
 ok($ssh2->connect($host), "connect to $host");
+
+isa_ok($ssh2->sock, 'IO::Socket::INET', '->sock isa IO::Socket::INET');
 
 # (8) server methods
 for my $type(qw(kex hostkey crypt_cs crypt_sc mac_cs mac_sc comp_cs comp_sc)) {
@@ -79,8 +83,9 @@
 
 # (3) authentication methods
 unless ($user) {
-    my $def_user = getpwuid $<;
-    print "\nEnter username [$def_user]: ";
+    my $def_user;
+    $def_user = getpwuid $< if $^O !~ /mswin/i;
+    print $def_user ? "\nEnter username [$def_user]: " : "\nEnter username: ";
     chomp($user = <STDIN>);
     $user ||= $def_user;
 }
@@ -92,6 +97,9 @@
 
 # (2) authenticate
 @auth = $pass ? (password => $pass) : (interact => 1);
+if($^O =~ /MSWin32/i && !$pass) { # interact probably failed to set $pass on Win32
+  @auth = win32_auth();
+}
 my $type = $ssh2->auth(username => $user, @auth,
   publickey  => "$ENV{HOME}/.ssh/id_dsa.pub",
   privatekey => "$ENV{HOME}/.ssh/id_dsa");
@@ -144,7 +152,12 @@
 SKIP: { # SKIP-slurp
 eval { require File::Slurp };
 skip '- File::Slurp required', 1 if $@;
-is(${$check->sref}, File::Slurp::read_file($0), 'files match');
+if($^O =~ /MSWin32/i) {
+  is(${$check->sref}, File::Slurp::read_file($0, binmode => ':raw'), 'files match');
+}
+else {
+  is(${$check->sref}, File::Slurp::read_file($0), 'files match');
+}
 } # SKIP-slurp
 } # SKIP-scalar
 
@@ -189,6 +202,9 @@
 scalar <$fh> for 1..2;
 my $line = <$fh>;
 chomp $line;
+if($^O =~ /MSWin32/i) {
+  $line =~ s/\r//;
+}
 is($line, '# THIS LINE WILL BE READ BY A TEST BELOW', "read '$line'");
 #undef $fh;  # don't undef it, ensure reference counts work properly
 
@@ -233,3 +249,18 @@
 } # SKIP-connect
 
 # vim:filetype=perl
+
+sub win32_auth {
+  eval{require Term::ReadKey;};
+  print "\n  NOTE: The password you are about to enter\n  will be printed to the console." if $@;
+  print "\n  To avoid this, either install Term::ReadKey\n  or assign the correct value to \$pass" if $@;
+  print "\n  at the beginning of this test script." if $@;
+  print "\nEnter password: ";
+  if($@) {$pass = <STDIN>}
+  else {
+    Term::ReadKey::ReadMode('noecho');
+    $pass = Term::ReadKey::ReadLine(0);
+  }
+  chomp($pass);
+  return (password => $pass);
+}




More information about the Pkg-perl-cvs-commits mailing list