dep-resolv: Fix wildcard handling for dependency-data.

The recent(-ish) switch to allow short name from a few months ago in the
dependency-data files was buggy in the way it handles "catch all"
dependencies.

Dependency information was already shortened down to just the module
name when it was compared against the wildcard dependency rules, which
made it impossible for most of the rules to match (e.g. a dependency for
kde/kdemultimedia/* wouldn't match against 'juk' anymore because at that
portion of the code it's not clear that juk is actually a part of that
set).

I will still have to make some other fixes to permit wildcarded
dependencies to work through indirect modules. E.g. a dependency exists
for kde/foo/bar/bar* to "first-module". A second module depends on
"bar-intermedia-module", which is really under kde/foo/bar/. If
"bar-intermedia-module" is actually being built this is not an issue as
the dependency resolver can read the full path to detect the recursive
dependency onto "first-module". But if "bar-intermedia-module" is not
being built then there's no way to tell that there's really a dependency
on "first-module" since the wildcard dependency would not match.
wilder
Michael Pyne 11 years ago
parent d9795bc462
commit 6b7decf867
  1. 45
      modules/ksb/DependencyResolver.pm

@ -241,28 +241,29 @@ sub _directDependenciesOf
#
# Internal:
#
# Given the internal dependency options data and a kde-project item, extracts
# all "catch-all" rules that apply to the given item and converts them to
# standard dependencies for that item. The dependency options are then
# appropriately updated.
# Given the internal dependency options data and a kde-project full path,
# extracts all "catch-all" rules that apply to the given item and converts
# them to standard dependencies for that item. The dependency options are
# then appropriately updated.
#
# No checks are done for logical errors (e.g. having the item depend on itself)
# and no provision is made to avoid updating a module that has already had its
# catch-all rules generated.
# No checks are done for logical errors (e.g. having the item depend on
# itself) and no provision is made to avoid updating a module that has
# already had its catch-all rules generated.
#
# Parameters:
# optionsRef - The hashref as provided to <_visitModuleAndDependencies>
# item - The kde-project short module name to generate dependencies for.
# fullName - The kde-project full project path to generate dependencies for.
sub _makeCatchAllRules
{
my ($optionsRef, $item) = @_;
my ($optionsRef, $fullName) = @_;
my $dependenciesOfRef = $optionsRef->{dependenciesOf};
my $item = _shortenModuleName($fullName);
while (my ($catchAll, $deps) = each %{$optionsRef->{catchAllDependencies}}) {
my $prefix = $catchAll;
$prefix =~ s/\*$//;
if (($item =~ /^$prefix/) || !$prefix) {
if (($fullName =~ /^$prefix/) || !$prefix) {
my $depEntry = "$item:*";
$dependenciesOfRef->{$depEntry} //= {
'-' => [ ],
@ -322,7 +323,8 @@ sub _visitModuleAndDependencies
assert_isa($module, 'ksb::Module');
if ($module->scmType() eq 'proj') {
my $item = _shortenModuleName($module->fullProjectPath());
my $fullName = $module->fullProjectPath();
my $item = _shortenModuleName($fullName);
my $branch = _getBranchOf($module) // '*';
# Since the initial build list is visited start to finish it is
@ -332,7 +334,7 @@ sub _visitModuleAndDependencies
return if ($optionsRef->{visitedItems}->{$item} // 0) == 3;
$dependentName //= $item if $module->getOption('include-dependencies');
_visitDependencyItemAndDependencies($optionsRef, "$item:$branch", $level, $dependentName);
_visitDependencyItemAndDependencies($optionsRef, $fullName, $branch, $level, $dependentName);
$optionsRef->{visitedItems}->{$item} = 3; # Mark as also in build list
}
@ -361,10 +363,11 @@ sub _visitModuleAndDependencies
# optionsRef - hashref to the module dependencies, catch-all dependencies,
# module build list, module name to <ksb::Module> mapping, and auxiliary data
# to see if a module has already been visited.
# dependencyItem - a string containing the kde-projects short name for the module,
# ':', and the specific branch name for the dependency if needed. The branch
# name is '*' if the branch doesn't matter (or can be determined only by the
# branch-group in use). E.g. 'baloo:*' or 'akonadi:master'.
# dependencyFullItem - a string containing the full kde-projects path for the
# the module. The full path is needed to handle wildcarded dependencies.
# branch - The specific branch name for the dependency if
# needed. The branch name is '*' if the branch doesn't matter (or can be
# determined only by the branch-group in use). E.g. '*' or 'master'.
# level - Level of recursion of the current call.
# dependent - *if set*, is the name of the module that requires that all of its
# dependencies be added to the build list (properly ordered) even if not
@ -378,7 +381,7 @@ sub _visitModuleAndDependencies
# was input, in the case that recursive dependency inclusion was requested.
sub _visitDependencyItemAndDependencies
{
my ($optionsRef, $dependencyItem, $level, $dependentName) = @_;
my ($optionsRef, $dependencyFullItem, $branch, $level, $dependentName) = @_;
my $visitedItemsRef = $optionsRef->{visitedItems};
my $properBuildOrderRef = $optionsRef->{properBuildOrder};
@ -387,7 +390,7 @@ sub _visitDependencyItemAndDependencies
my $moduleFactoryRef = $optionsRef->{moduleFactoryRef};
$level //= 0;
my ($item, $branch) = split(':', $dependencyItem, 2);
my $item = _shortenModuleName($dependencyFullItem);
debug ("dep-resolv: Visiting ", (' ' x $level), "$item");
@ -409,7 +412,7 @@ sub _visitDependencyItemAndDependencies
$visitedItemsRef->{$item} = 1; # Mark as currently-visiting for cycle detection.
_makeCatchAllRules($optionsRef, $item);
_makeCatchAllRules($optionsRef, $dependencyFullItem);
for my $subItem (_directDependenciesOf($dependenciesOfRef, $item, $branch)) {
my ($subItemName, $subItemBranch) = ($subItem =~ m/^([^:]+):(.*)$/);
@ -437,8 +440,8 @@ sub _visitDependencyItemAndDependencies
}
if (!$subModule) {
whisper (" y[b[*] $dependencyItem depends on $subItem, but no module builds $subItem for this run.");
_visitDependencyItemAndDependencies($optionsRef, $subItem, $level + 1, $dependentName);
whisper (" y[b[*] $item depends on $subItem, but no module builds $subItem for this run.");
_visitDependencyItemAndDependencies($optionsRef, $subItemName, $subItemBranch, $level + 1, $dependentName);
}
else {
if ($subItemBranch ne '*' && (_getBranchOf($subModule) // '') ne $subItemBranch) {

Loading…
Cancel
Save