1
0
Fork 1
mirror of https://gitlab.postmarketos.org/postmarketOS/pmbootstrap.git synced 2025-07-13 03:19:47 +03:00

pmb.config: support ssh urls for (pm)aports (MR 2252)

HTTP auth is heavily discouraged, and becoming annoying to set up and
use. Let folks reconfigure pmaports origin remote using the SSH URL.

Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
This commit is contained in:
Caleb Connolly 2024-05-19 00:57:29 +02:00 committed by Oliver Smith
parent a8c24ae867
commit a76cd92bcb
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
2 changed files with 9 additions and 7 deletions

View file

@ -1108,8 +1108,10 @@ flashers = {
# GIT
#
git_repos = {
"aports_upstream": "https://gitlab.alpinelinux.org/alpine/aports.git",
"pmaports": "https://gitlab.com/postmarketOS/pmaports.git",
"aports_upstream": ["https://gitlab.alpinelinux.org/alpine/aports.git",
"git@gitlab.alpinelinux.org:alpine/aports.git"],
"pmaports": ["https://gitlab.com/postmarketOS/pmaports.git",
"git@gitlab.com:postmarketos/pmaports.git"],
}
#

View file

@ -38,7 +38,7 @@ def clone(args, name_repo):
path = get_path(args, name_repo)
if not os.path.exists(path):
# Build git command
url = pmb.config.git_repos[name_repo]
url = pmb.config.git_repos[name_repo][0]
command = ["git", "clone"]
command += [url, path]
@ -90,15 +90,15 @@ def get_upstream_remote(args, name_repo):
Usually "origin", but the user may have set up their git repository differently.
"""
url = pmb.config.git_repos[name_repo]
urls = pmb.config.git_repos[name_repo]
path = get_path(args, name_repo)
command = ["git", "remote", "-v"]
output = pmb.helpers.run.user(args, command, path, output_return=True)
for line in output.split("\n"):
if url in line:
if any(u in line for u in urls):
return line.split("\t", 1)[0]
raise RuntimeError("{}: could not find remote name for URL '{}' in git"
" repository: {}".format(name_repo, url, path))
raise RuntimeError("{}: could not find remote name for any URL '{}' in git"
" repository: {}".format(name_repo, urls, path))
def parse_channels_cfg(args):