[Bps-public-commit] Shipwright branch, master, updated. dd42aa83cae133de64f85cf19bf67f86c9f8954a

sunnavy at bestpractical.com sunnavy at bestpractical.com
Fri Jul 10 02:20:07 EDT 2009


The branch, master has been updated
       via  dd42aa83cae133de64f85cf19bf67f86c9f8954a (commit)
       via  b3641400175544c77cafdb4f1c778dad48fd7a65 (commit)
       via  1b576ca73fa2120fc028b0161acb9aed8444bee7 (commit)
      from  3813482ca6f83124fa950c9b6dd3025beffb49ef (commit)

Summary of changes:
 lib/Shipwright/Script/Import.pm         |    2 +-
 share/bin/shipwright-builder            |   50 +++++++++++++++++++-----------
 share/etc/shipwright-perl-wrapper       |    4 +-
 share/etc/shipwright-script-wrapper     |    4 +-
 share/etc/shipwright-source-bash        |    2 +-
 share/etc/shipwright-source-tcsh        |    2 +-
 share/etc/shipwright-windows-setenv.bat |    2 +-
 7 files changed, 40 insertions(+), 26 deletions(-)

- Log -----------------------------------------------------------------
commit 1b576ca73fa2120fc028b0161acb9aed8444bee7
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Thu Jul 9 12:14:24 2009 +0800

    we should add $name to $imported after import $name

diff --git a/lib/Shipwright/Script/Import.pm b/lib/Shipwright/Script/Import.pm
index ac77ea6..313a41c 100644
--- a/lib/Shipwright/Script/Import.pm
+++ b/lib/Shipwright/Script/Import.pm
@@ -162,7 +162,6 @@ sub run {
             $version =
               Shipwright::Util::LoadFile( $shipwright->source->version_path );
             my ($name) = $source =~ m{.*/(.*)$};
-            $imported{$name}++;
 
             my $base = $self->_parent_dir($source);
 
@@ -226,6 +225,7 @@ sub run {
                 build_script => $script_dir,
                 overwrite    => $imported{$name} ? 0 : 1,
             );
+            $imported{$name}++;
 
             # merge new map into map.yml in repo
             my $new_map =

commit b3641400175544c77cafdb4f1c778dad48fd7a65
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri Jul 10 14:14:03 2009 +0800

    add usr/bin and usr/sbin to path too

diff --git a/share/etc/shipwright-perl-wrapper b/share/etc/shipwright-perl-wrapper
index 61825a8..ed8d992 100755
--- a/share/etc/shipwright-perl-wrapper
+++ b/share/etc/shipwright-perl-wrapper
@@ -6,13 +6,13 @@ else
     LINK=`readlink $0`
 fi
 
-if [ "$LINK" = '' ] || [ $LINK = '../etc/shipwright-perl-wrapper' ]; then
+if [ "$LINK" = '' ] || [[ $LINK =~ '../etc/shipwright-perl-wrapper' ]]; then
     BASE=$0
     BASE_DIR=`dirname "$BASE"`
     BASE_DIR=` (cd "$BASE_DIR"; pwd) `
     FILENAME=`basename "$BASE"`
     WRAPPED_DIR=`basename "$BASE_DIR"`
-    PATH=${BASE_DIR}/../sbin:${BASE_DIR}/../bin:$PATH \
+    PATH=${BASE_DIR}/../sbin:${BASE_DIR}/../bin:${BASE_DIR}/../usr/sbin:${BASE_DIR}/../usr/bin:$PATH \
     SHIPWRIGHT_PERL=$BASE_DIR/perl \
     PERL5LIB=${BASE_DIR}/../lib/perl5/site_perl:${BASE_DIR}/../lib/perl5:${PERL5LIB}\
         LD_LIBRARY_PATH=${BASE_DIR}/../lib:${LD_LIBRARY_PATH}\
diff --git a/share/etc/shipwright-script-wrapper b/share/etc/shipwright-script-wrapper
index 8407d47..5c7226c 100755
--- a/share/etc/shipwright-script-wrapper
+++ b/share/etc/shipwright-script-wrapper
@@ -6,13 +6,13 @@ else
     LINK=`readlink $0`
 fi
 
-if [ "$LINK" = '' ] || [ $LINK = '../etc/shipwright-script-wrapper' ]; then
+if [ "$LINK" = '' ] || [[ $LINK =~ '../etc/shipwright-script-wrapper' ]]; then
     BASE=$0
     BASE_DIR=`dirname "$BASE"`
     BASE_DIR=` (cd "$BASE_DIR"; pwd) `
     FILENAME=`basename "$BASE"`
     WRAPPED_DIR=`basename "$BASE_DIR"`
-    PATH=${BASE_DIR}/../sbin:${BASE_DIR}/../bin:$PATH \
+    PATH=${BASE_DIR}/../sbin:${BASE_DIR}/../bin:${BASE_DIR}/../usr/sbin:${BASE_DIR}/../usr/bin:$PATH \
     PERL5LIB=${BASE_DIR}/../lib/perl5/site_perl:${BASE_DIR}/../lib/perl5:${PERL5LIB}\
         LD_LIBRARY_PATH=${BASE_DIR}/../lib:${LD_LIBRARY_PATH}\
         DYLD_LIBRARY_PATH=${BASE_DIR}/../lib:${DYLD_LIBRARY_PATH}\
diff --git a/share/etc/shipwright-source-bash b/share/etc/shipwright-source-bash
index c7b21ee..3d5dee2 100644
--- a/share/etc/shipwright-source-bash
+++ b/share/etc/shipwright-source-bash
@@ -1,6 +1,6 @@
 #!/usr/bin/env bash
 if [ $# = 1 ]; then
-    export PATH=$1/sbin:$1/bin:$PATH
+    export PATH=$1/sbin:$1/bin:$1/usr/sbin:$1/usr/bin:$PATH
     # fix vessels which ship their own ncurses, but don't clobber $TERMINFO
     # if it's already been set
     if [ ! $TERMINFO ] && [ -d $1/share/terminfo ]; then
diff --git a/share/etc/shipwright-source-tcsh b/share/etc/shipwright-source-tcsh
index 45cecdc..d7b9b5d 100644
--- a/share/etc/shipwright-source-tcsh
+++ b/share/etc/shipwright-source-tcsh
@@ -1,6 +1,6 @@
 #!/usr/bin/env tcsh
 if ( $# == 1 ) then
-    setenv PATH $1/sbin:$1/bin:$PATH
+    setenv PATH $1/sbin:$1/bin:$1/usr/sbin:$1/usr/bin:$PATH
     # fix vessels which ship their own ncurses, but don't clobber $TERMINFO
     # if it's already been set
     if ( ! $?TERMINFO && -d $1/share/terminfo ) then
diff --git a/share/etc/shipwright-windows-setenv.bat b/share/etc/shipwright-windows-setenv.bat
index 60787ca..cad3c05 100644
--- a/share/etc/shipwright-windows-setenv.bat
+++ b/share/etc/shipwright-windows-setenv.bat
@@ -1,3 +1,3 @@
-set PATH=%1\sbin;%1\bin;%PATH%;
+set PATH=%1\sbin;%1\bin;%1\usr\sbin;%1\usr\bin;%PATH%;
 set PERL5LIB=%1\lib\perl5\site_perl;%1\lib\perl5;%PERL5LIB%;
 set LIB=%1\lib;%LIB%

commit dd42aa83cae133de64f85cf19bf67f86c9f8954a
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri Jul 10 14:16:15 2009 +0800

    wrap usr/bin and usr/sbin too

diff --git a/share/bin/shipwright-builder b/share/bin/shipwright-builder
index 9b6b4a9..5be1f66 100755
--- a/share/bin/shipwright-builder
+++ b/share/bin/shipwright-builder
@@ -132,6 +132,8 @@ $args{'install-base'} = get_install_base() unless $args{'install-base'};
 
 # replace prefix ~ with real home dir
 $args{'install-base'} =~ s/^~/(getpwuid $<)[7]/e;
+# remove last / or \
+$args{'install-base'} =~ s![/\\]$!!;
 
 unless ( $args{name} ) {
     if ( $build_base =~ m{([-.\w]+)[\\/]([.\d]+)$} ) {
@@ -312,8 +314,10 @@ sub install {
         );
 
         $ENV{PATH} =
-            catdir( $args{'install-base'}, 'bin' ) . ':'
-          . catdir( $args{'install-base'}, 'sbin' ) . ':'
+            catdir( $args{'install-base'}, 'sbin' ) . ':'
+          . catdir( $args{'install-base'}, 'bin' ) . ':'
+          . catdir( $args{'install-base'}, 'usr', 'sbin' ) . ':'
+          . catdir( $args{'install-base'}, 'usr', 'bin' ) . ':'
           . $ENV{PATH};
         $ENV{PERL_MM_USE_DEFAULT} = 1;
         $ENV{PERL_MM_OPT} = '';
@@ -486,15 +490,19 @@ sub wrap_bin {
             return;
         }
 
-        my $dir = ( splitdir($File::Find::dir) )[-1];
-        mkdir catdir( $args{'install-base'},       "$dir-wrapped" )
-          unless -d catdir( $args{'install-base'}, "$dir-wrapped" );
+        my $wrapped_dir = "$File::Find::dir-wrapped";
+        my $wrapped_file = catfile( $wrapped_dir, $file );
+        my $tmp = $File::Find::dir;
+        $tmp =~ s/$args{'install-base'}//g;
+        my $wrapped_depth =
+          scalar( splitdir($File::Find::dir) ) -
+          scalar( splitdir( $args{'install-base'} ) );
 
-        if ( -e catfile( $args{'install-base'}, "$dir-wrapped", $file ) ) {
-            print $log 'found old '
-              . catfile( $args{'install-base'}, "$dir-wrapped", $file )
-              . ', deleting' . "\n";
-            unlink catfile( $args{'install-base'}, "$dir-wrapped", $file );
+        mkdir $wrapped_dir unless -d $wrapped_dir;
+
+        if ( -e $wrapped_file ) {
+            print $log 'found old ' . $wrapped_file . ', deleting' . "\n";
+            unlink $wrapped_file;
         }
 
         my $type;
@@ -513,21 +521,26 @@ sub wrap_bin {
         }
 
         chmod oct 755, $file;
-        move( $file => catdir( $args{'install-base'}, "$dir-wrapped" ) )
-          or confess $!;
+        move( $file => $wrapped_dir ) or confess $!;
 
     # if we have this $type(e.g. perl) installed and have that specific wrapper,
     # then link to it, else link to the normal one
-        if (   $type
-            && -e catfile( '..', 'bin', $type )
-            && -e catfile( '..', 'etc', "shipwright-$type-wrapper" ) )
+        if (
+            $type
+            && (   -e catfile( '..', 'bin', $type )
+                || -e catfile( ('..') x $wrapped_depth, 'bin', $type ) )
+            && -e catfile( ('..') x $wrapped_depth, 'etc',
+                "shipwright-$type-wrapper" )
+          )
         {
-            symlink catfile( '..', 'etc', "shipwright-$type-wrapper" ) => $file
+            symlink catfile( ('..') x $wrapped_depth,
+                'etc', "shipwright-$type-wrapper" ) => $file
               or confess $!;
         }
         else {
 
-            symlink catfile( '..', 'etc', 'shipwright-script-wrapper' ) => $file
+            symlink catfile( ('..') x $wrapped_depth,
+                'etc', 'shipwright-script-wrapper' ) => $file
               or confess $!;
         }
         chmod oct 755, $file;
@@ -535,7 +548,8 @@ sub wrap_bin {
 
     my @dirs =
       grep { -d $_ }
-      map { catdir( $args{'install-base'}, $_ ) } qw/bin sbin/;
+      map { catdir( $args{'install-base'}, $_ ) } 'bin', 'sbin',
+      catdir( 'usr', 'bin' ), catdir( 'usr', 'sbin' );
     find( $sub, @dirs ) if @dirs;
 
 }

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



More information about the Bps-public-commit mailing list