mirror of
https://github.com/arcan1s/ahriman.git
synced 2025-04-24 23:37:18 +00:00
remove unsafe flag from handlers
This flag became reduntant there and tree creation has been moved to lock
This commit is contained in:
parent
721b447767
commit
b7852f55c8
@ -39,12 +39,12 @@ class Application(ApplicationPackages, ApplicationRepository):
|
|||||||
>>> from ahriman.models.package_source import PackageSource
|
>>> from ahriman.models.package_source import PackageSource
|
||||||
>>>
|
>>>
|
||||||
>>> configuration = Configuration()
|
>>> configuration = Configuration()
|
||||||
>>> application = Application("x86_64", configuration, report=True, unsafe=False)
|
>>> application = Application("x86_64", configuration, report=True)
|
||||||
>>> # add packages to build queue
|
>>> # add packages to build queue
|
||||||
>>> application.add(["ahriman"], PackageSource.AUR)
|
>>> application.add(["ahriman"], PackageSource.AUR)
|
||||||
>>>
|
>>>
|
||||||
>>> # check for updates
|
>>> # check for updates
|
||||||
>>> updates = application.updates([], aur=True, local=True, manual=True, vcs=True, log_fn=print)
|
>>> updates = application.updates([], aur=True, local=True, manual=True, vcs=True)
|
||||||
>>> # updates for specified packages
|
>>> # updates for specified packages
|
||||||
>>> application.update(updates)
|
>>> application.update(updates)
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ class ApplicationProperties(LazyLogging):
|
|||||||
repository(Repository): repository instance
|
repository(Repository): repository instance
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, architecture: str, configuration: Configuration, *, report: bool, unsafe: bool,
|
def __init__(self, architecture: str, configuration: Configuration, *, report: bool,
|
||||||
refresh_pacman_database: PacmanSynchronization = PacmanSynchronization.Disabled) -> None:
|
refresh_pacman_database: PacmanSynchronization = PacmanSynchronization.Disabled) -> None:
|
||||||
"""
|
"""
|
||||||
default constructor
|
default constructor
|
||||||
@ -44,12 +44,11 @@ class ApplicationProperties(LazyLogging):
|
|||||||
architecture(str): repository architecture
|
architecture(str): repository architecture
|
||||||
configuration(Configuration): configuration instance
|
configuration(Configuration): configuration instance
|
||||||
report(bool): force enable or disable reporting
|
report(bool): force enable or disable reporting
|
||||||
unsafe(bool): if set no user check will be performed before path creation
|
|
||||||
refresh_pacman_database(PacmanSynchronization, optional): pacman database synchronization level
|
refresh_pacman_database(PacmanSynchronization, optional): pacman database synchronization level
|
||||||
(Default value = PacmanSynchronization.Disabled)
|
(Default value = PacmanSynchronization.Disabled)
|
||||||
"""
|
"""
|
||||||
self.configuration = configuration
|
self.configuration = configuration
|
||||||
self.architecture = architecture
|
self.architecture = architecture
|
||||||
self.database = SQLite.load(configuration)
|
self.database = SQLite.load(configuration)
|
||||||
self.repository = Repository.load(architecture, configuration, self.database, report=report, unsafe=unsafe,
|
self.repository = Repository.load(architecture, configuration, self.database, report=report,
|
||||||
refresh_pacman_database=refresh_pacman_database)
|
refresh_pacman_database=refresh_pacman_database)
|
||||||
|
@ -31,8 +31,7 @@ class Add(Handler):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def run(cls, args: argparse.Namespace, architecture: str, configuration: Configuration, *,
|
def run(cls, args: argparse.Namespace, architecture: str, configuration: Configuration, *, report: bool) -> None:
|
||||||
report: bool, unsafe: bool) -> None:
|
|
||||||
"""
|
"""
|
||||||
callback for command line
|
callback for command line
|
||||||
|
|
||||||
@ -41,10 +40,8 @@ class Add(Handler):
|
|||||||
architecture(str): repository architecture
|
architecture(str): repository architecture
|
||||||
configuration(Configuration): configuration instance
|
configuration(Configuration): configuration instance
|
||||||
report(bool): force enable or disable reporting
|
report(bool): force enable or disable reporting
|
||||||
unsafe(bool): if set no user check will be performed before path creation
|
|
||||||
"""
|
"""
|
||||||
application = Application(architecture, configuration,
|
application = Application(architecture, configuration, report=report, refresh_pacman_database=args.refresh)
|
||||||
report=report, unsafe=unsafe, refresh_pacman_database=args.refresh)
|
|
||||||
application.on_start()
|
application.on_start()
|
||||||
application.add(args.package, args.source, args.username)
|
application.add(args.package, args.source, args.username)
|
||||||
if not args.now:
|
if not args.now:
|
||||||
|
@ -36,8 +36,7 @@ class Backup(Handler):
|
|||||||
ALLOW_AUTO_ARCHITECTURE_RUN = False # it should be called only as "no-architecture"
|
ALLOW_AUTO_ARCHITECTURE_RUN = False # it should be called only as "no-architecture"
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def run(cls, args: argparse.Namespace, architecture: str, configuration: Configuration, *,
|
def run(cls, args: argparse.Namespace, architecture: str, configuration: Configuration, *, report: bool) -> None:
|
||||||
report: bool, unsafe: bool) -> None:
|
|
||||||
"""
|
"""
|
||||||
callback for command line
|
callback for command line
|
||||||
|
|
||||||
@ -46,7 +45,6 @@ class Backup(Handler):
|
|||||||
architecture(str): repository architecture
|
architecture(str): repository architecture
|
||||||
configuration(Configuration): configuration instance
|
configuration(Configuration): configuration instance
|
||||||
report(bool): force enable or disable reporting
|
report(bool): force enable or disable reporting
|
||||||
unsafe(bool): if set no user check will be performed before path creation
|
|
||||||
"""
|
"""
|
||||||
backup_paths = Backup.get_paths(configuration)
|
backup_paths = Backup.get_paths(configuration)
|
||||||
with TarFile(args.path, mode="w") as archive: # well we don't actually use compression
|
with TarFile(args.path, mode="w") as archive: # well we don't actually use compression
|
||||||
|
@ -30,8 +30,7 @@ class Clean(Handler):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def run(cls, args: argparse.Namespace, architecture: str, configuration: Configuration, *,
|
def run(cls, args: argparse.Namespace, architecture: str, configuration: Configuration, *, report: bool) -> None:
|
||||||
report: bool, unsafe: bool) -> None:
|
|
||||||
"""
|
"""
|
||||||
callback for command line
|
callback for command line
|
||||||
|
|
||||||
@ -40,9 +39,8 @@ class Clean(Handler):
|
|||||||
architecture(str): repository architecture
|
architecture(str): repository architecture
|
||||||
configuration(Configuration): configuration instance
|
configuration(Configuration): configuration instance
|
||||||
report(bool): force enable or disable reporting
|
report(bool): force enable or disable reporting
|
||||||
unsafe(bool): if set no user check will be performed before path creation
|
|
||||||
"""
|
"""
|
||||||
application = Application(architecture, configuration, report=report, unsafe=unsafe)
|
application = Application(architecture, configuration, report=report)
|
||||||
application.on_start()
|
application.on_start()
|
||||||
application.clean(cache=args.cache, chroot=args.chroot, manual=args.manual, packages=args.packages,
|
application.clean(cache=args.cache, chroot=args.chroot, manual=args.manual, packages=args.packages,
|
||||||
pacman=args.pacman)
|
pacman=args.pacman)
|
||||||
|
@ -30,8 +30,7 @@ class Daemon(Handler):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def run(cls, args: argparse.Namespace, architecture: str, configuration: Configuration, *,
|
def run(cls, args: argparse.Namespace, architecture: str, configuration: Configuration, *, report: bool) -> None:
|
||||||
report: bool, unsafe: bool) -> None:
|
|
||||||
"""
|
"""
|
||||||
callback for command line
|
callback for command line
|
||||||
|
|
||||||
@ -40,11 +39,10 @@ class Daemon(Handler):
|
|||||||
architecture(str): repository architecture
|
architecture(str): repository architecture
|
||||||
configuration(Configuration): configuration instance
|
configuration(Configuration): configuration instance
|
||||||
report(bool): force enable or disable reporting
|
report(bool): force enable or disable reporting
|
||||||
unsafe(bool): if set no user check will be performed before path creation
|
|
||||||
"""
|
"""
|
||||||
from ahriman.application.handlers import Update
|
from ahriman.application.handlers import Update
|
||||||
Update.run(args, architecture, configuration, report=report, unsafe=unsafe)
|
Update.run(args, architecture, configuration, report=report)
|
||||||
timer = threading.Timer(args.interval, Daemon.run, args=[args, architecture, configuration],
|
timer = threading.Timer(args.interval, Daemon.run, args=[args, architecture, configuration],
|
||||||
kwargs={"report": report, "unsafe": unsafe})
|
kwargs={"report": report})
|
||||||
timer.start()
|
timer.start()
|
||||||
timer.join()
|
timer.join()
|
||||||
|
@ -32,8 +32,7 @@ class Dump(Handler):
|
|||||||
ALLOW_AUTO_ARCHITECTURE_RUN = False
|
ALLOW_AUTO_ARCHITECTURE_RUN = False
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def run(cls, args: argparse.Namespace, architecture: str, configuration: Configuration, *,
|
def run(cls, args: argparse.Namespace, architecture: str, configuration: Configuration, *, report: bool) -> None:
|
||||||
report: bool, unsafe: bool) -> None:
|
|
||||||
"""
|
"""
|
||||||
callback for command line
|
callback for command line
|
||||||
|
|
||||||
@ -42,7 +41,6 @@ class Dump(Handler):
|
|||||||
architecture(str): repository architecture
|
architecture(str): repository architecture
|
||||||
configuration(Configuration): configuration instance
|
configuration(Configuration): configuration instance
|
||||||
report(bool): force enable or disable reporting
|
report(bool): force enable or disable reporting
|
||||||
unsafe(bool): if set no user check will be performed before path creation
|
|
||||||
"""
|
"""
|
||||||
root, _ = configuration.check_loaded()
|
root, _ = configuration.check_loaded()
|
||||||
ConfigurationPathsPrinter(root, configuration.includes).print(verbose=True, separator=" = ")
|
ConfigurationPathsPrinter(root, configuration.includes).print(verbose=True, separator=" = ")
|
||||||
|
@ -97,7 +97,7 @@ class Handler:
|
|||||||
log_handler = Log.handler(args.log_handler)
|
log_handler = Log.handler(args.log_handler)
|
||||||
Log.load(configuration, log_handler, quiet=args.quiet, report=args.report)
|
Log.load(configuration, log_handler, quiet=args.quiet, report=args.report)
|
||||||
with Lock(args, architecture, configuration):
|
with Lock(args, architecture, configuration):
|
||||||
cls.run(args, architecture, configuration, report=args.report, unsafe=args.unsafe)
|
cls.run(args, architecture, configuration, report=args.report)
|
||||||
return True
|
return True
|
||||||
except ExitCode:
|
except ExitCode:
|
||||||
return False
|
return False
|
||||||
@ -136,8 +136,7 @@ class Handler:
|
|||||||
return 0 if all(result) else 1
|
return 0 if all(result) else 1
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def run(cls, args: argparse.Namespace, architecture: str, configuration: Configuration, *,
|
def run(cls, args: argparse.Namespace, architecture: str, configuration: Configuration, *, report: bool) -> None:
|
||||||
report: bool, unsafe: bool) -> None:
|
|
||||||
"""
|
"""
|
||||||
callback for command line
|
callback for command line
|
||||||
|
|
||||||
@ -146,7 +145,6 @@ class Handler:
|
|||||||
architecture(str): repository architecture
|
architecture(str): repository architecture
|
||||||
configuration(Configuration): configuration instance
|
configuration(Configuration): configuration instance
|
||||||
report(bool): force enable or disable reporting
|
report(bool): force enable or disable reporting
|
||||||
unsafe(bool): if set no user check will be performed before path creation
|
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
NotImplementedError: not implemented method
|
NotImplementedError: not implemented method
|
||||||
|
@ -31,8 +31,7 @@ class Help(Handler):
|
|||||||
ALLOW_AUTO_ARCHITECTURE_RUN = False # it should be called only as "no-architecture"
|
ALLOW_AUTO_ARCHITECTURE_RUN = False # it should be called only as "no-architecture"
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def run(cls, args: argparse.Namespace, architecture: str, configuration: Configuration, *,
|
def run(cls, args: argparse.Namespace, architecture: str, configuration: Configuration, *, report: bool) -> None:
|
||||||
report: bool, unsafe: bool) -> None:
|
|
||||||
"""
|
"""
|
||||||
callback for command line
|
callback for command line
|
||||||
|
|
||||||
@ -41,7 +40,6 @@ class Help(Handler):
|
|||||||
architecture(str): repository architecture
|
architecture(str): repository architecture
|
||||||
configuration(Configuration): configuration instance
|
configuration(Configuration): configuration instance
|
||||||
report(bool): force enable or disable reporting
|
report(bool): force enable or disable reporting
|
||||||
unsafe(bool): if set no user check will be performed before path creation
|
|
||||||
"""
|
"""
|
||||||
parser: argparse.ArgumentParser = args.parser()
|
parser: argparse.ArgumentParser = args.parser()
|
||||||
if args.command is None:
|
if args.command is None:
|
||||||
|
@ -32,8 +32,7 @@ class KeyImport(Handler):
|
|||||||
ALLOW_AUTO_ARCHITECTURE_RUN = False # it should be called only as "no-architecture"
|
ALLOW_AUTO_ARCHITECTURE_RUN = False # it should be called only as "no-architecture"
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def run(cls, args: argparse.Namespace, architecture: str, configuration: Configuration, *,
|
def run(cls, args: argparse.Namespace, architecture: str, configuration: Configuration, *, report: bool) -> None:
|
||||||
report: bool, unsafe: bool) -> None:
|
|
||||||
"""
|
"""
|
||||||
callback for command line
|
callback for command line
|
||||||
|
|
||||||
@ -42,7 +41,6 @@ class KeyImport(Handler):
|
|||||||
architecture(str): repository architecture
|
architecture(str): repository architecture
|
||||||
configuration(Configuration): configuration instance
|
configuration(Configuration): configuration instance
|
||||||
report(bool): force enable or disable reporting
|
report(bool): force enable or disable reporting
|
||||||
unsafe(bool): if set no user check will be performed before path creation
|
|
||||||
"""
|
"""
|
||||||
application = Application(architecture, configuration, report=report, unsafe=unsafe)
|
application = Application(architecture, configuration, report=report)
|
||||||
application.repository.sign.key_import(args.key_server, args.key)
|
application.repository.sign.key_import(args.key_server, args.key)
|
||||||
|
@ -38,8 +38,7 @@ class Patch(Handler):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def run(cls, args: argparse.Namespace, architecture: str, configuration: Configuration, *,
|
def run(cls, args: argparse.Namespace, architecture: str, configuration: Configuration, *, report: bool) -> None:
|
||||||
report: bool, unsafe: bool) -> None:
|
|
||||||
"""
|
"""
|
||||||
callback for command line
|
callback for command line
|
||||||
|
|
||||||
@ -48,9 +47,8 @@ class Patch(Handler):
|
|||||||
architecture(str): repository architecture
|
architecture(str): repository architecture
|
||||||
configuration(Configuration): configuration instance
|
configuration(Configuration): configuration instance
|
||||||
report(bool): force enable or disable reporting
|
report(bool): force enable or disable reporting
|
||||||
unsafe(bool): if set no user check will be performed before path creation
|
|
||||||
"""
|
"""
|
||||||
application = Application(architecture, configuration, report=report, unsafe=unsafe)
|
application = Application(architecture, configuration, report=report)
|
||||||
application.on_start()
|
application.on_start()
|
||||||
|
|
||||||
if args.action == Action.Update and args.variable is not None:
|
if args.action == Action.Update and args.variable is not None:
|
||||||
|
@ -32,8 +32,7 @@ class Rebuild(Handler):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def run(cls, args: argparse.Namespace, architecture: str, configuration: Configuration, *,
|
def run(cls, args: argparse.Namespace, architecture: str, configuration: Configuration, *, report: bool) -> None:
|
||||||
report: bool, unsafe: bool) -> None:
|
|
||||||
"""
|
"""
|
||||||
callback for command line
|
callback for command line
|
||||||
|
|
||||||
@ -42,9 +41,8 @@ class Rebuild(Handler):
|
|||||||
architecture(str): repository architecture
|
architecture(str): repository architecture
|
||||||
configuration(Configuration): configuration instance
|
configuration(Configuration): configuration instance
|
||||||
report(bool): force enable or disable reporting
|
report(bool): force enable or disable reporting
|
||||||
unsafe(bool): if set no user check will be performed before path creation
|
|
||||||
"""
|
"""
|
||||||
application = Application(architecture, configuration, report=report, unsafe=unsafe)
|
application = Application(architecture, configuration, report=report)
|
||||||
application.on_start()
|
application.on_start()
|
||||||
|
|
||||||
packages = Rebuild.extract_packages(application, args.status, from_database=args.from_database)
|
packages = Rebuild.extract_packages(application, args.status, from_database=args.from_database)
|
||||||
|
@ -30,8 +30,7 @@ class Remove(Handler):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def run(cls, args: argparse.Namespace, architecture: str, configuration: Configuration, *,
|
def run(cls, args: argparse.Namespace, architecture: str, configuration: Configuration, *, report: bool) -> None:
|
||||||
report: bool, unsafe: bool) -> None:
|
|
||||||
"""
|
"""
|
||||||
callback for command line
|
callback for command line
|
||||||
|
|
||||||
@ -40,8 +39,7 @@ class Remove(Handler):
|
|||||||
architecture(str): repository architecture
|
architecture(str): repository architecture
|
||||||
configuration(Configuration): configuration instance
|
configuration(Configuration): configuration instance
|
||||||
report(bool): force enable or disable reporting
|
report(bool): force enable or disable reporting
|
||||||
unsafe(bool): if set no user check will be performed before path creation
|
|
||||||
"""
|
"""
|
||||||
application = Application(architecture, configuration, report=report, unsafe=unsafe)
|
application = Application(architecture, configuration, report=report)
|
||||||
application.on_start()
|
application.on_start()
|
||||||
application.remove(args.package)
|
application.remove(args.package)
|
||||||
|
@ -31,8 +31,7 @@ class RemoveUnknown(Handler):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def run(cls, args: argparse.Namespace, architecture: str, configuration: Configuration, *,
|
def run(cls, args: argparse.Namespace, architecture: str, configuration: Configuration, *, report: bool) -> None:
|
||||||
report: bool, unsafe: bool) -> None:
|
|
||||||
"""
|
"""
|
||||||
callback for command line
|
callback for command line
|
||||||
|
|
||||||
@ -41,9 +40,8 @@ class RemoveUnknown(Handler):
|
|||||||
architecture(str): repository architecture
|
architecture(str): repository architecture
|
||||||
configuration(Configuration): configuration instance
|
configuration(Configuration): configuration instance
|
||||||
report(bool): force enable or disable reporting
|
report(bool): force enable or disable reporting
|
||||||
unsafe(bool): if set no user check will be performed before path creation
|
|
||||||
"""
|
"""
|
||||||
application = Application(architecture, configuration, report=report, unsafe=unsafe)
|
application = Application(architecture, configuration, report=report)
|
||||||
application.on_start()
|
application.on_start()
|
||||||
unknown_packages = application.unknown()
|
unknown_packages = application.unknown()
|
||||||
|
|
||||||
|
@ -33,8 +33,7 @@ class Restore(Handler):
|
|||||||
ALLOW_AUTO_ARCHITECTURE_RUN = False # it should be called only as "no-architecture"
|
ALLOW_AUTO_ARCHITECTURE_RUN = False # it should be called only as "no-architecture"
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def run(cls, args: argparse.Namespace, architecture: str, configuration: Configuration, *,
|
def run(cls, args: argparse.Namespace, architecture: str, configuration: Configuration, *, report: bool) -> None:
|
||||||
report: bool, unsafe: bool) -> None:
|
|
||||||
"""
|
"""
|
||||||
callback for command line
|
callback for command line
|
||||||
|
|
||||||
@ -43,7 +42,6 @@ class Restore(Handler):
|
|||||||
architecture(str): repository architecture
|
architecture(str): repository architecture
|
||||||
configuration(Configuration): configuration instance
|
configuration(Configuration): configuration instance
|
||||||
report(bool): force enable or disable reporting
|
report(bool): force enable or disable reporting
|
||||||
unsafe(bool): if set no user check will be performed before path creation
|
|
||||||
"""
|
"""
|
||||||
with TarFile(args.path) as archive:
|
with TarFile(args.path) as archive:
|
||||||
archive.extractall(path=args.output)
|
archive.extractall(path=args.output)
|
||||||
|
@ -47,8 +47,7 @@ class Search(Handler):
|
|||||||
}
|
}
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def run(cls, args: argparse.Namespace, architecture: str, configuration: Configuration, *,
|
def run(cls, args: argparse.Namespace, architecture: str, configuration: Configuration, *, report: bool) -> None:
|
||||||
report: bool, unsafe: bool) -> None:
|
|
||||||
"""
|
"""
|
||||||
callback for command line
|
callback for command line
|
||||||
|
|
||||||
@ -57,9 +56,8 @@ class Search(Handler):
|
|||||||
architecture(str): repository architecture
|
architecture(str): repository architecture
|
||||||
configuration(Configuration): configuration instance
|
configuration(Configuration): configuration instance
|
||||||
report(bool): force enable or disable reporting
|
report(bool): force enable or disable reporting
|
||||||
unsafe(bool): if set no user check will be performed before path creation
|
|
||||||
"""
|
"""
|
||||||
application = Application(architecture, configuration, report=report, unsafe=unsafe)
|
application = Application(architecture, configuration, report=report)
|
||||||
|
|
||||||
official_packages_list = Official.multisearch(*args.search, pacman=application.repository.pacman)
|
official_packages_list = Official.multisearch(*args.search, pacman=application.repository.pacman)
|
||||||
aur_packages_list = AUR.multisearch(*args.search, pacman=application.repository.pacman)
|
aur_packages_list = AUR.multisearch(*args.search, pacman=application.repository.pacman)
|
||||||
|
@ -35,8 +35,7 @@ class ServiceUpdates(Handler):
|
|||||||
ALLOW_AUTO_ARCHITECTURE_RUN = False # it should be called only as "no-architecture"
|
ALLOW_AUTO_ARCHITECTURE_RUN = False # it should be called only as "no-architecture"
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def run(cls, args: argparse.Namespace, architecture: str, configuration: Configuration, *,
|
def run(cls, args: argparse.Namespace, architecture: str, configuration: Configuration, *, report: bool) -> None:
|
||||||
report: bool, unsafe: bool) -> None:
|
|
||||||
"""
|
"""
|
||||||
callback for command line
|
callback for command line
|
||||||
|
|
||||||
@ -45,9 +44,8 @@ class ServiceUpdates(Handler):
|
|||||||
architecture(str): repository architecture
|
architecture(str): repository architecture
|
||||||
configuration(Configuration): configuration instance
|
configuration(Configuration): configuration instance
|
||||||
report(bool): force enable or disable reporting
|
report(bool): force enable or disable reporting
|
||||||
unsafe(bool): if set no user check will be performed before path creation
|
|
||||||
"""
|
"""
|
||||||
application = Application(architecture, configuration, report=report, unsafe=unsafe)
|
application = Application(architecture, configuration, report=report)
|
||||||
|
|
||||||
remote = Package.from_aur("ahriman", application.repository.pacman, None)
|
remote = Package.from_aur("ahriman", application.repository.pacman, None)
|
||||||
release = remote.version.rsplit("-", 1)[-1] # we don't store pkgrel locally, so we just append it
|
release = remote.version.rsplit("-", 1)[-1] # we don't store pkgrel locally, so we just append it
|
||||||
|
@ -46,8 +46,7 @@ class Setup(Handler):
|
|||||||
SUDOERS_DIR_PATH = Path("/etc") / "sudoers.d"
|
SUDOERS_DIR_PATH = Path("/etc") / "sudoers.d"
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def run(cls, args: argparse.Namespace, architecture: str, configuration: Configuration, *,
|
def run(cls, args: argparse.Namespace, architecture: str, configuration: Configuration, *, report: bool) -> None:
|
||||||
report: bool, unsafe: bool) -> None:
|
|
||||||
"""
|
"""
|
||||||
callback for command line
|
callback for command line
|
||||||
|
|
||||||
@ -56,12 +55,11 @@ class Setup(Handler):
|
|||||||
architecture(str): repository architecture
|
architecture(str): repository architecture
|
||||||
configuration(Configuration): configuration instance
|
configuration(Configuration): configuration instance
|
||||||
report(bool): force enable or disable reporting
|
report(bool): force enable or disable reporting
|
||||||
unsafe(bool): if set no user check will be performed before path creation
|
|
||||||
"""
|
"""
|
||||||
Setup.configuration_create_ahriman(args, architecture, args.repository, configuration)
|
Setup.configuration_create_ahriman(args, architecture, args.repository, configuration)
|
||||||
configuration.reload()
|
configuration.reload()
|
||||||
|
|
||||||
application = Application(architecture, configuration, report=report, unsafe=unsafe)
|
application = Application(architecture, configuration, report=report)
|
||||||
|
|
||||||
Setup.configuration_create_makepkg(args.packager, args.makeflags_jobs, application.repository.paths)
|
Setup.configuration_create_makepkg(args.packager, args.makeflags_jobs, application.repository.paths)
|
||||||
Setup.executable_create(application.repository.paths, args.build_command, architecture)
|
Setup.executable_create(application.repository.paths, args.build_command, architecture)
|
||||||
|
@ -37,8 +37,7 @@ class Shell(Handler):
|
|||||||
ALLOW_MULTI_ARCHITECTURE_RUN = False
|
ALLOW_MULTI_ARCHITECTURE_RUN = False
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def run(cls, args: argparse.Namespace, architecture: str, configuration: Configuration, *,
|
def run(cls, args: argparse.Namespace, architecture: str, configuration: Configuration, *, report: bool) -> None:
|
||||||
report: bool, unsafe: bool) -> None:
|
|
||||||
"""
|
"""
|
||||||
callback for command line
|
callback for command line
|
||||||
|
|
||||||
@ -47,10 +46,9 @@ class Shell(Handler):
|
|||||||
architecture(str): repository architecture
|
architecture(str): repository architecture
|
||||||
configuration(Configuration): configuration instance
|
configuration(Configuration): configuration instance
|
||||||
report(bool): force enable or disable reporting
|
report(bool): force enable or disable reporting
|
||||||
unsafe(bool): if set no user check will be performed before path creation
|
|
||||||
"""
|
"""
|
||||||
# pylint: disable=possibly-unused-variable
|
# pylint: disable=possibly-unused-variable
|
||||||
application = Application(architecture, configuration, report=report, unsafe=unsafe)
|
application = Application(architecture, configuration, report=report)
|
||||||
if args.verbose:
|
if args.verbose:
|
||||||
# licensed by https://creativecommons.org/licenses/by-sa/3.0
|
# licensed by https://creativecommons.org/licenses/by-sa/3.0
|
||||||
path = Path(sys.prefix) / "share" / "ahriman" / "templates" / "shell"
|
path = Path(sys.prefix) / "share" / "ahriman" / "templates" / "shell"
|
||||||
|
@ -30,8 +30,7 @@ class Sign(Handler):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def run(cls, args: argparse.Namespace, architecture: str, configuration: Configuration, *,
|
def run(cls, args: argparse.Namespace, architecture: str, configuration: Configuration, *, report: bool) -> None:
|
||||||
report: bool, unsafe: bool) -> None:
|
|
||||||
"""
|
"""
|
||||||
callback for command line
|
callback for command line
|
||||||
|
|
||||||
@ -40,6 +39,5 @@ class Sign(Handler):
|
|||||||
architecture(str): repository architecture
|
architecture(str): repository architecture
|
||||||
configuration(Configuration): configuration instance
|
configuration(Configuration): configuration instance
|
||||||
report(bool): force enable or disable reporting
|
report(bool): force enable or disable reporting
|
||||||
unsafe(bool): if set no user check will be performed before path creation
|
|
||||||
"""
|
"""
|
||||||
Application(architecture, configuration, report=report, unsafe=unsafe).sign(args.package)
|
Application(architecture, configuration, report=report).sign(args.package)
|
||||||
|
@ -37,8 +37,7 @@ class Status(Handler):
|
|||||||
ALLOW_AUTO_ARCHITECTURE_RUN = False
|
ALLOW_AUTO_ARCHITECTURE_RUN = False
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def run(cls, args: argparse.Namespace, architecture: str, configuration: Configuration, *,
|
def run(cls, args: argparse.Namespace, architecture: str, configuration: Configuration, *, report: bool) -> None:
|
||||||
report: bool, unsafe: bool) -> None:
|
|
||||||
"""
|
"""
|
||||||
callback for command line
|
callback for command line
|
||||||
|
|
||||||
@ -47,10 +46,9 @@ class Status(Handler):
|
|||||||
architecture(str): repository architecture
|
architecture(str): repository architecture
|
||||||
configuration(Configuration): configuration instance
|
configuration(Configuration): configuration instance
|
||||||
report(bool): force enable or disable reporting
|
report(bool): force enable or disable reporting
|
||||||
unsafe(bool): if set no user check will be performed before path creation
|
|
||||||
"""
|
"""
|
||||||
# we are using reporter here
|
# we are using reporter here
|
||||||
client = Application(architecture, configuration, report=True, unsafe=unsafe).repository.reporter
|
client = Application(architecture, configuration, report=True).repository.reporter
|
||||||
if args.ahriman:
|
if args.ahriman:
|
||||||
service_status = client.get_internal()
|
service_status = client.get_internal()
|
||||||
StatusPrinter(service_status.status).print(verbose=args.info)
|
StatusPrinter(service_status.status).print(verbose=args.info)
|
||||||
|
@ -33,8 +33,7 @@ class StatusUpdate(Handler):
|
|||||||
ALLOW_AUTO_ARCHITECTURE_RUN = False
|
ALLOW_AUTO_ARCHITECTURE_RUN = False
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def run(cls, args: argparse.Namespace, architecture: str, configuration: Configuration, *,
|
def run(cls, args: argparse.Namespace, architecture: str, configuration: Configuration, *, report: bool) -> None:
|
||||||
report: bool, unsafe: bool) -> None:
|
|
||||||
"""
|
"""
|
||||||
callback for command line
|
callback for command line
|
||||||
|
|
||||||
@ -43,10 +42,9 @@ class StatusUpdate(Handler):
|
|||||||
architecture(str): repository architecture
|
architecture(str): repository architecture
|
||||||
configuration(Configuration): configuration instance
|
configuration(Configuration): configuration instance
|
||||||
report(bool): force enable or disable reporting
|
report(bool): force enable or disable reporting
|
||||||
unsafe(bool): if set no user check will be performed before path creation
|
|
||||||
"""
|
"""
|
||||||
# we are using reporter here
|
# we are using reporter here
|
||||||
client = Application(architecture, configuration, report=True, unsafe=unsafe).repository.reporter
|
client = Application(architecture, configuration, report=True).repository.reporter
|
||||||
|
|
||||||
if args.action == Action.Update and args.package:
|
if args.action == Action.Update and args.package:
|
||||||
# update packages statuses
|
# update packages statuses
|
||||||
|
@ -34,8 +34,7 @@ class Structure(Handler):
|
|||||||
ALLOW_AUTO_ARCHITECTURE_RUN = False
|
ALLOW_AUTO_ARCHITECTURE_RUN = False
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def run(cls, args: argparse.Namespace, architecture: str, configuration: Configuration, *,
|
def run(cls, args: argparse.Namespace, architecture: str, configuration: Configuration, *, report: bool) -> None:
|
||||||
report: bool, unsafe: bool) -> None:
|
|
||||||
"""
|
"""
|
||||||
callback for command line
|
callback for command line
|
||||||
|
|
||||||
@ -44,9 +43,8 @@ class Structure(Handler):
|
|||||||
architecture(str): repository architecture
|
architecture(str): repository architecture
|
||||||
configuration(Configuration): configuration instance
|
configuration(Configuration): configuration instance
|
||||||
report(bool): force enable or disable reporting
|
report(bool): force enable or disable reporting
|
||||||
unsafe(bool): if set no user check will be performed before path creation
|
|
||||||
"""
|
"""
|
||||||
application = Application(architecture, configuration, report=report, unsafe=unsafe)
|
application = Application(architecture, configuration, report=report)
|
||||||
packages = application.repository.packages()
|
packages = application.repository.packages()
|
||||||
|
|
||||||
tree = Tree.resolve(packages)
|
tree = Tree.resolve(packages)
|
||||||
|
@ -31,8 +31,7 @@ class Triggers(Handler):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def run(cls, args: argparse.Namespace, architecture: str, configuration: Configuration, *,
|
def run(cls, args: argparse.Namespace, architecture: str, configuration: Configuration, *, report: bool) -> None:
|
||||||
report: bool, unsafe: bool) -> None:
|
|
||||||
"""
|
"""
|
||||||
callback for command line
|
callback for command line
|
||||||
|
|
||||||
@ -41,9 +40,8 @@ class Triggers(Handler):
|
|||||||
architecture(str): repository architecture
|
architecture(str): repository architecture
|
||||||
configuration(Configuration): configuration instance
|
configuration(Configuration): configuration instance
|
||||||
report(bool): force enable or disable reporting
|
report(bool): force enable or disable reporting
|
||||||
unsafe(bool): if set no user check will be performed before path creation
|
|
||||||
"""
|
"""
|
||||||
application = Application(architecture, configuration, report=report, unsafe=unsafe)
|
application = Application(architecture, configuration, report=report)
|
||||||
if args.trigger:
|
if args.trigger:
|
||||||
loader = application.repository.triggers
|
loader = application.repository.triggers
|
||||||
loader.triggers = [loader.load_trigger(trigger, architecture, configuration) for trigger in args.trigger]
|
loader.triggers = [loader.load_trigger(trigger, architecture, configuration) for trigger in args.trigger]
|
||||||
|
@ -32,8 +32,7 @@ class UnsafeCommands(Handler):
|
|||||||
ALLOW_AUTO_ARCHITECTURE_RUN = False # it should be called only as "no-architecture"
|
ALLOW_AUTO_ARCHITECTURE_RUN = False # it should be called only as "no-architecture"
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def run(cls, args: argparse.Namespace, architecture: str, configuration: Configuration, *,
|
def run(cls, args: argparse.Namespace, architecture: str, configuration: Configuration, *, report: bool) -> None:
|
||||||
report: bool, unsafe: bool) -> None:
|
|
||||||
"""
|
"""
|
||||||
callback for command line
|
callback for command line
|
||||||
|
|
||||||
@ -42,7 +41,6 @@ class UnsafeCommands(Handler):
|
|||||||
architecture(str): repository architecture
|
architecture(str): repository architecture
|
||||||
configuration(Configuration): configuration instance
|
configuration(Configuration): configuration instance
|
||||||
report(bool): force enable or disable reporting
|
report(bool): force enable or disable reporting
|
||||||
unsafe(bool): if set no user check will be performed before path creation
|
|
||||||
"""
|
"""
|
||||||
parser = args.parser()
|
parser = args.parser()
|
||||||
unsafe_commands = UnsafeCommands.get_unsafe_commands(parser)
|
unsafe_commands = UnsafeCommands.get_unsafe_commands(parser)
|
||||||
|
@ -33,8 +33,7 @@ class Update(Handler):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def run(cls, args: argparse.Namespace, architecture: str, configuration: Configuration, *,
|
def run(cls, args: argparse.Namespace, architecture: str, configuration: Configuration, *, report: bool) -> None:
|
||||||
report: bool, unsafe: bool) -> None:
|
|
||||||
"""
|
"""
|
||||||
callback for command line
|
callback for command line
|
||||||
|
|
||||||
@ -43,10 +42,8 @@ class Update(Handler):
|
|||||||
architecture(str): repository architecture
|
architecture(str): repository architecture
|
||||||
configuration(Configuration): configuration instance
|
configuration(Configuration): configuration instance
|
||||||
report(bool): force enable or disable reporting
|
report(bool): force enable or disable reporting
|
||||||
unsafe(bool): if set no user check will be performed before path creation
|
|
||||||
"""
|
"""
|
||||||
application = Application(architecture, configuration, report=report, unsafe=unsafe,
|
application = Application(architecture, configuration, report=report, refresh_pacman_database=args.refresh)
|
||||||
refresh_pacman_database=args.refresh)
|
|
||||||
application.on_start()
|
application.on_start()
|
||||||
packages = application.updates(args.package, aur=args.aur, local=args.local, manual=args.manual, vcs=args.vcs)
|
packages = application.updates(args.package, aur=args.aur, local=args.local, manual=args.manual, vcs=args.vcs)
|
||||||
Update.check_if_empty(args.exit_code, not packages)
|
Update.check_if_empty(args.exit_code, not packages)
|
||||||
|
@ -37,8 +37,7 @@ class Users(Handler):
|
|||||||
ALLOW_AUTO_ARCHITECTURE_RUN = False # it should be called only as "no-architecture"
|
ALLOW_AUTO_ARCHITECTURE_RUN = False # it should be called only as "no-architecture"
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def run(cls, args: argparse.Namespace, architecture: str, configuration: Configuration, *,
|
def run(cls, args: argparse.Namespace, architecture: str, configuration: Configuration, *, report: bool) -> None:
|
||||||
report: bool, unsafe: bool) -> None:
|
|
||||||
"""
|
"""
|
||||||
callback for command line
|
callback for command line
|
||||||
|
|
||||||
@ -47,7 +46,6 @@ class Users(Handler):
|
|||||||
architecture(str): repository architecture
|
architecture(str): repository architecture
|
||||||
configuration(Configuration): configuration instance
|
configuration(Configuration): configuration instance
|
||||||
report(bool): force enable or disable reporting
|
report(bool): force enable or disable reporting
|
||||||
unsafe(bool): if set no user check will be performed before path creation
|
|
||||||
"""
|
"""
|
||||||
database = SQLite.load(configuration)
|
database = SQLite.load(configuration)
|
||||||
|
|
||||||
|
@ -39,8 +39,7 @@ class Validate(Handler):
|
|||||||
ALLOW_AUTO_ARCHITECTURE_RUN = False
|
ALLOW_AUTO_ARCHITECTURE_RUN = False
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def run(cls, args: argparse.Namespace, architecture: str, configuration: Configuration, *,
|
def run(cls, args: argparse.Namespace, architecture: str, configuration: Configuration, *, report: bool) -> None:
|
||||||
report: bool, unsafe: bool) -> None:
|
|
||||||
"""
|
"""
|
||||||
callback for command line
|
callback for command line
|
||||||
|
|
||||||
@ -49,7 +48,6 @@ class Validate(Handler):
|
|||||||
architecture(str): repository architecture
|
architecture(str): repository architecture
|
||||||
configuration(Configuration): configuration instance
|
configuration(Configuration): configuration instance
|
||||||
report(bool): force enable or disable reporting
|
report(bool): force enable or disable reporting
|
||||||
unsafe(bool): if set no user check will be performed before path creation
|
|
||||||
"""
|
"""
|
||||||
schema = Validate.schema(architecture, configuration)
|
schema = Validate.schema(architecture, configuration)
|
||||||
validator = Validator(configuration=configuration, schema=schema)
|
validator = Validator(configuration=configuration, schema=schema)
|
||||||
|
@ -42,8 +42,7 @@ class Versions(Handler):
|
|||||||
PEP423_PACKAGE_NAME = re.compile(r"^[A-Za-z0-9._-]+")
|
PEP423_PACKAGE_NAME = re.compile(r"^[A-Za-z0-9._-]+")
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def run(cls, args: argparse.Namespace, architecture: str, configuration: Configuration, *,
|
def run(cls, args: argparse.Namespace, architecture: str, configuration: Configuration, *, report: bool) -> None:
|
||||||
report: bool, unsafe: bool) -> None:
|
|
||||||
"""
|
"""
|
||||||
callback for command line
|
callback for command line
|
||||||
|
|
||||||
@ -52,7 +51,6 @@ class Versions(Handler):
|
|||||||
architecture(str): repository architecture
|
architecture(str): repository architecture
|
||||||
configuration(Configuration): configuration instance
|
configuration(Configuration): configuration instance
|
||||||
report(bool): force enable or disable reporting
|
report(bool): force enable or disable reporting
|
||||||
unsafe(bool): if set no user check will be performed before path creation
|
|
||||||
"""
|
"""
|
||||||
VersionPrinter(f"Module version {version.__version__}",
|
VersionPrinter(f"Module version {version.__version__}",
|
||||||
{"Python": sys.version}).print(verbose=False, separator=" ")
|
{"Python": sys.version}).print(verbose=False, separator=" ")
|
||||||
|
@ -36,8 +36,7 @@ class Web(Handler):
|
|||||||
COMMAND_ARGS_WHITELIST = ["force", "log_handler", ""]
|
COMMAND_ARGS_WHITELIST = ["force", "log_handler", ""]
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def run(cls, args: argparse.Namespace, architecture: str, configuration: Configuration, *,
|
def run(cls, args: argparse.Namespace, architecture: str, configuration: Configuration, *, report: bool) -> None:
|
||||||
report: bool, unsafe: bool) -> None:
|
|
||||||
"""
|
"""
|
||||||
callback for command line
|
callback for command line
|
||||||
|
|
||||||
@ -46,7 +45,6 @@ class Web(Handler):
|
|||||||
architecture(str): repository architecture
|
architecture(str): repository architecture
|
||||||
configuration(Configuration): configuration instance
|
configuration(Configuration): configuration instance
|
||||||
report(bool): force enable or disable reporting
|
report(bool): force enable or disable reporting
|
||||||
unsafe(bool): if set no user check will be performed before path creation
|
|
||||||
"""
|
"""
|
||||||
# we are using local import for optional dependencies
|
# we are using local import for optional dependencies
|
||||||
from ahriman.web.web import run_server, setup_service
|
from ahriman.web.web import run_server, setup_service
|
||||||
|
@ -86,6 +86,7 @@ class Lock(LazyLogging):
|
|||||||
check if current user is actually owner of ahriman root
|
check if current user is actually owner of ahriman root
|
||||||
"""
|
"""
|
||||||
check_user(self.paths, unsafe=self.unsafe)
|
check_user(self.paths, unsafe=self.unsafe)
|
||||||
|
self.paths.tree_create()
|
||||||
|
|
||||||
def clear(self) -> None:
|
def clear(self) -> None:
|
||||||
"""
|
"""
|
||||||
@ -116,7 +117,7 @@ class Lock(LazyLogging):
|
|||||||
1. Check user UID
|
1. Check user UID
|
||||||
2. Check if there is lock file
|
2. Check if there is lock file
|
||||||
3. Check web status watcher status
|
3. Check web status watcher status
|
||||||
4. Create lock file
|
4. Create lock file and directory tree
|
||||||
5. Report to status page if enabled
|
5. Report to status page if enabled
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
@ -47,7 +47,7 @@ class Repository(Executor, UpdateHandler):
|
|||||||
>>>
|
>>>
|
||||||
>>> configuration = Configuration()
|
>>> configuration = Configuration()
|
||||||
>>> database = SQLite.load(configuration)
|
>>> database = SQLite.load(configuration)
|
||||||
>>> repository = Repository.load("x86_64", configuration, database, report=True, unsafe=False)
|
>>> repository = Repository.load("x86_64", configuration, database, report=True)
|
||||||
>>> known_packages = repository.packages()
|
>>> known_packages = repository.packages()
|
||||||
>>>
|
>>>
|
||||||
>>> build_result = repository.process_build(known_packages)
|
>>> build_result = repository.process_build(known_packages)
|
||||||
@ -58,7 +58,7 @@ class Repository(Executor, UpdateHandler):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def load(cls, architecture: str, configuration: Configuration, database: SQLite, *, report: bool, unsafe: bool,
|
def load(cls, architecture: str, configuration: Configuration, database: SQLite, *, report: bool,
|
||||||
refresh_pacman_database: PacmanSynchronization = PacmanSynchronization.Disabled) -> Self:
|
refresh_pacman_database: PacmanSynchronization = PacmanSynchronization.Disabled) -> Self:
|
||||||
"""
|
"""
|
||||||
load instance from argument list
|
load instance from argument list
|
||||||
@ -68,7 +68,6 @@ class Repository(Executor, UpdateHandler):
|
|||||||
configuration(Configuration): configuration instance
|
configuration(Configuration): configuration instance
|
||||||
database(SQLite): database instance
|
database(SQLite): database instance
|
||||||
report(bool): force enable or disable reporting
|
report(bool): force enable or disable reporting
|
||||||
unsafe(bool): if set no user check will be performed before path creation
|
|
||||||
refresh_pacman_database(PacmanSynchronization, optional): pacman database synchronization level
|
refresh_pacman_database(PacmanSynchronization, optional): pacman database synchronization level
|
||||||
(Default value = PacmanSynchronization.Disabled)
|
(Default value = PacmanSynchronization.Disabled)
|
||||||
|
|
||||||
@ -76,7 +75,7 @@ class Repository(Executor, UpdateHandler):
|
|||||||
Self: fully loaded repository class instance
|
Self: fully loaded repository class instance
|
||||||
"""
|
"""
|
||||||
instance = cls(architecture, configuration, database,
|
instance = cls(architecture, configuration, database,
|
||||||
report=report, unsafe=unsafe, refresh_pacman_database=refresh_pacman_database)
|
report=report, refresh_pacman_database=refresh_pacman_database)
|
||||||
instance._set_context()
|
instance._set_context()
|
||||||
return instance
|
return instance
|
||||||
|
|
||||||
|
@ -21,12 +21,10 @@ from ahriman.core.alpm.pacman import Pacman
|
|||||||
from ahriman.core.alpm.repo import Repo
|
from ahriman.core.alpm.repo import Repo
|
||||||
from ahriman.core.configuration import Configuration
|
from ahriman.core.configuration import Configuration
|
||||||
from ahriman.core.database import SQLite
|
from ahriman.core.database import SQLite
|
||||||
from ahriman.core.exceptions import UnsafeRunError
|
|
||||||
from ahriman.core.log import LazyLogging
|
from ahriman.core.log import LazyLogging
|
||||||
from ahriman.core.sign.gpg import GPG
|
from ahriman.core.sign.gpg import GPG
|
||||||
from ahriman.core.status.client import Client
|
from ahriman.core.status.client import Client
|
||||||
from ahriman.core.triggers import TriggerLoader
|
from ahriman.core.triggers import TriggerLoader
|
||||||
from ahriman.core.util import check_user
|
|
||||||
from ahriman.models.packagers import Packagers
|
from ahriman.models.packagers import Packagers
|
||||||
from ahriman.models.pacman_synchronization import PacmanSynchronization
|
from ahriman.models.pacman_synchronization import PacmanSynchronization
|
||||||
from ahriman.models.repository_paths import RepositoryPaths
|
from ahriman.models.repository_paths import RepositoryPaths
|
||||||
@ -53,7 +51,7 @@ class RepositoryProperties(LazyLogging):
|
|||||||
vcs_allowed_age(int): maximal age of the VCS packages before they will be checked
|
vcs_allowed_age(int): maximal age of the VCS packages before they will be checked
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, architecture: str, configuration: Configuration, database: SQLite, *, report: bool, unsafe: bool,
|
def __init__(self, architecture: str, configuration: Configuration, database: SQLite, *, report: bool,
|
||||||
refresh_pacman_database: PacmanSynchronization) -> None:
|
refresh_pacman_database: PacmanSynchronization) -> None:
|
||||||
"""
|
"""
|
||||||
default constructor
|
default constructor
|
||||||
@ -63,7 +61,6 @@ class RepositoryProperties(LazyLogging):
|
|||||||
configuration(Configuration): configuration instance
|
configuration(Configuration): configuration instance
|
||||||
database(SQLite): database instance
|
database(SQLite): database instance
|
||||||
report(bool): force enable or disable reporting
|
report(bool): force enable or disable reporting
|
||||||
unsafe(bool): if set no user check will be performed before path creation
|
|
||||||
refresh_pacman_database(PacmanSynchronization): pacman database synchronization level
|
refresh_pacman_database(PacmanSynchronization): pacman database synchronization level
|
||||||
"""
|
"""
|
||||||
self.architecture = architecture
|
self.architecture = architecture
|
||||||
@ -74,11 +71,6 @@ class RepositoryProperties(LazyLogging):
|
|||||||
self.vcs_allowed_age = configuration.getint("build", "vcs_allowed_age", fallback=0)
|
self.vcs_allowed_age = configuration.getint("build", "vcs_allowed_age", fallback=0)
|
||||||
|
|
||||||
self.paths: RepositoryPaths = configuration.repository_paths # additional workaround for pycharm typing
|
self.paths: RepositoryPaths = configuration.repository_paths # additional workaround for pycharm typing
|
||||||
try:
|
|
||||||
check_user(self.paths, unsafe=unsafe)
|
|
||||||
self.paths.tree_create()
|
|
||||||
except UnsafeRunError:
|
|
||||||
self.logger.warning("root owner differs from the current user, skipping tree creation")
|
|
||||||
|
|
||||||
self.ignore_list = configuration.getlist("build", "ignore_packages", fallback=[])
|
self.ignore_list = configuration.getlist("build", "ignore_packages", fallback=[])
|
||||||
self.pacman = Pacman(architecture, configuration, refresh_database=refresh_pacman_database)
|
self.pacman = Pacman(architecture, configuration, refresh_database=refresh_pacman_database)
|
||||||
|
@ -53,7 +53,7 @@ class Watcher(LazyLogging):
|
|||||||
"""
|
"""
|
||||||
self.architecture = architecture
|
self.architecture = architecture
|
||||||
self.database = database
|
self.database = database
|
||||||
self.repository = Repository.load(architecture, configuration, database, report=False, unsafe=False)
|
self.repository = Repository.load(architecture, configuration, database, report=False)
|
||||||
|
|
||||||
self.known: dict[str, tuple[Package, BuildStatus]] = {}
|
self.known: dict[str, tuple[Package, BuildStatus]] = {}
|
||||||
self.status = BuildStatus()
|
self.status = BuildStatus()
|
||||||
|
@ -104,7 +104,7 @@ class Tree:
|
|||||||
>>>
|
>>>
|
||||||
>>> configuration = Configuration()
|
>>> configuration = Configuration()
|
||||||
>>> database = SQLite.load(configuration)
|
>>> database = SQLite.load(configuration)
|
||||||
>>> repository = Repository.load("x86_64", configuration, database, report=True, unsafe=False)
|
>>> repository = Repository.load("x86_64", configuration, database, report=True)
|
||||||
>>> packages = repository.packages()
|
>>> packages = repository.packages()
|
||||||
>>>
|
>>>
|
||||||
>>> tree = Tree.resolve(packages)
|
>>> tree = Tree.resolve(packages)
|
||||||
|
@ -27,7 +27,7 @@ def application_packages(configuration: Configuration, database: SQLite, reposit
|
|||||||
"""
|
"""
|
||||||
mocker.patch("ahriman.core.repository.Repository.load", return_value=repository)
|
mocker.patch("ahriman.core.repository.Repository.load", return_value=repository)
|
||||||
mocker.patch("ahriman.core.database.SQLite.load", return_value=database)
|
mocker.patch("ahriman.core.database.SQLite.load", return_value=database)
|
||||||
return ApplicationPackages("x86_64", configuration, report=False, unsafe=False)
|
return ApplicationPackages("x86_64", configuration, report=False)
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
@ -47,7 +47,7 @@ def application_properties(configuration: Configuration, database: SQLite, repos
|
|||||||
"""
|
"""
|
||||||
mocker.patch("ahriman.core.repository.Repository.load", return_value=repository)
|
mocker.patch("ahriman.core.repository.Repository.load", return_value=repository)
|
||||||
mocker.patch("ahriman.core.database.SQLite.load", return_value=database)
|
mocker.patch("ahriman.core.database.SQLite.load", return_value=database)
|
||||||
return ApplicationProperties("x86_64", configuration, report=False, unsafe=False)
|
return ApplicationProperties("x86_64", configuration, report=False)
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
@ -67,4 +67,4 @@ def application_repository(configuration: Configuration, database: SQLite, repos
|
|||||||
"""
|
"""
|
||||||
mocker.patch("ahriman.core.repository.Repository.load", return_value=repository)
|
mocker.patch("ahriman.core.repository.Repository.load", return_value=repository)
|
||||||
mocker.patch("ahriman.core.database.SQLite.load", return_value=database)
|
mocker.patch("ahriman.core.database.SQLite.load", return_value=database)
|
||||||
return ApplicationRepository("x86_64", configuration, report=False, unsafe=False)
|
return ApplicationRepository("x86_64", configuration, report=False)
|
||||||
|
@ -26,10 +26,9 @@ def application(configuration: Configuration, repository: Repository, database:
|
|||||||
Returns:
|
Returns:
|
||||||
Application: application test instance
|
Application: application test instance
|
||||||
"""
|
"""
|
||||||
mocker.patch("ahriman.models.repository_paths.RepositoryPaths.tree_create")
|
|
||||||
mocker.patch("ahriman.core.database.SQLite.load", return_value=database)
|
mocker.patch("ahriman.core.database.SQLite.load", return_value=database)
|
||||||
mocker.patch("ahriman.core.repository.Repository.load", return_value=repository)
|
mocker.patch("ahriman.core.repository.Repository.load", return_value=repository)
|
||||||
return Application("x86_64", configuration, report=False, unsafe=False)
|
return Application("x86_64", configuration, report=False)
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
|
@ -143,7 +143,7 @@ def test_run(args: argparse.Namespace, configuration: Configuration) -> None:
|
|||||||
must raise NotImplemented for missing method
|
must raise NotImplemented for missing method
|
||||||
"""
|
"""
|
||||||
with pytest.raises(NotImplementedError):
|
with pytest.raises(NotImplementedError):
|
||||||
Handler.run(args, "x86_64", configuration, report=True, unsafe=True)
|
Handler.run(args, "x86_64", configuration, report=True)
|
||||||
|
|
||||||
|
|
||||||
def test_check_if_empty() -> None:
|
def test_check_if_empty() -> None:
|
||||||
|
@ -43,7 +43,7 @@ def test_run(args: argparse.Namespace, configuration: Configuration, repository:
|
|||||||
dependencies_mock = mocker.patch("ahriman.application.application.Application.with_dependencies")
|
dependencies_mock = mocker.patch("ahriman.application.application.Application.with_dependencies")
|
||||||
on_start_mock = mocker.patch("ahriman.application.application.Application.on_start")
|
on_start_mock = mocker.patch("ahriman.application.application.Application.on_start")
|
||||||
|
|
||||||
Add.run(args, "x86_64", configuration, report=False, unsafe=False)
|
Add.run(args, "x86_64", configuration, report=False)
|
||||||
application_mock.assert_called_once_with(args.package, args.source, args.username)
|
application_mock.assert_called_once_with(args.package, args.source, args.username)
|
||||||
dependencies_mock.assert_not_called()
|
dependencies_mock.assert_not_called()
|
||||||
on_start_mock.assert_called_once_with()
|
on_start_mock.assert_called_once_with()
|
||||||
@ -67,7 +67,7 @@ def test_run_with_updates(args: argparse.Namespace, configuration: Configuration
|
|||||||
return_value=[package_ahriman])
|
return_value=[package_ahriman])
|
||||||
print_mock = mocker.patch("ahriman.application.application.Application.print_updates")
|
print_mock = mocker.patch("ahriman.application.application.Application.print_updates")
|
||||||
|
|
||||||
Add.run(args, "x86_64", configuration, report=False, unsafe=False)
|
Add.run(args, "x86_64", configuration, report=False)
|
||||||
updates_mock.assert_called_once_with(args.package, aur=False, local=False, manual=True, vcs=False)
|
updates_mock.assert_called_once_with(args.package, aur=False, local=False, manual=True, vcs=False)
|
||||||
application_mock.assert_called_once_with([package_ahriman],
|
application_mock.assert_called_once_with([package_ahriman],
|
||||||
Packagers(args.username, {package_ahriman.base: "packager"}))
|
Packagers(args.username, {package_ahriman.base: "packager"}))
|
||||||
@ -92,5 +92,5 @@ def test_run_empty_exception(args: argparse.Namespace, configuration: Configurat
|
|||||||
mocker.patch("ahriman.application.application.Application.print_updates")
|
mocker.patch("ahriman.application.application.Application.print_updates")
|
||||||
check_mock = mocker.patch("ahriman.application.handlers.Handler.check_if_empty")
|
check_mock = mocker.patch("ahriman.application.handlers.Handler.check_if_empty")
|
||||||
|
|
||||||
Add.run(args, "x86_64", configuration, report=False, unsafe=False)
|
Add.run(args, "x86_64", configuration, report=False)
|
||||||
check_mock.assert_called_once_with(True, True)
|
check_mock.assert_called_once_with(True, True)
|
||||||
|
@ -33,7 +33,7 @@ def test_run(args: argparse.Namespace, configuration: Configuration, mocker: Moc
|
|||||||
add_mock = tarfile.__enter__.return_value = MagicMock()
|
add_mock = tarfile.__enter__.return_value = MagicMock()
|
||||||
mocker.patch("tarfile.TarFile.__new__", return_value=tarfile)
|
mocker.patch("tarfile.TarFile.__new__", return_value=tarfile)
|
||||||
|
|
||||||
Backup.run(args, "x86_64", configuration, report=False, unsafe=False)
|
Backup.run(args, "x86_64", configuration, report=False)
|
||||||
add_mock.add.assert_called_once_with(Path("path"))
|
add_mock.add.assert_called_once_with(Path("path"))
|
||||||
|
|
||||||
|
|
||||||
|
@ -35,6 +35,6 @@ def test_run(args: argparse.Namespace, configuration: Configuration, repository:
|
|||||||
application_mock = mocker.patch("ahriman.application.application.Application.clean")
|
application_mock = mocker.patch("ahriman.application.application.Application.clean")
|
||||||
on_start_mock = mocker.patch("ahriman.application.application.Application.on_start")
|
on_start_mock = mocker.patch("ahriman.application.application.Application.on_start")
|
||||||
|
|
||||||
Clean.run(args, "x86_64", configuration, report=False, unsafe=False)
|
Clean.run(args, "x86_64", configuration, report=False)
|
||||||
application_mock.assert_called_once_with(cache=False, chroot=False, manual=False, packages=False, pacman=False)
|
application_mock.assert_called_once_with(cache=False, chroot=False, manual=False, packages=False, pacman=False)
|
||||||
on_start_mock.assert_called_once_with()
|
on_start_mock.assert_called_once_with()
|
||||||
|
@ -33,7 +33,7 @@ def test_run(args: argparse.Namespace, configuration: Configuration, mocker: Moc
|
|||||||
start_mock = mocker.patch("threading.Timer.start")
|
start_mock = mocker.patch("threading.Timer.start")
|
||||||
join_mock = mocker.patch("threading.Timer.join")
|
join_mock = mocker.patch("threading.Timer.join")
|
||||||
|
|
||||||
Daemon.run(args, "x86_64", configuration, report=True, unsafe=False)
|
Daemon.run(args, "x86_64", configuration, report=True)
|
||||||
run_mock.assert_called_once_with(args, "x86_64", configuration, report=True, unsafe=False)
|
run_mock.assert_called_once_with(args, "x86_64", configuration, report=True)
|
||||||
start_mock.assert_called_once_with()
|
start_mock.assert_called_once_with()
|
||||||
join_mock.assert_called_once_with()
|
join_mock.assert_called_once_with()
|
||||||
|
@ -29,7 +29,7 @@ def test_run(args: argparse.Namespace, configuration: Configuration, mocker: Moc
|
|||||||
application_mock = mocker.patch("ahriman.core.configuration.Configuration.dump",
|
application_mock = mocker.patch("ahriman.core.configuration.Configuration.dump",
|
||||||
return_value=configuration.dump())
|
return_value=configuration.dump())
|
||||||
|
|
||||||
Dump.run(args, "x86_64", configuration, report=False, unsafe=False)
|
Dump.run(args, "x86_64", configuration, report=False)
|
||||||
application_mock.assert_called_once_with()
|
application_mock.assert_called_once_with()
|
||||||
print_mock.assert_called()
|
print_mock.assert_called()
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ def test_run(args: argparse.Namespace, configuration: Configuration, mocker: Moc
|
|||||||
args = _default_args(args)
|
args = _default_args(args)
|
||||||
parse_mock = mocker.patch("argparse.ArgumentParser.parse_args")
|
parse_mock = mocker.patch("argparse.ArgumentParser.parse_args")
|
||||||
|
|
||||||
Help.run(args, "x86_64", configuration, report=False, unsafe=False)
|
Help.run(args, "x86_64", configuration, report=False)
|
||||||
parse_mock.assert_called_once_with(["--help"])
|
parse_mock.assert_called_once_with(["--help"])
|
||||||
|
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ def test_run_command(args: argparse.Namespace, configuration: Configuration, moc
|
|||||||
args.command = "aur-search"
|
args.command = "aur-search"
|
||||||
parse_mock = mocker.patch("argparse.ArgumentParser.parse_args")
|
parse_mock = mocker.patch("argparse.ArgumentParser.parse_args")
|
||||||
|
|
||||||
Help.run(args, "x86_64", configuration, report=False, unsafe=False)
|
Help.run(args, "x86_64", configuration, report=False)
|
||||||
parse_mock.assert_called_once_with(["aur-search", "--help"])
|
parse_mock.assert_called_once_with(["aur-search", "--help"])
|
||||||
|
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ def test_run(args: argparse.Namespace, configuration: Configuration, repository:
|
|||||||
mocker.patch("ahriman.core.repository.Repository.load", return_value=repository)
|
mocker.patch("ahriman.core.repository.Repository.load", return_value=repository)
|
||||||
application_mock = mocker.patch("ahriman.core.sign.gpg.GPG.key_import")
|
application_mock = mocker.patch("ahriman.core.sign.gpg.GPG.key_import")
|
||||||
|
|
||||||
KeyImport.run(args, "x86_64", configuration, report=False, unsafe=False)
|
KeyImport.run(args, "x86_64", configuration, report=False)
|
||||||
application_mock.assert_called_once_with(args.key_server, args.key)
|
application_mock.assert_called_once_with(args.key_server, args.key)
|
||||||
|
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ def test_run(args: argparse.Namespace, configuration: Configuration, repository:
|
|||||||
return_value=(args.package, PkgbuildPatch(None, "patch")))
|
return_value=(args.package, PkgbuildPatch(None, "patch")))
|
||||||
application_mock = mocker.patch("ahriman.application.handlers.Patch.patch_set_create")
|
application_mock = mocker.patch("ahriman.application.handlers.Patch.patch_set_create")
|
||||||
|
|
||||||
Patch.run(args, "x86_64", configuration, report=False, unsafe=False)
|
Patch.run(args, "x86_64", configuration, report=False)
|
||||||
patch_mock.assert_called_once_with(args.package, "x86_64", args.track)
|
patch_mock.assert_called_once_with(args.package, "x86_64", args.track)
|
||||||
application_mock.assert_called_once_with(pytest.helpers.anyvar(int), args.package, PkgbuildPatch(None, "patch"))
|
application_mock.assert_called_once_with(pytest.helpers.anyvar(int), args.package, PkgbuildPatch(None, "patch"))
|
||||||
|
|
||||||
@ -63,7 +63,7 @@ def test_run_function(args: argparse.Namespace, configuration: Configuration, re
|
|||||||
patch_mock = mocker.patch("ahriman.application.handlers.Patch.patch_create_from_function", return_value=patch)
|
patch_mock = mocker.patch("ahriman.application.handlers.Patch.patch_create_from_function", return_value=patch)
|
||||||
application_mock = mocker.patch("ahriman.application.handlers.Patch.patch_set_create")
|
application_mock = mocker.patch("ahriman.application.handlers.Patch.patch_set_create")
|
||||||
|
|
||||||
Patch.run(args, "x86_64", configuration, report=False, unsafe=False)
|
Patch.run(args, "x86_64", configuration, report=False)
|
||||||
patch_mock.assert_called_once_with(args.variable, args.patch)
|
patch_mock.assert_called_once_with(args.variable, args.patch)
|
||||||
application_mock.assert_called_once_with(pytest.helpers.anyvar(int), args.package, patch)
|
application_mock.assert_called_once_with(pytest.helpers.anyvar(int), args.package, patch)
|
||||||
|
|
||||||
@ -79,7 +79,7 @@ def test_run_list(args: argparse.Namespace, configuration: Configuration, reposi
|
|||||||
mocker.patch("ahriman.core.repository.Repository.load", return_value=repository)
|
mocker.patch("ahriman.core.repository.Repository.load", return_value=repository)
|
||||||
application_mock = mocker.patch("ahriman.application.handlers.Patch.patch_set_list")
|
application_mock = mocker.patch("ahriman.application.handlers.Patch.patch_set_list")
|
||||||
|
|
||||||
Patch.run(args, "x86_64", configuration, report=False, unsafe=False)
|
Patch.run(args, "x86_64", configuration, report=False)
|
||||||
application_mock.assert_called_once_with(pytest.helpers.anyvar(int), args.package, ["version"], False)
|
application_mock.assert_called_once_with(pytest.helpers.anyvar(int), args.package, ["version"], False)
|
||||||
|
|
||||||
|
|
||||||
@ -94,7 +94,7 @@ def test_run_remove(args: argparse.Namespace, configuration: Configuration, repo
|
|||||||
mocker.patch("ahriman.core.repository.Repository.load", return_value=repository)
|
mocker.patch("ahriman.core.repository.Repository.load", return_value=repository)
|
||||||
application_mock = mocker.patch("ahriman.application.handlers.Patch.patch_set_remove")
|
application_mock = mocker.patch("ahriman.application.handlers.Patch.patch_set_remove")
|
||||||
|
|
||||||
Patch.run(args, "x86_64", configuration, report=False, unsafe=False)
|
Patch.run(args, "x86_64", configuration, report=False)
|
||||||
application_mock.assert_called_once_with(pytest.helpers.anyvar(int), args.package, ["version"])
|
application_mock.assert_called_once_with(pytest.helpers.anyvar(int), args.package, ["version"])
|
||||||
|
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ def test_run(args: argparse.Namespace, package_ahriman: Package, configuration:
|
|||||||
check_mock = mocker.patch("ahriman.application.handlers.Handler.check_if_empty")
|
check_mock = mocker.patch("ahriman.application.handlers.Handler.check_if_empty")
|
||||||
on_start_mock = mocker.patch("ahriman.application.application.Application.on_start")
|
on_start_mock = mocker.patch("ahriman.application.application.Application.on_start")
|
||||||
|
|
||||||
Rebuild.run(args, "x86_64", configuration, report=False, unsafe=False)
|
Rebuild.run(args, "x86_64", configuration, report=False)
|
||||||
extract_mock.assert_called_once_with(pytest.helpers.anyvar(int), args.status, from_database=args.from_database)
|
extract_mock.assert_called_once_with(pytest.helpers.anyvar(int), args.status, from_database=args.from_database)
|
||||||
application_packages_mock.assert_called_once_with([package_ahriman], None)
|
application_packages_mock.assert_called_once_with([package_ahriman], None)
|
||||||
application_mock.assert_called_once_with([package_ahriman], args.username)
|
application_mock.assert_called_once_with([package_ahriman], args.username)
|
||||||
@ -69,7 +69,7 @@ def test_run_extract_packages(args: argparse.Namespace, configuration: Configura
|
|||||||
mocker.patch("ahriman.application.application.Application.print_updates")
|
mocker.patch("ahriman.application.application.Application.print_updates")
|
||||||
extract_mock = mocker.patch("ahriman.application.handlers.Rebuild.extract_packages", return_value=[])
|
extract_mock = mocker.patch("ahriman.application.handlers.Rebuild.extract_packages", return_value=[])
|
||||||
|
|
||||||
Rebuild.run(args, "x86_64", configuration, report=False, unsafe=False)
|
Rebuild.run(args, "x86_64", configuration, report=False)
|
||||||
extract_mock.assert_called_once_with(pytest.helpers.anyvar(int), args.status, from_database=args.from_database)
|
extract_mock.assert_called_once_with(pytest.helpers.anyvar(int), args.status, from_database=args.from_database)
|
||||||
|
|
||||||
|
|
||||||
@ -86,7 +86,7 @@ def test_run_dry_run(args: argparse.Namespace, configuration: Configuration, rep
|
|||||||
check_mock = mocker.patch("ahriman.application.handlers.Handler.check_if_empty")
|
check_mock = mocker.patch("ahriman.application.handlers.Handler.check_if_empty")
|
||||||
print_mock = mocker.patch("ahriman.application.application.Application.print_updates")
|
print_mock = mocker.patch("ahriman.application.application.Application.print_updates")
|
||||||
|
|
||||||
Rebuild.run(args, "x86_64", configuration, report=False, unsafe=False)
|
Rebuild.run(args, "x86_64", configuration, report=False)
|
||||||
application_mock.assert_not_called()
|
application_mock.assert_not_called()
|
||||||
check_mock.assert_called_once_with(False, False)
|
check_mock.assert_called_once_with(False, False)
|
||||||
print_mock.assert_called_once_with([package_ahriman], log_fn=pytest.helpers.anyvar(int))
|
print_mock.assert_called_once_with([package_ahriman], log_fn=pytest.helpers.anyvar(int))
|
||||||
@ -104,7 +104,7 @@ def test_run_filter(args: argparse.Namespace, configuration: Configuration, repo
|
|||||||
mocker.patch("ahriman.application.handlers.Rebuild.extract_packages", return_value=[])
|
mocker.patch("ahriman.application.handlers.Rebuild.extract_packages", return_value=[])
|
||||||
application_packages_mock = mocker.patch("ahriman.core.repository.repository.Repository.packages_depend_on")
|
application_packages_mock = mocker.patch("ahriman.core.repository.repository.Repository.packages_depend_on")
|
||||||
|
|
||||||
Rebuild.run(args, "x86_64", configuration, report=False, unsafe=False)
|
Rebuild.run(args, "x86_64", configuration, report=False)
|
||||||
application_packages_mock.assert_called_once_with([], ["python-aur"])
|
application_packages_mock.assert_called_once_with([], ["python-aur"])
|
||||||
|
|
||||||
|
|
||||||
@ -119,7 +119,7 @@ def test_run_without_filter(args: argparse.Namespace, configuration: Configurati
|
|||||||
mocker.patch("ahriman.application.handlers.Rebuild.extract_packages", return_value=[])
|
mocker.patch("ahriman.application.handlers.Rebuild.extract_packages", return_value=[])
|
||||||
application_packages_mock = mocker.patch("ahriman.core.repository.repository.Repository.packages_depend_on")
|
application_packages_mock = mocker.patch("ahriman.core.repository.repository.Repository.packages_depend_on")
|
||||||
|
|
||||||
Rebuild.run(args, "x86_64", configuration, report=False, unsafe=False)
|
Rebuild.run(args, "x86_64", configuration, report=False)
|
||||||
application_packages_mock.assert_called_once_with([], None)
|
application_packages_mock.assert_called_once_with([], None)
|
||||||
|
|
||||||
|
|
||||||
@ -137,7 +137,7 @@ def test_run_update_empty_exception(args: argparse.Namespace, configuration: Con
|
|||||||
mocker.patch("ahriman.application.application.Application.print_updates")
|
mocker.patch("ahriman.application.application.Application.print_updates")
|
||||||
check_mock = mocker.patch("ahriman.application.handlers.Handler.check_if_empty")
|
check_mock = mocker.patch("ahriman.application.handlers.Handler.check_if_empty")
|
||||||
|
|
||||||
Rebuild.run(args, "x86_64", configuration, report=False, unsafe=False)
|
Rebuild.run(args, "x86_64", configuration, report=False)
|
||||||
check_mock.assert_called_once_with(True, True)
|
check_mock.assert_called_once_with(True, True)
|
||||||
|
|
||||||
|
|
||||||
@ -154,7 +154,7 @@ def test_run_build_empty_exception(args: argparse.Namespace, configuration: Conf
|
|||||||
mocker.patch("ahriman.application.application.Application.update", return_value=Result())
|
mocker.patch("ahriman.application.application.Application.update", return_value=Result())
|
||||||
check_mock = mocker.patch("ahriman.application.handlers.Handler.check_if_empty")
|
check_mock = mocker.patch("ahriman.application.handlers.Handler.check_if_empty")
|
||||||
|
|
||||||
Rebuild.run(args, "x86_64", configuration, report=False, unsafe=False)
|
Rebuild.run(args, "x86_64", configuration, report=False)
|
||||||
check_mock.assert_has_calls([MockCall(True, False), MockCall(True, True)])
|
check_mock.assert_has_calls([MockCall(True, False), MockCall(True, True)])
|
||||||
|
|
||||||
|
|
||||||
|
@ -31,6 +31,6 @@ def test_run(args: argparse.Namespace, configuration: Configuration, repository:
|
|||||||
application_mock = mocker.patch("ahriman.application.application.Application.remove")
|
application_mock = mocker.patch("ahriman.application.application.Application.remove")
|
||||||
on_start_mock = mocker.patch("ahriman.application.application.Application.on_start")
|
on_start_mock = mocker.patch("ahriman.application.application.Application.on_start")
|
||||||
|
|
||||||
Remove.run(args, "x86_64", configuration, report=False, unsafe=False)
|
Remove.run(args, "x86_64", configuration, report=False)
|
||||||
application_mock.assert_called_once_with([])
|
application_mock.assert_called_once_with([])
|
||||||
on_start_mock.assert_called_once_with()
|
on_start_mock.assert_called_once_with()
|
||||||
|
@ -34,7 +34,7 @@ def test_run(args: argparse.Namespace, package_ahriman: Package, configuration:
|
|||||||
remove_mock = mocker.patch("ahriman.application.application.Application.remove")
|
remove_mock = mocker.patch("ahriman.application.application.Application.remove")
|
||||||
on_start_mock = mocker.patch("ahriman.application.application.Application.on_start")
|
on_start_mock = mocker.patch("ahriman.application.application.Application.on_start")
|
||||||
|
|
||||||
RemoveUnknown.run(args, "x86_64", configuration, report=False, unsafe=False)
|
RemoveUnknown.run(args, "x86_64", configuration, report=False)
|
||||||
application_mock.assert_called_once_with()
|
application_mock.assert_called_once_with()
|
||||||
remove_mock.assert_called_once_with([package_ahriman])
|
remove_mock.assert_called_once_with([package_ahriman])
|
||||||
on_start_mock.assert_called_once_with()
|
on_start_mock.assert_called_once_with()
|
||||||
@ -53,7 +53,7 @@ def test_run_dry_run(args: argparse.Namespace, configuration: Configuration, rep
|
|||||||
remove_mock = mocker.patch("ahriman.application.application.Application.remove")
|
remove_mock = mocker.patch("ahriman.application.application.Application.remove")
|
||||||
print_mock = mocker.patch("ahriman.core.formatters.Printer.print")
|
print_mock = mocker.patch("ahriman.core.formatters.Printer.print")
|
||||||
|
|
||||||
RemoveUnknown.run(args, "x86_64", configuration, report=False, unsafe=False)
|
RemoveUnknown.run(args, "x86_64", configuration, report=False)
|
||||||
application_mock.assert_called_once_with()
|
application_mock.assert_called_once_with()
|
||||||
remove_mock.assert_not_called()
|
remove_mock.assert_not_called()
|
||||||
print_mock.assert_called_once_with(verbose=False)
|
print_mock.assert_called_once_with(verbose=False)
|
||||||
|
@ -32,7 +32,7 @@ def test_run(args: argparse.Namespace, configuration: Configuration, mocker: Moc
|
|||||||
extract_mock = tarfile.__enter__.return_value = MagicMock()
|
extract_mock = tarfile.__enter__.return_value = MagicMock()
|
||||||
mocker.patch("tarfile.TarFile.__new__", return_value=tarfile)
|
mocker.patch("tarfile.TarFile.__new__", return_value=tarfile)
|
||||||
|
|
||||||
Restore.run(args, "x86_64", configuration, report=False, unsafe=False)
|
Restore.run(args, "x86_64", configuration, report=False)
|
||||||
extract_mock.extractall.assert_called_once_with(path=args.output)
|
extract_mock.extractall.assert_called_once_with(path=args.output)
|
||||||
|
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ def test_run(args: argparse.Namespace, configuration: Configuration, repository:
|
|||||||
check_mock = mocker.patch("ahriman.application.handlers.Handler.check_if_empty")
|
check_mock = mocker.patch("ahriman.application.handlers.Handler.check_if_empty")
|
||||||
print_mock = mocker.patch("ahriman.core.formatters.Printer.print")
|
print_mock = mocker.patch("ahriman.core.formatters.Printer.print")
|
||||||
|
|
||||||
Search.run(args, "x86_64", configuration, report=False, unsafe=False)
|
Search.run(args, "x86_64", configuration, report=False)
|
||||||
aur_search_mock.assert_called_once_with("ahriman", pacman=pytest.helpers.anyvar(int))
|
aur_search_mock.assert_called_once_with("ahriman", pacman=pytest.helpers.anyvar(int))
|
||||||
official_search_mock.assert_called_once_with("ahriman", pacman=pytest.helpers.anyvar(int))
|
official_search_mock.assert_called_once_with("ahriman", pacman=pytest.helpers.anyvar(int))
|
||||||
check_mock.assert_called_once_with(False, False)
|
check_mock.assert_called_once_with(False, False)
|
||||||
@ -62,7 +62,7 @@ def test_run_empty_exception(args: argparse.Namespace, configuration: Configurat
|
|||||||
mocker.patch("ahriman.core.repository.Repository.load", return_value=repository)
|
mocker.patch("ahriman.core.repository.Repository.load", return_value=repository)
|
||||||
check_mock = mocker.patch("ahriman.application.handlers.Handler.check_if_empty")
|
check_mock = mocker.patch("ahriman.application.handlers.Handler.check_if_empty")
|
||||||
|
|
||||||
Search.run(args, "x86_64", configuration, report=False, unsafe=False)
|
Search.run(args, "x86_64", configuration, report=False)
|
||||||
check_mock.assert_called_once_with(True, True)
|
check_mock.assert_called_once_with(True, True)
|
||||||
|
|
||||||
|
|
||||||
@ -77,7 +77,7 @@ def test_run_sort(args: argparse.Namespace, configuration: Configuration, reposi
|
|||||||
mocker.patch("ahriman.core.repository.Repository.load", return_value=repository)
|
mocker.patch("ahriman.core.repository.Repository.load", return_value=repository)
|
||||||
sort_mock = mocker.patch("ahriman.application.handlers.Search.sort")
|
sort_mock = mocker.patch("ahriman.application.handlers.Search.sort")
|
||||||
|
|
||||||
Search.run(args, "x86_64", configuration, report=False, unsafe=False)
|
Search.run(args, "x86_64", configuration, report=False)
|
||||||
sort_mock.assert_has_calls([
|
sort_mock.assert_has_calls([
|
||||||
MockCall([], "name"), MockCall().__iter__(),
|
MockCall([], "name"), MockCall().__iter__(),
|
||||||
MockCall([aur_package_ahriman], "name"), MockCall().__iter__()
|
MockCall([aur_package_ahriman], "name"), MockCall().__iter__()
|
||||||
@ -96,7 +96,7 @@ def test_run_sort_by(args: argparse.Namespace, configuration: Configuration, rep
|
|||||||
mocker.patch("ahriman.core.repository.Repository.load", return_value=repository)
|
mocker.patch("ahriman.core.repository.Repository.load", return_value=repository)
|
||||||
sort_mock = mocker.patch("ahriman.application.handlers.Search.sort")
|
sort_mock = mocker.patch("ahriman.application.handlers.Search.sort")
|
||||||
|
|
||||||
Search.run(args, "x86_64", configuration, report=False, unsafe=False)
|
Search.run(args, "x86_64", configuration, report=False)
|
||||||
sort_mock.assert_has_calls([
|
sort_mock.assert_has_calls([
|
||||||
MockCall([], "field"), MockCall().__iter__(),
|
MockCall([], "field"), MockCall().__iter__(),
|
||||||
MockCall([aur_package_ahriman], "field"), MockCall().__iter__()
|
MockCall([aur_package_ahriman], "field"), MockCall().__iter__()
|
||||||
|
@ -35,7 +35,7 @@ def test_run(args: argparse.Namespace, configuration: Configuration, repository:
|
|||||||
application_mock = mocker.patch("ahriman.core.formatters.Printer.print")
|
application_mock = mocker.patch("ahriman.core.formatters.Printer.print")
|
||||||
check_mock = mocker.patch("ahriman.application.handlers.Handler.check_if_empty")
|
check_mock = mocker.patch("ahriman.application.handlers.Handler.check_if_empty")
|
||||||
|
|
||||||
ServiceUpdates.run(args, "x86_64", configuration, report=False, unsafe=False)
|
ServiceUpdates.run(args, "x86_64", configuration, report=False)
|
||||||
package_mock.assert_called_once_with(package_ahriman.base, repository.pacman, None)
|
package_mock.assert_called_once_with(package_ahriman.base, repository.pacman, None)
|
||||||
application_mock.assert_called_once_with(verbose=True, separator=" -> ")
|
application_mock.assert_called_once_with(verbose=True, separator=" -> ")
|
||||||
check_mock.assert_called_once_with(args.exit_code, True)
|
check_mock.assert_called_once_with(args.exit_code, True)
|
||||||
@ -53,6 +53,6 @@ def test_run_skip(args: argparse.Namespace, configuration: Configuration, reposi
|
|||||||
application_mock = mocker.patch("ahriman.core.formatters.Printer.print")
|
application_mock = mocker.patch("ahriman.core.formatters.Printer.print")
|
||||||
check_mock = mocker.patch("ahriman.application.handlers.Handler.check_if_empty")
|
check_mock = mocker.patch("ahriman.application.handlers.Handler.check_if_empty")
|
||||||
|
|
||||||
ServiceUpdates.run(args, "x86_64", configuration, report=False, unsafe=False)
|
ServiceUpdates.run(args, "x86_64", configuration, report=False)
|
||||||
application_mock.assert_not_called()
|
application_mock.assert_not_called()
|
||||||
check_mock.assert_not_called()
|
check_mock.assert_not_called()
|
||||||
|
@ -53,7 +53,7 @@ def test_run(args: argparse.Namespace, configuration: Configuration, repository:
|
|||||||
executable_mock = mocker.patch("ahriman.application.handlers.Setup.executable_create")
|
executable_mock = mocker.patch("ahriman.application.handlers.Setup.executable_create")
|
||||||
init_mock = mocker.patch("ahriman.core.alpm.repo.Repo.init")
|
init_mock = mocker.patch("ahriman.core.alpm.repo.Repo.init")
|
||||||
|
|
||||||
Setup.run(args, "x86_64", configuration, report=False, unsafe=False)
|
Setup.run(args, "x86_64", configuration, report=False)
|
||||||
ahriman_configuration_mock.assert_called_once_with(args, "x86_64", args.repository, configuration)
|
ahriman_configuration_mock.assert_called_once_with(args, "x86_64", args.repository, configuration)
|
||||||
devtools_configuration_mock.assert_called_once_with(
|
devtools_configuration_mock.assert_called_once_with(
|
||||||
args.build_command, "x86_64", args.from_configuration, args.mirror, args.multilib, args.repository,
|
args.build_command, "x86_64", args.from_configuration, args.mirror, args.multilib, args.repository,
|
||||||
|
@ -32,7 +32,7 @@ def test_run(args: argparse.Namespace, configuration: Configuration, repository:
|
|||||||
mocker.patch("ahriman.core.repository.Repository.load", return_value=repository)
|
mocker.patch("ahriman.core.repository.Repository.load", return_value=repository)
|
||||||
application_mock = mocker.patch("code.interact")
|
application_mock = mocker.patch("code.interact")
|
||||||
|
|
||||||
Shell.run(args, "x86_64", configuration, report=False, unsafe=False)
|
Shell.run(args, "x86_64", configuration, report=False)
|
||||||
application_mock.assert_called_once_with(local=pytest.helpers.anyvar(int))
|
application_mock.assert_called_once_with(local=pytest.helpers.anyvar(int))
|
||||||
|
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ def test_run_eval(args: argparse.Namespace, configuration: Configuration, reposi
|
|||||||
mocker.patch("ahriman.core.repository.Repository.load", return_value=repository)
|
mocker.patch("ahriman.core.repository.Repository.load", return_value=repository)
|
||||||
application_mock = mocker.patch("code.InteractiveConsole.runcode")
|
application_mock = mocker.patch("code.InteractiveConsole.runcode")
|
||||||
|
|
||||||
Shell.run(args, "x86_64", configuration, report=False, unsafe=False)
|
Shell.run(args, "x86_64", configuration, report=False)
|
||||||
application_mock.assert_called_once_with(args.code)
|
application_mock.assert_called_once_with(args.code)
|
||||||
|
|
||||||
|
|
||||||
@ -61,6 +61,6 @@ def test_run_verbose(args: argparse.Namespace, configuration: Configuration, rep
|
|||||||
print_mock = mocker.patch("ahriman.core.formatters.Printer.print")
|
print_mock = mocker.patch("ahriman.core.formatters.Printer.print")
|
||||||
application_mock = mocker.patch("code.interact")
|
application_mock = mocker.patch("code.interact")
|
||||||
|
|
||||||
Shell.run(args, "x86_64", configuration, report=False, unsafe=False)
|
Shell.run(args, "x86_64", configuration, report=False)
|
||||||
application_mock.assert_called_once_with(local=pytest.helpers.anyvar(int))
|
application_mock.assert_called_once_with(local=pytest.helpers.anyvar(int))
|
||||||
print_mock.assert_called_once_with(verbose=False)
|
print_mock.assert_called_once_with(verbose=False)
|
||||||
|
@ -30,5 +30,5 @@ def test_run(args: argparse.Namespace, configuration: Configuration, repository:
|
|||||||
mocker.patch("ahriman.core.repository.Repository.load", return_value=repository)
|
mocker.patch("ahriman.core.repository.Repository.load", return_value=repository)
|
||||||
application_mock = mocker.patch("ahriman.application.application.Application.sign")
|
application_mock = mocker.patch("ahriman.application.application.Application.sign")
|
||||||
|
|
||||||
Sign.run(args, "x86_64", configuration, report=False, unsafe=False)
|
Sign.run(args, "x86_64", configuration, report=False)
|
||||||
application_mock.assert_called_once_with([])
|
application_mock.assert_called_once_with([])
|
||||||
|
@ -43,7 +43,7 @@ def test_run(args: argparse.Namespace, configuration: Configuration, repository:
|
|||||||
check_mock = mocker.patch("ahriman.application.handlers.Handler.check_if_empty")
|
check_mock = mocker.patch("ahriman.application.handlers.Handler.check_if_empty")
|
||||||
print_mock = mocker.patch("ahriman.core.formatters.Printer.print")
|
print_mock = mocker.patch("ahriman.core.formatters.Printer.print")
|
||||||
|
|
||||||
Status.run(args, "x86_64", configuration, report=False, unsafe=False)
|
Status.run(args, "x86_64", configuration, report=False)
|
||||||
application_mock.assert_called_once_with()
|
application_mock.assert_called_once_with()
|
||||||
packages_mock.assert_called_once_with(None)
|
packages_mock.assert_called_once_with(None)
|
||||||
check_mock.assert_called_once_with(False, False)
|
check_mock.assert_called_once_with(False, False)
|
||||||
@ -62,7 +62,7 @@ def test_run_empty_exception(args: argparse.Namespace, configuration: Configurat
|
|||||||
mocker.patch("ahriman.core.status.client.Client.get", return_value=[])
|
mocker.patch("ahriman.core.status.client.Client.get", return_value=[])
|
||||||
check_mock = mocker.patch("ahriman.application.handlers.Handler.check_if_empty")
|
check_mock = mocker.patch("ahriman.application.handlers.Handler.check_if_empty")
|
||||||
|
|
||||||
Status.run(args, "x86_64", configuration, report=False, unsafe=False)
|
Status.run(args, "x86_64", configuration, report=False)
|
||||||
check_mock.assert_called_once_with(True, True)
|
check_mock.assert_called_once_with(True, True)
|
||||||
|
|
||||||
|
|
||||||
@ -78,7 +78,7 @@ def test_run_verbose(args: argparse.Namespace, configuration: Configuration, rep
|
|||||||
return_value=[(package_ahriman, BuildStatus(BuildStatusEnum.Success))])
|
return_value=[(package_ahriman, BuildStatus(BuildStatusEnum.Success))])
|
||||||
print_mock = mocker.patch("ahriman.core.formatters.Printer.print")
|
print_mock = mocker.patch("ahriman.core.formatters.Printer.print")
|
||||||
|
|
||||||
Status.run(args, "x86_64", configuration, report=False, unsafe=False)
|
Status.run(args, "x86_64", configuration, report=False)
|
||||||
print_mock.assert_has_calls([MockCall(verbose=True) for _ in range(2)])
|
print_mock.assert_has_calls([MockCall(verbose=True) for _ in range(2)])
|
||||||
|
|
||||||
|
|
||||||
@ -93,7 +93,7 @@ def test_run_with_package_filter(args: argparse.Namespace, configuration: Config
|
|||||||
packages_mock = mocker.patch("ahriman.core.status.client.Client.get",
|
packages_mock = mocker.patch("ahriman.core.status.client.Client.get",
|
||||||
return_value=[(package_ahriman, BuildStatus(BuildStatusEnum.Success))])
|
return_value=[(package_ahriman, BuildStatus(BuildStatusEnum.Success))])
|
||||||
|
|
||||||
Status.run(args, "x86_64", configuration, report=False, unsafe=False)
|
Status.run(args, "x86_64", configuration, report=False)
|
||||||
packages_mock.assert_called_once_with(package_ahriman.base)
|
packages_mock.assert_called_once_with(package_ahriman.base)
|
||||||
|
|
||||||
|
|
||||||
@ -110,7 +110,7 @@ def test_run_by_status(args: argparse.Namespace, configuration: Configuration, r
|
|||||||
mocker.patch("ahriman.core.repository.Repository.load", return_value=repository)
|
mocker.patch("ahriman.core.repository.Repository.load", return_value=repository)
|
||||||
print_mock = mocker.patch("ahriman.core.formatters.Printer.print")
|
print_mock = mocker.patch("ahriman.core.formatters.Printer.print")
|
||||||
|
|
||||||
Status.run(args, "x86_64", configuration, report=False, unsafe=False)
|
Status.run(args, "x86_64", configuration, report=False)
|
||||||
print_mock.assert_has_calls([MockCall(verbose=False) for _ in range(2)])
|
print_mock.assert_has_calls([MockCall(verbose=False) for _ in range(2)])
|
||||||
|
|
||||||
|
|
||||||
@ -123,9 +123,8 @@ def test_imply_with_report(args: argparse.Namespace, configuration: Configuratio
|
|||||||
mocker.patch("ahriman.core.database.SQLite.load", return_value=database)
|
mocker.patch("ahriman.core.database.SQLite.load", return_value=database)
|
||||||
load_mock = mocker.patch("ahriman.core.repository.Repository.load")
|
load_mock = mocker.patch("ahriman.core.repository.Repository.load")
|
||||||
|
|
||||||
Status.run(args, "x86_64", configuration, report=False, unsafe=False)
|
Status.run(args, "x86_64", configuration, report=False)
|
||||||
load_mock.assert_called_once_with("x86_64", configuration, database,
|
load_mock.assert_called_once_with("x86_64", configuration, database, report=True, refresh_pacman_database=0)
|
||||||
report=True, unsafe=False, refresh_pacman_database=0)
|
|
||||||
|
|
||||||
|
|
||||||
def test_disallow_auto_architecture_run() -> None:
|
def test_disallow_auto_architecture_run() -> None:
|
||||||
|
@ -36,7 +36,7 @@ def test_run(args: argparse.Namespace, configuration: Configuration, repository:
|
|||||||
mocker.patch("ahriman.core.repository.Repository.load", return_value=repository)
|
mocker.patch("ahriman.core.repository.Repository.load", return_value=repository)
|
||||||
update_self_mock = mocker.patch("ahriman.core.status.client.Client.update_self")
|
update_self_mock = mocker.patch("ahriman.core.status.client.Client.update_self")
|
||||||
|
|
||||||
StatusUpdate.run(args, "x86_64", configuration, report=False, unsafe=False)
|
StatusUpdate.run(args, "x86_64", configuration, report=False)
|
||||||
update_self_mock.assert_called_once_with(args.status)
|
update_self_mock.assert_called_once_with(args.status)
|
||||||
|
|
||||||
|
|
||||||
@ -50,7 +50,7 @@ def test_run_packages(args: argparse.Namespace, configuration: Configuration, re
|
|||||||
mocker.patch("ahriman.core.repository.Repository.load", return_value=repository)
|
mocker.patch("ahriman.core.repository.Repository.load", return_value=repository)
|
||||||
update_mock = mocker.patch("ahriman.core.status.client.Client.update")
|
update_mock = mocker.patch("ahriman.core.status.client.Client.update")
|
||||||
|
|
||||||
StatusUpdate.run(args, "x86_64", configuration, report=False, unsafe=False)
|
StatusUpdate.run(args, "x86_64", configuration, report=False)
|
||||||
update_mock.assert_called_once_with(package_ahriman.base, args.status)
|
update_mock.assert_called_once_with(package_ahriman.base, args.status)
|
||||||
|
|
||||||
|
|
||||||
@ -65,7 +65,7 @@ def test_run_remove(args: argparse.Namespace, configuration: Configuration, repo
|
|||||||
mocker.patch("ahriman.core.repository.Repository.load", return_value=repository)
|
mocker.patch("ahriman.core.repository.Repository.load", return_value=repository)
|
||||||
update_mock = mocker.patch("ahriman.core.status.client.Client.remove")
|
update_mock = mocker.patch("ahriman.core.status.client.Client.remove")
|
||||||
|
|
||||||
StatusUpdate.run(args, "x86_64", configuration, report=False, unsafe=False)
|
StatusUpdate.run(args, "x86_64", configuration, report=False)
|
||||||
update_mock.assert_called_once_with(package_ahriman.base)
|
update_mock.assert_called_once_with(package_ahriman.base)
|
||||||
|
|
||||||
|
|
||||||
@ -78,9 +78,8 @@ def test_imply_with_report(args: argparse.Namespace, configuration: Configuratio
|
|||||||
mocker.patch("ahriman.core.database.SQLite.load", return_value=database)
|
mocker.patch("ahriman.core.database.SQLite.load", return_value=database)
|
||||||
load_mock = mocker.patch("ahriman.core.repository.Repository.load")
|
load_mock = mocker.patch("ahriman.core.repository.Repository.load")
|
||||||
|
|
||||||
StatusUpdate.run(args, "x86_64", configuration, report=False, unsafe=False)
|
StatusUpdate.run(args, "x86_64", configuration, report=False)
|
||||||
load_mock.assert_called_once_with("x86_64", configuration, database,
|
load_mock.assert_called_once_with("x86_64", configuration, database, report=True, refresh_pacman_database=0)
|
||||||
report=True, unsafe=False, refresh_pacman_database=0)
|
|
||||||
|
|
||||||
|
|
||||||
def test_disallow_auto_architecture_run() -> None:
|
def test_disallow_auto_architecture_run() -> None:
|
||||||
|
@ -18,7 +18,7 @@ def test_run(args: argparse.Namespace, configuration: Configuration, repository:
|
|||||||
application_mock = mocker.patch("ahriman.core.tree.Tree.resolve", return_value=[[package_ahriman]])
|
application_mock = mocker.patch("ahriman.core.tree.Tree.resolve", return_value=[[package_ahriman]])
|
||||||
print_mock = mocker.patch("ahriman.core.formatters.Printer.print")
|
print_mock = mocker.patch("ahriman.core.formatters.Printer.print")
|
||||||
|
|
||||||
Structure.run(args, "x86_64", configuration, report=False, unsafe=False)
|
Structure.run(args, "x86_64", configuration, report=False)
|
||||||
application_mock.assert_called_once_with([package_ahriman])
|
application_mock.assert_called_once_with([package_ahriman])
|
||||||
print_mock.assert_called_once_with(verbose=True, separator=" ")
|
print_mock.assert_called_once_with(verbose=True, separator=" ")
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ def test_run(args: argparse.Namespace, configuration: Configuration, repository:
|
|||||||
application_mock = mocker.patch("ahriman.application.application.Application.on_result")
|
application_mock = mocker.patch("ahriman.application.application.Application.on_result")
|
||||||
on_start_mock = mocker.patch("ahriman.application.application.Application.on_start")
|
on_start_mock = mocker.patch("ahriman.application.application.Application.on_start")
|
||||||
|
|
||||||
Triggers.run(args, "x86_64", configuration, report=False, unsafe=False)
|
Triggers.run(args, "x86_64", configuration, report=False)
|
||||||
application_mock.assert_called_once_with(Result())
|
application_mock.assert_called_once_with(Result())
|
||||||
on_start_mock.assert_called_once_with()
|
on_start_mock.assert_called_once_with()
|
||||||
|
|
||||||
@ -50,6 +50,6 @@ def test_run_trigger(args: argparse.Namespace, configuration: Configuration, rep
|
|||||||
report_mock = mocker.patch("ahriman.core.report.ReportTrigger.on_result")
|
report_mock = mocker.patch("ahriman.core.report.ReportTrigger.on_result")
|
||||||
upload_mock = mocker.patch("ahriman.core.upload.UploadTrigger.on_result")
|
upload_mock = mocker.patch("ahriman.core.upload.UploadTrigger.on_result")
|
||||||
|
|
||||||
Triggers.run(args, "x86_64", configuration, report=False, unsafe=False)
|
Triggers.run(args, "x86_64", configuration, report=False)
|
||||||
report_mock.assert_called_once_with(Result(), [package_ahriman])
|
report_mock.assert_called_once_with(Result(), [package_ahriman])
|
||||||
upload_mock.assert_not_called()
|
upload_mock.assert_not_called()
|
||||||
|
@ -32,7 +32,7 @@ def test_run(args: argparse.Namespace, configuration: Configuration, mocker: Moc
|
|||||||
return_value=["command"])
|
return_value=["command"])
|
||||||
print_mock = mocker.patch("ahriman.core.formatters.Printer.print")
|
print_mock = mocker.patch("ahriman.core.formatters.Printer.print")
|
||||||
|
|
||||||
UnsafeCommands.run(args, "x86_64", configuration, report=False, unsafe=False)
|
UnsafeCommands.run(args, "x86_64", configuration, report=False)
|
||||||
commands_mock.assert_called_once_with(pytest.helpers.anyvar(int))
|
commands_mock.assert_called_once_with(pytest.helpers.anyvar(int))
|
||||||
print_mock.assert_called_once_with(verbose=True)
|
print_mock.assert_called_once_with(verbose=True)
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ def test_run_check(args: argparse.Namespace, configuration: Configuration, mocke
|
|||||||
return_value=["command"])
|
return_value=["command"])
|
||||||
check_mock = mocker.patch("ahriman.application.handlers.UnsafeCommands.check_unsafe")
|
check_mock = mocker.patch("ahriman.application.handlers.UnsafeCommands.check_unsafe")
|
||||||
|
|
||||||
UnsafeCommands.run(args, "x86_64", configuration, report=False, unsafe=False)
|
UnsafeCommands.run(args, "x86_64", configuration, report=False)
|
||||||
commands_mock.assert_called_once_with(pytest.helpers.anyvar(int))
|
commands_mock.assert_called_once_with(pytest.helpers.anyvar(int))
|
||||||
check_mock.assert_called_once_with(["clean"], ["command"], pytest.helpers.anyvar(int))
|
check_mock.assert_called_once_with(["clean"], ["command"], pytest.helpers.anyvar(int))
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ def test_run(args: argparse.Namespace, package_ahriman: Package, configuration:
|
|||||||
on_start_mock = mocker.patch("ahriman.application.application.Application.on_start")
|
on_start_mock = mocker.patch("ahriman.application.application.Application.on_start")
|
||||||
print_mock = mocker.patch("ahriman.application.application.Application.print_updates")
|
print_mock = mocker.patch("ahriman.application.application.Application.print_updates")
|
||||||
|
|
||||||
Update.run(args, "x86_64", configuration, report=False, unsafe=False)
|
Update.run(args, "x86_64", configuration, report=False)
|
||||||
application_mock.assert_called_once_with([package_ahriman],
|
application_mock.assert_called_once_with([package_ahriman],
|
||||||
Packagers(args.username, {package_ahriman.base: "packager"}))
|
Packagers(args.username, {package_ahriman.base: "packager"}))
|
||||||
updates_mock.assert_called_once_with(args.package, aur=args.aur, local=args.local, manual=args.manual, vcs=args.vcs)
|
updates_mock.assert_called_once_with(args.package, aur=args.aur, local=args.local, manual=args.manual, vcs=args.vcs)
|
||||||
@ -75,7 +75,7 @@ def test_run_empty_exception(args: argparse.Namespace, configuration: Configurat
|
|||||||
mocker.patch("ahriman.application.application.Application.updates", return_value=[])
|
mocker.patch("ahriman.application.application.Application.updates", return_value=[])
|
||||||
check_mock = mocker.patch("ahriman.application.handlers.Handler.check_if_empty")
|
check_mock = mocker.patch("ahriman.application.handlers.Handler.check_if_empty")
|
||||||
|
|
||||||
Update.run(args, "x86_64", configuration, report=False, unsafe=False)
|
Update.run(args, "x86_64", configuration, report=False)
|
||||||
check_mock.assert_called_once_with(True, True)
|
check_mock.assert_called_once_with(True, True)
|
||||||
|
|
||||||
|
|
||||||
@ -93,7 +93,7 @@ def test_run_update_empty_exception(args: argparse.Namespace, package_ahriman: P
|
|||||||
mocker.patch("ahriman.application.application.Application.print_updates")
|
mocker.patch("ahriman.application.application.Application.print_updates")
|
||||||
check_mock = mocker.patch("ahriman.application.handlers.Handler.check_if_empty")
|
check_mock = mocker.patch("ahriman.application.handlers.Handler.check_if_empty")
|
||||||
|
|
||||||
Update.run(args, "x86_64", configuration, report=False, unsafe=False)
|
Update.run(args, "x86_64", configuration, report=False)
|
||||||
check_mock.assert_has_calls([MockCall(True, False), MockCall(True, True)])
|
check_mock.assert_has_calls([MockCall(True, False), MockCall(True, True)])
|
||||||
|
|
||||||
|
|
||||||
@ -109,7 +109,7 @@ def test_run_dry_run(args: argparse.Namespace, configuration: Configuration, rep
|
|||||||
check_mock = mocker.patch("ahriman.application.handlers.Handler.check_if_empty")
|
check_mock = mocker.patch("ahriman.application.handlers.Handler.check_if_empty")
|
||||||
updates_mock = mocker.patch("ahriman.application.application.Application.updates")
|
updates_mock = mocker.patch("ahriman.application.application.Application.updates")
|
||||||
|
|
||||||
Update.run(args, "x86_64", configuration, report=False, unsafe=False)
|
Update.run(args, "x86_64", configuration, report=False)
|
||||||
updates_mock.assert_called_once_with(args.package, aur=args.aur, local=args.local, manual=args.manual, vcs=args.vcs)
|
updates_mock.assert_called_once_with(args.package, aur=args.aur, local=args.local, manual=args.manual, vcs=args.vcs)
|
||||||
application_mock.assert_not_called()
|
application_mock.assert_not_called()
|
||||||
check_mock.assert_called_once_with(False, pytest.helpers.anyvar(int))
|
check_mock.assert_called_once_with(False, pytest.helpers.anyvar(int))
|
||||||
|
@ -47,7 +47,7 @@ def test_run(args: argparse.Namespace, configuration: Configuration, database: S
|
|||||||
create_user_mock = mocker.patch("ahriman.application.handlers.Users.user_create", return_value=user)
|
create_user_mock = mocker.patch("ahriman.application.handlers.Users.user_create", return_value=user)
|
||||||
update_mock = mocker.patch("ahriman.core.database.SQLite.user_update")
|
update_mock = mocker.patch("ahriman.core.database.SQLite.user_update")
|
||||||
|
|
||||||
Users.run(args, "x86_64", configuration, report=False, unsafe=False)
|
Users.run(args, "x86_64", configuration, report=False)
|
||||||
create_user_mock.assert_called_once_with(args)
|
create_user_mock.assert_called_once_with(args)
|
||||||
update_mock.assert_called_once_with(user)
|
update_mock.assert_called_once_with(user)
|
||||||
|
|
||||||
@ -63,7 +63,7 @@ def test_run_empty_salt(args: argparse.Namespace, configuration: Configuration,
|
|||||||
mocker.patch("ahriman.models.user.User.hash_password", return_value=user)
|
mocker.patch("ahriman.models.user.User.hash_password", return_value=user)
|
||||||
|
|
||||||
with pytest.raises(configparser.NoOptionError):
|
with pytest.raises(configparser.NoOptionError):
|
||||||
Users.run(args, "x86_64", configuration, report=False, unsafe=False)
|
Users.run(args, "x86_64", configuration, report=False)
|
||||||
|
|
||||||
|
|
||||||
def test_run_empty_salt_without_password(args: argparse.Namespace, configuration: Configuration, database: SQLite,
|
def test_run_empty_salt_without_password(args: argparse.Namespace, configuration: Configuration, database: SQLite,
|
||||||
@ -80,7 +80,7 @@ def test_run_empty_salt_without_password(args: argparse.Namespace, configuration
|
|||||||
create_user_mock = mocker.patch("ahriman.application.handlers.Users.user_create", return_value=user)
|
create_user_mock = mocker.patch("ahriman.application.handlers.Users.user_create", return_value=user)
|
||||||
update_mock = mocker.patch("ahriman.core.database.SQLite.user_update")
|
update_mock = mocker.patch("ahriman.core.database.SQLite.user_update")
|
||||||
|
|
||||||
Users.run(args, "x86_64", configuration, report=False, unsafe=False)
|
Users.run(args, "x86_64", configuration, report=False)
|
||||||
create_user_mock.assert_called_once_with(args)
|
create_user_mock.assert_called_once_with(args)
|
||||||
update_mock.assert_called_once_with(user)
|
update_mock.assert_called_once_with(user)
|
||||||
|
|
||||||
@ -96,7 +96,7 @@ def test_run_list(args: argparse.Namespace, configuration: Configuration, databa
|
|||||||
check_mock = mocker.patch("ahriman.application.handlers.Handler.check_if_empty")
|
check_mock = mocker.patch("ahriman.application.handlers.Handler.check_if_empty")
|
||||||
list_mock = mocker.patch("ahriman.core.database.SQLite.user_list", return_value=[user])
|
list_mock = mocker.patch("ahriman.core.database.SQLite.user_list", return_value=[user])
|
||||||
|
|
||||||
Users.run(args, "x86_64", configuration, report=False, unsafe=False)
|
Users.run(args, "x86_64", configuration, report=False)
|
||||||
list_mock.assert_called_once_with("user", args.role)
|
list_mock.assert_called_once_with("user", args.role)
|
||||||
check_mock.assert_called_once_with(False, False)
|
check_mock.assert_called_once_with(False, False)
|
||||||
|
|
||||||
@ -113,7 +113,7 @@ def test_run_empty_exception(args: argparse.Namespace, configuration: Configurat
|
|||||||
mocker.patch("ahriman.core.database.SQLite.user_list", return_value=[])
|
mocker.patch("ahriman.core.database.SQLite.user_list", return_value=[])
|
||||||
check_mock = mocker.patch("ahriman.application.handlers.Handler.check_if_empty")
|
check_mock = mocker.patch("ahriman.application.handlers.Handler.check_if_empty")
|
||||||
|
|
||||||
Users.run(args, "x86_64", configuration, report=False, unsafe=False)
|
Users.run(args, "x86_64", configuration, report=False)
|
||||||
check_mock.assert_called_once_with(True, True)
|
check_mock.assert_called_once_with(True, True)
|
||||||
|
|
||||||
|
|
||||||
@ -127,7 +127,7 @@ def test_run_remove(args: argparse.Namespace, configuration: Configuration, data
|
|||||||
mocker.patch("ahriman.core.database.SQLite.load", return_value=database)
|
mocker.patch("ahriman.core.database.SQLite.load", return_value=database)
|
||||||
remove_mock = mocker.patch("ahriman.core.database.SQLite.user_remove")
|
remove_mock = mocker.patch("ahriman.core.database.SQLite.user_remove")
|
||||||
|
|
||||||
Users.run(args, "x86_64", configuration, report=False, unsafe=False)
|
Users.run(args, "x86_64", configuration, report=False)
|
||||||
remove_mock.assert_called_once_with(args.username)
|
remove_mock.assert_called_once_with(args.username)
|
||||||
|
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ def test_run(args: argparse.Namespace, configuration: Configuration, mocker: Moc
|
|||||||
print_mock = mocker.patch("ahriman.core.formatters.Printer.print")
|
print_mock = mocker.patch("ahriman.core.formatters.Printer.print")
|
||||||
application_mock = mocker.patch("ahriman.core.configuration.validator.Validator.validate", return_value=False)
|
application_mock = mocker.patch("ahriman.core.configuration.validator.Validator.validate", return_value=False)
|
||||||
|
|
||||||
Validate.run(args, "x86_64", configuration, report=False, unsafe=False)
|
Validate.run(args, "x86_64", configuration, report=False)
|
||||||
|
|
||||||
application_mock.assert_called_once_with(configuration.dump())
|
application_mock.assert_called_once_with(configuration.dump())
|
||||||
print_mock.assert_called_once_with(verbose=True)
|
print_mock.assert_called_once_with(verbose=True)
|
||||||
@ -47,7 +47,7 @@ def test_run_skip(args: argparse.Namespace, configuration: Configuration, mocker
|
|||||||
mocker.patch("ahriman.core.configuration.validator.Validator.validate", return_value=True)
|
mocker.patch("ahriman.core.configuration.validator.Validator.validate", return_value=True)
|
||||||
print_mock = mocker.patch("ahriman.core.formatters.Printer.print")
|
print_mock = mocker.patch("ahriman.core.formatters.Printer.print")
|
||||||
|
|
||||||
Validate.run(args, "x86_64", configuration, report=False, unsafe=False)
|
Validate.run(args, "x86_64", configuration, report=False)
|
||||||
print_mock.assert_not_called()
|
print_mock.assert_not_called()
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ def test_run(args: argparse.Namespace, configuration: Configuration, mocker: Moc
|
|||||||
application_mock = mocker.patch("ahriman.application.handlers.Versions.package_dependencies")
|
application_mock = mocker.patch("ahriman.application.handlers.Versions.package_dependencies")
|
||||||
print_mock = mocker.patch("ahriman.core.formatters.Printer.print")
|
print_mock = mocker.patch("ahriman.core.formatters.Printer.print")
|
||||||
|
|
||||||
Versions.run(args, "x86_64", configuration, report=False, unsafe=False)
|
Versions.run(args, "x86_64", configuration, report=False)
|
||||||
application_mock.assert_called_once_with("ahriman")
|
application_mock.assert_called_once_with("ahriman")
|
||||||
print_mock.assert_has_calls([MockCall(verbose=False, separator=" "), MockCall(verbose=False, separator=" ")])
|
print_mock.assert_has_calls([MockCall(verbose=False, separator=" "), MockCall(verbose=False, separator=" ")])
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ def test_run(args: argparse.Namespace, configuration: Configuration, repository:
|
|||||||
stop_mock = mocker.patch("ahriman.core.spawn.Spawn.stop")
|
stop_mock = mocker.patch("ahriman.core.spawn.Spawn.stop")
|
||||||
join_mock = mocker.patch("ahriman.core.spawn.Spawn.join")
|
join_mock = mocker.patch("ahriman.core.spawn.Spawn.join")
|
||||||
|
|
||||||
Web.run(args, "x86_64", configuration, report=False, unsafe=False)
|
Web.run(args, "x86_64", configuration, report=False)
|
||||||
setup_mock.assert_called_once_with("x86_64", configuration, pytest.helpers.anyvar(int))
|
setup_mock.assert_called_once_with("x86_64", configuration, pytest.helpers.anyvar(int))
|
||||||
run_mock.assert_called_once_with(pytest.helpers.anyvar(int))
|
run_mock.assert_called_once_with(pytest.helpers.anyvar(int))
|
||||||
start_mock.assert_called_once_with()
|
start_mock.assert_called_once_with()
|
||||||
|
@ -57,8 +57,11 @@ def test_check_user(lock: Lock, mocker: MockerFixture) -> None:
|
|||||||
must check user correctly
|
must check user correctly
|
||||||
"""
|
"""
|
||||||
check_user_patch = mocker.patch("ahriman.application.lock.check_user")
|
check_user_patch = mocker.patch("ahriman.application.lock.check_user")
|
||||||
|
tree_create = mocker.patch("ahriman.models.repository_paths.RepositoryPaths.tree_create")
|
||||||
|
|
||||||
lock.check_user()
|
lock.check_user()
|
||||||
check_user_patch.assert_called_once_with(lock.paths, unsafe=False)
|
check_user_patch.assert_called_once_with(lock.paths, unsafe=False)
|
||||||
|
tree_create.assert_called_once_with()
|
||||||
|
|
||||||
|
|
||||||
def test_check_user_exception(lock: Lock, mocker: MockerFixture) -> None:
|
def test_check_user_exception(lock: Lock, mocker: MockerFixture) -> None:
|
||||||
@ -70,10 +73,11 @@ def test_check_user_exception(lock: Lock, mocker: MockerFixture) -> None:
|
|||||||
lock.check_user()
|
lock.check_user()
|
||||||
|
|
||||||
|
|
||||||
def test_check_user_unsafe(lock: Lock) -> None:
|
def test_check_user_unsafe(lock: Lock, mocker: MockerFixture) -> None:
|
||||||
"""
|
"""
|
||||||
must skip user check if unsafe flag set
|
must skip user check if unsafe flag set
|
||||||
"""
|
"""
|
||||||
|
mocker.patch("ahriman.models.repository_paths.RepositoryPaths.tree_create")
|
||||||
lock.unsafe = True
|
lock.unsafe = True
|
||||||
lock.check_user()
|
lock.check_user()
|
||||||
|
|
||||||
|
@ -443,9 +443,8 @@ def repository(configuration: Configuration, database: SQLite, mocker: MockerFix
|
|||||||
Returns:
|
Returns:
|
||||||
Repository: repository test instance
|
Repository: repository test instance
|
||||||
"""
|
"""
|
||||||
mocker.patch("ahriman.models.repository_paths.RepositoryPaths.tree_create")
|
|
||||||
mocker.patch("ahriman.core.repository.Repository._set_context")
|
mocker.patch("ahriman.core.repository.Repository._set_context")
|
||||||
return Repository.load("x86_64", configuration, database, report=False, unsafe=False)
|
return Repository.load("x86_64", configuration, database, report=False)
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
|
@ -7,23 +7,23 @@ from ahriman.core.database import SQLite
|
|||||||
from ahriman.core.repository.cleaner import Cleaner
|
from ahriman.core.repository.cleaner import Cleaner
|
||||||
from ahriman.core.repository.executor import Executor
|
from ahriman.core.repository.executor import Executor
|
||||||
from ahriman.core.repository.update_handler import UpdateHandler
|
from ahriman.core.repository.update_handler import UpdateHandler
|
||||||
|
from ahriman.models.pacman_synchronization import PacmanSynchronization
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def cleaner(configuration: Configuration, database: SQLite, mocker: MockerFixture) -> Cleaner:
|
def cleaner(configuration: Configuration, database: SQLite) -> Cleaner:
|
||||||
"""
|
"""
|
||||||
fixture for cleaner
|
fixture for cleaner
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
configuration(Configuration): configuration fixture
|
configuration(Configuration): configuration fixture
|
||||||
database(SQLite): database fixture
|
database(SQLite): database fixture
|
||||||
mocker(MockerFixture): mocker object
|
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
Cleaner: cleaner test instance
|
Cleaner: cleaner test instance
|
||||||
"""
|
"""
|
||||||
mocker.patch("ahriman.models.repository_paths.RepositoryPaths.tree_create")
|
return Cleaner("x86_64", configuration, database, report=False,
|
||||||
return Cleaner("x86_64", configuration, database, report=False, unsafe=False, refresh_pacman_database=0)
|
refresh_pacman_database=PacmanSynchronization.Disabled)
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
@ -43,8 +43,8 @@ def executor(configuration: Configuration, database: SQLite, mocker: MockerFixtu
|
|||||||
mocker.patch("ahriman.core.repository.cleaner.Cleaner.clear_chroot")
|
mocker.patch("ahriman.core.repository.cleaner.Cleaner.clear_chroot")
|
||||||
mocker.patch("ahriman.core.repository.cleaner.Cleaner.clear_packages")
|
mocker.patch("ahriman.core.repository.cleaner.Cleaner.clear_packages")
|
||||||
mocker.patch("ahriman.core.repository.cleaner.Cleaner.clear_queue")
|
mocker.patch("ahriman.core.repository.cleaner.Cleaner.clear_queue")
|
||||||
mocker.patch("ahriman.models.repository_paths.RepositoryPaths.tree_create")
|
return Executor("x86_64", configuration, database, report=False,
|
||||||
return Executor("x86_64", configuration, database, report=False, unsafe=False, refresh_pacman_database=0)
|
refresh_pacman_database=PacmanSynchronization.Disabled)
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
@ -64,5 +64,5 @@ def update_handler(configuration: Configuration, database: SQLite, mocker: Mocke
|
|||||||
mocker.patch("ahriman.core.repository.cleaner.Cleaner.clear_chroot")
|
mocker.patch("ahriman.core.repository.cleaner.Cleaner.clear_chroot")
|
||||||
mocker.patch("ahriman.core.repository.cleaner.Cleaner.clear_packages")
|
mocker.patch("ahriman.core.repository.cleaner.Cleaner.clear_packages")
|
||||||
mocker.patch("ahriman.core.repository.cleaner.Cleaner.clear_queue")
|
mocker.patch("ahriman.core.repository.cleaner.Cleaner.clear_queue")
|
||||||
mocker.patch("ahriman.models.repository_paths.RepositoryPaths.tree_create")
|
return UpdateHandler("x86_64", configuration, database, report=False,
|
||||||
return UpdateHandler("x86_64", configuration, database, report=False, unsafe=False, refresh_pacman_database=0)
|
refresh_pacman_database=PacmanSynchronization.Disabled)
|
||||||
|
@ -17,9 +17,8 @@ def test_load(configuration: Configuration, database: SQLite, mocker: MockerFixt
|
|||||||
"""
|
"""
|
||||||
must correctly load instance
|
must correctly load instance
|
||||||
"""
|
"""
|
||||||
mocker.patch("ahriman.models.repository_paths.RepositoryPaths.tree_create")
|
|
||||||
context_mock = mocker.patch("ahriman.core.repository.Repository._set_context")
|
context_mock = mocker.patch("ahriman.core.repository.Repository._set_context")
|
||||||
Repository.load("x86_64", configuration, database, report=False, unsafe=False)
|
Repository.load("x86_64", configuration, database, report=False)
|
||||||
context_mock.assert_called_once_with()
|
context_mock.assert_called_once_with()
|
||||||
|
|
||||||
|
|
||||||
@ -27,10 +26,9 @@ def test_set_context(configuration: Configuration, database: SQLite, mocker: Moc
|
|||||||
"""
|
"""
|
||||||
must set context variables
|
must set context variables
|
||||||
"""
|
"""
|
||||||
mocker.patch("ahriman.models.repository_paths.RepositoryPaths.tree_create")
|
|
||||||
set_mock = mocker.patch("ahriman.core._Context.set")
|
set_mock = mocker.patch("ahriman.core._Context.set")
|
||||||
|
|
||||||
instance = Repository.load("x86_64", configuration, database, report=False, unsafe=False)
|
instance = Repository.load("x86_64", configuration, database, report=False)
|
||||||
set_mock.assert_has_calls([
|
set_mock.assert_has_calls([
|
||||||
MockCall(ContextKey("database", SQLite), instance.database),
|
MockCall(ContextKey("database", SQLite), instance.database),
|
||||||
MockCall(ContextKey("configuration", Configuration), instance.configuration),
|
MockCall(ContextKey("configuration", Configuration), instance.configuration),
|
||||||
|
@ -1,39 +1,11 @@
|
|||||||
from pytest_mock import MockerFixture
|
from pytest_mock import MockerFixture
|
||||||
|
|
||||||
from ahriman.core.configuration import Configuration
|
|
||||||
from ahriman.core.database import SQLite
|
|
||||||
from ahriman.core.exceptions import UnsafeRunError
|
|
||||||
from ahriman.core.repository.repository_properties import RepositoryProperties
|
from ahriman.core.repository.repository_properties import RepositoryProperties
|
||||||
from ahriman.models.packagers import Packagers
|
from ahriman.models.packagers import Packagers
|
||||||
from ahriman.models.pacman_synchronization import PacmanSynchronization
|
|
||||||
from ahriman.models.user import User
|
from ahriman.models.user import User
|
||||||
from ahriman.models.user_access import UserAccess
|
from ahriman.models.user_access import UserAccess
|
||||||
|
|
||||||
|
|
||||||
def test_create_tree_on_load(configuration: Configuration, database: SQLite, mocker: MockerFixture) -> None:
|
|
||||||
"""
|
|
||||||
must create tree on load
|
|
||||||
"""
|
|
||||||
mocker.patch("ahriman.core.repository.repository_properties.check_user")
|
|
||||||
tree_create_mock = mocker.patch("ahriman.models.repository_paths.RepositoryPaths.tree_create")
|
|
||||||
RepositoryProperties("x86_64", configuration, database, report=False, unsafe=False,
|
|
||||||
refresh_pacman_database=PacmanSynchronization.Disabled)
|
|
||||||
|
|
||||||
tree_create_mock.assert_called_once_with()
|
|
||||||
|
|
||||||
|
|
||||||
def test_create_tree_on_load_unsafe(configuration: Configuration, database: SQLite, mocker: MockerFixture) -> None:
|
|
||||||
"""
|
|
||||||
must not create tree on load in case if user differs from the root owner
|
|
||||||
"""
|
|
||||||
mocker.patch("ahriman.core.repository.repository_properties.check_user", side_effect=UnsafeRunError(0, 1))
|
|
||||||
tree_create_mock = mocker.patch("ahriman.models.repository_paths.RepositoryPaths.tree_create")
|
|
||||||
RepositoryProperties("x86_64", configuration, database, report=False, unsafe=False,
|
|
||||||
refresh_pacman_database=PacmanSynchronization.Disabled)
|
|
||||||
|
|
||||||
tree_create_mock.assert_not_called()
|
|
||||||
|
|
||||||
|
|
||||||
def test_packager(repository: RepositoryProperties, mocker: MockerFixture) -> None:
|
def test_packager(repository: RepositoryProperties, mocker: MockerFixture) -> None:
|
||||||
"""
|
"""
|
||||||
must extract packager
|
must extract packager
|
||||||
|
@ -19,7 +19,7 @@ def test_force_no_report(configuration: Configuration, database: SQLite, mocker:
|
|||||||
load_mock = mocker.patch("ahriman.core.repository.Repository.load")
|
load_mock = mocker.patch("ahriman.core.repository.Repository.load")
|
||||||
|
|
||||||
Watcher("x86_64", configuration, database)
|
Watcher("x86_64", configuration, database)
|
||||||
load_mock.assert_called_once_with("x86_64", configuration, database, report=False, unsafe=False)
|
load_mock.assert_called_once_with("x86_64", configuration, database, report=False)
|
||||||
|
|
||||||
|
|
||||||
def test_get(watcher: Watcher, package_ahriman: Package) -> None:
|
def test_get(watcher: Watcher, package_ahriman: Package) -> None:
|
||||||
|
Loading…
Reference in New Issue
Block a user