Fix detecting changed aports
This commit is contained in:
parent
4e940e519d
commit
25380ced2f
2 changed files with 17 additions and 10 deletions
|
@ -58,7 +58,7 @@ aports-static-upstream:
|
||||||
- pmbootstrap.cfg
|
- pmbootstrap.cfg
|
||||||
expire_in: 1 week
|
expire_in: 1 week
|
||||||
only:
|
only:
|
||||||
- master
|
- master@postmarketOS/pmaports
|
||||||
|
|
||||||
# build changed aports
|
# build changed aports
|
||||||
aports-build:
|
aports-build:
|
||||||
|
|
|
@ -32,14 +32,16 @@ def get_changed_files():
|
||||||
commit that was used for the diff.
|
commit that was used for the diff.
|
||||||
:returns: list of changed files
|
:returns: list of changed files
|
||||||
"""
|
"""
|
||||||
# Current branch
|
commit_head = run_git(["rev-parse", "HEAD"])[:-1]
|
||||||
branch = run_git(["rev-parse", "--abbrev-ref", "HEAD"])[:-1]
|
commit_upstream_master = run_git(["rev-parse", "upstream/master"])[:-1]
|
||||||
print("branch: " + branch)
|
print("commit HEAD: " + commit_head)
|
||||||
|
print("commit upstream/master: " + commit_upstream_master)
|
||||||
|
|
||||||
# Commit to diff against
|
# Check if we are latest upstream/master
|
||||||
commit = "HEAD~1"
|
if commit_head == commit_upstream_master:
|
||||||
if branch != "master":
|
commit = "HEAD~1" # then compare with previous commit
|
||||||
commit = run_git(["merge-base", "master", "HEAD"])[:-1]
|
else:
|
||||||
|
commit = run_git(["merge-base", "upstream/master", "HEAD"])[:-1] # otherwise compare with latest common ancestor
|
||||||
print("comparing HEAD with: " + commit)
|
print("comparing HEAD with: " + commit)
|
||||||
|
|
||||||
# Changed files
|
# Changed files
|
||||||
|
@ -77,13 +79,18 @@ def get_changed_packages():
|
||||||
def check_build(packages):
|
def check_build(packages):
|
||||||
# Initialize build environment with less logging
|
# Initialize build environment with less logging
|
||||||
run_pmbootstrap(["build_init"])
|
run_pmbootstrap(["build_init"])
|
||||||
run_pmbootstrap(["--details-to-stdout", "build", "--strict"] +
|
run_pmbootstrap(["--details-to-stdout", "build", "--strict", "--force"] +
|
||||||
list(packages))
|
list(packages))
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
packages = get_changed_packages()
|
# Add a remote pointing to postmarketOS/pmaports for later
|
||||||
|
run_git(["remote", "add", "upstream",
|
||||||
|
"https://gitlab.com/postmarketOS/pmaports.git"])
|
||||||
|
run_git(["fetch", "upstream"])
|
||||||
|
|
||||||
|
# Build changed packages
|
||||||
|
packages = get_changed_packages()
|
||||||
if len(packages) == 0:
|
if len(packages) == 0:
|
||||||
print("no aports changed in this branch")
|
print("no aports changed in this branch")
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Add table
Reference in a new issue