Compare commits

...

2 Commits

Author SHA1 Message Date
Joerg Bornemann
ca679e98de init-repository: Fix passing no --alternates option
Commit d6918d7ac5 broke init-repository if
you did not pass an --alternates option.

Pick-to: 6.8
Task-number: QTBUG-142712
Fixes: QTBUG-142744
Change-Id: Ia727b420a34a46e52f0f05e549aabe2c975c6d7e
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 6bd3b23b6c)
(cherry picked from commit f1d54f955c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-12-19 19:46:22 +00:00
Joerg Bornemann
30ee3ee4b2 init-repository: Fix passing relative path to --alternates
When using --alternates with a relative path, nested submodules
(e.g., qtdeclarative/tests/auto/qml/ecmascripttests/test262) failed
because the alternates path wasn't adjusted for the changed working
directory depth. The --alternates option worked correctly with absolute
paths.

Fix by converting the passed alternates path to an absolute path.

Pick-to: 6.8
Fixes: QTBUG-142712
Change-Id: Ief7a87768d9ff17bb2832ae363f573ecae58d5ee
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit d6918d7ac5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit ec20fd6cab)
2025-12-19 19:46:22 +00:00
2 changed files with 17 additions and 1 deletions

View File

@@ -421,3 +421,19 @@ function(qt_ir_get_option_as_cmake_flag_option cli_name cmake_option_name out_va
endif()
set(${out_var} "${cmake_option}" PARENT_SCOPE)
endfunction()
# Get the value of a command line option as existing absolute path.
# Yield error if the path does not exist.
# Convert to absolute path if necessary.
function(qt_ir_get_option_as_existing_absolute_path name value)
qt_ir_get_option_value("${name}" path)
if(NOT "${path}" STREQUAL "")
if(NOT EXISTS "${path}")
qt_ir_add_error("The path '${path}' passed with -${name} does not exist.")
endif()
if(NOT IS_ABSOLUTE "${path}")
get_filename_component(path "${path}" ABSOLUTE)
endif()
endif()
set("${value}" "${path}" PARENT_SCOPE)
endfunction()

View File

@@ -295,7 +295,7 @@ function(qt_ir_run_after_args_parsed top_level_src_path out_var_exit_reason)
"${working_directory}")
# Get some additional options to pass down.
qt_ir_get_option_value(alternates alternates)
qt_ir_get_option_as_existing_absolute_path(alternates alternates)
qt_ir_get_option_as_cmake_flag_option(branch "CHECKOUT_BRANCH" checkout_branch_option)
# The prefix for the cmake-style 'dictionary' that will be used by various functions.