[Bps-public-commit] r9940 - in bpsbuilder/BPB/lib/BPB: .

sunnavy at bestpractical.com sunnavy at bestpractical.com
Fri Dec 14 01:41:12 EST 2007


Author: sunnavy
Date: Fri Dec 14 01:41:12 2007
New Revision: 9940

Modified:
   bpsbuilder/BPB/lib/BPB/Backend.pm
   bpsbuilder/BPB/lib/BPB/Backend/SVK.pm

Log:
added etc/bpb-script-wrapper

Modified: bpsbuilder/BPB/lib/BPB/Backend.pm
==============================================================================
--- bpsbuilder/BPB/lib/BPB/Backend.pm	(original)
+++ bpsbuilder/BPB/lib/BPB/Backend.pm	Fri Dec 14 01:41:12 2007
@@ -29,6 +29,27 @@
     return $module->new(%args);
 }
 
+our $WRAPPER = <<'EOF'
+#!/bin/sh
+if [ -z `which readlink` ]; then  
+    # if we don't have readlink, we're on some pitiful platform like solaris
+    test -h $0 && BASE=`ls -l $0 | awk -F\>  '{print $NF}'`
+else
+    BASE=`readlink $0`
+fi
+if [ -z "$BASE" ]; then
+        BASE=$0
+fi
+BASE_DIR=`dirname "$BASE"`
+BASE_DIR=` (cd "$BASE_DIR"; pwd) `
+FILENAME=`basename "$BASE"`
+WRAPPED_DIR=`basename "$BASE_DIR"`
+LD_LIBRARY_PATH=${BASE_DIR}/../lib:${LD_LIBRARY_PATH}\
+    DYLD_LIBRARY_PATH=${BASE_DIR}/../lib:${DYLD_LIBRARY_PATH}\
+    exec ${BASE_DIR}/../${WRAPPED_DIR}-wrapped/${FILENAME}  "$@"
+EOF
+;
+
 1;
 
 __END__

Modified: bpsbuilder/BPB/lib/BPB/Backend/SVK.pm
==============================================================================
--- bpsbuilder/BPB/lib/BPB/Backend/SVK.pm	(original)
+++ bpsbuilder/BPB/lib/BPB/Backend/SVK.pm	Fri Dec 14 01:41:12 2007
@@ -31,12 +31,17 @@
 sub initialize {
     my $self = shift;
     my $dir = tempdir( CLEANUP => 1 );
-    for (qw/bpb dists/) {
+    for (qw/bpb dists etc/) {
         mkdir File::Spec->catfile( $dir, $_ );
     }
     open my $order,   '>', File::Spec->catfile( $dir, 'bpb', 'order.yml' );
     close $order;
 
+    open my $wrapper, '>', File::Spec->catfile( $dir, 'etc',
+            'bpb-script-wrapper' );
+    print $wrapper $BPB::Backend::WRAPPER;
+    close $wrapper;
+
     $self->import( source => $dir, _initialize => 1 );
 }
 



More information about the Bps-public-commit mailing list