Esempio n. 1
0
def mkarchroot(workdir, packages=None):
    if not packages:
        packages = []
    parent_dir = os.path.dirname(workdir)
    if not os.path.exists(parent_dir):
        os.makedirs(parent_dir)
    run(['mkarchroot', workdir] + packages, sudo=True, capture_stdout=False)
Esempio n. 2
0
def arch_nspawn(workdir, cmd, bind_ro=None, bind_rw=None):
    if not bind_ro:
        bind_ro = []
    if not bind_rw:
        bind_rw = []
    bind_ro = ['--bind-ro=' + bind for bind in bind_ro]
    bind_rw = ['--bind=' + bind for bind in bind_rw]
    run(['arch-nspawn', workdir] + bind_ro + bind_rw + cmd, capture_stdout=False)
Esempio n. 3
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)
Esempio n. 4
0
def repoadd(database, package, sudo=False):
    db_dir = os.path.dirname(database)
    pkg_dir = os.path.dirname(package)

    if os.path.exists(os.path.join(db_dir, os.path.basename(package))):
        return

    if sudo:
        utils.run(['mkdir', '-p', db_dir], workdir=db_dir, sudo=True)
        if pkg_dir != db_dir:
            utils.run(['cp', package, db_dir], workdir=db_dir, sudo=True)
    else:
        if not os.path.exists(db_dir):
            os.makedirs(db_dir)
        if pkg_dir != db_dir:
            package = copy(package, db_dir)
    utils.run(['repo-add', database, package], sudo=sudo)
Esempio n. 5
0
def rsync(source_dir, dest_dir, sudo=False):
    run(['rsync', '-a', '--delete', '-q', '-W', '-x', source_dir + '/', dest_dir],
        capture_stdout=False, sudo=sudo)
Esempio n. 6
0
def hub(cmd, workdir):
    run(['hub'] + cmd, workdir=workdir, capture_stdout=False)
Esempio n. 7
0
def ccm(action, arch, workdir):
    bits = "32" if arch == "i686" else "64"
    return utils.run(['ccm' + bits, action], workdir=workdir, capture_stdout=False, sudo=True)