Created attachment 322940 [details] Make AgeSet and DateSet use BUILD_TIME key instead of COUNTER mtime Sorry to bother again because of AgeSet and DateSet: Since there is quite a while the BUILD_TIME key in portage, this is probably what should be used instead of the mtime of COUNTER: If a package was emerged from a *.tbz2, the BUILD_TIME is probably what the user means by the age of a package when he uses the AgeSet/DateSet classes. (And moreover, it appears not so clean to use undocumented timestamps.) For "ancient" packages which were emerged before the BUILD_TIME key was supported by portage, it is probably reasonable to assume that they are older than any date specified in AgeSet/DateSet. I attach a corresponding patch. (BTW: Thanks for improving the option parsing logic and fixing the exception handling in DateSet.)
You should handle ValueError from float(date), in case BUILD_TIME is corrupt. Also, it looks like you forgot to convert the date string to a float in a couple of places (BUILD_TIME is suppose to be an int, so you could use int(date) instead).
Also, note that aux_get will return an empty string for any packages installed by older portage which did not support BUILD_TIME, so you could handle that specially (maybe that's what the KeyError handling was intended for, but it won't work since an empty string is simply returned).
Created attachment 323012 [details, diff] Fix previous patch, but with more reliable int(date) conversions Thanks for your hints. > BUILD_TIME is suppose to be an int In this case, it makes no sense to allow "date" being a flow. I made it now an int throughout. > Also, note that aux_get will return an empty string for > any packages installed by older portage which did not > support BUILD_TIME Thanks. I didn't expect this, since my impression was that the RebuiltBinaries class (in the same file) used KeyError for checking it; but it has in addition a check for a nonempty string... So the new patch just needs to verify that int(BUILD_TIME) succeeds: This also covers BUILD_TIME == "", since int("") fails with ValueError.
Thanks, this is in git: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=1ceea27a7cb658f0f592363a98bdef1fe2d1c552
This is fixed in 2.2.0_alpha125.