8.3. Groups management with yum-groups-manager
yum-groups-manager is used to create or edit the groups metadata file of a YUM repository. Using this tool is often much easier than to edit the corresponding XML by hand. yum-groups-manager can load a whole group metadata file, create a new group or edit an existing one, and then write the metadata as output.
Before you can use this tool you will need that the packages to be added to the corresponding groups be available via yum, ie, they must be available in the configured repositories.
Creation of the Rubyera YUM group
# yum-groups-manager -n "Rubyera" --id=rubyera --description="Rubyera, packages from..." --save=comps.xml --mandatory passenger
# cat comps.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE comps PUBLIC "-//Red Hat, Inc.//DTD Comps info//EN" "comps.dtd">
<comps>
<group>
<id>rubyera</id>
<default>false</default>
<uservisible>true</uservisible>
<display_order>1024</display_order>
<name>Rubyera</name>
<description>Rubyera, packages from...</description>
<packagelist>
<packagereq type="mandatory">passenger</packagereq>
</packagelist>
</group>
</comps>
Once created the comps.xml
file and after placing it in the same directory whith the rpms, you must run the createrepo
command now specifying the name of the file that defines groups.
# createrepo --verbose -g comps.xml /var/www/html/x86_64/
Now the group is available.
# yum clean metadata
# yum groupinfo Rubyera
Loaded plugins: download-order, downloadonly, filter-data, list-data, presto, verify
Setting up Group Process
...
rubyera | 1.9 kB 00:00 ...
rubyera/group_gz | 341 B 00:00 ...
Group: Rubyera
Description: Rubyera, paquetes producidos por ...
Mandatory Packages:
passenger
It is not possible to add mandatory applications and optionals or by default in one command, you must use separate commands, for example, to add optional packages you can do:
# yum-groups-manager --id=rubyera --load=repodata/comps.xml --save=comps.xml --optional dhcp_probe
Note that you can not operate on the same input and output file. The option --load
loads thecomps.xml
file previously produced by createrepo, while --save
is operating on the directory where the rpms are, in this case /var/www/html/x86_64
.
Once you have a new comps.xml
file, shown below, you must rebuild the YUM repository with createrepo
.
# cat rubyera.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE comps PUBLIC "-//Red Hat, Inc.//DTD Comps info//EN" "comps.dtd">
<comps>
<group>
<id>rubyera</id>
<default>false</default>
<uservisible>true</uservisible>
<display_order>1024</display_order>
<name>Rubyera</name>
<description>Rubyera, paquetes producidos por...</description>
<packagelist>
<packagereq type="optional">dhcp_probe</packagereq>
<packagereq type="mandatory">passenger</packagereq>
</packagelist>
</group>
</comps>
# createrepo --verbose -g comps.xml /var/www/html/x86_64/
Verification of the new composition of Rubyera group.
# yum clean metadata
# yum groupinfo Rubyera
...
Group: Rubyera
Description: Rubyera, paquetes producidos por ...
Mandatory Packages:
passenger
Optional Packages:
dhcp_probe
To add a second group:
# yum-groups-manager --name="Rubyera debuginfo" --id=rubyera-debuginfo --load=repodata/comps.xml --save=comps.xml dhcp_probe-debuginfo passenger-debuginfo
# cat comps.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE comps PUBLIC "-//Red Hat, Inc.//DTD Comps info//EN" "comps.dtd">
<comps>
<group>
<id>rubyera</id>
<default>false</default>
<uservisible>true</uservisible>
<display_order>1024</display_order>
<name>Rubyera</name>
<description>Rubyera, packages from...</description>
<packagelist>
<packagereq type="mandatory">passenger</packagereq>
<packagereq type="optional">dhcp_probe</packagereq>
</packagelist>
</group>
<group>
<id>rubyera-debuginfo</id>
<default>false</default>
<uservisible>true</uservisible>
<display_order>1024</display_order>
<name>Rubyera debuginfo</name>
<description></description>
<packagelist>
<packagereq type="default">dhcp_probe-debuginfo</packagereq>
<packagereq type="default">passenger-debuginfo</packagereq>
</packagelist>
</group>
</comps>
# yum groupinfo "Rubyera debuginfo"
...
Group: Rubyera debuginfo
Default Packages:
dhcp_probe-debuginfo
passenger-debuginfo