Reference: Max RPM book, Edward C. Bailey
Building a package is similar to compiling code—there are inputs, an engine, and outputs.
2) Patches - RPM gives you the ability to automatically apply patches.
3) Spec File - It contains information required by RPM to build the package, as well as instructions telling RPM how to build it. It also dictates exactly what files are a part of the package, and where they should be installed. There are eight sections in spec file
3.1 - The Preamble - It contains information that will be displayed when users request information about the package. This would include a description of the package’s function, the version number of the software, and so on.
3.2 - The Prep Section - necessary preparations are made prior to the actual building of the software. The contents of this section are an ordinary shell script. However, RPM does provide two macros. One macro can unpack a compressed tar file and cd into the source directory. The other macro easily applies patches to the unpacked sources.
3.3 - The Build Section - The build section consists of a shell script. It is used to perform whatever commands are required to compile the sources. This section could consist of a single make command, or be more complex if the build process requires it.
3.4 - The Install Section - It also consists of a shell script. It is used to perform the commands required to install the software. This section might only consist of a make install command. Otherwise, the usual assortment of cp, mv, or install commands to get the job done.
3.5 - Install and Uninstall Scripts - It consists of scripts that will be run, on the user’s system, when the package is actually installed or removed.
3.6 - The Verify Script - It is executed when RPM verifies the package’s proper installation. While RPM does most of the work verifying packages, this script can be used to verify aspects of the package that are beyond RPM’s capabilities.
3.7 - The Clean Section - contains a script that can clean things up after the build. This script is rarely used, since RPM normally does a good job of clean-up in most build environments.
3.8 - The File List - The last section consists of a list of files that will comprise the package. Additionally,
a number of macros can be used to control file attributes when installed, as well as to denote which files are documentation, and which contain configuration information. The file list is very important — if it is missing, no package will be built.
Engine: RPM
It performs a number of steps during the build process:
*) Executes the commands and macros in the prep section of the spec file.
*) Checks the contents of the file list.Building a package is similar to compiling code—there are inputs, an engine, and outputs.
Inputs
1) Sources - It should be a tar file. RPM can handle other archive formats, but a bit more up-front effort is required.2) Patches - RPM gives you the ability to automatically apply patches.
3) Spec File - It contains information required by RPM to build the package, as well as instructions telling RPM how to build it. It also dictates exactly what files are a part of the package, and where they should be installed. There are eight sections in spec file
3.1 - The Preamble - It contains information that will be displayed when users request information about the package. This would include a description of the package’s function, the version number of the software, and so on.
3.2 - The Prep Section - necessary preparations are made prior to the actual building of the software. The contents of this section are an ordinary shell script. However, RPM does provide two macros. One macro can unpack a compressed tar file and cd into the source directory. The other macro easily applies patches to the unpacked sources.
3.3 - The Build Section - The build section consists of a shell script. It is used to perform whatever commands are required to compile the sources. This section could consist of a single make command, or be more complex if the build process requires it.
3.4 - The Install Section - It also consists of a shell script. It is used to perform the commands required to install the software. This section might only consist of a make install command. Otherwise, the usual assortment of cp, mv, or install commands to get the job done.
3.5 - Install and Uninstall Scripts - It consists of scripts that will be run, on the user’s system, when the package is actually installed or removed.
3.6 - The Verify Script - It is executed when RPM verifies the package’s proper installation. While RPM does most of the work verifying packages, this script can be used to verify aspects of the package that are beyond RPM’s capabilities.
3.7 - The Clean Section - contains a script that can clean things up after the build. This script is rarely used, since RPM normally does a good job of clean-up in most build environments.
3.8 - The File List - The last section consists of a list of files that will comprise the package. Additionally,
a number of macros can be used to control file attributes when installed, as well as to denote which files are documentation, and which contain configuration information. The file list is very important — if it is missing, no package will be built.
Engine: RPM
It performs a number of steps during the build process:
*) Executes the commands and macros in the prep section of the spec file.
*) Executes the commands and macros in the build section of the spec file.
*) Executes the commands and macros in the install section of the spec file. Any macros in the file list are executed at this time, too.
*) Creates the binary package file.
*) Creates the source package file.
Outputs
The end product of this entire process is a source package file and a binary package file.1) Source package: It is a specially formatted archive that contains the following files - the original compressed tar file(s), spec file, patches. It is a great way to archive all the information needed to rebuild a particular version of the package.
2) Binary RPM: It contains the files that comprise the application, along with any additional information needed to install and erase it.
Building packages
Step 1: Creating the Build Directory Structure
Default directory layout consists of a single top-level directory (/usr/src/redhat) with five subdirectories./usr/src/redhat/
SOURCES - Contains the original sources, patches, and icon files.
SPECS - Contains the spec files used to control the build process.
BUILD - The directory in which the sources are unpacked, and the software is built.
RPMS - Contains the binary package files created by the build process.
SRPMS - Contains the source package files created by the build process.
1 comment:
First and foremost, are the sources. After all, without them, there wouldn't be much to build! In the case of packaging someone else's software, the sources should be kept as the author distributed them, which usually means a compressed tar file. RPM can handle other archive formats, but a bit more up-front effort is required.
http://www.delld620.com/
Post a Comment