(debian-policy.info)Overwriting files in other packages


Next: Replacing whole packages forcing their removal Up: Overwriting files and replacing packages - Replaces
Enter node , (file) or (file)node

7.6.1 Overwriting files in other packages
-----------------------------------------

It is usually an error for a package to contain files which are on the
system in another package.  However, if the overwriting package declares
that it ‘Replaces’ the one containing the file being overwritten, then
‘dpkg’ will replace the file from the old package with that from the
new.  The file will no longer be listed as “owned” by the old package
and will be taken over by the new package.  Normally, ‘Breaks’ should be
used in conjunction with ‘Replaces’.  (1)

For example, if a package foo is split into foo and foo-data starting at
version 1.2-3, foo-data would have the fields

     Replaces: foo (<< 1.2-3)
     Breaks: foo (<< 1.2-3)

in its control file.  The new version of the package foo would normally
have the field

     Depends: foo-data (>= 1.2-3)

(or possibly ‘Recommends’ or even ‘Suggests’ if the files moved into
foo-data are not required for normal operation).

If a package is completely replaced in this way, so that ‘dpkg’ does not
know of any files it still contains, it is considered to have
“disappeared”.  It will be marked as not wanted on the system (selected
for removal) and “Not-Installed”.  Any ‘conffile’s details noted for the
package will be ignored, as they will have been taken over by the
overwriting package.  The package’s ‘postrm’ script will be run with a
special argument to allow the package to do any final cleanup required.
See Note: Summary of ways maintainer scripts are called.  (2)

For this usage of ‘Replaces’, virtual packages (see Note: Virtual
packages - Provides.) are not considered when looking at a
‘Replaces’ field.  The packages declared as being replaced must be
mentioned by their real names.

This usage of ‘Replaces’ only takes effect when both packages are at
least partially on the system at once.  It is not relevant if the
packages conflict unless the conflict has been overridden.

   ---------- Footnotes ----------

   (1) To see why ‘Breaks’ is normally needed in addition to ‘Replaces’,
consider the case of a file in the package foo being taken over by the
package foo-data.  ‘Replaces’ will allow foo-data to be installed and
take over that file.  However, without ‘Breaks’, nothing requires foo to
be upgraded to a newer version that knows it does not include that file
and instead depends on foo-data.  Nothing would prevent the new foo-data
package from being installed and then removed, removing the file that it
took over from foo.  After that operation, the package manager would
think the system was in a consistent state, but the foo package would be
missing one of its files.

   (2) Replaces is a one way relationship.  You have to install the
replacing package after the replaced package.


automatically generated by info2www version 1.2.2.9