aboutsummaryrefslogtreecommitdiffstats
path: root/bootstrap/codesearch
diff options
context:
space:
mode:
authorBartek Grzybowski <b.grzybowski@partner.samsung.com>2021-07-02 11:00:30 +0200
committerBartek Grzybowski <b.grzybowski@partner.samsung.com>2021-07-02 11:10:16 +0200
commit1fc7d0ad7f255601816bd0112e5da2f04069dfed (patch)
tree2a5e72be6668155f2e2931903efc1e07f585212b /bootstrap/codesearch
parentd671e65bde10a92b58d40a50229ec28a5a75ee69 (diff)
[CODESEARCH] Rework how --git option works
"--git" will not only affect the "base-url" in Hound config for code browser but also the "url" for the repository clone string. This is the most sane behavior as git protocol is the most efficient one in terms of speed. "git" and "ssh" options are also set to be mutually exclusie as according to the above change using git protocol based clone and passing ssh credentials would not make sense as git protocol does not support any kind of authentication. Change-Id: I9897bc2aec2707ca4ed7543b1576686fb8e2b2da Issue-ID: INT-1940 Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
Diffstat (limited to 'bootstrap/codesearch')
-rwxr-xr-xbootstrap/codesearch/create_config.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/bootstrap/codesearch/create_config.py b/bootstrap/codesearch/create_config.py
index 4ff059d19..b881476e7 100755
--- a/bootstrap/codesearch/create_config.py
+++ b/bootstrap/codesearch/create_config.py
@@ -35,8 +35,10 @@ def get_projects_list(gerrit):
def create_repos_list(projects, gerrit, ssh, git, poll):
"""Create a map of all projects to their repositories' URLs."""
gerrit_url = "https://{}{}".format(gerrit, API_PREFIX)
+ git_url = "git://{}".format(git)
gerrit_project_url_base = "{}/{{}}.git".format(gerrit_url)
gitweb_code_url_base = "{}/gitweb?p={{}}.git;hb=HEAD;a=blob;f=".format(gerrit_url)
+ git_project_url_base = "{}/{{}}.git".format(git_url)
repos_list = {}
for project in projects:
@@ -49,6 +51,7 @@ def create_repos_list(projects, gerrit, ssh, git, poll):
project_url = "ssh://{}@{}:{}/{}.git".format(user, gerrit, port, project)
if git:
code_url = "https://{}/{}/tree/".format(git, project) + CODE_LOCATION
+ project_url = git_project_url_base.format(project)
anchor = GIT_ANCHOR
repos_list[project] = {
@@ -66,10 +69,11 @@ def create_repos_list(projects, gerrit, ssh, git, poll):
def parse_arguments():
"""Return parsed command-line arguments."""
parser = argparse.ArgumentParser(description=__doc__)
+ group = parser.add_mutually_exclusive_group()
parser.add_argument('--gerrit', help='Gerrit address', default=DEFAULT_GERRIT)
- parser.add_argument('--ssh', help='SSH information: user, port', nargs=2)
- parser.add_argument('--git', help='external git address')
- parser.add_argument('--poll-interval', help='repositories polling interval in seconds', type=int, default=DEFAULT_POLL)
+ group.add_argument('--ssh', help='SSH information for Gerrit access: user, port', nargs=2)
+ group.add_argument('--git', help='External git address. Does not support --ssh')
+ parser.add_argument('--poll-interval', help='Repositories polling interval in seconds', type=int, default=DEFAULT_POLL)
return parser.parse_args()