aportgen get_upstream_aport: checkout branch

Checkout the aports.git branch for the current channel (e.g.
3.12-stable), before trying to find the APKBUILD.

I had tried to auto-unshallow the git repository earlier, but then the
tags were missing. I decided that it's not worth to provide a migration
path: "pmbootstrap aportgen" is only used by few advanced users (to
maintain the pmaports repo).
This commit is contained in:
Oliver Smith 2020-05-12 20:55:08 +02:00
parent 54938032af
commit 130de05881
No known key found for this signature in database
GPG Key ID: 5AE7F5513E0885CB
1 changed files with 13 additions and 0 deletions

View File

@ -163,6 +163,19 @@ def get_upstream_aport(args, pkgname):
pmb.helpers.git.clone(args, "aports_upstream")
aports_upstream_path = args.work + "/cache_git/aports_upstream"
# Checkout branch
channel_cfg = pmb.config.pmaports.read_config_channel(args)
branch = channel_cfg["branch_aports"]
logging.info(f"Checkout aports.git branch: {branch}")
if pmb.helpers.run.user(args, ["git", "checkout", branch],
aports_upstream_path, check=False):
logging.info("NOTE: run 'pmbootstrap pull' and try again")
logging.info("NOTE: if it still fails, your aports.git was cloned with"
" an older version of pmbootstrap, as shallow clone."
" Unshallow it, or remove it and let pmbootstrap clone it"
f" again: {aports_upstream_path}")
raise RuntimeError("Branch checkout failed.")
# Search package
paths = glob.glob(aports_upstream_path + "/*/" + pkgname)
if len(paths) > 1: