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.
This commit is contained in:
Oliver Smith
2018-12-13 07:35:58 +01:00
parent 683bc62f96
commit 6179f45791
+8 -3
View File
@@ -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