lib.distros.redhat.Distro: Add missing file
All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 4m3s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 3m54s
CI / Packaging test (pull_request) Successful in 0s
CI / Packaging - Kali Linux (push) Successful in 4m8s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 4m11s
CI / Packaging test (push) Successful in 0s

Add the (untested) module lib.distros.redhat.Distro. It had been
lingering in the source tree, but I've apparently forgotten to add it
to Git. It has never seen any real use because CI still doesn't run
a RedHat distro, so it is to be regarded as a stub. Which is better
than nothing.

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2026-08-14 01:57:05 +02:00
commit 15b2735afa
Signed by: Jan Lindemann
GPG key ID: 3750640C9E25DD61

View file

@ -0,0 +1,79 @@
from __future__ import annotations
from typing import TYPE_CHECKING, override
from ...Distro import Distro as Base
from ...pm.rpm import list_files, query_packages, run_rpm
if TYPE_CHECKING:
from typing import Any, Collection, Iterable
from ...base import Result
from ...ExecContext import ExecContext
from ...Package import Package
class Distro(Base):
async def yum(
self, args: list[str], verbose: bool = True, sudo: bool = True
) -> Result:
cmd = ['/usr/bin/yum']
cmd.extend(args)
if sudo:
return await self.sudo(cmd, verbose = verbose)
return await self.run(cmd, verbose = verbose)
async def rpm(
self,
*args: Any,
ec: ExecContext | None = None,
**kwargs: Any,
) -> str:
if ec is None:
ec = self.ctx
kwargs['ec'] = ec
return await run_rpm(*args, **kwargs)
def __init__(self, *args: Any, **kwargs: Any) -> None:
super().__init__(*args, **kwargs)
@override
async def _ref(self) -> None:
await self.yum(['clean', 'expire-cache'])
await self.yum(['makecache'])
@override
async def _dup(self, download_only: bool) -> None:
args: list[str] = ['update']
if download_only:
args.append('--downloadonly')
await self.yum(args)
@override
async def _reboot_required(self, verbose: bool) -> bool:
raise NotImplementedError()
@override
async def _select_by_name(self, names: Collection[str]) -> Iterable[Package]:
return await query_packages(names, ec = self.ctx)
@override
async def _install(self, names: Iterable[str], only_update: bool) -> None:
args = ['update' if only_update else 'install']
if not self.interactive:
args.append('-y')
args.extend(names)
await self.yum(args)
@override
async def _delete(self, names: Iterable[str]) -> None:
await self.rpm(['-e', *names], sudo = True)
@override
async def _pkg_files(self, name: str) -> Iterable[str]:
return await list_files(name, ec = self.ctx)
async def _download(self, name: str, tmp_dir: str) -> str:
raise NotImplementedError(
'distro pkg download is not yet implemented for RedHat distributions'
)