- fix: db1 end-of-file not detected in legacy compatible way.
[tools/librpm-tizen.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     /bin/chown @RPMUSER@.@RPMGROUP@ /var/lib/rpm/*.rpm
191 elif [ -f /var/lib/rpm/Packages ]; then
192     # undo db1 configuration
193     rm -f /etc/rpm/macros.db1
194     /bin/chown @RPMUSER@.@RPMGROUP@ /var/lib/rpm/[A-Z]*
195 else
196     # initialize db3 database
197     rm -f /etc/rpm/macros.db1
198     /bin/rpm --initdb
199 fi
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 %define rpmattr         %attr(0755, @RPMUSER@, @RPMGROUP@)
225 %define rpmdbattr       %rpmattr %verify(not md5 size mtime) %ghost
226
227 %files
228 %defattr(-,root,root)
229 %doc RPM-PGP-KEY RPM-GPG-KEY CHANGES GROUPS doc/manual/[a-z]*
230 %attr(0755, @RPMUSER@, @RPMGROUP@)      /bin/rpm
231
232 %ifos linux
233 %config(noreplace,missingok)    /etc/cron.daily/rpm
234 %config(noreplace,missingok)    /etc/logrotate.d/rpm
235 %dir                            /etc/rpm
236 %config(noreplace,missingok)    /etc/rpm/macros.db1
237 %attr(0755, @RPMUSER@, @RPMGROUP@)      %dir /var/lib/rpm
238 %rpmdbattr      /var/lib/rpm/Basenames
239 %rpmdbattr      /var/lib/rpm/Conflictname
240 #%rpmdbattr     /var/lib/rpm/__db.001
241 %rpmdbattr      /var/lib/rpm/Dirnames
242 %rpmdbattr      /var/lib/rpm/Group
243 %rpmdbattr      /var/lib/rpm/Installtid
244 %rpmdbattr      /var/lib/rpm/Name
245 #%rpmdbattr     /var/lib/rpm/Packages
246 %rpmdbattr      /var/lib/rpm/Providename
247 %rpmdbattr      /var/lib/rpm/Provideversion
248 %rpmdbattr      /var/lib/rpm/Removetid
249 %rpmdbattr      /var/lib/rpm/Requirename
250 %rpmdbattr      /var/lib/rpm/Requireversion
251 %rpmdbattr      /var/lib/rpm/Triggername
252 %endif
253
254 %rpmattr        %{__prefix}/bin/rpm2cpio
255 %rpmattr        %{__prefix}/bin/gendiff
256 %rpmattr        %{__prefix}/bin/rpmdb
257 %rpmattr        %{__prefix}/bin/rpm[eiukqv]
258 %rpmattr        %{__prefix}/bin/rpmsign
259 %rpmattr        %{__prefix}/bin/rpmquery
260 %rpmattr        %{__prefix}/bin/rpmverify
261
262 %{__prefix}/lib/librpm.so.*
263 %{__prefix}/lib/librpmdb.so.*
264 %{__prefix}/lib/librpmio.so.*
265 %{__prefix}/lib/librpmbuild.so.*
266
267 %rpmattr        %{__prefix}/lib/rpm/config.guess
268 %rpmattr        %{__prefix}/lib/rpm/config.sub
269 %rpmattr        %{__prefix}/lib/rpm/convertrpmrc.sh
270 %attr(0644, @RPMUSER@, @RPMGROUP@)      %{__prefix}/lib/rpm/macros
271 %rpmattr        %{__prefix}/lib/rpm/mkinstalldirs
272 %rpmattr        %{__prefix}/lib/rpm/rpm.*
273 %rpmattr        %{__prefix}/lib/rpm/rpm[deiukqv]
274 %attr(0644, @RPMUSER@, @RPMGROUP@)      %{__prefix}/lib/rpm/rpmpopt*
275 %attr(0644, @RPMUSER@, @RPMGROUP@)      %{__prefix}/lib/rpm/rpmrc
276
277 %ifarch i386 i486 i586 i686 athlon
278 %attr(-, @RPMUSER@, @RPMGROUP@) %{__prefix}/lib/rpm/i[3456]86*
279 %endif
280 %ifarch alpha
281 %attr(-, @RPMUSER@, @RPMGROUP@) %{__prefix}/lib/rpm/alpha*
282 %endif
283 %ifarch sparc sparc64
284 %attr(-, @RPMUSER@, @RPMGROUP@) %{__prefix}/lib/rpm/sparc*
285 %endif
286 %ifarch ia64
287 %attr(-, @RPMUSER@, @RPMGROUP@) %{__prefix}/lib/rpm/ia64*
288 %endif
289 %ifarch powerpc ppc
290 %attr(-, @RPMUSER@, @RPMGROUP@) %{__prefix}/lib/rpm/ppc*
291 %endif
292 %ifarch s390 s390x
293 %attr(-, @RPMUSER@, @RPMGROUP@) %{__prefix}/lib/rpm/s390*
294 %endif
295 %ifarch armv3l armv4l
296 %attr(-, @RPMUSER@, @RPMGROUP@) %{__prefix}/lib/rpm/armv[34][lb]*
297 %endif
298
299 %lang(cs)       %{__prefix}/*/locale/cs/LC_MESSAGES/rpm.mo
300 %lang(da)       %{__prefix}/*/locale/da/LC_MESSAGES/rpm.mo
301 %lang(de)       %{__prefix}/*/locale/de/LC_MESSAGES/rpm.mo
302 %lang(fi)       %{__prefix}/*/locale/fi/LC_MESSAGES/rpm.mo
303 %lang(fr)       %{__prefix}/*/locale/fr/LC_MESSAGES/rpm.mo
304 %lang(is)       %{__prefix}/*/locale/is/LC_MESSAGES/rpm.mo
305 %lang(ja)       %{__prefix}/*/locale/ja/LC_MESSAGES/rpm.mo
306 %lang(no)       %{__prefix}/*/locale/no/LC_MESSAGES/rpm.mo
307 %lang(pl)       %{__prefix}/*/locale/pl/LC_MESSAGES/rpm.mo
308 %lang(pt)       %{__prefix}/*/locale/pt/LC_MESSAGES/rpm.mo
309 %lang(pt_BR)    %{__prefix}/*/locale/pt_BR/LC_MESSAGES/rpm.mo
310 %lang(ro)       %{__prefix}/*/locale/ro/LC_MESSAGES/rpm.mo
311 %lang(ru)       %{__prefix}/*/locale/ru/LC_MESSAGES/rpm.mo
312 %lang(sk)       %{__prefix}/*/locale/sk/LC_MESSAGES/rpm.mo
313 %lang(sl)       %{__prefix}/*/locale/sl/LC_MESSAGES/rpm.mo
314 %lang(sr)       %{__prefix}/*/locale/sr/LC_MESSAGES/rpm.mo
315 %lang(sv)       %{__prefix}/*/locale/sv/LC_MESSAGES/rpm.mo
316 %lang(tr)       %{__prefix}/*/locale/tr/LC_MESSAGES/rpm.mo
317
318 %{__prefix}%{__share}/man/man1/gendiff.1*
319 %{__prefix}%{__share}/man/man8/rpm.8*
320 %{__prefix}%{__share}/man/man8/rpm2cpio.8*
321 %lang(pl) %{__prefix}%{__share}/man/pl/man[18]/*.[18]*
322 %lang(ru) %{__prefix}%{__share}/man/ru/man[18]/*.[18]*
323 %lang(sk) %{__prefix}%{__share}/man/sk/man[18]/*.[18]*
324
325 %files build
326 %defattr(-,root,root)
327 %dir %{__prefix}/src/redhat
328 %dir %{__prefix}/src/redhat/BUILD
329 %dir %{__prefix}/src/redhat/SPECS
330 %dir %{__prefix}/src/redhat/SOURCES
331 %dir %{__prefix}/src/redhat/SRPMS
332 %dir %{__prefix}/src/redhat/RPMS
333 %{__prefix}/src/redhat/RPMS/*
334 %rpmattr        %{__prefix}/bin/rpmbuild
335 %rpmattr        %{__prefix}/lib/rpm/brp-*
336 %rpmattr        %{__prefix}/lib/rpm/check-prereqs
337 %rpmattr        %{__prefix}/lib/rpm/cpanflute
338 %rpmattr        %{__prefix}/lib/rpm/find-lang.sh
339 %rpmattr        %{__prefix}/lib/rpm/find-prov.pl
340 %rpmattr        %{__prefix}/lib/rpm/find-provides
341 %rpmattr        %{__prefix}/lib/rpm/find-provides.perl
342 %rpmattr        %{__prefix}/lib/rpm/find-req.pl
343 %rpmattr        %{__prefix}/lib/rpm/find-requires
344 %rpmattr        %{__prefix}/lib/rpm/find-requires.perl
345 %rpmattr        %{__prefix}/lib/rpm/get_magic.pl
346 %rpmattr        %{__prefix}/lib/rpm/getpo.sh
347 %rpmattr        %{__prefix}/lib/rpm/http.req
348 %rpmattr        %{__prefix}/lib/rpm/javadeps
349 %rpmattr        %{__prefix}/lib/rpm/magic.prov
350 %rpmattr        %{__prefix}/lib/rpm/magic.req
351 %rpmattr        %{__prefix}/lib/rpm/perl.prov
352 %rpmattr        %{__prefix}/lib/rpm/perl.req
353 %rpmattr        %{__prefix}/lib/rpm/rpm[bt]
354 %rpmattr        %{__prefix}/lib/rpm/rpmdiff
355 %rpmattr        %{__prefix}/lib/rpm/rpmdiff.cgi
356 %rpmattr        %{__prefix}/lib/rpm/u_pkg.sh
357 %rpmattr        %{__prefix}/lib/rpm/vpkg-provides.sh
358 %rpmattr        %{__prefix}/lib/rpm/vpkg-provides2.sh
359
360 %{__prefix}%{__share}/man/man8/rpmbuild.8*
361
362 %if %{with_python_subpackage}
363 %files python
364 %defattr(-,root,root)
365 %{__prefix}/lib/python1.5/site-packages/rpmmodule.so
366 %endif
367
368 %files devel
369 %defattr(-,root,root)
370 %if %{with_apidocs}
371 %doc @WITH_APIDOCS_TARGET@
372 %endif
373 %{__prefix}/include/rpm
374 %{__prefix}/lib/librpm.a
375 %{__prefix}/lib/librpm.la
376 %{__prefix}/lib/librpm.so
377 %{__prefix}/lib/librpmdb.a
378 %{__prefix}/lib/librpmdb.la
379 %{__prefix}/lib/librpmdb.so
380 %{__prefix}/lib/librpmio.a
381 %{__prefix}/lib/librpmio.la
382 %{__prefix}/lib/librpmio.so
383 %{__prefix}/lib/librpmbuild.a
384 %{__prefix}/lib/librpmbuild.la
385 %{__prefix}/lib/librpmbuild.so
386
387 %files -n popt
388 %defattr(-,root,root)
389 %{__prefix}/lib/libpopt.so.*
390 %{__prefix}%{__share}/man/man3/popt.3*
391 %lang(cs)       %{__prefix}/*/locale/cs/LC_MESSAGES/popt.mo
392 %lang(da)       %{__prefix}/*/locale/da/LC_MESSAGES/popt.mo
393 %lang(gl)       %{__prefix}/*/locale/gl/LC_MESSAGES/popt.mo
394 %lang(hu)       %{__prefix}/*/locale/hu/LC_MESSAGES/popt.mo
395 %lang(is)       %{__prefix}/*/locale/is/LC_MESSAGES/popt.mo
396 %lang(no)       %{__prefix}/*/locale/no/LC_MESSAGES/popt.mo
397 %lang(pt)       %{__prefix}/*/locale/pt/LC_MESSAGES/popt.mo
398 %lang(ro)       %{__prefix}/*/locale/ro/LC_MESSAGES/popt.mo
399 %lang(ru)       %{__prefix}/*/locale/ru/LC_MESSAGES/popt.mo
400 %lang(sk)       %{__prefix}/*/locale/sk/LC_MESSAGES/popt.mo
401 %lang(sl)       %{__prefix}/*/locale/sl/LC_MESSAGES/popt.mo
402 %lang(sv)       %{__prefix}/*/locale/sv/LC_MESSAGES/popt.mo
403 %lang(tr)       %{__prefix}/*/locale/tr/LC_MESSAGES/popt.mo
404 %lang(uk)       %{__prefix}/*/locale/uk/LC_MESSAGES/popt.mo
405 %lang(wa)       %{__prefix}/*/locale/wa/LC_MESSAGES/popt.mo
406 %lang(zh_CN)    %{__prefix}/*/locale/zh_CN.GB2312/LC_MESSAGES/popt.mo
407
408 # XXX These may end up in popt-devel but it hardly seems worth the effort now.
409 %{__prefix}/lib/libpopt.a
410 %{__prefix}/lib/libpopt.la
411 %{__prefix}/lib/libpopt.so
412 %{__prefix}/include/popt.h
413
414 %changelog
415 * Mon Feb 19 2001 Jeff Johnson <jbj@redhat.com>
416 - start rpm-4.0.3 with --repackage.