Tuesday, October 6, 2009

Importing APT repository info into a SQL DB

Hello,
in case you love repositories and databases there is a simple utility that allows you to export a remote APT repository metatada into a SQL database.
It was only tested with sqlite3 and MySQL, should work with any sqlalchemy supported DB .

First you need to get debfactory using bzr:
bzr checkout lp:debfactory

Now let's import the package info for Ubuntu Karmic (i386).
cd debfactory/bin
./apt2sql.py -d sqlite:///apt2sql.db \
http://archive.ubuntu.com/ubuntu/ karmic "*" i386

Check the packages count from the db:

sqlite3 apt2sql.db "SELECT COUNT(*) FROM package"

No comments:

Post a Comment