lib.Distro.pkg_files() -> .pkg_paths()
"files" is a term that can be used for many aspects of a file, its path, its content, a handle, so better use "pkg_paths" instead of "pkg_files" for Distro's method to inform about which files a package holds. That also aligns better with the recent move from PackageFilter toward PathFilter. Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
31e0d1f3a4
commit
5ac36ec271
6 changed files with 26 additions and 26 deletions
|
|
@ -63,7 +63,7 @@ class DummyDistro(Distro):
|
|||
pass
|
||||
|
||||
@override
|
||||
async def _pkg_files(self, names: list[str] | None) -> Iterable[str]:
|
||||
async def _pkg_paths(self, names: list[str] | None) -> Iterable[str]:
|
||||
return []
|
||||
|
||||
@override
|
||||
|
|
@ -97,7 +97,7 @@ vd.verified = None
|
|||
assert asyncio.run(vd.verify()) == []
|
||||
assert vd.verified is None
|
||||
|
||||
# -- pkg_files --
|
||||
# -- pkg_paths --
|
||||
|
||||
# -- Without a filter, the selection is passed through as the
|
||||
# whole system; the paths come back unfiltered
|
||||
|
|
@ -113,7 +113,7 @@ class TmplDistro(DummyDistro):
|
|||
return [Package(n) for n in self.files]
|
||||
|
||||
@override
|
||||
async def _pkg_files(self, names: list[str] | None) -> list[str]:
|
||||
async def _pkg_paths(self, names: list[str] | None) -> list[str]:
|
||||
if names is None:
|
||||
names = list(self.files)
|
||||
ret: list[str] = []
|
||||
|
|
@ -126,12 +126,12 @@ t.files = {
|
|||
'a': ['/usr/share/a/a.conf.jw-tmpl', '/usr/bin/a'],
|
||||
'b': ['/etc/b/b.conf.jw-tmpl'],
|
||||
}
|
||||
assert sorted(asyncio.run(t.pkg_files())) == [
|
||||
assert sorted(asyncio.run(t.pkg_paths())) == [
|
||||
'/etc/b/b.conf.jw-tmpl', '/usr/bin/a', '/usr/share/a/a.conf.jw-tmpl'
|
||||
]
|
||||
|
||||
# -- A single package name as a str is accepted for compatibility
|
||||
assert sorted(asyncio.run(t.pkg_files('a'))) == [
|
||||
assert sorted(asyncio.run(t.pkg_paths('a'))) == [
|
||||
'/usr/bin/a',
|
||||
'/usr/share/a/a.conf.jw-tmpl',
|
||||
]
|
||||
|
|
@ -261,7 +261,7 @@ class CannedRpmLocal(Local):
|
|||
|
||||
cl = CannedRpmLocal()
|
||||
sd = SuseDistro(cl, id = 'suse', os_release_str = OS_RELEASE_SUSE)
|
||||
assert asyncio.run(sd.pkg_files()) == [
|
||||
assert asyncio.run(sd.pkg_paths()) == [
|
||||
'/usr/bin/x',
|
||||
'/etc/a/a.conf.jw-tmpl',
|
||||
]
|
||||
|
|
@ -273,7 +273,7 @@ sdf = SuseDistro(
|
|||
os_release_str = OS_RELEASE_SUSE,
|
||||
default_path_filter = Pkg(spec = 'pkg:url=~jw.dev', file_context = cl)
|
||||
)
|
||||
assert asyncio.run(sdf.pkg_files()) == \
|
||||
assert asyncio.run(sdf.pkg_paths()) == \
|
||||
['/etc/a/a.conf.jw-tmpl', '/etc/b/b.conf.jw-tmpl']
|
||||
assert cl.cmds[-1] == ['/usr/bin/rpm', '-ql', 'a', 'b']
|
||||
|
||||
|
|
@ -283,7 +283,7 @@ sde = SuseDistro(
|
|||
os_release_str = OS_RELEASE_SUSE,
|
||||
default_path_filter = Pkg(spec = 'pkg:url=~zzz-nomatch', file_context = cl)
|
||||
)
|
||||
assert asyncio.run(sde.pkg_files()) == []
|
||||
assert asyncio.run(sde.pkg_paths()) == []
|
||||
assert '--queryformat' in cl.cmds[-1]
|
||||
|
||||
# -- _install_local_files --
|
||||
|
|
|
|||
|
|
@ -212,7 +212,7 @@ async def run_tests() -> None:
|
|||
self.queries = 0
|
||||
|
||||
@override
|
||||
async def _pkg_files(self, names: list[str] | None) -> list[str]:
|
||||
async def _pkg_paths(self, names: list[str] | None) -> list[str]:
|
||||
self.queries += 1
|
||||
return self.files
|
||||
|
||||
|
|
|
|||
|
|
@ -336,7 +336,7 @@ async def run_tests() -> None:
|
|||
self.files = files
|
||||
|
||||
@override
|
||||
async def _pkg_files(self, names: list[str] | None) -> list[str]:
|
||||
async def _pkg_paths(self, names: list[str] | None) -> list[str]:
|
||||
return self.files
|
||||
|
||||
fake = FakeDistro(
|
||||
|
|
|
|||
|
|
@ -321,7 +321,7 @@ async def run_tests() -> None:
|
|||
self.files = files
|
||||
|
||||
@override
|
||||
async def _pkg_files(self, names: list[str] | None) -> list[str]:
|
||||
async def _pkg_paths(self, names: list[str] | None) -> list[str]:
|
||||
return self.files
|
||||
|
||||
fake = FakeDistro(
|
||||
|
|
|
|||
|
|
@ -351,7 +351,7 @@ async def run_tests() -> None:
|
|||
self.files = files
|
||||
|
||||
@override
|
||||
async def _pkg_files(self, names: list[str] | None) -> list[str]:
|
||||
async def _pkg_paths(self, names: list[str] | None) -> list[str]:
|
||||
return self.files
|
||||
|
||||
fake = FakeDistro(
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ class _FakeDistro:
|
|||
filter: Any = None) -> list[Package]:
|
||||
return [p for p, _ in self.__pkgs if filter is None or filter.match_pkg(p)]
|
||||
|
||||
async def pkg_files(self, names: list[str] | None = None) -> list[str]:
|
||||
async def pkg_paths(self, names: list[str] | None = None) -> list[str]:
|
||||
ret: list[str] = []
|
||||
for p, files in self.__pkgs:
|
||||
if names is None or p.name in names:
|
||||
|
|
|
|||
Loading…
Reference in a new issue