Bug 1898968

Summary: Listing an installed package from a specific repository not operational
Product: [Fedora] Fedora Reporter: ricky.tigg
Component: dnfAssignee: Jaroslav Mracek <jmracek>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: dmach, jmracek, jrohel, mblaha, mhatina, packaging-team-maint, pkratoch, rpm-software-management, vmukhame
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: dnf-4.5.2-1.fc33 dnf-4.5.2-1.fc32 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-01-06 01:21:41 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description ricky.tigg 2020-11-18 12:08:20 UTC
Description of problem: listing an installed package from a specific repository is not operational.

Version-Release number of component: dnf.noarch 4.4.0

How reproducible: Existence of a testing package for a component.

Steps to Reproduce:

# dnf -qy --best --enablerepo=updates-testing install time
$ dnf rq -a --installed --qf "%{name} %{ui_from_repo}" | grep -i 'updates-testing*$'

Actual result: no output from repository query

Expected result: eligible package for listing to be listed

Additional info:

$ dnf -q repo-pkgs updates-testing list installed | sed 1d
time.x86_64                     1.9-12.fc33                     @updates-testing

Comment 1 Jaroslav Mracek 2020-11-24 08:35:35 UTC
I created a new attribute for package class - https://github.com/rpm-software-management/dnf/pull/1692

Now you can use:
dnf rq -a --installed --qf "%{name} %{_from_repo}" | grep -i 'updates-testing*$'

In future you can use:
dnf rq -a --installed --qf "%{name} %{from_repo}" | grep -i 'updates-testing*$'

Comment 2 ricky.tigg 2020-11-25 09:31:06 UTC
Hello. Confirmed.

$ dnf rq -a --installed --qf "%{name} %{_from_repo}" | grep ^time
time @updates-testing

Did you observe 'dnf rq -a --installed --qf "%{name} %{ui_from_repo}"  'returned at least the packages belonging to repository System?

Comment 3 Jaroslav Mracek 2020-11-25 12:51:21 UTC
I am proposing additional change: https://github.com/rpm-software-management/dnf/pull/1695.

Comment 4 Jaroslav Mracek 2020-11-25 12:57:41 UTC
(In reply to ricky.tigg from comment #2)
> Hello. Confirmed.
> 
> $ dnf rq -a --installed --qf "%{name} %{_from_repo}" | grep ^time
> time @updates-testing
> 
> Did you observe 'dnf rq -a --installed --qf "%{name} %{ui_from_repo}" 
> 'returned at least the packages belonging to repository System?

Not sure that I understand correctly but ui_from_repo returns Id of repository the package belongs to (@System for installed packages). It means that everything what was installed is in repository with ID @system.
I also do not recommend to use `ui_from_repo` because it is a compatibility option. I would recommend to use `repomane` instead.

Comment 5 ricky.tigg 2020-11-26 08:00:13 UTC
Attribute '%{reponame}' behaves unexpectedly like attribute '%{ui_from_repo}'! Wasn't attribute '%{reponame}' meant to behave like the coming attribute '%{from_repo}' as your recommendation implicitly suggested?

$ dnf rq -a --installed --qf '%{name} %{_from_repo} %{ui_from_repo} %{reponame}' | grep ^time
time @updates-testing @System @System

Comment 6 Jaroslav Mracek 2020-12-03 10:43:26 UTC
Attribute '%{reponame}' must behave like '%{ui_from_repo}'. `ui_from_repo` is only compatibility attribute. Hoe it behaves:

Attribute '%{reponame}' return name of repository that package belongs to.

For available packages
$ dnf rq -a --available --qf "%{name} %{reponame}"

For installed packages it returns `@System` because `@System` is name of repository with installed packages.
$ dnf rq -a --installed --qf "%{name} %{reponame}"

The new attribute `from_repo` (not yet available) - for installed packages it will return id of repository from which the package was installed if such information is available in the history database. Otherwise returns an empty string.

Comment 7 Fedora Update System 2020-12-03 17:26:57 UTC
FEDORA-2020-4f53b68751 has been submitted as an update to Fedora 32. https://bodhi.fedoraproject.org/updates/FEDORA-2020-4f53b68751

Comment 8 Fedora Update System 2020-12-03 17:26:59 UTC
FEDORA-2020-152c03e942 has been submitted as an update to Fedora 33. https://bodhi.fedoraproject.org/updates/FEDORA-2020-152c03e942

Comment 9 Fedora Update System 2020-12-05 01:58:41 UTC
FEDORA-2020-152c03e942 has been pushed to the Fedora 33 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2020-152c03e942`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-152c03e942

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 10 Fedora Update System 2020-12-05 02:08:11 UTC
FEDORA-2020-4f53b68751 has been pushed to the Fedora 32 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2020-4f53b68751`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-4f53b68751

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 11 ricky.tigg 2020-12-07 08:41:17 UTC
Suggested command does not lead to installatio. Is the behavior similar in on your system?

# dnf -y upgrade --enablerepo=updates-testing --advisory=FEDORA-2020-4f53b68751
Last metadata expiration check: 0:35:08 ago on Mon Dec  7 09:59:52 2020.
No security updates needed, but 9 updates available
Dependencies resolved.
Nothing to do.
Complete!

Comment 12 ricky.tigg 2020-12-07 13:50:46 UTC
Command operational after re-installation of the OS.

Comment 13 Fedora Update System 2021-01-06 01:21:41 UTC
FEDORA-2020-152c03e942 has been pushed to the Fedora 33 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 14 Fedora Update System 2021-01-06 16:35:29 UTC
FEDORA-2020-4f53b68751 has been pushed to the Fedora 32 stable repository.
If problem still persists, please make note of it in this bug report.