pkghelper: dry run handling
This commit is contained in:
parent
18710aef48
commit
ad881dc948
|
@ -34,9 +34,10 @@ class PackageInstaller:
|
|||
by the server installer.
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self, app):
|
||||
self.pkgs: Dict[str, asyncio.Task] = {}
|
||||
self._cache: Optional[apt.Cache] = None
|
||||
self.app = app
|
||||
|
||||
@property
|
||||
def cache(self):
|
||||
|
@ -70,6 +71,10 @@ class PackageInstaller:
|
|||
if binpkg.installed:
|
||||
log.debug("%s already installed", pkgname)
|
||||
return PackageInstallState.DONE
|
||||
if self.app.opts.dry_run:
|
||||
log.debug("dry-run apt-get install %s", pkgname)
|
||||
await asyncio.sleep(2 / self.app.scale_factor)
|
||||
return PackageInstallState.DONE
|
||||
if not binpkg.candidate.uri.startswith("cdrom:"):
|
||||
log.debug(
|
||||
"%s not available from cdrom (rather %s)", pkgname, binpkg.candidate.uri
|
||||
|
|
|
@ -291,7 +291,7 @@ class SubiquityServer(Application):
|
|||
self.event_syslog_id = "subiquity_event.{}".format(os.getpid())
|
||||
self.log_syslog_id = "subiquity_log.{}".format(os.getpid())
|
||||
self.command_runner = get_command_runner(self)
|
||||
self.package_installer = PackageInstaller()
|
||||
self.package_installer = PackageInstaller(self)
|
||||
|
||||
self.error_reporter = ErrorReporter(
|
||||
self.context.child("ErrorReporter"), self.opts.dry_run, self.root
|
||||
|
|
Loading…
Reference in New Issue