| 1 | #!/usr/bin/perl | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | package Su::Build::CustomBuild; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use Fatal qw(open); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 1 | ▶ | use Data::Dumper; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 1 | ▶ | use File::Copy; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 1 | ▶ | use base 'Module::Build'; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 1 | ▶ | use Config; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 1 | our $VERSION = "0.4"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | =pod | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | CustomBuild - The custom build class. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | =head1 SYNOPSYS | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | The custom build class. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | =head1 ACTIONS | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | =over | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | =item ACTION_list | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | List up the custom actions. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 0 | ▶ | sub ACTION_list { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ACTION_list: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 0 | print "Action entries:\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 0 | my $pkg_name = __PACKAGE__; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 0 | $pkg_name =~ s/::/\//g; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 0 | for my $path (@INC) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 0 | ▶ | next if ( !-e $path . '/' . $pkg_name . ".pm" ); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 0 | open( my $f, "<", $path . '/' . $pkg_name . ".pm" ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 0 | for (<$f>) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 0 | ▶ | if ( $_ =~ /sub ACTION_([a-zA-Z0-9_]+?)\s*{/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | print $1 . "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | } ## end for my $path (@INC) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | } ## end sub ACTION_list | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 0 | ▶ | sub ACTION_add_changes { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ACTION_add_changes: not called CC=17 SCAR=57.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | # Get the latest tag version from `git tag` command. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 0 | open my $IN, "git tag|"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 0 | my @tag = <$IN>; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 0 | @tag = sort { $b <=> $a } @tag; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 0 | ▶ | my $tag_version = $tag[0] || ''; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$tag[0] || ''
MC/DC0%0/1
$tag[0] || ''
$tag[0]
Truth table0%0/2
A
A= $tag[0]
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 0 | ▶ | $tag_version =~ s/(\r|\n)//g if $tag_version; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | ## print @tag; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | # Get the latest tag version from the Changes file. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 0 | my $changes_f = "Changes"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 0 | my $changes_version = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 0 | open( my $F, '<', $changes_f ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 0 | ▶ | while ( my $line = <$F> ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 0 | $line =~ s/(\r|\n)//g; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | ## print "[trace] line:$line\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | # if ( $line =~ /^(\d+\.\d+)$/ ) { print "match:" . $1 . "\n" } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 0 | ▶ | if ( $line =~ /^(\d+\.\d+)$/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 0 | $changes_version = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | } ## end while ( my $line = <$F> ) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 0 | close $F; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | # Get the source version via ShipIt. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 0 | my $source_ver; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 0 | require ShipIt; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 0 | my $SHIP_CONF_FILE = ".shipit"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 0 | my $conf = ShipIt::Conf->parse($SHIP_CONF_FILE); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | my $state = ShipIt::State->new($conf); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 0 | $source_ver = $state->pt->current_version; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 0 | print "changes_version:$changes_version\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 0 | print "tag_version:$tag_version\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 0 | print "source_version:$source_ver\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 0 | ▶ | die | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$tag_version and $source_ver == $tag_version
MC/DC0%0/2
$tag_version and $source_ver == $tag_version
$tag_version
$source_ver == $tag_version
Truth table0%0/3
A and B
A= $tag_versionB= $source_ver == $tag_version
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | "[ERROR]The version number in the projcet source and git tag is the same. Increment source version." | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | if ( $tag_version && $source_ver == $tag_version ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | # Note that if both has the same verion, it's ok. Because repository may has some not tagged changes. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | ▶ | die | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$tag_version and $changes_version > $tag_version
MC/DC0%0/2
$tag_version and $changes_version > $tag_version
$tag_version
$changes_version > $tag_version
Truth table0%0/3
A and B
A= $tag_versionB= $changes_version > $tag_version
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | "[ERROR]The version number in the Changes is larger than the tag in repostory. So nothing to add to the Changes." | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | if ( $tag_version && $changes_version > $tag_version ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 0 | ▶ | die | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
@tag and $changes_version and not grep(/$changes_version/, @tag)
@tag and $changes_version
MC/DC0%0/3
@tag and $changes_version and not grep(/$changes_version/, @tag)
@tag
$changes_version
not grep(/$changes_version/, @tag)
Truth table0%0/4
A and B and not(C)
A= @tagB= $changes_versionC= not grep(/$changes_version/, @tag)
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | "[ERROR]The tag version in Changes not exist in the git tags. Changes mey be already updated by you manually." | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | if ( @tag && $changes_version && not grep /$changes_version/, @tag ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | # Get the log from `git log` command to add to the Changes file. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | # Make sure the date format is iso. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 0 | ▶ | my @log = $changes_version | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | ? `git log --date=iso $changes_version..HEAD` | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | # If the tag is not exist, then collect all logs. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | : `git log --date=iso`; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 0 | my @to_add; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | for my $line (@log) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 0 | ▶ | if ( $line =~ /^(commit|Author:)/ ) { # Ignore commit id and Author. | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | } elsif ( $line =~ /^\n$/ ) { # Ignore empty line. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 0 | push @to_add, $line; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | } ## end for my $line (@log) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | ## print Dumper(@to_add); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 0 | ▶ | die "[ERROR]log contents are empty." unless @to_add; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 0 | move( 'Changes', 'Changes.bak' ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 0 | open( my $Changes_fh, '>', 'Changes' ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 0 | print $Changes_fh "$source_ver\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 0 | print $Changes_fh join( "", @to_add ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | close $Changes_fh; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | # Add old entries to the new Changes. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 0 | `echo "" >> Changes`; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | `cat Changes.bak >> Changes`; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | } ## end sub ACTION_add_changes | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | ▶ | sub ACTION_refresh_modules { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ACTION_refresh_modules: not called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | # Not implemented. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | ▶ | sub ACTION_stage { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ACTION_stage: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | # Not implemented. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | =begin comment | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | This method is called instead of constructor. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | =end comment | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 1 | ▶ | sub resume { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
resume: called CC=3 SCAR=13.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 1 | ▶ | no warnings qw(once); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 1 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 1 | ▶ | no warnings 'redefine'; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | # *CustomBuild::ACTION_hoge = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | # print "action hoge\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | # }; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 1 | my $obj = $self->SUPER::resume; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | # print Dumper( $obj->{args} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | # print Dumper( $obj->{config} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | # print Dumper( $obj->{properties} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | # Get defined test_types. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 1 | my $tests = $obj->{properties}->{test_types}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | # Register the test hander. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 1 | foreach my $key ( sort keys %{$tests} ) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 2 | ▶ | *{ __PACKAGE__ . "::ACTION_test${key}" } = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | shift->generic_test( type => "${key}" ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 2 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | } ## end foreach my $key ( sort keys...) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | # Register the shipit scenarios.. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 1 | foreach my $ship_file ( glob '.shipit_*' ) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 0 | require ShipIt; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 0 | my $kind = $ship_file; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 0 | $kind =~ s/\.shipit_(.+)/$1/; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 0 | ▶ | *{ __PACKAGE__ . "::ACTION_shipit_${kind}" } = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 0 | my $SHIP_CONF_FILE = $ship_file; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 0 | print "ship file:" . $SHIP_CONF_FILE . "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 0 | my $conf = ShipIt::Conf->parse($SHIP_CONF_FILE); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 0 | my $state = ShipIt::State->new($conf); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 0 | foreach my $step ( $conf->steps ) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 0 | warn "Running step $step\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 0 | $step->run($state); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 0 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | } ## end foreach my $ship_file ( glob...) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 1 | return $obj; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | } ## end sub resume | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 0 | ▶ | sub ACTION_check_pod { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ACTION_check_pod: not called CC=14 SCAR=53.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 0 | my @files = `find lib -type f -name "*.pm"`; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | #print Dumper(@files); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 0 | for my $elm (@files) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 0 | chomp $elm; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | # print $elm . "\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 0 | open my $f, '<', $elm; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | 0 | my $txt = join '', <$f>; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | # print $txt; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | # Check missing empty line before a section. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 0 | ▶ | while ( $txt =~ /[^\n]\n(=head\d|=item\s*\w*|=cut|=over|=back|=over)/g ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 0 | my $show_txt = $` . $&; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 0 | my @show_lines = split "\n", $show_txt; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 0 | my $line_num = scalar @show_lines; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 0 | @show_lines = @show_lines[ $#show_lines - 10 ... $#show_lines ]; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | # @show_lines = grep { $_ } @show_lines; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 0 | print "\n[ERROR]no empty line:at $elm L$line_num\n" | |||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | . join( "\n", @show_lines ) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | . " <---------\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | } ## end while ( $txt =~ ...) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 0 | ▶ | while ( | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | $txt =~ /\n(=head\d|=item\s*\w*|=cut|=over|=back|=over)[^\n]*?\n[^\n]/g ) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 0 | my $show_txt = $` . $&; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 0 | my $all_txt = $` . $& . $'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 0 | my @show_lines = split "\n", $show_txt; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 0 | my @all_lines = split "\n", $all_txt; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 0 | my $line_num = scalar @show_lines; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | @show_lines = | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 0 | grep { defined $_ } | |||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | @all_lines[ $#show_lines - 10 ... $#show_lines + 5 ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | # @show_lines = grep { $_ } @show_lines; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | 0 | print "\n[ERROR]no empty line:before $elm L$line_num\n" | |||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | # . join( "\n", @show_lines ) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | . join( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | "\n", | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | ( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | @show_lines[ 0 .. $#show_lines - 6 ], | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | $show_lines[ $#show_lines - 5 ] . " <---------\n", | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | @show_lines[ $#show_lines - 4 .. $#show_lines ], | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | "\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | } ## end while ( $txt =~ ...) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | # Check excessive empty lines before a section. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 0 | ▶ | while ( $txt =~ /\n{3,}(=head\d)/g ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 0 | my $show_txt = $` . $&; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 0 | my @show_lines = split "\n", $show_txt; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 0 | my $line_num = scalar @show_lines; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | 0 | @show_lines = @show_lines[ $#show_lines - 10 ... $#show_lines ]; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | # @show_lines = grep { $_ } @show_lines; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | 0 | print "\n[ERROR]more than 2 empty line::at $elm L$line_num\n" | |||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | . join( "\n", @show_lines ) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | . " <---------\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | } ## end while ( $txt =~ /\n{3,}(=head\d)/g) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | # Check whether empty line is exit before the source section. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | 0 | my $prev_line = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 0 | ▶ | while ( | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | $txt =~ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | /\n(?:=head\d*[a-zA-Z() ]*|=item[\s\w_($)]*(?=\n))(.+?)(?:=cut|=over|=back|=over)/sg | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | # /\n(?:=head\d*[a-zA-Z() ]*|=item[\s\w_()]*)(.+?)(?:=cut|=over|=back|=over)/sg | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | # print "begin\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | 0 | my @lines = split( /\n/, $1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | 0 | my $b_code_block = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | 0 | my $line_num; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 0 | for my $line (@lines) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | 0 | ++$line_num; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | 0 | $line =~ tr/\r//; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | # print "match:$elm\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | # print "line:$line:block:$b_code_block\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | 0 | ▶ | if ( !$b_code_block && $line =~ /^\s.+/ && $prev_line ne '' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition0%0/6
not $b_code_block and $line =~ /^\s.+/ and $prev_line ne ""
not $b_code_block and $line =~ /^\s.+/
MC/DC0%0/3
not $b_code_block and $line =~ /^\s.+/ and $prev_line ne ""
not $b_code_block
$line =~ /^\s.+/
$prev_line ne ""
Truth table0%0/4
not(A) and B and C
A= not $b_code_blockB= $line =~ /^\s.+/C= $prev_line ne ""
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | 0 | print "\n[ERROR] not empty line before source part.$elm L$line_num\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | 0 | print "$prev_line\n$line\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 0 | $b_code_block = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | ▶ | } elsif ( !$b_code_block && $line =~ /^\s.+/ ) { | |||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
not $b_code_block and $line =~ /^\s.+/
MC/DC0%0/2
not $b_code_block and $line =~ /^\s.+/
not $b_code_block
$line =~ /^\s.+/
Truth table0%0/3
not(A) and B
A= not $b_code_blockB= $line =~ /^\s.+/
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | 0 | $b_code_block = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | ▶ | } elsif ( $b_code_block | |||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$b_code_block and $line =~ /^[^\s].+/
MC/DC0%0/2
$b_code_block and $line =~ /^[^\s].+/
$b_code_block
$line =~ /^[^\s].+/
Truth table0%0/3
A and B
A= $b_code_blockB= $line =~ /^[^\s].+/
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | && $line =~ /^[^\s].+/ ) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | # && $prev_line =~ /^\s.+/ ) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | 0 | $b_code_block = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | } ## end elsif ( $b_code_block && ...) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | 0 | $prev_line = $line; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | } ## end for my $line (@lines) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | # print "end\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | } ## end while ( $txt =~...) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | } ## end for my $elm (@files) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | } ## end sub ACTION_check_pod | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | 0 | ▶ | sub ACTION_uninstall { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ACTION_uninstall: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | 0 | my $module_path = $self->{properties}->{module_name}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | 0 | $module_path =~ s!::!/!g; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | my $packlist_file = | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | 0 | $Config{sitearchexp} . "/auto/" . $module_path . "/.packlist"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | 0 | ▶ | die ".packlist file not found. $packlist_file" unless -e $packlist_file; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | 0 | open( my $F, '<', $packlist_file ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | 0 | ▶ | while ( my $line = <$F> ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | 0 | $line =~ s/(\r|\n)//g; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | 0 | print "[INFO]Deleting: " . $line . "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 0 | ▶ | unlink $line or die "[ERROR]Can not delete file:" . $line . ":$!"; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | } ## end while ( my $line = <$F> ) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | 0 | print "[INFO]Deleting: " . $packlist_file . "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | 0 | ▶ | unlink $packlist_file | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | or die "[ERROR]Can not delete file:" . $packlist_file . ":$!"; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | } ## end sub ACTION_uninstall | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | # Just list up the install files. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | 0 | ▶ | sub ACTION_fakeuninstall { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ACTION_fakeuninstall: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | 0 | my $module_path = $self->{properties}->{module_name}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | 0 | $module_path =~ s!::!/!g; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | my $packlist_file = | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | 0 | $Config{sitearchexp} . "/auto/" . $module_path . "/.packlist"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | 0 | ▶ | die ".packlist file not found. $packlist_file" unless -e $packlist_file; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | 0 | open( my $F, '<', $packlist_file ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | 0 | print join( '', <$F> ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | } ## end sub ACTION_fakeuninstall | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | 0 | ▶ | sub ACTION_ms_test { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ACTION_ms_test: not called CC=8 SCAR=42.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | # The temporaly directory to extract tar.gz file for test. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | 0 | my $work_dir = 'c:/tmp'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | # my $win_perl = 'c:/perl/bin/perl.exe'; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | # Make the path of perl executable file from the PATH entry. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | 0 | my $win_perl = | |||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | `set|grep -e ^PATH=|perl -ne 'print join("\n",split ":" ,\$_);'|grep -i perl/bin|perl -ne '\$_=~s!/cygdrive/([a-z])(.*)!\$1:\$2/perl.exe!;print \$_;'`; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | 0 | chomp $win_perl; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | 0 | print "ms perl path:" . $win_perl; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | 0 | ▶ | die "perl.exe not exist: $win_perl:" unless ( -f $win_perl ); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | # `set|grep -e ^PATH=|perl -ne 'print join("\n",split ":" ,$_);'|grep -i perl/bin|perl -ne '$_=~s!/cygdrive/([a-z])(.*)!$1:$2/perl.exe!;print $_;'`; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | 0 | import Data::Dumper; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | 0 | import File::Spec; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | 0 | print Dumper( $self->{properties}->{module_name} ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | 0 | my $fname = $self->{properties}->{module_name}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | 0 | $fname =~ s/::/-/; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | 0 | my @f = glob("Su-*\.tar\.gz"); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | 0 | ▶ | unless (@f) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | 0 | die "Dist file not exist. Place the tar.gz file to the current directory."; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | 0 | print "target file:" . $f[0] . "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | # Remove old work file. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | 0 | my $work_file = File::Spec->catfile( $work_dir, $f[0] ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | 0 | ▶ | if ( -f $work_file ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | 0 | `rm $work_file`; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | # Copy to the work dir. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | 0 | `cp $f[0] $work_dir`; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | 0 | ▶ | die "target file not exist: $f[0]:" unless ( -f $f[0] ); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | 0 | my $file_mod_ts = ( stat $f[0] )[9]; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | 0 | my $file_cur_ts = time; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | 0 | print "[TRACE]file_mod_ts:$file_mod_ts\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | 0 | print "[TRACE]file_cur_ts:$file_cur_ts\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | 0 | ▶ | die "target file is too old which is build over 30 min before." | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | if $file_mod_ts < $file_cur_ts - 60 * 30; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | 0 | my $dir_name = $f[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | 0 | $dir_name =~ s/(Su-[0-9.]+)\.tar\.gz/$1/; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | 0 | print "dir_name:" . $dir_name . "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | 0 | my $uncompress_dir = File::Spec->catfile( $work_dir, $dir_name ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | # Remove old work uncompressed dir. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | 0 | ▶ | if ( -d $uncompress_dir ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | 0 | `rm -fr $uncompress_dir`; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | 0 | ▶ | unless ( -f $work_file ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | 0 | die "work file not exist."; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | 0 | my $cyg_work_file = $work_file; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | 0 | my $cyg_work_dir = $work_dir; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | 0 | $cyg_work_file =~ s/://; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | 0 | $cyg_work_dir =~ s/://; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | 0 | print "file:" . $cyg_work_file . "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | 0 | `tar -C /cygdrive/$cyg_work_dir -xvzf /cygdrive/$cyg_work_file`; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | 0 | $uncompress_dir =~ s/://; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | 0 | print "changing directory:" . $uncompress_dir . "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | 0 | print `cd /cygdrive/$uncompress_dir;$win_perl Build.PL`; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | 0 | print `cd /cygdrive/$uncompress_dir;$win_perl Build test`; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | # perl -e ' print `cd c:/tmp/Su-0.008;c:/perl/bin/perl.exe Build.PL`' | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | # perl -e ' print `cd c:/tmp/Su-0.008;c:/perl/bin/perl.exe Build help`' | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | # perl -e ' print `cd c:/tmp/Su-0.008;c:/perl/bin/perl.exe Build test`' | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | } ## end sub ACTION_ms_test | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | |||||||||||||||||||||||||||||||||||||||||||||||||||