ci: lib: integrate add_upstream_git_remote into get_base_commit
add_upstream_git_remote was just being run at beginning of every method using get_changed_packages or get_changed_files, to have upstream available to use get_base_commit. So then, just move it to get_base_commit. As a positive side-effect, since the previous commit get_base_commit will just use the gitlab variable if available. So in CI we will just completely avoid running these two commands! Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7078>
This commit is contained in:
parent
7bf7616490
commit
bc3fb78958
8 changed files with 5 additions and 15 deletions
|
|
@ -41,7 +41,6 @@ if __name__ == "__main__":
|
|||
custom_valid_options += kconfigcheck_categories
|
||||
os.environ["CUSTOM_VALID_OPTIONS"] = " ".join(custom_valid_options)
|
||||
|
||||
common.add_upstream_git_remote()
|
||||
apkbuilds = {file for file in common.get_changed_files(removed=False)
|
||||
if os.path.basename(file) == "APKBUILD"}
|
||||
if len(apkbuilds) < 1:
|
||||
|
|
|
|||
|
|
@ -32,7 +32,6 @@ if __name__ == "__main__":
|
|||
arch = sys.argv[1]
|
||||
|
||||
# Get and print modified packages
|
||||
common.add_upstream_git_remote()
|
||||
packages = common.get_changed_packages()
|
||||
|
||||
# Load context
|
||||
|
|
|
|||
|
|
@ -216,7 +216,6 @@ Thank you and sorry for the inconvenience.
|
|||
|
||||
if __name__ == "__main__":
|
||||
# Get and print modified packages
|
||||
common.add_upstream_git_remote()
|
||||
packages = common.get_changed_packages()
|
||||
if len(packages) == 0:
|
||||
print("no aports changed in this branch")
|
||||
|
|
|
|||
|
|
@ -75,8 +75,6 @@ def show_error_all():
|
|||
|
||||
|
||||
if __name__ == "__main__":
|
||||
common.add_upstream_git_remote()
|
||||
|
||||
if "kconfigcheck.toml" in common.get_changed_files():
|
||||
print("kconfigcheck.toml changed -> checking all kernels")
|
||||
if not check_kconfig_all():
|
||||
|
|
|
|||
|
|
@ -32,13 +32,6 @@ def run_git(parameters, check=True, stderr=None):
|
|||
return None
|
||||
|
||||
|
||||
def add_upstream_git_remote():
|
||||
""" Add a remote pointing to postmarketOS/pmaports. """
|
||||
run_git(["remote", "add", "upstream",
|
||||
"https://gitlab.postmarketos.org/postmarketOS/pmaports.git"], False)
|
||||
run_git(["fetch", "-q", "upstream"])
|
||||
|
||||
|
||||
def commit_message_has_string(needle):
|
||||
base_commit = get_base_commit()
|
||||
|
||||
|
|
@ -102,6 +95,11 @@ def get_base_commit() -> str:
|
|||
if commit is not None:
|
||||
return commit
|
||||
|
||||
# Add a remote pointing to postmarketOS/pmaports
|
||||
run_git(["remote", "add", "upstream",
|
||||
"https://gitlab.postmarketos.org/postmarketOS/pmaports.git"], False)
|
||||
run_git(["fetch", "-q", "upstream"])
|
||||
|
||||
branch_upstream = f"upstream/{get_upstream_branch()}"
|
||||
commit_head = run_git(["rev-parse", "HEAD"])[:-1]
|
||||
commit_upstream = run_git(["rev-parse", branch_upstream])[:-1]
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ import subprocess
|
|||
import sys
|
||||
|
||||
if __name__ == "__main__":
|
||||
common.add_upstream_git_remote()
|
||||
deviceinfo_files = {file for file in common.get_changed_files(removed=False)
|
||||
if os.path.basename(file) == "deviceinfo"}
|
||||
|
||||
|
|
|
|||
|
|
@ -184,7 +184,6 @@ if __name__ == "__main__":
|
|||
devices_under_test = set()
|
||||
packages_modified = set()
|
||||
# Get and print modified packages
|
||||
common.add_upstream_git_remote()
|
||||
for file in common.get_changed_files():
|
||||
path = Path(file)
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ def verify_checksums(packages):
|
|||
|
||||
if __name__ == "__main__":
|
||||
# Get and print modified packages
|
||||
common.add_upstream_git_remote()
|
||||
packages = common.get_changed_packages()
|
||||
|
||||
# Load context
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue