forked from Mirror/pmbootstrap
Add pmbootstrap checksum --verify (!1788)
Download all sources and verify their checksums. This will be used in pmaports.git CI, if ci:skip-build is set in the commit message (currently it just skips the build, and we don't test if the source checksums are valid or not).
This commit is contained in:
parent
110b5821ac
commit
b4c301974e
5 changed files with 22 additions and 4 deletions
|
@ -18,7 +18,6 @@ along with pmbootstrap. If not, see <http://www.gnu.org/licenses/>.
|
|||
"""
|
||||
# Exported functions
|
||||
from pmb.build.init import init
|
||||
from pmb.build.checksum import checksum
|
||||
from pmb.build.envkernel import package_kernel
|
||||
from pmb.build.menuconfig import menuconfig
|
||||
from pmb.build.newapkbuild import newapkbuild
|
||||
|
|
|
@ -24,7 +24,8 @@ import pmb.helpers.run
|
|||
import pmb.helpers.pmaports
|
||||
|
||||
|
||||
def checksum(args, pkgname):
|
||||
def check(args, pkgname):
|
||||
""" Fetch all sources and update the checksums in the APKBUILD. """
|
||||
pmb.build.init(args)
|
||||
pmb.build.copy_to_buildpath(args, pkgname)
|
||||
logging.info("(native) generate checksums for " + pkgname)
|
||||
|
@ -35,3 +36,15 @@ def checksum(args, pkgname):
|
|||
source = args.work + "/chroot_native/home/pmos/build/APKBUILD"
|
||||
target = pmb.helpers.pmaports.find(args, pkgname) + "/"
|
||||
pmb.helpers.run.user(args, ["cp", source, target])
|
||||
|
||||
|
||||
def verify(args, pkgname):
|
||||
""" Fetch all sources and verify their checksums. """
|
||||
pmb.build.init(args)
|
||||
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(args, ["abuild", "fetch", "verify"],
|
||||
working_dir="/home/pmos/build")
|
||||
|
|
|
@ -119,7 +119,10 @@ def build_init(args):
|
|||
|
||||
def checksum(args):
|
||||
for package in args.packages:
|
||||
pmb.build.checksum(args, package)
|
||||
if args.verify:
|
||||
pmb.build.checksum.verify(args, package)
|
||||
else:
|
||||
pmb.build.checksum.check(args, package)
|
||||
|
||||
|
||||
def chroot(args):
|
||||
|
|
|
@ -478,6 +478,9 @@ def arguments():
|
|||
|
||||
# Action: checksum / aportgen / build
|
||||
checksum = sub.add_parser("checksum", help="update aport checksums")
|
||||
checksum.add_argument("--verify", action="store_true", help="download"
|
||||
" sources and verify that the checksums of the"
|
||||
" APKBUILD match, instead of updating them")
|
||||
aportgen = sub.add_parser("aportgen", help="generate a postmarketOS"
|
||||
" specific package build recipe (aport/APKBUILD)")
|
||||
build = sub.add_parser("build", help="create a package for a"
|
||||
|
|
|
@ -134,7 +134,7 @@ def test_aportgen_device_wizard(args, monkeypatch):
|
|||
|
||||
# Build the device package
|
||||
pkgname = "device-testsuite-testdevice"
|
||||
pmb.build.checksum(args, pkgname)
|
||||
pmb.build.checksum.check(args, pkgname)
|
||||
pmb.build.package(args, pkgname, "armhf", force=True)
|
||||
|
||||
# Abort on overwrite confirmation
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue