forked from Mirror/pmbootstrap
core: pkgrepo: support arbitrarily named pmaports directories (MR 2470)
There was an oversight when this API was originally created and it implicitly assumed that the pmaports repository was always named "pmaports". This unfortunately broke some peoples workflows. Introduce a new "pkgrepo_name()" function and adjust the codebase to use it, as well as adjusting pkgrepo internally to special case the "pmaports" repo so that it's always named pmaports no matter what the directory itself is named. This is probably more complexity than we should be dealing with here, we should probably create a new type to encode this behaviour. Fixes: #2412 Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
This commit is contained in:
parent
70dc855281
commit
a72a60f546
5 changed files with 49 additions and 15 deletions
|
@ -5,7 +5,7 @@ from enum import Enum
|
|||
from pathlib import Path
|
||||
from typing import Final
|
||||
from pmb.core.context import get_context
|
||||
from pmb.core.pkgrepo import pkgrepo_default_path, pkgrepo_path
|
||||
from pmb.core.pkgrepo import pkgrepo_default_path, pkgrepo_path, pkgrepo_name
|
||||
from pmb.helpers import logging
|
||||
import os
|
||||
import re
|
||||
|
@ -107,7 +107,10 @@ def get_upstream_remote(aports: Path) -> str:
|
|||
|
||||
Usually "origin", but the user may have set up their git repository differently.
|
||||
"""
|
||||
name_repo = aports.parts[-1]
|
||||
name_repo = pkgrepo_name(aports)
|
||||
if name_repo not in pmb.config.git_repos:
|
||||
logging.warning(f"WARNING: can't determine remote for {name_repo}, using 'origin'")
|
||||
return "origin"
|
||||
urls = pmb.config.git_repos[name_repo]
|
||||
lines = list_remotes(aports)
|
||||
for line in lines:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue