wiki:Tools/DebianPkgmgrCreationScript
Last modified 11 years ago Last modified on 11/10/10 05:23:52

Debian Pkgmgr Creation Script

The tool create-debian-pkglist-gp.py is a Python script that generates the required XML files in the Pkgmgr directory for Bcfg2 to install software with the APT driver ("gp" stands for the initials of the author, Guillaume Pratte, as the script is not officially incorporated in Bcfg2 for now, and as an previous version of this script exists as "create-debian-pkglist.py").

The configuration file

The tool reads it's configuration from a file named $REPOS/etc/debian-pkglist.conf, where $REPOS is the path to the Bcfg2 repository (for example, /var/lib/bcfg2). Here is an example of this file :

[ubuntu-dapper]
deb_url=deb http://gulus.usherbrooke.ca/ubuntu dapper main restricted universe
deb_url2=deb http://gulus.usherbrooke.ca/ubuntu dapper-updates main restricted universe
deb_url3=deb http://gulus.usherbrooke.ca/ubuntu dapper-security main restricted universe
priority=0
architectures=i386,amd64
group_names=dapper

[ubuntu-feisty]
deb_url=deb http://gulus.usherbrooke.ca/ubuntu feisty main universe multiverse restricted
deb_url2=deb http://gulus.usherbrooke.ca/ubuntu feisty-updates main universe multiverse restricted
deb_url3=deb http://gulus.usherbrooke.ca/ubuntu feisty-security main universe multiverse restricted
priority=0
architectures=i386,amd64
group_names=feisty

This will create two files in the Pkgmgr directory, one named "ubuntu-dapper.xml", and the other "ubuntu-feisty.xml". The file is named after the sections of the configuration file (i.e. the file name is the string between the brackets). The ubuntu-dapper.xml file will be the result of the fusion of the three URLs specified. This fusion is done by comparing packages versions with dpkg and keeping only the most recent version of the packages.

Here is a description of the options :

deb_url

Specify the Debian URL(s) to use to generate the file. The format of this URL is the same as the URLs in /etc/apt/sources.list. Up to 9 URLs can be specified : deb_url, deb_url2, deb_url3, ..., deb_url9. The order of these URLs is not important. If a package is present in more than one URL, the most recent version of the package is kept. The package version comparison is done with the command "dpkg --compare-versions".

priority

The priority to put in the PackageList? tag of the generated XML file. A higher number means a higher priority. This priority is used by Bcfg2 to determine what package version to use if two XML lists contains the same package with a different version number.

architectures

A list of one or more architectures. For example :

architectures=i386

or :

architectures=i386, amd64

If more than one architecture is specified, groups will be used to differentiate the versions for each architecture in the XML file. Packages which have the same versions across all architectures will have no architecture-based group.

group_names

A list of one or more groups that all packages will belong to. As a consequence, packages will be available for the client only if it belong to these groups. It is suggested to use the code name of the distribution as defined in the metadata (for instance, in the bcfg-os.xml file).

Download

This tool is available here : create-debian-pkglist-gp.py

The file must be saved into $REPOS/etc/ (where $REPOS is the path to the Bcfg2 repository (for example, /var/lib/bcfg2)).

Script invocation

The script must be invoked like this : python create-debian-pkglist.py

Invoking with -v will ouput the URLs being processed.