openpkg/rpmtool.pod

changeset 15
0b0ffb65d705
child 428
f880f219c566
equal deleted inserted replaced
-1:000000000000 0:10d927ac1ea8
1 ##
2 ## rpmtool.pod -- OpenPKG RPM Auxiliary Tool (Manual Page)
3 ## Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
4 ## Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
5 ##
6 ## Permission to use, copy, modify, and distribute this software for
7 ## any purpose with or without fee is hereby granted, provided that
8 ## the above copyright notice and this permission notice appear in all
9 ## copies.
10 ##
11 ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
12 ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
13 ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
14 ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
15 ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
16 ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
17 ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
18 ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
19 ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
20 ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
21 ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
22 ## SUCH DAMAGE.
23 ##
24
25 =pod
26
27 =head1 NAME
28
29 B<rpmtool> - RPM Auxiliary Tool
30
31 =head1 SYNOPSIS
32
33 B<rpmtool>
34 I<command>
35 [I<command-options>]
36
37 =head1 DESCRIPTION
38
39 This is an auxiliary tool to the RedHat Package Manager (RPM). It
40 provides additional functionality for use in RPM I<spec> files while
41 building packages. The following I<command>s are available:
42
43 =over 4
44
45 =item B<platform>
46
47 This command outputs a unique platform id in the format
48 "<architecture>-<system><release>". For instance, the output on a
49 FreeBSD platform can be "i386-freebsd4.2", the output on a Linux
50 platform can be "i686-linux2.2.16", the output on a Solaris platform can
51 be "sun4u-sunos5.8", etc.
52
53 Example:
54
55 case `rpmtool platform`; in
56 *-freebsd[34].* ) ... ;;
57 *-sunos5.[678] ) ... ;;
58 *-linux2.[24].* ) ... ;;
59 esac
60
61 =item B<mflags> [B<-O>] I<tool>
62
63 This command outputs additional flags for make(1) for
64 use with the program I<tool>. It provides only standard flags which
65 always can be used. In conjunction with B<-O> (optimization), it also provides
66 reasonable job control for use on multi-processor platforms (for instance it
67 outputs "-j4" on an SMP system with 2 CPUs if GNU make or BSD pmake is used).
68
69 Example:
70
71 make `rpmtool mflags -O make`
72
73 =item B<cflags> [B<-O>] I<tool>
74
75 This command outputs additional flags for cc(1) for use with the program
76 I<tool>. It provides only standard flags which always can be used.
77 conjunction with B<-O> it provides also optimization flags (for instance
78 it outputs "-O2 -pipe" for GNU C/C++ compiler).
79
80 Example:
81
82 CC="$CC" CFLAGS=`rpmtool cflags -O $CC` ./configure ...
83
84 =item B<cppflags> [B<-p> I<prefix>] [[C<+|->I<subdir> ...]
85
86 This command output cpp(1) C<-I> options for the OpenPKG instance
87 I<prefix>. It optionally can prefix or suffix with one or more I<subdir>
88 related options, too. If I<subdir> is prefixed with C<+> (or not
89 prefixed at all), the generated option is appended. If I<subdir> is
90 prefixed with C<-> the generated option is prepended.
91
92 Example:
93
94 rpmtool cppflags -p /foo bar -baz +quux
95
96 =item B<ldflags> [B<-p> I<prefix>] [[C<+|->I<subdir> ...]
97
98 This command output ld(1) C<-L> options for the OpenPKG instance
99 I<prefix>. It optionally can prefix or suffix with one or more I<subdir>
100 related options, too. If I<subdir> is prefixed with C<+> (or not
101 prefixed at all), the generated option is appended. If I<subdir> is
102 prefixed with C<-> the generated option is prepended.
103
104 Example:
105
106 rpmtool ldflags -p /foo bar -baz +quux
107
108 =item B<files> [B<-v>] [B<-o> I<outfile>] [B<-r> I<build-root>] [I<entry> ...]
109
110 This is a dynamic variant of the RPM C<%files> section, i.e., it
111 dynamically creates the contents of the C<%files> section for use with
112 the C<%files -f> command. For this the file list entries are read from
113 the command line (or from stdin if no arguments are given or a single
114 argument C<-> is given) and written to stdout (if no B<-o> option is
115 given or its I<outfile> argument is C<->) or to I<outfile>.
116
117 The trick of this approach is to be able to use additional features in
118 the file list which RPM does not provide. The following features are
119 provided:
120
121 =over 4
122
123 =item B<Trailing Tags>
124
125 RPM requires that all tags (like C<%attr(...)> or C<%dir>) preceed the
126 path in a file list entry. This sometimes leads to ugly and unreadable
127 file lists, because all paths cannot be left-aligned. With rpmtool(8)
128 tags in the input file list can be at leading and trailing positions.
129 The output file list will nevertheless have all tags in leading
130 positions for RPM.
131
132 =item B<Syntactical Set Pattern>
133
134 RPM supports simple wildcard patterns like C</path/*> or C</path/[a-z]>,
135 etc. Sometimes it is convenient, to also have (in addition to character
136 sets) string sets like C</path/{foo,bar,quux}>. rpmtool(8) provides this
137 by syntactically (without checking the filesystem) expanding those
138 string sets.
139
140 =item B<Overriding Entries>
141
142 This is the most important feature and the reason why shtool(1)'s
143 B<files> command was implemented. Although RPM allows one to specify a
144 directory in a file list and then implicitly expands this recursively
145 into its contents, it unfortunately does not allow one to later
146 explcitly override particular entries (usually if an individual
147 C<%attr(...)> tag is required). rpmtool(8) now supports overriding
148 entries, i.e., if a path occurs multiple times, only the last occurance
149 is kept.
150
151 =item B<Negation Tag>
152
153 This provides an additional tag C<%not> which can be used to explicitly
154 exclude a previously implicitly added entry.
155
156 =back
157
158 Example:
159
160 %install
161 :
162 rpmtool files -o files -r$RPM_BUILD_ROOT \
163 '%defattr(-,foo,foo)' \
164 '%{prefix}' \
165 '%attr(1755,root,foo) %{prefix}/bin/bar' \
166 '%not %dir {%{prefix},%{prefix}/*,%{prefix}/man/*}' \
167 '%not %{prefix}/info/dir'
168
169 %files -f files
170
171 =item B<msg> [B<-b>]
172
173 This displays the contents of F<stdin> as a boxed message. If option
174 B<-b> is given it additionally beeps once before displaying the box.
175
176 =back
177
178 =head1 HISTORY
179
180 This tool was created in November 2000 for use in OpenPKG, the
181 cross-platform RPM-based Unix software packaging facility.
182
183 =head1 AUTHOR
184
185 Ralf S. Engelschall
186 rse@engelschall.com
187 www.engelschall.com
188
189 =cut
190

mercurial