Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 21

RPM HOWTO

Donnie Barnes, djb@redhat.com


8 1997, v2.07
____________________________________________________________
Table of Contents
1.
2.
3.
3.1 RPM
3.2 RPM
4. RPM
5.
6. RPMs
6.1
6.2
6.3
6.4
6.5
6.6
6.7
6.8
6.9

rpmrc
(Spec File)

Prep
(Build)


6.9.1
6.9.2
6.9.3
6.9.4 RPM
6.10
6.11 RPMs
6.12 ;
7. RPM
7.1
7.2
7.3
7.4
7.5

(spec File)
Optflags
Macros

8.
9.

______________________________________________________________________
1.
RPM Red Hat Package Manager.
Red Hat ,

, .

,

,
.

,

.
Red Hat Software
RPM
. RPM ,
.
,
.
RPM GPL.
RPM Ed
Bailey, Maximum RPM.
www.redhat.com <http://www.redhat.com>.
2.
',
RPM.
`` ()'' . RPP (
,
RPM), ``''
. ,
RPP make
. ,

.
. ROM,
(patch)
. . ;
. - ,
,
RHL.
(patch) . ,

.
RPM .

.
. RPM
,

,
. .

.
, . .
,

. , .
BOGUS
RPM. RPM
Red Hat Software,
BOGUS (PM PMS).
3.

3.1. RPM
RPM Red Hat
Linux. ,
RPM. ftp.redhat.com
<ftp://ftp.redhat.com/pub/redhat/code/rpm>.
3.2. RPM
RPM cpio 2.4.2
. Linux,
Unix. ,
SunOS, Solaris, AIX, Irix, AmigaOS .
-
Unix .
RPMs.
RPMs ,
, gcc, make, .
4. RPM
, RPM
:
rpm -i foobar-1.0-1.i386.rpm

:
rpm -e foobar


FTP.
,
URL, :
rpm -i ftp://ftp.pht.com/pub/linux/redhat/rh-2.0-beta/RPMS/foobar

-1.0-1.i386.rpm

RPM /
FTP.
, rpm
Usage :

RPM version 2.3.9


Copyright (C) 1997 - Red Hat Software
This may be freely redistributed under the terms of the GNU Public License
usage: rpm
rpm
rpm
rpm

rpm

rpm

rpm
rpm
rpm
rpm
rpm
rpm
rpm
rpm
rpm
rpm

{--help}
{--version}
{--initdb} [--dbpath <dir>]
{--install -i} [-v] [--hash -h] [--percent] [--force] [--test]
[--replacepkgs] [--replacefiles] [--root <dir>]
[--excludedocs] [--includedocs] [--noscripts]
[--rcfile <file>] [--ignorearch] [--dbpath <dir>]
[--prefix <dir>] [--ignoreos] [--nodeps]
[--ftpproxy <host>] [--ftpport <port>]
file1.rpm ... fileN.rpm
{--upgrade -U} [-v] [--hash -h] [--percent] [--force] [--test]
[--oldpackage] [--root <dir>] [--noscripts]
[--excludedocs] [--includedocs] [--rcfile <file>]
[--ignorearch] [--dbpath <dir>] [--prefix <dir>]
[--ftpproxy <host>] [--ftpport <port>]
[--ignoreos] [--nodeps] file1.rpm ... fileN.rpm
{--query -q} [-afpg] [-i] [-l] [-s] [-d] [-c] [-v] [-R]
[--scripts] [--root <dir>] [--rcfile <file>]
[--whatprovides] [--whatrequires] [--requires]
[--ftpuseport] [--ftpproxy <host>] [--ftpport <port>]
[--provides] [--dump] [--dbpath <dir>] [targets]
{--verify -V -y} [-afpg] [--root <dir>] [--rcfile <file>]
[--dbpath <dir>] [--nodeps] [--nofiles] [--noscripts]
[--nomd5] [targets]
{--setperms} [-afpg] [target]
{--setugids} [-afpg] [target]
{--erase -e} [--root <dir>] [--noscripts] [--rcfile <file>]
[--dbpath <dir>] [--nodeps] [--allmatches]
package1 ... packageN
{-b|t}[plciba] [-v] [--short-circuit] [--clean] [--rcfile <file>]
[--sign] [--test] [--timecheck <s>] specfile
{--rebuild} [--rcfile <file>] [-v] source1.rpm ... sourceN.rpm
{--recompile} [--rcfile <file>] [-v] source1.rpm ... sourceN.rpm
{--resign} [--rcfile <file>] package1 package2 ... packageN
{--addsign} [--rcfile <file>] package1 package2 ... packageN
{--checksig -K} [--nopgp] [--nomd5] [--rcfile <file>]
package1 ... packageN

rpm {--rebuilddb} [--rcfile <file>] [--dbpath <dir>]


rpm {--querytags}

RPM
(man page).
5. RPM;
RPM , ,
.
.
/
:
,
.
, :
rpm -Va
.
, :
rpm -qf /usr/X11R6/bin/xjewel

:
xjewel-1.6-1

RPM koules,
. ,
:
rpm -qpi koules-1.2-2.i386.rpm

:
Name

: koules

Version
Release

: 1.2
: 2

Distribution: Red Hat Linux Col

gate
12 1996

Vendor: Red Hat Software


Build Date: Mon Sep 02 11:59:

Install date: (none)


Group
: Games

Build Host: porky.redhat.com


Source RPM: koules-1.2-2.src.

rpm
Size
Summary

: 614939
: SVGAlib action game with multiplayer, network, and sound su

pport
Description :
This arcade-style game is novel in conception and excellent in execution.
No shooting, no blood, no guts, no gore. The play is simple, but you
still must develop skill to play. This version uses SVGAlib to
run on a graphics console.

RPM koules.
:
rpm -qpl koules-1.2-2.i386.rpm

/usr/doc/koules
/usr/doc/koules/ANNOUNCE
/usr/doc/koules/BUGS
/usr/doc/koules/COMPILE.OS2
/usr/doc/koules/COPYING
/usr/doc/koules/Card
/usr/doc/koules/ChangeLog
/usr/doc/koules/INSTALLATION
/usr/doc/koules/Icon.xpm
/usr/doc/koules/Icon2.xpm
/usr/doc/koules/Koules.FAQ
/usr/doc/koules/Koules.xpm
/usr/doc/koules/README
/usr/doc/koules/TODO
/usr/games/koules
/usr/games/koules.svga
/usr/games/koules.tcl
/usr/man/man6/koules.svga.6

.
RPM .

6. RPMs
RPMs,

.
RPM :
/etc/rpmrc .
RPM
.
(patch)

(spec file) .
.
RPM.
, RPM
.

6.1. rpmrc
, RPM
/etc/rpmrc. :

require_vendor: 1
distribution: I roll my own!
require_distribution: 1
topdir: /usr/src/me
vendor: Mickiesoft
packager: Mickeysoft Packaging Account <packages@mickiesoft.com>
optflags: i386 -O2 -m486 -fno-strength-reduce
optflags: alpha -O2
optflags: sparc -O2
signature: pgp
pgp_name: Mickeysoft Packaging Account
pgp_path: /home/packages/.pgp
tmppath: /usr/tmp

require_vendor RPM
(vendor). /etc/rpmrc
(spec file).
, 0.
require_distribution require_group.
distribution.

(spec file). ,
,
. vendor ,
(.. Joe's Software and Rock Music Emporium).
RPM
. rpmrc
``optflags'' flags
.
.
macros
tags flags.
rpm --showrc

6.2. (Spec File)


.
.


.

. --
(version number)-- (release number)--spec.
(vim-3.0-1.spec):

Summary: ejects ejectable media and controls auto ejection


Name: eject
Version: 1.4
Release: 3
Copyright: GPL
Group: Utilities/System
Source: sunsite.unc.edu:/pub/Linux/utils/disk-management/eject-1.4.tar.gz
Patch: eject-1.4-make.patch
Patch1: eject-1.4-jaz.patch
%description
(eject)
%prep

%setup
%patch -p1
%patch1 -p1
%build
make RPM_OPT_FLAGS="$RPM_OPT_FLAGS"
%install
install -s -m 755 -o 0 -g 0 eject /usr/bin/eject
install -m 644 -o 0 -g 0 eject.1 /usr/man/man1
%files
%doc README COPYING ChangeLog
/usr/bin/eject
/usr/man/man1/eject.1

6.3.
.
.
:
Summary: .
Name: rpm
.
Version: (version) rpm
.
Release: (release)
(..
,
2).
Icon:
(
``glint'' Red Hat). gif
SOURCES.
Source: HOME
.
.
:
(..
).

:
Source0: blah-0.tar.gz
Source1: blah-1.tar.gz
Source2: fooblah.tar.gz

SOURCES . (
, "
").
Patch: (patch)
. :

patch.
patch .
:
Patch0: blah-0.patch
Patch1: blah-1.patch
Patch2: fooblah.patch

SOURCES .
Copyright: .
GPL, BSD, MIT, public domain,
distributable, commercial.
BuildRoot:
``root'' .

.
Group:
( ``glint'' RedHat)
.
:

Applications

Communications
Editors
Emacs
Engineering
Spreadsheets
Databases
Graphics
Networking
Mail
Math
News
Publishing
TeX
Base
Kernel
Utilities
Archiving
Console
File
System
Terminal
Text
Daemons
Documentation
X11
XFree86
Servers
Applications
Graphics
Networking
Games
Strategy
Video
Amusements
Utilities
Libraries
Window Managers
Libraries
Networking
Admin
Daemons
News
Utilities
Development
Debuggers
Libraries
Libc
Languages
Fortran
Tcl
Building
Version Control
Tools
Shells
Games

%description ,
.
tag / .
-
.
6.4. Prep
.
.
patch
make.
:
(shell scripts).
sh script %prep tag
patch . ,
macros '.
' macros %setup macro.
( ),
.
:
-n name
name.
$-$. $,
${}${}, tar .
( ``$''
.
-.

, ).
-c
untar.
-b # untar # (
-c ' ).
.
-a # untar # .
-T untar
-b 0 -a 0 untar
.
.
-D .
macro .
macros
( ).
macros %patch macro.
macro
(patches) . ,
:
# Patch#

-p #
patch(1).
-P Patch ( Patch0).

0 untar .
( ) %patch
macro macro.
%patch# :
%patch # -P
macros .
, sh
. %build macro (
), sh.

.
6.5. (Build)
macros .

, patch
.
sh, sh
( ).
reset
,
. cd
.
6.6.
, , macros.
.
make install , . ,
patch makefile make install
make install ,
sh .

.
6.7.
/

/ .
' ldconfig

. macros
:
%pre macro .

%post macro .
%preun macro
.
%postun macro
.

sh script, #!/bin/sh.
6.8.

. RPM
make install.
. find
. ,

,
.
macros
. :
%doc

binary.
/usr/doc/$NAME-$VERSION-$RELEASE.
macro ,
macro
'.
%config
. sendmail.cf, passwd, .

,

.rpmsave . , ,
macro.
%dir
. ,
%dir macro,

.
%files -f <filename>

.

.
.
.
/usr/bin ,
/usr/bin .

6.9.
6.9.1.

(build tree). /etc/rpmrc.
/usr/src.

(build tree):
BUILD RPM.
,
RPM .
SOURCES tar
patches.
RPM.
SPECS
(spec).
RPMS RPM RPMs
.
SRPMS RPMs .
6.9.2.


RPM. , ,
$NAME.orig.
. .

. ,
(patch). ,
.
script configure. ,
cd . :
diff -uNr dirname.orig dirname > ../SOURCES/dirname-linux.patch

patch
(spec file).
``linux'' patch
.
``config'' ``bugs''
patch. patch

.
6.9.3.


, .

. ,
.
,
.

6.9.4. RPM
(spec file),
.
:

rpm -ba foobar-1.0.spec

switch -b :
p prep specfile.
l
%.
c prep .

build.

RPM,
RPM, .
i prep, .
b prep, ,
.
a ( ).
-b switch.
:
--short-circuit
( c i).
--clean (build tree)
.
--keep-temps temp scripts
/tmp.
/tmp -v .
--test ,

.
6.10.
rpm
, .

. -, make install
, .
rpm -u packagename,
, make
install. ,
. (binary
package) , rpm
.
rpm -ba package,
rpm -i package.
build install
.

6.11. RPMs
RPM (
RPM),
( RPM
). ,
ftp.redhat.com <ftp://ftp.redhat.com>.

6.12. ;

RPMs. RPMs ,
RPMs.
RPMs
internet . ,
upload . shareware
upload
.
Netscape, ssh, pgp, .
7. RPM
RPM Intel i386,
Digital Alpha Linux Sparc.
SGI HP.

. ``optflags'' /etc/rpmrc.
flags
,
. ``arch'' macros
(spec file).

.
``Exclude'' (header).
7.1. (spec File)
(spec file)
``fileutils''. Alpha
Intel.

Summary: GNU File Utilities


Name: fileutils
Version: 3.16
Release: 1
Copyright: GPL
Group: Utilities/File
Source0: prep.ai.mit.edu:/pub/gnu/fileutils-3.16.tar.gz
Source1: DIR_COLORS
Patch: fileutils-3.16-mktime.patch
%description
These are the GNU file management utilities. It includes programs
to copy, move, list, etc, files.
The ls program in this package now incorporates color ls!
%prep
%setup

%ifarch alpha
%patch -p1
autoconf
%endif
%build
configure --prefix=/usr --exec-prefix=/
make CFLAGS="$RPM_OPT_FLAGS" LDFLAGS=-s
%install
rm -f /usr/info/fileutils*
make install
gzip -9nf /usr/info/fileutils*
.
.
.

7.2. Optflags
,
``optflags'' /etc/rpmrc.
, RPM_OPT_FLAGS.
patch Makefile

( -m486 -O2).


Makefile. patch Makefile
.
7.3. Macros
%ifarch macro
-
.
patch

.
patch
, RPM
.

, fileutils patch 64
bit. , Alpha
. , %ifarch macro 64 bit patch
:
%ifarch axp
%patch1 -p1
%endif

patch
alpha.
7.4.

RPMs
,
""
.

rpm --rebuild /usr/src/SRPMS/*.rpm

.
,
:
ExcludeArch: axp

.
,
.
Intel Alpha.
7.5.
, RPM
-
.
, , . ,

RPM .

8.

.
. ,
,
.
9.
, , ,
HOWTO, email :
voulariba@hellug.gr

You might also like