| Maximum RPM: Taking the Red Hat Package Manager to the Limit | ||
|---|---|---|
| Prev | Chapter 18. Creating Subpackages | Next |
While creating subpackages changes the general structure of the spec file, there's one section that doesn't change: the build-time scripts. This means there is only one set of %prep, %build, and %install scripts in any spec file.
Of course, even if RPM doesn't require any changes to these scripts, you still might need to make some subpackage-related changes to them. Normally these changes are related to doing whatever is required to get the all the software unpacked, built, and installed. For example, if packaging client/server software, the software for both the client and the server must be unpacked, and then both the client and server binaries must be built and installed.
Let's add some build-time scripts and take a final look at the spec file:
Name: foo
Version: 2.7
Release: 1
Source: foo-2.7.tgz
CopyRight: probably not
Summary: The foo app, and the baz library needed to build it
Group: bogus/junque
%description
This is the long description of the foo app, and the baz library needed to
build it...
%package server
Summary: The foo server
Group: bogus/junque
%description server
This is the long description for the foo server...
%package client
Summary: The foo client
Group: bogus/junque
%description client
This is the long description for the foo client...
%package -n bazlib
Version: 5.6
Summary: The baz library
Group: bogus/junque
%description -n bazlib
This is the long description for the bazlib...
%prep
%setup
%build
make
%install
make install
%pre
echo "This is the foo package preinstall script"
%pre server
echo "This is the foo-server subpackage preinstall script"
#%pre client
#echo "This is the foo-client subpackage preinstall script"
%pre -n bazlib
echo "This is the bazlib subpackage preinstall script"
%files
/usr/local/foo-file
%files server
/usr/local/server-file
%files client
/usr/local/client-file
%files -n bazlib
/usr/local/bazlib-file
|
As you can see, the build-time scripts are about as simple as they can be. [1]
| [1] | This is the advantage to making up an example. A more real-world spec file would undoubtedly have more interesting scripts. |