Debtags development
Python libraries
The Debtags python library is not as complete as the C++ library but it's the best place to start playing with Debtags and prototyping code.
It can be found as part of the python-debian package, which also comes with
many examples. All methods are documented, and the package has a
README.Debtags file with the aggregated documentation.
The core of the Python library is the DB object, which stores the mapping
from package names to tag names and vice versa. Packages and tags are
represented as simple strings.
C++ libraries
There are two C++ libraries that can be used to manipulate tag data:
libtagcoll and libept.
libtagcoll provides generic functions to handle "items" tagged with "tags",
without putting any limit on what an "item" and a "tag" are.
libept is designed to be the engine of a full-featured package manager
application, and it implements a specialisation of libtagcoll for the Debian
and Debtags case. It is currently used as the engine for the adept package
manager.
libtagcoll
The library can be used to work with Debian packages and Debtags tags, or with
books and categories, or even people and IRC channels. The item and tag types
are template parameters, and the only requirement on the underlying type is
that it can be stored in a std::set.
The library itself is a collection of all sorts of useful code, divided in various sections:
inputis an input stream abstraction used to support deserialisation of tag data.streamis a collection of functions to handle item and tag information as a stream, and it's useful to perform analysis and changes on the fly while reading or writing tag information.collcontains various different implementations of collections of tagged items, that the library calls "tagged collections".diskindexcontains the code to implement a fast, read only index for tag information.tagexprcontains the code to build and evaluate binary tag expressions as can be seen intagcoll grepanddebtags search.
libept
libept provides abstractions for all the elements that a package manager
application needs to handle: packages, versions, dependencies, caches, tags
and so on.
The main design feature of libept is that the library can be reconfigured to
use different kinds of packages and caches, allowing a package manager to be
easily from Debian to another distribution based on different technology.
To achieve this, all classes are templatised on a configuration class, that defines what are the classes that implement all the various kinds of components used by the library.
In libept, the code that concerns Debtags is found in ept/cache, and its
main parts are:
tag.himplements theFacetandTagobjects.debtags/vocabulary.himplements access to the Debtags vocabulary, through the fast on-disk index. It also allows to createFacetandTagobjects from facet and tag anmes.debtags/tagmap.himplements the association betweenPackageandTagobjects, using the fast on-disk index. This is the part that implements the specialisation oflibtagcollfor Debtags.debtags/update.himplements rebuilding all the data files and indexes in the/var/lib/debtagsdirectory
Javascript libraries
At http://debtags.alioth.debian.org/js/debtags.js there is the Javascript library that is used to support the various Debtags web applications.
If you are planning to handle Debtags information using Javascript, it probably contains code worth recycling.