Przeglądaj źródła

dpkg (1.2.13) unstable; urgency=LOW

  * dpkg --search produces correct output for diversions.
  * dpkg-name remove unnecessary arch missing warning.  (Bug#3482.)

  * dpkg-deb --build warns about uppercase chars in package name.

  * dpkg-scanpackages error messages updated and manpage provided
    (thanks to Michael Shields).
  * dpkg-scanpackages warns about spurious entries in override file.
  * dpkg-scanpackages `noverride' renamed to `override' everywhere.
  * dpkg-scanpackages field ordering to put Architecture higher.
  * dpkg-scanpackages field names capitalised appropriately.
  * dpkg-scanpackages invokes find with -follow.  (Bug#3956.)

  * guidelines say #!/usr/bin/perl everywhere, not #!/bin/perl.
  * Many developers' PGP keys added.

  * configure script uses ${CC} instead of $(CC) (again :-/).
  * developers' keys included in dpkg source tree and /usr/doc.
  * configure remade using autoconf 2.10-3 (was 2.4-1).

 -- Ian Jackson <ian@chiark.chu.cam.ac.uk>  Thu, 1 Aug 1996 02:46:34 +0100
Ian Jackson 30 lat temu
rodzic
commit
90d5c6916a

+ 3 - 0
TODO

@@ -20,6 +20,8 @@ urgent
  * remove old docs from /usr/doc/dpkg.
  * remove old docs from /usr/doc/dpkg.
 
 
 other stuff unlikely to get done soon
 other stuff unlikely to get done soon
+ * Automatically remove <file>.gz if <file> can't be found ?
+ * Local version number (using non-numeric epoch, perhaps ?)
  * Filename field generated by --record-avail handle split packages somehow.
  * Filename field generated by --record-avail handle split packages somehow.
  * understand Replaces in dselect
  * understand Replaces in dselect
  * provide way for package to declare ownership of files for dpkg -S
  * provide way for package to declare ownership of files for dpkg -S
@@ -46,6 +48,7 @@ other stuff unlikely to get done soon
  * --purge remove empty directories which used too contain conffiles
  * --purge remove empty directories which used too contain conffiles
  * conffiles handling options, including `replace removed files'
  * conffiles handling options, including `replace removed files'
  * `diff' option at conffile prompt
  * `diff' option at conffile prompt
+ * dpkg --query | -Q
 
 
 done
 done
  * highlight or pre-sort or something new or changed packages,
  * highlight or pre-sort or something new or changed packages,

Plik diff jest za duży
+ 310 - 101
configure


+ 1 - 1
configure.in

@@ -25,7 +25,7 @@ AC_ARG_WITH(arch,
    dpkg_archwhy="  (obtained from dpkg)"
    dpkg_archwhy="  (obtained from dpkg)"
   elif test "${GCC-no}" = yes; then
   elif test "${GCC-no}" = yes; then
 changequote(, )dnl
 changequote(, )dnl
-   dpkg_arch="`$(CC) --print-libgcc-file-name |
+   dpkg_arch="`${CC} --print-libgcc-file-name |
 	sed -e 's,^.*/gcc-lib/,,; s,/libgcc\.a$,,; s,/[0-9.][0-9.]*$,,; s/-.*$//'`"
 	sed -e 's,^.*/gcc-lib/,,; s,/libgcc\.a$,,; s,/[0-9.][0-9.]*$,,; s/-.*$//'`"
 changequote([, ])dnl
 changequote([, ])dnl
    if test "x`echo \"$dpkg_arch\" | tr -d a-z0-9-`" != x -o "x$dpkg_arch" = x
    if test "x`echo \"$dpkg_arch\" | tr -d a-z0-9-`" != x -o "x$dpkg_arch" = x

+ 24 - 0
debian.Changelog

@@ -1,3 +1,27 @@
+dpkg (1.2.13) unstable; urgency=LOW
+
+  * dpkg --search produces correct output for diversions.
+  * dpkg-name remove unnecessary arch missing warning.  (Bug#3482.)
+
+  * dpkg-deb --build warns about uppercase chars in package name.
+
+  * dpkg-scanpackages error messages updated and manpage provided
+    (thanks to Michael Shields).
+  * dpkg-scanpackages warns about spurious entries in override file.
+  * dpkg-scanpackages `noverride' renamed to `override' everywhere.
+  * dpkg-scanpackages field ordering to put Architecture higher.
+  * dpkg-scanpackages field names capitalised appropriately.
+  * dpkg-scanpackages invokes find with -follow.  (Bug#3956.)
+
+  * guidelines say #!/usr/bin/perl everywhere, not #!/bin/perl.
+  * Many developers' PGP keys added.
+
+  * configure script uses ${CC} instead of $(CC) (again :-/).
+  * developers' keys included in dpkg source tree and /usr/doc.
+  * configure remade using autoconf 2.10-3 (was 2.4-1).
+
+ -- Ian Jackson <ian@chiark.chu.cam.ac.uk>  Thu, 1 Aug 1996 02:46:34 +0100
+
 dpkg (1.2.12); priority=LOW
 dpkg (1.2.12); priority=LOW
 
 
   * dpkg --search and --list understand and comment on diversions.
   * dpkg --search and --list understand and comment on diversions.

+ 1 - 0
debian.README

@@ -6,6 +6,7 @@ which is part of Debian.
 Copyright (C) 1994,1995,1996 Ian Jackson <iwj10@cus.cam.ac.uk>
 Copyright (C) 1994,1995,1996 Ian Jackson <iwj10@cus.cam.ac.uk>
 Copyright (C) 1995,1996 Erick Branderhorst <branderhorst@heel.fgg.eur.nl>
 Copyright (C) 1995,1996 Erick Branderhorst <branderhorst@heel.fgg.eur.nl>
 Copyright (C) 1996 Kim-Minh Kaplan <kkaplan@cdfhp3.in2p3.fr>
 Copyright (C) 1996 Kim-Minh Kaplan <kkaplan@cdfhp3.in2p3.fr>
+Copyright (C) 1996 Michael Shields <shields@crosslink.net>
 Copyright (C) 1995 Bruce Perens <bruce@pixar.com>
 Copyright (C) 1995 Bruce Perens <bruce@pixar.com>
 Copyright (C) 1994 Carl Streeter <streeter@cae.wisc.edu>
 Copyright (C) 1994 Carl Streeter <streeter@cae.wisc.edu>
 Copyright (C) 1994 Matt Welsh <mdw@sunsite.unc.edu>
 Copyright (C) 1994 Matt Welsh <mdw@sunsite.unc.edu>

+ 1 - 1
debian.rules

@@ -1,7 +1,7 @@
 #!/usr/bin/make -f
 #!/usr/bin/make -f
 
 
 package=dpkg
 package=dpkg
-version=1.2.12
+version=1.2.13
 
 
 archi=$(shell dpkg --print-architecture)
 archi=$(shell dpkg --print-architecture)
 DIR:=$(shell pwd)
 DIR:=$(shell pwd)

+ 7 - 7
doc/Makefile.in

@@ -24,7 +24,7 @@ mandir = $(prefix)/man
 man5dir = $(mandir)/man5
 man5dir = $(mandir)/man5
 man5 = 5
 man5 = 5
 docdir = $(prefix)/doc
 docdir = $(prefix)/doc
-devdocdir = $(docdir)/dpkg
+dpkgdocdir = $(docdir)/dpkg
 
 
 DIST = Makefile.in $(SRC) $(MAN)
 DIST = Makefile.in $(SRC) $(MAN)
 
 
@@ -35,15 +35,15 @@ INSTALL_DATA = @INSTALL_DATA@
 MAKEINFO = makeinfo
 MAKEINFO = makeinfo
 TEXI2DVI = texi2dvi
 TEXI2DVI = texi2dvi
 
 
-DEVDOCS= auto-deconfiguration.txt dependency-ordering.txt \
+DPKGDOCS= auto-deconfiguration.txt dependency-ordering.txt \
  disappear-replace.txt diversions.text \
  disappear-replace.txt diversions.text \
  essential-flag.txt version-ordering.txt
  essential-flag.txt version-ordering.txt
 
 
 # Files folded into main guidelines document
 # Files folded into main guidelines document
-OBSOLETEDOCS= descriptions.txt upgrades+errors.txt \
+OBSOLETEDOCS= descriptions.txt upgrades+errors.txt developer-keys.pgp \
  maintainer-script-args.txt virtual-dependencies.txt
  maintainer-script-args.txt virtual-dependencies.txt
 
 
-all:		$(DEVDOCS) guidelines.info
+all:		$(DPKGDOCS) guidelines.info
 
 
 guidelines.info: guidelines.texi
 guidelines.info: guidelines.texi
 		$(MAKEINFO) $(srcdir)/guidelines.texi
 		$(MAKEINFO) $(srcdir)/guidelines.texi
@@ -65,7 +65,7 @@ database-structure.monops: database-structure.ps
 
 
 clean:
 clean:
 		rm -f database-structure.ps database-structure.monops ps
 		rm -f database-structure.ps database-structure.monops ps
-		rm -f *.{aux,cp,dvi,fn,ky,log,pg,toc,tp,vr}
+		rm -f *.{aux,cp,dvi,fn,ky,log,pg,toc,tp,vr,bak}
 		rm -f guidelines.info*
 		rm -f guidelines.info*
 
 
 distclean:
 distclean:
@@ -77,6 +77,6 @@ install:	all
 		$(INSTALL_DATA) deb-control.5 $(man5dir)/deb-control.$(man5)
 		$(INSTALL_DATA) deb-control.5 $(man5dir)/deb-control.$(man5)
 		$(INSTALL_DATA) guidelines.info guidelines.info-*[0-9] \
 		$(INSTALL_DATA) guidelines.info guidelines.info-*[0-9] \
 			$(infodir)/.
 			$(infodir)/.
-		set -e; for d in $(DEVDOCS) ; do \
-			$(INSTALL_DATA) $$d $(devdocdir)/$$d ; \
+		set -e; for d in $(DPKGDOCS) ; do \
+			$(INSTALL_DATA) $$d $(dpkgdocdir)/$$d ; \
 		done
 		done

BIN
doc/developer-keys.bak


BIN
doc/developer-keys.pgp


+ 3 - 9
doc/guidelines.texi

@@ -360,12 +360,7 @@ All command scripts should have a @code{#!} line naming the shell to be
 used to interpret them.
 used to interpret them.
 
 
 @item
 @item
-In the case of Perl scripts this should be @code{#!/usr/bin/perl} or
-sometimes @code{#!/bin/perl}, as follows: if the script is a critical
-one that may be called when the @file{/usr} partition is unmounted or
-broken it should use @file{/bin/perl}.  Otherwise (especially if the
-script is not specifically targetted at Debian) it should use Perl's
-standard location, @file{/usr/bin/perl}.
+In the case of Perl scripts this should be @code{#!/usr/bin/perl}.
 
 
 @item
 @item
 Generally the following compilation parameters should be used:
 Generally the following compilation parameters should be used:
@@ -973,9 +968,8 @@ errors when making calls such as @code{open}, @code{print},
 
 
    If these scripts exist they should be left in the @file{DEBIAN}
    If these scripts exist they should be left in the @file{DEBIAN}
 directory with execute permission enabled and should contain an
 directory with execute permission enabled and should contain an
-appropriate @code{#!} line, such as @code{#!/bin/bash} for a
-@code{bash} script or @code{#!/bin/perl} for a Perl script (see
-above).
+appropriate @code{#!} line, such as @code{#!/bin/bash} for a @code{bash}
+script or @code{#!/usr/bin/perl} for a Perl script (see above).
 
 
 @node Dependencies and Conflicts, Package Classification Fields, Installation and Removal Scripts, Control Files
 @node Dependencies and Conflicts, Package Classification Fields, Installation and Removal Scripts, Control Files
 @unnumberedsec Conflicts, Depends, Suggests, Recommends and Provides
 @unnumberedsec Conflicts, Depends, Suggests, Recommends and Provides

+ 429 - 67
doc/sgml/programmer.sgml

@@ -1,4 +1,4 @@
-<!doctype linuxdoc system>
+<!doctype linuxdoc system "./linuxdoc.dtd" >
 
 
 <!--
 <!--
  Debian Linux dpkg package installation tool.
  Debian Linux dpkg package installation tool.
@@ -24,18 +24,20 @@ from the system administrator's perspective.
 <toc>
 <toc>
 
 
 <!-- Describes the technical interface between a package and dpkg.
 <!-- Describes the technical interface between a package and dpkg.
-Control file fields and their syntax and semantics.  How to use
+How to use
 update-rc.d, diversions, update-alternatives, install-info in a
 update-rc.d, diversions, update-alternatives, install-info in a
 package.  How to safely put shared libraries in a package.  Details of
 package.  How to safely put shared libraries in a package.  Details of
-dpkg's handling of individual files.  Semantics of virtual packages.
+dpkg's handling of individual files.
 Sections on when to use which feature (eg Replaces
 Sections on when to use which feature (eg Replaces
 vs. Replaces/Conflicts vs. update-alternatives vs. diversions)
 vs. Replaces/Conflicts vs. update-alternatives vs. diversions)
 Cross-references to the policy document (see below) where appropriate.
 Cross-references to the policy document (see below) where appropriate.
 Description of the interface between dselect and its access methods.
 Description of the interface between dselect and its access methods.
 Hints on where to start with a new package (ie, the hello package).
 Hints on where to start with a new package (ie, the hello package).
+What to do about file aliasing.
 -->
 -->
 
 
 <sect>Scope of this manual
 <sect>Scope of this manual
+<p>
 
 
 This manual describes the technical aspects of creating Debian binary
 This manual describes the technical aspects of creating Debian binary
 packages (<tt/.deb/ files.).  It documents the behaviour of the
 packages (<tt/.deb/ files.).  It documents the behaviour of the
@@ -72,6 +74,7 @@ example for people wishing to create Debian packages.
 <em>Note that this document is not yet complete !</em>
 <em>Note that this document is not yet complete !</em>
 
 
 <sect>Binary package format
 <sect>Binary package format
+<p>
 
 
 <tt/dpkg/ is a suite of programs for creating binary package files and
 <tt/dpkg/ is a suite of programs for creating binary package files and
 installing and removing them on Unix systems.<footnote><tt/dpkg/ is
 installing and removing them on Unix systems.<footnote><tt/dpkg/ is
@@ -101,6 +104,7 @@ as checksums and digital signatures.
 
 
 
 
 <sect1>Creating package files -- <tt/dpkg-deb/
 <sect1>Creating package files -- <tt/dpkg-deb/
+<p>
 
 
 All manipulation of binary package files is done by <tt/dpkg-deb/;
 All manipulation of binary package files is done by <tt/dpkg-deb/;
 it's the only program that has knowledge of the format.
 it's the only program that has knowledge of the format.
@@ -136,9 +140,9 @@ is installed.
 <p>
 <p>
 
 
 When you've prepared the package, you should invoke:<!--var-->
 When you've prepared the package, you should invoke:<!--var-->
-<tscreen><verb>
+<example>
 dpkg --build <it/directory/
 dpkg --build <it/directory/
-</verb></tscreen>
+</example>
 <p>
 <p>
 
 
 This will build the package in <var/directory/<tt/.deb/.
 This will build the package in <var/directory/<tt/.deb/.
@@ -149,12 +153,13 @@ invokes <tt/dpkg-deb/ with the same arguments to build the package.)
 See the manpage for <tt/dpkg-deb/ for details of how to examine the
 See the manpage for <tt/dpkg-deb/ for details of how to examine the
 contents of this newly-created file.  You may find the output of
 contents of this newly-created file.  You may find the output of
 following commands enlightening:
 following commands enlightening:
-<tscreen><verb>
+<example>
 dpkg-deb --info <var/filename/<tt/.deb/
 dpkg-deb --info <var/filename/<tt/.deb/
 dpkg-deb --contents <var/filename/<tt/.deb/
 dpkg-deb --contents <var/filename/<tt/.deb/
-</verb></tscreen>
+</example>
 
 
 <sect1>Package control information files<label id="controlarea">
 <sect1>Package control information files<label id="controlarea">
+<p>
 
 
 The control information portion of a binary package is a collection of
 The control information portion of a binary package is a collection of
 files with names known to <tt/dpkg/.  It will treat the contents of
 files with names known to <tt/dpkg/.  It will treat the contents of
@@ -198,6 +203,7 @@ that not necessarily every configuration file should be listed here.
 </descrip>
 </descrip>
 
 
 <sect1>The main control information file: <tt/control/<label id="controlfile">
 <sect1>The main control information file: <tt/control/<label id="controlfile">
+<p>
 
 
 The most important control information file used by <tt/dpkg/ when it
 The most important control information file used by <tt/dpkg/ when it
 installs a package is <tt/control/.  It contains all the package's
 installs a package is <tt/control/.  It contains all the package's
@@ -269,13 +275,13 @@ indicates that the package is architecture-independent.
 <p>
 <p>
 
 
 The value for this field can be obtained using
 The value for this field can be obtained using
-<tscreen><verb>
+<example>
 dpkg --print-architecture
 dpkg --print-architecture
-</verb></tscreen>
+</example>
 This actually invokes
 This actually invokes
-<tscreen><verb>
+<example>
 gcc --print-libgcc-file-name
 gcc --print-libgcc-file-name
-</verb></tscreen>
+</example>
 and parses and decomposes the output and looks the CPU type from the
 and parses and decomposes the output and looks the CPU type from the
 GCC configuration in a table in <tt/dpkg/.  This is so that it will
 GCC configuration in a table in <tt/dpkg/.  This is so that it will
 work if you're cross-compiling.
 work if you're cross-compiling.
@@ -375,11 +381,13 @@ resort.
 </descrip>
 </descrip>
 
 
 <sect2>List of other control fields
 <sect2>List of other control fields
+<p>
 
 
 There are several other fields which are used elsewhere by parts of
 There are several other fields which are used elsewhere by parts of
 the system.  These should not appear in package control files.
 the system.  These should not appear in package control files.
 
 
 <sect3>Status fields
 <sect3>Status fields
+<p>
 
 
 These fields appear in <tt/dpkg/'s internal status file; they are also
 These fields appear in <tt/dpkg/'s internal status file; they are also
 printed by <tt/dpkg --status/ and can be seen in <tt/dselect/ by
 printed by <tt/dpkg --status/ and can be seen in <tt/dselect/ by
@@ -411,6 +419,7 @@ emphasise that this field should <em/not/ appear in a package !
 </descrip>
 </descrip>
 
 
 <sect4><tt/Packages/ file (available package) fields
 <sect4><tt/Packages/ file (available package) fields
+<p>
 
 
 These fields are found in <tt/Packages/ files (lists of packages
 These fields are found in <tt/Packages/ files (lists of packages
 available for installation, which are generated by the distribution
 available for installation, which are generated by the distribution
@@ -441,11 +450,12 @@ spaces.
 </descrip>
 </descrip>
 
 
 <sect4>Obsolete fields
 <sect4>Obsolete fields
+<p>
 
 
 These are still recognised by <tt/dpkg/ but should not appear anywhere
 These are still recognised by <tt/dpkg/ but should not appear anywhere
 any more.
 any more.
 
 
-<p><descrip>
+<descrip>
 
 
 <tag><tt/Revision/, <tt/Package-Revision/, <tt/Package_Revision/</tag>
 <tag><tt/Revision/, <tt/Package-Revision/, <tt/Package_Revision/</tag>
 
 
@@ -459,6 +469,7 @@ separate control file field.  This field went through several names.
 </descrip>
 </descrip>
 
 
 <sect1>Version numbering<label id="versions">
 <sect1>Version numbering<label id="versions">
+<p>
 
 
 Every package has a version number, in its <tt/Version/ control file
 Every package has a version number, in its <tt/Version/ control file
 field.
 field.
@@ -577,6 +588,7 @@ If an upstream package has problematic version numbers they should be
 converted to a sane form for use in the <tt/Version/ field.
 converted to a sane form for use in the <tt/Version/ field.
 
 
 <sect1>Package maintainer scripts run by <tt/dpkg/<label id="maintainerscripts">
 <sect1>Package maintainer scripts run by <tt/dpkg/<label id="maintainerscripts">
+<p>
 
 
 It is possible supply scripts as part of a package which <tt/dpkg/
 It is possible supply scripts as part of a package which <tt/dpkg/
 will run for you when your package is installed, upgraded or removed.
 will run for you when your package is installed, upgraded or removed.
@@ -624,18 +636,21 @@ See <ref id="maintscripts-instact"> for details of exactly when and
 how these scripts are called and with what arguments.
 how these scripts are called and with what arguments.
 
 
 <sect>Declaring relationships between packages<label id="depconoverwr">
 <sect>Declaring relationships between packages<label id="depconoverwr">
+<p>
 
 
 Packages can declare in their control file that they have certain
 Packages can declare in their control file that they have certain
 relationships to other packages - for example, that they may not be
 relationships to other packages - for example, that they may not be
 installed at the same time as certain other packages, and/or that they
 installed at the same time as certain other packages, and/or that they
-depend on the presence of others.
+depend on the presence of others, or that they should overwrite files
+in certain other packages if present.
 <p>
 <p>
 
 
 This is done using the <tt/Depends/, <tt/Recommends/, <tt/Suggests/,
 This is done using the <tt/Depends/, <tt/Recommends/, <tt/Suggests/,
 <tt/Conflicts/, <tt/Provides/ and <tt/Replaces/ control file fields.
 <tt/Conflicts/, <tt/Provides/ and <tt/Replaces/ control file fields.
 <p>
 <p>
 
 
-<sect>Syntax of relationship fields
+<sect1>Syntax of relationship fields
+<p>
 
 
 These fields all have a uniform syntax.  They are a list of package
 These fields all have a uniform syntax.  They are a list of package
 names separated by commas.
 names separated by commas.
@@ -664,8 +679,8 @@ The relations allowed are
 for strictly earlier, earlier or equal, exactly equal, later or equal
 for strictly earlier, earlier or equal, exactly equal, later or equal
 and strictly later, respectively.  The forms <tt/&lt;/ and <tt/&gt;/
 and strictly later, respectively.  The forms <tt/&lt;/ and <tt/&gt;/
 were used to mean earlier/later or equal, rather than strictly
 were used to mean earlier/later or equal, rather than strictly
-earlier/later, and so (while <tt/dpkg/ still supports them) they
-should not appear in new packages.
+earlier/later, so they should not appear in new packages (though
+<tt/dpkg/ still supports them).
 <p>
 <p>
 
 
 Whitespace may appear at any point in the version specification, and
 Whitespace may appear at any point in the version specification, and
@@ -677,8 +692,9 @@ put a single space after each comma, on either side of each vertical
 bar, and before each open parenthesis.
 bar, and before each open parenthesis.
 
 
 <sect1>Dependencies - <tt/Depends/, <tt/Recommends/, <tt/Suggests/, <tt/Pre-Depends/
 <sect1>Dependencies - <tt/Depends/, <tt/Recommends/, <tt/Suggests/, <tt/Pre-Depends/
+<p>
 
 
-These three fields are used to declare a dependency by one package on
+These four fields are used to declare a dependency by one package on
 another.  They appear in the depending package's control file.
 another.  They appear in the depending package's control file.
 <p>
 <p>
 
 
@@ -697,6 +713,10 @@ For this reason packages in an installation run are usually all
 unpacked first and all configured later; this gives later versions of
 unpacked first and all configured later; this gives later versions of
 packages with dependencies on later versions of other packages the
 packages with dependencies on later versions of other packages the
 opportunity to have their dependencies satisfied.
 opportunity to have their dependencies satisfied.
+<p>
+
+Thus <tt/Depends/ allows package maintainers to impose an order in
+which packages should be configured.
 
 
 <descrip>
 <descrip>
 <tag/<tt/Depends//
 <tag/<tt/Depends//
@@ -736,29 +756,267 @@ fields unsatisfied, but they are able to do so by being persistent.
 
 
 **** WHEN TO USE -- POLICY STATEMENT HERE ?
 **** WHEN TO USE -- POLICY STATEMENT HERE ?
 
 
+<tag/<tt/Suggests//
 
 
+This is used to declare that one package may be more useful with one
+or more others.
+<p>
 
 
+<tt/dselect/ will offer suggsted packages to the system administrator
+when they select the suggesting package, but the default is not to
+install the suggested package.
 
 
-<tt/<tt/Suggests//
-This declares a 
+**** WHEN TO USE -- POLICY STATEMENT HERE ?
 
 
-**** WRITE THIS
+<tag/<tt/Pre-Depends//
+
+This field is like <tt/Depends/, except that it also forces <tt/dpkg/
+to complete installation of the packages named before even starting
+the installation of the package which declares the predependency.
+<p>
+
+<tt/dselect/ checks for predependencies when it is doing an
+installation run, and will attempt to find the packages which are
+required to be installed first and do so in the right order.
+<p>
+
+However, this process is slow (because it requires repeated
+invocations of <tt/dpkg/) and troublesome (because it requires
+guessing where to find the appropriate files).
+<p>
+
+For these reasons, and because this field imposes restrictions on the
+order in which packages may be unpacked (which can be difficult for
+installations from multipart media, for example), <tt/Pre-Depends/
+should be used sparingly, preferably only by packages whose premature
+upgrade or installation would hamper the ability of the system to
+continue with any upgrade that might be in progress.
+<p>
+
+When the package declaring it is being configured, a
+<tt/Pre-Dependency/ will be considered satisfied only if the depending
+package has been correctly configured, just as if an ordinary
+<tt/Depends/ had been used.
+<p>
+
+However, when a package declaring a predependency is being unpacked
+the predependency can be satisfied even if the depended-on package(s)
+are only unpacked or half-configured, provided that they have been
+configured correctly at some point in the past (and not removed or
+partially removed since).  In this case both the previously-configured
+and currently unpacked or half-configured versions must satisfy any
+version clause in the <tt/Pre-Depends/ field.
 
 
 </descrip>
 </descrip>
 
 
-<sect1>Alternative packages - <tt/Conflicts/
+<sect2>Deconfiguration due to removal during bulk installations
+<p>
+
+If <tt/dpkg/ would like to remove a package due to a conflict, as
+described above, but this would violate a dependency of some other
+package on the system, <tt/dpkg/ will usually not remove the
+conflicting package and halt with an error.
+<p>
+
+However, if the <tt/--auto-deconfigure/ (<tt/-B/) option is used
+<tt/dpkg/ will automatically `deconfigure' the package with the
+problematic dependency, so that the conflicting package can be removed
+and the package we're trying to install can be installed.  If
+<tt/dpkg/ is being asked to install packages (rather than just
+unpacking them) it will try to reconfigure the package when it has
+unpacked all its arguments, in the hope that one of the other packages
+it is installing will satisfy the problematic dependency.
+<p>
+
+<tt/dselect/ supplies this argument to <tt/dpkg/ when it invokes it,
+so that bulk installations proceed smoothly.
+
+<sect1>Alternative packages - <tt/Conflicts/ and <tt/Replaces/<label id="conflicts">
+<p>
+
+When one package declares a conflict with another <tt/dpkg/ will
+refuse to allow them to be installed on the system at the same time.
+<p>
+
+If one package is to be installed, the other must be removed first -
+if the package being installed is marked as replacing (<ref
+id="replaces">) the one on the system, or the one on the system is
+marked as deselected, or both packages are marked <tt/Essential/, then
+<tt/dpkg/ will automatically remove the package which is causing the
+conflict, otherwise it will halt the installation of the new package
+with an error.
+<p>
+
+<tt/dselect/ makes it hard to select conflicting packages, though the
+user can override this if they wish.  If they do not override it then
+<tt/dselect/ will select one of the packages for removal, and the user
+must make sure it is the right one.  In the future <tt/dselect/ will
+look for the presence of a <tt/Replaces/ field to help decide which
+package should be installed and which removed.
+<p>
+
+A package will not cause a conflict merely because its configuration
+files are still installed; it must be at least half-installed.
+<p>
+
+A special exception is made for packages which declare a conflict with
+their own package name, or with a virtual package which they provide
+(see below): this does not prevent their installation, and allows a
+package to conflict with others providing a replacement for it.
+<p>
+
+A <tt/Conflicts/ entry should almost never have an `earlier than'
+version clause.  This would prevent <tt/dpkg/ from upgrading or
+installing the package which declared such a conflict until the
+upgrade or removal of the conflicted-with package had been completed.
+This aspect of installation ordering is not handled by <tt/dselect/,
+so that the use <tt/Conflicts/ in this way is likely to cause problems
+for `bulk run' upgrades and installations.
+<p>
+
 
 
-**** WRITE THIS
 
 
-<sect1>Virtual packages - <tt/Provides/
+<sect1>Virtual packages - <tt/Provides/<label id="virtual">
+<p>
 
 
-**** WRITE THIS
+As well as the names of actual (`concrete') packages, the package
+relationship fields <tt/Depends/, <tt/Recommends/, <tt/Suggests/ and
+<tt/Conflicts/ may mention virtual packages.
+<p>
 
 
-<sect1>Overwriting files - <tt/Replaces/<label id="replaces">
+A virtual package is one which appears in the <tt/Provides/ control
+file field of another package.  The effect is as if the package(s)
+which provide a particular virtual package name had been listed by
+name everywhere were the virtual package name appears.
+<p>
 
 
-**** WRITE THIS
+If there are both a real and a virtual package of the same name then
+the dependency may be satisfied (or the conflict caused) by either the
+real package or any of the virtual packages which provide it.  This is
+so that, for example, supposing we have
+<p>
+
+If a dependency or a conflict has a version number attached then only
+real packages will be considered to see whether the relationship is
+satisfied (or prohibited, for a conflict) - it is assumed that a real
+package which provides virtual package is not of the `right' version.
+So, a <tt/Provides/ field may not contain version numbers, and the
+version number of the concrete package which provides a particular
+virtual package will not be looked at when considering a dependency on
+or conflict with the virtual package name.
+<p>
+
+If you want to specify which of a set of real packages should be the
+default to satisfy a particular dependency on a virtual package, you
+should list the real package as alternative before the virtual.
+<p>
+
+<sect1>Defaults for satisfying dependencies - ordering
+<p>
+
+Ordering is significant in dependency fields.
+<p>
+
+Usually dselect will suggest to the user that they select the package
+with the most `fundamental' class (eg, it will prefer Base packages to
+Optional ones), or the one that they `most wanted' to select in some
+sense.
+<p>
+
+However, in the absence of other information <tt/dselect/ will offer a
+default selection of the first named package in a list of
+alternatives.
+<p>
+
+However, there is no way to specify the `order' of several packages
+which all provide the same thing, when that thing is listed as a
+dependency.
+<p>
+
+Therefore a dependency on a virtual package should contain a concrete
+package name as the first alternative, so that this is the default.
+<p>
+
+For example, consider the set of packages:
+
+<example>
+Package: glibcdoc
+Recommends: info-browser
+
+Package: info
+Provides: info-browser
+
+Package: emacs
+Provides: info-browser
+</example>
+
+If <tt/emacs/ and <tt/info/ both have the same priority then
+<tt/dselect/'s choice is essentially random.  Better would be
+<example>
+Package: glibcdoc
+Recommends: info | info-browser
+</example>
+so that <tt/dselect/ defaults to selecting the lightweight standalone
+info browser.
+
+<sect1><tt/Replaces/ - overwriting files and replacing packages<label id="replaces">
+<p>
+
+The <tt/Replaces/ control file field has two purposes, which come into
+play in different situations.
+<p>
+
+Virtual packages (<ref id="virtual">) are not considered when looking
+at a <tt/Replaces/ field - the packages declared as being replaced
+must be mentioned by their real names.
+
+<sect2>Overwriting files in other packages
+<p>
+
+Firstly, as mentioned before, it is usually an error for a package to
+contains files which are on the system in another package, though
+currently the <tt/--force-overwrite/ flag is enabled by default,
+downgrading the error to a warning,
+<p>
+
+If the overwriting package declares that it replaces the one
+containing the file being overwritten then <tt/dpkg/ will proceed, and
+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.
+<p>
+
+If a package is completely replaced in this way, so that <tt/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 conffiles details noted in the
+package will be ignored, as they will have been taken over by the
+replacing package(s).  The package's <tt/postrm/ script will be run to
+allow the package to do any final cleanup required.
+See <ref id="maintscripts-instact">.
+<p>
+
+In the future <tt/dpkg/ will discard files which overwrite those from
+another package which declares that it replaces the one being
+installed (so that you can install an older version of a package
+without problems).
+<p>
+
+This usage of <tt/Replaces/ only takes effect when both packages are
+at least partially on the system at once, so that it can only happen
+if they do not conflict or if the conflict has been overridden.
+
+<sect2>Replacing whole packages, forcing their removal
+<p>
+
+Secondly, <tt/Replaces/ allows <tt/dpkg/ and <tt/dselect/ to resolve
+which package should be removed when a conflict - see
+<ref id="conflicts">.  This usage only takes effect when the two
+packages <em/do/ conflict, so that the two effects do not interfere
+with each other.
+<p>
 
 
 <sect>Order of processing steps and maintainer script arguments<label id="maintscripts-instact">
 <sect>Order of processing steps and maintainer script arguments<label id="maintscripts-instact">
+<p>
 
 
 <sect1>Summary of ways maintainer scripts are called
 <sect1>Summary of ways maintainer scripts are called
 <p>
 <p>
@@ -819,20 +1077,20 @@ the `error unwind' calls listed below.
 <item>
 <item>
 If a version the package is already
 If a version the package is already
 installed, call
 installed, call
-<tscreen><verb>
+<example>
 <var/old-prerm/ <tt/upgrade/ <var/new-version/
 <var/old-prerm/ <tt/upgrade/ <var/new-version/
-</verb></tscreen>
+</example>
 
 
 <item>
 <item>
 If this gives an error (ie, a non-zero exit status), dpkg will
 If this gives an error (ie, a non-zero exit status), dpkg will
 attempt instead:
 attempt instead:
-<tscreen><verb>
+<example>
 <var/new-prerm/ <tt/failed-upgrade/ <var/old-version/
 <var/new-prerm/ <tt/failed-upgrade/ <var/old-version/
-</verb></tscreen>
+</example>
 Error unwind, for both the above cases:
 Error unwind, for both the above cases:
-<tscreen><verb>
+<example>
 <var/old-postinst/ <tt/abort-upgrade/ <var/new-version/
 <var/old-postinst/ <tt/abort-upgrade/ <var/new-version/
-</verb></tscreen>
+</example>
 
 
 </enum>
 </enum>
 
 
@@ -843,32 +1101,32 @@ If a `conflicting' package is being removed at the same time:
 <item>
 <item>
 If any packages depended on that conflicting package and
 If any packages depended on that conflicting package and
 <tt/--auto-deconfigure/ is specified, call, for each such package:
 <tt/--auto-deconfigure/ is specified, call, for each such package:
-<tscreen><verb>
+<example>
 <var/deconfigured's-prerm/ <tt/deconfigure/
 <var/deconfigured's-prerm/ <tt/deconfigure/
  <tt/in-favour/ <var/package-being-installed/ <var/version/
  <tt/in-favour/ <var/package-being-installed/ <var/version/
  <tt/removing/ <var/conflicting-package/ <var/version/
  <tt/removing/ <var/conflicting-package/ <var/version/
-</verb></tscreen>
+</example>
 Error unwind:
 Error unwind:
-<tscreen><verb>
+<example>
 <var/deconfigured's-postinst/ <tt/abort-deconfigure/
 <var/deconfigured's-postinst/ <tt/abort-deconfigure/
  <tt/in-favour/ <var/package-being-installed-but-failed/ <var/version/
  <tt/in-favour/ <var/package-being-installed-but-failed/ <var/version/
  <tt/removing/ <var/conflicting-package/ <var/version/
  <tt/removing/ <var/conflicting-package/ <var/version/
-</verb></tscreen>
+</example>
 The deconfigured packages are marked as requiring configuration, so
 The deconfigured packages are marked as requiring configuration, so
 that if <tt/--install/ is used they will be configured again if
 that if <tt/--install/ is used they will be configured again if
 possible.
 possible.
 
 
 <item>
 <item>
 To prepare for removal of the conflicting package, call:
 To prepare for removal of the conflicting package, call:
-<tscreen><verb>
+<example>
 <var/conflictor's-prerm/ <tt/remove/
 <var/conflictor's-prerm/ <tt/remove/
  <tt/in-favour/ <var/package/ <var/new-version/
  <tt/in-favour/ <var/package/ <var/new-version/
-</verb></tscreen>
+</example>
 Error unwind:
 Error unwind:
-<tscreen><verb>
+<example>
 <var/conflictor's-postinst/ <tt/abort-remove/
 <var/conflictor's-postinst/ <tt/abort-remove/
  <tt/in-favour/ <var/package/ <var/new-version/
  <tt/in-favour/ <var/package/ <var/new-version/
-</verb></tscreen>
+</example>
 
 
 </enum>
 </enum>
 
 
@@ -876,28 +1134,28 @@ Error unwind:
 <enum>
 <enum>
 <item>
 <item>
 If the package is being upgraded, call:
 If the package is being upgraded, call:
-<tscreen><verb>
+<example>
 <var/new-preinst/ <tt/upgrade/ <var/old-version/
 <var/new-preinst/ <tt/upgrade/ <var/old-version/
-</verb></tscreen>
+</example>
 
 
 <item>
 <item>
 Otherwise, if the package had some configuration files from a previous
 Otherwise, if the package had some configuration files from a previous
 version installed (ie, it is in the `configuration files only' state):
 version installed (ie, it is in the `configuration files only' state):
-<tscreen><verb>
+<example>
 <var/new-preinst/ <tt/install/ <var/old-version/
 <var/new-preinst/ <tt/install/ <var/old-version/
-</verb></tscreen>
+</example>
 
 
 <item>
 <item>
 Otherwise (ie, the package was completely purged):
 Otherwise (ie, the package was completely purged):
-<tscreen><verb>
+<example>
 <var/new-preinst/ <tt/install/
 <var/new-preinst/ <tt/install/
-</verb></tscreen>
+</example>
 Error unwind versions, respectively:
 Error unwind versions, respectively:
-<tscreen><verb>
+<example>
 <var/new-postrm/ <tt/abort-upgrade/ <var/old-version/
 <var/new-postrm/ <tt/abort-upgrade/ <var/old-version/
 <var/new-postrm/ <tt/abort-install/ <var/old-version/
 <var/new-postrm/ <tt/abort-install/ <var/old-version/
 <var/new-postrm/ <tt/abort-install/
 <var/new-postrm/ <tt/abort-install/
-</verb></tscreen>
+</example>
 
 
 </enum>
 </enum>
 
 
@@ -927,19 +1185,19 @@ and then it is removed again).
 <enum>
 <enum>
 <item>
 <item>
 If the package is being upgraded, call
 If the package is being upgraded, call
-<tscreen><verb>
+<example>
 <var/old-postrm/ <tt/upgrade/ <var/new-version/
 <var/old-postrm/ <tt/upgrade/ <var/new-version/
-</verb></tscreen>
+</example>
 
 
 <item>
 <item>
 If this fails, <tt/dpkg/ will attempt:
 If this fails, <tt/dpkg/ will attempt:
-<tscreen><verb>
+<example>
 <var/new-postrm/ <tt/failed-upgrade/ <var/old-version/
 <var/new-postrm/ <tt/failed-upgrade/ <var/old-version/
-</verb></tscreen>
+</example>
 Error unwind, for both cases:
 Error unwind, for both cases:
-<tscreen><verb>
+<example>
 <var/old-preinst/ <tt/abort-upgrade/ <var/new-version/
 <var/old-preinst/ <tt/abort-upgrade/ <var/new-version/
-</verb></tscreen>
+</example>
 
 
 </enum>
 </enum>
 
 
@@ -967,18 +1225,19 @@ to have been removed.  For each such package,
 <enum>
 <enum>
 <item>
 <item>
 <tt/dpkg/ calls:
 <tt/dpkg/ calls:
-<tscreen><verb>
+<example>
 <var/disappearer's-postrm/ <tt/disappear/ <var/overwriter/ <var/overwriter-version/
 <var/disappearer's-postrm/ <tt/disappear/ <var/overwriter/ <var/overwriter-version/
-</verb></tscreen>
+</example>
 
 
 <item>
 <item>
 The package's maintainer scripts are removed.
 The package's maintainer scripts are removed.
 
 
 <item>
 <item>
 It is noted in the status database as being in a sane state, namely
 It is noted in the status database as being in a sane state, namely
-not installed (any conffiles it may have are ignored).  Note that
-disappearing packages do not have their prerm called, because
-<tt/dpkg/ doesn't know in advance that the package is going to vanish.
+not installed (any conffiles it may have are ignored, rather than
+being removed by <tt/dpkg/).  Note that disappearing packages do not
+have their prerm called, because <tt/dpkg/ doesn't know in advance
+that the package is going to vanish.
 
 
 </enum>
 </enum>
 
 
@@ -1010,9 +1269,9 @@ and so do not get removed now).
 
 
 When we configure a package (this happens with <tt/dpkg --install/, or
 When we configure a package (this happens with <tt/dpkg --install/, or
 with <tt/--configure/), we first update the conffiles and then call:
 with <tt/--configure/), we first update the conffiles and then call:
-<tscreen><verb>
+<example>
 <var/postinst/ <tt/configure/ <var/most-recently-configured-version/
 <var/postinst/ <tt/configure/ <var/most-recently-configured-version/
-</verb></tscreen>
+</example>
 <p>
 <p>
 
 
 No attempt is made to unwind after errors during configuration.
 No attempt is made to unwind after errors during configuration.
@@ -1029,17 +1288,17 @@ circumstances.
 
 
 <enum>
 <enum>
 <item>
 <item>
-<tscreen><verb>
+<example>
 <var/prerm/ <tt/remove/
 <var/prerm/ <tt/remove/
-</verb></tscreen>
+</example>
 
 
 <item>
 <item>
 The package's files are removed (except conffiles).
 The package's files are removed (except conffiles).
 
 
 <item>
 <item>
-<tscreen><verb>
+<example>
 <var/postrm/ <tt/remove/
 <var/postrm/ <tt/remove/
-</verb></tscreen>
+</example>
 
 
 <item>
 <item>
 All the maintainer scripts except the postrm are removed.
 All the maintainer scripts except the postrm are removed.
@@ -1054,9 +1313,9 @@ The conffiles and any backup files (<tt/~/-files, <tt/#*#/ files,
 <tt/%/-files, <tt/.dpkg-{old,new,tmp}/, etc.) are removed.
 <tt/%/-files, <tt/.dpkg-{old,new,tmp}/, etc.) are removed.
 
 
 <item>
 <item>
-<tscreen><verb>
+<example>
 <var/postrm/ <tt/purge/
 <var/postrm/ <tt/purge/
-</verb></tscreen>
+</example>
 
 
 <item>
 <item>
 The package's file list is removed.
 The package's file list is removed.
@@ -1066,14 +1325,117 @@ The package's file list is removed.
 No attempt is made to unwind after errors during removal.
 No attempt is made to unwind after errors during removal.
 
 
 
 
+<sect>Configuration file handling<label id="conffiles">
+
+<tt/dpkg/ can do a certain amount of automatic handling of package
+configuration files.
+<p>
+
+Whether this mechanism is appropriate depends on a number of factors,
+but basically there are two approaches to any particular configuration
+file.
+<p>
+
+The easy method is to ship a best-effort configuration in the package,
+and use <tt/dpkg/'s conffile mechanism to handle updates.  If the user
+is unlikely to want to edit the file, but you need them to be able to
+without losing their changes, and a new package with a changed version
+of the file is only released infrequently, this is a good approach.
+<p>
+
+The hard method is to build the configuration file from scratch in the
+<tt/postinst/ script, and to take the responsibility for fixing any
+mistakes made in earlier versions of the package automatically.  This
+will be appropriate if the file is likely to need to be different on
+each system.
+
+<sect1>Automatic handling of configuration files by <tt/dpkg/
+<p>
+
+A package may contain a control area file called <tt/conffiles/.  This
+file should be a list of filenames of configuration files needing
+automatic handling, separated by newlines.  The filenames should be
+absolute pathnames, and the files referred to should actually exist in
+the package.
+<p>
+
+When a package is upgraded, during the configuration state shortly
+before <tt/dpkg/ runs the package's <tt/postinst/ script, it will
+process the configuration files.
+<p>
+
+For each file it checks to see whether the version of the file
+included in the package is the same as the one that was included in
+the last version of the package (the one that is being upgraded
+from); it also compares the version currently installed on the system
+with the one shipped with the last version.
+<p>
+
+If neither the user nor the package maintainer has changed the file,
+it is left alone.  If one or the other has changed their version, then
+the changed version is preferred - ie, if the user edits their file,
+but the package maintainer doesn't ship a different version, the
+user's changes will stay, silently, but if the maintainer ships a new
+version and the user hasn't edited it the new version will be
+installed (with an informative message).  If both have changed their
+version the user is prompted about the problem and must resolve the
+differences themselves.
+<p>
+
+The comparisons are done by calculating the MD5 message digests of the
+files, and storing the MD5 of the file as it was included in the most
+recent version of the package.
+<p>
+
+When a package is installed for the first time <tt/dpkg/ will install
+the file that comes with it, unless that would mean overwriting a file
+already on the filesystem.
+<p>
+
+However, note that <tt/dpkg/ will <em/not/ replace a conffile file
+that was removed by the user (or by a script).  This is necessary
+because for some programs' configuration files a missing file produces
+an effect hard or impossible to achieve in another way, so that a
+missing file needs to be kept that way if the user did it.
+<p>
+
+Note that a package should <em/not/ modify a <tt/dpkg/-handled
+conffile in its maintainer scripts.  Doing this will lead to <tt/dpkg/
+asking the user confusing and possibly dangerous questions when the
+package is upgraded.
+
+<sect2>Fully-featured maintainer script configuration handling
+<p>
+
+For files which contain site-specific information such as thep
+hostname and networking details and so forth, it is better to create
+the file in the package's <tt/postinst/ script.
+<p>
+
+This will typically involve examining the state of the rest of the
+system to determine values and other information, and may involve
+prompting the user for some information which can't be obtained some
+other way.
+<p>
+
+When using this method there are a number of important issues which
+should be considered:
+<p>
+
+The package's <tt/postinst/ should be written so that 
+
+
 <sect>Dangling references
 <sect>Dangling references
+<p>
 
 
 <sect1>Would dangle to conffiles<label id="conffiles">
 <sect1>Would dangle to conffiles<label id="conffiles">
+<p>
 
 
 There would be a dangling xref here.  Instead I've just put this dummy
 There would be a dangling xref here.  Instead I've just put this dummy
 text in.
 text in.
 
 
 <sect1>Would dangle to descriptions<label id="descriptions">
 <sect1>Would dangle to descriptions<label id="descriptions">
+<p>
 
 
 There would be a dangling xref here.  Instead I've just put this dummy
 There would be a dangling xref here.  Instead I've just put this dummy
 text in.
 text in.

+ 2 - 2
dpkg-deb/build.c

@@ -94,9 +94,9 @@ void do_build(const char *const *argv) {
             &checkedinfo, stderr, &warns);
             &checkedinfo, stderr, &warns);
     assert(checkedinfo->available.valid);
     assert(checkedinfo->available.valid);
     if (strspn(checkedinfo->name,
     if (strspn(checkedinfo->name,
-               "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-.")
+               "abcdefghijklmnopqrstuvwxyz0123456789+-.")
         != strlen(checkedinfo->name))
         != strlen(checkedinfo->name))
-      ohshit("package name has characters that aren't alphanums or `-+.'");
+      ohshit("package name has characters that aren't lowercase alphanums or `-+.'");
     if (checkedinfo->priority == pri_other) {
     if (checkedinfo->priority == pri_other) {
       fprintf(stderr, "warning, `%s' contains user-defined Priority value `%s'\n",
       fprintf(stderr, "warning, `%s' contains user-defined Priority value `%s'\n",
               controlfile, checkedinfo->otherpriority);
               controlfile, checkedinfo->otherpriority);

+ 1 - 1
main/enquiry.c

@@ -439,7 +439,7 @@ void enqperpackage(const char *const *argv) {
             if (namenode->divert && !namenode->divert->camefrom) {
             if (namenode->divert && !namenode->divert->camefrom) {
               if (!namenode->divert->pkg) printf("locally diverted");
               if (!namenode->divert->pkg) printf("locally diverted");
               else if (pkg == namenode->divert->pkg) printf("package diverts others");
               else if (pkg == namenode->divert->pkg) printf("package diverts others");
-              else printf("diverted by %s",pkg->name);
+              else printf("diverted by %s",namenode->divert->pkg->name);
               printf(" to: %s\n",namenode->divert->useinstead->name);
               printf(" to: %s\n",namenode->divert->useinstead->name);
             }
             }
             file= file->next;
             file= file->next;

+ 3 - 2
scripts/Makefile.in

@@ -1,5 +1,5 @@
 # Copyright (C) 1994 Ian Murdock <imurdock@debian.org>
 # Copyright (C) 1994 Ian Murdock <imurdock@debian.org>
-# Copyright (C) 1994,1995 Ian Jackson <ijackson@nyx.cs.du.edu>
+# Copyright (C) 1994,1995,1996 Ian Jackson <ijackson@nyx.cs.du.edu>
 #
 #
 #   This is free software; you can redistribute it and/or modify
 #   This is free software; you can redistribute it and/or modify
 #   it under the terms of the GNU General Public License as
 #   it under the terms of the GNU General Public License as
@@ -36,7 +36,8 @@ perlpath = @perlpath@
 
 
 MAN1 =  dpkg-name
 MAN1 =  dpkg-name
 EXC =   dpkg-name
 EXC =   dpkg-name
-MAN8 =	update-rc.d start-stop-daemon update-alternatives install-info
+MAN8 =	update-rc.d start-stop-daemon update-alternatives install-info \
+	dpkg-scanpackages
 SBIN =	update-rc.d start-stop-daemon update-alternatives install-info \
 SBIN =	update-rc.d start-stop-daemon update-alternatives install-info \
 	dpkg-scanpackages dpkg-divert cleanup-info
 	dpkg-scanpackages dpkg-divert cleanup-info
 
 

+ 1 - 1
scripts/dpkg-name.sh

@@ -69,7 +69,7 @@ getname () {
 
 
 		a=`dpkg-deb -f -- "$1" architecture`;
 		a=`dpkg-deb -f -- "$1" architecture`;
 		a=`echo $a|sed -e 's/ *//g'`;
 		a=`echo $a|sed -e 's/ *//g'`;
-		if [ -z "$a" ]; # architecture field empty
+		if [ -z "$a" -a -n "$noarchitecture" ]; # arch field empty, or ignored
 		then
 		then
 			a=`dpkg --print-architecture`;
 			a=`dpkg --print-architecture`;
 			stderr "assuming architecture \`"$a"' for \`"$1"'";
 			stderr "assuming architecture \`"$a"' for \`"$1"'";

+ 107 - 0
scripts/dpkg-scanpackages.8

@@ -0,0 +1,107 @@
+.\" This manpage is copyright (C) 1996 Michael Shields <shields@crosslink.net>.
+.\" 
+.\" This is free software; you may redistribute it and/or modify
+.\" it under the terms of the GNU General Public License as
+.\" published by the Free Software Foundation; either version 2,
+.\" or (at your option) any later version.
+.\"
+.\" This is distributed in the hope that it will be useful, but
+.\" WITHOUT ANY WARRANTY; without even the implied warranty of
+.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+.\" GNU General Public License for more details.
+.\"
+.\" You should have received a copy of the GNU General Public
+.\" License along with dpkg; if not, write to the Free Software
+.\" Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+.TH DPKG-SCANPACKAGES 8 "1996-07-08" "Debian Linux"
+.SH NAME
+dpkg-scanpackages \- create Packages files
+.
+.SH SYNOPSIS
+.B dpkg-scanpackages
+.I binarydir
+.I overridefile
+.RI [ pathprefix ]
+.B >
+.I Packages
+.
+.SH DESCRIPTION
+.B dpkg-scanpackages
+sorts through a tree of Debian binary packages and creates a Packages
+file, used by
+.BR dselect (8)
+to tell the user what packages are available for installation.  These
+Packages files are the same as those found on Debian archive sites
+and CD-ROMs.  You might use
+.B dpkg-scanpackages
+yourself if making a directory of local packages to install on a cluster
+of machines.
+.PP
+.I binarydir
+is the name of the binary tree to process (for example,
+.BR contrib/binary-i386 ).
+It is best to make this relative to the root of the Debian archive,
+because every Filename field in the new Packages file will start with
+this string.
+.PP
+.I overridefile
+is the name of a file to read which contains information about how the
+package fits into the distribution; see below.
+.PP
+.I pathprefix
+is an optional string to be prepended to the Filename fields.
+.
+.SH THE OVERRIDE FILE
+While most information about a package can be found in the control file,
+some must be filled in by the distribution czars rather than by the
+maintainer, because they relate to the arrangement of files for release
+rather than the actual dependencies and description of the package.
+This information is found in the override file.
+.PP
+The override file has a simple whitespace-delimited format.  Comments are
+allowed (denoted with a
+.BR # ).
+.PP
+.in +5
+.I package
+.I priority
+.I section
+.RI [ maintainerinfo ]
+.in -5
+.PP
+.I package
+is the name of the package.  Entries in the override file for packages
+not found in the binary tree are ignored.
+.PP
+.I priority
+and
+.I section
+place the package within the release tree; these ought not to be found
+in the control file.  If the package is found in a subdirectory of
+.IR binarydir ,
+that will be checked against
+.IR section .
+.PP
+.IR maintainerinfo ,
+if present, can be either the name of a maintainer for an unconditional
+override, or else
+.I oldmaintainer
+.B =>
+.I newmaintainer
+to perform a substitution.
+.PP
+The override files used to make the official Packages lists may be found
+in the
+.I indices
+directory on any Debian mirror.
+.
+.SH DIAGNOSTICS
+.B dpkg-scanpackages
+outputs the usual self-explanatory errors.  It also warns about packages
+that are in the wrong subdirectory, are duplicated, have a Filename
+field in their control file, are missing from the override file, or have
+maintainer substitutions which do not take effect.
+.
+.SH SEE ALSO
+.BR dpkg (8),
+.BR dselect (8).

+ 97 - 87
scripts/dpkg-scanpackages.pl

@@ -1,106 +1,106 @@
-#!/usr/bin/perl --
-# usage:
-#  dpkg-scanpackages .../binary .../noverride pathprefix >.../Packages.new
-#  mv .../Packages.new .../Packages
-#
-# This is the core script that generates Packages files (as found
-# on the Debian FTP site and CD-ROMs).
-#
-# The first argument should preferably be a relative filename, so that
-# the Filename field has good information.
-#
-# Any desired string can be prepended to each Filename value by
-# passing it as the third argument.
-#
-# The noverride file is a series of lines of the form
-# <package> <priority> <section> <maintainer>
-# where the <maintainer> field is optional.  Fields are separated by
-# whitespace.  The <maintainer> field may be <old-maintainer> => <new-maintainer>
-# (this is recommended).
-
-$version= '1.0.12'; # This line modified by Makefile
+#!/usr/bin/perl
+
+$version= '1.2.6'; # This line modified by Makefile
 
 
 %kmap= ('optional','suggests',
 %kmap= ('optional','suggests',
         'recommended','recommends',
         'recommended','recommends',
         'class','priority',
         'class','priority',
         'package_revision','revision');
         'package_revision','revision');
 
 
-%pri= ('priority',300,
-       'section',290,
-       'maintainer',280,
-       'version',270,
-       'depends',250,
-       'recommends',240,
-       'suggests',230,
-       'conflicts',220,
-       'provides',210,
-       'filename',200,
-       'size',180,
-       'md5sum',170,
-       'description',160);
-
-@ARGV==3 || die;
-
-$binarydir= shift(@ARGV);
--d $binarydir || die $!;
-
-$override= shift(@ARGV);
--e $override || die $!;
-
-$pathprefix= shift(@ARGV);
-
-open(F,"find $binarydir -name '*.deb' -print |") || die $!;
+@fieldpri= ('Package',
+            'Version',
+            'Priority',
+            'Section',
+            'Essential',
+            'Maintainer',
+            'Pre-Depends',
+            'Depends',
+            'Recommends',
+            'Suggests',
+            'Conflicts',
+            'Provides',
+            'Replaces',
+            'Architecture',
+            'Filename',
+            'Size',
+            'MD5sum',
+            'Description');
+
+$i=100; grep($pri{$_}=$i--,@fieldpri);
+
+$#ARGV == 1 || $#ARGV == 2
+    or die "Usage: dpkg-scanpackages binarypath overridefile pathprefix > Packages\n";
+($binarydir, $override, $pathprefix) = @ARGV;
+-d $binarydir or die "Binary dir $binarydir not found\n";
+-e $override or die "Override file $override not found\n";
+
+# The extra slash causes symlinks to be followed.
+open(F,"find $binarydir/ -follow -name '*.deb' -print |")
+    or die "Couldn't open pipe to find: $!\n";
 while (<F>) {
 while (<F>) {
     chop($fn=$_);
     chop($fn=$_);
-    substr($fn,0,length($binarydir)) eq $binarydir || die $fn;
-    open(C,"dpkg-deb -I $fn control |") || die "$fn $!";
-    $t=''; while (<C>) { $t.=$_; }
-    $!=0; close(C); $? && die "$fn $? $!";
+    substr($fn,0,length($binarydir)) eq $binarydir
+	or die "$fn not in binary dir $binarydir\n";
+    $t= `dpkg-deb -I $fn control`
+	or die "Couldn't call dpkg-deb on $fn: $!\n";
+    $? and die "\`dpkg-deb -I $fn control' exited with $?\n";
     undef %tv;
     undef %tv;
     $o= $t;
     $o= $t;
     while ($t =~ s/^\n*(\S+):[ \t]*(.*(\n[ \t].*)*)\n//) {
     while ($t =~ s/^\n*(\S+):[ \t]*(.*(\n[ \t].*)*)\n//) {
-        $k= $1; $v= $2;
-        $k =~ y/A-Z/a-z/;
+        $k= lc $1; $v= $2;
         if (defined($kmap{$k})) { $k= $kmap{$k}; }
         if (defined($kmap{$k})) { $k= $kmap{$k}; }
+        if (@kn= grep($k eq lc $_, @fieldpri)) {
+            @kn==1 || die $k;
+            $k= $kn[0];
+        }
         $v =~ s/\s+$//;
         $v =~ s/\s+$//;
         $tv{$k}= $v;
         $tv{$k}= $v;
-#print STDERR "K>$k V>$v<\n";
     }
     }
-    $t =~ m/^\n*$/ || die "$fn $o / $t ?";
-    defined($tv{'package'}) || die "$fn $o ?";
-    $p= $tv{'package'}; delete $tv{'package'};
+    $t =~ /^\n*$/
+	or die "Unprocessed text from $fn control file; info:\n$o / $t\n";
+
+    defined($tv{'Package'})
+	or die "No Package field in control file of $fn\n";
+    $p= $tv{'Package'}; delete $tv{'Package'};
+
     if (defined($p1{$p})) {
     if (defined($p1{$p})) {
         print(STDERR " ! Package $p (filename $fn) is repeat;\n".
         print(STDERR " ! Package $p (filename $fn) is repeat;\n".
-                     "   ignored that one and using data from $pfilename{$p}) !\n")
+                     "   ignored that one and using data from $pfilename{$p} !\n")
             || die $!;
             || die $!;
         next;
         next;
     }
     }
-    if (defined($tv{'filename'})) {
-        print(STDERR " ! Package $p (filename $fn) has Filename field !\n") || die $!;
-    }
-    $tv{'filename'}= "$pathprefix$fn";
+    print(STDERR " ! Package $p (filename $fn) has Filename field!\n") || die $!
+        if defined($tv{'Filename'});
+    
+    $tv{'Filename'}= "$pathprefix$fn";
+
     open(C,"md5sum <$fn |") || die "$fn $!";
     open(C,"md5sum <$fn |") || die "$fn $!";
-    chop($_=<C>); m/^[0-9a-f]{32}$/ || die "$fn \`$_' $!";
-    $!=0; close(C); $? && die "$fn $? $!";
-    $tv{'md5sum'}= $_;
-    defined(@stat= stat($fn)) || die "$fn $!";
-    $stat[7] || die "$fn $stat[7]";
-    $tv{'size'}= $stat[7];
-    if (length($tv{'revision'})) {
-        $tv{'version'}.= '-'.$tv{'revision'};
-        delete $tv{'revision'};
+    chop($_=<C>); close(C); $? and die "\`md5sum < $fn' exited with $?\n";
+    /^[0-9a-f]{32}$/ or die "Strange text from \`md5sum < $fn': \`$_'\n";
+    $tv{'MD5sum'}= $_;
+
+    @stat= stat($fn) or die "Couldn't stat $fn: $!\n";
+    $stat[7] or die "$fn is empty\n";
+    $tv{'Size'}= $stat[7];
+
+    if (length($tv{'Revision'})) {
+        $tv{'Version'}.= '-'.$tv{'Revision'};
+        delete $tv{'Revision'};
     }
     }
+
     for $k (keys %tv) {
     for $k (keys %tv) {
         $pv{$p,$k}= $tv{$k};
         $pv{$p,$k}= $tv{$k};
         $k1{$k}= 1;
         $k1{$k}= 1;
         $p1{$p}= 1;
         $p1{$p}= 1;
     }
     }
+
     $_= substr($fn,length($binarydir));
     $_= substr($fn,length($binarydir));
     s#/[^/]+$##; s#^/*##;
     s#/[^/]+$##; s#^/*##;
     $psubdir{$p}= $_;
     $psubdir{$p}= $_;
     $pfilename{$p}= $fn;
     $pfilename{$p}= $fn;
 }
 }
-$!=0; close(F); $? && die "$? $!";
+close(F);
+$? and die "find exited with $?\n";
 
 
 select(STDERR); $= = 1000; select(STDOUT);
 select(STDERR); $= = 1000; select(STDOUT);
 
 
@@ -120,29 +120,31 @@ sub writelist {
 
 
 @samemaint=();
 @samemaint=();
 
 
-open(O,"<$override") || die $!;
-while(<O>) {
+open(O, $override)
+    or die "Couldn't open override file $override: $!\n";
+while (<O>) {
+    s/\#.*//;
     s/\s+$//;
     s/\s+$//;
     ($p,$priority,$section,$maintainer)= split(/\s+/,$_,4);
     ($p,$priority,$section,$maintainer)= split(/\s+/,$_,4);
     next unless defined($p1{$p});
     next unless defined($p1{$p});
     if (length($maintainer)) {
     if (length($maintainer)) {
         if ($maintainer =~ m/\s*=\>\s*/) {
         if ($maintainer =~ m/\s*=\>\s*/) {
-            $oldmaint= $`; $newmaint= $'; $debmaint= $pv{$p,'maintainer'};
+            $oldmaint= $`; $newmaint= $'; $debmaint= $pv{$p,'Maintainer'};
             if (!grep($debmaint eq $_, split(m:\s*//\s*:, $oldmaint))) {
             if (!grep($debmaint eq $_, split(m:\s*//\s*:, $oldmaint))) {
                 push(@changedmaint,
                 push(@changedmaint,
-                     "  $p (package says $pv{$p,'maintainer'}, not $oldmaint)\n");
+                     "  $p (package says $pv{$p,'Maintainer'}, not $oldmaint)\n");
             } else {
             } else {
-                $pv{$p,'maintainer'}= $newmaint;
+                $pv{$p,'Maintainer'}= $newmaint;
             }
             }
-        } elsif ($pv{$p,'maintainer'} eq $maintainer) {
+        } elsif ($pv{$p,'Maintainer'} eq $maintainer) {
             push(@samemaint,"  $p ($maintainer)\n");
             push(@samemaint,"  $p ($maintainer)\n");
         } else {
         } else {
             print(STDERR " * Unconditional maintainer override for $p *\n") || die $!;
             print(STDERR " * Unconditional maintainer override for $p *\n") || die $!;
-            $pv{$p,'maintainer'}= $maintainer;
+            $pv{$p,'Maintainer'}= $maintainer;
         }
         }
     }
     }
-    $pv{$p,'priority'}= $priority;
-    $pv{$p,'section'}= $section;
+    $pv{$p,'Priority'}= $priority;
+    $pv{$p,'Section'}= $section;
     if (length($psubdir{$p}) && $section ne $psubdir{$p}) {
     if (length($psubdir{$p}) && $section ne $psubdir{$p}) {
         print(STDERR " !! Package $p has \`Section: $section',".
         print(STDERR " !! Package $p has \`Section: $section',".
                      " but file is in \`$psubdir{$p}' !!\n") || die $!;
                      " but file is in \`$psubdir{$p}' !!\n") || die $!;
@@ -151,12 +153,11 @@ while(<O>) {
     $o1{$p}= 1;
     $o1{$p}= 1;
 }
 }
 close(O);
 close(O);
+print(STDERR "\n") || die $! if $ouches;
 
 
-if ($ouches) { print(STDERR "\n") || die $!; }
-
-$k1{'maintainer'}= 1;
-$k1{'priority'}= 1;
-$k1{'section'}= 1;
+$k1{'Maintainer'}= 1;
+$k1{'Priority'}= 1;
+$k1{'Section'}= 1;
 
 
 @missingover=();
 @missingover=();
 
 
@@ -171,9 +172,12 @@ for $p (sort keys %p1) {
     }
     }
     $r.= "\n";
     $r.= "\n";
     $written++;
     $written++;
-    print(STDOUT $r) || die $!;
+    $p1{$p}= 1;
+    print(STDOUT $r) or die "Failed when writing stdout: $!\n";
 }
 }
-close(STDOUT) || die $!;
+close(STDOUT) or die "Couldn't close stdout: $!\n";
+
+@spuriousover= grep(!defined($p1{$_}),sort keys %o1);
 
 
 &writelist("** Packages in archive but missing from override file: **",
 &writelist("** Packages in archive but missing from override file: **",
            @missingover);
            @missingover);
@@ -189,5 +193,11 @@ if (@samemaint) {
           @samemaint,
           @samemaint,
           "\n") || die $!;
           "\n") || die $!;
 }
 }
+if (@spuriousover) {
+    print(STDERR
+          " -- Packages in override file but not in archive: --\n",
+          @spuriousover,
+          "\n") || die $!;
+}
 
 
 print(STDERR " Wrote $written entries to output Packages file.\n") || die $!;
 print(STDERR " Wrote $written entries to output Packages file.\n") || die $!;

+ 1 - 1
version.h

@@ -1 +1 @@
-#define DPKG_VERSION "1.2.11" /* This line modified by Makefile */
+#define DPKG_VERSION "1.2.13" /* This line modified by Makefile */