Bug 363059

Summary: qmake should be run with the -r option
Product: [Developer tools] kdesrc-build Reporter: David Faure <faure>
Component: generalAssignee: Michael Pyne <mpyne>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version First Reported In: Git   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In: 16.06
Sentry Crash Report:

Description David Faure 2016-05-14 07:19:56 UTC
$ kdesrc-build -v --reconfigure libaccounts-qt                       

Building libaccounts-qt (build system qmake) (1/1)
        Updating libaccounts-qt (to branch master)
        Updating libaccounts-qt using existing branch master
        This module will not be built. Nothing updated.
        No changes to libaccounts-qt source, proceeding to build.
        Unable to install libaccounts-qt!



Reproducible: Always

Steps to Reproduce:
module libaccounts-qt
  repository https://gitlab.com/accounts-sso/libaccounts-qt.git
  qmake-options PREFIX=/tmp
end module

1. Comment out the qmake-options line
2. kdesrc-build libaccounts-qt
This will fail to install into /usr, as expected
3. Enable the qmake-options line again
4. kdesrc-build --reconfigure libaccounts-qt

Actual Results:  
Same error. And yet qmake was run again, I see in the logs.
The verbose output above is quite unclear about that BTW.
1) "This module will not be built" ... why? seems wrong.
2) If I use reconfigure on a cmake module I see "Running cmake...", so surely there should be a similar line with "Running qmake..." for qmake modules.

Expected Results:  
If qmake was run with -r, then the change would actually take effect.
This is a qmake issue, where it only regenerates the toplevel Makefile, but not Makefiles in subdirs, unless -r is passed.

The patch below fixes the main issue, but I'm still filing this for posterity, for feedback, and because the output could be improved too.

diff --git a/modules/ksb/BuildSystem/QMake.pm b/modules/ksb/BuildSystem/QMake.pm
index 2f7924b..aa91a74 100644                                                                                                                               
--- a/modules/ksb/BuildSystem/QMake.pm
+++ b/modules/ksb/BuildSystem/QMake.pm
@@ -45,6 +45,7 @@ sub configureInternal
     my $builddir = $module->fullpath('build');
     my $sourcedir = $module->fullpath('source');
     my @qmakeOpts = split(' ', $module->getOption('qmake-options'));
+    push @qmakeOpts, '-r';
     my @projectFiles = glob("$sourcedir/*.pro");
 
     if (!@projectFiles || !$projectFiles[0]) {
Comment 1 Michael Pyne 2016-05-14 13:49:33 UTC
I'll look at improving output message to be more consistent with CMake (for awhile I've wanted to decouple ksb::BuildSystem::* with output, leaving high-level classes to handle user output while lower-level classes don't emit output at all.... but since that hasn't happened yet no reason to make QMake the weird one).

As for the patch, I try to keep kdesrc-build-provided options at front of cmdline when possible so for consistentcy I'd say to move the '-r' either in front of the split(), or to use unshift instead of push afterwards.

But I'll handle that today when I get a chance.
Comment 2 Michael Pyne 2016-05-15 00:20:26 UTC
Git commit 21fe19f8cd331a9d898744bea3679e0227307b07 by Michael Pyne.
Committed on 15/05/2016 at 00:19.
Pushed by mpyne into branch 'master'.

Adjust QMake flags to make --reconfigure work too, other minor fixes.
FIXED-IN:16.06

M  +4    -1    modules/ksb/BuildSystem/QMake.pm
M  +0    -1    modules/ksb/Module.pm

http://commits.kde.org/kdesrc-build/21fe19f8cd331a9d898744bea3679e0227307b07