From 1d76940879043865cd1e442c6a0f5acafe1eb1ba Mon Sep 17 00:00:00 2001 From: Michael Pyne Date: Sat, 9 Feb 2013 21:30:23 -0500 Subject: [PATCH] kde-projects: Support ignoring given implicit modules. It's kind of annoying to be unable to build all modules in a certain kde-projects module grouping, *except* for some certain chosen ones. Now you can: You can add the ignore-modules option in your module-sets using kde-projects repository. It accepts a space-separated list of module names (either kdefoo or kde/module/kdefoo style) to ignore. Although the intention is to only filter out matching modules in *that* module-set, it would actually perform the filtering even if you accidentally put it in the wrong module set due to a fluke of the implementation (I recommend not relying on this, however). The documentation has also been updated, including an example of the usage. --- doc/index.docbook | 55 +++++++++++++++++++++++++++++++++++-- kdesrc-build | 17 +++++++++++- modules/ksb/BuildContext.pm | 7 +++-- 3 files changed, 73 insertions(+), 6 deletions(-) diff --git a/doc/index.docbook b/doc/index.docbook index 6b23709..ffad67f 100644 --- a/doc/index.docbook +++ b/doc/index.docbook @@ -787,12 +787,46 @@ because &kdesrc-build; will not perform dependency handling. It is worth nothing that &kdesrc-build; will try to build modules -in the right order, but this depends on other databases being kept up-to-date. -You can manually do the right thing if necessary by using the technique -described above. +in the right order, such as if only kdegraphics/* had been +listed above, but this depends on other databases being kept up-to-date. You +can manually list modules in the proper order if necessary by using the +technique described above. + +Filtering out &kde; project modules + +You might decide that you'd like to build all programs within a &kde; +module grouping except for a given program. + +For instance, the kdeutils group includes a program +named kremotecontrol. If your computer does not have +the proper hardware to receive the signals sent by remote controls then you may +decide that you'd rather not download, build, and install +kremotecontrol every time you update +kdeutils. + +As of &kdesrc-build; 1.16, you can achieve this by using the ignore-modules configuration option. + + +Example for ignoring a kde-project module in a group + +module-set utils + kde-projects + + # This option chooses what modules to look for in the database. + kdeutils + + # This option "subtracts out" modules from the modules chosen by use-modules, above. + kremotecontrol +end module-set + + + + + @@ -1840,6 +1874,21 @@ on also use that proxy server, if possible, by setting the + +ignore-modules +Can't be overridden +Modules named by this option, which would be chosen by &kdesrc-build; +due to a use-modules option, are +instead skipped entirely. Use this option when you want to build an entire +kde-projects project grouping +except for some specific modules. + +See also . + +This option was introduced with &kdesrc-build; 1.16. + + + install-after-build Module setting overrides global diff --git a/kdesrc-build b/kdesrc-build index b012d17..8e2fb70 100755 --- a/kdesrc-build +++ b/kdesrc-build @@ -698,10 +698,15 @@ sub parse_moduleset my $moduleSetName = shift || ''; my $repoSet = $ctx->getOption('git-repository-base'); my $rcfile = $ctx->rcFile(); + my @modules; + my %ignoredModules; my %optionSet; # We read all options, and apply them to all modules my $startLine = $.; # For later error messages + # Used to strip leading parts of module name if no wildcard present + my $pathLeadersRE = qr,^.*/(?!\*),; + while($_ = readNextLogicalLine($fileReader)) { last if /^end\s+module(-?set)?$/; @@ -716,6 +721,11 @@ sub parse_moduleset die make_exception('Config', 'Invalid use-modules'); } } + elsif ($option eq 'ignore-modules') { + my @modulesToIgnore = split(' ', $value); + s,$pathLeadersRE,, foreach @modulesToIgnore; + @ignoredModules{@modulesToIgnore} = (1) x @modulesToIgnore; + } elsif ($option eq 'set-env') { Module::processSetEnvOption(\%optionSet, $option, $value); } @@ -764,7 +774,10 @@ EOF if ($usingXML) { # Remove all name components before the final /, as long as the / # isn't followed by a *. - $moduleName =~ s,^.*/(?!\*),,; + $moduleName =~ s,$pathLeadersRE,,; + + # Sometimes we just want all kde-projects modules except for a few + next if exists $ignoredModules{$moduleName}; } else { $moduleName =~ s/\.git$//; @@ -785,6 +798,8 @@ EOF } } + $ctx->addToIgnoreList(keys %ignoredModules); + if (not scalar @moduleList) { warning ("No modules were defined for the module-set in r[b[$rcfile] starting at line y[b[$startLine]"); warning ("You should use the g[b[use-modules] option to make the module-set useful."); diff --git a/modules/ksb/BuildContext.pm b/modules/ksb/BuildContext.pm index 15a4d3d..98cc47c 100644 --- a/modules/ksb/BuildContext.pm +++ b/modules/ksb/BuildContext.pm @@ -60,6 +60,7 @@ my %defaultGlobalOptions = ( "git-desired-protocol" => 'git', # protocol to grab from kde-projects "git-repository-base" => {}, # Base path template for use multiple times. "http-proxy" => '', # Proxy server to use for HTTP. + "ignore-modules" => '', # See also: use-modules, kde-projects "install-after-build" => 1, # Default to true "install-session-driver" => 0,# Default to false "kdedir" => "$ENV{HOME}/kde", @@ -161,11 +162,13 @@ sub addModule my ($self, $module) = @_; Carp::confess("No module to push") unless $module; + my $path; if (list_has($self->{modules}, $module)) { debug("Skipping duplicate module ", $module->name()); } - elsif ($module->getOption('#xml-full-path') && - list_has($self->{ignore_list}, $module->getOption('#xml-full-path'))) + elsif (($path = $module->getOption('#xml-full-path')) && + # See if the name matches any given in the ignore list. + any(sub { $path =~ /(^|\/)$_$/ }, $self->{ignore_list})) { debug("Skipping ignored module $module"); }