def test_update(application: Application, package_ahriman: Package, mocker: MockerFixture) -> None: """ must process package updates """ paths = [package.filepath for package in package_ahriman.packages.values()] tree = Tree([Leaf(package_ahriman, set())]) mocker.patch("ahriman.core.tree.Tree.load", return_value=tree) mocker.patch( "ahriman.core.repository.repository.Repository.packages_built", return_value=[]) mocker.patch("ahriman.models.package.Package.load", return_value=package_ahriman) build_mock = mocker.patch( "ahriman.core.repository.executor.Executor.process_build", return_value=paths) update_mock = mocker.patch( "ahriman.core.repository.executor.Executor.process_update") finalize_mock = mocker.patch( "ahriman.application.application.Application._finalize") application.update([package_ahriman]) build_mock.assert_called_once() update_mock.assert_has_calls([mock.call([]), mock.call(paths)]) finalize_mock.assert_has_calls( [mock.call([]), mock.call([package_ahriman])])
def run(cls: Type[Handler], args: argparse.Namespace, architecture: str, configuration: Configuration) -> None: """ callback for command line :param args: command line args :param architecture: repository architecture :param configuration: configuration instance """ application = Application(architecture, configuration) packages = application.get_updates( args.package, args.no_aur, args.no_manual, args.no_vcs, Update.log_fn(application, args.dry_run)) if args.dry_run: return application.update(packages)
def run(cls: Type[Handler], args: argparse.Namespace, architecture: str, configuration: Configuration) -> None: """ callback for command line :param args: command line args :param architecture: repository architecture :param configuration: configuration instance """ application = Application(architecture, configuration) application.add(args.package, args.without_dependencies) if not args.now: return packages = application.get_updates(args.package, True, False, True, application.logger.info) application.update(packages)
def run(cls: Type[Handler], args: argparse.Namespace, architecture: str, configuration: Configuration) -> None: """ callback for command line :param args: command line args :param architecture: repository architecture :param configuration: configuration instance """ depends_on = set(args.depends_on) if args.depends_on else None application = Application(architecture, configuration) packages = [ package for package in application.repository.packages() if depends_on is None or depends_on.intersection(package.depends) ] # we have to use explicit list here for testing purpose application.update(packages)
def run(cls: Type[Handler], args: argparse.Namespace, architecture: str, configuration: Configuration) -> None: """ callback for command line :param args: command line args :param architecture: repository architecture :param configuration: configuration instance """ client = Application(architecture, configuration).repository.reporter callback: Callable[[str], None] = lambda p: client.remove( p) if args.remove else client.update(p, args.status) if args.package: # update packages statuses for package in args.package: callback(package) else: # update service status client.update_self(args.status)