Skip to content

Commit

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

Generally allows installing from archives or git repositories.
  • Loading branch information
kupietz committed Sep 10, 2024
1 parent af15536 commit e2baebe
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions lib/App/cpm/Worker/Installer.pm
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,19 @@ 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']) {
$self->{logger}->log("Configuring distribution via Makefile.PL or Build.PL");
if (system("$^X Makefile.PL") != 0 && system("$^X Build.PL") != 0) {
$self->{logger}->log("Failed to configure distribution via Makefile.PL or Build.PL");
return;
}
}

my $meta = $self->_load_metafile($distfile, 'META.json', 'META.yml', 'MYMETA.json', 'MYMETA.yml');
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 e2baebe

Please sign in to comment.