Spec File Reference
Tags
Name:is used to define the name of the software being packaged.Version:defines the version of the software being packaged.Release:can be thought of as the package’s version.%descriptiondescribe the packages intended use.Summary:is used to define a one-line description of the packaged software.Copyright:is used to define the copyright terms applicable to the software being packaged.Distribution:is used to define a group of packages, of which this package is a part.Icon:is used to name a file containing an icon representing the packaged software.Vendor:is used to define the name of the entity that is responsible for packaging the software.URL:is used to define a URL that can be used to obtain additional information about the packaged software.Group:is used to group packages together by the types of functionality they provide.Packager:is used to hold the name and contact information for the person or persons who built the package.Requires:is used to alert RPM to the fact that the package needs to have certain capabilities available in order to operate properly.Serial:is used to define a serial number for a package. This is only necessary if RPM is unable to determine the ordering of a package’s version numbers.Conflicts:is used to alert RPM to the fact that the package is not compatible with other packages.AutoReqProv:is used to control the automatic dependency processing performed when the package is being built.
- To disable automatic dependency processing, add the following line: AutoReqProv: no
ExcludeArch:is used to direct RPM to ensure that the package does not attempt to build on the excluded architecture(s).ExclusiveArch:is used to direct RPM to ensure the package is only built on the specified architecture(s).ExcludeOs:is used to direct RPM to ensure that the package does not attempt to build on the excluded operating system(s).ExclusiveOs:is used to denote which operating system(s) should only be be permitted to build the package.Prefix:is used to define part of the path RPM will use when installing the package’s files.BuildArch:is used to define the architecture of the intended install target.BuildRoot:is used to define an alternate build root, where the software will be installed during the build process.Source:is used to define the filename of the sources to be packaged.NoSource:is used to alert RPM to the fact that one or more source files should be excluded from the source package file.Patch:is used to define the name of a patch file to be applied to the package’s sources.NoPatch:is used to alert RPM to the fact that one or more patch files should be excluded from the source package file.%fileslist indicates to RPM which files on the build system are to be packaged.
Scripts
%prepis executed first during an rpm build (creating an rpm).%buildis the second scriptlet executed during an rpm build.%installdoes whatever is necessary to actually install the newly built software.%cleanas the name implies, is used to clean up the software’s build directory tree.%preexecutes just before the package is to be installed.%postexecutes after the package has been installed.%preunexecutes just before the package is to be erased.%postunexecutes after the package has been erased.%verifyscriptexecutes whenever the installed package is verified by RPM’s verification command.
Macros
%setupis used to unpack the original sources, in preparation for the build.%patchas its name implies, is used to apply patches to the unpacked sources.
File-related Directives
%docflags the filename(s) that follow, as being documentation.%configis used to flag the specified file as being a configuration file.%attrpermits finer control over three key file attributes: mode, uid, gid%verifycan control which of 9 file attributes are to be checked when an RPM verification is done.%docdiris used to add a directory to the list of directories that will contain documentation.%dirRPM will package only the directory itself.%packageis used to permit the creation of more than one package per spec file and can appear at any point in the spec file.
Conditionals
%ifarchis used to begin a section of the spec file that is architecture-specific.%ifnarchis used in a similar fashion to%ifarch, except that the logic is reversed.%ifosis used to control RPM’s spec file processing based on the build system’s operating system.%ifnosis the logical complement to%ifos%elseis placed between a%ifconditional of some persuasion, and a%endif.%endifis used to end a conditional block of spec file statements.
转载于:https://my.oschina.net/u/158589/blog/76553
发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/110329.html原文链接:https://javaforall.net

