7.comps.xmlの編集方法RedHat8.0からこれまでのフォーマットからXMLベースのフォーマットに変更されました。それまでのCompsファイルの構文はとてもシンプルなものでしたが、XML化され幾分見づらくなったように思えます。 とはいうもののUpdateファイルや機能追加のファイルがあった場合はこのcomps.xmlファイルを編集する必要があります。 編集対象バージョン:RedHat8.0以降 文章はいずれぽちネットで確認したものをUpdateするだワン! 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 ListA 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 HierarchyThis 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 PackageA 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 fileAs 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 fileA 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
|