C++ CSS HTML Java JavaScript MySQL Oracle PERL PHP SQL Unix VBScript XHTML XML Сети
The Lone Directive: %package
 

The Lone Directive: %package

While every directive we've seen so far is used in the %files list, the %package known as subpackages. Subpackages are named according to the contents of the line containing the %package directive. The format of the package directive is:
%package: <string>
        

The <string>name tag value of "foonly", and a "%package doc" line, then the subpackage name will be foonly-doc.

-n <string> — Use <string> As the Entire Subpackage Name

As we mentioned above, the name of a subpackage normally includes the main package name. When the -n option is added to the %package directive, it directs RPM to use the name specified on the %package line as the entire package name. In the example above, the following %package line would create a subpackage named foonly-doc:
%package doc
          

The following %package line would create a subpackage named doc:
%package -n doc
          

The %package%package directive will only apply to that subpackage.

Finally, the name string specified by the %package directive is also used to denote which parts of the spec file are a part of that subpackage. This is done by including the string (along with the -n option, if present on the %package line) on the starting line of the section that is to be subpackage-specific. Here's an example:
…
%package -n bar
…
%post -n bar
…
          

In this heavily edited spec file segment, a subpackage called bar has been defined. Later in the file is a post-install script. Because it has subpackage bar's name on the %post line, the post-install script will be part of the bar subpackage only.

For more information on building subpackages, please see Chapter 18.

Главная