Bug 1162887 - [api] introspecting transaction package sets
Summary: [api] introspecting transaction package sets
Alias: None
Product: Fedora
Classification: Fedora
Component: dnf
Version: rawhide
Hardware: Unspecified
OS: Unspecified
Target Milestone: ---
Assignee: Honza Silhan
QA Contact: Fedora Extras Quality Assurance
Depends On:
TreeView+ depends on / blocked
Reported: 2014-11-11 22:55 UTC by Jakub Kadlčík
Modified: 2015-02-20 08:32 UTC (History)
6 users (show)

Clone Of:
Last Closed: 2015-02-20 08:32:50 UTC

Attachments (Terms of Use)

Description Jakub Kadlčík 2014-11-11 22:55:49 UTC
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.

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:
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.

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