Skip to content

Commit

Permalink
Build META files if not included
Browse files Browse the repository at this point in the history
Resolves skaji#230

Generally allow installing from source archives, source archive URLs and
git repositories.
  • Loading branch information
kupietz committed Sep 10, 2024
1 parent af15536 commit e84540a
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions lib/App/cpm/Worker/Installer.pm
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,22 @@ sub fetch {

chdir $dir or die;

my $meta = $self->_load_metafile($distfile, 'META.json', 'META.yml');
my @accepted_meta_files = ('META.json', 'META.yml', 'MYMETA.json', 'MYMETA.yml');

if (!grep -f, \@accepted_meta_files && grep -f, [ 'Makefile.PL', 'Build.PL' ]) {
my $makefile = (-f "Makefile.PL" ? "Makefile" : "Build");
$self->{logger}->log("Configuring distribution via $makefile.PL");
my @cmd = ($self->{menlo}->{perl}, "$makefile.PL");
push @cmd, 'PUREPERL_ONLY=1' if $self->{pureperl_only};
$self->_retry(sub {
$self->{menlo}->configure(\@cmd, $self->{menlo_dist}, 1);
-f $makefile;
});
}

my $meta = $self->_load_metafile($distfile, @accepted_meta_files);
if (!$meta) {
$self->{logger}->log("Distribution does not have META.json nor META.yml");
$self->{logger}->log("Distribution lacks both META.json and META.yml files, and neither MYMETA.json nor MYMETA.yml can be generated");
return;
}
my $p = $meta->{provides} || $self->menlo->extract_packages($meta, ".");
Expand Down

0 comments on commit e84540a

Please sign in to comment.