mirror of
ssh://git.janware.com/janware/proj/jw-pkg
synced 2026-04-28 13:55:24 +02:00
lib.pm: Add parameter ec: ExecContext to functions
Functions in lib.pm (i.e. run_dpkg(), run_rpm() and friends) also get an ExecContext-type parameter. Use them in lib/distros/*/Distro. Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
1325222fbd
commit
525fa34387
5 changed files with 37 additions and 27 deletions
|
|
@ -29,20 +29,20 @@ class Distro(Base):
|
|||
args = ['-Su']
|
||||
if args.download_only:
|
||||
args.append('-w')
|
||||
return await self.util.pacman(args)
|
||||
return await self.pacman(args)
|
||||
|
||||
async def _reboot_required(self, verbose: bool) -> bool:
|
||||
raise NotImplementedError('distro reboot-required is not yet implemented for Arch-like distributions')
|
||||
|
||||
async def _select(self, names: Iterable[str]) -> Iterable[Package]:
|
||||
return await query_packages(names)
|
||||
raise NotImplementedError('distro select is not yet implemented for Arch-like distributions')
|
||||
|
||||
async def _install(self, names: Iterable[str], only_update: bool) -> None:
|
||||
if only_update:
|
||||
raise NotImplementedError('--only-update is not yet implemented for pacman')
|
||||
args = ['-S', '--needed']
|
||||
args.extend(args.packages)
|
||||
await self.util.pacman(args)
|
||||
await self.pacman(args)
|
||||
|
||||
async def _delete(self, names: Iterable[str]) -> None:
|
||||
raise NotImplementedError('distro delete not yet implemented for Arch-like distributions')
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ class Distro(Base):
|
|||
return await self.sudo(cmd, mod_env=mod_env)
|
||||
|
||||
async def dpkg(self, *args, **kwargs):
|
||||
return await run_dpkg(*args, **kwargs)
|
||||
return await run_dpkg(*args, ec=self.ctx, **kwargs)
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
|
|
@ -58,7 +58,7 @@ class Distro(Base):
|
|||
return False
|
||||
|
||||
async def _select(self, names: Iterable[str]) -> Iterable[Package]:
|
||||
return await query_packages(names)
|
||||
return await query_packages(names, ec=self.ctx)
|
||||
|
||||
async def _install(self, names: Iterable[str], only_update: bool) -> None:
|
||||
args = ['install']
|
||||
|
|
@ -72,4 +72,4 @@ class Distro(Base):
|
|||
return await self.dpkg(['-P', *names], sudo=True)
|
||||
|
||||
async def _pkg_files(self, name: str) -> Iterable[str]:
|
||||
return await list_files(name)
|
||||
return await list_files(name, ec=self.ctx)
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ class Distro(Base):
|
|||
return await self.run(cmd, verbose=verbose)
|
||||
|
||||
async def rpm(self, *args, **kwargs) -> Result:
|
||||
return await run_rpm(*args, **kwargs)
|
||||
return await run_rpm(*args, ec=self.ctx, **kwargs)
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
|
|
@ -50,7 +50,7 @@ class Distro(Base):
|
|||
return False
|
||||
|
||||
async def _select(self, names: Iterable[str]) -> Iterable[Package]:
|
||||
return await query_packages(names)
|
||||
return await query_packages(names, ec=self.ctx)
|
||||
|
||||
async def _install(self, names: Iterable[str], only_update: bool) -> None:
|
||||
cmd = 'update' if only_update else 'install'
|
||||
|
|
@ -60,4 +60,4 @@ class Distro(Base):
|
|||
return await self.rpm(['-e', *names], sudo=True)
|
||||
|
||||
async def _pkg_files(self, name: str) -> Iterable[str]:
|
||||
return await list_files(name)
|
||||
return await list_files(name, ec=self.ctx)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue