[Piuparts-devel] faster-rdep-calc/rdep-chain-len
Andreas Beckmann
anbe at debian.org
Sun Apr 14 10:49:51 UTC 2013
On 2013-04-14 00:36, Dave Steele wrote:
>> Furthermore I ran into problems with dwke on logs that have no longer
>> existing packages (see trace below) ... I shuffled around the patches a
>> bit and changed the rrdep accessors to a) take a package name instead of
>> a package and b) return -1 if the requested package does not exist.
>> You can find the first part of that work in
>> preview/fast-rdep-interface:
>>
>
> By testing for None in the accessor and returning -1, there becomes a
> need for special handling in both the caller and accessor. It is
returning -1 gives a perfectly sortable integer result without any need
for the caller to check validity - and it moves the "bad" logs to the
bottom of the list
> already the responsibility of the caller to pass a valid object. In
But that does not happen currently. db.get_package(name, ...) may return
None. Or a package in a dependency db that does never get counters
computed (that is not a bug!).
Moving the package lookup to the accessor saves us trouble here - we
either get a *local* object from the current db or None. No need to tell
outside any details except by returning -1.
> detect_well_known_errors, this is result of the bullet proofing you
> asked for earlier. The fail you list here is in a try block to catch
> just this - it just no longer looks for the right exception after a
> recent rebase. I've added AttributeError to the catches.
I don't like this usage for exceptions, especially catching random
KeyErrors that break on simple changes. With the accessors doing proper
checking, all the try/excepts in that context can go away.
Exception handling is primarily needed for IOError etc. if a file
disappears after we have found it's name.
And that happens all the time :-)
> I'm no longer sure whether or not piuparts-report needs to guard
> against this. It didn't, before resolve_virtual. PackagesDB should
> guarantee that the package lists are consistent.
-report does lookup on package names from the db
dwke does lookup on (package) names found in the filesystem
> The preferred package type argument for the rdep metric calls is
> pretty evenly divided. I'm leaving it a the package object for now, as
> the more efficient form.
I really prefer passing the "name" argument and doing lookup in the
accessor (even if it is a bit more expensive) as it avoids the danger of
passing a "wrong" object
Andreas
More information about the Piuparts-devel
mailing list