|
|
@ -358,10 +358,23 @@ libdnf5 = None
|
|
|
|
|
|
|
|
|
|
|
|
def is_installed(base, spec):
|
|
|
|
def is_installed(base, spec):
|
|
|
|
settings = libdnf5.base.ResolveSpecSettings()
|
|
|
|
settings = libdnf5.base.ResolveSpecSettings()
|
|
|
|
query = libdnf5.rpm.PackageQuery(base)
|
|
|
|
installed_query = libdnf5.rpm.PackageQuery(base)
|
|
|
|
query.filter_installed()
|
|
|
|
installed_query.filter_installed()
|
|
|
|
match, nevra = query.resolve_pkg_spec(spec, settings, True)
|
|
|
|
match, nevra = installed_query.resolve_pkg_spec(spec, settings, True)
|
|
|
|
return match
|
|
|
|
|
|
|
|
|
|
|
|
# FIXME use `is_glob_pattern` function when available:
|
|
|
|
|
|
|
|
# https://github.com/rpm-software-management/dnf5/issues/1563
|
|
|
|
|
|
|
|
glob_patterns = set("*[?")
|
|
|
|
|
|
|
|
if any(set(char) & glob_patterns for char in spec):
|
|
|
|
|
|
|
|
available_query = libdnf5.rpm.PackageQuery(base)
|
|
|
|
|
|
|
|
available_query.filter_available()
|
|
|
|
|
|
|
|
available_query.resolve_pkg_spec(spec, settings, True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return not (
|
|
|
|
|
|
|
|
{p.get_name() for p in available_query} - {p.get_name() for p in installed_query}
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
return match
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def is_newer_version_installed(base, spec):
|
|
|
|
def is_newer_version_installed(base, spec):
|
|
|
|