Example #1
0
def build_iso(self, iso, branch):
    logger.info('Fetching ISO configuration...')
    iso.source.checkout(branch=branch)

    config = iso.config

    if not config:
        logger.error('ISO configuration not found: ' + iso.name)
        return

    logger.info('Setting up the build directory...')
    rsync('/usr/share/archiso/configs/releng', config.workdir)

    logger.info('Preparing ISO configuration...')

    # Add any additional repos
    replace_in_file(config.path('pacman.conf'), r'\#\[testing\]',
                    '\n\n'.join(config.custom_repos) + '\n\n#[testing]')

    # Add the requested packages
    append_to_file(config.path('packages.both'), config.packages)
    append_to_file(config.path('packages.i686'), config.packages_i686)
    append_to_file(config.path('packages.x86_64'), config.packages_x86_64)

    # Add customizations
    append_to_file(config.path('airootfs/root/customize_airootfs.sh'), config.customizations)

    if config.graphical_target:
        replace_in_file(config.path('airootfs/root/customize_airootfs.sh'),
                        r'multi-user.target', 'graphical.target')

    logger.info('Building ISO...')
    cmd = [config.path('build.sh'), '-v']

    if config.name:
        cmd += ['-N ' + config.name]
    if config.version:
        cmd += ['-V ' + config.version]
    if config.label:
        cmd += ['-L ' + config.label]

    run(cmd, capture_stdout=False, sudo=True, workdir=config.workdir)
Example #2
0
    def build(self):
        print('>>>>> Removing the existing build directory...')
        shutil.rmtree(self.build_dir)

        print('>>>>> Setting up the build directory...')

        # Set up the iso build dir
        shutil.copytree('/usr/share/archiso/configs/releng', self.build_dir)

        # Add any additional repos
        replace_in_file(self.path('pacman.conf'), r'\#\[testing\]',
                        '\n\n'.join(self.custom_repos) + '\n\n#[testing]')

        # Add the requested packages
        append_to_file(self.path('packages.both'), self.packages)
        append_to_file(self.path('packages.i686'), self.packages_i686)
        append_to_file(self.path('packages.x86_64'), self.packages_x86_64)

        # Add customizations
        append_to_file(self.path('airootfs/root/customize_airootfs.sh'), self.customizations)

        if self.graphical_target:
            replace_in_file(self.path('airootfs/root/customize_airootfs.sh'),
                            r'multi-user.target', 'graphical.target')

        print('>>>>> Building...')
        cmd = 'sudo ' + self.path('build.sh')
        args = ['v']

        if self.name:
            args += ['-N ' + self.name]
        if self.version:
            args += ['-V ' + self.version]
        if self.label:
            args += ['-L ' + self.label]

        cmd += ' ' + ' '.join(args)
        subprocess.call(cmd, shell=True, cwd=self.build_dir)