Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the possibility to load filelists conditionally #2012

Merged
merged 5 commits into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Prev Previous commit
Next Next commit
commands: Setup filelists requests
Request loading filelists metadata if the command needs it or its argument specs contain a file pattern.
  • Loading branch information
jan-kolarik committed Jan 25, 2024
commit 98d345df11e086d2838a3720f3cc191bd7572384
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.packages):
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