On 08/11/2010 05:22 PM, seth vidal wrote:
On Wed, 2010-08-11 at 16:49 +0200, Radek Vykydal wrote:
On 08/11/2010 03:54 PM, seth vidal wrote:
On Wed, 2010-08-11 at 09:42 -0400, Chris Lumens wrote:
_inSack seems to be a special PackageSack added to yum's TransactionData
for optimalization lately. I don't like touching it from anaconda,
but I can't find another way. I think the case is not so common
to be worth deeper changes in yuminstall. There might be option
of doing SackSetup after unchecking of a repo, but it seems less
safe to me.
I know skvidal sometimes lurks on this list and will respond to things.
Perhaps he can come up with a better way. You're right, this is kinda
gross and not really something I want us to have to touch either. Seems
like entirely too much secret yum knowledge to me.
Rereading the original justification for the patch I'm a bit confused.
You've done some pkg selection, then the user hits the back button to
add/remove repos. Now you want to prune pkgs out of the transaction set
that are from that repo? B/c it seems to me that you would want to reset
the whole transaction, wouldn't you?
Yes, I want to reset the whole transaction - remove all pkgs.
Package selection will start from scratch after the reset.
This is the case:
1) have repos A and B enabled
2) default packages for repos/installclass are added
3) user adds/removes packages
4) transaction is created
5) (e.g.) user learns about some conflicts
6) goes back in UI (to 1))
6) disables repo B in UI -> it is removed
7) before going forward to 2), transaction needs to be reset
with the patched function
def resetPackageSelections(self):
"""Reset the package selection to an empty state."""
for txmbr in self.ayum.tsInfo:
self.ayum.tsInfo.remove(txmbr.pkgtup)
self.ayum.tsInfo.conditionals.clear()
for grp in self.ayum.comps.groups:
grp.selected = False
The problem that the patch adresses is that removing the txmbrs
in the first loop will traceback on txmbrs that refer to repo
removed in 6).
Is there a better way to reset the tsInfo (TransactionData)? It is quite a
hacky function (clearing conditionals is a similar case added some time
ago).
Or should we remove the packages before removing the repo in 6)
(perhaps with disable method added to yum for anaconda lately?)
I think these should do it:
self.ayum.closeRpmDB()
self.ayum._repos.close()
self.ayum.comps = None
or:
self.ayum.close()
These don't do what we need - to keep
ayum.repos (and their sacks) that had been set up
before 1) and modified in 6), and start only group/package
selection from scratch - which requires resetting
ayum.tsInfo if I get it right.
What you are suggesting seems to me as starting
with a new YumBase object - that is going far too back
for us.
Although it is not an option in this case, does ayum.close()
or all the closing do anything (e.g. cleanup, releasing resources)
to make reusing self.ayum preferable to just creating
a new YumBase object? Or is something preserved in the
ayum object? From what I read in the code it is not, but
I might have overlooked something.
Perhaps yum interface just is not suitable for doing things
like those in 1) - 7)?
Radek
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list