diff --git a/App-cpanminus/xt/prereq_cycle.t b/App-cpanminus/xt/prereq_cycle.t new file mode 100644 index 00000000..672d264f --- /dev/null +++ b/App-cpanminus/xt/prereq_cycle.t @@ -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; diff --git a/Menlo-Legacy/lib/Menlo/CLI/Compat.pm b/Menlo-Legacy/lib/Menlo/CLI/Compat.pm index 00f5d4bf..7c1743f1 100644 --- a/Menlo-Legacy/lib/Menlo/CLI/Compat.pm +++ b/Menlo-Legacy/lib/Menlo/CLI/Compat.pm @@ -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(<{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;