Bug 366594 - can't use ignore-modules in option stanza from config file
Summary: can't use ignore-modules in option stanza from config file
Status: RESOLVED FIXED
Alias: None
Product: kdesrc-build
Classification: Developer tools
Component: general (show other bugs)
Version: Git
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Michael Pyne
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-08-10 15:22 UTC by Oliver Henshaw
Modified: 2016-10-08 20:01 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In: 16.10


Attachments
Allows 'options' blocks to apply to named module-sets (12.83 KB, patch)
2016-08-14 21:06 UTC, Michael Pyne
Details
Allows 'options' blocks to apply to named or unseen module-sets (39.55 KB, patch)
2016-09-17 18:22 UTC, Michael Pyne
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Oliver Henshaw 2016-08-10 15:22:11 UTC
I want to include kf5-frameworks-build-include etc. in my rc-file to update/build/install all modules but there may be a few I want to exclude permanently. For example, excluding phonon-vlc if I want to keep away from nonfree dependencies, or other modules whose dependencies I can't/won't meet or that won't build. I can do that with --ignore-modules on the command line but it would be better to have the option persist.

I thought that bug #365813 might solve this but kdesrc-build still fails with:

 $ ./kdesrc-build --rc-file ../kdesrc-build-config/kdesrc-build-frameworks phonon 
 * module #overlay_phonon (near line 11) should be declared as module-set to use ignore-modules
kdesrc-build encountered an exceptional error condition:
 ========
    Config Error: Option ignore-modules can only be used in module-set
 ========
        Can't continue, so stopping now.

$ cat ../kdesrc-build-config/kdesrc-build-frameworks       
# Adjust all these settings at will

include /opt/kde/sources/kdesrc-build-config/kdesrc-build-options-global
include /opt/kde/sources/kdesrc-build-config/kdesrc-build-options-frameworks

# call with --ignore-modules phonon-vlc as can't exclude this module any
# other way without copying the phonon module-set
$ cat ../kdesrc-build-config/kdesrc-build-options-frameworks 
include /opt/kde/sources/kdesrc-build/kf5-frameworks-build-include

# call with --ignore-modules phonon-vlc as can't exclude this module any
# other way without copying the phonon module-set

options bluez-qt
    cmake-options -DBUILD_TESTING=TRUE -DCMAKE_BUILD_TYPE:STRING=debug -DINSTALL_UDEV_RULE=FALSE
end options

options phonon
    ignore-modules phonon-vlc
end options

Seems that the option is still treated as if it applies to a module when it's applied to a module set, and ignore-modules is blacklisted as a setting that only applies to module sets.

Reproducible: Always
Comment 1 Michael Pyne 2016-08-14 21:06:36 UTC
Created attachment 100600 [details]
Allows 'options' blocks to apply to named module-sets

Please try this patch and see if it works for you.
Comment 2 Oliver Henshaw 2016-08-15 13:42:58 UTC
Seems to work fine to "ignore-modules phonon-vlc" for frameworks. But when I try to "ignore-modules kaccounts-mobile" for workspace it seems to mask the existing ignore-modules in module-set kf5-workspace-modules - it fails building breeze-grub, which should be excluded.
Comment 3 Oliver Henshaw 2016-08-15 14:08:52 UTC
Another problem: not sure why, maybe some options clash somehow?

$ ./kdesrc-build --rc-file ../kdesrc-build-config/kdesrc-build-workspace
[works as expected]
$ ./kdesrc-build --rc-file ../kdesrc-build-config/kdesrc-build-both         
 * module #overlay_kf5-workspace-modules (near line 6) should be declared as module-set to use ignore-modules
kdesrc-build encountered an exceptional error condition:
 ========
    Config Error: Option ignore-modules can only be used in module-set
 ========
        Can't continue, so stopping now


Where

$ cat ../kdesrc-build-config/kdesrc-build-both
# Adjust all these settings at will

include /opt/kde/sources/kdesrc-build-config/kdesrc-build-options-global
include /opt/kde/sources/kdesrc-build-config/kdesrc-build-options-frameworks
include /opt/kde/sources/kdesrc-build-config/kdesrc-build-options-workspace


$ cat ../kdesrc-build-config/kdesrc-build-options-workspace 
include /opt/kde/sources/kdesrc-build/kf5-workspace-build-include

options kf5-workspace-modules
  # has dependencies outside workspace
  # also need to add breeze-grub as currently masks existing ignore-modules
  ignore-modules kaccounts-mobile breeze-grub
end options


$ cat ../kdesrc-build-config/kdesrc-build-options-frameworks 
include /opt/kde/sources/kdesrc-build/kf5-frameworks-build-include

options bluez-qt
    cmake-options -DBUILD_TESTING=TRUE -DCMAKE_BUILD_TYPE:STRING=debug -DINSTALL_UDEV_RULE=FALSE
end options

options phonon
    ignore-modules phonon-vlc
end options


$ cat ../kdesrc-build-config/kdesrc-build-workspace          
# Adjust all these settings at will

include /opt/kde/sources/kdesrc-build-config/kdesrc-build-options-global
include /opt/kde/sources/kdesrc-build-config/kdesrc-build-options-workspace
Comment 4 Michael Pyne 2016-08-17 00:04:56 UTC
Yes, it's expected that it would mask the existing option. It wouldn't *have* to but it's hard to know ahead of time which options the user would prefer to be overwritten by a later declaration and which options should instead append to the existing option (or otherwise nest).

Maybe it would be possible to extend the existing syntax for referring to global options to refer to existing use-modules / ignore-modules settings...

As far as the error you've encountered, it's because "options" is only read to override a module-set if it's already seen a module-set by a matching name... I'll need to think of how to do this better so that it's possible to carry around an "options" block in a configuration file even if it doesn't end up referring to a module or module-set due to the way the include declarations are handled.
Comment 5 Michael Pyne 2016-09-17 18:22:24 UTC
Created attachment 101150 [details]
Allows 'options' blocks to apply to named or unseen module-sets

Sorry for the long delay, but please try this patch (against current git-master, so you'll have to get rid of the first patch I submitted first).

It should allow you to declare options blocks that permit module-set options even if no matching module-set is seen -- as long as your include-directive hackery don't try to use those options against a module, of course. ;)

If it seems to work for you I'll commit the patchset to master.
Comment 6 Oliver Henshaw 2016-09-29 13:35:53 UTC
Seems to work fine, only it fails with module-sets that have the same name as modules.

$ ./kdesrc-build --rc-file ../kdesrc-build-config/kdesrc-build-frameworks 
Updating kde-build-metadata (to branch master)
 * Downloading projects.kde.org project database...
 * module phonon should be declared as module-set to use ignore-modules
kdesrc-build encountered an exceptional error condition:
 ========
    Config Error: Option ignore-modules can only be used in module-set
 ========
        Can't continue, so stopping now

occurs with the stanza:
options phonon
    ignore-modules phonon-vlc
end options

But if I s/module-set phonon/module-set kf5-phonon/ in kf5-frameworks-build-include and change it in the options stanza then everything proceeds to build.
Comment 7 Michael Pyne 2016-10-08 20:01:50 UTC
Git commit 14fc9bb282ef1cf5cb3b73d2b40083186fd303a1 by Michael Pyne.
Committed on 08/10/2016 at 19:34.
Pushed by mpyne into branch 'master'.

Allow module-set validation to pass in 'options' overrides.

This show allow 'ignore-modules' to work in 'options' blocks (at least,
it does in my testing).

FIXED-IN:16.08

M  +8    -5    modules/ksb/Application.pm

http://commits.kde.org/kdesrc-build/14fc9bb282ef1cf5cb3b73d2b40083186fd303a1
Comment 8 Michael Pyne 2016-10-08 20:01:51 UTC
Git commit c9d32735a4ff11c5a30654976e2bb539c0886710 by Michael Pyne.
Committed on 08/10/2016 at 19:38.
Pushed by mpyne into branch 'master'.

Allow options blocks to override unseen module-sets.

In other words, we separate parsing of options blocks from whether
existing modules or module-sets have already been seen. Instead we
decide later (when expanding module-sets or modules) whether there are
any relevant options blocks to apply (this is the 'deferred option'
handling).

Now you should be able to declare options blocks that contain options
appropriate for module-sets, even if no module-set is defined with that
name (e.g. if you're doing weirdness with 'include' declarations).

This does require that you don't use the same name for modules and for
module-sets, but that is essentially already a requirement anyways.
There's no good way to always disambiguate that.
FIXED-IN:16.10

M  +17   -53   modules/ksb/Application.pm
M  +33   -14   modules/ksb/ModuleResolver.pm

http://commits.kde.org/kdesrc-build/c9d32735a4ff11c5a30654976e2bb539c0886710