Skip to content

Commit

Permalink
commands: Setup filelists requests
Browse files Browse the repository at this point in the history
Request loading filelists metadata if the command needs it or its argument specs contain a file pattern.
  • Loading branch information
jan-kolarik committed Jan 19, 2024
1 parent 1da2afe commit 4b2aa45
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
3 changes: 3 additions & 0 deletions dnf/cli/commands/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ def configure(self):
demands.available_repos = True
demands.fresh_metadata = False
demands.sack_activation = True
self.base.conf.optional_metadata_types += ["filelists"]

def run(self):
logger.debug(_("Searching Packages: "))
Expand Down Expand Up @@ -271,6 +272,8 @@ def configure(self):
demands.plugin_filtering_enabled = True
if self.opts.changelogs:
demands.changelogs = True
if dnf.util._is_file_pattern_present(self.opts.pkg_specs):
self.base.conf.optional_metadata_types += ["filelists"]
_checkEnabledRepo(self.base)

def run(self):
Expand Down
5 changes: 5 additions & 0 deletions dnf/cli/commands/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import hawkey

import dnf.exceptions
import dnf.util
from dnf.cli import commands
from dnf.cli.option_parser import OptionParser
from dnf.i18n import _
Expand Down Expand Up @@ -62,6 +63,10 @@ def configure(self):
demands.available_repos = True
demands.resolving = True
demands.root_user = True

if dnf.util._is_file_pattern_present(self.opts.pkg_specs):
self.base.conf.optional_metadata_types += ["filelists"]

commands._checkGPGKey(self.base, self.cli)
if not self.opts.filenames:
commands._checkEnabledRepo(self.base)
Expand Down
3 changes: 3 additions & 0 deletions dnf/cli/commands/repoquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,9 @@ def configure(self):
if self.opts.querychangelogs:
demands.changelogs = True

if self.opts.queryfilelist or dnf.util._is_file_pattern_present(self.opts.key):
self.base.conf.optional_metadata_types += ["filelists"]

def build_format_fn(self, opts, pkg):
if opts.querychangelogs:
out = []
Expand Down
5 changes: 5 additions & 0 deletions dnf/cli/commands/upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

import dnf.exceptions
import dnf.base
import dnf.util
from dnf.cli import commands
from dnf.cli.option_parser import OptionParser
from dnf.i18n import _
Expand Down Expand Up @@ -56,6 +57,10 @@ def configure(self):
demands.available_repos = True
demands.resolving = True
demands.root_user = True

if dnf.util._is_file_pattern_present(self.opts.pkg_specs):
self.base.conf.optional_metadata_types += ["filelists"]

commands._checkGPGKey(self.base, self.cli)
if not self.opts.filenames:
commands._checkEnabledRepo(self.base)
Expand Down

0 comments on commit 4b2aa45

Please sign in to comment.