Skip to content

Commit

Permalink
Rework dc script
Browse files Browse the repository at this point in the history
  • Loading branch information
pjcj committed Jun 15, 2024
1 parent c7460eb commit 9d67d97
Show file tree
Hide file tree
Showing 5 changed files with 412 additions and 306 deletions.
1 change: 1 addition & 0 deletions bin/cpancover
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ sub newcp {
sub main {
# TODO - only one instance should run at a time
get_options;
use Data::Dumper; say Dumper($Options) if $Options->{verbose};

if ($Options->{latest}) {
my $cp = newcp;
Expand Down
2 changes: 1 addition & 1 deletion docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ with at least the perl optree, Devel::Cover output can vary slightly between
perl releases. For this reason some Devel::Cover tests have difference golden
results depending on the perl version.

A set of perl versions can be created by running the `dc all_versions --build`
A set of perl versions can be created by running the `dc all-versions --build`
command. Once this is done golden results for all versions can be created by
running `make all_gold TEST=circular_ref`.

Expand Down
6 changes: 3 additions & 3 deletions docs/cpancover.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ cd /cover/dc
Install or upgrade a cpancover perl:

```sh
dc install_cpancover_perl 5.26.1
dc install-cpancover-perl 5.26.1
```

Run cpancover:
Expand Down Expand Up @@ -123,7 +123,7 @@ For each version there is a standard and a threaded plenv installation.

The development directory for these purposes is `/cover/Devel--Cover`. New
versions of perl can be installed by adding them to `utils/all_versions` and
running `dc all_versions --build`.
running `dc all-versions --build`.

To install a version of perl with development tools run `dc install_dc_dev_perl
To install a version of perl with development tools run `dc install-dc_dev-perl
5.38.2`.
19 changes: 13 additions & 6 deletions lib/Devel/Cover/Collection.pm
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ 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);
}

Expand All @@ -142,12 +143,14 @@ sub build_modules ($self) {
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 "add_build_dirs";
say for @{ $self->build_dirs };
# say && system "ls -al $_" for "/remote_staging",
# map "$_/build", @{$self->cpan_dir};
my $exists = sub {
Expand All @@ -159,7 +162,8 @@ sub add_build_dirs ($self) {
};
push $self->build_dirs->@*, grep { !$exists->() } grep -d,
map glob("$_/build/*"), $self->cpan_dir->@*;
# say "add_build_dirs:"; say for @{$self->build_dirs};
say "add_build_dirs:";
say for @{ $self->build_dirs };
}

sub run ($self, $build_dir) {
Expand Down Expand Up @@ -188,12 +192,13 @@ sub run ($self, $build_dir) {
# say "\n$line\n$output$line\n"; return;

# $output .= $self->sys($^X, "-V");
# $output .= $self->sys("pwd");
$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;
$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 @@ -224,7 +229,7 @@ sub run_all ($self) {
},
$self->build_dirs
);
# print Dumper \@res;
print "x" x 80, Dumper \@res;
}

sub write_json ($self, $vars) {
Expand Down Expand Up @@ -466,7 +471,9 @@ sub cover_modules ($self) {
# say "modules: ", Dumper $self->modules;

my @cmd = $self->dc_file;
push @cmd, "--local" if $self->local;
push @cmd, "--local" if $self->local;
push @cmd, "--verbose" if $self->verbose;
push @cmd, "-i", "pjcj/cpancover_dev:latest";
my @command = (@cmd, "cpancover-docker-module");
$self->_set_local_timeout(0);
my @res = iterate_as_array(
Expand Down
Loading

0 comments on commit 9d67d97

Please sign in to comment.