From 130de05881af7d3a0fca3549d434f44eb86d8163 Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Tue, 12 May 2020 20:55:08 +0200 Subject: [PATCH] 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). --- pmb/aportgen/core.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pmb/aportgen/core.py b/pmb/aportgen/core.py index 2976343b..66933600 100644 --- a/pmb/aportgen/core.py +++ b/pmb/aportgen/core.py @@ -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: