jw.pkg.cmds.distro.backend.redhat: Add Module

Add backend for YAM-based package management, as used by RHEL,
Fedora, CentOS.

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2026-01-28 07:30:34 +01:00
commit f6a8b6307a
5 changed files with 65 additions and 0 deletions

View file

@ -0,0 +1,14 @@
# -*- coding: utf-8 -*-
from ...Cmd import Cmd
from ..BackendCmd import BackendCmd
class Base(BackendCmd):
def __init__(self, parent: Cmd):
super().__init__(parent)
async def yum(self, *args):
cmd = ['/usr/bin/yum']
cmd.extend(args)
return await self._sudo(cmd)

View file

@ -0,0 +1,14 @@
# -*- coding: utf-8 -*-
from argparse import Namespace
from ...Cmd import Cmd
from .Base import Base
class Dup(Base):
def __init__(self, parent: Cmd):
super().__init__(parent)
async def run(self, args: Namespace):
raise NotImplementedError('distro dup is not yet implemented for Red Hat-like distributions')

View file

@ -0,0 +1,18 @@
# -*- coding: utf-8 -*-
from argparse import Namespace
from ...Cmd import Cmd
from .Base import Base
class Install(Base):
def __init__(self, parent: Cmd):
super().__init__(parent)
async def run(self, args: Namespace):
yum_args = ['install']
if not self.interactive:
yum_args.append['-y']
yum_args.extend(args.packages)
return await self.yum(*yum_args)

View file

@ -0,0 +1,4 @@
TOPDIR = ../../../../../../../..
include $(TOPDIR)/make/proj.mk
include $(JWBDIR)/make/py-mod.mk

View file

@ -0,0 +1,15 @@
# -*- coding: utf-8 -*-
from argparse import Namespace
from ...Cmd import Cmd
from .Base import Base
class Refresh(Base):
def __init__(self, parent: Cmd):
super().__init__(parent)
async def run(self, args: Namespace):
await self.yum('clean', 'expire-cache')
await self.yum('makecache')