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.
wilder
Michael Pyne 13 years ago
parent e6cc07de7e
commit 1d76940879
  1. 55
      doc/index.docbook
  2. 17
      kdesrc-build
  3. 7
      modules/ksb/BuildContext.pm

@ -787,12 +787,46 @@ because &kdesrc-build; will not perform dependency handling.
</orderedlist>
<note><para>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 <literal>kdegraphics/*</literal> 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.
</para></note>
</sect2>
<sect2 id="ignoring-project-modules">
<title>Filtering out &kde; project modules</title>
<para>You might decide that you'd like to build all programs within a &kde;
module grouping <emphasis>except</emphasis> for a given program.</para>
<para>For instance, the <literal>kdeutils</literal> group includes a program
named <application>kremotecontrol</application>. 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
<application>kremotecontrol</application> every time you update
<literal>kdeutils</literal>.</para>
<para>As of &kdesrc-build; 1.16, you can achieve this by using the <link
linkend="conf-ignore-modules">ignore-modules</link> configuration option.</para>
<example id="example-ignoring-a-module">
<title>Example for ignoring a kde-project module in a group</title>
<programlisting>
module-set <replaceable>utils</replaceable>
<option><link linkend="conf-repository">repository</link></option> <literal>kde-projects</literal>
# This option chooses what modules to look for in the database.
<option><link linkend="conf-use-modules">use-modules</link></option> <replaceable>kdeutils</replaceable>
# This option "subtracts out" modules from the modules chosen by use-modules, above.
<option><link linkend="conf-ignore-modules">ignore-modules</link></option> <replaceable>kremotecontrol</replaceable>
end module-set
</programlisting>
</example>
</sect2>
</sect1>
<sect1 id="building-and-troubleshooting">
@ -1840,6 +1874,21 @@ on also use that proxy server, if possible, by setting the
</entry>
</row>
<row id="conf-ignore-modules">
<entry>ignore-modules</entry>
<entry>Can't be overridden</entry>
<entry><para>Modules named by this option, which would be chosen by &kdesrc-build;
due to a <link linkend="conf-use-modules">use-modules</link> option, are
instead skipped entirely. Use this option when you want to build an entire
<link linkend="kde-projects-module-sets">kde-projects</link> project grouping
<emphasis>except for</emphasis> some specific modules.</para>
<tip><para>See also <xref linkend="example-ignoring-a-module"/>.</para></tip>
<para>This option was introduced with &kdesrc-build; 1.16.</para>
</entry>
</row>
<row id="conf-install-after-build">
<entry>install-after-build</entry>
<entry>Module setting overrides global</entry>

@ -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.");

@ -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");
}

Loading…
Cancel
Save