Пример #1
0
class Pacman:
    """
    alpm wrapper
    :ivar handle: pyalpm root `Handle`
    """

    def __init__(self, configuration: Configuration) -> None:
        """
        default constructor
        :param configuration: configuration instance
        """
        root = configuration.get("alpm", "root")
        pacman_root = configuration.getpath("alpm", "database")
        self.handle = Handle(root, str(pacman_root))
        for repository in configuration.getlist("alpm", "repositories"):
            self.handle.register_syncdb(repository, 0)  # 0 is pgp_level

    def all_packages(self) -> List[str]:
        """
        get list of packages known for alpm
        :return: list of package names
        """
        result: Set[str] = set()
        for database in self.handle.get_syncdbs():
            result.update({package.name for package in database.pkgcache})

        return list(result)
Пример #2
0
def download_package(package, arch='x86_64'):
    global makechrootpkg_args

    dbpath = f'/var/lib/archbuild/extra-{arch}/root/var/lib/pacman/'
    gpgpath = f'/var/lib/archbuild/extra-{arch}/root/etc/pacman.d/gnupg'
    mirror = 'https://mirrors.tuna.tsinghua.edu.cn/archlinux'
    handle = Handle('/', dbpath)
    for i in ['core', 'extra', 'community']:
        repo = handle.register_syncdb(i, 0)

    for repo in handle.get_syncdbs():
        result = repo.get_pkg(package)
        if result:
            if arch == 'x86_64':
                url = f'{mirror}/{repo.name}/os/{arch}/{result.filename}'
            makechrootpkg_args += ['-I', 'tmp/' + result.filename]
            break

    run_cmd(['wget', '-nc', '-P', 'tmp', url, url + '.sig'])
    run_cmd([
        'gpg', '--homedir', gpgpath, '--verify',
        'tmp/' + result.filename + '.sig', 'tmp/' + result.filename
    ])
Пример #3
0
#!/usr/bin/env python3
from lilaclib import *

from pyalpm import Handle
arch = 'x86_64'
package = 'glfw-wayland'
dbpath = '/var/lib/archbuild/extra-x86_64/root/var/lib/pacman/'
gpgpath = '/var/lib/archbuild/extra-x86_64/root/etc/pacman.d/gnupg'
mirror = 'https://mirrors.tuna.tsinghua.edu.cn/archlinux'
handle = Handle('/', dbpath)
for i in ['core', 'extra', 'community']:
    repo = handle.register_syncdb(i, 0)
for repo in handle.get_syncdbs():
    result = repo.get_pkg(package)
    if result:
        url = f'{mirror}/{repo.name}/os/{arch}/{result.filename}'
        break

repo_depends = [
    'mumps-par', 'oce', 'hypre', 'mmg', 'libnn-git', 'libcsa-git', 'scalapack'
]
build_prefix = 'extra-x86_64'
time_limit_hours = 8
makechrootpkg_args = ['-I', 'tmp/' + result.filename]


def pre_build():
    vcs_update()

    run_cmd(['wget', '-nc', url, url + '.sig'])
    run_cmd([
Пример #4
0
def get_syncdb():
    # Return syncdb, so handle should go out of scope
    handle = Handle('/', '/tmp/')
    repo = handle.register_syncdb(REPO_1, 0)
    repo.servers = [TEST_MIRROR.format(repo=REPO_1, arch=ARCH)]
    return handle.get_syncdbs()[0]