This fixes bug 395627, where the error is actually that we set CMAKE_PREFIX_PATH twice if qtdir is set to a non-system path and the user is also setting CMAKE_PREFIX_PATH. Unfortunately the second value overrides the first (the one the user set). Also added a test for this, which fails before the fix and passes afterwards. The full test suite (all 5...) pass. BUG:395627 FIXED-IN:18.08wilder^2
parent
14b5093bf1
commit
7f92da7b30
3 changed files with 109 additions and 2 deletions
@ -0,0 +1,78 @@ |
|||||||
|
use 5.014; |
||||||
|
use strict; |
||||||
|
use warnings; |
||||||
|
|
||||||
|
# Verify that a user-set CMAKE_PREFIX_PATH is not removed, even if we supply |
||||||
|
# "magic" of our own |
||||||
|
# See bug 395627 -- https://bugs.kde.org/show_bug.cgi?id=395627 |
||||||
|
|
||||||
|
my @savedCommand; |
||||||
|
my $log_called = 0; |
||||||
|
|
||||||
|
# Redefine log_command to capture whether it was properly called. This is all |
||||||
|
# very order-dependent, we need to load ksb::Util before kdesrc-build itself |
||||||
|
# does to install the new subroutine before it's copied over into the other |
||||||
|
# package symbol tables. |
||||||
|
BEGIN { |
||||||
|
use ksb::Util; |
||||||
|
|
||||||
|
no strict 'refs'; |
||||||
|
no warnings 'redefine'; |
||||||
|
|
||||||
|
*ksb::Util::log_command = sub { |
||||||
|
$log_called = 1; |
||||||
|
|
||||||
|
my ($module, $filename, $argRef, $optionsRef) = @_; |
||||||
|
my @command = @{$argRef}; |
||||||
|
@savedCommand = @command; |
||||||
|
return 0; # success |
||||||
|
}; |
||||||
|
} |
||||||
|
|
||||||
|
use Test::More; |
||||||
|
|
||||||
|
use ksb::Application; |
||||||
|
use ksb::Module; |
||||||
|
|
||||||
|
my @args = qw(--pretend --rc-file t/data/bug-395627/kdesrc-buildrc); |
||||||
|
|
||||||
|
{ |
||||||
|
my $app = ksb::Application->new(@args); |
||||||
|
my @moduleList = @{$app->{modules}}; |
||||||
|
|
||||||
|
is (scalar @moduleList, 6, 'Right number of modules'); |
||||||
|
isa_ok ($moduleList[0]->buildSystem(), 'ksb::BuildSystem::KDE4'); |
||||||
|
|
||||||
|
my $result; |
||||||
|
my @prefixes; |
||||||
|
my $prefix; |
||||||
|
|
||||||
|
# This requires log_command to be overridden above |
||||||
|
$result = $moduleList[0]->setupBuildSystem(); |
||||||
|
is ($log_called, 1, 'Overridden log_command was called'); |
||||||
|
ok ($result, 'Setup build system for auto-set prefix path'); |
||||||
|
|
||||||
|
# We should expect an auto-set -DCMAKE_PREFIX_PATH passed to cmake somewhere |
||||||
|
($prefix) = grep { /-DCMAKE_PREFIX_PATH/ } @savedCommand; |
||||||
|
is ($prefix, '-DCMAKE_PREFIX_PATH=/tmp/qt5', 'Prefix path set to custom Qt prefix'); |
||||||
|
|
||||||
|
$result = $moduleList[2]->setupBuildSystem(); |
||||||
|
ok ($result, 'Setup build system for manual-set prefix path'); |
||||||
|
|
||||||
|
(@prefixes) = grep { /-DCMAKE_PREFIX_PATH/ } @savedCommand; |
||||||
|
is (scalar @prefixes, 1, 'Only one set prefix path in manual mode'); |
||||||
|
if (@prefixes) { |
||||||
|
is ($prefixes[0], '-DCMAKE_PREFIX_PATH=FOO', 'Manual-set prefix path is as set by user'); |
||||||
|
} |
||||||
|
|
||||||
|
$result = $moduleList[4]->setupBuildSystem(); |
||||||
|
ok ($result, 'Setup build system for manual-set prefix path'); |
||||||
|
|
||||||
|
(@prefixes) = grep { /-DCMAKE_PREFIX_PATH/ } @savedCommand; |
||||||
|
is (scalar @prefixes, 1, 'Only one set prefix path in manual mode'); |
||||||
|
if (@prefixes) { |
||||||
|
is ($prefixes[0], '-DCMAKE_PREFIX_PATH:PATH=BAR', 'Manual-set prefix path is as set by user'); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
done_testing(); |
||||||
@ -0,0 +1,26 @@ |
|||||||
|
global |
||||||
|
source-dir /tmp |
||||||
|
qtdir /tmp/qt5 |
||||||
|
git-repository-base fake git://localhost/git-set/ |
||||||
|
override-build-system KDE # Use CMake everywhere w/out source probing |
||||||
|
end global |
||||||
|
|
||||||
|
module-set test |
||||||
|
repository fake |
||||||
|
use-modules sample1 sample2 |
||||||
|
# Should have auto-set CMAKE_PREFIX_PATH |
||||||
|
end module-set |
||||||
|
|
||||||
|
module-set test2-set |
||||||
|
repository fake |
||||||
|
use-modules sample3 sample4 |
||||||
|
cmake-options -DCMAKE_PREFIX_PATH=FOO |
||||||
|
# Should not auto-set CMAKE_PREFIX_PATH since it's already set |
||||||
|
end module-set |
||||||
|
|
||||||
|
module-set test3-set |
||||||
|
repository fake |
||||||
|
use-modules sample5 sample6 |
||||||
|
cmake-options -DCMAKE_PREFIX_PATH:PATH=BAR |
||||||
|
# Uses a slightly different syntax, should still be retained |
||||||
|
end module-set |
||||||
Loading…
Reference in new issue