Bug 1162887 - [api] introspecting transaction package sets
[api] introspecting transaction package sets
Product: Fedora
Classification: Fedora
Component: dnf (Show other bugs)
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Honza Silhan
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2014-11-11 17:55 EST by Jakub Kadlčík
Modified: 2015-02-20 03:32 EST (History)
6 users (show)

See Also:
Fixed In Version: hawkey-0.5.3-2.fc21
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2015-02-20 03:32:50 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Jakub Kadlčík 2014-11-11 17:55:49 EST
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 05:59:15 EST
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 16:17:26 EST
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-12 19:36:11 EST
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 10:38:01 EST
It could be added to API.
Comment 5 Fedora Update System 2015-02-15 19:03:35 EST
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.
Comment 6 Fedora Update System 2015-02-17 03:04:28 EST
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:
then log in and leave karma (feedback).
Comment 7 Fedora Update System 2015-02-20 03:32:50 EST
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.

Note You need to log in before you can comment on or make changes to this bug.