|
|
862ba9 |
From eb2aa8c14208da7a567a0d79a8baa9f5201640cd Mon Sep 17 00:00:00 2001
|
|
|
862ba9 |
From: Jaroslav Mracek <jmracek@redhat.com>
|
|
|
862ba9 |
Date: Tue, 24 Nov 2020 09:17:41 +0100
|
|
|
862ba9 |
Subject: [PATCH 1/3] Add `from_repo` attribute for Package class
|
|
|
862ba9 |
(RhBug:1898968,1879168)
|
|
|
862ba9 |
|
|
|
862ba9 |
It as an alias for private attribute _from_repo.
|
|
|
862ba9 |
|
|
|
862ba9 |
https://bugzilla.redhat.com/show_bug.cgi?id=1898968
|
|
|
862ba9 |
https://bugzilla.redhat.com/show_bug.cgi?id=1879168
|
|
|
862ba9 |
---
|
|
|
862ba9 |
dnf/cli/commands/repoquery.py | 2 +-
|
|
|
862ba9 |
dnf/package.py | 7 +++++--
|
|
|
862ba9 |
doc/api_package.rst | 6 ++++++
|
|
|
862ba9 |
3 files changed, 12 insertions(+), 3 deletions(-)
|
|
|
862ba9 |
|
|
|
862ba9 |
diff --git a/dnf/cli/commands/repoquery.py b/dnf/cli/commands/repoquery.py
|
|
|
862ba9 |
index 099a9312d9..a11b440525 100644
|
|
|
862ba9 |
--- a/dnf/cli/commands/repoquery.py
|
|
|
862ba9 |
+++ b/dnf/cli/commands/repoquery.py
|
|
|
862ba9 |
@@ -44,7 +44,7 @@
|
|
|
862ba9 |
QFORMAT_MATCH = re.compile(r'%(-?\d*?){([:.\w]+?)}')
|
|
|
862ba9 |
|
|
|
862ba9 |
QUERY_TAGS = """\
|
|
|
862ba9 |
-name, arch, epoch, version, release, reponame (repoid), evr,
|
|
|
862ba9 |
+name, arch, epoch, version, release, reponame (repoid), from_repo, evr,
|
|
|
862ba9 |
debug_name, source_name, source_debug_name,
|
|
|
862ba9 |
installtime, buildtime, size, downloadsize, installsize,
|
|
|
862ba9 |
provides, requires, obsoletes, conflicts, sourcerpm,
|
|
|
862ba9 |
diff --git a/dnf/package.py b/dnf/package.py
|
|
|
862ba9 |
index d44ce6706c..f647df6bff 100644
|
|
|
862ba9 |
--- a/dnf/package.py
|
|
|
862ba9 |
+++ b/dnf/package.py
|
|
|
862ba9 |
@@ -76,12 +76,15 @@ def _from_repo(self):
|
|
|
862ba9 |
pkgrepo = None
|
|
|
862ba9 |
if self._from_system:
|
|
|
862ba9 |
pkgrepo = self.base.history.repo(self)
|
|
|
862ba9 |
- else:
|
|
|
862ba9 |
- pkgrepo = {}
|
|
|
862ba9 |
if pkgrepo:
|
|
|
862ba9 |
return '@' + pkgrepo
|
|
|
862ba9 |
return self.reponame
|
|
|
862ba9 |
|
|
|
862ba9 |
+ @property
|
|
|
862ba9 |
+ def from_repo(self):
|
|
|
862ba9 |
+ # :api
|
|
|
862ba9 |
+ return self._from_repo
|
|
|
862ba9 |
+
|
|
|
862ba9 |
@property
|
|
|
862ba9 |
def _header(self):
|
|
|
862ba9 |
return dnf.rpm._header(self.localPkg())
|
|
|
862ba9 |
diff --git a/doc/api_package.rst b/doc/api_package.rst
|
|
|
862ba9 |
index 95df5d4b23..48ef8f1d22 100644
|
|
|
862ba9 |
--- a/doc/api_package.rst
|
|
|
862ba9 |
+++ b/doc/api_package.rst
|
|
|
862ba9 |
@@ -74,6 +74,12 @@
|
|
|
862ba9 |
|
|
|
862ba9 |
Files the package provides (list of strings).
|
|
|
862ba9 |
|
|
|
862ba9 |
+ .. attribute:: from_repo
|
|
|
862ba9 |
+
|
|
|
862ba9 |
+ For installed packages returns id of repository from which the package was installed prefixed
|
|
|
862ba9 |
+ with '@' (if such information is available in the history database). Otherwise returns id of
|
|
|
862ba9 |
+ repository the package belongs to (@System for installed packages of unknown origin) (string).
|
|
|
862ba9 |
+
|
|
|
862ba9 |
.. attribute:: group
|
|
|
862ba9 |
|
|
|
862ba9 |
Group of the package (string).
|
|
|
862ba9 |
|
|
|
862ba9 |
From 1a933f8e036cd704fa6e7f77a8448263e93e540f Mon Sep 17 00:00:00 2001
|
|
|
862ba9 |
From: Jaroslav Mracek <jmracek@redhat.com>
|
|
|
862ba9 |
Date: Tue, 24 Nov 2020 09:19:42 +0100
|
|
|
862ba9 |
Subject: [PATCH 2/3] Correct description of Package().reponane attribute
|
|
|
862ba9 |
|
|
|
862ba9 |
---
|
|
|
862ba9 |
doc/api_package.rst | 2 +-
|
|
|
862ba9 |
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
862ba9 |
|
|
|
862ba9 |
diff --git a/doc/api_package.rst b/doc/api_package.rst
|
|
|
862ba9 |
index 48ef8f1d22..a78897babe 100644
|
|
|
862ba9 |
--- a/doc/api_package.rst
|
|
|
862ba9 |
+++ b/doc/api_package.rst
|
|
|
862ba9 |
@@ -138,7 +138,7 @@
|
|
|
862ba9 |
|
|
|
862ba9 |
.. attribute:: reponame
|
|
|
862ba9 |
|
|
|
862ba9 |
- Id of repository the package was installed from (string).
|
|
|
862ba9 |
+ Id of repository the package belongs to (@System for installed packages) (string).
|
|
|
862ba9 |
|
|
|
862ba9 |
.. attribute:: requires
|
|
|
862ba9 |
|
|
|
862ba9 |
|
|
|
862ba9 |
From 24cdb68776507fdae25bed0e82d80df3018aecfc Mon Sep 17 00:00:00 2001
|
|
|
862ba9 |
From: Jaroslav Mracek <jmracek@redhat.com>
|
|
|
862ba9 |
Date: Tue, 24 Nov 2020 09:22:07 +0100
|
|
|
862ba9 |
Subject: [PATCH 3/3] Add unittest for new API
|
|
|
862ba9 |
|
|
|
862ba9 |
---
|
|
|
862ba9 |
tests/api/test_dnf_package.py | 5 +++++
|
|
|
862ba9 |
1 file changed, 5 insertions(+)
|
|
|
862ba9 |
|
|
|
862ba9 |
diff --git a/tests/api/test_dnf_package.py b/tests/api/test_dnf_package.py
|
|
|
862ba9 |
index 04cddc7ecc..5952352bb5 100644
|
|
|
862ba9 |
--- a/tests/api/test_dnf_package.py
|
|
|
862ba9 |
+++ b/tests/api/test_dnf_package.py
|
|
|
862ba9 |
@@ -163,6 +163,11 @@ def test_reponame(self):
|
|
|
862ba9 |
self.assertHasAttr(self.package, "reponame")
|
|
|
862ba9 |
self.assertHasType(self.package.reponame, str)
|
|
|
862ba9 |
|
|
|
862ba9 |
+ def test_from_repo(self):
|
|
|
862ba9 |
+ # Package.reponame
|
|
|
862ba9 |
+ self.assertHasAttr(self.package, "from_repo")
|
|
|
862ba9 |
+ self.assertHasType(self.package.from_repo, str)
|
|
|
862ba9 |
+
|
|
|
862ba9 |
def test_requires(self):
|
|
|
862ba9 |
# Package.requires
|
|
|
862ba9 |
self.assertHasAttr(self.package, "requires")
|