jw.pkg.cmds.distro.backend.*.Base -> Util

Rename the class Base of all distribution backends to Util. It
contains distribution specifics, but is not going to be the base
class anymore shortly.

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2026-02-17 11:14:39 +01:00
commit 05f3f33931
16 changed files with 28 additions and 28 deletions

View file

@ -3,9 +3,9 @@
from argparse import Namespace
from ...Cmd import Cmd
from .Base import Base
from .Util import Util
class Dup(Base):
class Dup(Util):
def __init__(self, parent: Cmd):
super().__init__(parent)

View file

@ -3,9 +3,9 @@
from argparse import Namespace
from ...Cmd import Cmd
from .Base import Base
from .Util import Util
class Install(Base):
class Install(Util):
def __init__(self, parent: Cmd):
super().__init__(parent)

View file

@ -3,9 +3,9 @@
from argparse import Namespace
from ...Cmd import Cmd
from .Base import Base
from .Util import Util
class Refresh(Base):
class Refresh(Util):
def __init__(self, parent: Cmd):
super().__init__(parent)

View file

@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-
from ...Cmd import Cmd
from ..Backend import Backend
class Util(Backend):
def __init__(self, parent: Cmd):
super().__init__(parent)
async def pacman(self, *args):
cmd = ['/usr/bin/pacman']
if not self.interactive:
cmd.extend(['--noconfirm'])
cmd.extend(args)
return await self._sudo(cmd)

View file

@ -3,9 +3,9 @@
from argparse import Namespace
from ...Cmd import Cmd
from .Base import Base
from .Util import Util
class Dup(Base):
class Dup(Util):
def __init__(self, parent: Cmd):
super().__init__(parent)

View file

@ -3,9 +3,9 @@
from argparse import Namespace
from ...Cmd import Cmd
from .Base import Base
from .Util import Util
class Install(Base):
class Install(Util):
def __init__(self, parent: Cmd):
super().__init__(parent)

View file

@ -3,9 +3,9 @@
from argparse import Namespace
from ...Cmd import Cmd
from .Base import Base
from .Util import Util
class Refresh(Base):
class Refresh(Util):
def __init__(self, parent: Cmd):
super().__init__(parent)

View file

@ -0,0 +1,18 @@
# -*- coding: utf-8 -*-
from ...Cmd import Cmd
from ..Backend import Backend
class Util(Backend):
def __init__(self, parent: Cmd):
super().__init__(parent)
async def apt_get(self, *args):
cmd = ['/usr/bin/apt-get']
mod_env = None
if not self.interactive:
cmd.extend(['-yes', '--quiet', '--fix-broken'])
mod_env = { 'DEBIAN_FRONTEND': 'noninteractive' }
cmd.extend(args)
return await self._sudo(cmd, mod_env=mod_env)

View file

@ -3,9 +3,9 @@
from argparse import Namespace
from ...Cmd import Cmd
from .Base import Base
from .Util import Util
class Dup(Base):
class Dup(Util):
def __init__(self, parent: Cmd):
super().__init__(parent)

View file

@ -3,9 +3,9 @@
from argparse import Namespace
from ...Cmd import Cmd
from .Base import Base
from .Util import Util
class Install(Base):
class Install(Util):
def __init__(self, parent: Cmd):
super().__init__(parent)

View file

@ -3,9 +3,9 @@
from argparse import Namespace
from ...Cmd import Cmd
from .Base import Base
from .Util import Util
class Refresh(Base):
class Refresh(Util):
def __init__(self, parent: Cmd):
super().__init__(parent)

View file

@ -0,0 +1,14 @@
# -*- coding: utf-8 -*-
from ...Cmd import Cmd
from ..Backend import Backend
class Util(Backend):
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

@ -3,9 +3,9 @@
from argparse import Namespace
from ...Cmd import Cmd
from .Base import Base
from .Util import Util
class Dup(Base):
class Dup(Util):
def __init__(self, parent: Cmd):
super().__init__(parent)

View file

@ -3,9 +3,9 @@
from argparse import Namespace
from ...Cmd import Cmd
from .Base import Base
from .Util import Util
class Install(Base):
class Install(Util):
def __init__(self, parent: Cmd):
super().__init__(parent)

View file

@ -3,9 +3,9 @@
from argparse import Namespace
from ...Cmd import Cmd
from .Base import Base
from .Util import Util
class Refresh(Base):
class Refresh(Util):
def __init__(self, parent: Cmd):
super().__init__(parent)

View file

@ -0,0 +1,17 @@
# -*- coding: utf-8 -*-
from ...Cmd import Cmd
from ..Backend import Backend
class Util(Backend):
def __init__(self, parent: Cmd):
super().__init__(parent)
async def zypper(self, *args):
cmd = ['/usr/bin/zypper']
if not self.interactive:
cmd.extend(['--non-interactive', '--gpg-auto-import-keys', '--no-gpg-checks'])
cmd.extend(args)
# Run sudo --login in case /etc/profile modifies ZYPP_CONF
return await self._sudo(cmd, opts=['--login'])