r77074 - in /branches/upstream/libfind-lib-perl/current: Changes MANIFEST META.yml lib/Find/Lib.pm t/moretests/03-chdir-topbegin.t t/moretests/04-symlinks.t t/moretests/symlink_test.pl

carnil at users.alioth.debian.org carnil at users.alioth.debian.org
Mon Jul 4 13:25:27 UTC 2011


Author: carnil
Date: Mon Jul  4 13:25:24 2011
New Revision: 77074

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=77074
Log:
[svn-upgrade] new version libfind-lib-perl (1.03)

Added:
    branches/upstream/libfind-lib-perl/current/t/moretests/03-chdir-topbegin.t
Modified:
    branches/upstream/libfind-lib-perl/current/Changes
    branches/upstream/libfind-lib-perl/current/MANIFEST
    branches/upstream/libfind-lib-perl/current/META.yml
    branches/upstream/libfind-lib-perl/current/lib/Find/Lib.pm
    branches/upstream/libfind-lib-perl/current/t/moretests/04-symlinks.t
    branches/upstream/libfind-lib-perl/current/t/moretests/symlink_test.pl

Modified: branches/upstream/libfind-lib-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libfind-lib-perl/current/Changes?rev=77074&op=diff
==============================================================================
--- branches/upstream/libfind-lib-perl/current/Changes (original)
+++ branches/upstream/libfind-lib-perl/current/Changes Mon Jul  4 13:25:24 2011
@@ -1,4 +1,10 @@
 Revision history for Find-Lib
+
+1.03    Mon Jul 4 00:20:00 PDT 2011
+        - Making this the final 1.03. All tests pass on cpantesters.
+
+1.03_01 Wed Jun 29 11:05:00 PDT 2011
+        - Revert 1.02 change, but keep a default to Cwd::cwd()
 
 1.02    Mon Jun 20 22:00:00 PDT 2011
         - Fix a portabality issue s/$ENV{PWD}/Cwd::cwd()/ RT#68967

Modified: branches/upstream/libfind-lib-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libfind-lib-perl/current/MANIFEST?rev=77074&op=diff
==============================================================================
--- branches/upstream/libfind-lib-perl/current/MANIFEST (original)
+++ branches/upstream/libfind-lib-perl/current/MANIFEST Mon Jul  4 13:25:24 2011
@@ -17,6 +17,7 @@
 t/moretests/02-dollar0-begin.t
 t/moretests/02-dollar0.t
 t/moretests/03-chdir-begin.t
+t/moretests/03-chdir-topbegin.t
 t/moretests/03-chdir.t
 t/moretests/03-pwd-begin.t
 t/moretests/04-symlinks.t

Modified: branches/upstream/libfind-lib-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libfind-lib-perl/current/META.yml?rev=77074&op=diff
==============================================================================
--- branches/upstream/libfind-lib-perl/current/META.yml (original)
+++ branches/upstream/libfind-lib-perl/current/META.yml Mon Jul  4 13:25:24 2011
@@ -1,6 +1,6 @@
 --- #YAML:1.0
 name:               Find-Lib
-version:            1.02
+version:            1.03
 abstract:           Helper to smartly find libs to use in the filesystem tree
 author:
     - Yann Kerherve <yannk at cpan.org>

Modified: branches/upstream/libfind-lib-perl/current/lib/Find/Lib.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libfind-lib-perl/current/lib/Find/Lib.pm?rev=77074&op=diff
==============================================================================
--- branches/upstream/libfind-lib-perl/current/lib/Find/Lib.pm (original)
+++ branches/upstream/libfind-lib-perl/current/lib/Find/Lib.pm Mon Jul  4 13:25:24 2011
@@ -4,7 +4,6 @@
 use lib;
 
 use File::Spec();
-use Cwd;
 use vars qw/$Base $VERSION @base/;
 use vars qw/$Script/; # compat
 
@@ -18,7 +17,7 @@
 
 =cut
 
-$VERSION = '1.02';
+$VERSION = '1.03';
 
 =head1 SYNOPSIS
 
@@ -94,7 +93,7 @@
 information the module relies on to interpret the relative path given by the
 calling program.
 
-If one of cwd, or $0 is changed before Find::Lib has a chance to do
+If one of cwd, $ENV{PWD} or $0 is changed before Find::Lib has a chance to do
 its job, then Find::Lib will most probably die, saying "The script cannot be
 found". I don't know a workaround that. So be sure to load Find::Lib as soon
 as possible in your script to minimize problems (you are in control!).
@@ -128,8 +127,16 @@
     return guess_system_path();
 }
 
+## we want to use PWD if it exists (it's not guaranteed on all platforms)
+## so that we have a sense of the shell current working dir, with unresolved
+## symlinks
+sub guess_pwd {
+    return $ENV{PWD} || Cwd::cwd();
+}
+
 sub guess_shell_path {
-    my ($volume, $path, $file) = File::Spec->splitpath( Cwd::cwd() );
+    my $pwd = guess_pwd();
+    my ($volume, $path, $file) = File::Spec->splitpath($pwd);
     my @path = File::Spec->splitdir($path);
     pop @path unless $path[-1];
     @base = (@path, $file);

Added: branches/upstream/libfind-lib-perl/current/t/moretests/03-chdir-topbegin.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libfind-lib-perl/current/t/moretests/03-chdir-topbegin.t?rev=77074&op=file
==============================================================================
--- branches/upstream/libfind-lib-perl/current/t/moretests/03-chdir-topbegin.t (added)
+++ branches/upstream/libfind-lib-perl/current/t/moretests/03-chdir-topbegin.t Mon Jul  4 13:25:24 2011
@@ -1,0 +1,13 @@
+use strict;
+use Test::More tests => 2;
+
+BEGIN { chdir '/tmp' };
+
+use Find::Lib;
+
+eval {
+    Find::Lib->import('../mylib');
+    eval "use MyLib a => 1, b => 42;"; die $@ if $@;
+};
+ok !$@, "we didn't die because chdir doesn't change PWD, so we are safe"
+    or diag $@;

Modified: branches/upstream/libfind-lib-perl/current/t/moretests/04-symlinks.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libfind-lib-perl/current/t/moretests/04-symlinks.t?rev=77074&op=diff
==============================================================================
--- branches/upstream/libfind-lib-perl/current/t/moretests/04-symlinks.t (original)
+++ branches/upstream/libfind-lib-perl/current/t/moretests/04-symlinks.t Mon Jul  4 13:25:24 2011
@@ -3,16 +3,19 @@
 use Test::More;
 use File::Copy;
 use File::Spec;
+use Cwd;
 
+our $cwd;
 our $PWD;
 our @dirs = ("testdir_$$", "testdir");
 our $link = "symlink_$$";
 my $script = 'symlink_test.pl';
-my $dirs = File::Spec->catdir(@dirs);
+my $nested_dir = File::Spec->catdir(@dirs);
 my $srcfile = File::Spec->catfile('t', 'moretests', $script);
 my $dstfile = File::Spec->catfile(@dirs, $script);
 
 BEGIN {
+    $cwd = Cwd::cwd();
     $PWD = $ENV{PWD};
     if ($^O eq 'MSWin32' or $^O eq 'os2') {
         plan skip_all => "irrelevant on dosish OS";
@@ -24,32 +27,32 @@
 plan tests => 2;
 
 END {
-    chdir $PWD; ## restore original directory
+    chdir $cwd; ## restore original directory
     unlink "symlinktest$$";
     unlink $link;
     unlink $dstfile;
-    rmdir $dirs;
+    rmdir $nested_dir;
     rmdir $dirs[0];
 }
 
 ## let's create some stuff
 mkdir $dirs[0];
-mkdir $dirs;
-symlink $dirs, $link
-    or die "Couldn't symlink the test directory '$dirs $link': $!";
+mkdir $nested_dir;
+symlink $nested_dir, $link
+    or die "Couldn't symlink the test directory '$nested_dir $link': $!";
 
 copy $srcfile, $dstfile;
 
 ## this is where we do the real test;
 {
     ## Go into the symlinked directory
-    chdir $link or die "coudn't chdir to $link";
-    ## damn chdir doesn't update PWD unless comming from non-core Cwd
+    chdir $link or die "couldn't chdir to $link";
+    ## damn chdir doesn't update PWD unless coming from Cwd (which might not be installed?)
     local $ENV{PWD} = File::Spec->catdir( $ENV{PWD}, $link );
     ## execute from there, if all is ok, succeeds
     my $ret = system $^X, $script;
     ok !$ret, "script succeeded, meaning that compilation with symlink worked"
-        or diag "PWD=$ENV{PWD}, script=$script";
+        or diag "cwd=$cwd, PWD=$PWD script=$script";
 
     $ret = system $^X, ".///$script";
     ok !$ret, "crufty path doesn't make it blow up";

Modified: branches/upstream/libfind-lib-perl/current/t/moretests/symlink_test.pl
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libfind-lib-perl/current/t/moretests/symlink_test.pl?rev=77074&op=diff
==============================================================================
--- branches/upstream/libfind-lib-perl/current/t/moretests/symlink_test.pl (original)
+++ branches/upstream/libfind-lib-perl/current/t/moretests/symlink_test.pl Mon Jul  4 13:25:24 2011
@@ -1,7 +1,6 @@
 #!perl
 ## this is not a test in itself, don't execute
 ## this is a script that is executed by a test
-
 use Find::Lib '../t/mylib';
 use MyLibNoTest;
 exit 0;




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