| 1 | # ABSTRACT: Pull upstream distributions into the repository | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | package Pinto::Action::Pull; | ||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 4 | ▶ | use Moose; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 4 | ▶ | use MooseX::StrictConstructor; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 4 | ▶ | use MooseX::Types::Moose qw(Bool); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | 4 | ▶ | use MooseX::MarkAsMethods ( autoclean => 1 ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 4 | ▶ | use Try::Tiny; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 4 | ▶ | use Pinto::Util qw(throw); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | 4 | ▶ | use Pinto::Types qw(TargetList); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | 4 | our $VERSION = '0.14'; # VERSION | |||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | 4 | extends qw( Pinto::Action ); | |||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | 4 | has targets => ( | |||||||||||||||||||||||||||
| 26 | isa => TargetList, | ||||||||||||||||||||||||||||
| 27 | traits => [qw(Array)], | ||||||||||||||||||||||||||||
| 28 | handles => { targets => 'elements' }, | ||||||||||||||||||||||||||||
| 29 | required => 1, | ||||||||||||||||||||||||||||
| 30 | coerce => 1, | ||||||||||||||||||||||||||||
| 31 | ); | ||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | 4 | has no_fail => ( | |||||||||||||||||||||||||||
| 34 | is => 'ro', | ||||||||||||||||||||||||||||
| 35 | isa => Bool, | ||||||||||||||||||||||||||||
| 36 | default => 0, | ||||||||||||||||||||||||||||
| 37 | ); | ||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | 4 | with qw( Pinto::Role::Committable Pinto::Role::Puller ); | |||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | 3 | ▶ | sub execute { | ||||||||||||||||||||||||||
|
Subroutine
execute: called CC=2 SCAR=10.5
| |||||||||||||||||||||||||||||
| 46 | 3 | my ($self) = @_; | |||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | 3 | my $stack = $self->stack; | |||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | 3 | for my $target ( $self->targets ) { | |||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | 3 | ▶ | try { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=24.2
| |||||||||||||||||||||||||||||
| 53 | 3 | $self->repo->svp_begin; | |||||||||||||||||||||||||||
| 54 | 3 | $self->notice( "Pulling target $target to stack $stack"); | |||||||||||||||||||||||||||
| 55 | 3 | my ($dist, $did_pull, $did_pull_prereqs) = $self->pull( target => $target ); | |||||||||||||||||||||||||||
| 56 | 0 | ▶ | $self->notice("Target $target is already on stack $stack") unless $did_pull; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 57 | 0 | ▶ | push @{$self->affected}, $dist if $did_pull || $did_pull_prereqs; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$did_pull or $did_pull_prereqs
MC/DC0%0/2
$did_pull or $did_pull_prereqs
$did_pull
$did_pull_prereqs
Truth table0%0/3
A or B
A= $did_pullB= $did_pull_prereqs
| |||||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||
| 59 | 3 | ▶ | catch { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=12.4
| |||||||||||||||||||||||||||||
| 60 | 3 | ▶ | throw $_ unless $self->no_fail; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 61 | 0 | $self->result->failed( because => $_ ); | |||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | 0 | $self->repo->svp_rollback; | |||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | 0 | $self->error($_); | |||||||||||||||||||||||||||
| 66 | 0 | $self->error("Target $target failed...continuing anyway"); | |||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||
| 68 | 3 | ▶ | finally { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.2
| |||||||||||||||||||||||||||||
| 69 | 3 | my ($error) = @_; | |||||||||||||||||||||||||||
| 70 | 3 | ▶ | $self->repo->svp_release unless $error; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 71 | 3 | }; | |||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||
| 74 | 0 | $self->chrome->progress_done; | |||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||
| 76 | 0 | return $self; | |||||||||||||||||||||||||||
| 77 | } | ||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||
| 79 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||
| 81 | 4 | __PACKAGE__->meta->make_immutable; | |||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||
| 83 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||
| 85 | 4 | 1; | |||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||
| 87 | __END__ | ||||||||||||||||||||||||||||