| File: | config/auto/revision.pm |
| Coverage: | 100.0% |
| line | stmt | bran | cond | sub | code |
|---|---|---|---|---|---|
| 1 | # Copyright (C) 2005-2007, Parrot Foundation. | ||||
| 2 | |||||
| 3 - 11 | =head1 NAME config/auto/revision.pm - Parrot's configure revision =head1 DESCRIPTION Determines parrot's revision. In a release, this field is empty. =cut | ||||
| 12 | |||||
| 13 | package auto::revision; | ||||
| 14 | |||||
| 15 | 2 2 2 | use strict; | |||
| 16 | 2 2 2 | use warnings; | |||
| 17 | |||||
| 18 | 2 2 2 | use base qw(Parrot::Configure::Step); | |||
| 19 | |||||
| 20 | 2 2 2 | use Parrot::Revision; | |||
| 21 | |||||
| 22 | sub _init { | ||||
| 23 | 2 | my $self = shift; | |||
| 24 | 2 | my %data; | |||
| 25 | 2 | $data{description} = q{Determine Parrot's revision}; | |||
| 26 | 2 | $data{result} = q{}; | |||
| 27 | 2 | return \%data; | |||
| 28 | } | ||||
| 29 | |||||
| 30 | sub runstep { | ||||
| 31 | 4 | my ( $self, $conf ) = @_; | |||
| 32 | |||||
| 33 | 4 | my $revision = $Parrot::Revision::current; | |||
| 34 | |||||
| 35 | 4 | if ( defined($revision) and $revision !~ /^[a-z0-9]+$/i ) { | |||
| 36 | 1 | die "Invalid Parrot revision (SHA1): $!"; | |||
| 37 | } | ||||
| 38 | |||||
| 39 | 3 | $conf->data->set( revision => $revision ); | |||
| 40 | |||||
| 41 | 3 | if ( defined $revision ) { | |||
| 42 | 2 | $self->set_result($revision); | |||
| 43 | } | ||||
| 44 | else { | ||||
| 45 | 1 | $self->set_result("done"); | |||
| 46 | } | ||||
| 47 | |||||
| 48 | 3 | return 1; | |||
| 49 | } | ||||
| 50 | |||||
| 51 | 1; | ||||
| 52 | |||||
| 53 | # Local Variables: | ||||
| 54 | # mode: cperl | ||||
| 55 | # cperl-indent-level: 4 | ||||
| 56 | # fill-column: 100 | ||||
| 57 | # End: | ||||
| 58 | # vim: expandtab shiftwidth=4: | ||||