kde-projects: Don't return duplicate phonon modules from KDE XML.

The way kdesrc-build handles letting users type "use-modules frameworks"
and getting everything in frameworks/* back is by implementing the
wildcard search in the KDE XML reader that parses kde_projects.xml. This
uses a two-pass search for simple names, looking for 'name/*' and
'name'.

This results in duplicates, which are normally OK due to other features
in kdesrc-build that prevent duplicate modules from making it into the
build list. However a feature I'm implementing was made much more
difficult by this; easier instead just to prevent finding dups in the
first place.
wilder
Michael Pyne 11 years ago
parent 6e05bb60f1
commit 3821990bac
  1. 24
      modules/ksb/KDEXMLReader.pm

@ -90,7 +90,19 @@ sub getModulesForProject
$parser->parse($self->inputHandle());
}
my @results;
# A hash is used to hold results since the keys inherently form a set,
# since we don't want dups.
my %results;
my $findResults = sub {
for my $result (
grep {
_projectPathMatchesWildcardSearch(
$repositories{$_}->{'fullName'}, $proj)
} keys %repositories)
{
$results{$result} = 1;
};
};
# Wildcard matches happen as specified if asked for. Non-wildcard matches
# have an implicit "$proj/*" search as well for compatibility with previous
@ -98,20 +110,16 @@ sub getModulesForProject
if ($proj !~ /\*/) {
# We have to do a search to account for over-specified module names
# like phonon/phonon
push @results, grep {
_projectPathMatchesWildcardSearch($repositories{$_}->{'fullName'}, $proj)
} keys %repositories;
$findResults->();
# Now setup for a wildcard search to find things like kde/kdelibs/baloo
# if just 'kdelibs' is asked for.
$proj .= '/*';
}
push @results, grep {
_projectPathMatchesWildcardSearch($repositories{$_}->{'fullName'}, $proj)
} keys %repositories;
$findResults->();
return @repositories{@results};
return @repositories{keys %results};
}
sub xmlTagStart

Loading…
Cancel
Save