2.16: dnf5: replace removed API calls and add fallbacks (#83026)

* dnf5: replace removed API calls (#83020)

* dnf5: replace removed API calls

bfb6f32e15
96c9188f9c

* call set_group_with_name instead of setting group_with_name

c7b88428f3

---------

Co-authored-by: Matt Martz <matt@sivel.net>
(cherry picked from commit 4e57249d59)

* Fallbacks for brand new APIs that don't exist in released dnf5 (#83022)

(cherry picked from commit 57750e2cf7)

---------

Co-authored-by: Matt Martz <matt@sivel.net>
pull/83040/head
Martin Krizek 8 months ago committed by GitHub
parent e631b5b36a
commit e6361322e3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,2 @@
bugfixes:
- dnf5 - replace removed API calls

@ -484,7 +484,7 @@ class Dnf5Module(YumDnf):
conf.config_file_path = self.conf_file
try:
base.load_config_from_file()
base.load_config()
except RuntimeError as e:
self.module.fail_json(
msg=str(e),
@ -520,7 +520,8 @@ class Dnf5Module(YumDnf):
log_router = base.get_logger()
global_logger = libdnf5.logger.GlobalLogger()
global_logger.set(log_router.get(), libdnf5.logger.Logger.Level_DEBUG)
logger = libdnf5.logger.create_file_logger(base)
# FIXME hardcoding the filename does not seem right, should libdnf5 expose the default file name?
logger = libdnf5.logger.create_file_logger(base, "dnf5.log")
log_router.add_logger(logger)
if self.update_cache:
@ -545,7 +546,11 @@ class Dnf5Module(YumDnf):
for repo in repo_query:
repo.enable()
sack.update_and_load_enabled_repos(True)
try:
sack.load_repos()
except AttributeError:
# dnf5 < 5.2.0.0
sack.update_and_load_enabled_repos(True)
if self.update_cache and not self.names and not self.list:
self.module.exit_json(
@ -577,7 +582,11 @@ class Dnf5Module(YumDnf):
self.module.exit_json(msg="", results=results, rc=0)
settings = libdnf5.base.GoalJobSettings()
settings.group_with_name = True
try:
settings.set_group_with_name(True)
except AttributeError:
# dnf5 < 5.2.0.0
settings.group_with_name = True
if self.bugfix or self.security:
advisory_query = libdnf5.advisory.AdvisoryQuery(base)
types = []

Loading…
Cancel
Save