packages, chroot: make sure chroots are initialised and /prebuilts is mounted

This commit is contained in:
InsanePrawn 2022-01-29 07:51:38 +01:00
parent 6bc3d36b11
commit 190251dd7d
2 changed files with 7 additions and 1 deletions

View file

@ -163,6 +163,8 @@ class Chroot:
self.base_packages = base_packages self.base_packages = base_packages
if initialize: if initialize:
self.initialize() self.initialize()
if self.name.startswith(BASE_CHROOT_PREFIX) and set(get_kupfer_local(self.arch).repos).intersection(set(self.extra_repos)):
raise Exception(f'Base chroot {self.name} had local repos specified: {self.extra_repos}')
# TODO: when we go multithreaded, activate() and initialize() probably need a reader-writer lock # TODO: when we go multithreaded, activate() and initialize() probably need a reader-writer lock
@ -453,6 +455,7 @@ class Chroot:
native_mount = os.path.join(self.path, 'native') native_mount = os.path.join(self.path, 'native')
logging.debug(f'Activating crossdirect in {native_mount}') logging.debug(f'Activating crossdirect in {native_mount}')
native_chroot.initialize()
native_chroot.mount_pacman_cache() native_chroot.mount_pacman_cache()
native_chroot.mount_packages() native_chroot.mount_packages()
native_chroot.activate() native_chroot.activate()

View file

@ -415,14 +415,15 @@ def setup_build_chroot(
add_kupfer_repos: bool = True, add_kupfer_repos: bool = True,
clean_chroot: bool = False, clean_chroot: bool = False,
) -> Chroot: ) -> Chroot:
init_prebuilts(arch)
chroot = get_build_chroot(arch, add_kupfer_repos=add_kupfer_repos) chroot = get_build_chroot(arch, add_kupfer_repos=add_kupfer_repos)
chroot.mount_packages()
logging.info(f'Initializing {arch} build chroot') logging.info(f'Initializing {arch} build chroot')
chroot.initialize(reset=clean_chroot) chroot.initialize(reset=clean_chroot)
chroot.write_pacman_conf() # in case it was initialized with different repos chroot.write_pacman_conf() # in case it was initialized with different repos
chroot.activate() chroot.activate()
chroot.mount_pacman_cache() chroot.mount_pacman_cache()
chroot.mount_pkgbuilds() chroot.mount_pkgbuilds()
chroot.mount_packages()
if extra_packages: if extra_packages:
chroot.try_install_packages(extra_packages, allow_fail=False) chroot.try_install_packages(extra_packages, allow_fail=False)
return chroot return chroot
@ -469,6 +470,8 @@ def build_package(
) )
cross = foreign_arch and package.mode == 'cross' and enable_crosscompile cross = foreign_arch and package.mode == 'cross' and enable_crosscompile
target_chroot.initialize()
if cross: if cross:
logging.info(f'Cross-compiling {package.path}') logging.info(f'Cross-compiling {package.path}')
build_root = native_chroot build_root = native_chroot