initCommon(); $template->displayHeader(); ?>

Editing the Comps File

As of Red Hat Linux 8.0, the comps file has changed format completely. In previous releases of Red Hat Linux, it was just a simple text file with a few tags and a somewhat inflexible parser. As of Red Hat Linux 8.0, we instead use an XML based file so that it is both easily parsable and a defined syntax.

Looking at the comps file, you'll see that it starts out in a standard fashion with the xml version and the DTD declaration. You then get into the body of the document within the <comps> tag.

The comps file is then broken into several different sections. The first is the group lists, which describe the different groups (or components) available for selection during a Red Hat Linux installation. This includes group names, descriptions and lists of included packages. The second section is a group hierarchy. This defines an ordering of the groups by breaking them down into categories. Finally, there is a section with the list of packages included and their resolved dependencies.

The Group List

A group has quite a few different attributes which are required for proper operation. The following is a list of attributes and what they're used for. Groups are defined within the <group></group> tag.

A simple group definition:

<group>
  <id>somegroup</id>
  <name>Sample Group</name>
  <default>true</default>
  <uservisible>false</uservisible>
  <description>This is a silly sample group</description>
  <packagelist>
    <packagereq type="mandatory">bash</packagereq>
    <packagereq type="default">cpio</packagereq>
  </packagelist>
</group>

The Group Hierarchy

This describes the tree structure displayed in various Red Hat Linux config tools for the groups. The group hierarchy is defined within the <grouphierarchy></grouphierarchy> tags. It is made up of categories defined by the <category> tag.

A sample group hierarchy listing the group above could look something like the following.

<grouphierarchy>
  <category>
    <name>Random Groups</name>
    <subcategories>
      <subcategory>somegroup</subcategory>
    </subcategories>
  </category>
</grouphierarchy>

A category is made up of the following attributes.

The Package

A package is a convenient definition of a package with dependency information used by anaconda, the Red Hat Linux installer. It is automatically generated (see below for the information on how to generate the information). A package is defined within the <package></package> tags.

A sample package looks like this:

<package>
  <name>bash</name>
  <dependencylist>
    <dependency>mktemp</dependency>
    <dependency>bash</dependency>
    <dependency>glibc</dependency>
    <dependency>libtermcap</dependency>
  </dependencylist>
</package>

Generating the full comps file

As mentioned above, the package sections of the comps file are automatically generated. To generate your own comps file, install the comps-extras package and then run the following commands.

And yes, before anyone asks, if I were to do it again, I'd place the packages information in a separate file, but it was too late to change when I realized how klunky things were :)

Parsing the comps file

A sample implementation in python for the parsing of the comps file is provided in the rhpl package shipped with Red Hat Linux. A simple use to print out all of the mandatory packages in each group follows:

#!/usr/bin/python

import rhpl.comps
import sys

comps = rhpl.comps.Comps(sys.argv[1])
for group in comps.groups.values():
    pkgs = []
    for (type, pkg) in group.packages.values():
        if type == u'mandatory':
            pkgs.append(pkg)
    print group.name, pkgs

Suggestions, Corrections, Questions?

This document was written and is currently maintained by Jeremy Katz . If you have suggestions or corrections for future versions, please feel free to email them to me. If you have questions about things in this document, please mail

Last updated: 2 October 2002 displayFooter('$Date: 2005/11/29 17:30:35 $'); ?>