Skip to content

Commit

Permalink
Improve error reporting for providers blocked by complex requires
Browse files Browse the repository at this point in the history
We used to report them as conflicts, which is very confusing.
  • Loading branch information
mlschroe committed Aug 27, 2024
1 parent 47069fd commit d2a9b28
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
8 changes: 8 additions & 0 deletions Build/Expand.pm
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,14 @@ sub check_conddeps_inst {
} else {
if (!@q && @cx == 1) {
next if $rtype == 2;
if (!$rtype) {
if (defined($p)) {
$aconflicts->{$cx[0]} = "conflicts with $r needed by $p";
} else {
$aconflicts->{$cx[0]} = "conflicts with $r";
}
next;
}
if (defined($p)) {
$aconflicts->{$cx[0]} = "is in conflict with $p";
} else {
Expand Down
6 changes: 5 additions & 1 deletion t/richdeps.t
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/perl -w

use strict;
use Test::More tests => 46;
use Test::More tests => 47;

require 't/testlib.pm';

Expand Down Expand Up @@ -201,3 +201,7 @@ is_deeply(\@r, [1, 'wa'], 'install (wa without nnn)');

@r = expand($config, 'foo', 'bar');
is_deeply(\@r, [undef, 'nothing provides (baz if foo) needed by bar'], 'install foo bar');

@r = expand($config, 'bar', '--directdepsend--', 'foo');
is_deeply(\@r, [undef, '(provider foo conflicts with (baz if foo) needed by bar)', 'conflict for providers of foo'], 'install bar --directdepsend-- foo');

0 comments on commit d2a9b28

Please sign in to comment.