diff --git a/doc/index.docbook b/doc/index.docbook index 702590e..473415b 100644 --- a/doc/index.docbook +++ b/doc/index.docbook @@ -1335,7 +1335,8 @@ but is instead at the &konsole; or terminal where you ran &kdesrc-build;. To use the script, you must have a file in your home directory called .kdesrc-buildrc, which describes the modules you would -like to download and build. +like to download and build, and any options or configuration parameters to +use for these modules. @@ -1414,6 +1415,71 @@ linkend="conf-use-modules">use-modules for more information. + + +<quote>options</quote> modules + +There is a final type of configuration file entry, +options groups, which may be given wherever a +module or module-set may be used. + + +options module-name +option-name option-value +[...] +end options + + +An options group may have options set for it just like +a module declaration, and is associated with an existing module. Any options +set these way will be used to override options set for the +associated module. + +The associated module name must match the +name given in the options declaration. Be careful of +mis-typing the name. + +This is useful to allow for declaring an entire +module-set worth of modules, all using the same options, and +then using options groups to make individual changes. + + +Example of using options + +In this example we choose to build all modules from the &kde; multimedia +software grouping. However we want to use a different version of the &kmix; +application (perhaps for testing a bug fix). It works as follows: + + +module-set kde-multimedia-set + repository kde-projects + use-modules kde/kdemultimedia + branch master +end module-set + +# kmix is a part of kde/kdemultimedia group, even though we never named +# kmix earlier in this file, &kdesrc-build; will figure out the change. +options kmix + branch KDE/4.12 +end options + + +Now when you run &kdesrc-build;, all of the &kde; multimedia programs will +be built from the master branch of the source repository, but +&kmix; will be built from the older KDE/4.12 branch. By using +options you didn't have to individually list all the +other &kde; multimedia programs to give them the right +branch option. + + + + +Note that this feature is only available in &kdesrc-build; from version +1.16, or using the development version of &kdesrc-build; after +2014-01-12. + + + diff --git a/modules/ksb/Application.pm b/modules/ksb/Application.pm index f10cce5..58f6092 100644 --- a/modules/ksb/Application.pm +++ b/modules/ksb/Application.pm @@ -879,7 +879,7 @@ sub _parseModuleOptions } my $endWord = $module->isa('ksb::BuildContext') ? 'global' : 'module'; - my $endRE = qr/^end\s+$endWord/; + my $endRE = qr/^end[\w\s]*$/; # Read in each option while ($_ = _readNextLogicalLine($fileReader)) @@ -1090,7 +1090,7 @@ sub _readConfigurationOptions my $pendingOptionsRef = shift; my @module_list; my $rcfile = $ctx->rcFile(); - my ($option, $modulename, %readModules); + my ($option, %readModules); my $fileReader = ksb::RecursiveFH->new(); $fileReader->pushBasePath(dirname($rcfile)); # rcfile should already be absolute @@ -1134,7 +1134,7 @@ sub _readConfigurationOptions next if (/^\s*$/); # Skip blank lines # Get modulename (has dash, dots, slashes, or letters/numbers) - ($modulename) = /^module\s+([-\/\.\w]+)\s*$/; + my ($type, $modulename) = /^(options|module)\s+([-\/\.\w]+)\s*$/; my $newModule; # Module-set? @@ -1157,8 +1157,27 @@ sub _readConfigurationOptions my @moduleSetItems = $newModule->moduleNamesToFind(); @seenModuleSetItems{@moduleSetItems} = ($newModule) x scalar @moduleSetItems; } - # Module override? - elsif (exists $seenModuleSetItems{$modulename}) { + # Duplicate module entry? (Note, this must be checked before the check + # below for 'options' sets) + elsif (exists $seenModules{$modulename}) { + # Overwrite options set for existing modules. + # But allow duplicate 'options' declarations without error. + if ($type ne 'options') { + warning ("Don't use b[r[module $modulename] on line $., use b[g[options $modulename]"); + } + + $newModule = $seenModules{$modulename}; + + # _parseModuleOptions will re-use newModule, but we still need to + # be careful not to mask cmdline options in pendingOptsKeys. + _parseModuleOptions($ctx, $fileReader, $newModule); + + delete @{$newModule->{options}}{@pendingOptsKeys}; + + next; # Skip all the stuff below + } + # Module override (for use-modules from a module-set), or option overrride? + elsif ($type eq 'options' || exists $seenModuleSetItems{$modulename}) { # Parse the modules... $newModule = _parseModuleOptions($ctx, $fileReader, "#overlay_$modulename"); @@ -1173,22 +1192,13 @@ sub _readConfigurationOptions # Don't mask global cmdline options. delete @{$moduleOptsRef}{@pendingOptsKeys}; - next; # Don't add to module list - } - # Duplicate module entry? - elsif (exists $seenModules{$modulename}) { - # Overwrite options set for existing modules. - warning ("Multiple module declarations for $modulename"); - - $newModule = $seenModules{$modulename}; - - # _parseModuleOptions will re-use newModule, but we still need to - # be careful not to mask cmdline options in pendingOptsKeys. - _parseModuleOptions($ctx, $fileReader, $newModule); - - delete @{$newModule->{options}}{@pendingOptsKeys}; + # TODO: Remove compat handling of 'module $foo' as 'options $foo', + # probably 2014-04-01? + if ($type ne 'options') { + warning ("Don't use b[r[module $modulename] on line $., use b[g[options $modulename]"); + } - next; # Skip all the stuff below + next; # Don't add to module list } else { $newModule = _parseModuleOptions($ctx, $fileReader, $modulename);