Просмотр исходного кода

dpkg (1.2.4); priority=MEDIUM

  * New dpkg-name from Erick (<pkg>_<version>_<arch>.deb convention).
  * Disappeared packages can't own conffiles any more !  (Bug#3214.)
  * install-info creates Miscellaneous sections with a newline
    following the heading.  (Bug#3218.)
  * cleanup-info script installed in /usr/sbin; called as appropriate
    by postinst.  Thanks to Kim-Minh Kaplan.  (Bug#3125.)
  * Allow superseded Essential packages to be purged after they've
    been removed (clear the Essential flag on removal, and ignore it
    on packages that are in stat_configfiles).

  * dselect disk methods understand `y' as well as `yes' for using
    development tree.
  * dselect doesn't make packages appear as `new' again if update
    of available packages fails.
  * dselect places method selection cursor over option last selected.

  * dpkg-scanpackages doesn't die when repeated packages are found.
  * dpkg-scanpackages allows many old maintainers (`//'-separated).

  * `Version' field is now mandatory (some operations already
    wouldn't work right anyway if it was't there).

  * update-rc.d(8) now says you must remove the script.  (Bug#3215.)
  * dpkg --force-help says that --force-overwrite is on by default.
  * dpkg-deb manpage rewritten.
  * debian.README (= /usr/doc/copyright/dpkg) edited slightly.

  * Some database parsing grunge removed (pdb_preferversion, &c).
  * Source tree doc/sgml contains some embryonic manuals.
  * Leftover files in lib directory in source tree deleted.

 -- Ian Jackson <ian@chiark.chu.cam.ac.uk>  Mon, 10 Jun 1996 03:52:01 +0100
Ian Jackson лет назад: 30
Родитель
Сommit
f48836f858

+ 35 - 0
debian.Changelog

@@ -1,3 +1,38 @@
+dpkg (1.2.4); priority=MEDIUM
+
+  * New dpkg-name from Erick (<pkg>_<version>_<arch>.deb convention).
+  * Disappeared packages can't own conffiles any more !  (Bug#3214.)
+  * install-info creates Miscellaneous sections with a newline
+    following the heading.  (Bug#3218.)
+  * cleanup-info script installed in /usr/sbin; called as appropriate
+    by postinst.  Thanks to Kim-Minh Kaplan.  (Bug#3125.)
+  * Allow superseded Essential packages to be purged after they've
+    been removed (clear the Essential flag on removal, and ignore it
+    on packages that are in stat_configfiles).
+
+  * dselect disk methods understand `y' as well as `yes' for using
+    development tree.
+  * dselect doesn't make packages appear as `new' again if update
+    of available packages fails.
+  * dselect places method selection cursor over option last selected.
+
+  * dpkg-scanpackages doesn't die when repeated packages are found.
+  * dpkg-scanpackages allows many old maintainers (`//'-separated).
+
+  * `Version' field is now mandatory (some operations already
+    wouldn't work right anyway if it was't there).
+
+  * update-rc.d(8) now says you must remove the script.  (Bug#3215.)
+  * dpkg --force-help says that --force-overwrite is on by default.
+  * dpkg-deb manpage rewritten.
+  * debian.README (= /usr/doc/copyright/dpkg) edited slightly.
+
+  * Some database parsing grunge removed (pdb_preferversion, &c).
+  * Source tree doc/sgml contains some embryonic manuals.
+  * Leftover files in lib directory in source tree deleted.
+
+ -- Ian Jackson <ian@chiark.chu.cam.ac.uk>  Mon, 10 Jun 1996 03:52:01 +0100
+
 dpkg (1.2.3); priority=HIGH
 
   * install-info doesn't replicate section headings (Bug#3125, #2973).

+ 5 - 5
debian.README

@@ -1,17 +1,17 @@
-This is Debian/GNU Linux's package maintenance system.
+This is Debian Linux's package maintenance system.
 
 For an example of how to construct packages see the `hello' package
 which is part of Debian.
 
-[ Note for users of GCC 2.7.0: you must compile at least
- `dselect/main.cc' with only -O2, due to a bug in GCC. ]
-
 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) 1996 Kim-Minh Kaplan <kkaplan@cdfhp3.in2p3.fr>
 Copyright (C) 1995 Bruce Perens <bruce@pixar.com>
 Copyright (C) 1994 Carl Streeter <streeter@cae.wisc.edu>
 Copyright (C) 1994 Matt Welsh <mdw@sunsite.unc.edu>
 Copyright (C) 1994 Ian Murdock <imurdock@debian.org>
-Copyright (C) 1995,1996 Erick Branderhorst <branderhorst@heel.fgg.eur.nl>
+Parts written by Colin Plumb and Branko Lankester in 1993.
+
 
 This is free software; you can redistribute it and/or modify it under
 the terms of the GNU General Public License as published by the Free

+ 85 - 44
debian.postinst

@@ -21,56 +21,97 @@ them by hand later.
 END
 }
 
-if [ "x$1" = xconfigure ]; then case "$2" in 0.* | 1.0.* | 1.1.0 | 1.1.0[^0-9]* | '' )
-	for f in 0 1 2 3 4 5 6
-	do
-		cd /etc/rc$f.d
-		for g in K[0-9][0-9]*
+if [ "x$1" = xconfigure ]; then
+	case "$2" in
+	0.* | 1.0.* | 1.1.0 | 1.1.0[^0-9]* | '' )
+		for f in 0 1 2 3 4 5 6
 		do
-			if [ -n "`echo \"x$g\" | tr -d 0-9A-Za-z_-`" ]
-			then
-				continue
-			fi
-			h="`echo $g | sed -e 's/^K/S/'`"
-			if ! [ -L $h -a -L $g ] \
-			  || [ "`ls -Li $g 2>/dev/null | awk '{print $1}'`" != \
-			       "`ls -Li $h 2>/dev/null | awk '{print $1}'`" ]
-			then
-				continue
-			fi
-			removes="$removes rc$f.d/$g"
+			cd /etc/rc$f.d
+			for g in K[0-9][0-9]*
+			do
+				if [ -n "`echo \"x$g\" | tr -d 0-9A-Za-z_-`" ]
+				then
+					continue
+				fi
+				h="`echo $g | sed -e 's/^K/S/'`"
+				if ! [ -L $h -a -L $g ] \
+				  || [ "`ls -Li $g 2>/dev/null | awk '{print $1}'`" != \
+				       "`ls -Li $h 2>/dev/null | awk '{print $1}'`" ]
+				then
+					continue
+				fi
+				removes="$removes rc$f.d/$g"
+			done
 		done
-	done
-	if [ -n "$removes" ]
-	then
-		cd /etc
-		dupdaemonhelp
-		while [ -n "$removes" ]
-		do
-			echo -n 'y=remove, n=leave, l=list, h=help ?  '
+		if [ -n "$removes" ]
+		then
+			cd /etc
+			dupdaemonhelp
+			while [ -n "$removes" ]
+			do
+				echo -n 'y=remove, n=leave, l=list, h=help ?  '
+				read response
+				case "$response" in
+				[Yy]*)
+					echo "Removing duplicate K links ..."
+					rm -v $removes
+					removes=""
+					;;
+				[Nn]*)
+					echo -e "OK, leaving them.\n"
+					removes=""
+					;;
+				[Ll]*)
+					echo
+					echo $removes
+					echo
+					;;
+				[Hh]*)
+					dupdaemonhelp
+					;;
+				esac
+			done
+		fi
+		;;
+	1.1.6 | 1.1.6elf | 1.2.[0123] | 1.2.[0123]elf )
+		response=''
+		while [ -z "$response" ]; do
+			echo -n '
+The version of dpkg you'\''re upgrading from had a problem with the
+install-info program used to maintain the /usr/info/dir file.  It may
+have corrupted the file, for example by placing new entries for the
+menu in it before the `* Menu'\'' line (thus making them ineffective) or
+by creating several identical sections.
+
+I can try to sort these problems out, but beware that this process is
+not guaranteed not to mess up a dir file which has things that look
+like menu entries in the introductory paragraphs.  The distributed dir
+files do not do this, so if you haven'\''t edited /usr/info/dir it'\''s
+almost certainly safe to say `yes'\'' to the next question.
+
+If you say `no'\'' you may wish to check and/or edit /usr/info/dir yourself.
+
+Try to check/repair /usr/info/dir automatically ?  [y/n]  '
 			read response
 			case "$response" in
-			[Yy]*)
-				echo "Removing duplicate K links ..."
-				rm -v $removes
-				removes=""
-				;;
-			[Nn]*)
-				echo -e "OK, leaving them.\n"
-				removes=""
-				;;
-			[Ll]*)
-				echo
-				echo $removes
-				echo
-				;;
-			[Hh]*)
-				dupdaemonhelp
-				;;
+			[Yy]* | '')	response=yes ;;
+			[Nn]*)		response=no ;;
+			*)		response='' ;;
 			esac
 		done
-	fi
-;; esac ; fi
+		if [ "$response" = yes ]; then
+			echo "
+Checking/repairing /usr/info/dir ..."
+			cleanup-info --unsafe
+			echo
+		else
+			echo "
+OK.
+"
+		fi
+		;;
+	esac
+fi
 
 cd /var/lib/dpkg
 if ! test -f diversions

+ 1 - 1
debian.rules

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

Разница между файлами не показана из-за своего большого размера
+ 1089 - 0
doc/sgml/programmer.sgml


+ 209 - 108
dpkg-deb/dpkg-deb.8

@@ -1,130 +1,231 @@
 .\" Hey, Emacs!  This is an -*- nroff -*- source file.
-.\" Authors: Raul Miller and Ian Jackson
-.TH DPKG\-DEB 8 "29 Nov 1995" "Debian Project" "Debian GNU/Linux"
+.\" Authors: Ian Jackson
+.TH DPKG\-DEB 8 "1st June 1996" "Debian Project" "Debian Linux manual"
 .SH NAME 
-dpkg\-deb \- Debian GNU/Linux package archive backend
+dpkg\-deb \- Debian package archive (.deb) manipulation tool
 .SH SYNOPSIS
-.B dpkg-deb --version
-.LP
-.B dpkg-deb
-.BR -X | --vextract
-.I <deb>
-.RI [ <directory> ]
-.LP
 .B dpkg-deb
 .BR -b | --build
-.RB [ --nocheck ]
-.I <directory>
-.RI [ <deb> ]
-.LP
-.B dpkg-deb
-.BR -c | --contents
-.I <deb>
-.LP
+.IR directory " [" archive ]
+.br
 .B dpkg-deb
-.BR -e | --control
-.I <deb>
-.RI [ <directory> ]
-.LP
+.BR -I | --info
+.IR archive " [" control\-file\-name " ..]"
+.br
 .B dpkg-deb
 .BR -f | --field
-.I <deb>
-.RI [ <cfield> ]...
-.LP
-.B dpkg-deb
-.BR -h | --help
-.LP
+.IR archive " [" control\-field\-name " ...]"
+.br
 .B dpkg-deb
-.BR -I | --info
-.I <deb>
-.RI [ <cfile> ]
-.LP
-.B dpkg-deb
-.BR -x | --extract 
-.I <deb> <directory>
-.LP
+.BR -c | --contents
+.I archive
+.br
 .B dpkg-deb
-.BR -D | --debug
-.I <invocation-options>
+.BR -x | --extract | -X | --vextract
+.I archive directory
+.br
+.B dpkg-deb --fsys-tarfile
+.I archive
+.br
+.B dpkg-deb --control
+.I archive directory
 .SH DESCRIPTION
 .B dpkg-deb
-packs and unpacks debian archives.  It tracks file permissions, and
-includes support for the staged unpacking mechanism required by debian.
-.SH OPTIONS
-.I <deb>
-is the filename of a Debian format archive.
-.I <cfile>
-is the name of an administrative file component.
-.I <cfield>
-is the name of a field in the main `control' file.
-.LP
-.B --version
-displays the version number.
-.LP
-.BR -X | --vextract
-extracts files from archive and lists archive's contents.
-.LP
-.BR -b | --build
-makes a debian archive from the image of
-.IR <directory> .
-.I <directory>
+packs, unpacks and provides information about Debian archives.
+
+Use
+.B dpkg
+to install and remove packages from your system.
+
+You can also invoke
+.B dpkg\-deb
+by calling
+.B dpkg
+with whatever options you want to pass to
+.BR dpkg\-deb ".  " dpkg
+will spot that you wanted
+.B dpkg\-deb
+and run it for you.
+.SH ACTION OPTIONS
+.TP
+.BR -b ", " --build
+Creates a debian archive from the filesystem tree stored in
+.IR directory ".  " directory
 must have a
 .B DEBIAN
-subdirectory, which is treated specially for the debian-specific
-control file and any pre- or post-install scripts.
+subdirectory, which contains the control information files such
+as the control file itself.  This directory will
+.I not
+appear in the binary package's filesystem archive, but instead
+the files in it will be put in the binary package's control
+information area.
 
-The
+Unless you specify
+.BR \-\-no\-check ", " dpkg\-deb "
+will read
+.B DEBIAN/control
+and parse it.  It will check it for syntax errors and other problems,
+and display the name of the binary package being built.
+.B dpkg\-deb
+will also check the permissions of the maintainer scripts and other
+files found in the
 .B DEBIAN
-directory must contain a file called
-.B control
-whose contents is a valid control file for the Debian package
-management system.  Errors in this file will abort the processing of
-the package.  This check can be bypassed by the use of the
-.B --nocheck
-option.
-.LP
-.BR -c | --contents
-lists the contents of the archive on stdout.
-.LP
-.BR -e | --control
-extracts the control file from the archive.
-If no target directory is specified, the control files are extracted
-into
-.BR ./DEBIAN .
-.LP
-.BR -f | --field
-displays [named field(s) from] the control file.
-.LP
-.BR -h | --help
-displays summary of usage.
-.LP
-.BR -I | --info
-describes the archive, on stdout.
-.LP
-.BR -x | --extract
-extracts files from archive.
-.LP
-.BR -D | --debug
-would enable debugging.
-.SH NOTES
-.B dpkg-deb
-packs and unpacks *.deb files, but does not deal with any of the
-larger administrative issues of installing/de-installing packages.
-.SH SEE ALSO
-.BR deb (5),
-.BR deb-control (5),
-.BR dpkg (5),
-.BR dpkg (8),
-.BR dselect (8).
+control information directory.
+
+If no
+.I archive
+is specified then
+.B dpkg\-deb
+will write the package into the file
+.IR directory \fB.deb\fR.
+
+If the archive to be created already exists it will be overwritten.
+.TP
+.BR \-\-info ", " -I
+Provides information about a binary package archive.
+
+If no
+.IR control\-file\-name s
+are specified then it will print a summary of the contents of the
+package as well as its control file.
+
+If any
+.IR control\-file\-name s
+are specified then
+.B dpkg\-deb
+will print them in the order they were specified; if any of the
+components weren't present it will print an error message to stderr
+about each one and exit with status 2.
+.TP
+.BR \-\-field ", " -f
+Extracts control file information from a binary package archive.
+
+If no
+.BR control\-file\-field s
+are specified then it will print the whole control file.
+
+If any are specified then
+.B dpkg\-deb
+will print their contents, in the order in which they appear in the
+control file.  If more than one
+.BR control\-file\-field
+is specified then
+.B dpkg\-deb
+will precede each with its field name (and a colon and space).
+
+No errors are reported for fields requested but not found.
+.TP
+.BR --contents ", " -c
+Lists the contents of the filesystem tree archive portion of the
+package archive.  It is currently produced in the format generated by
+.BR tar 's
+verbose listing.
+.TP
+.BR --extract ", " -x ", " \-\-vextract ", " -X
+Extracts the filesystem tree from a package archive into the specified
+directory.
+
+.BR \-\-vextract " (" -X ")"
+prints a listing of the files extracted as it goes, while
+.BR \-\-extract " (" -x ")"
+is silent unless an error occurs.
+
+Note that extracting a package to the root directory will
+.I not
+result in a correct installation !  Use
+.B dpkg
+to install packages.
+
+.I directory
+(but not its parents) will be created if necessary.
+.TP
+.BR --fsys-tarfile
+Extracts the filesystem tree data from a binary package and sends it
+to standard output in
+.B tar
+format.  Together with
+.B tar
+this can be used to extract a particular file from a package archive.
+.TP
+.BR --control ", " -e
+Extracs the control information files from a package archive into the
+specified directory.
+
+If no directory is specified then a subdirectory
+.B DEBIAN
+in the current directory is used.
+
+The target directory (but not its parents) will be created if
+necessary.
+.TP
+.BR --help ", " -h
+Prints
+.BR dpkg\-deb 's
+usage message, giving a summary of its options and their uses.
+.TP
+.BR --version
+Prints
+.BR dpkg\-deb 's
+version number.
+.TP
+.BR --licence
+Prints information about
+.BR dpkg\-deb 's
+copyright licensing and lack of warranty.  (The American spelling
+.B \-\-license
+is also supported.)
+.SH OTHER OPTIONS
+.TP
+.BR --new
+Ensures that
+.B dpkg\-deb
+builds a `new' format archive.  This is the default.
+.TP
+.BR --old
+Forces
+.B dpkg\-deb
+to build an `old' format archive.  This old archive format is less
+easily parsed by non-Debian tools and is now obsolete; its only use is
+when building packages to be parsed by versions of dpkg older than
+0.93.76 (September 1995), which was released as i386 a.out only.
+.TP
+.BR --no-check
+Inhibit's
+.BR "dpkg\-deb \-\-build" 's
+usual checks on the proposed contents of an archive.  You can build
+any archive you want, no matter how broken, this way.
+.TP
+.BR --debug ", " -D
+Enables debugging output.  This is not very interesting.
 .SH BUGS
 .B dpkg-deb -I 
 .IB package1 .deb
 .IB package2 .deb
 does the wrong thing.
 
-This manpage is too terse and fails to document all the options.  If
-you are a competent and accurate writer and are willing to spend the
-time reading the source and writing good manpages please
-please write a better man page than this one.
-.LP
-Still being developed, as of 29th November 1995.
+There is no authentication on
+.B .deb
+files; in fact, there isn't even a straightforward checksum.
+
+Do not attempt to use just
+.B dpkg\-deb
+to install software !  You must use
+.B dpkg
+proper to ensure that all the files are correctly placed and the
+package's scripts run and its status and contents recorded.
+.SH SEE ALSO
+.BR deb (5),
+.BR deb-control (5),
+.BR dpkg (5),
+.BR dpkg (8),
+.BR dselect (8).
+.SH AUTHOR
+.B dpkg\-deb
+and this manpage were written by Ian Jackson.  They are
+Copyright (C)1995-1996
+by him and released under the GNU General Public Licence; there is NO
+WARRANTY.  See
+.B /usr/doc/copyright/dpkg
+and
+.B /usr/doc/copyright/GPL
+for details.

+ 1 - 4
dselect/main.cc

@@ -166,10 +166,7 @@ extern void operator delete(void *p) {
 }
 
 urqresult urq_list(void) {
-  readwrite= modstatdb_init(admindir,
-                            // Why do I need this cast ??
-                            (modstatdb_rw)(msdbrw_writeifposs|
-                                           msdbrw_availablepreferversion));
+  readwrite= modstatdb_init(admindir,msdbrw_writeifposs);
 
   curseson();
 

+ 8 - 2
dselect/methlist.cc

@@ -115,16 +115,22 @@ void methodlist::redrawcolheads() {
 }
 
 methodlist::methodlist() : baselist(&methodlistbindings) {
+  int newcursor= -1;
+  
   if (debug)
     fprintf(debug,"methodlist[%p]::methodlist()\n",this);
 
   table= new struct option*[noptions];
 
   struct option *opt, **ip;
-  for (opt=options, ip=table, nitems=0; opt; opt=opt->next, nitems++) *ip++= opt;
+  for (opt=options, ip=table, nitems=0; opt; opt=opt->next, nitems++) {
+    if (opt == coption) { assert(newcursor==-1); newcursor= nitems; }
+    *ip++= opt;
+  }
   assert(nitems==noptions);
 
-  setcursor(0);
+  if (newcursor==-1) newcursor= 0;
+  setcursor(newcursor);
 
   if (debug)
     fprintf(debug,"methodlist[%p]::methodlist done; noptions=%d\n", this, noptions);

+ 2 - 5
include/dpkg-db.h

@@ -146,9 +146,7 @@ enum modstatdb_rw {
   msdbrw_write/*s*/, msdbrw_needsuperuser,
   /* Now some optional flags: */
   msdbrw_flagsmask= ~077,
-  /* Prefer later versions from `status' in `available' info, but do not
-   * save `available' info: */
-  msdbrw_availablepreferversion= 0100
+  /* ... of which there are currently none, but they'd start at 0100 */
 };
 
 enum modstatdb_rw modstatdb_init(const char *admindir, enum modstatdb_rw reqrwflags);
@@ -178,8 +176,7 @@ void hashreport(FILE*);
 enum parsedbflags {
   pdb_recordavailable   =001, /* Store in `available' in-core structures, not `status' */
   pdb_rejectstatus      =002, /* Throw up an error if `Status' encountered             */
-  pdb_weakclassification=004, /* Ignore priority/section info if we already have any   */
-  pdb_preferversion=     010  /* Discard information about earlier versions            */
+  pdb_weakclassification=004  /* Ignore priority/section info if we already have any   */
 };
 
 const char *illegal_packagename(const char *p, const char **ep);

+ 2 - 3
lib/database.c

@@ -145,11 +145,10 @@ int informative(struct pkginfo *pkg, struct pkginfoperfile *info) {
    * out.
    */
   if (info == &pkg->installed &&
-      ((pkg->want != want_unknown && pkg->want != want_purge) ||
+      (pkg->want != want_unknown ||
        pkg->eflag != eflagv_ok ||
        pkg->status != stat_notinstalled ||
-       informativeversion(&pkg->configversion) ||
-       pkg->files))
+       informativeversion(&pkg->configversion)))
     /* We ignore Section and Priority, as these tend to hang around. */
     return 1;
   if (!info->valid) return 0;

+ 2 - 5
lib/dbmodify.c

@@ -179,8 +179,7 @@ enum modstatdb_rw modstatdb_init(const char *adir, enum modstatdb_rw readwritere
   if (cstatus != msdbrw_needsuperuserlockonly) {
     parsedb(statusfile, pdb_weakclassification, 0,0,0);
     parsedb(availablefile,
-            pdb_recordavailable|pdb_rejectstatus|
-            (cflags & msdbrw_availablepreferversion ? pdb_preferversion : 0),
+            pdb_recordavailable|pdb_rejectstatus,
             0,0,0);
   }
 
@@ -206,9 +205,7 @@ void modstatdb_shutdown(void) {
   switch (cstatus) {
   case msdbrw_write:
     checkpoint();
-    if (!(cflags & msdbrw_availablepreferversion))
-      writedb(availablefile,1,0);
-
+    writedb(availablefile,1,0);
     /* tidy up a bit, but don't worry too much about failure */
     fclose(importanttmp);
     strcpy(updatefnrest, IMPORTANTTMP); unlink(updatefnbuf);

+ 45 - 39
lib/parse.c

@@ -197,7 +197,7 @@ int parsedb(const char *filename, enum parsedbflags flags,
                      &newpifp->description, "description");
       parsemustfield(file,filename,lno, warnto,warncount,&newpig,1,
                      &newpifp->maintainer, "maintainer");
-      parsemustfield(file,filename,lno, warnto,warncount,&newpig,1,
+      parsemustfield(file,filename,lno, warnto,warncount,&newpig,0,
                      &newpifp->version.version, "version");
     }
     if (flags & pdb_recordavailable)
@@ -222,51 +222,57 @@ int parsedb(const char *filename, enum parsedbflags flags,
       }
     }
 
+    /* There was a bug that could make a not-installed package have
+     * conffiles, so we check for them here and remove them (rather than
+     * calling it an error, which will do at some point -- fixme).
+     */
+    if (!(flags & pdb_recordavailable) &&
+        newpig.status == stat_notinstalled &&
+        newpifp->conffiles) {
+      parseerr(file,filename,lno, warnto,warncount,&newpig,1,
+               "Package which in state not-installed has conffiles, forgetting them");
+      newpifp->conffiles= 0;
+    }
+
     pigp= findpackage(newpig.name);
     pifp= (flags & pdb_recordavailable) ? &pigp->available : &pigp->installed;
     if (!pifp->valid) blankpackageperfile(pifp);
 
-    if (!(flags & pdb_preferversion) ||
-        versioncompare(&newpifp->version,&pifp->version) >= 0) {
-      /* If we're ignoring older versions compare version numbers
-       * and only process this entry if it's a higher version.
-       */
-
-      /* Copy the priority and section across, but don't overwrite existing
-       * values if the pdb_weakclassification flag is set.
-       */
-      if (newpig.section && *newpig.section &&
-          !((flags & pdb_weakclassification) && pigp->section && *pigp->section))
-        pigp->section= newpig.section;
-      if (newpig.priority != pri_unknown &&
-          !((flags & pdb_weakclassification) && pigp->priority != pri_unknown)) {
-        pigp->priority= newpig.priority;
-        if (newpig.priority == pri_other) pigp->otherpriority= newpig.otherpriority;
-      }
+    /* Copy the priority and section across, but don't overwrite existing
+     * values if the pdb_weakclassification flag is set.
+     */
+    if (newpig.section && *newpig.section &&
+        !((flags & pdb_weakclassification) && pigp->section && *pigp->section))
+      pigp->section= newpig.section;
+    if (newpig.priority != pri_unknown &&
+        !((flags & pdb_weakclassification) && pigp->priority != pri_unknown)) {
+      pigp->priority= newpig.priority;
+      if (newpig.priority == pri_other) pigp->otherpriority= newpig.otherpriority;
+    }
 
-      /* Sort out the dependency mess. */
-      copy_dependency_links(pigp,&pifp->depends,newpifp->depends,
-                            (flags & pdb_recordavailable) ? 1 : 0);
-      /* Leave the `depended' pointer alone, we've just gone to such
-       * trouble to get it right :-).  The `depends' pointer in
-       * pifp was indeed also updated by copy_dependency_links,
-       * but since the value was that from newpifp anyway there's
-       * no need to copy it back.
-       */
-      newpifp->depended= pifp->depended;
+    /* Sort out the dependency mess. */
+    copy_dependency_links(pigp,&pifp->depends,newpifp->depends,
+                          (flags & pdb_recordavailable) ? 1 : 0);
+    /* Leave the `depended' pointer alone, we've just gone to such
+     * trouble to get it right :-).  The `depends' pointer in
+     * pifp was indeed also updated by copy_dependency_links,
+     * but since the value was that from newpifp anyway there's
+     * no need to copy it back.
+     */
+    newpifp->depended= pifp->depended;
 
-      /* Copy across data */
-      memcpy(pifp,newpifp,sizeof(struct pkginfoperfile));
-      if (!(flags & pdb_recordavailable)) {
-        pigp->want= newpig.want;
-        pigp->eflag= newpig.eflag;
-        pigp->status= newpig.status;
-        pigp->configversion= newpig.configversion;
-        pigp->files= 0;
-      } else {
-        pigp->files= newpig.files;
-      }
+    /* Copy across data */
+    memcpy(pifp,newpifp,sizeof(struct pkginfoperfile));
+    if (!(flags & pdb_recordavailable)) {
+      pigp->want= newpig.want;
+      pigp->eflag= newpig.eflag;
+      pigp->status= newpig.status;
+      pigp->configversion= newpig.configversion;
+      pigp->files= 0;
+    } else {
+      pigp->files= newpig.files;
     }
+
     if (donep) *donep= pigp;
     pdone++;
     if (c == EOF) break;

+ 3 - 1
main/main.c

@@ -63,6 +63,7 @@ Usage: \n\
   " DPKG " --update-avail <Packages-file>     replace available packages info\n\
   " DPKG " --merge-avail <Packages-file>      merge with info from file\n\
   " DPKG " --clear-avail                      erase existing available info\n\
+  " DPKG " --forget-old-unavail               forget uninstalled unavailable pkgs\n\
   " DPKG " -s|--status <package-name> ...     display package status details\n\
   " DPKG " --print-avail <package-name> ...   display available version details\n\
   " DPKG " -L|--listfiles <package-name> ...  list files `owned' by package(s)\n\
@@ -242,7 +243,7 @@ DPKG " forcing options - control behaviour when problems found:\n\
   configure-any          Configure any package which may help this one\n\
   hold                   Process incidental packages even when on hold\n\
   bad-path               PATH is missing important programs, problems likely\n\
-  overwrite              Overwrite a file from one package with another\n\
+  overwrite [*]          Overwrite a file from one package with another\n\
   overwrite-diverted     Overwrite a diverted file with an undiverted version\n\
   depends-version [!]    Turn dependency version problems into warnings\n\
   depends [!]            Turn all dependency problems into warnings\n\
@@ -297,6 +298,7 @@ static const struct cmdinfo cmdinfos[]= {
   ACTION( "update-avail",                    0,  act_avreplace,     updateavailable ),
   ACTION( "merge-avail",                     0,  act_avmerge,       updateavailable ),
   ACTION( "clear-avail",                     0,  act_avclear,       updateavailable ),
+  ACTION( "forget-old-unavail",              0,  act_forgetold,     forgetold       ),
   ACTION( "audit",                          'C', act_audit,         audit           ),
   ACTION( "yet-to-unpack",                   0,  act_unpackchk,     unpackchk       ),
   ACTION( "list",                           'l', act_listpackages,  listpackages    ),

+ 3 - 1
main/main.h

@@ -52,7 +52,8 @@ enum action { act_unset, act_install, act_unpack, act_avail, act_configure,
               act_remove, act_purge, act_listpackages, act_avreplace, act_avmerge,
               act_unpackchk, act_status, act_searchfiles, act_audit, act_listfiles,
               act_assertpredep, act_printarch, act_predeppackage, act_cmpversions,
-              act_printinstarch, act_compareversions, act_printavail, act_avclear };
+              act_printinstarch, act_compareversions, act_printavail, act_avclear,
+              act_forgetold };
 
 enum conffopt {
   cfof_prompt        =     001,
@@ -98,6 +99,7 @@ void process_archive(const char *filename);
 
 /* from update.c */
 
+void forgetold(const char *const *argv);
 void updateavailable(const char *const *argv);
 
 /* from enquiry.c */

+ 1 - 0
main/processarc.c

@@ -878,6 +878,7 @@ void process_archive(const char *filename) {
     otherpkg->installed.depends= 0;
     otherpkg->installed.essential= 0;
     otherpkg->installed.description= otherpkg->installed.maintainer= 0;
+    otherpkg->installed.conffiles= 0;
     blankversion(&otherpkg->installed.version);
     otherpkg->installed.arbs= 0;
     otherpkg->clientdata->fileslistvalid= 0;

+ 2 - 1
main/remove.c

@@ -90,7 +90,7 @@ void deferred_remove(struct pkginfo *pkg) {
   }
 
   assert(pkg->installed.valid);
-  if (pkg->installed.essential)
+  if (pkg->installed.essential && pkg->status != stat_configfiles)
     forcibleerr(fc_removeessential, "This is an essential package -"
                 " it should not be removed.");
 
@@ -294,6 +294,7 @@ void removal_bulk(struct pkginfo *pkg) {
     pop_cleanup(ehflag_normaltidy); /* closedir */
     
     pkg->status= stat_configfiles;
+    pkg->installed.essential= 0;
     modstatdb_note(pkg);
     push_checkpoint(~ehflag_bombout, ehflag_normaltidy);
 

+ 44 - 5
main/update.c

@@ -38,11 +38,16 @@ void updateavailable(const char *const *argv) {
   int count= 0;
   static struct varbuf vb;
 
-  if (cipaction->arg == act_avclear) {
-    if (sourcefile)
-      badusage("--clear-avail takes no arguments");
-  } else if (!sourcefile || argv[1]) {
-    badusage("--%s needs exactly one Packages file argument", cipaction->olong);
+  switch (cipaction->arg) {
+  case act_avclear:
+    if (sourcefile) badusage("--%s takes no arguments",cipaction->olong);
+    break;
+  case act_avreplace: case act_avmerge:
+    if (!sourcefile || argv[1])
+      badusage("--%s needs exactly one Packages file argument",cipaction->olong);
+    break;
+  default:
+    internerr("bad cipaction->arg in updateavailable");
   }
   
   if (!f_noact) {
@@ -86,3 +91,37 @@ void updateavailable(const char *const *argv) {
   if (cipaction->arg != act_avclear)
     printf("Information about %d package(s) was updated.\n",count);
 }
+
+void forgetold(const char *const *argv) {
+  struct pkgiterator *it;
+  struct pkginfo *pkg;
+  enum pkgwant oldwant;
+
+  if (*argv) badusage("--forget-old-unavail takes no arguments");
+
+  modstatdb_init(admindir, f_noact ? msdbrw_readonly : msdbrw_write);
+
+  it= iterpkgstart();
+  while ((pkg= iterpkgnext(it))) {
+    debug(dbg_eachfile,"forgetold checking %s",pkg->name);
+    if (informative(pkg,&pkg->available)) {
+      debug(dbg_eachfile,"forgetold ... informative available");
+      continue;
+    }
+    if (pkg->want != want_purge && pkg->want != want_deinstall) {
+      debug(dbg_eachfile,"forgetold ... informative want");
+      continue;
+    }
+    oldwant= pkg->want;
+    pkg->want= want_unknown;
+    if (informative(pkg,&pkg->installed)) {
+      debug(dbg_eachfile,"forgetold ... informative installed");
+      pkg->want= oldwant;
+      continue;
+    }
+    debug(dbg_general,"forgetold forgetting %s",pkg->name);
+  }
+  iterpkgend(it);
+  
+  modstatdb_shutdown();
+}

+ 1 - 1
methods/disk.setup

@@ -405,7 +405,7 @@ development tree are available for installation.  Would you like to
 use the unreleased development tree (this is only recommended for
 experts who like to live dangerously and want to help with testing) ?'
 		yesno "$p_usedevel" 'Use unreleased development distribution ?'
-		usedevel="$response"
+		usedevel="$yesno"
 		if [ "$usedevel" = yes ]
 		then
 			whichmain=development

+ 2 - 0
methods/disk.update

@@ -82,6 +82,8 @@ do
 	esac	
 done
 
+dpkg --forget-old-unavail
+
 echo -n 'Update OK.  Hit RETURN.  '
 read response
 

+ 1 - 1
scripts/Makefile.in

@@ -38,7 +38,7 @@ MAN1 =  dpkg-name
 EXC =   dpkg-name
 MAN8 =	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
+	dpkg-scanpackages dpkg-divert cleanup-info
 
 INSTALL = @INSTALL@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@

+ 155 - 0
scripts/cleanup-info.pl

@@ -0,0 +1,155 @@
+#!/usr/bin/perl --
+#
+#   Clean up the mess that bogus install-info may have done :
+#
+#	- gather all sections with the same heading into a single one.
+#	Tries to be smart about cases and trailing colon/spaces.
+#
+#   Other clean ups :
+#
+#	- remove empty sections,
+#	- squeeze blank lines (in entries part only).
+#
+#   Order of sections is preserved (the first encountered section
+# counts).
+#
+#   Order of entries within a section is preserved.
+#
+# BUGS:
+#
+#   Probably many : I just recently learned Perl for this program
+# using the man pages.  Hopefully this is a short enough program to
+# debug.
+
+# don't put that in for production.
+# use strict;
+
+my $version = '1.1.6'; # This line modified by Makefile
+sub version {
+    print STDERR <<END;
+Debian Linux cleanup-info $version.  Copyright (C)1996 Kim-Minh Kaplan.
+This is free software; see the GNU General Public Licence
+version 2 or later for copying conditions.  There is NO warranty.
+END
+}
+
+sub usage {
+    print STDERR <<'EOF';
+usage: cleanup-info [--version] [--help] [--unsafe] [--] [<dirname>]
+Warning: the ``--unsafe'' option may garble an otherwise correct file
+EOF
+}
+
+my $infodir = '/usr/info';
+my $unsafe = 0;
+$0 =~ m|[^/]+$|;
+my $name= $&;
+
+sub ulquit {
+    unlink "$infodir/dir.lock"
+	or warn "$name: warning - unable to unlock $infodir/dir: $!\n";
+    die $_[0];
+}
+
+while (scalar @ARGV > 0 && $ARGV[0] =~ /^--/) {
+    $_ = shift;
+    /^--$/ and last;
+    /^--version$/ and do {
+	version;
+	exit 0;
+    };
+    /^--help$/ and do {
+	usage;
+	exit 0;
+    };
+    /^--unsafe$/ and do {
+	$unsafe=1;
+	next;
+    };
+    print STDERR "$name: unknown option \`$_'\n";
+    usage;
+    exit 1;
+}
+
+if (scalar @ARGV > 0) {
+    $infodir = shift;
+    if (scalar @ARGV > 0) {
+	print STDERR "$name: too many arguments\n";
+	usage;
+	exit 1;
+    }
+}
+
+if (!link "$infodir/dir", "$infodir/dir.lock") {
+    die "$name: failed to lock dir for editing! $!\n".
+        ($! =~ /exist/i ? "try deleting $infodir/dir.lock\n" : '');
+}
+open OLD, "$infodir/dir"  or ulquit "$name: can't open $infodir/dir: $!\n";
+open OUT, ">$infodir/dir.new"
+    or ulquit "$name can't create $infodir/dir.new: $!\n";
+
+my (%sections, @section_list, $lastline);
+my $section="Miscellaneous";	# default section
+my $section_canonic="miscellaneous";
+my $waitfor = $unsafe ? '^\*.*:' : '^\*\s*Menu';
+
+while (<OLD>) {				# dump the non entries part
+    last if (/$waitfor/oi);
+    if (defined $lastline) {
+	print OUT $lastline
+	    or ulquit "$name: error writing $infodir/dir.new: $!\n";
+    }
+    $lastline = $_;
+};
+
+if (/^\*\s*Menu\s*:?/i) {
+    print OUT $lastline if defined $lastline;
+    print OUT $_;
+} else {
+    print OUT "* Menu:\n";
+    if (defined $lastline) {
+	$lastline =~ s/\s*$//;
+	if ($lastline =~ /^([^\*\s].*)/) { # there was a section title
+	    $section = $1;
+	    $lastline =~ s/\s*:$//;
+	    $section_canonic = lc $lastline;
+	}
+    }
+    push @section_list, $section_canonic;
+    s/\s*$//;
+    $sections{$section_canonic} = "\n$section\n$_\n";
+}
+
+foreach (<OLD>) {		# collect sections
+    next if (/^\s*$/ or $unsafe and /^\*\s*Menu/oi);
+    s/\s*$//;
+    if (/^([^\*\s].*)/) {		# change of section
+	$section = $1;
+	s/\s*:$//;
+	$section_canonic = lc $_;
+    } else {			# add to section
+	if (! exists $sections{$section_canonic}) { # create section header
+	    push @section_list, $section_canonic;
+	    $sections{$section_canonic} = "\n$section\n";
+	}
+	$sections{$section_canonic} .= "$_\n";
+    }
+}
+
+eof OLD or ulquit "$name: read $infodir/dir: $!\n";
+close OLD or ulquit "$name: close $infodir/dir after read: $!\n";
+
+print OUT @sections{@section_list};
+close OUT or ulquit "$name: error closing $infodir/dir.new: $!\n";
+
+# install clean version
+unlink "$infodir/dir.old";
+link "$infodir/dir", "$infodir/dir.old"
+    or ulquit "$name: can't backup old $infodir/dir, giving up: $!\n";
+rename "$infodir/dir.new", "$infodir/dir"
+    or ulquit "$name: failed to install $infodir/dir; I'll leave it as $infodir/dir.new: $!\n";
+
+unlink "$infodir/dir.lock"
+    or die "$name: failed to unlock $infodir/dir: $!\n";
+
+exit 0;

+ 14 - 12
scripts/dpkg-name.1

@@ -4,7 +4,7 @@
 .\" This is free software; see the GNU General Public Licence version 2
 .\" or later for copying conditions.  There is NO warranty.
 .\" Time-stamp: <96/05/03 14:00:06 root>
-.TH dpkg-name 1 "April 1996" "Debian Project" "Debian Linux"
+.TH dpkg-name 1 "May 1996" "Debian Project" "Debian Linux"
 .SH NAME
 dpkg\-name \- rename Debian packages to full package names
 .SH SYNOPSIS
@@ -19,19 +19,18 @@ This manual page documents the
 sh script which provides an easy way to rename
 .B Debian
 packages into their full package names. A full package name consists
-of <package>-<version>.<architecture>.deb as specified in the control
-file of the package. The <package> part of the filename will have
-hyphens "-" replaced by underscores "_". The <version> part of the
-filename consists of the mainstream version information optionally
-followed by a hyphen and the revision information.
+of <package>_<version>_<architecture>.deb as specified in the control
+file of the package. The <version> part of the filename consists of
+the mainstream version information optionally followed by a hyphen and
+the revision information.
 .SH EXAMPLES
 .TP
 .B dpkg-name bar-foo.deb
-The file `bar-foo.deb' will be renamed to bar_foo-1.0-2.i386.deb or
+The file `bar-foo.deb' will be renamed to bar-foo_1.0-2_i386.deb or
 something similar (depending on whatever information is in the control
 part of `bar-foo.deb').
 .TP
-.B find /root/debian/ \-name '*.deb' | xargs \-n 1 dpkg\-name -a
+.B find /root/debian/ \-name '*.deb' | xargs \-n 1 dpkg\-name \-a
 All files with the extension `deb' in the directory /root/debian and its
 subdirectory's will be renamed by dpkg\-name if required into names with no
 architecture information.
@@ -42,7 +41,7 @@ Your archive will be messed up completely because a lot of packages
 don't come with section information.
 .B Don't do this.
 .TP
-.B dpkg --build debian-tmp && dpkg-name -s .. debian-tmp.deb
+.B dpkg --build debian-tmp && dpkg-name -o -s .. debian-tmp.deb
 This can be used when building new packages.
 .SS OPTIONS
 .TP
@@ -83,15 +82,18 @@ information and exit successfully.
 Successfully tested on
 .B Debian Linux 
 systems only. Some packages don't follow the name structure
-<package>-<version>.<architecture>.deb. Packages renamed by dpkg-name
+<package>_<version>_<architecture>.deb. Packages renamed by dpkg-name
 will follow this structure. Generally this will have no impact on how
-packages are installed by dselect/dpkg.
+packages are installed by dselect/dpkg, but other installation tools
+might depend on this naming structure.
 .SH SEE ALSO
 .BR deb (5),
 .BR deb-control (5),
 .BR dpkg (5),
 .BR dpkg (8),
-.BR dpkg-deb (8).
+.BR dpkg-deb (8),
+.BR find (1),
+.BR xargs (1).
 .SH COPYRIGHT
 Copyright 1995,1996 Erick Branderhorst.
 .B dpkg-name

+ 5 - 6
scripts/dpkg-name.sh

@@ -4,7 +4,7 @@ set -e
 
 # Time-stamp: <96/05/03 13:59:41 root>
 prog="`basename \"${0}\"`"
-version="1.1.6"; # This line modified by Makefile
+version="1.2.3"; # This line modified by Makefile
 purpose="rename Debian packages to full package names"
 
 license () {
@@ -33,8 +33,8 @@ show_version () {
 usage () {
 	echo "Usage: ${prog} file[s]
   ${purpose}
-  file.deb changes to <package>-<version>.<architecture>.deb
-  <package> is y/-/_/ aware
+  file.deb changes to <package>_<version>_<architecture>.deb 
+  according to the ``underscores convention''.
   -a|--no-architecture  No architecture part in filename
   -o|--overwrite        Overwrite if file exists
   -s|--subdir [dir]     Move file into subdir (Use with care)
@@ -55,7 +55,6 @@ fileexists () {
 getname () {
 	if p=`dpkg-deb -f -- "$1" package`;
 	then
-		p=`echo $p|sed -e 'y/-/_/'`;
 		v=`dpkg-deb -f -- "$1" version`;
 		r=`dpkg-deb -f -- "$1" revision`;
 		if [ -z "$r" ];
@@ -77,9 +76,9 @@ getname () {
 		fi
 		if [ -z "$noarchitecture" ];
 		then
-			tname=$p-$v.$a.deb;
+			tname=$p\_$v\_$a.deb;
 		else
-			tname=$p-$v.deb
+			tname=$p\_$v.deb
 		fi
 	
 		name=`echo $tname|sed -e 's/ //g'`

+ 9 - 3
scripts/dpkg-scanpackages.pl

@@ -69,7 +69,12 @@ while (<F>) {
     $t =~ m/^\n*$/ || die "$fn $o / $t ?";
     defined($tv{'package'}) || die "$fn $o ?";
     $p= $tv{'package'}; delete $tv{'package'};
-    defined($p1{$p}) && die "$fn $p repeat";
+    if (defined($p1{$p})) {
+        print(STDERR " ! Package $p (filename $fn) is repeat;\n".
+                     "   ignored that one and using data from $pfilename{$p}) !\n")
+            || die $!;
+        continue;
+    }
     if (defined($tv{'filename'})) {
         print(STDERR " ! Package $p (filename $fn) has Filename field !\n") || die $!;
     }
@@ -122,8 +127,8 @@ while(<O>) {
     next unless defined($p1{$p});
     if (length($maintainer)) {
         if ($maintainer =~ m/\s*=\>\s*/) {
-            $oldmaint= $`; $newmaint= $';
-            if ($pv{$p,'maintainer'} ne $oldmaint) {
+            $oldmaint= $`; $newmaint= $'; $debmaint= $pv{$p,'maintainer'};
+            if (!grep($debmaint eq $_, split(m,\s*//\s*, $oldmaint))) {
                 push(@changedmaint,
                      "  $p (package says $pv{$p,'maintainer'}, not $oldmaint)\n");
             } else {
@@ -132,6 +137,7 @@ while(<O>) {
         } elsif ($pv{$p,'maintainer'} eq $maintainer) {
             push(@samemaint,"  $p ($maintainer)\n");
         } else {
+            print(STDERR " * Unconditional maintainer override for $p *\n") || die $!;
             $pv{$p,'maintainer'}= $maintainer;
         }
     }

+ 1 - 1
scripts/install-info.pl

@@ -257,7 +257,7 @@ if (!$remove) {
             if ($i <= 0) { # We ran off the top, make this section and Misc.
                 print "$name: no sections yet, creating Miscellaneous section too.\n"
                     unless $quiet;
-                @work= ("\n", "$sectiontitle\n", "\n", "Miscellaneous:", @work);
+                @work= ("\n", "$sectiontitle\n", "\n", "Miscellaneous:\n", @work);
                 $mss= 1;
             } else {
                 @work= (@work[0..$i], "$sectiontitle\n", "\n", @work[$i+1..$#work]);

+ 7 - 6
scripts/update-rc.d.8

@@ -1,5 +1,5 @@
 .\" Hey, Emacs!  This is an -*- nroff -*- source file.
-.TH UPDATE\-RC.D 8 "29th November 1995" "Debian Project" "Debian/GNU Linux"
+.TH UPDATE\-RC.D 8 "6th June 1996" "Debian Project" "Debian/GNU Linux"
 .SH NAME
 update\-rc.d \- install and remove System-V style init script links
 .SH SYNOPSIS
@@ -27,11 +27,12 @@ removing init scripts on a Debian system.
 .SH REMOVING SCRIPTS
 When invoked with the
 .I remove
-option, update-rc.d removes the script and links to the script for the package
-.RI "" <basename> .
-It first finds and removes the script in
-.B /etc/init.d/
-and then removes all links to the script in
+option, update-rc.d removes the links to the script for the package
+.IR basename .
+The script must have been deleted already -
+.B update-rc.d
+checks for this.
+It then removes all the (now-dangling) links to the script in
 .RB "" /etc/rc[0123456].d/ .
 
 .SH INSTALLING SCRIPTS

+ 1 - 1
version.h

@@ -1 +1 @@
-#define DPKG_VERSION "1.2.3" /* This line modified by Makefile */
+#define DPKG_VERSION "1.2.4" /* This line modified by Makefile */