perl.prov patch (#43081).
[platform/upstream/rpm.git] / rpm.spec.in
1 %define with_python_subpackage  @WITH_PYTHON_SUBPACKAGE@ %{nil}
2 %define with_bzip2              @WITH_BZIP2@ %{nil}
3 %define with_apidocs            @WITH_APIDOCS@ %{nil}
4 %define with_internal_db        @WITH_INTERNAL_DB@ %{nil}
5 %define strip_binaries          1
6
7 # XXX legacy requires './' payload prefix to be omitted from rpm packages.
8 %define _noPayloadPrefix        1
9
10 %define __prefix        /usr
11 %{expand:%%define __share %(if [ -d %{__prefix}/share/man ]; then echo /share ; else echo %%{nil} ; fi)}
12
13 Summary: The Red Hat package management system.
14 Name: rpm
15 %define version @VERSION@
16 Version: %{version}
17 Release: 0.1
18 Group: System Environment/Base
19 Source: ftp://ftp.rpm.org/pub/rpm/dist/rpm-4.0.x/rpm-%{version}.tar.gz
20 Copyright: GPL
21 Conflicts: patch < 2.5
22 %ifos linux
23 Prereq: gawk fileutils textutils mktemp
24 Requires: popt
25 %endif
26
27 %if !%{with_internal_db}
28 BuildRequires: db3-devel
29
30 # XXX glibc-2.1.92 has incompatible locale changes that affect statically
31 # XXX linked binaries like /bin/rpm.
32 %ifnarch ia64
33 Requires: glibc >= 2.1.92
34 %endif
35 %endif
36
37 # XXX Red Hat 5.2 has not bzip2 or python
38 %if %{with_bzip2}
39 BuildRequires: bzip2 >= 0.9.0c-2
40 %endif
41 %if %{with_python_subpackage}
42 BuildRequires: python-devel >= 1.5.2
43 %endif
44
45 BuildRoot: %{_tmppath}/%{name}-root
46
47 %description
48 The RPM Package Manager (RPM) is a powerful command line driven
49 package management system capable of installing, uninstalling,
50 verifying, querying, and updating software packages.  Each software
51 package consists of an archive of files along with information about
52 the package like its version, a description, etc.
53
54 %package devel
55 Summary: Development files for applications which will manipulate RPM packages.
56 Group: Development/Libraries
57 Requires: rpm = %{version}, popt
58
59 %description devel
60 This package contains the RPM C library and header files.  These
61 development files will simplify the process of writing programs which
62 manipulate RPM packages and databases. These files are intended to
63 simplify the process of creating graphical package managers or any
64 other tools that need an intimate knowledge of RPM packages in order
65 to function.
66
67 This package should be installed if you want to develop programs that
68 will manipulate RPM packages and databases.
69
70 %package build
71 Summary: Scripts and executable programs used to build packages.
72 Group: Development/Tools
73 Requires: rpm = %{version}
74
75 %description build
76 This package contains scripts and executable programs that are used to
77 build packages using RPM.
78
79 %if %{with_python_subpackage}
80 %package python
81 Summary: Python bindings for apps which will manipulate RPM packages.
82 Group: Development/Libraries
83 BuildRequires: popt >= 1.5
84 Requires: rpm = %{version}
85 Requires: popt >= 1.5
86 Requires: python >= 1.5.2
87
88 %description python
89 The rpm-python package contains a module which permits applications
90 written in the Python programming language to use the interface
91 supplied by RPM (RPM Package Manager) libraries.
92
93 This package should be installed if you want to develop Python
94 programs that will manipulate RPM packages and databases.
95 %endif
96
97 %package -n popt
98 Summary: A C library for parsing command line parameters.
99 Group: Development/Libraries
100 Version: 1.7
101
102 %description -n popt
103 Popt is a C library for parsing command line parameters.  Popt was
104 heavily influenced by the getopt() and getopt_long() functions, but it
105 improves on them by allowing more powerful argument expansion.  Popt
106 can parse arbitrary argv[] style arrays and automatically set
107 variables based on command line arguments.  Popt allows command line
108 arguments to be aliased via configuration files and includes utility
109 functions for parsing arbitrary strings into argv[] arrays using
110 shell-like rules.
111
112 Install popt if you're a C programmer and you'd like to use its
113 capabilities.
114
115 %prep
116 %setup -q
117
118 %build
119 %ifos linux
120 CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%{__prefix} --sysconfdir=/etc --localstatedir=/var --infodir='${prefix}%{__share}/info' --mandir='${prefix}%{__share}/man'
121 %else
122 CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%{__prefix}
123 %endif
124
125 make
126
127 %install
128 rm -rf $RPM_BUILD_ROOT
129
130 make DESTDIR="$RPM_BUILD_ROOT" install
131
132 %ifos linux
133
134 # Save list of packages through cron
135 mkdir -p ${RPM_BUILD_ROOT}/etc/cron.daily
136 install -m 755 scripts/rpm.daily ${RPM_BUILD_ROOT}/etc/cron.daily/rpm
137
138 mkdir -p ${RPM_BUILD_ROOT}/etc/logrotate.d
139 install -m 755 scripts/rpm.log ${RPM_BUILD_ROOT}/etc/logrotate.d/rpm
140
141 mkdir -p $RPM_BUILD_ROOT/etc/rpm
142 cat << E_O_F > $RPM_BUILD_ROOT/etc/rpm/macros.db1
143 %%_dbapi                1
144 E_O_F
145
146 mkdir -p $RPM_BUILD_ROOT/var/lib/rpm
147 for dbi in \
148         Basenames Conflictname Dirnames Group Installtid Name Providename \
149         Provideversion Removetid Requirename Requireversion Triggername
150 do
151     touch $RPM_BUILD_ROOT/var/lib/rpm/$dbi
152 done
153
154 %endif
155
156 %if %{with_apidocs}
157 gzip -9n apidocs/man/man*/* || :
158 %endif
159
160 %if %{strip_binaries}
161 { cd $RPM_BUILD_ROOT
162   strip ./bin/rpm
163   strip .%{__prefix}/bin/rpm2cpio
164 }
165 %endif
166
167 %clean
168 rm -rf $RPM_BUILD_ROOT
169
170 %pre
171 %ifos linux
172 if [ -f /var/lib/rpm/Packages -a -f /var/lib/rpm/packages.rpm ]; then
173     echo "
174 You have both
175         /var/lib/rpm/packages.rpm       db1 format installed package headers
176         /var/lib/rpm/Packages           db3 format installed package headers
177 Please remove (or at least rename) one of those files, and re-install.
178 "
179     exit 1
180 fi
181 /usr/sbin/groupadd -g 37 @RPMGROUP@                             > /dev/null 2>&1
182 /usr/sbin/useradd  -d /var/lib/rpm -u 37 -g 37 @RPMUSER@        > /dev/null 2>&1
183 %endif
184 exit 0
185
186 %post
187 %ifos linux
188 /sbin/ldconfig
189 if [ -f /var/lib/rpm/packages.rpm ]; then
190     : # do nothing
191 elif [ -f /var/lib/rpm/Packages ]; then
192     # undo db1 configuration
193     rm -f /etc/rpm/macros.db1
194 else
195     # initialize db3 database
196     rm -f /etc/rpm/macros.db1
197     /bin/rpm --initdb
198 fi
199 /bin/chown @RPMUSER@.@RPMGROUP@ /var/lib/rpm/[A-Z]* /var/lib/rpm/*.rpm
200 %endif
201 exit 0
202
203 %ifos linux
204 %postun
205 /sbin/ldconfig
206 if [ $1 == 0 ]; then
207     /usr/sbin/userdel rpm
208     /usr/sbin/groupdel rpm
209 fi
210
211
212 %post devel -p /sbin/ldconfig
213 %postun devel -p /sbin/ldconfig
214
215 %post -n popt -p /sbin/ldconfig
216 %postun -n popt -p /sbin/ldconfig
217 %endif
218
219 %if %{with_python_subpackage}
220 %post python -p /sbin/ldconfig
221 %postun python -p /sbin/ldconfig
222 %endif
223
224 %files
225 %defattr(-,root,root)
226 %doc RPM-PGP-KEY RPM-GPG-KEY CHANGES GROUPS doc/manual/[a-z]*
227 %attr(0755, @RPMUSER@, @RPMGROUP@)      /bin/rpm
228
229 %ifos linux
230 %config(noreplace,missingok)    /etc/cron.daily/rpm
231 %config(noreplace,missingok)    /etc/logrotate.d/rpm
232 %dir                            /etc/rpm
233 %config(noreplace,missingok)    /etc/rpm/macros.db1
234 %attr(0755, @RPMUSER@, @RPMGROUP@)      %dir /var/lib/rpm
235 %attr(0755, @RPMUSER@, @RPMGROUP@)      %ghost /var/lib/rpm/Basenames
236 %attr(0755, @RPMUSER@, @RPMGROUP@)      %ghost /var/lib/rpm/Conflictname
237 #%attr(0755, @RPMUSER@, @RPMGROUP@)     %ghost /var/lib/rpm/__db.001
238 %attr(0755, @RPMUSER@, @RPMGROUP@)      %ghost /var/lib/rpm/Dirnames
239 %attr(0755, @RPMUSER@, @RPMGROUP@)      %ghost /var/lib/rpm/Group
240 %attr(0755, @RPMUSER@, @RPMGROUP@)      %ghost /var/lib/rpm/Installtid
241 %attr(0755, @RPMUSER@, @RPMGROUP@)      %ghost /var/lib/rpm/Name
242 #%attr(0755, @RPMUSER@, @RPMGROUP@)     %ghost /var/lib/rpm/Packages
243 %attr(0755, @RPMUSER@, @RPMGROUP@)      %ghost /var/lib/rpm/Providename
244 %attr(0755, @RPMUSER@, @RPMGROUP@)      %ghost /var/lib/rpm/Provideversion
245 %attr(0755, @RPMUSER@, @RPMGROUP@)      %ghost /var/lib/rpm/Removetid
246 %attr(0755, @RPMUSER@, @RPMGROUP@)      %ghost /var/lib/rpm/Requirename
247 %attr(0755, @RPMUSER@, @RPMGROUP@)      %ghost /var/lib/rpm/Requireversion
248 %attr(0755, @RPMUSER@, @RPMGROUP@)      %ghost /var/lib/rpm/Triggername
249 %endif
250
251 %attr(0755, @RPMUSER@, @RPMGROUP@)      %{__prefix}/bin/rpm2cpio
252 %attr(0755, @RPMUSER@, @RPMGROUP@)      %{__prefix}/bin/gendiff
253 %attr(0755, @RPMUSER@, @RPMGROUP@)      %{__prefix}/bin/rpmdb
254 %attr(0755, @RPMUSER@, @RPMGROUP@)      %{__prefix}/bin/rpm[eiukqv]
255 %attr(0755, @RPMUSER@, @RPMGROUP@)      %{__prefix}/bin/rpmsign
256 %attr(0755, @RPMUSER@, @RPMGROUP@)      %{__prefix}/bin/rpmquery
257 %attr(0755, @RPMUSER@, @RPMGROUP@)      %{__prefix}/bin/rpmverify
258
259 %{__prefix}/lib/librpm.so.*
260 %{__prefix}/lib/librpmdb.so.*
261 %{__prefix}/lib/librpmio.so.*
262 %{__prefix}/lib/librpmbuild.so.*
263
264 %attr(0755, @RPMUSER@, @RPMGROUP@)      %{__prefix}/lib/rpm/config.guess
265 %attr(0755, @RPMUSER@, @RPMGROUP@)      %{__prefix}/lib/rpm/config.sub
266 %attr(0755, @RPMUSER@, @RPMGROUP@)      %{__prefix}/lib/rpm/convertrpmrc.sh
267 %attr(0644, @RPMUSER@, @RPMGROUP@)      %{__prefix}/lib/rpm/macros
268 %attr(0755, @RPMUSER@, @RPMGROUP@)      %{__prefix}/lib/rpm/mkinstalldirs
269 %attr(0755, @RPMUSER@, @RPMGROUP@)      %{__prefix}/lib/rpm/rpm.*
270 %attr(0755, @RPMUSER@, @RPMGROUP@)      %{__prefix}/lib/rpm/rpm[deiukqv]
271 %attr(0644, @RPMUSER@, @RPMGROUP@)      %{__prefix}/lib/rpm/rpmpopt*
272 %attr(0644, @RPMUSER@, @RPMGROUP@)      %{__prefix}/lib/rpm/rpmrc
273
274 %ifarch i386 i486 i586 i686 athlon
275 %attr(-, @RPMUSER@, @RPMGROUP@) %{__prefix}/lib/rpm/i[3456]86*
276 %endif
277 %ifarch alpha
278 %attr(-, @RPMUSER@, @RPMGROUP@) %{__prefix}/lib/rpm/alpha*
279 %endif
280 %ifarch sparc sparc64
281 %attr(-, @RPMUSER@, @RPMGROUP@) %{__prefix}/lib/rpm/sparc*
282 %endif
283 %ifarch ia64
284 %attr(-, @RPMUSER@, @RPMGROUP@) %{__prefix}/lib/rpm/ia64*
285 %endif
286 %ifarch powerpc ppc
287 %attr(-, @RPMUSER@, @RPMGROUP@) %{__prefix}/lib/rpm/ppc*
288 %endif
289 %ifarch s390 s390x
290 %attr(-, @RPMUSER@, @RPMGROUP@) %{__prefix}/lib/rpm/s390*
291 %endif
292 %ifarch armv3l armv4l
293 %attr(-, @RPMUSER@, @RPMGROUP@) %{__prefix}/lib/rpm/armv[34][lb]*
294 %endif
295
296 %lang(cs)       %{__prefix}/*/locale/cs/LC_MESSAGES/rpm.mo
297 %lang(da)       %{__prefix}/*/locale/da/LC_MESSAGES/rpm.mo
298 %lang(de)       %{__prefix}/*/locale/de/LC_MESSAGES/rpm.mo
299 %lang(fi)       %{__prefix}/*/locale/fi/LC_MESSAGES/rpm.mo
300 %lang(fr)       %{__prefix}/*/locale/fr/LC_MESSAGES/rpm.mo
301 %lang(is)       %{__prefix}/*/locale/is/LC_MESSAGES/rpm.mo
302 %lang(ja)       %{__prefix}/*/locale/ja/LC_MESSAGES/rpm.mo
303 %lang(no)       %{__prefix}/*/locale/no/LC_MESSAGES/rpm.mo
304 %lang(pl)       %{__prefix}/*/locale/pl/LC_MESSAGES/rpm.mo
305 %lang(pt)       %{__prefix}/*/locale/pt/LC_MESSAGES/rpm.mo
306 %lang(pt_BR)    %{__prefix}/*/locale/pt_BR/LC_MESSAGES/rpm.mo
307 %lang(ro)       %{__prefix}/*/locale/ro/LC_MESSAGES/rpm.mo
308 %lang(ru)       %{__prefix}/*/locale/ru/LC_MESSAGES/rpm.mo
309 %lang(sk)       %{__prefix}/*/locale/sk/LC_MESSAGES/rpm.mo
310 %lang(sl)       %{__prefix}/*/locale/sl/LC_MESSAGES/rpm.mo
311 %lang(sr)       %{__prefix}/*/locale/sr/LC_MESSAGES/rpm.mo
312 %lang(sv)       %{__prefix}/*/locale/sv/LC_MESSAGES/rpm.mo
313 %lang(tr)       %{__prefix}/*/locale/tr/LC_MESSAGES/rpm.mo
314
315 %{__prefix}%{__share}/man/man[18]/*.[18]*
316 %lang(pl) %{__prefix}%{__share}/man/pl/man[18]/*.[18]*
317 %lang(ru) %{__prefix}%{__share}/man/ru/man[18]/*.[18]*
318 %lang(sk) %{__prefix}%{__share}/man/sk/man[18]/*.[18]*
319
320 %files build
321 %defattr(-,root,root)
322 %dir %{__prefix}/src/redhat
323 %dir %{__prefix}/src/redhat/BUILD
324 %dir %{__prefix}/src/redhat/SPECS
325 %dir %{__prefix}/src/redhat/SOURCES
326 %dir %{__prefix}/src/redhat/SRPMS
327 %dir %{__prefix}/src/redhat/RPMS
328 %{__prefix}/src/redhat/RPMS/*
329 %attr(0755, @RPMUSER@, @RPMGROUP@)      %{__prefix}/bin/rpmbuild
330 %attr(0755, @RPMUSER@, @RPMGROUP@)      %{__prefix}/lib/rpm/brp-*
331 %attr(0755, @RPMUSER@, @RPMGROUP@)      %{__prefix}/lib/rpm/check-prereqs
332 %attr(0755, @RPMUSER@, @RPMGROUP@)      %{__prefix}/lib/rpm/cpanflute
333 %attr(0755, @RPMUSER@, @RPMGROUP@)      %{__prefix}/lib/rpm/find-lang.sh
334 %attr(0755, @RPMUSER@, @RPMGROUP@)      %{__prefix}/lib/rpm/find-prov.pl
335 %attr(0755, @RPMUSER@, @RPMGROUP@)      %{__prefix}/lib/rpm/find-provides
336 %attr(0755, @RPMUSER@, @RPMGROUP@)      %{__prefix}/lib/rpm/find-provides.perl
337 %attr(0755, @RPMUSER@, @RPMGROUP@)      %{__prefix}/lib/rpm/find-req.pl
338 %attr(0755, @RPMUSER@, @RPMGROUP@)      %{__prefix}/lib/rpm/find-requires
339 %attr(0755, @RPMUSER@, @RPMGROUP@)      %{__prefix}/lib/rpm/find-requires.perl
340 %attr(0755, @RPMUSER@, @RPMGROUP@)      %{__prefix}/lib/rpm/get_magic.pl
341 %attr(0755, @RPMUSER@, @RPMGROUP@)      %{__prefix}/lib/rpm/getpo.sh
342 %attr(0755, @RPMUSER@, @RPMGROUP@)      %{__prefix}/lib/rpm/http.req
343 %attr(0755, @RPMUSER@, @RPMGROUP@)      %{__prefix}/lib/rpm/javadeps
344 %attr(0755, @RPMUSER@, @RPMGROUP@)      %{__prefix}/lib/rpm/magic.prov
345 %attr(0755, @RPMUSER@, @RPMGROUP@)      %{__prefix}/lib/rpm/magic.req
346 %attr(0755, @RPMUSER@, @RPMGROUP@)      %{__prefix}/lib/rpm/perl.prov
347 %attr(0755, @RPMUSER@, @RPMGROUP@)      %{__prefix}/lib/rpm/perl.req
348 %attr(0755, @RPMUSER@, @RPMGROUP@)      %{__prefix}/lib/rpm/rpm[bt]
349 %attr(0755, @RPMUSER@, @RPMGROUP@)      %{__prefix}/lib/rpm/rpmdiff
350 %attr(0755, @RPMUSER@, @RPMGROUP@)      %{__prefix}/lib/rpm/rpmdiff.cgi
351 %attr(0755, @RPMUSER@, @RPMGROUP@)      %{__prefix}/lib/rpm/u_pkg.sh
352 %attr(0755, @RPMUSER@, @RPMGROUP@)      %{__prefix}/lib/rpm/vpkg-provides.sh
353 %attr(0755, @RPMUSER@, @RPMGROUP@)      %{__prefix}/lib/rpm/vpkg-provides2.sh
354
355 %if %{with_python_subpackage}
356 %files python
357 %defattr(-,root,root)
358 %{__prefix}/lib/python1.5/site-packages/rpmmodule.so
359 %endif
360
361 %files devel
362 %defattr(-,root,root)
363 %if %{with_apidocs}
364 %doc @WITH_APIDOCS_TARGET@
365 %endif
366 %{__prefix}/include/rpm
367 %{__prefix}/lib/librpm.a
368 %{__prefix}/lib/librpm.la
369 %{__prefix}/lib/librpm.so
370 %{__prefix}/lib/librpmdb.a
371 %{__prefix}/lib/librpmdb.la
372 %{__prefix}/lib/librpmdb.so
373 %{__prefix}/lib/librpmio.a
374 %{__prefix}/lib/librpmio.la
375 %{__prefix}/lib/librpmio.so
376 %{__prefix}/lib/librpmbuild.a
377 %{__prefix}/lib/librpmbuild.la
378 %{__prefix}/lib/librpmbuild.so
379
380 %files -n popt
381 %defattr(-,root,root)
382 %{__prefix}/lib/libpopt.so.*
383 %{__prefix}%{__share}/man/man3/popt.3*
384 %lang(cs)       %{__prefix}/*/locale/cs/LC_MESSAGES/popt.mo
385 %lang(da)       %{__prefix}/*/locale/da/LC_MESSAGES/popt.mo
386 %lang(gl)       %{__prefix}/*/locale/gl/LC_MESSAGES/popt.mo
387 %lang(hu)       %{__prefix}/*/locale/hu/LC_MESSAGES/popt.mo
388 %lang(is)       %{__prefix}/*/locale/is/LC_MESSAGES/popt.mo
389 %lang(no)       %{__prefix}/*/locale/no/LC_MESSAGES/popt.mo
390 %lang(pt)       %{__prefix}/*/locale/pt/LC_MESSAGES/popt.mo
391 %lang(ro)       %{__prefix}/*/locale/ro/LC_MESSAGES/popt.mo
392 %lang(ru)       %{__prefix}/*/locale/ru/LC_MESSAGES/popt.mo
393 %lang(sk)       %{__prefix}/*/locale/sk/LC_MESSAGES/popt.mo
394 %lang(sl)       %{__prefix}/*/locale/sl/LC_MESSAGES/popt.mo
395 %lang(sv)       %{__prefix}/*/locale/sv/LC_MESSAGES/popt.mo
396 %lang(tr)       %{__prefix}/*/locale/tr/LC_MESSAGES/popt.mo
397 %lang(uk)       %{__prefix}/*/locale/uk/LC_MESSAGES/popt.mo
398 %lang(wa)       %{__prefix}/*/locale/wa/LC_MESSAGES/popt.mo
399 %lang(zh_CN)    %{__prefix}/*/locale/zh_CN.GB2312/LC_MESSAGES/popt.mo
400
401 # XXX These may end up in popt-devel but it hardly seems worth the effort now.
402 %{__prefix}/lib/libpopt.a
403 %{__prefix}/lib/libpopt.la
404 %{__prefix}/lib/libpopt.so
405 %{__prefix}/include/popt.h
406
407 %changelog
408 * Mon Feb 19 2001 Jeff Johnson <jbj@redhat.com>
409 - start rpm-4.0.3 with --repackage.