jw.pkg.cmds.distro.CmdDup: Support --donwload-only

Add --download-only to the options of jw-pkg.py distro dup, which
makes the command only download packages from the repositories
without installing them.

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2026-03-03 11:08:02 +01:00
commit 888ea9979a
5 changed files with 19 additions and 4 deletions

View file

@ -12,6 +12,8 @@ class CmdDup(Cmd): # export
def add_arguments(self, parser: ArgumentParser) -> None:
super().add_arguments(parser)
parser.add_argument('--download-only', default=False, action='store_true',
help='Only download packages from the repos, don\'t install them, yet')
async def _run(self, args: Namespace) -> None:
return await self._backend.run(args)

View file

@ -11,4 +11,7 @@ class Dup(Base):
super().__init__(parent)
async def run(self, args: Namespace):
raise NotImplementedError('distro dup is not yet implemented for Arch-like distributions')
pm_args = ['-Su']
if args.download_only:
pm_args.append('-w')
return await self.util.pacman(pm_args)

View file

@ -11,4 +11,8 @@ class Dup(Base):
super().__init__(parent)
async def run(self, args: Namespace):
raise NotImplementedError('distro dup is not yet implemented for Debian-like distributions')
apt_get_args: list[str] = []
if args.download_only:
apt_get_args.append('--download-only')
apt_get_args.append('upgrade')
return await self.apt_get(apt_get_args)

View file

@ -11,4 +11,7 @@ class Dup(Base):
super().__init__(parent)
async def run(self, args: Namespace):
raise NotImplementedError('distro dup is not yet implemented for Red Hat-like distributions')
yum_args: list[str] = ['update']
if args.download_only:
yum_args.append('--downloadonly')
return await self.yum(yum_args)

View file

@ -11,4 +11,7 @@ class Dup(Base):
super().__init__(parent)
async def run(self, args: Namespace):
return await self.util.zypper(['dup', '--force-resolution', '--auto-agree-with-licenses'])
zypper_args = ['dup', '--force-resolution', '--auto-agree-with-licenses']
if args.download_only:
zypper_args.append('--download-only')
return await self.util.zypper(zypper_args)