Shipwright
view release on metacpan or search on metacpan
share/bin/shipwright-builder view on Meta::CPAN
unless ( -d 'shipwright' ) {
print
"$0 expects to be run in a directory with a 'shipwright' subdirectory\n";
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,
map { $_ => 1 } split /\s*,\s*/, $args{flags} || ''
};
$args{with} = { map { split /=/ } split /\s*,\s*/, $args{with} || '' };
$args{branches} = { map { split /=/ } split /\s*,\s*/, $args{branches} || '' };
$args{make} ||=
$ENV{SHIPWRIGHT_MAKE}
|| which('make')
|| which('dmake')
|| which('nmake')
|| 'make';
$args{make} = $bin_quote . $args{make} . $bin_quote
if $args{make} =~ /\s/
&& $args{make} !~ /^$bin_quote/;
if ( is_on_windows() ) {
$args{as} ||= 'MSWin';
}
else {
my $uname = `uname 2>/dev/null`;
chomp $uname;
$args{as} ||= $uname || 'default';
}
if ( $args{only} ) {
$args{only} = { map { $_ => 1 } split /\s*,\s*/, $args{only} };
}
unless ( $args{name} ) {
if ( $build_base =~ m{([-.\w]+)[\\/]([.\d]+)$} ) {
$args{name} = "$1-$2";
}
elsif ( $build_base =~ m{([-.\w]+)$} ) {
$args{name} = $1;
}
}
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";
}
# replace prefix ~ with real home dir
$args{'install-base'} =~ s/^~/(getpwuid $<)[7]/e;
# remove last / or \
$args{'install-base'} =~ s{[/\\]$}{};
}
my ( $installed, $installed_file );
my $installed_hash = {};
unless ( $args{'no-install-base'} ) {
$installed_file =
catfile( $args{'install-base'}, "$args{as}_installed.yml" );
if ( -e $installed_file ) {
$installed = YAML::Tiny->read(
catfile( $args{'install-base'}, "$args{as}_installed.yml" ) );
if ( ref $installed->[0] eq 'ARRAY' ) {
$installed_hash = { map { $_ => 0 } @{ $installed->[0] } };
}
elsif ( ref $installed->[0] eq 'HASH' ) {
$installed_hash = $installed->[0];
}
else {
warn "invalid $args{as}_installed.yml";
}
}
else {
$installed = YAML::Tiny->new;
}
$args{'install-base'} = rel2abs( $args{'install-base'} );
}
# YAML::Tiny objects are array based.
my $order = ( YAML::Tiny->read( catfile( 'shipwright', 'order.yml' ) ) )->[0];
my $version = ( YAML::Tiny->read( catfile( 'shipwright', 'version.yml' ) ) )->[0];
my ( $flags, $ktf, $branches );
if ( -e catfile( 'shipwright', 'flags.yml' ) ) {
$flags = ( YAML::Tiny->read( catfile( 'shipwright', 'flags.yml' ) ) )->[0];
}
$flags ||= {};
if ( -e catfile( 'shipwright', 'known_test_failures.yml' ) ) {
$ktf =
( YAML::Tiny->read( catfile( 'shipwright', 'known_test_failures.yml' ) ) )
->[0];
}
$ktf ||= {};
if ( -e catfile( 'shipwright', 'branches.yml' ) ) {
$branches =
( YAML::Tiny->read( catfile( 'shipwright', 'branches.yml' ) ) )->[0]
|| {};
for my $name ( keys %{ $args{branches} } ) {
die 'no branch name ' . $args{branches}->{$name} . " for $name"
unless grep { $_ eq $args{branches}->{$name} }
@{ $branches->{$name} || [] };
}
}
( run in 1.093 second using v1.01-cache-2.11-cpan-5837b0d9d2c )