pmb.build.init: refactor init marker related code
Put it in /tmp and touch it directly from python instead of running pmb.chroot.root. This way it's slightly faster and doesn't require root rights. Order the imports alphabetically while at it, and remove very obvious comments. Reviewed-by: Caleb Connolly <kc@postmarketos.org> Tested-by: Caleb Connolly <kc@postmarketos.org> Link: https://lists.sr.ht/~postmarketos/pmbootstrap-devel/%3C20230419192042.3951-2-ollieparanoid@postmarketos.org%3E
This commit is contained in:
parent
a8695833d9
commit
a8ab820015
|
@ -1,8 +1,9 @@
|
|||
# Copyright 2023 Oliver Smith
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
import os
|
||||
import logging
|
||||
import glob
|
||||
import logging
|
||||
import os
|
||||
import pathlib
|
||||
|
||||
import pmb.build
|
||||
import pmb.config
|
||||
|
@ -12,9 +13,8 @@ import pmb.helpers.run
|
|||
|
||||
|
||||
def init(args, suffix="native"):
|
||||
# Check if already initialized
|
||||
marker = "/var/local/pmbootstrap_chroot_build_init_done"
|
||||
if os.path.exists(args.work + "/chroot_" + suffix + marker):
|
||||
marker = f"{args.work}/chroot_{suffix}/tmp/pmb_chroot_build_init_done"
|
||||
if os.path.exists(marker):
|
||||
return
|
||||
|
||||
# Initialize chroot, install packages
|
||||
|
@ -77,8 +77,7 @@ def init(args, suffix="native"):
|
|||
"s/^ERROR_CLEANUP=.*/ERROR_CLEANUP=''/",
|
||||
"/etc/abuild.conf"], suffix)
|
||||
|
||||
# Mark the chroot as initialized
|
||||
pmb.chroot.root(args, ["touch", marker], suffix)
|
||||
pathlib.Path(marker).touch()
|
||||
|
||||
|
||||
def init_compiler(args, depends, cross, arch):
|
||||
|
|
Loading…
Reference in New Issue