|
|
878112 |
From bcfb9e8998a87f5737b6dbce5edd206f56d732eb Mon Sep 17 00:00:00 2001
|
|
|
878112 |
From: Jaroslav Mracek <jmracek@redhat.com>
|
|
|
878112 |
Date: Fri, 3 Jan 2020 10:57:59 +0100
|
|
|
878112 |
Subject: [PATCH] Add support of commandline packages in repoquery
|
|
|
878112 |
(RhBug:1784148)
|
|
|
878112 |
|
|
|
878112 |
https://bugzilla.redhat.com/show_bug.cgi?id=1784148
|
|
|
878112 |
---
|
|
|
878112 |
dnf/cli/commands/repoquery.py | 21 +++++++++++++++++++++
|
|
|
878112 |
1 file changed, 21 insertions(+)
|
|
|
878112 |
|
|
|
878112 |
diff --git a/dnf/cli/commands/repoquery.py b/dnf/cli/commands/repoquery.py
|
|
|
878112 |
index f5cb36fe57..7334ddcd90 100644
|
|
|
878112 |
--- a/dnf/cli/commands/repoquery.py
|
|
|
878112 |
+++ b/dnf/cli/commands/repoquery.py
|
|
|
878112 |
@@ -402,6 +402,20 @@ def _get_recursive_providers_query(self, query_in, providers, done=None):
|
|
|
878112 |
done = self._get_recursive_providers_query(query_in, query_select, done=t.union(done))
|
|
|
878112 |
return t.union(done)
|
|
|
878112 |
|
|
|
878112 |
+ def _add_add_remote_packages(self):
|
|
|
878112 |
+ rpmnames = []
|
|
|
878112 |
+ remote_packages = []
|
|
|
878112 |
+ for key in self.opts.key:
|
|
|
878112 |
+ schemes = dnf.pycomp.urlparse.urlparse(key)[0]
|
|
|
878112 |
+ if key.endswith('.rpm'):
|
|
|
878112 |
+ rpmnames.append(key)
|
|
|
878112 |
+ elif schemes and schemes in ('http', 'ftp', 'file', 'https'):
|
|
|
878112 |
+ rpmnames.append(key)
|
|
|
878112 |
+ if rpmnames:
|
|
|
878112 |
+ remote_packages = self.base.add_remote_rpms(
|
|
|
878112 |
+ rpmnames, strict=False, progress=self.base.output.progress)
|
|
|
878112 |
+ return remote_packages
|
|
|
878112 |
+
|
|
|
878112 |
def run(self):
|
|
|
878112 |
if self.opts.querytags:
|
|
|
878112 |
print(_('Available query-tags: use --queryformat ".. %{tag} .."'))
|
|
|
878112 |
@@ -416,6 +430,8 @@ def run(self):
|
|
|
878112 |
else hawkey.APPLY_EXCLUDES
|
|
|
878112 |
)
|
|
|
878112 |
if self.opts.key:
|
|
|
878112 |
+ remote_packages = self._add_add_remote_packages()
|
|
|
878112 |
+
|
|
|
878112 |
kwark = {}
|
|
|
878112 |
forms = [self.nevra_forms[command] for command in self.opts.command
|
|
|
878112 |
if command in list(self.nevra_forms.keys())]
|
|
|
878112 |
@@ -423,6 +439,11 @@ def run(self):
|
|
|
878112 |
kwark["forms"] = forms
|
|
|
878112 |
pkgs = []
|
|
|
878112 |
query_results = q.filter(empty=True)
|
|
|
878112 |
+
|
|
|
878112 |
+ if remote_packages:
|
|
|
878112 |
+ query_results = query_results.union(
|
|
|
878112 |
+ self.base.sack.query().filterm(pkg=remote_packages))
|
|
|
878112 |
+
|
|
|
878112 |
for key in self.opts.key:
|
|
|
878112 |
query_results = query_results.union(
|
|
|
878112 |
dnf.subject.Subject(key, ignore_case=True).get_best_query(
|