RPM Production Guide (1)

Source: Internet
Author: User
Article title: RPM Production Guide (1 ). Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
Author: Yu Yiqi and Zhao Jianli
To create a software package in RPM format, you need to compile the software package description file. The standard naming format is: software name-version number-release number. spec. this file describes a lot of information about the software package, such as the software name, version, category, description summary, instructions to be executed during creation, and operations to be performed during installation, and the files to be included in the software package. With this file, RPM can produce the corresponding package file.
The following is an example of the software package (lze-6.0-2.i386.rpm) I made the small Zhao editor LZE, a detailed description of the software package description file writing. The description file is a lze-6.0-2.spec that contains the following content: (list with the nl-ba command, the number starting with each line is the row number in the file)
1 # File name: lze-6.0-2.spec
2 # File function: lze software package description
3 # Author: Zhao Jianli, graduate Team 2, yuyiqi National Defense University, China software production center
4 # Modification time: 2001.10.19
5
6 Name: lze
7 Version: 6.0
8 Release: 2
9 Summary: Xiao Zhao full-screen multi-window multi-functional editor in Chinese and English (applicable to LINUX/UNIX systems)
10 Group: Applications/Editors
11 License: Share
12 Vendor: Vertical and horizontal software production center
13 Packager: Yu Yiqi (zhsoft@371.net)
14 Source: http://zhsoft.myetang.com/lze-6.0-2.src.tgz
15 Prefix:/usr
16 Requires:/bin/sh
17 Provides: lze-edit
18
19% description
Editor: 20 Xiao Zhao is a full-screen multi-window multi-screen multi-window specially designed for users using sco unix and LINUX multi-user systems.
21 multi-functional editors in both Chinese and English.
22. it mainly has the following ten features: 1. Full-screen menu operations. 2. Diverse Display methods. 3. rich block operations. 4. 10
Powerful tabulation with 23 words. 5. flexible multi-window operations. 6. complete file operations. 7. explain that the output function is unique
24 colors. 8. built-in Chinese input method (enhanced five strokes and enhanced pinyin), practical and convenient. 9. hexadecimal editing, such as Tiger
25 wings. 10. instant translation.
26 in short, Xiao Zhao editor will be a good helper for programming and writing general documents on UNIX and LINUX systems.
27. it will help you at work, and it is easy to get on!
28
29% prep
30 echo "the pre-processing script Program (prep) starts to execute"
31% setup
32
33% build
34 echo "compile the connection script program (build) and start execution"
35 make
36
37% install
38 echo "install the script program to start execution"
39 make install
40
41% clean
42 echo "after the package is created, the script program clean starts to execute"
43
44% pre
45 echo "run the script program (pre) before installation"
46
47% post
48 echo "after installation, execute the script program (post) to start executing"
49
50% preun
51 echo "run the script program (preun) before uninstalling"
52
53% postun
54 echo "run the script program (postun) after uninstalling and start execution"
55
56% veryfiscript
57 echo "the verification script program (verifyscript) of the software package starts to execute"
58
59% triggerin -- xiuwu
60 echo "triggerin execution starts when the software package is installed"
61
62% triggerun -- yuntaishan <2.0
63 echo "triggerun execution started before the software package is uninstalled"
64
65% triggerpostun -- dapubu
66 echo "triggerpostun execution starts after the software package is uninstalled"
67
68% files
69% defattr (-, root, root)
70% config/etc/funkey. def
71% config/etc/inputme. def
72% doc/usr/doc/lze-6.0/README
73% doc/usr/doc/lze-6.0/LICENSE
74/usr/bin/lze
75/usr/bin/lzeime. py
76/usr/bin/lzeime. wb
77/etc/wbzc. dat
78
79% changelogs
80 * Tue Aug 18 1998 Yu Yiqi
81-built-in pinyin and five-stroke input method
82 * Fri May 01 1998 Yu Yiqi
83-added multi-window operations
84 * Mon Mar 24 1997 Yu Yiqi
85-added block Operation Commands
86
This description file includes the following content:
I. comment rows
See Row 1-4.
It starts with # and serves as an annotation to help users understand what is written, but it does not have any effect on the generation of software packages. In this file, the comment lines are concentrated in the file header. In fact, it can be anywhere in the description file.
II. file header
See Row 6-17.
The file header describes the basic information of the software package. It contains several fields, including required fields and optional fields. A domain occupies one row. the description format is as follows:
Domain name: domain value
Note: the domain name is case-insensitive and the domain value cannot be blank.
The file header must have the following six fields:
1. Name:
This domain defines the software name.
2. Version:
This Domain Definition version number. The version number is added only when the software changes significantly. Note: the version number cannot contain minus (-) characters.
3. Release:
This field defines the release number. If the software changes little than before, only the release number is added without changing the version number. Note: The release number cannot contain minus (-) characters.
RPM uses the above Name (software Name), Version (Version number), Release (Release number) and system number to Name the software package, such as the package output file Name for the lze-6.0-2.i386.rpm.
4. Summary:
This domain defines a software package introduction, which is a one-sentence description.
5. Group:
This domain defines the category of the software. For more information, see < <精通rpm之五--查询篇> >. In this example, Applications/Editors indicate that the software belongs to the "application/editor" class.
6. License:
This domain defines the license or copyright rules applicable to the software. This domain can also be defined by Copyright (Copyright). The two agree. License details include: GPL (General Public License, applicable to free software), BSD, MIT, Public Domain (Public Domain), Distributable (contribution), Commercial (Commercial), Share (Share).
The optional fields of the file header include the following categories:
1. Basic information
1.1 Vendor:
This domain defines the vendor (vendor) of the software ).
1.2 Distribution:
This domain defines the release of the software, which is the classification of the software package maker. Generally, a release is composed of several software packages. If I want to make a release named "PandaTV 95", each of the software packages (such as bamboo 95) should have the following line:
Distribution: PandaTV '95
1.3 Icon:
This field specifies the icon file name used by the software package. This file is in GIF or XPM format and must be stored in the directory indicated by the % _ sourcedir (source code directory) macro of RPM. the default format is/usr/src/dist/SOURCES. RPM itself does not use icons, but it stores the content of the icon file in the package file and stores the content in the RPM database during installation. This icon can be used by the RPM Package management tool on the graphic interface to improve the interface effect and increase visibility. The following example indicates that the software package uses panda. xpm as the icon:
Icon: panda. xpm
1.4 Packager:
This domain defines the package, that is, the person or company that created the package. The writing format is:
Package name <电子信箱或相关网页>
See the description file line 13th.
1.5 Serial:
This domain defines the software serial number or the domain name Epoch. The software serial number is an integer specified by the package. it should increase with the increase of the version number and always keep the value unique. The software serial number can be used to describe the dependency between software packages. In the following example, the serial number of the specified software package is 4:
Serial: 4
Or use:
Epoch: 4
1.6 URL:
This domain defines a web address that contains information about the packaging software. For example:
URL: http://devplanet.fastethernet.net/gxedit.html
2. Dependency
The dependency is RPM used to describe the relationship between software packages. The RPM on which a software package depends is called a function. it can be a real software package or a virtual software package (virtual package ). The virtual package has no version number.
Dependent domains include:
2.1 Provides:
This field defines the features provided by the software package, which can be repeated across multiple rows. The description format is as follows:
Provides: function 1 [, function 2]...
Note: [] is optional. multiple functions are separated by commas or spaces.
The functions provided by the software package are generally shared libraries in the form of virtual packages. When multiple software packages provide the same service, virtual packages are often used to represent the service. For example, a mail client allows users to use different ways of reading (text form, HTML form, etc.), and can require any mail reader to provide a mail-reader virtual package. In this way, the description file of the email program should have such a line:
Provides: mail-reader
So that it can be used by the Mail client.
2.2 Requires:
This field defines the features required by the software package, which can be repeated across multiple rows. The description format is as follows:
Requires: function 1 [comparison operator 1 [serial number 1:] Version 1 [-release number 1] [, function 2 [comparison operator 2 [serial number 2:] version 2 [-release number 2]...
Where: * [] is included as an option;
* Comparison operators can be <(less than),> (greater than), = (equal to), >=( greater than or equal to), or <= (less than or equal );
* When no serial number is selected, the default RPM value is 0;
* Functions can be separated by commas.
Example: Requires: aaa, bbb> = 3.0, ccc <. 0-1
Note: In this example, the generated package must have the following functions during installation:
(1) aaa (the aaa package has been installed in the system, or the aaa virtual package has been provided by software packages in the installed software package );
(2) the bbb package has been installed and must be later than or equal to 3.0;
(3) the ccc package has been installed and the version must be smaller than the serial number of 2, the version number is 5.0, and the release number is 1.
When you compare the version of RPM, the sequence of comparison is: First version number, then release number, and finally compare the serial number. By comparison, determine which version is newer and which version is older.
2.3 Conflicts:
This field defines which features are in conflict with this software package (cannot coexist ). This field can also be written multiple times in the description file. The description format is the same as that of the Requires domain:
Conflicts: function 1 [comparison operator 1 [serial number 1:] Version 1 [-release number 1] [, function 2 [comparison operator 2 [serial number 2:] version 2 [-release number 2]...
Where: * [] is included as an option;
* Comparison operators can be <(less than),> (greater than), = (equal to), >=( greater than or equal to), or <= (less than or equal );
* When no serial number is selected, the default RPM value is 0;
* Functions can be separated by commas.
For example:
Conflicts: xxx =. 0 yyy> = 3.0
Note: In this example, the generated package conflict functions are as follows:
(1) when the xxx package version in the system is equal
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.