mirror of
ssh://git.janware.com/janware/proj/jw-pkg
synced 2026-04-25 09:35:54 +02:00
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:
parent
3ca544a32d
commit
f6a8b6307a
5 changed files with 65 additions and 0 deletions
14
src/python/jw/pkg/cmds/distro/backend/redhat/Base.py
Normal file
14
src/python/jw/pkg/cmds/distro/backend/redhat/Base.py
Normal 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)
|
||||
14
src/python/jw/pkg/cmds/distro/backend/redhat/Dup.py
Normal file
14
src/python/jw/pkg/cmds/distro/backend/redhat/Dup.py
Normal 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')
|
||||
18
src/python/jw/pkg/cmds/distro/backend/redhat/Install.py
Normal file
18
src/python/jw/pkg/cmds/distro/backend/redhat/Install.py
Normal 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)
|
||||
4
src/python/jw/pkg/cmds/distro/backend/redhat/Makefile
Normal file
4
src/python/jw/pkg/cmds/distro/backend/redhat/Makefile
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
TOPDIR = ../../../../../../../..
|
||||
|
||||
include $(TOPDIR)/make/proj.mk
|
||||
include $(JWBDIR)/make/py-mod.mk
|
||||
15
src/python/jw/pkg/cmds/distro/backend/redhat/Refresh.py
Normal file
15
src/python/jw/pkg/cmds/distro/backend/redhat/Refresh.py
Normal 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')
|
||||
Loading…
Add table
Add a link
Reference in a new issue