Commit 2ca16048 authored by Michael Pyne's avatar Michael Pyne

dep-resolv: Fix Perl warning about non-numeric comparison.

When sorting back edges for dependency 'votes' in the new dependency
resolver, dfaure encountered Perl warnings to the effect of:

    > Argument "5/8" isn't numeric in numeric comparison (<=>) at
    > /kdesrc-build/modules/ksb/ line 776.

This turns out to be because converting an entire hash object into a
scalar value doesn't just return the number of key/value pairs, but
instead returns a string describing metadata about the hash object's
content (see

While this doesn't actually break sorting due to the way Perl constructs
the string, it does cause warnings about using numeric comparisons on

Fix by applying `scalar` to just the list of keys in the hash containing
votes, which is just a way to determine the number of keys in the hash.
parent 141d7149
Pipeline #2423 passed with stage
in 1 minute and 14 seconds
......@@ -771,8 +771,8 @@ sub _compareBuildOrder
# so it is probably a good idea to build that one earlier to help
# maximise the duration of time for which builds can be run in parallel
my $voteA = scalar(%{$moduleGraph->{$a}->{votes}});
my $voteB = scalar(%{$moduleGraph->{$b}->{votes}});
my $voteA = scalar keys %{$moduleGraph->{$a}->{votes}};
my $voteB = scalar keys %{$moduleGraph->{$b}->{votes}};
my $votes = $voteB <=> $voteA;
return $votes if $votes;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment