There are two styles of coding that are used currently. First, the
PackageManifest{,Pair} classes track an arbitrary list of store paths (not
necessarily a closure) as parsed Package and Version objects. These are used to
track and compare the sets of selected packages. Then for everything else like
version diffing, we just store raw nested data structures holding package names
and versions, e.g. dict[str, list[optional[str]]] for mapping package names to
lists of available versions (and then parse Versions on the fly to do
comparisons, which is inefficient).
This is the beginning of clean-up to make the latter use PackageSet, Package,
and Version as well.
- Use @total_ordering to supply implementations of all other comparison
functions from just __eq__() and __le__(). This is not done automatically.
https://docs.python.org/3/library/functools.html#functools.total_ordering
- An incomplete check for "pre" meant that the following would evaluate
to true:
VersionChunk("1pre2") < VersionChunk("1pre2")
In practice this wasn't a problem because it appears that when comparing
VersionChunk lists, equality is checked before ordering, but this isn't
good to rely on.
It was kindly pointed out to me in merge request !3 that it's not clear
that nvd is in Nixpkgs. Nixpkgs is the preferred way to get nvd, or
alternatively one of the release tags in this repo, rather than the
master branch where things can change willy-nilly.