| 1 | #!/usr/bin/env perl | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | # Copyright (c) 2015-2019 Christian Jaeger, copying@christianjaeger.ch | ||||||||||||||||||||||||||||
| 4 | # This is free software. See the file COPYING.md that came bundled | ||||||||||||||||||||||||||||
| 5 | # with this file. | ||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | # Expand some .pm files to avoid dependency on Sub::Call::Tail: | ||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | # (XX could also include intro/more_tailcalls here and call this | ||||||||||||||||||||||||||||
| 10 | # instead from t/trampoline-fix, but so what) | ||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 3 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | 3 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 14 | 3 | ▶ | use warnings FATAL => 'uninitialized'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | 3 | ▶ | use lib "./lib"; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 17 | 3 | ▶ | use Chj::xperlfunc qw(dirname xxsystem_safe xLmtime XLmtime xmkdir_p); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | 3 | my $windows = 1; #($^O =~ /win32/i); | |||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | 12 | ▶ | sub executable { | ||||||||||||||||||||||||||
|
Subroutine
executable: called CC=3 SCAR=11.6
| |||||||||||||||||||||||||||||
| 22 | 12 | my ($path) = @_; | |||||||||||||||||||||||||||
| 23 | 12 | ▶ | if ($windows) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | # -x apparently doesn't work; thus: | ||||||||||||||||||||||||||||
| 26 | 12 | ▶ | open my $in, "<", $path or die "open '$path': $!"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 27 | 12 | my $line = <$in>; | |||||||||||||||||||||||||||
| 28 | 12 | close $in; | |||||||||||||||||||||||||||
| 29 | 12 | $line =~ /^#!/ | |||||||||||||||||||||||||||
| 30 | } else { | ||||||||||||||||||||||||||||
| 31 | 0 | -x $path | |||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||
| 33 | } | ||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | 3 | ▶ | open my $manif, "<", "MANIFEST" or die "$!"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | 3 | local $_; | |||||||||||||||||||||||||||
| 38 | 3 | ▶ | while (<$manif>) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 39 | 972 | chomp; | |||||||||||||||||||||||||||
| 40 | 972 | ▶ | next unless m{^htmlgen/}; # if m{^(?:lib|meta)/}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 41 | 57 | ▶ | next unless m|\.pm$| or executable $_; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
/\.pm$/ or executable($_)
MC/DC100%2/2
/\.pm$/ or executable($_)
/\.pm$/
executable($_)
Truth table100%3/3
A or B
A= /\.pm$/B= executable($_)
| |||||||||||||||||||||||||||||
| 42 | 48 | my $from = $_; | |||||||||||||||||||||||||||
| 43 | 48 | my $to = "." . $from; | |||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | 48 | my $t_from = xLmtime $from; | |||||||||||||||||||||||||||
| 46 | 16 | ▶ | my $expand = sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 47 | 16 | xxsystem_safe($^X, "bin/expand-tail", $from, $to); | |||||||||||||||||||||||||||
| 48 | 48 | }; | |||||||||||||||||||||||||||
| 49 | 48 | ▶ | if (my $t_to = XLmtime $to) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 50 | 32 | ▶ | if ($t_from >= $t_to) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 51 | 0 | &$expand; | |||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||
| 53 | } else { | ||||||||||||||||||||||||||||
| 54 | 16 | xmkdir_p dirname $to; | |||||||||||||||||||||||||||
| 55 | 16 | &$expand; | |||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | 3 | ▶ | close $manif or die $!; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||