[Bps-public-commit] Shipwright branch, master, updated. b76e2fd2a1be534249128f78c7ac721f0f670d80
? sunnavy
sunnavy at bestpractical.com
Fri Oct 22 03:17:25 EDT 2010
The branch, master has been updated
via b76e2fd2a1be534249128f78c7ac721f0f670d80 (commit)
from 0c0d50414e185debc0ecff81649589d896cbccea (commit)
Summary of changes:
lib/Shipwright/Backend/Base.pm | 5 ++-
lib/Shipwright/Script/Import.pm | 60 +++++++++++++++++++------------------
lib/Shipwright/Script/Maintain.pm | 6 ++-
lib/Shipwright/Script/Update.pm | 8 ++++-
lib/Shipwright/Source/Base.pm | 23 +++++++++++--
5 files changed, 63 insertions(+), 39 deletions(-)
- Log -----------------------------------------------------------------
commit b76e2fd2a1be534249128f78c7ac721f0f670d80
Author: sunnavy <sunnavy at bestpractical.com>
Date: Fri Oct 22 15:15:05 2010 +0800
split test_requires from build_requires
diff --git a/lib/Shipwright/Backend/Base.pm b/lib/Shipwright/Backend/Base.pm
index 9cb406b..3340a55 100644
--- a/lib/Shipwright/Backend/Base.pm
+++ b/lib/Shipwright/Backend/Base.pm
@@ -435,7 +435,7 @@ sub _fill_deps {
my $req = $self->requires( name => $name ) || {};
if ( $req->{requires} ) {
- for (qw/requires recommends build_requires/) {
+ for (qw/requires recommends build_requires test_requires/) {
push @{ $require->{$name} }, keys %{ $req->{$_} }
unless $args{"skip_$_"};
}
@@ -852,7 +852,8 @@ sub update_refs {
@deps = (
keys %{ $req->{requires} },
keys %{ $req->{recommends} },
- keys %{ $req->{build_requires} }
+ keys %{ $req->{build_requires} },
+ keys %{ $req->{test_requires} }
);
}
else {
diff --git a/lib/Shipwright/Script/Import.pm b/lib/Shipwright/Script/Import.pm
index bf9b12e..3c4f0b7 100644
--- a/lib/Shipwright/Script/Import.pm
+++ b/lib/Shipwright/Script/Import.pm
@@ -7,7 +7,7 @@ use base qw/App::CLI::Command Class::Accessor::Fast Shipwright::Script/;
__PACKAGE__->mk_accessors(
qw/comment no_follow build_script require_yml include_dual_lifed
name test_script extra_tests overwrite min_perl_version skip version as
- skip_recommends skip_all_recommends skip_installed/
+ skip_recommends skip_all_test_requires skip_all_recommends skip_installed/
);
use Shipwright;
@@ -20,22 +20,23 @@ use List::MoreUtils qw/firstidx/;
sub options {
(
- 'm|comment=s' => 'comment',
- 'name=s' => 'name',
- 'no-follow' => 'no_follow',
- 'build-script=s' => 'build_script',
- 'require-yml=s' => 'require_yml',
- 'test-script' => 'test_script',
- 'extra-tests' => 'extra_tests',
- 'overwrite' => 'overwrite',
- 'min-perl-version=s' => 'min_perl_version',
- 'skip=s' => 'skip',
- 'version=s' => 'version',
- 'as=s' => 'as',
- 'skip-recommends=s' => 'skip_recommends',
- 'skip-all-recommends' => 'skip_all_recommends',
- 'skip-installed' => 'skip_installed',
- 'include-dual-lifed' => 'include_dual_lifed'
+ 'm|comment=s' => 'comment',
+ 'name=s' => 'name',
+ 'no-follow' => 'no_follow',
+ 'build-script=s' => 'build_script',
+ 'require-yml=s' => 'require_yml',
+ 'test-script' => 'test_script',
+ 'extra-tests' => 'extra_tests',
+ 'overwrite' => 'overwrite',
+ 'min-perl-version=s' => 'min_perl_version',
+ 'skip=s' => 'skip',
+ 'version=s' => 'version',
+ 'as=s' => 'as',
+ 'skip-recommends=s' => 'skip_recommends',
+ 'skip-all-recommends' => 'skip_all_recommends',
+ 'skip-all-test-requires' => 'skip_all_test_requires',
+ 'skip-installed' => 'skip_installed',
+ 'include-dual-lifed' => 'include_dual_lifed'
);
}
@@ -116,17 +117,18 @@ sub run {
for my $source (@sources) {
my $shipwright = Shipwright->new(
- repository => $self->repository,
- source => $source,
- name => $self->name,
- follow => !$self->no_follow,
- min_perl_version => $self->min_perl_version,
- include_dual_lifed => $self->include_dual_lifed,
- skip => $self->skip,
- version => $self->version,
- skip_recommends => $self->skip_recommends,
- skip_all_recommends => $self->skip_all_recommends,
- skip_installed => $self->skip_installed,
+ repository => $self->repository,
+ source => $source,
+ name => $self->name,
+ follow => !$self->no_follow,
+ min_perl_version => $self->min_perl_version,
+ include_dual_lifed => $self->include_dual_lifed,
+ skip => $self->skip,
+ version => $self->version,
+ skip_recommends => $self->skip_recommends,
+ skip_all_recommends => $self->skip_all_recommends,
+ skip_all_test_requires => $self->skip_all_test_requires,
+ skip_installed => $self->skip_installed,
);
confess_or_die "cpan dists can't be branched"
@@ -278,7 +280,7 @@ sub _import_req {
my @sources = readdir $d;
close $d;
- for my $type (qw/requires recommends build_requires/) {
+ for my $type (qw/requires recommends build_requires test_requires/) {
for my $module ( keys %{ $req->{$type} } ) {
my $dist = $map->{$module} || $module;
$dist =~ s/::/-/g;
diff --git a/lib/Shipwright/Script/Maintain.pm b/lib/Shipwright/Script/Maintain.pm
index 9dbcb07..7058985 100644
--- a/lib/Shipwright/Script/Maintain.pm
+++ b/lib/Shipwright/Script/Maintain.pm
@@ -7,7 +7,7 @@ use Shipwright::Util;
use base qw/App::CLI::Command Class::Accessor::Fast Shipwright::Script/;
__PACKAGE__->mk_accessors(
qw/update_order update_refs graph_deps skip_recommends
- skip_build_requires skip_requires for_dists/
+ skip_build_requires skip_requires skip_test_requires for_dists/
);
use Shipwright;
@@ -20,6 +20,7 @@ sub options {
'skip-recommends' => 'skip_recommends',
'skip-requires' => 'skip_requires',
'skip-build-requires' => 'skip_build_requires',
+ 'skip-test-requires' => 'skip_test_requires',
'for-dists=s' => 'for_dists',
);
}
@@ -33,7 +34,8 @@ sub run {
$shipwright->backend->update_order(
for_dists => [ split /,\s*/, $self->for_dists || '' ],
map { $_ => $self->$_ }
- qw/skip_requires skip_recommends skip_build_requires/,
+ qw/skip_requires skip_recommends skip_build_requires
+ skip_test_requires/,
);
$self->log->fatal( 'updated order with success' );
}
diff --git a/lib/Shipwright/Script/Update.pm b/lib/Shipwright/Script/Update.pm
index 78d5ba4..64a1488 100644
--- a/lib/Shipwright/Script/Update.pm
+++ b/lib/Shipwright/Script/Update.pm
@@ -83,7 +83,7 @@ sub run {
my $name = shift or confess_or_die 'need name arg';
my $requires = $shipwright->backend->requires( name => $name ) || {};
for my $dep ( @deps ) {
- for my $type ( qw/requires build_requires recommends/ ) {
+ for my $type ( qw/requires build_requires recommends test_requires/ ) {
delete $requires->{$type}{$dep} if $requires->{$type};
}
@@ -153,7 +153,11 @@ sub run {
my ($require) =
$shipwright->backend->requires( name => $name );
- for my $type (qw/requires build_requires recommends/) {
+ for my $type (
+ qw/requires build_requires recommends
+ test_requires/
+ )
+ {
for ( keys %{ $require->{$type} } ) {
$find_deps->($_);
}
diff --git a/lib/Shipwright/Source/Base.pm b/lib/Shipwright/Source/Base.pm
index 551375f..d1bd9f1 100644
--- a/lib/Shipwright/Source/Base.pm
+++ b/lib/Shipwright/Source/Base.pm
@@ -16,7 +16,9 @@ __PACKAGE__->mk_accessors(
qw/source directory scripts_directory download_directory follow
min_perl_version map_path skip map skip_recommends skip_all_recommends
skip_installed include_dual_lifed
- keep_build_requires name log url_path version_path branches_path version/
+ keep_build_requires name log url_path version_path branches_path version
+ skip_all_test_requires
+ /
);
=head1 NAME
@@ -93,6 +95,7 @@ sub _follow {
&& $self->skip_recommends->{ $reverse_map->{ $self->name } } )
|| $self->skip_all_recommends;
push @types, 'recommends' unless $skip_recommends;
+ push @types, 'test_requires' unless $self->skip_all_test_requires;
if ( !-e $require_path ) {
@@ -222,7 +225,7 @@ sub shipwright_build_requires {
}
sub shipwright_test_requires {
- _shipwright_requires( 'build_requires', @_ == 1 ? ( @_, 0 ) : @_ );
+ _shipwright_requires( 'test_requires', @_ == 1 ? ( @_, 0 ) : @_ );
goto &test_requires;
}
@@ -243,7 +246,7 @@ sub _shipwright_requires_from {
}
sub shipwright_test_requires_from {
- _shipwright_requires_from( 'build_requires', @_ );
+ _shipwright_requires_from( 'test_requires', @_ );
goto &test_requires_from;
}
@@ -357,6 +360,13 @@ EOF
# if there's META.yml, let's find more about it
my $meta = load_yaml_file('META.yml')
or confess_or_die "can't read META.yml: $!";
+
+ # Module::Install will make test_requires into build_requires
+ for ( keys %{ $require->{test_requires} } ) {
+ delete $meta->{build_requires}{$_}
+ if exists $meta->{build_requires}{$_};
+ }
+
$require ||= {};
$require->{requires} = {
%{ $meta->{requires} || {} },
@@ -369,9 +379,13 @@ EOF
$require->{build_requires} = {
%{ $meta->{build_requires} || {} },
%{ $meta->{configure_requires} || {} },
- %{ $meta->{test_requires} || {} },
%{ $require->{build_requires} || {} },
};
+ $require->{test_requires} = {
+ %{ $meta->{test_rquires} || {} },
+ %{ $require->{test_requires} || {} },
+ };
+
}
unlink 'shipwright_makefile.pl', 'shipwright_prereqs';
@@ -562,6 +576,7 @@ EOF
# don't keep recommends info if we skip them, so we won't encounter
# them when update later
$require->{recommends} = {} if $skip_recommends;
+ $require->{test_requires} = {} if $self->skip_all_test_requires;
dump_yaml_file( $require_path, $require );
}
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list