def __init__(self, section: str, configuration: Configuration) -> None: """ default constructor :param section: settings section name :param configuration: configuration instance """ self.link_path = configuration.get(section, "link_path") self.template_path = configuration.getpath(section, "template_path") # base template vars self.homepage = configuration.get(section, "homepage", fallback=None) self.name = configuration.get("repository", "name") self.sign_targets, self.default_pgp_key = GPG.sign_options( configuration)
def __init__(self, architecture: str, configuration: Configuration) -> None: self.logger = logging.getLogger("builder") self.architecture = architecture self.configuration = configuration self.aur_url = configuration.get("alpm", "aur_url") self.name = configuration.get("repository", "name") self.paths = RepositoryPaths( configuration.getpath("repository", "root"), architecture) self.paths.create_tree() self.ignore_list = configuration.getlist("build", "ignore_packages") self.pacman = Pacman(configuration) self.sign = GPG(architecture, configuration) self.repo = Repo(self.name, self.paths, self.sign.repository_sign_args) self.reporter = Client.load(configuration)
def __init__(self, architecture: str, configuration: Configuration) -> None: """ default constructor :param architecture: repository architecture :param configuration: configuration instance """ Upload.__init__(self, architecture, configuration) self.command = configuration.getlist("rsync", "command") self.remote = configuration.get("rsync", "remote")
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 test_merge_sections_missing(configuration: Configuration) -> None: """ must merge create section if not exists """ section = configuration.section_name("build", "x86_64") configuration.remove_section("build") configuration.add_section(section) configuration.set(section, "key", "value") configuration.merge_sections("x86_64") assert configuration.get("build", "key") == "value"
def load(cls: Type[Client], configuration: Configuration) -> Client: """ load client from settings :param configuration: configuration instance :return: client according to current settings """ host = configuration.get("web", "host", fallback=None) port = configuration.getint("web", "port", fallback=None) if host is not None and port is not None: from ahriman.core.status.web_client import WebClient return WebClient(host, port) return cls()
def __init__(self, architecture: str, configuration: Configuration) -> None: """ default constructor :param architecture: repository architecture :param configuration: configuration instance """ Report.__init__(self, architecture, configuration) JinjaTemplate.__init__(self, "email", configuration) # base smtp settings self.host = configuration.get("email", "host") self.no_empty_report = configuration.getboolean("email", "no_empty_report", fallback=True) self.password = configuration.get("email", "password", fallback=None) self.port = configuration.getint("email", "port") self.receivers = configuration.getlist("email", "receivers") self.sender = configuration.get("email", "sender") self.ssl = SmtpSSLSettings.from_option( configuration.get("email", "ssl", fallback="disabled")) self.user = configuration.get("email", "user", fallback=None)
def sign_options( configuration: Configuration ) -> Tuple[Set[SignSettings], Optional[str]]: """ extract default sign options from configuration :param configuration: configuration instance :return: tuple of sign targets and default PGP key """ targets = { SignSettings.from_option(option) for option in configuration.getlist("sign", "target") } default_key = configuration.get("sign", "key") if targets else None return targets, default_key
def __init__(self, args: argparse.Namespace, architecture: str, configuration: Configuration) -> None: """ default constructor :param args: command line args :param architecture: repository architecture :param configuration: configuration instance """ self.path = Path( f"{args.lock}_{architecture}") if args.lock is not None else None self.force = args.force self.unsafe = args.unsafe self.root = Path(configuration.get("repository", "root")) self.reporter = Client() if args.no_report else Client.load( configuration)
def __init__(self, package: Package, configuration: Configuration, paths: RepositoryPaths) -> None: """ default constructor :param package: package definitions :param configuration: configuration instance :param paths: repository paths instance """ self.logger = logging.getLogger("builder") self.build_logger = logging.getLogger("build_details") self.package = package self.paths = paths self.archbuild_flags = configuration.getlist("build", "archbuild_flags") self.build_command = configuration.get("build", "build_command") self.makepkg_flags = configuration.getlist("build", "makepkg_flags") self.makechrootpkg_flags = configuration.getlist("build", "makechrootpkg_flags")
def repo(configuration: Configuration, repository_paths: RepositoryPaths) -> Repo: return Repo(configuration.get("repository", "name"), repository_paths, [])