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

sunnavy at bestpractical.com sunnavy at bestpractical.com
Tue Jun 16 21:46:25 EDT 2009


The branch, master has been updated
       via  dd6da8213f4e9b0e00b5b3fcd3c82c0508472607 (commit)
       via  65013120e049312cb01387845f94abdc82435063 (commit)
      from  c79928f0c3e337686237a80a2a8a8162beb9c679 (commit)

Summary of changes:
 lib/Shipwright/Backend.pm    |    1 +
 lib/Shipwright/Source.pm     |   10 ++++++++++
 share/bin/shipwright-builder |    3 +++
 3 files changed, 14 insertions(+), 0 deletions(-)

- Log -----------------------------------------------------------------
commit 65013120e049312cb01387845f94abdc82435063
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Wed Jun 17 09:40:19 2009 +0800

    expand ~ in the path

diff --git a/lib/Shipwright/Source.pm b/lib/Shipwright/Source.pm
index 92f4566..3731776 100644
--- a/lib/Shipwright/Source.pm
+++ b/lib/Shipwright/Source.pm
@@ -66,6 +66,7 @@ sub new {
 sub type {
     my $source = shift;
 
+    _translate_source( $source );
     # prefix that can't be omitted
     if ( $$source =~ /^file:.*\.(tar\.gz|tgz|tar\.bz2)$/ ) {
         $$source =~ s/^file://i;
@@ -98,6 +99,15 @@ sub type {
 
 }
 
+sub _translate_source {
+    my $source = shift;
+    if ( $$source =~ /^(file|dir(ectory)?|shipwright):~/i ) {
+
+        # replace prefix ~ with real home dir
+        $$source =~ s/~/(getpwuid $<)[7]/e;
+    }
+}
+
 1;
 
 __END__
diff --git a/share/bin/shipwright-builder b/share/bin/shipwright-builder
index e928df9..9b6b4a9 100755
--- a/share/bin/shipwright-builder
+++ b/share/bin/shipwright-builder
@@ -130,6 +130,9 @@ if ( $args{only} ) {
 
 $args{'install-base'} = get_install_base() unless $args{'install-base'};
 
+# replace prefix ~ with real home dir
+$args{'install-base'} =~ s/^~/(getpwuid $<)[7]/e;
+
 unless ( $args{name} ) {
     if ( $build_base =~ m{([-.\w]+)[\\/]([.\d]+)$} ) {
         $args{name} = "$1-$2";

commit dd6da8213f4e9b0e00b5b3fcd3c82c0508472607
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Wed Jun 17 09:43:56 2009 +0800

    expand ~ for fs backend too

diff --git a/lib/Shipwright/Backend.pm b/lib/Shipwright/Backend.pm
index 206473e..8d6cb8b 100644
--- a/lib/Shipwright/Backend.pm
+++ b/lib/Shipwright/Backend.pm
@@ -24,6 +24,7 @@ sub new {
     }
     elsif ( $args{repository} =~ m{^\s*fs:} ) {
         $args{repository} =~ s{^\s*fs:}{};
+        $args{repository} =~ s/^~/(getpwuid $<)[7]/e;
         my $abs_path = abs_path($args{repository});
         $args{repository} = $abs_path if $abs_path;
         $module = 'Shipwright::Backend::FS';

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



More information about the Bps-public-commit mailing list