Skip to content

Commit

Permalink
Tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
pjcj committed Jun 15, 2024
1 parent 9d67d97 commit 5bbd6f6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 22 deletions.
21 changes: 2 additions & 19 deletions lib/Devel/Cover/Collection.pm
Original file line number Diff line number Diff line change
Expand Up @@ -127,43 +127,30 @@ sub process_module_file ($self) {
my $modules = do { local $/; <$fh> };
close $fh or die "Can't close $file: $!";
my @modules = grep /\S/, grep !/^ *#/, split /\n/, $modules;
# say "modules: @modules";
$self->add_modules(@modules);
}

sub build_modules ($self) {
my @command = qw( cpan -Ti );
push @command, "-f" if $self->force;
# my @command = qw( cpan );
# $ENV{CPAN_OPTS} = "-i -T";
# $ENV{CPAN_OPTS} .= " -f" if $self->force;
# $self->_set_local_timeout(300);
my %m;
for my $module (sort grep !$m{$_}++, $self->modules->@*) {
say "Building $module";
my $output = $self->fsys(@command, $module);
say $output;
say "-----------------------------------------------------------xxx";
}
$self->_set_local_timeout(0);
}

sub add_build_dirs ($self) {
say "add_build_dirs";
say for @{ $self->build_dirs };
# say && system "ls -al $_" for "/remote_staging",
# map "$_/build", @{$self->cpan_dir};
my $exists = sub {
# say "exists [$_]";
my $dir = "/remote_staging/" . (s|.*/||r =~ s/-\d+$/*/r);
my @files = glob $dir;
# say "checking [$dir] -> [@files]";
@files
};
push $self->build_dirs->@*, grep { !$exists->() } grep -d,
map glob("$_/build/*"), $self->cpan_dir->@*;
say "add_build_dirs:";
say for @{ $self->build_dirs };
}

sub run ($self, $build_dir) {
Expand All @@ -189,16 +176,12 @@ sub run ($self, $build_dir) {
}

$output .= "Testing $module in $build_dir\n";
# say "\n$line\n$output$line\n"; return;

# $output .= $self->sys($^X, "-V");
$output .= $self->sys("pwd");
my @cmd;
if ($self->local) {
$ENV{DEVEL_COVER_OPTIONS} = "-ignore,/usr/local/lib/perl5";
$ENV{DEVEL_COVER_TEST_OPTS} = "-Mblib=" . $self->bin_dir . "/..";
@cmd = ($^X, $ENV{DEVEL_COVER_TEST_OPTS}, $self->bin_dir . "/cover");
say "*****--[@cmd]";
} else {
@cmd = ($^X, $self->bin_dir . "/cover");
}
Expand Down Expand Up @@ -229,7 +212,6 @@ sub run_all ($self) {
},
$self->build_dirs
);
print "x" x 80, Dumper \@res;
}

sub write_json ($self, $vars) {
Expand Down Expand Up @@ -344,7 +326,8 @@ sub generate_html ($self) {
$m->{module} = $mod;
$m->{link} = "/$module/index.html" if $json->{summary}{Total}{total}{total};

for my $criterion ($vars->{criteria}->%*) {
say Dumper $vars;
for my $criterion ($vars->{criteria}->@*) {
my $summary = $json->{summary}{Total}{$criterion};
# print "summary:", Dumper $summary;
my $pc = $summary->{percentage};
Expand Down
3 changes: 0 additions & 3 deletions utils/dc
Original file line number Diff line number Diff line change
Expand Up @@ -336,21 +336,18 @@ recipe_cpancover-docker-module() {
((verbose)) && pi "[-$l-] [$dir] [$module]"
local v=
((verbose)) && v=--verbose
set -x
container=$($docker run -d \
--volume="$dcdir:/dc:ro" \
--volume="$staging:/remote_staging:ro" \
--workdir=/dc --rm=false --name="$name" \
--memory=1g \
"$docker_image" \
"$dir/utils/dc" "$l" cpancover-build-module "$module" "$v")
set +x
((verbose)) && pi "container is $container"
$docker wait "$name" # >/dev/null
# shellcheck disable=SC2181
if [[ $? == 0 ]]; then
$docker logs "$name"
echo "================================================================"
local_staging="$staging/$name"
mkdir -p "$local_staging"
$docker cp "$name:/root/staging" "$local_staging"
Expand Down

0 comments on commit 5bbd6f6

Please sign in to comment.