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