Remove build tools from rootfs

This commit is contained in:
themylogin
2023-07-11 10:11:44 +02:00
parent e3bea2e750
commit 0de14d4902
4 changed files with 20 additions and 9 deletions

View File

@@ -131,7 +131,7 @@ class BootstrapDir(CacheMixin, HashMixin):
shutil.rmtree(self.chroot_basedir) shutil.rmtree(self.chroot_basedir)
class PackageBootstrapDirectory(BootstrapDir): class RootfsBootstrapDir(BootstrapDir):
@property @property
def deopts(self): def deopts(self):
@@ -139,11 +139,11 @@ class PackageBootstrapDirectory(BootstrapDir):
@property @property
def extra_packages_to_install(self): def extra_packages_to_install(self):
return ['build-essential', 'dh-make', 'devscripts', 'fakeroot'] return []
@property @property
def cache_filename(self): def cache_filename(self):
return 'basechroot-package.squashfs' return 'basechroot-rootfs.squashfs'
def after_extra_packages_installation_steps(self): def after_extra_packages_installation_steps(self):
if self.installed_packages_in_cache_changed: if self.installed_packages_in_cache_changed:
@@ -166,6 +166,17 @@ class PackageBootstrapDirectory(BootstrapDir):
run(['chroot', self.chroot_basedir, '/debootstrap/debootstrap', '--second-stage']) run(['chroot', self.chroot_basedir, '/debootstrap/debootstrap', '--second-stage'])
class PackageBootstrapDir(RootfsBootstrapDir):
@property
def extra_packages_to_install(self):
return ['build-essential', 'dh-make', 'devscripts', 'fakeroot']
@property
def cache_filename(self):
return 'basechroot-package.squashfs'
class CdromBootstrapDirectory(BootstrapDir): class CdromBootstrapDirectory(BootstrapDir):
@property @property

View File

@@ -6,7 +6,7 @@ import threading
from toposort import toposort from toposort import toposort
from .bootstrap.bootstrapdir import PackageBootstrapDirectory from .bootstrap.bootstrapdir import PackageBootstrapDir
from .clean import clean_bootstrap_logs from .clean import clean_bootstrap_logs
from .config import PARALLEL_BUILD, PKG_DEBUG from .config import PARALLEL_BUILD, PKG_DEBUG
from .exceptions import CallError from .exceptions import CallError
@@ -109,7 +109,7 @@ def _build_packages_impl(desired_packages=None):
logger.debug('Setting up bootstrap directory') logger.debug('Setting up bootstrap directory')
with LoggingContext('build_packages', 'w'): with LoggingContext('build_packages', 'w'):
PackageBootstrapDirectory().setup() PackageBootstrapDir().setup()
logger.debug('Successfully setup bootstrap directory') logger.debug('Successfully setup bootstrap directory')

View File

@@ -1,6 +1,6 @@
import os import os
from scale_build.bootstrap.bootstrapdir import PackageBootstrapDirectory from scale_build.bootstrap.bootstrapdir import PackageBootstrapDir
from scale_build.utils.run import run from scale_build.utils.run import run
@@ -10,4 +10,4 @@ class BootstrapMixin:
os.makedirs(self.tmpfs_path, exist_ok=True) os.makedirs(self.tmpfs_path, exist_ok=True)
if self.tmpfs: if self.tmpfs:
run(['mount', '-t', 'tmpfs', '-o', f'size={self.tmpfs_size}G', 'tmpfs', self.tmpfs_path]) run(['mount', '-t', 'tmpfs', '-o', f'size={self.tmpfs_size}G', 'tmpfs', self.tmpfs_path])
PackageBootstrapDirectory().restore_cache(self.chroot_base_directory) PackageBootstrapDir().restore_cache(self.chroot_base_directory)

View File

@@ -2,7 +2,7 @@ import difflib
import logging import logging
import os import os
from .bootstrap.bootstrapdir import PackageBootstrapDirectory from .bootstrap.bootstrapdir import RootfsBootstrapDir
from .exceptions import CallError from .exceptions import CallError
from .image.bootstrap import ( from .image.bootstrap import (
clean_mounts, setup_chroot_basedir, umount_chroot_basedir, umount_tmpfs_and_clean_chroot_dir clean_mounts, setup_chroot_basedir, umount_chroot_basedir, umount_tmpfs_and_clean_chroot_dir
@@ -54,7 +54,7 @@ def build_update_image_impl():
logger.debug('Bootstrapping TrueNAS rootfs [UPDATE] (%s/rootfs-bootstrap.log)', LOG_DIR) logger.debug('Bootstrapping TrueNAS rootfs [UPDATE] (%s/rootfs-bootstrap.log)', LOG_DIR)
with LoggingContext('rootfs-bootstrap', 'w'): with LoggingContext('rootfs-bootstrap', 'w'):
package_bootstrap_obj = PackageBootstrapDirectory() package_bootstrap_obj = RootfsBootstrapDir()
package_bootstrap_obj.setup() package_bootstrap_obj.setup()
logger.debug('Installing TrueNAS rootfs package [UPDATE] (%s/rootfs-packages.log)', LOG_DIR) logger.debug('Installing TrueNAS rootfs package [UPDATE] (%s/rootfs-packages.log)', LOG_DIR)