ci: verify_checksums: support packages in systemd repos
In 65038ce26a the logic for also checksum checking pkgs in the systemd
repo was dropped when the logic was moved from build_changed_aports.py,
this re-introduces that logic so that checksums for packages in the
systemd repo are also checked.
Part-of: https://gitlab.postmarketos.org/postmarketos/pmaports/-/merge_requests/6404
This commit is contained in:
parent
36875d85f2
commit
2d77fa6662
1 changed files with 61 additions and 1 deletions
|
|
@ -1,10 +1,18 @@
|
|||
#!/usr/bin/env python3
|
||||
# Copyright 2025 Pablo Correa Gomez
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
import os
|
||||
import sys
|
||||
|
||||
# Same dir
|
||||
import common
|
||||
|
||||
# pmbootstrap
|
||||
import add_pmbootstrap_to_import_path
|
||||
import pmb.core
|
||||
from pmb.core.context import get_context
|
||||
|
||||
|
||||
def verify_checksums(packages):
|
||||
if len(packages) == 0:
|
||||
print("no packages changed, not doing any checksums verification")
|
||||
|
|
@ -15,8 +23,60 @@ def verify_checksums(packages):
|
|||
common.run_pmbootstrap(["--details-to-stdout", "checksum", "--verify"] +
|
||||
list(packages))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
# Get and print modified packages
|
||||
common.add_upstream_git_remote()
|
||||
packages = common.get_changed_packages()
|
||||
verify_checksums(packages)
|
||||
|
||||
# Load context
|
||||
sys.argv = ["pmbootstrap.py", "chroot"]
|
||||
args = pmb.parse.arguments()
|
||||
context = get_context()
|
||||
|
||||
# Get set of all buildable packages for the enabled repos, for skipping unbuildable
|
||||
# aports later. We might be given a changed aport from e.g. extra-repos/systemd when
|
||||
# that repo is not enabled
|
||||
buildable_pkgs = set()
|
||||
for path in pmb.core.pkgrepo.pkgrepo_iter_package_dirs():
|
||||
buildable_pkgs.add(os.path.basename(path))
|
||||
|
||||
# To store a list of packages from extra-repos/systemd for special handling
|
||||
# later:
|
||||
systemd_pkgs = list()
|
||||
|
||||
# Filter out packages are not found in enabled repos
|
||||
# (Iterate over copy of packages, because we modify it in this loop)
|
||||
for package in packages.copy():
|
||||
if package not in buildable_pkgs:
|
||||
print(f"{package}: not in current repo, skipping")
|
||||
packages.remove(package)
|
||||
# FIXME: this should probably be more generic, if other repos are added
|
||||
# later?
|
||||
# This just tosses the package into the list of packages to try
|
||||
# building later w/ systemd enabled, and assumes it'll be found
|
||||
# there.
|
||||
print(f"{package}: adding to list of packages to check in systemd repo")
|
||||
systemd_pkgs.append(package)
|
||||
continue
|
||||
|
||||
# No packages: skip build
|
||||
if len(packages) == 0:
|
||||
print("no packages to check for the current repo")
|
||||
else:
|
||||
verify_checksums(packages)
|
||||
|
||||
# FIXME: this should probably be more generic, if other repos are added later?
|
||||
if systemd_pkgs:
|
||||
common.run_pmbootstrap(["config", "systemd", "always"])
|
||||
# To fix the ERROR: Chroot 'native' is for the 'edge' channel, but you are on the
|
||||
# 'systemd-edge' channel. Run 'pmbootstrap zap' to delete your chroots and try again.
|
||||
# To do this automatically, run 'pmbootstrap config auto_zap_misconfigured_chroots yes'.
|
||||
common.run_pmbootstrap(["config", "auto_zap_misconfigured_chroots", "yes"])
|
||||
|
||||
# No packages: skip build
|
||||
if len(systemd_pkgs) == 0:
|
||||
print("no packages to check for the systemd repo")
|
||||
|
||||
else:
|
||||
verify_checksums(systemd_pkgs)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue