Skip to content

Commit

Permalink
fix: do not try to double-install modules that depend on themselves
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Schreiber authored and tomeon committed Apr 22, 2024
1 parent 68061bf commit b67ecf6
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
12 changes: 12 additions & 0 deletions App-cpanminus/xt/prereq_cycle.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
use lib ".";
use xt::Run;
use Test::More;

my $stdout = run qw(--showdeps Bundle::CPAN);

like last_build_log, qr/! Bundle::CPAN specifies itself as a dependency\./;

# Bundle::CPAN is not shown in the list of dependencies
unlike $stdout, qr/^Bundle::CPAN$/;

done_testing;
11 changes: 10 additions & 1 deletion Menlo-Legacy/lib/Menlo/CLI/Compat.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1985,7 +1985,16 @@ sub build_stuff {
push @{$dist->{want_phases}}, 'develop' if $self->{with_develop} && $depth == 0;
push @{$dist->{want_phases}}, 'configure' if $self->{with_configure} && $depth == 0;

my @deps = $self->find_prereqs($dist);
my @all_deps = $self->find_prereqs($dist);
my @deps = grep { $_->{module} ne $dist->{module} } @all_deps;

if ( @deps != @all_deps ) {
$self->chat(<<DIAG, 1);
! $dist->{module} specifies itself as a dependency.
! Omitting it from the list of dependencies.
DIAG
}

my $module_name = $self->find_module_name($configure_state) || $dist->{meta}{name};
$module_name =~ s/-/::/g;

Expand Down

0 comments on commit b67ecf6

Please sign in to comment.