Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.

Bug 1162887

Summary: [api] introspecting transaction package sets
Product: [Fedora] Fedora Reporter: Jakub Kadlčík <jkadlcik>
Component: dnfAssignee: Honza Silhan <jsilhan>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: akozumpl, jsilhan, mluscon, pnemade, rholy, tla
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: hawkey-0.5.3-2.fc21 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-02-20 08:32:50 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 Jakub Kadlčík 2014-11-11 22:55:49 UTC
Hello,
I would like to ask you about considering to include Transaction properties install_set and remove_set into API.

I would like to use them like this:

installed = set([package.name for package in self.base.transaction.install_set])
erased = set([package.name for package in self.base.transaction.remove_set])

and then work with those sets.

Some time ago I asked for similar thing in https://bugzilla.redhat.com/show_bug.cgi?id=1067156

Thank you

Comment 1 Radek Holy 2014-11-12 10:59:15 UTC
Hello, is there a good reason why "set(itertools.chain.from_iterable(item.installs() for item in transaction))" is not enough for you? I understand that since the method you want is in the code base already, it should be easy too add it to API. But if we want to keep DNF maintainable we need to carefully consider every API extension.

Comment 2 Jakub Kadlčík 2014-11-12 21:17:26 UTC
Hello Radek,
thank you for the reply.

It's not entirely necessary, but the

installed = set([package.name for package in self.base.transaction.install_set])

is much more straightforward than

installed = set([p.name for p in chain.from_iterable([i.installs() for i in self.base.transaction])])

It is a complicated because when you are iterating Transaction you are getting the TransactionItem. For getting packages (I actually want package names) you must iterate over every item in installs(). Unlike this, install_set is straight access directly to the packages.

> the method you want is in the code base already, it should be easy too add it to API.
That was the point why I asked for considering about adding it to API, but if there are some plans for changing the actual state, I would wait for that reimplementation.

> But if we want to keep DNF maintainable we need to carefully consider every API extension.
I understand this, so I will not trying to force you to it or something :-). My goal is achievable with actual API.

Comment 3 Radek Holy 2014-11-13 00:36:11 UTC
I see. Such a method would even more useful because anyone who writes a DNF extension that installs some packages needs to download them first and that would require "base.download_packages(list(itertools.chain.from_iterable(item.installs() for item in base.transaction)))" in every such extension.
Not very painful but not very comfortable. And why should we force people to duplicate code, right?

Maybe we can wait for more interested people.

I don't know. Let's see what is the opinion of the rest of the team.

Comment 4 Honza Silhan 2014-11-14 15:38:01 UTC
It could be added to API.

Comment 5 Fedora Update System 2015-02-16 00:03:35 UTC
dnf-plugins-core-0.1.5-1.fc21,hawkey-0.5.3-2.fc21,dnf-0.6.4-1.fc21 has been submitted as an update for Fedora 21.
https://admin.fedoraproject.org/updates/dnf-plugins-core-0.1.5-1.fc21,hawkey-0.5.3-2.fc21,dnf-0.6.4-1.fc21

Comment 6 Fedora Update System 2015-02-17 08:04:28 UTC
Package hawkey-0.5.3-2.fc21, dnf-plugins-core-0.1.5-1.fc21, dnf-0.6.4-1.fc21:
* should fix your issue,
* was pushed to the Fedora 21 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing hawkey-0.5.3-2.fc21 dnf-plugins-core-0.1.5-1.fc21 dnf-0.6.4-1.fc21'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2015-2139/dnf-plugins-core-0.1.5-1.fc21,hawkey-0.5.3-2.fc21,dnf-0.6.4-1.fc21
then log in and leave karma (feedback).

Comment 7 Fedora Update System 2015-02-20 08:32:50 UTC
hawkey-0.5.3-2.fc21, dnf-plugins-core-0.1.5-1.fc21, dnf-0.6.4-1.fc21 has been pushed to the Fedora 21 stable repository.  If problems still persist, please make note of it in this bug report.