Archive for June, 2008
This weeks updates
This has been somewhat of a amputated week, last weekend I was away for a bicycle race and this weekend I’m going to a wedding, so it hasn’t been a lot of time for programming. Anyways I’ve added human-readable output for pkg_info’s -s option (the old is also available with the -b option). The environment variable PKG_DBCACHE_FILE is used to specify where the cache-file is located. And I’ve added features for the pkg_convert program that checks if key’s exists within the database and the printing of the data indexed in the database. The pkg_create -O option has been modified to cache information as well and installing ports from /usr/ports/ will then work if you specify the PKG_CMD in /usr/ports/Mk/bsd.port.mk to point to this pkg_create.
I’m hoping to release a test-version next week so that I can receive comments and bugs which I’m sure there is. On Thursday next week I’m going on a one week vacation to Greece so that you will have a good time to test the tools and fill my mailbox ![]()
Progress
Changes
These are the main things I’ve done so far some abstract and some more specific, if you want to check out the code you can get it from the perforce depot: //depot/projects/soc2008/andenore_pkginstall/
pkg_convert:
- Added a convert program (pkg_convert) that indexes information to PKG_DBCACHE_FILE (defaults to $PKG_DBDIR/pkgcache.db)
pkg_info:
- Improved performance for -W option using the dbcache
- A quick profiling of pkg_info revealed that the default behavior for pkg_info was to call read_plist for each package even though not needed so I’ve added a check for this and it runs significantly faster.
pkg_add:
- Indexes information to dbcache according to the add
pkg_delete:
- “Deindexes” information according to the delete
lib:
- Changed methods in match.c to use cache if available
- Added global variable ‘database’ of type DB* (the database object)
- Added database helper functions
I’ve done some quick profiling of pkg_version and it spends much of it’s time in read_plist too (just to fetch the origin). So I plan to index the origin of each package and speed this up in pkg_version.
Getting started
Now I’m finally done with my exams for the semester and travelled home where I will spend the summer.
This week I started to work on my project which is adding .db support to pkg_install. I have written some database helper functions and a simple converter program that indexes portnames in /var/db/pkg to the database file which is going to act as a cache rather than a replacement for the whole flat-database. I have rewritten some functions in pkg_info that uses the cache and it works well and seemingly faster although I have not taken time measurements (writing a time comparison script is on my todo-list).
Next week I will continue to improve the converter to index more information that is needed and gradually rewrite the pkg-tools to make use of the database.