mirror of
https://gitlab.postmarketos.org/postmarketOS/pmbootstrap.git
synced 2025-07-13 03:19:47 +03:00
helpers: git: pathlib (MR 2252)
Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
This commit is contained in:
parent
50943b9fc5
commit
25ea5fc453
1 changed files with 5 additions and 5 deletions
|
@ -30,7 +30,7 @@ def get_path(name_repo: str):
|
|||
return pkgrepo_path(name_repo)
|
||||
|
||||
|
||||
def clone(name_repo):
|
||||
def clone(name_repo: str):
|
||||
"""Clone a git repository to $WORK/cache_git/$name_repo.
|
||||
|
||||
(or to the overridden path set in args, as with ``pmbootstrap --aports``).
|
||||
|
@ -43,7 +43,7 @@ def clone(name_repo):
|
|||
raise ValueError("No git repository configured for " + name_repo)
|
||||
|
||||
path = get_path(name_repo)
|
||||
if not os.path.exists(path):
|
||||
if not path.exists():
|
||||
# Build git command
|
||||
url = pmb.config.git_repos[name_repo][0]
|
||||
command = ["git", "clone"]
|
||||
|
@ -51,13 +51,13 @@ def clone(name_repo):
|
|||
|
||||
# Create parent dir and clone
|
||||
logging.info("Clone git repository: " + url)
|
||||
os.makedirs(get_context().config.work / "cache_git", exist_ok=True)
|
||||
(get_context().config.work / "cache_git").mkdir(exist_ok=True)
|
||||
pmb.helpers.run.user(command, output="stdout")
|
||||
|
||||
# FETCH_HEAD does not exist after initial clone. Create it, so
|
||||
# is_outdated() can use it.
|
||||
fetch_head = path + "/.git/FETCH_HEAD"
|
||||
if not os.path.exists(fetch_head):
|
||||
fetch_head = path / ".git/FETCH_HEAD"
|
||||
if not fetch_head.exists():
|
||||
open(fetch_head, "w").close()
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue