diff --git a/src/python/jw/pkg/cmds/distro/backend/suse/Base.py b/src/python/jw/pkg/cmds/distro/backend/suse/Base.py new file mode 100644 index 00000000..8b737d58 --- /dev/null +++ b/src/python/jw/pkg/cmds/distro/backend/suse/Base.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +from ...Cmd import Cmd +from ..BackendCmd import BackendCmd + +class Base(BackendCmd): + + 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) + return await self._sudo(cmd) diff --git a/src/python/jw/pkg/cmds/distro/backend/suse/Dup.py b/src/python/jw/pkg/cmds/distro/backend/suse/Dup.py new file mode 100644 index 00000000..7e728e79 --- /dev/null +++ b/src/python/jw/pkg/cmds/distro/backend/suse/Dup.py @@ -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): + return await self.zypper('dup', '--force-resolution', '--auto-agree-with-licenses') diff --git a/src/python/jw/pkg/cmds/distro/backend/suse/Install.py b/src/python/jw/pkg/cmds/distro/backend/suse/Install.py new file mode 100644 index 00000000..df198881 --- /dev/null +++ b/src/python/jw/pkg/cmds/distro/backend/suse/Install.py @@ -0,0 +1,14 @@ +# -*- 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): + return await self.zypper('install', *args.packages) diff --git a/src/python/jw/pkg/cmds/distro/backend/suse/Makefile b/src/python/jw/pkg/cmds/distro/backend/suse/Makefile new file mode 100644 index 00000000..d8d0e64b --- /dev/null +++ b/src/python/jw/pkg/cmds/distro/backend/suse/Makefile @@ -0,0 +1,4 @@ +TOPDIR = ../../../../../../../.. + +include $(TOPDIR)/make/proj.mk +include $(JWBDIR)/make/py-mod.mk diff --git a/src/python/jw/pkg/cmds/distro/backend/suse/Refresh.py b/src/python/jw/pkg/cmds/distro/backend/suse/Refresh.py new file mode 100644 index 00000000..81350671 --- /dev/null +++ b/src/python/jw/pkg/cmds/distro/backend/suse/Refresh.py @@ -0,0 +1,14 @@ +# -*- 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): + return await self.zypper('refresh')