[Bps-public-commit] Shipwright branch, master, updated. 5015fbcbc5569387c9b58d66ee8fe1527eea6ed5
sunnavy at bestpractical.com
sunnavy at bestpractical.com
Thu Apr 30 02:35:50 EDT 2009
The branch, master has been updated
via 5015fbcbc5569387c9b58d66ee8fe1527eea6ed5 (commit)
from 7282a7e2d8746ac794b7cb722bfcae58a984966a (commit)
Summary of changes:
share/bin/shipwright-utility | 39 ++++++++++++++++++++++++++++++++++++++-
1 files changed, 38 insertions(+), 1 deletions(-)
- Log -----------------------------------------------------------------
commit 5015fbcbc5569387c9b58d66ee8fe1527eea6ed5
Author: sunnavy <sunnavy at gmail.com>
Date: Thu Apr 30 14:30:56 2009 +0800
add generate-tar-file option for shipwright-utility
diff --git a/share/bin/shipwright-utility b/share/bin/shipwright-utility
index f0dbece..4c996d2 100755
--- a/share/bin/shipwright-utility
+++ b/share/bin/shipwright-utility
@@ -11,7 +11,9 @@ my %args;
confess "unknown option"
unless GetOptions( \%args, 'update-order', 'keep-requires=s',
- 'keep-recommends=s', 'keep-build-requires=s', 'for-dists=s', 'help', );
+ 'keep-recommends=s', 'keep-build-requires=s', 'for-dists=s', 'help',
+ 'generate-tar-file=s',
+ );
my $USAGE = <<'END'
run: ./bin/shipwright-utility --update-order
@@ -30,6 +32,9 @@ update-order: regenerate install order.
e.g. --update-order --keep-recommends 0 --for-dists Jifty-DBI,Jifty
+generate-tar-file: generate a self executable tar file
+ e.g. --generate-tar-file /tmp/foo
+
END
;
@@ -75,6 +80,38 @@ if ( $args{'update-order'} ) {
my $order = $dep->schedule_all();
DumpFile( 'shipwright/order.yml', $order );
+ print "updated order with success\n";
+}
+elsif ( $args{'generate-tar-file'} ) {
+ require File::Spec;
+ require Cwd;
+ my $cwd = Cwd::getcwd();
+ my @dirs = File::Spec->splitdir( $cwd );
+ my $name = pop @dirs;
+ my $parent_dir = File::Spec->catdir( @dirs );
+ my $tar_file = Cwd::abs_path( $args{'generate-tar-file'} );
+
+ chdir $parent_dir;
+ open my $tar_out, '>', $tar_file or die $!;
+ chmod 0755, $tar_file; ## no critic
+ print $tar_out <<'EOF';
+#!/usr/bin/env perl
+open (my $tar,'|tar xz 2>/dev/null');
+while (<DATA>) {
+ print $tar $_;
+}
+close $tar;
+EOF
+ print $tar_out <<EOF;
+exec("cd $name; bin/shipwright-builder \@ARGV");
+__DATA__
+EOF
+ open my $tar_in, "tar cz $name |" or die $!;
+ while ( <$tar_in> ) {
+ print $tar_out $_;
+ }
+ chdir $cwd;
+ print "generated with success\n";
}
sub fill_deps {
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list