Beispiel #1
0
def setup_environment_template(architecture):
    env = Environment(CHROOT_TEMPLATE.format(arch=architecture))

    os.makedirs(env.root)
    for basedir in BASEDIRS:
        os.makedirs(joinpaths(env.root, basedir))

    pacman = Pacman(env.root, config=joinpaths(config.STUFF, 'pacman.conf'),
                    cachedir=config.GLOBAL_PACMAN_CACHE)
    pacman.refresh_database()
    pacman.install(BASEPACKAGES)

    with env:
        for src, dst, mode in [
            ('resolv.conf', '/etc', None),
            ('pacman.conf', '/etc', None),
            ('mirrorlist-%s' % architecture, '/etc/pacman.d/mirrorlist', None),
            ('buildpkg', '/usr/bin/buildpkg', '+x'),
        ]:
            shutil.copy(joinpaths(config.STUFF, src), joinpaths(env.root, dst[1:]))
            if mode:
                env.execute('chmod', mode, dst)
        env.execute('useradd', '-m', 'build')
        env.execute('chown', '-R', 'build:build', '/home/build')
    return env
Beispiel #2
0
 def __enter__(self):
     assert not self._joined, "cannot join environment twice"
     for directory in ['/dev', '/sys', '/proc']:
         execute_command('mount', '--bind', directory,
                         joinpaths(self.root, directory[1:]))
     execute_command('mount', '--bind', config.GLOBAL_PACMAN_CACHE,
                     joinpaths(self.root, 'var/cache/pacman'))
     self._joined = True
Beispiel #3
0
    def run(self, package_name, architecture):
        environ = Environment.setup_clone(architecture)
        with environ:
            environ.execute_as_build_user('buildpkg --download %s' % package_name)

            pkgbuild = Pkgbuild(joinpaths(environ.home, package_name, 'PKGBUILD'))
            makedepends = pkgbuild.parse_makedepends()
            depends = pkgbuild.parse_depends()
            if depends:
                environ.pacman.install(depends, as_dependency=True)
            if makedepends:
                environ.pacman.install(makedepends)

            environ.execute_as_build_user('buildpkg --build %s' % package_name)

        package_file = find_package_in(joinpaths(environ.home, package_name))
        update_repository(architecture, package_file)
Beispiel #4
0
from aurbuilds.utils import parent_dir, joinpaths

DEBUG = True
TARGET_ARCHITECTURES = ['i686']
ROOT = '/aurbuilds'
REPO = joinpaths(ROOT, 'repos', '{arch}')
STUFF = parent_dir(__file__)
GLOBAL_PACMAN_CACHE = '/var/cache/pacman/pkg'
PACMAN_EXE = 'pacman'
Beispiel #5
0
 def __exit__(self, *exc_info):
     for directory in ['dev', 'sys', 'proc', 'var/cache/pacman']:
         execute_command('umount', joinpaths(self.root, directory))
     self._joined = False
Beispiel #6
0
 def __init__(self, root, template=None):
     self.root = root
     self.template = template
     self.home = joinpaths(root, 'home', 'build')
     self.pacman = PacmanInEnvironment(self)
     self._joined = False
Beispiel #7
0
import os
import shutil
from aurbuilds import config
from aurbuilds.pacman import Pacman
from aurbuilds.utils import execute_command, joinpaths

CHROOT_TEMPLATE = joinpaths(config.ROOT, 'template-{arch}')
CHROOT = joinpaths(config.ROOT, 'build-{arch}')

BASEDIRS = ['var/lib/pacman', 'sys', 'proc', 'dev', 'dev/shm', 'dev/pts']
BASEPACKAGES = ['pacman', 'util-linux-ng', 'base-devel',
                'gzip', 'file', 'curl', 'wget']

def setup_environment_template(architecture):
    env = Environment(CHROOT_TEMPLATE.format(arch=architecture))

    os.makedirs(env.root)
    for basedir in BASEDIRS:
        os.makedirs(joinpaths(env.root, basedir))

    pacman = Pacman(env.root, config=joinpaths(config.STUFF, 'pacman.conf'),
                    cachedir=config.GLOBAL_PACMAN_CACHE)
    pacman.refresh_database()
    pacman.install(BASEPACKAGES)

    with env:
        for src, dst, mode in [
            ('resolv.conf', '/etc', None),
            ('pacman.conf', '/etc', None),
            ('mirrorlist-%s' % architecture, '/etc/pacman.d/mirrorlist', None),
            ('buildpkg', '/usr/bin/buildpkg', '+x'),