Enrico Zini: Using the apt-xapian-index catalogedtime plugin
Using the apt-xapian-index catalogedtime plugin
apt-xapian-index has recently gained a catalogedtime
plugin, which stores the timestamp of when the package was first cataloged.
At first glance this does not mean much, so I'll explain with an example.
aptitude can show a list of "New Packages": those packages that it sees now for
the first time. It is a very useful feature, but you cannot ask it "what
packages became available during last week?"
With the catalogedtime plugin, the apt xapian index can now answer that
question. You can also sort package results by "newness", or implement a user
interface with some sort of "newness timeline" package filter option.
Of course you will find documentation about it in
/var/lib/apt-xapian-index/README, since the index is self-documenting.
As usual in my apt-xapian-index posts, here is a code example:
#!/usr/bin/python # coding: utf-8 # Show packages that were NEW in the last N days # (C) 2010 Enrico Zini <enrico@enricozini.org> # License: WTFPL version 2 (http://sam.zoy.org/wtfpl/) import axi import xapian import time import sys class App: def __init__(self, days): self.db = xapian.Database(axi.XAPIANINDEX) # Read the contents of /var/lib/apt-xapian-index/values self.values, self.descs = axi.readValueDB() # Find the value ID for the catalogedtime timestamps self.cattime_vid = self.values["catalogedtime"] # Filter packages first seen more than than X days ago self.query = xapian.Query(xapian.Query.OP_VALUE_GE, self.cattime_vid, xapian.sortable_serialise(time.time() - 86400*days)) def main(self): # Perform the query self.enquire = xapian.Enquire(self.db) self.enquire.set_query(self.query) # Sort by cataloged time self.enquire.set_sort_by_value(self.cattime_vid, True) # Print the first 200 matches = self.enquire.get_mset(0, 200) for m in matches: name = m.document.get_data() val = m.document.get_value(self.cattime_vid) fval = xapian.sortable_unserialise(val) tm = time.localtime(fval) timestr = time.strftime("%c", tm) print "%s %s" % (timestr, name) if __name__ == "__main__": try: days = int(sys.argv[1]) except: print >>sys.stderr, "Usage: %s days" % sys.argv[0] sys.exit(1) app = App(days) app.main() sys.exit(0)Enjoy!
The patches have not been merged yet, but will probably be soon.

I recently added a
Last night, I finally got my temperature sensors going, including
a nice and shiny 
At the
Story
I bought Xperia X10i this summer during



After recent switch of this blog to Django, I've also planned to switch rest of my website to use same engine. Most of the code is already written, however I've found some forgotten parts, which nobody used for really a long time.
As most of the things there is free software, I don't like idea removing it completely, however it is quite unlikely that somebody will want to use these ancient things. Especially when it quite lacks documentation and I really forgot about that (most of them being Turbo Pascal things for DOS, Delphi components for Windows and so on). Anyway it will probably live only on
Shailu is supposed to be a vampire princess but the effect is spoiled because she wouldn't wear the fangs.
We didn't see even one Lady Gaga. I thought that was supposed to be the hot costume this year?
So, I m (almost) back from the first edition of MiniDebConf Paris, which was a success thanks to the great organizing skills in panic mode of Carl Chenet and Mehdi Dogguy. I think that everybody is already looking forward to the next edition.
I met lots of people, and it was great to be able to finally put faces on names from the french free software community. I gave two talk there, the first one on Debian and Ubuntu (
Closing advice: beside some last minute legwork, I did
essentially nothing to organize this mini-DebConf, your kudos
should be better directed to
Dear HP,