pmbootstrap-meow/pmb/build/checksum.py
Caleb Connolly 34dd9d42ba
WIP: start ripping out args (MR 2252)
Cease merging pmbootstrap.cfg into args, implement a Context type to let
us pull globals out of thin air (as an intermediate workaround) and rip
args out of a lot of the codebase.

This is just a first pass, after this we can split all the state that
leaked over into Context into types with narrower scopes (like a
BuildContext(), etc).

Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
2024-06-23 12:38:38 +02:00

38 lines
1.3 KiB
Python

# Copyright 2023 Oliver Smith
# SPDX-License-Identifier: GPL-3.0-or-later
from pmb.helpers import logging
import os
from pathlib import Path
import pmb.chroot
import pmb.build
from pmb.types import PmbArgs
import pmb.helpers.run
import pmb.helpers.pmaports
from pmb.core import Chroot
def update(args: PmbArgs, pkgname):
"""Fetch all sources and update the checksums in the APKBUILD."""
pmb.build.init_abuild_minimal()
pmb.build.copy_to_buildpath(args, pkgname)
logging.info("(native) generate checksums for " + pkgname)
pmb.chroot.user(["abuild", "checksum"],
working_dir=Path("/home/pmos/build"))
# Copy modified APKBUILD back
source = Chroot.native() / "home/pmos/build/APKBUILD"
target = f"{os.fspath(pmb.helpers.pmaports.find(pkgname))}/"
pmb.helpers.run.user(["cp", source, target])
def verify(args: PmbArgs, pkgname):
"""Fetch all sources and verify their checksums."""
pmb.build.init_abuild_minimal()
pmb.build.copy_to_buildpath(args, pkgname)
logging.info("(native) verify checksums for " + pkgname)
# Fetch and verify sources, "fetch" alone does not verify them:
# https://github.com/alpinelinux/abuild/pull/86
pmb.chroot.user(["abuild", "fetch", "verify"],
working_dir=Path("/home/pmos/build"))