[Yum-devel] optimizations on package object creation and other things.

Florian Festi ffesti at redhat.com
Wed Feb 28 14:00:46 UTC 2007


Hi!

seth vidal wrote:
> Can you show me what you mean here in the code? I'm not sure I'm
> following your description adequately.

We are talking about depsolve.py lines 1303-1307 and 1320-1321 and about 
code to replace these.

Whenever pkgs are removed requirements from other pkgs to the removed pkg 
can break. To find these _checkRemove() checks all provides of removed pkgs. 
As it is possible to set requirements to files it also checks every file of 
the removed pkg as if they where provides. This is very expensive as there 
are a lot of files.

To avoid checking every removed file we can also check every file 
requirement that will be in the system after the transaction is run.

I wrote it down in pseudo code. May be this makes things clearer:

def _checkFilerequirements(self):
     newPkgs = [txbr.po for txbr in self.tsInfoDelta
                if txmbr.output_state in TS_INSTALL_STATES]
     removedPkgs = set([txbr.po for txbr in self.tsInfoDelta
                        if txmbr.output_state in TS_REMOVE_STATES])
     for pkg in rpmdb.returnPackages() + newPkgs:
         if pkg in removedPkgs:
	    continue
	for name, flag, version in pkg.prco[requires]:
             if not name.startswith('/'):
		continue
	    if name in installed_unresoved_file_requirements:
		continue
    	    if not self._provideToPkg((name, flag, version)):
		yield (name, flag, version), pkg

run

installed_unresoved_file_requirements = set(_checkFilerequirements())

before adding any pkgs so we can ignore problems that are already in the rpmdb

_checkFilerequirements() should be called from _mytsCheck() and the result 
be added to the return value

Add some caching to speed things up.

Have fun

	Florian Festi



More information about the Yum-devel mailing list