mirror of
ssh://git.janware.com/janware/proj/jw-pkg
synced 2026-04-25 09:35:54 +02:00
jw.pkg.cmds.distro.lib.rpm.list_files(): Add function
Add a function list_files, which takes a package name and returns the contained files in a list. Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
2906c697de
commit
aebd9bb5e6
1 changed files with 7 additions and 2 deletions
|
|
@ -6,7 +6,7 @@ from ....lib.util import run_cmd, run_sudo
|
|||
|
||||
from .Package import Package
|
||||
|
||||
async def run_rpm(*args, sudo=False):
|
||||
async def run_rpm(*args, sudo=False): # export
|
||||
cmd = ['/usr/bin/rpm']
|
||||
cmd.extend(args)
|
||||
# FIXME: usage of run_xxx() (unpacked vs regular list is highly inconsistent)
|
||||
|
|
@ -14,7 +14,7 @@ async def run_rpm(*args, sudo=False):
|
|||
return await run_sudo(cmd)
|
||||
return await run_cmd(*cmd)
|
||||
|
||||
async def all_installed_packages() -> Iterable[Package]:
|
||||
async def all_installed_packages() -> Iterable[Package]: # export
|
||||
ret: list[Package] = []
|
||||
opts: list[str] = []
|
||||
query_tags: list[str] = []
|
||||
|
|
@ -30,3 +30,8 @@ async def all_installed_packages() -> Iterable[Package]:
|
|||
tags = package_str.split('|')
|
||||
ret.append(Package(name=tags[0], vendor=tags[1], packager=tags[2], url=tags[3]))
|
||||
return ret
|
||||
|
||||
async def list_files(pkg: str) -> list[str]: # export
|
||||
opts: list[str] = []
|
||||
file_list_str, stderr = await run_rpm('-ql', pkg, *opts, sudo=False)
|
||||
return file_list_str.splitlines()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue