Speed up 'pmbootstrap checksum'
Don't install gcc, ccache, git when the user only wants to update the checksums of a package. Reviewed-by: Caleb Connolly <kc@postmarketos.org> Tested-by: Caleb Connolly <kc@postmarketos.org> Link: https://lists.sr.ht/~postmarketos/pmbootstrap-devel/%3C20230419192042.3951-3-ollieparanoid@postmarketos.org%3E
This commit is contained in:
parent
a8ab820015
commit
c6bcb0dacf
|
@ -1,6 +1,6 @@
|
|||
# Copyright 2023 Oliver Smith
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
from pmb.build.init import init, init_compiler
|
||||
from pmb.build.init import init, init_abuild_minimal, init_compiler
|
||||
from pmb.build.envkernel import package_kernel
|
||||
from pmb.build.kconfig import menuconfig
|
||||
from pmb.build.newapkbuild import newapkbuild
|
||||
|
|
|
@ -10,7 +10,7 @@ import pmb.helpers.pmaports
|
|||
|
||||
def update(args, pkgname):
|
||||
""" Fetch all sources and update the checksums in the APKBUILD. """
|
||||
pmb.build.init(args)
|
||||
pmb.build.init_abuild_minimal(args)
|
||||
pmb.build.copy_to_buildpath(args, pkgname)
|
||||
logging.info("(native) generate checksums for " + pkgname)
|
||||
pmb.chroot.user(args, ["abuild", "checksum"],
|
||||
|
@ -24,7 +24,7 @@ def update(args, pkgname):
|
|||
|
||||
def verify(args, pkgname):
|
||||
""" Fetch all sources and verify their checksums. """
|
||||
pmb.build.init(args)
|
||||
pmb.build.init_abuild_minimal(args)
|
||||
pmb.build.copy_to_buildpath(args, pkgname)
|
||||
logging.info("(native) verify checksums for " + pkgname)
|
||||
|
||||
|
|
|
@ -12,14 +12,14 @@ import pmb.chroot.apk
|
|||
import pmb.helpers.run
|
||||
|
||||
|
||||
def init(args, suffix="native"):
|
||||
marker = f"{args.work}/chroot_{suffix}/tmp/pmb_chroot_build_init_done"
|
||||
def init_abuild_minimal(args, suffix="native"):
|
||||
""" Initialize a minimal chroot with abuild where one can do
|
||||
'abuild checksum'. """
|
||||
marker = f"{args.work}/chroot_{suffix}/tmp/pmb_chroot_abuild_init_done"
|
||||
if os.path.exists(marker):
|
||||
return
|
||||
|
||||
# Initialize chroot, install packages
|
||||
pmb.chroot.apk.install(args, pmb.config.build_packages, suffix,
|
||||
build=False)
|
||||
pmb.chroot.apk.install(args, ["abuild"], suffix, build=False)
|
||||
|
||||
# Fix permissions
|
||||
pmb.chroot.root(args, ["chown", "root:abuild",
|
||||
|
@ -27,6 +27,24 @@ def init(args, suffix="native"):
|
|||
pmb.chroot.root(args, ["chmod", "g+w",
|
||||
"/var/cache/distfiles"], suffix)
|
||||
|
||||
# Add user to group abuild
|
||||
pmb.chroot.root(args, ["adduser", "pmos", "abuild"], suffix)
|
||||
|
||||
pathlib.Path(marker).touch()
|
||||
|
||||
|
||||
def init(args, suffix="native"):
|
||||
""" Initialize a chroot for building packages with abuild. """
|
||||
marker = f"{args.work}/chroot_{suffix}/tmp/pmb_chroot_build_init_done"
|
||||
if os.path.exists(marker):
|
||||
return
|
||||
|
||||
init_abuild_minimal(args, suffix)
|
||||
|
||||
# Initialize chroot, install packages
|
||||
pmb.chroot.apk.install(args, pmb.config.build_packages, suffix,
|
||||
build=False)
|
||||
|
||||
# Generate package signing keys
|
||||
chroot = args.work + "/chroot_" + suffix
|
||||
if not os.path.exists(args.work + "/config_abuild/abuild.conf"):
|
||||
|
@ -63,9 +81,6 @@ def init(args, suffix="native"):
|
|||
"/usr/local/bin/gzip"], suffix)
|
||||
pmb.chroot.root(args, ["chmod", "+x", "/usr/local/bin/gzip"], suffix)
|
||||
|
||||
# Add user to group abuild
|
||||
pmb.chroot.root(args, ["adduser", "pmos", "abuild"], suffix)
|
||||
|
||||
# abuild.conf: Don't clean the build folder after building, so we can
|
||||
# inspect it afterwards for debugging
|
||||
pmb.chroot.root(args, ["sed", "-i", "-e", "s/^CLEANUP=.*/CLEANUP=''/",
|
||||
|
|
Loading…
Reference in New Issue