Skip to content
Snippets Groups Projects
Verified Commit 38fc51af authored by Oliver Smith's avatar Oliver Smith Committed by Clayton Craft
Browse files

(not for master) CI: hardcode get_upstream_branch (MR 5070)

Set it to master_staging_systemd, and bypass the usual logic of looking
into pmaports.cfg and channels.cfg (of master branch!). This avoids
adding it to channels.cfg of the master branch.
parent e5b3d644
No related branches found
No related tags found
No related merge requests found
......@@ -56,34 +56,8 @@ def get_upstream_branch():
:returns: branch name, e.g. "v20.05" """
# Prefer gitlab CI target branch name if it's set (i.e. running in gitlab CI)
if target_branch := os.environ.get("CI_MERGE_REQUEST_TARGET_BRANCH_NAME"):
return target_branch
global cache
if "upstream_branch" in cache:
return cache["upstream_branch"]
# Get channel (e.g. "stable") from pmaports.cfg
# https://postmarketos.org/pmaports.cfg
pmaports_dir = get_pmaports_dir()
pmaports_cfg = configparser.ConfigParser()
pmaports_cfg.read(f"{pmaports_dir}/pmaports.cfg")
channel = pmaports_cfg["pmaports"]["channel"]
# Get branch_pmaports (e.g. "v20.05") from channels.cfg
# https://postmarketos.org/channels.cfg
channels_cfg_str = run_git(["show", "upstream/master:channels.cfg"])
channels_cfg = configparser.ConfigParser()
channels_cfg.read_string(channels_cfg_str)
assert channel in channels_cfg, \
f"Channel '{channel}' from pmaports.cfg in your branch is unknown." \
" This appears to be an old branch, consider recreating your change" \
" on top of master."
ret = channels_cfg[channel]["branch_pmaports"]
cache["upstream_branch"] = ret
return ret
# HACK for master_staging_systemd branch
return "master_staging_systemd"
def get_changed_files(removed=True):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment