[Bps-public-commit] Shipwright branch, master, updated. 929e7a1d32dc27943fad9ba0e5a7f8d876b63ee5
? sunnavy
sunnavy at bestpractical.com
Mon May 24 02:37:54 EDT 2010
The branch, master has been updated
via 929e7a1d32dc27943fad9ba0e5a7f8d876b63ee5 (commit)
via 7e1d9a920e1068ea2980ad203fe0da36210200bb (commit)
via 7e431b22338bb96b4cea45cdf677a9a81a1a6f54 (commit)
from 9a693c511291b86a7dc312b571cf803ff59c1812 (commit)
Summary of changes:
lib/Shipwright/Script/Import.pm | 5 +-
share/bin/shipwright-builder | 330 +++++++++++++++++++++------------------
2 files changed, 180 insertions(+), 155 deletions(-)
- Log -----------------------------------------------------------------
commit 7e431b22338bb96b4cea45cdf677a9a81a1a6f54
Author: sunnavy <sunnavy at bestpractical.com>
Date: Fri May 21 15:12:08 2010 +0800
not try which cmd: it does not work at all on windows
diff --git a/share/bin/shipwright-builder b/share/bin/shipwright-builder
index 5b68990..eeb24fc 100755
--- a/share/bin/shipwright-builder
+++ b/share/bin/shipwright-builder
@@ -117,6 +117,9 @@ unless ( -d 'shipwright' ) {
exit -1;
}
+my $bin_quote = is_on_windows() ? q{"} : q{'};
+my $bin_ext = $Config{_exe};
+
$args{skip} = { map { $_ => 1 } split /\s*,\s*/, $args{skip} || '' };
$args{flags} = {
default => 1,
@@ -861,27 +864,20 @@ sub is_on_windows {
return $^O =~ /MSWin/;
}
-my $bin_quote = is_on_windows() ? q{"} : q{'};
-my $bin_ext = $Config{_exe};
sub which {
my $name = shift;
my $path;
- eval '$path = `which $name`';
- chomp $path;
- if ( !$path ) {
-
- # fallback to our way
-LINE:
- for my $dir ( path() ) {
- my $path = catfile( $dir, $name );
-
- # XXX any other names need to try?
- my @try = grep { -x } ( $path, $path .= $bin_ext );
- for my $try (@try) {
- $path = $try;
- last LINE;
- }
+
+ LINE:
+ for my $dir ( path() ) {
+ my $p = catfile( $dir, $name );
+
+ # XXX any other names need to try?
+ my @try = grep { -x } ( $p, $p . $bin_ext );
+ for my $try (@try) {
+ $path = $try;
+ last LINE;
}
}
commit 7e1d9a920e1068ea2980ad203fe0da36210200bb
Author: sunnavy <sunnavy at bestpractical.com>
Date: Mon May 24 10:29:11 2010 +0800
set the min_perl_version to the running perl if not exist
diff --git a/lib/Shipwright/Script/Import.pm b/lib/Shipwright/Script/Import.pm
index 434e5c2..d358088 100644
--- a/lib/Shipwright/Script/Import.pm
+++ b/lib/Shipwright/Script/Import.pm
@@ -48,9 +48,10 @@ sub run {
confess_or_die "--name and --as args are not supported when importing multiple sources"
if @sources > 1 && $self->name;
- if ( $self->min_perl_version ) {
+ {
require version;
- my $version = version->new( $self->min_perl_version );
+ my $version =
+ version->new( $self->min_perl_version || $Config{version} );
$self->min_perl_version( $version->numify );
}
commit 929e7a1d32dc27943fad9ba0e5a7f8d876b63ee5
Author: sunnavy <sunnavy at bestpractical.com>
Date: Mon May 24 14:38:09 2010 +0800
add --no-install-base option, so we can install dists to their default directory
diff --git a/share/bin/shipwright-builder b/share/bin/shipwright-builder
index eeb24fc..591aa84 100755
--- a/share/bin/shipwright-builder
+++ b/share/bin/shipwright-builder
@@ -37,6 +37,7 @@ confess "unknown option"
'with=s', 'noclean-after-install',
'make=s', 'branches=s',
'verbose', 'as=s',
+ 'no-install-base',
);
my $USAGE = <<'END';
@@ -49,6 +50,7 @@ Commonly used options:
directory. (Note that vessels are relocatable
once built)
Ex: --install-base /home/local/mydist
+ --no-install-base install to the default directory for each dist
--skip-test Don't run any tests at all
--skip-test-except-final Only run tests for the final package built
--skip-man-pages Don't install man pages for perl modules
@@ -149,20 +151,23 @@ if ( $args{only} ) {
$args{only} = { map { $_ => 1 } split /\s*,\s*/, $args{only} };
}
-$args{'install-base'} = get_install_base() unless $args{'install-base'};
+unless ( $args{'no-install-base'} ) {
+ $args{'install-base'} = get_install_base() unless $args{'install-base'};
-unless ( $args{'install-base'} ) {
- my $dir = tempdir( 'vessel_' . $args{name} . '-XXXXXX', TMPDIR => 1 );
- $args{'install-base'} = catdir( $dir, $args{name} );
- print "no default install-base, will set it to $args{'install-base'}\n";
-}
+ unless ( $args{'install-base'} ) {
+ my $dir = tempdir( 'vessel_' . $args{name} . '-XXXXXX', TMPDIR => 1 );
+ $args{'install-base'} = catdir( $dir, $args{name} );
+ print "no default install-base, will set it to $args{'install-base'}\n";
+ }
+ # replace prefix ~ with real home dir
+ $args{'install-base'} =~ s/^~/(getpwuid $<)[7]/e;
+
+ # remove last / or \
+ $args{'install-base'} =~ s{[/\\]$}{};
+}
-# 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]+)$} ) {
@@ -301,154 +306,171 @@ sub install {
print $fh $args{'install-base'};
close $fh;
- unless ( $args{perl} && -e $args{perl} ) {
- my $perl = catfile( $args{'install-base'}, 'bin', 'perl' );
- # -e $perl makes sense when we install onto another vessel
- if ( ( grep { /^perl/ } @$order ) || -e $perl ) {
- $args{perl} = $perl;
+# this dirty hack means that ExtUtils::AutoInstall won't try to recurse and run cpan
+ $ENV{'PERL5_CPANPLUS_IS_RUNNING'} = 1;
+ $ENV{'AUTOMATED_TESTING'} = 1; # Term::ReadLine::Perl and others
+ # use this to not prompt
+ $ENV{PERL_MM_USE_DEFAULT} = 1;
+ $ENV{PERL_MM_OPT} = '';
+ $ENV{MODULEBUILDRC} = '';
+
+ mkdir 'dists' unless -e 'dists';
+
+ if ( $args{'no-install-base'} ) {
+ for my $dist (@$order) {
+ _install( $dist, $log );
+ _record( $dist, $log );
+ chdir $build_base;
}
+ print "install finished\n";
}
+ else {
- {
+ unless ( $args{perl} && -e $args{perl} ) {
+ my $perl = catfile( $args{'install-base'}, 'bin', 'perl' );
- my $arch_command = $args{perl} || $^X;
- if ( is_on_windows() ) {
- $arch_command .= q{ -MConfig -e "print $Config{archname}"};
- }
- else {
- $arch_command .= q{ -MConfig -e 'print $Config{archname}'};
+ # -e $perl makes sense when we install onto another vessel
+ if ( ( grep { /^perl/ } @$order ) || -e $perl ) {
+ $args{perl} = $perl;
+ }
}
- my $arch = `$arch_command`;
- no warnings 'uninitialized';
+ {
-# this dirty hack means that ExtUtils::AutoInstall won't try to recurse and run cpan
- $ENV{'PERL5_CPANPLUS_IS_RUNNING'} = 1;
- $ENV{'AUTOMATED_TESTING'} = 1; # Term::ReadLine::Perl and others
- # use this to not prompt
- $ENV{DYLD_LIBRARY_PATH} =
- catdir( $args{'install-base'}, 'lib' ) . ':'
- . $ENV{DYLD_LIBRARY_PATH};
- $ENV{LD_LIBRARY_PATH} =
- catdir( $args{'install-base'}, 'lib' ) . ':' . $ENV{LD_LIBRARY_PATH};
- $ENV{PERL5LIB} = join(
- ':',
- catdir( 'blib', 'lib' ),
- catdir( 'blib', 'arch' ),
- $inc_lib, #BLIB COMES FIRST TO PLEASE MODULE::BUILD
- catdir(
- $args{'install-base'}, 'lib', 'perl5', $arch
-
- ),
- catdir( $args{'install-base'}, 'lib', 'perl5', 'site_perl' ),
- catdir( $args{'install-base'}, 'lib', 'perl5' ),
- );
-
- $ENV{PATH} =
- 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} = '';
- $ENV{MODULEBUILDRC} = '';
- $ENV{LDFLAGS} .= ' -L' . catdir( $args{'install-base'}, 'lib' );
- $ENV{CFLAGS} .= ' -I' . catdir( $args{'install-base'}, 'include' );
- }
-
- mkpath $args{'install-base'} unless -e $args{'install-base'};
-
- mkdir catdir( $args{'install-base'}, 'etc' )
- unless -e catdir( $args{'install-base'}, 'etc' );
- mkdir catdir( $args{'install-base'}, 'tools' )
- unless -e catdir( $args{'install-base'}, 'tools' );
-
- for ( 'shipwright-script-wrapper', 'shipwright-perl-wrapper' ) {
- rcopy( catfile( 'etc', $_ ),
- catfile( $args{'install-base'}, 'etc', $_ ) );
- }
-
- for ( 'shipwright-utility', 'shipwright-source-bash',
- 'shipwright-source-tcsh' )
- {
- rcopy( catfile( 'etc', $_ ),
- catfile( $args{'install-base'}, 'tools', $_ ) );
- }
+ my $arch_command = $args{perl} || $^X;
+ if ( is_on_windows() ) {
+ $arch_command .= q{ -MConfig -e "print $Config{archname}" };
+ }
+ else {
+ $arch_command .= q{ -MConfig -e 'print $Config{archname}'};
+ }
+ my $arch = `$arch_command`;
+
+ no warnings 'uninitialized';
+ $ENV{DYLD_LIBRARY_PATH} =
+ catdir( $args{'install-base'}, 'lib' ) . ':'
+ . $ENV{DYLD_LIBRARY_PATH};
+ $ENV{LD_LIBRARY_PATH} =
+ catdir( $args{'install-base'}, 'lib' ) . ':'
+ . $ENV{LD_LIBRARY_PATH};
+ $ENV{PERL5LIB} = join(
+ ':',
+ catdir( 'blib', 'lib' ),
+ catdir( 'blib', 'arch' ),
+ $inc_lib, #BLIB COMES FIRST TO PLEASE MODULE::BUILD
+ catdir(
+ $args{'install-base'}, 'lib', 'perl5', $arch
+
+ ),
+ catdir( $args{'install-base'}, 'lib', 'perl5', 'site_perl' ),
+ catdir( $args{'install-base'}, 'lib', 'perl5' ),
+ );
+
+ $ENV{PATH} =
+ 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{LDFLAGS} .= ' -L' . catdir( $args{'install-base'}, 'lib' );
+ $ENV{CFLAGS} .= ' -I' . catdir( $args{'install-base'}, 'include' );
+ }
- chmod oct 755,
- catfile( $args{'install-base'}, 'tools', 'shipwright-utility' );
+ mkpath $args{'install-base'} unless -e $args{'install-base'};
- # remove lib it's symbolic link
- for my $r ('lib') {
- my $dir = catdir( $args{'install-base'}, $r );
- unlink $dir if -l $dir;
- }
+ mkdir catdir( $args{'install-base'}, 'etc' )
+ unless -e catdir( $args{'install-base'}, 'etc' );
+ mkdir catdir( $args{'install-base'}, 'tools' )
+ unless -e catdir( $args{'install-base'}, 'tools' );
- # remove (usr/)?s?bin if it's an install from start
- unless ( keys %$installed_hash ) {
- for my $r ( 'bin', 'sbin', catdir( 'usr', 'bin' ),
- catdir( 'usr', 'sbin' ), )
+ for ( 'shipwright-script-wrapper', 'shipwright-perl-wrapper' ) {
+ rcopy( catfile( 'etc', $_ ),
+ catfile( $args{'install-base'}, 'etc', $_ ) );
+ }
+
+ for ( 'shipwright-utility', 'shipwright-source-bash',
+ 'shipwright-source-tcsh' )
{
+ rcopy( catfile( 'etc', $_ ),
+ catfile( $args{'install-base'}, 'tools', $_ ) );
+ }
+
+ chmod oct 755,
+ catfile( $args{'install-base'}, 'tools', 'shipwright-utility' );
+
+ # remove lib it's symbolic link
+ for my $r ('lib') {
my $dir = catdir( $args{'install-base'}, $r );
- next unless -e $dir;
- rmtree( $dir );
+ unlink $dir if -l $dir;
}
- }
- mkdir 'dists' unless -e 'dists';
- for my $dist (@$order) {
- _install( $dist, $log );
- _record( $dist, $log );
- chdir $build_base;
- }
+ # remove (usr/)?s?bin if it's an install from start
+ unless ( keys %$installed_hash ) {
+ for my $r (
+ 'bin', 'sbin',
+ catdir( 'usr', 'bin' ),
+ catdir( 'usr', 'sbin' ),
+ )
+ {
+ my $dir = catdir( $args{'install-base'}, $r );
+ next unless -e $dir;
+ rmtree($dir);
+ }
+ }
- mkdir catdir( $args{'install-base'}, 'bin' )
- unless -e catdir( $args{'install-base'}, 'bin' );
+ for my $dist (@$order) {
+ _install( $dist, $log );
+ _record( $dist, $log );
+ chdir $build_base;
+ }
- # in case wrappers are overwritten by accident
- for ( 'shipwright-script-wrapper', 'shipwright-perl-wrapper' ) {
- rcopy( catfile( 'etc', $_ ),
- catfile( $args{'install-base'}, 'etc', $_ ) );
- }
+ mkdir catdir( $args{'install-base'}, 'bin' )
+ unless -e catdir( $args{'install-base'}, 'bin' );
- my $cwd = getcwd;
- chdir $args{'install-base'};
- open my $tmp_fh, '>', '__as',
- or confess "can't wriite to $args{'install-base'}/__as: $!";
- print $tmp_fh $args{as};
- close $tmp_fh;
+ # in case wrappers are overwritten by accident
+ for ( 'shipwright-script-wrapper', 'shipwright-perl-wrapper' ) {
+ rcopy( catfile( 'etc', $_ ),
+ catfile( $args{'install-base'}, 'etc', $_ ) );
+ }
- mkdir 'as';
- my $as_dir = catdir( 'as', $args{as} );
- mkdir $as_dir;
+ my $cwd = getcwd;
+ chdir $args{'install-base'};
+ open my $tmp_fh, '>', '__as',
+ or confess "can't wriite to $args{'install-base'}/__as: $!";
+ print $tmp_fh $args{as};
+ close $tmp_fh;
+
+ mkdir 'as';
+ my $as_dir = catdir( 'as', $args{as} );
+ mkdir $as_dir;
- unless( is_on_windows() ) {
- for my $r ( 'lib', 'bin', 'sbin' ) {
- next unless -e $r;
- my $dir = catdir( $as_dir, $r );
- rmove( $r, catdir( $as_dir, $r ) );
+ unless ( is_on_windows() ) {
+ for my $r ( 'lib', 'bin', 'sbin' ) {
+ next unless -e $r;
+ my $dir = catdir( $as_dir, $r );
+ rmove( $r, catdir( $as_dir, $r ) );
- if ( $r !~ /bin/ ) {
- symlink $dir, $r;
+ if ( $r !~ /bin/ ) {
+ symlink $dir, $r;
+ }
}
- }
- # in usr dir
- my $usr_dir = catdir( $as_dir, 'usr' );
- mkdir $usr_dir;
- for my $r ( 'bin', 'sbin' ) {
- next unless -e catdir( 'usr', $r );
- rmove( catdir( 'usr', $r ), catdir( $usr_dir, $r ) );
+ # in usr dir
+ my $usr_dir = catdir( $as_dir, 'usr' );
+ mkdir $usr_dir;
+ for my $r ( 'bin', 'sbin' ) {
+ next unless -e catdir( 'usr', $r );
+ rmove( catdir( 'usr', $r ), catdir( $usr_dir, $r ) );
+ }
+ chdir $cwd;
+
+ wrap_bin($log);
}
- chdir $cwd;
- wrap_bin($log);
+ print "install finished, the dists are at $args{'install-base'}\n";
+ print $log "install finished, the dists are at $args{'install-base'}\n";
}
-
- print "install finished, the dists are at $args{'install-base'}\n";
- print $log "install finished, the dists are at $args{'install-base'}\n";
}
sub _install {
@@ -640,8 +662,16 @@ sub substitute {
my $text = shift;
return unless $text;
- my $install_base = $args{'install-base'};
- $text =~ s/%%INSTALL_BASE%%/$install_base/g;
+ if ( $args{'no-install-base'} ) {
+ $text =~ s/\s+\S*%%INSTALL_BASE%%\S*/ /g;
+ if ( $text =~ /Build\.PL/ ) {
+ $text =~ s/--install_path//g;
+ }
+ }
+ else {
+ my $install_base = $args{'install-base'};
+ $text =~ s/%%INSTALL_BASE%%/$install_base/g;
+ }
my $perl;
@@ -651,7 +681,6 @@ sub substitute {
else {
$perl = $^X;
}
-
my $perl_archname;
if ( is_on_windows() ) {
$perl_archname = `$perl -MConfig -e "print \$Config{archname}"`;
@@ -659,7 +688,6 @@ sub substitute {
else {
$perl_archname = `$perl -MConfig -e 'print \$Config{archname}'`;
}
-
$text =~ s/%%PERL%%/$perl -I$inc_lib -MShipwright::Util::CleanINC/g;
$text =~ s/%%PERL_ARCHNAME%%/$perl_archname/g;
$text =~ s/%%MODULE_BUILD_EXTRA%%//g;
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list