Respect crossdirect and ccache build config in cmd_build()
This commit is contained in:
parent
291ddb85ca
commit
c7b2159481
2 changed files with 14 additions and 9 deletions
|
@ -25,6 +25,7 @@ PROFILE_DEFAULTS: Profile = {
|
||||||
|
|
||||||
CONFIG_DEFAULTS = {
|
CONFIG_DEFAULTS = {
|
||||||
'build': {
|
'build': {
|
||||||
|
'ccache': True,
|
||||||
'crosscompile': True,
|
'crosscompile': True,
|
||||||
'crossdirect': True,
|
'crossdirect': True,
|
||||||
'threads': 0,
|
'threads': 0,
|
||||||
|
|
22
packages.py
22
packages.py
|
@ -422,7 +422,7 @@ def build_package(
|
||||||
set([target_chroot, native_chroot])
|
set([target_chroot, native_chroot])
|
||||||
|
|
||||||
# eliminate target_chroot == native_chroot with set()
|
# eliminate target_chroot == native_chroot with set()
|
||||||
for chroot, _arch in [(native_chroot, config.runtime['arch']), (target_chroot, arch)]:
|
for chroot, _arch in set([(native_chroot, config.runtime['arch']), (target_chroot, arch)]):
|
||||||
logging.debug(f'Mounting packages to {chroot}')
|
logging.debug(f'Mounting packages to {chroot}')
|
||||||
dir = mount_packages(chroot, _arch)
|
dir = mount_packages(chroot, _arch)
|
||||||
umount_dirs += [dir]
|
umount_dirs += [dir]
|
||||||
|
@ -453,15 +453,14 @@ def build_package(
|
||||||
build_root = target_chroot
|
build_root = target_chroot
|
||||||
makepkg_compile_opts += ['--syncdeps']
|
makepkg_compile_opts += ['--syncdeps']
|
||||||
env = deepcopy(makepkg_env)
|
env = deepcopy(makepkg_env)
|
||||||
if enable_ccache:
|
if foreign_arch and enable_crossdirect and package.name not in CROSSDIRECT_PKGS:
|
||||||
env['PATH'] = f"/usr/lib/ccache:{env['PATH']}"
|
|
||||||
if not foreign_arch:
|
|
||||||
logging.debug('Building for native arch, skipping crossdirect.')
|
|
||||||
elif enable_crossdirect and package.name not in CROSSDIRECT_PKGS:
|
|
||||||
env['PATH'] = f"/native/usr/lib/crossdirect/{arch}:{env['PATH']}"
|
env['PATH'] = f"/native/usr/lib/crossdirect/{arch}:{env['PATH']}"
|
||||||
umount_dirs += [mount_crossdirect(native_chroot=native_chroot, target_chroot=target_chroot, target_arch=arch)]
|
umount_dirs += [mount_crossdirect(native_chroot=native_chroot, target_chroot=target_chroot, target_arch=arch)]
|
||||||
else:
|
else:
|
||||||
logging.debug('Skipping crossdirect.')
|
if enable_ccache:
|
||||||
|
logging.debug('ccache enabled')
|
||||||
|
env['PATH'] = f"/usr/lib/ccache:{env['PATH']}"
|
||||||
|
logging.debug(('Building for native arch. ' if not foreign_arch else '') + 'Skipping crossdirect.')
|
||||||
|
|
||||||
src_dir = os.path.join(build_root, 'src')
|
src_dir = os.path.join(build_root, 'src')
|
||||||
os.makedirs(src_dir, exist_ok=True)
|
os.makedirs(src_dir, exist_ok=True)
|
||||||
|
@ -535,9 +534,14 @@ def cmd_build(paths: list[str], force=False, arch=None):
|
||||||
return
|
return
|
||||||
for level, need_build in enumerate(build_levels):
|
for level, need_build in enumerate(build_levels):
|
||||||
logging.info(f"(Level {level}) Building {', '.join([x.name for x in need_build])}")
|
logging.info(f"(Level {level}) Building {', '.join([x.name for x in need_build])}")
|
||||||
crosscompile = config.file['build']['crosscompile']
|
|
||||||
for package in need_build:
|
for package in need_build:
|
||||||
build_package(package, arch=arch, enable_crosscompile=crosscompile)
|
build_package(
|
||||||
|
package,
|
||||||
|
arch=arch,
|
||||||
|
enable_crosscompile=config.file['build']['crosscompile'],
|
||||||
|
enable_crossdirect=config.file['build']['crossdirect'],
|
||||||
|
enable_ccache=config.file['build']['ccache'],
|
||||||
|
)
|
||||||
add_package_to_repo(package, arch)
|
add_package_to_repo(package, arch)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue