home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 February / CHIP_2_98.iso / misc / src / rpm / docs / dependencies < prev    next >
Text File  |  1997-09-17  |  5KB  |  138 lines

  1. DEPENDENCIES
  2. ============
  3.  
  4. Dependencies provide a way for a package builder to require other
  5. packages or capabilities to be installed before or simultaneously
  6. with one another. These can be used to require a python interpretor
  7. for a python based application for example. RPM ensures dependencies
  8. are satisfied whenever packages are installed, erased, or upgraded.
  9.  
  10. Requiring Packages
  11. ------------------
  12.  
  13. To require packages, use:
  14.  
  15.     Requires: python perl
  16.  
  17. in the spec file. Note that "Requires python, perl" would work as well. If you
  18. needed to have a very recent version of python but any version of perl,
  19.  
  20.     Requires: python >= 1.3, perl
  21.  
  22. would do the trick. Again, the ',' in the line is optional.  Instead of
  23. '>=', you may also use '<', '>', '<=', or '='.
  24.  
  25. RPM uses an internal algorithm to determine version number orderings which
  26. works correctly most of the time. For example, it will know that
  27. 1.9a is older then 1.9b. However, it will also be later then 1.9 which
  28. may or may not be correct as some programmers use letters in version numbers
  29. to indicate beta versions. 
  30.  
  31. To work around this, you may specify a serial number for a package like this:
  32.  
  33.     Serial: 23
  34.  
  35. If a Requires: line should be comparing the given number with a serial number
  36. instead of a version number, you would do this:
  37.  
  38.     Requires: somepackage =S 23
  39.  
  40. Virtual Packages
  41. ----------------
  42.  
  43. Sometimes you need to make sure the system your package is being installed 
  44. on has a package which provides a certain capability, even though you don't
  45. care what specific package provides it. For example, sendmail won't work
  46. properly unless a local delivery agent (lda) is present. You can ensure that
  47. one is installed like this:
  48.  
  49.     Requires: lda
  50.  
  51. This will match either a package called lda (as mentioned above), or any
  52. package which contains:
  53.  
  54.     Provides: lda
  55.  
  56. in its .spec file. No version numbers may be used with virtual packages.
  57.  
  58. Automatic Dependencies
  59. ----------------------
  60.  
  61. To reduct the amount of work required by the package builder, RPM scans
  62. the file list of a package when it is being built. Any files in the file
  63. list which require shared libraries to work (as determined by ldd) cause
  64. that package to require the shared library.
  65.  
  66. For example, if your package contains /bin/vi, RPM will add dependencies 
  67. for both libtermcap.so.2 and libc.so.5. These are treated as virtual
  68. packages, so no version numbers are used.
  69.  
  70. A similar process allows RPM to add Provides information automatically. Any
  71. shared library in the file list is examined for its soname (the part of
  72. the name which must match for two shared libraries to be considered
  73. equivalent) and that soname is automatically provided by the package. For
  74. example, the libc-5.3.12 package has provides information added for
  75. libm.so.5 and libc.so.5. We expect this automatic dependency generation
  76. to eliminate the need for most packages to use explicit Requires: lines.
  77.  
  78. Installing and Erasing Packages with Dependencies
  79. -------------------------------------------------
  80.  
  81. For the most part, dependencies should be transparent to the user. However,
  82. a few things will change.
  83.  
  84. First, when packages are added or upgraded, all of their dependencies
  85. must be satisfied. If they are not, an error message like this appears:
  86.  
  87.     failed dependencies:
  88.         libICE.so.6  is needed by somepackage-2.11-1
  89.         libSM.so.6  is needed by somepackage-2.11-1
  90.         libc.so.5  is needed by somepackage-2.11-1
  91.  
  92. Similarly, when packages are removed, a check is made to ensure that 
  93. no installed packages will have their dependency conditions break due to
  94. the packages being removed. If you wish to turn off dependency checking for 
  95. a particular command, use the --nodeps flag.
  96.  
  97. Conflicts
  98. ---------
  99.  
  100. While conflicts were implemented in earlier versions of RPM they never 
  101. worked properly until RPM 2.3.4 (well, we hope they work properly now
  102. anyway).
  103.  
  104. Conflicts allow a package to say it won't work with another package (or
  105. virtual package) installed on the system. For example, qmail doesn't work
  106. (w/o custom setup) on machines with sendmail installed. The qmail spec file
  107. may codify this with a line like:
  108.  
  109. Conflicts: sendmail
  110.  
  111. The syntax of the "Conflicts" tag is identical to the syntax of the Requires
  112. tag and conflict checking may be overridden by using the --nodeps flag.
  113.  
  114. Querying with Dependencies
  115. --------------------------
  116.  
  117. Two new query information selection options are now available. The first, 
  118. --provides, prints a list of all of the capabilities a package provides. 
  119. The second, --requires, shows the other packages that a package requires
  120. to be installed, along with any version number checking.
  121.  
  122. There are also two new ways to search for packages. Running a query with 
  123. --whatrequires <item> queries all of the packages that require <item>. 
  124. Similarly, running --whatprovides <item> queries all of the packages that 
  125. provide the <item> virtual package. Note that querying for package that 
  126. provides "python" will not return anything, as python is a package, not
  127. a virtual package.
  128.  
  129. Verifying Dependencies
  130. ----------------------
  131.  
  132. As of RPM 2.2.2, -V (aka -y, --verify) verifies package dependencies
  133. by default. You can tell rpm to ignore dependencies during system
  134. verification with the --nodeps. If you want RPM to verify just dependencies
  135. and not file attributes (including file existence), use the --nofiles
  136. flag. Note that "rpm -Va --nofiles --nodeps" will not verify anything at
  137. all, nor generate an error message.
  138.