Bug 382172 - options blocks in kdesrc-buildrc work only when the module is specified on cmdline
Summary: options blocks in kdesrc-buildrc work only when the module is specified on cm...
Status: RESOLVED FIXED
Alias: None
Product: kdesrc-build
Classification: Developer tools
Component: general (other bugs)
Version First Reported In: Git
Platform: Other Linux
: NOR minor
Target Milestone: ---
Assignee: Michael Pyne
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-07-09 20:05 UTC by Michael Pyne
Modified: 2017-07-09 21:02 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed/Implemented In: 17.08
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Pyne 2017-07-09 20:05:03 UTC
In testing something the libdbusmenu-qt (which is a module instead of a module-set in the default config), I noticed that an options block declared as

options libdbusmenu-qt
  cmake-options -DWITH_DOC=OFF
end options

does not work when libdbusmenu-qt is built when the module list is generated by reading the config file.  When libdbusmenu-qt is specifically requested to be built on the command line, the options block *does* take effect.

E.g. compare 

$ kdesrc-build -p --debug --reconfigure --stop-after libdbusmenu-qt
> ...
> Would have run 'cmake' '/kdesrc/src/kf5/libdbusmenu-qt' '-G' 'Ninja' '-DCMAKE_CXX_FLAGS:STRING=-pipe -O2 -march=native ' '-DCMAKE_INSTALL_PREFIX=/home/kde-svn/kde-5'

(WITH_DOC is missing)

with 
$ kdesrc-build -p --debug --reconfigure libdbusmenu-qt
> ...
> Would have run 'cmake' '/kdesrc/src/kf5/libdbusmenu-qt' '-G' 'Ninja' '-DWITH_DOC=OFF' '-DCMAKE_CXX_FLAGS:STRING=-pipe -O2 -march=native ' '-DCMAKE_INSTALL_PREFIX=/home/kde-svn/kde-5'

(WITH_DOC now present).

---

The 'options' feature had been added to support ease of use with module sets but it has been supposed to work with regular modules for some years now.  This needs fixed to be consistent one way or the other.
Comment 1 Michael Pyne 2017-07-09 21:02:36 UTC
Git commit a23ed5fd2437d471e6112a0c1cb17b4c60d9e684 by Michael Pyne.
Committed on 09/07/2017 at 20:16.
Pushed by mpyne into branch 'master'.

Uniformly handle deferred option assignment.

It turns out that there is a code path where ksb::Module objects in the
process of being created do not have ModuleResolver::_applyOptions()
called on them to ensure that deferred options (from "options" blocks in
the config file) as applied if necessary.

This affected modules like libdbusmenu-qt, which if processed as part of
generating the build list from the config file would *NOT* have
_applyOptions() called (because expandModuleSets only ran this on
ksb::ModuleSets being expanded, and the resolveSingleSelector call that
otherwise would have run applyOptions is only called when modules are
passed as cmdline "selectors").

Fix by pushing _applyOptions to be called for all modules processed
through expandModuleSets (which despite the name gets a cut at every
module in the module list), and removing applyOptions from
resolveSingleSelector since it's redundant now.
FIXED-IN:17.08

M  +6    -10   modules/ksb/ModuleResolver.pm

https://commits.kde.org/kdesrc-build/a23ed5fd2437d471e6112a0c1cb17b4c60d9e684