init-repository: Add HTTPS support for Gerrit remotes

Introduce a new --codereview-https option to use HTTPS instead of SSH
for Gerrit URLs. Update QtIROptionsHelpers.cmake and document in
QtIRHelp.txt.

Change-Id: Iae032bdf07e323a8f63946475c692cab23deffc4
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Ahmad Hasan Mubashshir
2025-11-06 15:46:44 +06:00
parent df82dc7de2
commit 6f4c400406
3 changed files with 14 additions and 1 deletions

View File

@@ -102,18 +102,27 @@ endfunction()
# - ../qt/qttools-litehtml.git # - ../qt/qttools-litehtml.git
function(qt_ir_add_git_remotes repo_relative_url working_directory) function(qt_ir_add_git_remotes repo_relative_url working_directory)
set(gerrit_ssh_base "ssh://@USER@codereview.qt-project.org@PORT@/") set(gerrit_ssh_base "ssh://@USER@codereview.qt-project.org@PORT@/")
set(gerrit_repo_url "${gerrit_ssh_base}") set(gerrit_https_base "https://@USER@codereview.qt-project.org@AUTH@/")
qt_ir_get_option_value(codereview-username username) qt_ir_get_option_value(codereview-username username)
qt_ir_get_option_value(codereview-https https)
if(https)
set(gerrit_repo_url "${gerrit_https_base}")
else()
set(gerrit_repo_url "${gerrit_ssh_base}")
endif()
# If given a username, make a "verbose" remote. # If given a username, make a "verbose" remote.
# Otherwise, rely on proper SSH configuration. # Otherwise, rely on proper SSH configuration.
if(username) if(username)
string(REPLACE "@USER@" "${username}@" gerrit_repo_url "${gerrit_repo_url}") string(REPLACE "@USER@" "${username}@" gerrit_repo_url "${gerrit_repo_url}")
string(REPLACE "@PORT@" ":29418" gerrit_repo_url "${gerrit_repo_url}") string(REPLACE "@PORT@" ":29418" gerrit_repo_url "${gerrit_repo_url}")
string(REPLACE "@AUTH@" "/a" gerrit_repo_url "${gerrit_repo_url}")
else() else()
string(REPLACE "@USER@" "" gerrit_repo_url "${gerrit_repo_url}") string(REPLACE "@USER@" "" gerrit_repo_url "${gerrit_repo_url}")
string(REPLACE "@PORT@" "" gerrit_repo_url "${gerrit_repo_url}") string(REPLACE "@PORT@" "" gerrit_repo_url "${gerrit_repo_url}")
string(REPLACE "@AUTH@" "" gerrit_repo_url "${gerrit_repo_url}")
endif() endif()
set(namespace "qt") set(namespace "qt")

View File

@@ -98,6 +98,9 @@ Options:
username and port number, and thus relies on a correct SSH username and port number, and thus relies on a correct SSH
configuration. configuration.
--codereview-https
Specify this option to use HTTPs instead of SSH.
--alternates <path to other Qt5 repo> --alternates <path to other Qt5 repo>
Adds alternates for each submodule to another full qt5 checkout. Adds alternates for each submodule to another full qt5 checkout.
This makes this qt5 checkout very small, as it will use the object This makes this qt5 checkout very small, as it will use the object

View File

@@ -14,6 +14,7 @@ macro(qt_ir_set_known_command_line_options)
qt_ir_commandline_option(berlin TYPE boolean) qt_ir_commandline_option(berlin TYPE boolean)
qt_ir_commandline_option(branch TYPE boolean) qt_ir_commandline_option(branch TYPE boolean)
qt_ir_commandline_option(codereview-username TYPE string) qt_ir_commandline_option(codereview-username TYPE string)
qt_ir_commandline_option(codereview-https TYPE boolean)
qt_ir_commandline_option(copy-objects TYPE boolean) qt_ir_commandline_option(copy-objects TYPE boolean)
qt_ir_commandline_option(fetch TYPE boolean DEFAULT_VALUE yes) qt_ir_commandline_option(fetch TYPE boolean DEFAULT_VALUE yes)
qt_ir_commandline_option(force SHORT_NAME f TYPE boolean) qt_ir_commandline_option(force SHORT_NAME f TYPE boolean)