   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   rpmrc
     6.2    (Spec File)
     6.3  
     6.4 Prep
     6.5  (Build)
     6.6 
     6.7       /
     6.8 
     6.9  
        6.9.1      
        6.9.2   
        6.9.3    
        6.9.4     RPM
     6.10  
     6.11        RPMs
     6.12  ;

  7.  RPM   

     7.1     (spec File)
     7.2 Optflags
     7.3 Macros
     7.4    
     7.5 

  8.  

  9.    



  ______________________________________________________________________

  [1m1.  [0m

   RPM     [1mR[22med Hat [1mP[22mackage [1mM[22manager.   
    Red Hat   ,      
    ,     .
           
           , 
          
   ,          
  .
            
  ,          
           
      .


    Red Hat Software     
        RPM    
      .  RPM     ,
           .  
      ,    
     .     
     RPM      GPL.

       RPM      Ed
  Bailey, [4mMaximum[24m [4mRPM[24m.          
       www.redhat.com <http://www.redhat.com>.


  [1m2.  [0m

   ',         
      RPM.      
    `` ()'' .    RPP ( 
    ,      [4m[24m 
     RPM),      ``''
       .  ,  
       RPP    make 
  .         , 
            
       .      
     .    ROM,    
      (patch)       
  .       . ; 
   .  - ,      
  ,         
      RHL.     
  (patch)    [4m[24m [4m[24m  .    , 
        
  .

   RPM       .
              
   .        
         .    RPM
     ,      
  [4m[24m         
   ,        
    .    [4m[24m .

          
  .          
  ,   .     . 
    ,       
  .  ,      .

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


  [1m3.   [0m



  [1m3.1.    RPM[0m

        RPM     Red Hat
  Linux.        ,     
      RPM.      ftp.redhat.com
  <ftp://ftp.redhat.com/pub/redhat/code/rpm>.


  [1m3.2.    RPM[0m

         RPM     cpio 2.4.2 
  .          Linux, 
        Unix. , 
    SunOS, Solaris, AIX, Irix, AmigaOS  .  
     -    
    Unix       .

          RPMs.  
   RPMs   ,       
    ,   gcc, make, .


  [1m4.    RPM[0m

     ,  RPM    
  :


               rpm -i foobar-1.0-1.i386.rpm




        :


               rpm -e foobar




         [4m[24m    
      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 {--help}
         rpm {--version}
         rpm {--initdb}   [--dbpath <dir>]
         rpm {--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
         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
         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]
         rpm {--verify -V -y} [-afpg] [--root <dir>] [--rcfile <file>]
                          [--dbpath <dir>] [--nodeps] [--nofiles] [--noscripts]
                          [--nomd5] [targets]
         rpm {--setperms} [-afpg] [target]
         rpm {--setugids} [-afpg] [target]
         rpm {--erase -e} [--root <dir>] [--noscripts] [--rcfile <file>]
                          [--dbpath <dir>] [--nodeps] [--allmatches]
                          package1 ... packageN
         rpm {-b|t}[plciba] [-v] [--short-circuit] [--clean] [--rcfile  <file>]
                          [--sign] [--test] [--timecheck <s>] specfile
         rpm {--rebuild} [--rcfile <file>] [-v] source1.rpm ... sourceN.rpm
         rpm {--recompile} [--rcfile <file>] [-v] source1.rpm ... sourceN.rpm
         rpm {--resign} [--rcfile <file>] package1 package2 ... packageN
         rpm {--addsign} [--rcfile <file>] package1 package2 ... packageN
         rpm {--checksig -K} [--nopgp] [--nomd5] [--rcfile <file>]
                             package1 ... packageN
         rpm {--rebuilddb} [--rcfile <file>] [--dbpath <dir>]
         rpm {--querytags}




           RPM
     (man page).


  [1m5.           RPM;[0m

   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                      Distribution: Red Hat Linux Colgate
       Version     : 1.2                               Vendor: Red Hat Software
       Release     : 2                             Build Date: Mon Sep 02 11:59:12 1996
       Install date: (none)                        Build Host: porky.redhat.com
       Group       : Games                         Source RPM: koules-1.2-2.src.rpm
       Size        : 614939
       Summary     : SVGAlib action game with multiplayer, network, and sound support
       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    .


  [1m6.   RPMs[0m


       RPMs,    
             
  .

         RPM   :

       /etc/rpmrc     .

              RPM  
         .

       (patch)      
         

        (spec file)   .

            .

         RPM.

    ,  RPM     
       .



  [1m6.1.    rpmrc[0m

    ,     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





  [1m6.2.     (Spec File)[0m

         .   
        .  
           
               
  .

           
  .        -- 
  (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)        CD-ROMs,Jaz  Zip drives,      SPARC.

  %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





  [1m6.3.   [0m

           .
      .    
     :

    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    / .    
     -        
        .
  [1m6.4.  Prep[0m

         . 
        .    
       patch     
        make.

    :         
        (shell scripts).  
      sh script       %prep tag 
       patch   .  , 
   macros    '.

    '  macros   %setup macro.   
   (     ),   
         .    
   :


    -n name          
          name.    
      $-$.      $,
     ${}${},      tar .
     (     ``$'' [4m[24m  
           .
          -.   
              
     ,   ).

    -c         [4m[24m 
      untar.

    -b #   untar  # [4m[24m     ( 
          -c '   ).  
           .

    -a #   untar  # [4m[24m   .

    -T          untar
           -b 0  -a 0    untar
        .      
      .

    -D [4m[24m      .  
            macro . 
        [4m[24m  macros  [4m[24m  
     (   ).


       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.  
            
   .


  [1m6.5.   (Build)[0m

     macros    .     
            
       ,    patch 
     .        
     sh,       sh 
     (  ).

  [1m      reset      [0m
  [1m           [22m,
      .       cd 
  .


  [1m6.6.  [0m

     , , macros.     
      .      
  make install    ,   .   , 
     patch  makefile    make install  
         make install ,    
        sh .   
             
   .


  [1m6.7.       [0m
  [1m/[0m

            
  /    .   
  '         ldconfig 
        
  .   macros        
  :

    %pre   macro      .

    %post   macro      .

    %preun   macro     
     .

    %postun   macro     
     .

           
  sh script,    [4m[24m   #!/bin/sh.


  [1m6.8.  [0m

       [4m[24m        
   .   RPM       
      make install. [4m[24m [4m[24m  
    .       find  
      .    , 
           
      ,     
        .

     macros    
  .     :

    %doc         
             
     binary.     
     /usr/doc/$NAME-$VERSION-$RELEASE.       
     macro      ,    
          macro  
     '.

    %config         
     .       sendmail.cf, passwd, .
            
     ,         
             
     .rpmsave    .  , ,   
           macro.

    %dir          
          .  , 
           [4m[24m  %dir macro, [4m[24m 
            
         .

    %files -f <filename>       
              
          .     
                
      .         
           .

           . 
    /usr/bin  ,     
   [4m[24m   /usr/bin   .


  [1m6.9.   [0m


  [1m6.9.1.       [0m

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

           
       (build tree):

    BUILD          RPM.  
           ,   
       RPM     .

    SOURCES           tar
          patches.    
         RPM.

    SPECS          
      (spec).
    RPMS       RPM    RPMs  
     .

    SRPMS        RPMs  .


  [1m6.9.2.    [0m

              
            
  RPM.     ,    , 
        $NAME.orig.   
  .        . 
            
  .     ,    
  (patch).   ,      
  .         
    script configure.   ,      
        cd .     :


               diff -uNr dirname.orig dirname > ../SOURCES/dirname-linux.patch




       patch    
       (spec file).  
    ``linux''      patch  
  .       
  ``config''  ``bugs''    [4m[24m   
    patch.         patch 
            
      .


  [1m6.9.3.     [0m

               
   ,     .    
            
      . ,  
         .   
          ,  
          .



  [1m6.9.4.      RPM[0m

          (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     ,     
     .


  [1m6.10.   [0m

            rpm  
   ,    .    
          
    .   -,    make install 
   ,      .

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



  [1m6.11.         RPMs[0m

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




  [1m6.12.   ;[0m

             
       RPMs.   RPMs    , 
        RPMs.    
      RPMs        
  internet     . , [4m[24m  
   upload [4m[24m [4m[24m [4m[24m.   shareware
   [4m[24m     upload     
        . 
     Netscape, ssh, pgp, .


  [1m7.   RPM   [0m

   RPM         Intel i386,
  Digital Alpha   Linux   Sparc.   
        SGI  HP.  
            
  .      ``optflags''  /etc/rpmrc.
        flags   
   ,        
  .       ``arch'' macros 
    (spec file).      
          
     .       
  ``Exclude''   (header).


  [1m7.1.      (spec File)[0m

         (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*

  .
  .
  .





  [1m7.2.  Optflags[0m

     ,      
   ``optflags''   /etc/rpmrc.      
    ,      RPM_OPT_FLAGS.
     patch  Makefile      
           
     ( -m486  -O2).   
             
            
  Makefile.     patch   Makefile    
    .


  [1m7.3.  Macros[0m

   %ifarch macro      .  
       - patch   
   .     ,  RPM  
       patch    .

    ,  fileutils   patch   64
  bit.  ,        Alpha  
  . ,   %ifarch macro    64 bit patch 
  :

  %ifarch axp
  %patch1 -p1
  %endif




      patch     
     alpha.


  [1m7.4.     [0m

        RPMs    
      ,     
  ""       
  .         
  


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




       .       
     ,        
       :


       ExcludeArch: axp




           .
   ,        
  .           
  Intel       Alpha.


  [1m7.5.  [0m

  ,     RPM   
     -       
         .      
   ,   , .   , 
          
   RPM        .



  [1m8.   [0m

           
  .        
      .    ,   
           ,  
       .


  [1m9.     [0m

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


































































