include("site.inc"); $template = new Page; $template->initCommon(); $template->displayHeader(); ?>
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.
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>
id: (REQUIRED) The id of a group is just a short form used throughout the comps file to refer to the group. The intent is that it allows the changing of the user visible group names without having to change things through the comps file. (unicode string)
name: (REQUIRED) This is the user visible name of the group which is displayed in the various tools which allow package selection using the comps file. This is a translatable element with translations done using intltool's xml style. (unicode string)
default: This determines whether or not the group should be selected by default on a custom installation of Red Hat Linux. If not specified, it defaults to no. (boolean)
description: (REQUIRED) This is a short description of the group. This is a translatable element with translations done using intltool's xml style. (unicode string)
uservisible: This determines whether or not the group is shown in config tools by default. If not specified, it defaults to yes. (boolean)
packagelist: (REQUIRED) This is a list of packages included within the group. (list)
packagereq: Name of package to include. (string)
Attributes are:
type: Whether the package is a mandatory part of the group, a package which is installed by default with the group, or a package which can be optionally selected for installation as part of a group. (enum: "mandatory", "default", "optional")
requires: This package will only be installed if the required package is also installed. Note that this attribute is not guaranteed to continue working with its current semantics in the future.
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.
name: (REQUIRED) This is the displayed name of the category. This is a translatable element.
subcategories: (REQUIRED) This is the list of subcategories which are a part of this category. It is made up of a list of <subcategory></subcategory> elements. (list)
subcategory: This is one of the group ids from above. (string)
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>
name: (REQUIRED) This is the name of the package, rpm.RPMTAG_NAME from the package. (string)
dependencylist: This is a list of the required packages for this package. This list is *only* used right now by anaconda as a precomputed dependency tree to be able to have correct size calculations without having to have full file lists for dependency resolution. (list)
dependency: The name of a package required by this package. (string)
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.
Remove the packages section from the comps file (hint: maintain your master comps file without this information. You can find a tarball with our master version of the comps file and the po files used to merge the translations here. UPDATE: Red Hat Linux 9 available here)
Run '/usr/share/comps-extras/getfullcomps.py comps.xml /path/to/tree arch' where /path/to/tree is the path to the base of your Red Hat Linux installation tree and arch is the architecture the tree is for. Note that this assumes that comps.xml exists as '/path/to/tree/arch/RedHat/base/comps.xml'. Redirect the output to a temporary file.
Remove the last line (</comps>) from the comps.xml
file.
Cat the temporary file to the end of comps.xml
Echo "</comps>" to the end of comps.xml
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 :)
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
This document was written and is currently maintained by Jeremy Katz print mailto("katzj@redhat.com","","About Editing the Comps File"); ?>. 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 print mailto("anaconda-devel-list@redhat.com","","Editing comps.xml"); ?>
Last updated: 2 October 2002 $template->displayFooter('$Date: 2005/11/29 17:30:35 $'); ?>