r68751 - in /trunk/libvendorlib-perl: Changes META.yml debian/changelog lib/vendorlib.pm t/01basic.t

periapt-guest at users.alioth.debian.org periapt-guest at users.alioth.debian.org
Tue Feb 15 23:03:14 UTC 2011


Author: periapt-guest
Date: Tue Feb 15 23:02:58 2011
New Revision: 68751

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

Modified:
    trunk/libvendorlib-perl/Changes
    trunk/libvendorlib-perl/META.yml
    trunk/libvendorlib-perl/debian/changelog
    trunk/libvendorlib-perl/lib/vendorlib.pm
    trunk/libvendorlib-perl/t/01basic.t

Modified: trunk/libvendorlib-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libvendorlib-perl/Changes?rev=68751&op=diff
==============================================================================
--- trunk/libvendorlib-perl/Changes (original)
+++ trunk/libvendorlib-perl/Changes Tue Feb 15 23:02:58 2011
@@ -1,4 +1,19 @@
 Revision history for vendorlib
+
+0.10  2011-01-17 02:36:15
+    - fix a bug in the tests
+
+0.09  2011-01-16 07:25:10
+    - do not use directories that don't exist
+
+0.08  2011-01-14 05:45:08
+    - some fixes for Win32
+
+0.07  2011-01-11 09:49:29
+    - add tilde expansion from Config values
+
+0.06  2011-01-09 12:22:12
+    - added checks for loading core modules in t/01basic.t
 
 0.05  2011-01-06 11:04:51
     - add repository to META.yml

Modified: trunk/libvendorlib-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libvendorlib-perl/META.yml?rev=68751&op=diff
==============================================================================
--- trunk/libvendorlib-perl/META.yml (original)
+++ trunk/libvendorlib-perl/META.yml Tue Feb 15 23:02:58 2011
@@ -22,8 +22,8 @@
 provides:
   vendorlib:
     file: lib/vendorlib.pm
-    version: 0.05
+    version: 0.10
 resources:
   license: http://dev.perl.org/licenses/
   repository: git://github.com/rkitover/vendorlib.git
-version: 0.05
+version: 0.10

Modified: trunk/libvendorlib-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libvendorlib-perl/debian/changelog?rev=68751&op=diff
==============================================================================
--- trunk/libvendorlib-perl/debian/changelog (original)
+++ trunk/libvendorlib-perl/debian/changelog Tue Feb 15 23:02:58 2011
@@ -1,3 +1,9 @@
+libvendorlib-perl (0.10-1) UNRELEASED; urgency=low
+
+  * New upstream release
+
+ -- Nicholas Bamber <nicholas at periapt.co.uk>  Tue, 15 Feb 2011 23:05:18 +0000
+
 libvendorlib-perl (0.05-1) unstable; urgency=low
 
   * Initial Release. (Closes: #609172)

Modified: trunk/libvendorlib-perl/lib/vendorlib.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libvendorlib-perl/lib/vendorlib.pm?rev=68751&op=diff
==============================================================================
--- trunk/libvendorlib-perl/lib/vendorlib.pm (original)
+++ trunk/libvendorlib-perl/lib/vendorlib.pm Tue Feb 15 23:02:58 2011
@@ -10,7 +10,7 @@
 
 =cut
 
-our $VERSION = '0.05';
+our $VERSION = '0.10';
 
 =head1 SYNOPSIS
 
@@ -38,12 +38,51 @@
 =cut
 
 sub import {
-    my @paths = ('/etc/perl', @Config{qw/
+    my @paths = (($^O ne 'MSWin32' ? ('/etc/perl') : ()), @Config{qw/
         vendorarch
         vendorlib
         archlib
         privlib
     /});
+
+    # This grep MUST BE on copies of the paths to not trigger Config overload
+    # magic.
+    @paths = grep $_, @paths;
+
+    # remove duplicates
+    my @result;
+    while (my $path = shift @paths) {
+        if (@paths && $path eq $paths[0]) {
+            # ignore
+        }
+        else {
+            push @result, $path;
+        }
+    }
+    @paths = @result;
+
+    # fixup slashes for @INC on Win32
+    if ($^O eq 'MSWin32') {
+        s{\\}{/}g for @paths;
+    }
+
+    # expand tildes
+    if ($^O ne 'MSWin32') {
+        for my $path (@paths) {
+            if ($path =~ m{^~/+}) {
+                my $home = (getpwuid($<))[7];
+                $path =~ s|^~/+|${home}/|;
+            }
+            elsif (my ($user) = $path =~ /^~(\w+)/) {
+                my $home = (getpwnam($user))[7];
+                $path =~ s|^~${user}/+|${home}/|;
+            }
+        }
+    }
+
+    # remove any directories that don't actually exist
+    # this will also remove /etc/perl on non-Debian systems
+    @paths = grep -d, @paths;
 
     @INC = @paths;
 }

Modified: trunk/libvendorlib-perl/t/01basic.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libvendorlib-perl/t/01basic.t?rev=68751&op=diff
==============================================================================
--- trunk/libvendorlib-perl/t/01basic.t (original)
+++ trunk/libvendorlib-perl/t/01basic.t Tue Feb 15 23:02:58 2011
@@ -1,11 +1,60 @@
 use strict;
 use warnings;
 
-use Test::More tests => 1;
+use Test::More tests => 3;
 
 use lib 't/lib';
 use vendorlib;
 
+# check that we can load core XS and non-XS modules
+use Data::Dumper;
+use File::Basename;
+use Config;
+
 eval "require Foo;";
 
 ok $@, '@INC scrubbed';
+
+# test bare tilde expansion
+SKIP: {
+    skip 'no tilde expansion on Win32', 1 if $^O eq 'MSWin32';
+
+    local @INC;
+
+    my %config = %Config;
+
+    *vendorlib::Config = \%config;
+
+    local $config{vendorarch} = '~/';
+
+    vendorlib->import;
+
+    my $expanded = (getpwuid($<))[7] . '/';
+
+    shift @INC if $INC[0] eq '/etc/perl';
+
+    is $INC[0], $expanded, 'bare tilde expansion';
+}
+
+# test tilde expansion with user name
+SKIP: {
+    skip 'no tilde expansion on Win32', 1 if $^O eq 'MSWin32';
+
+    local @INC;
+
+    my %config = %Config;
+
+    *vendorlib::Config = \%config;
+
+    my $whoami = (getpwuid($<))[0];
+
+    local $config{vendorarch} = "~${whoami}/";
+
+    vendorlib->import;
+
+    my $expanded = (getpwuid($<))[7] . '/';
+
+    shift @INC if $INC[0] eq '/etc/perl';
+
+    is $INC[0], $expanded, 'tilde expansion with user name';
+}




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