From 6179f457918ab01d39a6f0edd9f9852849a19a2e Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Thu, 13 Dec 2018 07:32:17 +0100 Subject: [PATCH] build_changed_aports: allow existing remote In this CI test, we add the upstrem postmarketOS/pmaports.git remote to the checked out git repository. Do not crash when it exists already, so we don't need to remove it before each run when testing locally. --- .gitlab-ci/build_changed_aports.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci/build_changed_aports.py b/.gitlab-ci/build_changed_aports.py index 6deca74d1..f563025e8 100755 --- a/.gitlab-ci/build_changed_aports.py +++ b/.gitlab-ci/build_changed_aports.py @@ -11,10 +11,15 @@ def get_pmaports_dir(): return os.path.realpath(os.path.join(os.path.dirname(__file__) + "/..")) -def run_git(parameters): +def run_git(parameters, check=True): """ Run git in the pmaports dir and return the output """ cmd = ["git", "-C", get_pmaports_dir()] + parameters - return subprocess.check_output(cmd).decode() + try: + return subprocess.check_output(cmd).decode() + except subprocess.CalledProcessError: + if check: + raise + return None def run_pmbootstrap(parameters): @@ -93,7 +98,7 @@ def check_build(packages): if __name__ == "__main__": # Add a remote pointing to postmarketOS/pmaports for later run_git(["remote", "add", "upstream", - "https://gitlab.com/postmarketOS/pmaports.git"]) + "https://gitlab.com/postmarketOS/pmaports.git"], False) run_git(["fetch", "-q", "upstream"]) # Build changed packages