Sfoglia il codice sorgente

dpkg (1.3.6) experimental; urgency=low (HIGH for new source format)

  * dpkg-source now has broken argument unparsing for tar.  (Bug#4195.)

  * dpkg-gencontrol writes to debian/tmp/DEBIAN/control by default.
  * dpkg-shlibdeps script added.

  * Back to old sh update-rc.d, and removed manpage, because new Perl
    version and the manpage have different syntax and semantics.
  * update-rc.d prints usage message for missing terminal `.'.  (Bug#4122.)

  * Use rm -rf instead of just rm -r in dpkg-deb --info &c.  (Bug#4200.)

  * Added support for Installed-Size to dpkg-gencontrol, and documented.
  * Source packaging substitution variables and name syntax rationalised.
  * dpkg-source scripts' usage messages improved slightly.
  * dpkg-source works with non-empty second (orig dir) argument.

  * Added rationale for copyright policy to manual.
  * More developers' PGP keys.
  * Control database handling cleanups (usu. Source field blanked).

 -- Ian Jackson <ian@chiark.chu.cam.ac.uk>  Tue, 20 Aug 1996 15:39:58 +0100
Ian Jackson 30 anni fa
parent
commit
19f08301e3

+ 24 - 0
debian/changelog

@@ -1,3 +1,27 @@
+dpkg (1.3.6) experimental; urgency=low (HIGH for new source format)
+
+  * dpkg-source now has broken argument unparsing for tar.  (Bug#4195.)
+
+  * dpkg-gencontrol writes to debian/tmp/DEBIAN/control by default.
+  * dpkg-shlibdeps script added.
+
+  * Back to old sh update-rc.d, and removed manpage, because new Perl
+    version and the manpage have different syntax and semantics.
+  * update-rc.d prints usage message for missing terminal `.'.  (Bug#4122.)
+
+  * Use rm -rf instead of just rm -r in dpkg-deb --info &c.  (Bug#4200.)
+
+  * Added support for Installed-Size to dpkg-gencontrol, and documented.
+  * Source packaging substitution variables and name syntax rationalised.
+  * dpkg-source scripts' usage messages improved slightly.
+  * dpkg-source works with non-empty second (orig dir) argument.
+
+  * Added rationale for copyright policy to manual.
+  * More developers' PGP keys.
+  * Control database handling cleanups (usu. Source field blanked).
+
+ -- Ian Jackson <ian@chiark.chu.cam.ac.uk>  Tue, 20 Aug 1996 15:39:58 +0100
+
 dpkg (1.3.5) experimental; urgency=low (high for debian-changelog-mode)
 
   * 822-date script included.  (Bug#4136.)

+ 1 - 1
debian/control

@@ -7,7 +7,7 @@ Standards-Version: 0.1
 Package: dpkg
 Architecture: any
 Essential: yes
-Pre-Depends: libc5${libcver}, ncurses3.0
+Pre-Depends: ${shlibs:Pre-Depends}
 Conflicts: dpkgname
 Replaces: dpkgname
 Description: Package maintenance system for Debian Linux

+ 10 - 6
debian/rules

@@ -21,17 +21,19 @@ clean:
 
 binary:	checkroot build
 	-rm -rf debian/tmp
-	install -d debian/tmp debian/tmp/DEBIAN
+	install -d debian/tmp debian/tmp/DEBIAN debian/tmp/etc/dpkg
 	install -d debian/tmp/usr/doc/{copyright,dpkg}
 	set -e; if [ $(arch) = i386 ]; then \
-		dpkg-gencontrol -Vlibcver=' (>= 5.2.18-2)' >$(cidir)/control ; \
 		sed -e 's/^# i386elf: //' <debian/preinst >$(cidir)/preinst ; \
 	else \
-		dpkg-gencontrol -Vlibcver='' >$(cidir)/control ; \
 		sed -e '/^# i386elf: /d' debian/preinst >$(cidir)/preinst ; \
 	fi
-	cp debian/{prerm,postinst} debian/tmp/DEBIAN/.
-	chmod +x debian/tmp/DEBIAN/{postinst,prerm,preinst}
+	set -e; if [ -f debian/shlibs.default.$(arch) ]; then \
+		echo /etc/dpkg/shlibs.default >$(cidir)/conffiles ; \
+		cp debian/shlibs.default.$(arch) debian/tmp/etc/dpkg/shlibs.default ; \
+	fi
+	cp debian/{prerm,postinst} $(cidir)/.
+	chmod +x $(cidir)/{postinst,prerm,preinst}
 	$(MAKE) prefix=$(DIR)/debian/tmp/usr \
 		datadir=$(DIR)/debian/tmp/var/lib/dpkg \
 		etcdir=$(DIR)/debian/tmp/etc \
@@ -39,8 +41,10 @@ binary:	checkroot build
 	cp debian/copyright debian/tmp/usr/doc/copyright/dpkg
 	cp TODO debian/tmp/usr/doc/dpkg/WISHLIST
 	touch debian/tmp/var/lib/dpkg/{status,available}
+	dpkg-shlibdeps -dPre-Depends main/dpkg dselect/dselect
+	dpkg-gencontrol
 	chown -R root.root debian/tmp
-	chmod -R g-ws debian/tmp
+	chmod -R g-ws,a+r,u+w debian/tmp
 	set -e; cd debian/tmp; \
 	 version=`sed -n 's/^Version: //p' DEBIAN/control`; \
 	 file=dpkg_$${version}_$(arch).nondebbin.tar; \

+ 2 - 0
debian/shlibs.default.i386

@@ -0,0 +1,2 @@
+libc 5		libc5 (>= 5.2.18)
+libncurses 3.0	ncurses3.0

+ 1 - 0
debian/substvars

@@ -0,0 +1 @@
+shlibs:Pre-Depends=libc5 (>= 5.2.18), ncurses3.0

BIN
doc/developer-keys.bak


BIN
doc/developer-keys.pgp


+ 14 - 0
doc/policy.sgml

@@ -77,6 +77,20 @@ understand it before proceeding.  If you have doubts or questions,
 please ask.
 <p>
 
+The aims of the policy detailed below are:
+<list compact>
+<item>
+That any user be able to rebuild any package in the official Debian
+distribution from the original source plus our patches.
+<item>
+That we make available in our packaging formats as much software as we
+can.
+<item>
+That it be easy for people to make CDROMs of our distribution without
+violating copyrights.
+</list>
+<p>
+
 All packages in the Debian distribution proper must be freely useable,
 modifiable and redistributable in both source and binary form.  It
 must be possible for anyone to distribute and use modified source code

File diff suppressed because it is too large
+ 0 - 1222
doc/policy.sgml.orig


+ 55 - 1
doc/programmer.sgml

@@ -259,6 +259,49 @@ This file contains a list of configuration files which are to be
 handled automatically by <prgn/dpkg/ (see <ref id="conffiles">).  Note
 that not necessarily every configuration file should be listed here.
 
+<tag><tt/shlibs/
+<item>
+
+This file contains a list of the shared libraries supplied by the
+package, with dependency details for each.  This is used by
+<prgn/dpkg-shlibdeps/ when it determines what dependencies are
+required in a package control file.
+<p>
+
+Each line is of the form:
+<example>
+<var/library-name/ <var/version-or-soname/ <var/dependencies .../
+</example>
+<p>
+
+<var/library-name/ is the name of the shared library, for example
+<tt/libc5/.
+<p>
+
+<var/version-or-soname/ is the soname of the library - ie, the thing
+that must exactly match for the library to be recognised by
+<prgn/ld.so/.  Usually this is major version number of the library.
+<p>
+
+<var/dependencies/ has the same syntax as a dependency field in a
+binary package control file.  It should give details of which
+package(s) are required to satisfy a binary built against the version
+of the library contained in the package.  See <ref id="depsyntax">.
+<p>
+
+For example, if the package <tt/foo/ contains <tt/libfoo.so.1.2.3/,
+where the soname of the library is <tt/libfoo.so.1/, and the first
+version of the package which contained a minor number of at least
+<tt/2.3/ was <var/1.2.3-1/, then the package's <var/shlibs/ could
+say:
+<example>
+libfoo 1	foo (>= 1.2.3-1)
+</example>
+<p>
+
+The version-specific dependency is to avoid warnings from <prgn/ld.so/
+about using older shared libraries with newer binaries.
+
 </taglist>
 
 <sect id="controlfile">The main control information file: <tt/control/
@@ -292,6 +335,7 @@ installed.</footnote>
 <item><qref id="f-classification"><tt/Section/, <tt/Priority/</>
 <item><qref id="f-Source"><tt/Source/</>
 <item><qref id="descriptions"><tt/Description/</>
+<item><qref id="f-Installed-Size"><tt/Installed-Size/</>
 
 </list>
 <p>
@@ -1152,6 +1196,16 @@ commas.<footnote>A space after each comma is conventional.</footnote>
 Currently the packages must be separated using only spaces in the
 <tt/.changes/ file.
 
+<sect1 id="f-Installed-Size"><tt/Installed-Size/
+<p>
+
+This field appears in the control files of binary packages, and in the
+<tt/Packages/ files.  It gives the total amount of disk space
+required to install the named package.
+<p>
+
+The disk space is represented in kilobytes as a simple decimal number.
+
 <sect1 id="f-Files"><tt/Files/
 <p>
 
@@ -1989,7 +2043,7 @@ This is done using the <tt/Depends/, <tt/Recommends/, <tt/Suggests/,
 <tt/Conflicts/, <tt/Provides/ and <tt/Replaces/ control file fields.
 <p>
 
-<sect>Syntax of relationship fields
+<sect id="depsyntax">Syntax of relationship fields
 <p>
 
 These fields all have a uniform syntax.  They are a list of package

+ 1 - 1
dpkg-deb/info.c

@@ -48,7 +48,7 @@ static void cu_info_prepare(int argc, void **argv) {
   if (lstat(directory,&stab) && errno==ENOENT) return;
   if ((c1= fork()) == -1) { perror("failed to fork for cleanup"); return; }
   if (!c1) {
-    execlp(RM,"rm","-r",directory,(char*)0);
+    execlp(RM,"rm","-rf",directory,(char*)0);
     perror("failed to exec " RM " for cleanup"); _exit(1);
   }
   if (waitpid(c1,&status,0) != c1) { perror("failed to wait for rm cleanup"); return; }

+ 1 - 1
include/dpkg-db.h

@@ -90,7 +90,7 @@ struct pkginfoperfile { /* pif */
   struct dependency *depends;
   struct deppossi *depended;
   int essential; /* The `essential' flag, 1=yes, 0=no (absent) */
-  char *description, *maintainer, *source, *architecture;
+  char *description, *maintainer, *source, *architecture, *installedsize;
   struct versionrevision version;
   struct conffile *conffiles;
   struct arbitraryfield *arbs;

+ 2 - 1
lib/database.c

@@ -129,7 +129,7 @@ void blankpackageperfile(struct pkginfoperfile *pifp) {
   pifp->essential= 0;
   pifp->depends= 0;
   pifp->depended= 0;
-  pifp->description= pifp->maintainer= pifp->source= 0;
+  pifp->description= pifp->maintainer= pifp->source= pifp->installedsize= 0;
   pifp->architecture= 0;
   blankversion(&pifp->version);
   pifp->conffiles= 0;
@@ -155,6 +155,7 @@ int informative(struct pkginfo *pkg, struct pkginfoperfile *info) {
   if (info->depends ||
       nes(info->description) ||
       nes(info->maintainer) ||
+      nes(info->installedsize) ||
       nes(info->source) ||
       nes(info->architecture) ||
       informativeversion(&info->version) ||

+ 26 - 25
lib/parse.c

@@ -31,32 +31,33 @@
 
 const struct fieldinfo fieldinfos[]= {
   /* NB: capitalisation of these strings is important. */
-  { "Package",          f_name,            w_name                                    },
-  { "Essential",        f_boolean,         w_booleandefno,   PKGIFPOFF(essential)    },
-  { "Status",           f_status,          w_status                                  },
-  { "Priority",         f_priority,        w_priority                                },
-  { "Section",          f_section,         w_section                                 },
-  { "Maintainer",       f_charfield,       w_charfield,      PKGIFPOFF(maintainer)   },
-  { "Architecture",     f_charfield,       w_charfield,      PKGIFPOFF(architecture) },
-  { "Source",           f_charfield,       w_charfield,      PKGIFPOFF(source)       },
-  { "Version",          f_version,         w_version                                 },
-  { "Revision",         f_revision,        w_null                                    },
-  { "Config-Version",   f_configversion,   w_configversion                           },
-  { "Replaces",         f_dependency,      w_dependency,     dep_replaces            },
-  { "Provides",         f_dependency,      w_dependency,     dep_provides            },
-  { "Depends",          f_dependency,      w_dependency,     dep_depends             },
-  { "Pre-Depends",      f_dependency,      w_dependency,     dep_predepends          },
-  { "Recommends",       f_dependency,      w_dependency,     dep_recommends          },
-  { "Suggests",         f_dependency,      w_dependency,     dep_suggests            },
-  { "Conflicts",        f_dependency,      w_dependency,     dep_conflicts           },
-  { "Conffiles",        f_conffiles,       w_conffiles                               },
-  { "Filename",         f_filecharf,       w_filecharf,      FILEFOFF(name)          },
-  { "Size",             f_filecharf,       w_filecharf,      FILEFOFF(size)          },
-  { "MD5sum",           f_filecharf,       w_filecharf,      FILEFOFF(md5sum)        },
-  { "MSDOS-Filename",   f_filecharf,       w_filecharf,      FILEFOFF(msdosname)     },
-  { "Description",      f_charfield,       w_charfield,      PKGIFPOFF(description)  },
+  { "Package",          f_name,            w_name                                     },
+  { "Essential",        f_boolean,         w_booleandefno,   PKGIFPOFF(essential)     },
+  { "Status",           f_status,          w_status                                   },
+  { "Priority",         f_priority,        w_priority                                 },
+  { "Section",          f_section,         w_section                                  },
+  { "Installed-Size",   f_charfield,       w_charfield,      PKGIFPOFF(installedsize) },
+  { "Maintainer",       f_charfield,       w_charfield,      PKGIFPOFF(maintainer)    },
+  { "Architecture",     f_charfield,       w_charfield,      PKGIFPOFF(architecture)  },
+  { "Source",           f_charfield,       w_charfield,      PKGIFPOFF(source)        },
+  { "Version",          f_version,         w_version                                  },
+  { "Revision",         f_revision,        w_null                                     },
+  { "Config-Version",   f_configversion,   w_configversion                            },
+  { "Replaces",         f_dependency,      w_dependency,     dep_replaces             },
+  { "Provides",         f_dependency,      w_dependency,     dep_provides             },
+  { "Depends",          f_dependency,      w_dependency,     dep_depends              },
+  { "Pre-Depends",      f_dependency,      w_dependency,     dep_predepends           },
+  { "Recommends",       f_dependency,      w_dependency,     dep_recommends           },
+  { "Suggests",         f_dependency,      w_dependency,     dep_suggests             },
+  { "Conflicts",        f_dependency,      w_dependency,     dep_conflicts            },
+  { "Conffiles",        f_conffiles,       w_conffiles                                },
+  { "Filename",         f_filecharf,       w_filecharf,      FILEFOFF(name)           },
+  { "Size",             f_filecharf,       w_filecharf,      FILEFOFF(size)           },
+  { "MD5sum",           f_filecharf,       w_filecharf,      FILEFOFF(md5sum)         },
+  { "MSDOS-Filename",   f_filecharf,       w_filecharf,      FILEFOFF(msdosname)      },
+  { "Description",      f_charfield,       w_charfield,      PKGIFPOFF(description)   },
   /* Note that aliases are added to the nicknames table in parsehelp.c. */
-  {  0   /* sentinel - tells code that list is ended */                              }
+  {  0   /* sentinel - tells code that list is ended */                               }
 };
 #define NFIELDS (sizeof(fieldinfos)/sizeof(struct fieldinfo))
 const int nfields= NFIELDS;

+ 2 - 0
main/processarc.c

@@ -751,6 +751,7 @@ void process_archive(const char *filename) {
   pkg->installed.maintainer= pkg->available.maintainer;
   pkg->installed.source= pkg->available.source;
   pkg->installed.architecture= 0; /* This is irrelevant in the status file. */
+  pkg->installed.installedsize= pkg->available.installedsize;
   pkg->installed.version= pkg->available.version;
 
   /* We have to generate our own conffiles structure. */
@@ -887,6 +888,7 @@ void process_archive(const char *filename) {
     otherpkg->installed.depends= 0;
     otherpkg->installed.essential= 0;
     otherpkg->installed.description= otherpkg->installed.maintainer= 0;
+    otherpkg->installed.installedsize= otherpkg->installed.source= 0;
     otherpkg->installed.conffiles= 0;
     blankversion(&otherpkg->installed.version);
     otherpkg->installed.arbs= 0;

+ 1 - 0
main/remove.c

@@ -457,6 +457,7 @@ void removal_bulk(struct pkginfo *pkg) {
     pkg->installed.depends= 0;
     pkg->installed.essential= 0;
     pkg->installed.description= pkg->installed.maintainer= 0;
+    pkg->installed.source= pkg->installed.installedsize= 0;
     blankversion(&pkg->installed.version);
     pkg->installed.arbs= 0;
   }

+ 2 - 2
scripts/Makefile.in

@@ -39,8 +39,8 @@ perlpath = @perlpath@
 MAN1 =  dpkg-name dpkg-source 822-date
 LSMAN = dpkg-source.$(man1)
 LSMANL=	dpkg-gencontrol dpkg-genchanges dpkg-buildpackage \
-	dpkg-distaddfile dpkg-parsechangelog
-EXC =   dpkg-name dpkg-source dpkg-genchanges dpkg-gencontrol \
+	dpkg-distaddfile dpkg-parsechangelog dpkg-shlibdeps
+EXC =   dpkg-name dpkg-source dpkg-genchanges dpkg-gencontrol dpkg-shlibdeps \
 	dpkg-buildpackage dpkg-parsechangelog dpkg-distaddfile 822-date
 MAN8 =	update-rc.d start-stop-daemon update-alternatives install-info \
 	dpkg-scanpackages

+ 15 - 9
scripts/controllib.pl

@@ -1,11 +1,12 @@
 $parsechangelog= 'dpkg-parsechangelog';
 
-grep($capit{lc $_}=$_, qw(Pre-Depends Standards-Version));
+grep($capit{lc $_}=$_, qw(Pre-Depends Standards-Version Installed-Size));
 
 $substvar{'Format'}= 1.5;
-$substvar{'newline'}= "\n";
-$substvar{'space'}= " ";
-$substvar{'tab'}= "\t";
+$substvar{'Newline'}= "\n";
+$substvar{'Space'}= " ";
+$substvar{'Tab'}= "\t";
+$maxsubsts=50;
 
 $progname= $0; $progname= $& if $progname =~ m,[^/]+$,;
 
@@ -18,16 +19,20 @@ sub findarch {
     $arch=`dpkg --print-architecture`;
     $? && &subprocerr("dpkg --print-archictecture");
     $arch =~ s/\n$//;
-    $substvar{'arch'}= $arch;
+    $substvar{'Arch'}= $arch;
 }
 
 sub substvars {
     my ($v) = @_;
-    my $lhs,$vn,$rhs;
+    my $lhs,$vn,$rhs,$count;
+    $count=0;
     while ($v =~ m/\$\{([-:0-9a-z]+)\}/i) {
+        $count < $maxsubsts ||
+            &error("too many substitutions - recursive ? - in \`$v'");
         $lhs=$`; $vn=$1; $rhs=$';
         if (defined($substvar{$vn})) {
             $v= $lhs.$substvar{$vn}.$rhs;
+            $count++;
         } else {
             &warn("unknown substitution variable \${$vn}");
             $v= $lhs.$rhs;
@@ -37,14 +42,14 @@ sub substvars {
 }
 
 sub outputclose {
-    for $f (keys %f) { $substvar{"f:$f"}= $f{$f}; }
+    for $f (keys %f) { $substvar{"F:$f"}= $f{$f}; }
     if (length($varlistfile)) {
         $varlistfile="./$varlistfile" if $varlistfile =~ m/\s/;
         if (open(SV,"< $varlistfile")) {
             while (<SV>) {
                 next if m/^\#/ || !m/\S/;
                 s/\s*\n$//;
-                m/^(\w+)\=/ ||
+                m/^(\w[-:0-9A-Za-z]*)\=/ ||
                     &error("bad line in substvars file $varlistfile at line $.");
                 $substvar{$1}= $';
             }
@@ -56,6 +61,7 @@ sub outputclose {
     for $f (sort { $fieldimps{$b} <=> $fieldimps{$a} } keys %f) {
         $v= $f{$f};
         $v= &substvars($v);
+        $v =~ m/\S/ || next; # delete whitespace-only fields
         $v =~ m/\n\S/ && &internerr("field $f has newline then non whitespace >$v<");
         $v =~ m/\n[ \t]*\n/ && &internerr("field $f has blank lines >$v<");
         $v =~ m/\n$/ && &internerr("field $f has trailing newline >$v<");
@@ -91,7 +97,7 @@ sub parsechangelog {
     }
     &parsecdata('L',0,"parsed version of changelog");
     close(CDATA); $? && &subprocerr("parse changelog");
-    $substvar{'sourceversion'}= $fi{"L Version"};
+    $substvar{'Source-Version'}= $fi{"L Version"};
 }
 
 

+ 1 - 0
scripts/dpkg-buildpackage.sh

@@ -18,6 +18,7 @@ Options:  -r<gain-root-command>
           -B         (binary-only, no arch-indep files)
           -us        (unsigned source)
           -uc        (unsigned changes)
+          -h         print this message
 END
 }
 

+ 2 - 1
scripts/dpkg-distaddfile.pl

@@ -18,8 +18,9 @@ Ian Jackson.  This is free software; see the GNU General Public Licence
 version 2 or later for copying conditions.  There is NO warranty.
 
 Usage:
-  dpkg-addfile <filename> <section> <priority>
+  dpkg-distaddfile <filename> <section> <priority>
 Options:  -f<fileslistfile>      write files here instead of debian/files
+          -h                     print this message
 ";
 }
 

+ 2 - 1
scripts/dpkg-genchanges.pl

@@ -37,6 +37,7 @@ Options:  -b                     binary-only build - no source files
           -T<varlistfile>        read variables here, not debian/substvars
           -D<field>=<value>      override or add a field and value
           -U<field>              remove a field
+          -h                     print this message
 ";
 }
 
@@ -70,7 +71,7 @@ while (@ARGV) {
         $override{$1}= $';
     } elsif (m/^-U([^\=:]+)$/) {
         $remove{$1}= 1;
-    } elsif (m/^-V(\w+)[=:]/) {
+    } elsif (m/^-V(\w[-:0-9A-Za-z]*)[=:]/) {
         $substvar{$1}= $';
     } elsif (m/^-h$/) {
         &usageversion; exit(0);

+ 37 - 2
scripts/dpkg-gencontrol.pl

@@ -7,6 +7,7 @@ $controlfile= 'debian/control';
 $changelogfile= 'debian/changelog';
 $fileslistfile= 'debian/files';
 $varlistfile= 'debian/substvars';
+$packagebuilddir= 'debian/tmp';
 
 use POSIX;
 use POSIX qw(:errno_h);
@@ -28,6 +29,8 @@ Options:  -p<package>            print control file for package
           -F<changelogformat>    force change log format
           -v<forceversion>       set version of binary package
           -f<fileslistfile>      write files here instead of debian/files
+          -P<packagebuilddir>    temporary build dir instead of debian/tmp
+          -O                     write to stdout, not .../DEBIAN/control
           -is                    include section field
           -ip                    include priority field
           -isp|-ips              include both section and priority
@@ -35,13 +38,14 @@ Options:  -p<package>            print control file for package
           -U<field>              remove a field
           -V<name>=<value>       set a substitution variable
           -T<varlistfile>        read variables here, not debian/substvars
+          -h                     print this message
 ";
 }
 
 $i=100;grep($fieldimps{$_}=$i--,
           qw(Package Version Section Priority Architecture Essential
              Pre-Depends Depends Recommends Suggests Optional Conflicts Replaces
-             Provides Maintainer Source Description));
+             Provides Installed-Size Maintainer Source Description));
 
 while (@ARGV) {
     $_=shift(@ARGV);
@@ -51,10 +55,14 @@ while (@ARGV) {
         $controlfile= $';
     } elsif (m/^-l/) {
         $changelogfile= $';
+    } elsif (m/^-P/) {
+        $packagebuilddir= $';
     } elsif (m/^-f/) {
         $fileslistfile= $';
     } elsif (m/^-v(.+)$/) {
         $forceversion= $1;
+    } elsif (m/^-O$/) {
+        $stdout= 1;
     } elsif (m/^-is$/) {
         $spinclude{'Section'}=1;
     } elsif (m/^-ip$/) {
@@ -68,7 +76,7 @@ while (@ARGV) {
         $override{$1}= $';
     } elsif (m/^-U([^\=:]+)$/) {
         $remove{$1}= 1;
-    } elsif (m/^-V(\w+)[=:]/) {
+    } elsif (m/^-V(\w[-:0-9A-Za-z]*)[=:]/) {
         $substvar{$1}= $';
     } elsif (m/^-T/) {
         $varlistfile= $';
@@ -173,6 +181,24 @@ if ($oppackage ne $sourcepackage || $verdiff) {
     $f{'Source'}.= " ($sourceversion)" if $verdiff;
 }
 
+if (!defined($substvar{'Installed-Size'})) {
+    defined($c= open(DU,"-|")) || &syserr("fork for du");
+    if (!$c) {
+        chdir("$packagebuilddir") || &syserr("chdir for du to \`$packagebuilddir'");
+        exec("du","-k","-s","."); &syserr("exec du");
+    }
+    $duo=''; while (<DU>) { $duo.=$_; }
+    close(DU); $? && &subprocerr("du in \`$packagebuilddir'");
+    $duo =~ m/^(\d+)\s+\.$/ || &failure("du gave unexpected output \`$duo'");
+    $substvar{'Installed-Size'}= $1;
+}
+if (defined($substvar{'Extra-Size'})) {
+    $substvar{'Installed-Size'} += $substvar{'Extra-Size'};
+}
+if (length($substvar{'Installed-Size'})) {
+    $f{'Installed-Size'}= $substvar{'Installed-Size'};
+}
+
 $fileslistfile="./$fileslistfile" if $fileslistfile =~ m/^\s/;
 open(Y,"> $fileslistfile.new") || &syserr("open new files list file");
 if (open(X,"< $fileslistfile")) {
@@ -194,7 +220,16 @@ rename("$fileslistfile.new",$fileslistfile) || &syserr("install new files list f
 for $f (keys %override) { $f{&capit($f)}= $override{$f}; }
 for $f (keys %remove) { delete $f{&capit($f)}; }
 
+if (!$stdout) {
+    $cf= "$packagebuilddir/DEBIAN/control";
+    $cf= "./$cf" if $cf =~ m/^\s/;
+    open(STDOUT,"> $cf.new") ||
+        &syserr("cannot open new output control file \`$cf.new'");
+}
 &outputclose;
+if (!$stdout) {
+    rename("$cf.new","$cf") || &syserr("cannot install output control file \`$cf'");
+}
 
 sub spfileslistvalue {
     $r= $spvalue{$_[0]};

+ 6 - 2
scripts/dpkg-parsechangelog.pl

@@ -20,8 +20,12 @@ sub usageversion {
 Ian Jackson.  This is free software; see the GNU General Public Licence
 version 2 or later for copying conditions.  There is NO warranty.
 
-Usage: dpkg-parsechangelog [-L<libdir>] [-F<format>] [-v<version>]
-                           [-lchangelogfile]
+Usage: dpkg-parsechangelog [<option> ...]
+Options:  -l<changelogfile>      get per-version info from this file
+          -v<sinceversion>       include all changes later than version
+          -F<changelogformat>    force change log format
+          -L<libdir>             look for change log parsers in <libdir>
+          -h                     print this message
 ";
 }
 

+ 198 - 0
scripts/dpkg-shlibdeps.pl

@@ -0,0 +1,198 @@
+#!/usr/bin/perl
+
+$dpkglibdir= ".";
+$version= '1.3.6'; # This line modified by Makefile
+
+use POSIX;
+use POSIX qw(:errno_h :signal_h);
+
+$shlibsoverride= '/etc/dpkg/shlibs.override';
+$shlibsdefault= '/etc/dpkg/shlibs.default';
+$shlibsppdir= '/var/lib/dpkg/info';
+$shlibsppext= '.shlibs';
+$varnameprefix= 'shlibs';
+$dependencyfield= 'Depends';
+$varlistfile= 'debian/substvars';
+
+@depfields= qw(Suggests Recommends Depends Pre-Depends);
+
+push(@INC,$dpkglibdir);
+require 'controllib.pl';
+
+sub usageversion {
+    print STDERR
+"Debian GNU/Linux dpkg-shlibdeps $version.  Copyright (C) 1996
+Ian Jackson.  This is free software; see the GNU General Public Licence
+version 2 or later for copying conditions.  There is NO warranty.
+
+Usage:
+  dpkg-shlibdeps [<option> ...] <executable>|-e<executable> [<option>] ...
+Positional arguments/options (order is significant):
+          <executable>           } include dependencies for <executable>
+          -e<executable>         }  (use -e if <executable> starts with \`-')
+          -d<dependencyfield>    next executable(s) set shlibs:<dependencyfield>
+Overall options (have global effect no matter where placed):
+          -p<varnameprefix>      set <varnameprefix>:* instead of shlibs:*.
+          -O                     print variable settings to stdout
+          -T<varlistfile>        update variables here, not debian/substvars
+Dependency fields recognised are ".join("/",@depfields)."
+";
+}
+
+$i=0; grep($depstrength{$_}= ++$i, @depfields);
+
+while (@ARGV) {
+    $_=shift(@ARGV);
+    if (m/^-T/) {
+        $varlistfile= $';
+    } elsif (m/^-p(\w[-:0-9A-Za-z]*)$/) {
+        $varnameprefix= $1;
+    } elsif (m/^-O$/) {
+        $stdout= 1;
+    } elsif (m/^-h$/) {
+        usageversion; exit(0);
+    } elsif (m/^-d/) {
+        $dependencyfield= capit($');
+        defined($depstrength{$dependencyfield}) ||
+            &warn("unrecognised dependency field \`$dependencyfield'");
+    } elsif (m/^-e/) {
+        push(@exec,$'); push(@execf,$dependencyfield);
+    } elsif (m/^-/) {
+        usageerr("unknown option \`$_'");
+    } else {
+        push(@exec,$_); push(@execf,$dependencyfield);
+    }
+}
+
+@exec || usageerr("need at least one executable");
+
+for ($i=0;$i<=$#exec;$i++) {
+    defined($c= open(P,"-|")) || syserr("cannot fork for ldd");
+    if (!$c) { exec("ldd","--",$exec[$i]); syserr("cannot exec ldd"); }
+    $nthisldd=0;
+    while (<P>) {
+        s/\n$//;
+        if (m,^\t(\S+)\.so\.(\S+) \=\> (/\S+)$,) {
+            push(@libname,$1); push(@libsoname,$2); push(@libpath,$3);
+            push(@libf,$execf[$i]);
+            push(@libpaths,$3) if !$libpathadded{$3}++;
+            $nthisldd++;
+        } else {
+            &warn("unknown output from ldd on \`$exec[$i]': \`$_'");
+        }
+    }
+    close(P); $? && subprocerr("ldd on \`$exec[$i]'");
+    $nthisldd || &warn("ldd on \`$exec[$i]' gave nothing on standard output");
+}
+
+grep(s/\[\?\*/\\$&/g, @libpaths);
+defined($c= open(P,"-|")) || syserr("cannot fork for dpkg --search");
+if (!$c) { exec("dpkg","--search","--",@libpaths); syserr("cannot exec dpkg"); }
+while (<P>) {
+    s/\n$//;
+    if (m/^local diversion |^diversion by/) {
+        &warn("diversions involved - output may be incorrect");
+        print(STDERR " $_\n") || syserr("write diversion info to stderr");
+    } elsif (m=^(\S+(, \S+)*): (/.+)$=) {
+        $pathpackages{$+}= $1;
+    } else {
+        &warn("unknown output from dpkg --search: \`$_'");
+    }
+}
+close(P); $? && subprocerr("dpkg --search");
+
+for ($i=0;$i<=$#libname;$i++) {
+    scanshlibsfile($shlibsoverride,$libname[$i],$libsoname[$i],$libf[$i]) && next;
+    if (!defined($pathpackages{$libpath[$i]})) {
+        &warn("could not find any packages for $libpath[$i]".
+              " ($libname[$i].so.$libsoname[$i])");
+    } else {
+        @packages= split(/, /,$pathpackages{$libpath[$i]});
+        for $p (@packages) {
+            scanshlibsfile("$shlibsppdir/$p$shlibsppext",
+                           $libname[$i],$libsoname[$i],$libf[$i]) && next;
+        }
+    }
+    scanshlibsfile($shlibsdefault,$libname[$i],$libsoname[$i],$libf[$i]) && next;
+    &warn("unable to find dependency information for ".
+          "shared library $libname[$i] (soname $libsoname[$i], path $libpath[$i], ".
+          "dependency field $libf[$i])");
+}
+
+sub scanshlibsfile {
+    my ($fn,$ln,$lsn,$lf) = @_;
+    my ($da,$dv,$dk);
+    $fn= "./$fn" if $fn =~ m/^\s/;
+    if (!open(SLF,"< $fn")) {
+        $! == ENOENT || syserr("unable to open shared libs info file \`$fn'");
+#print STDERR "scanshlibsfile($fn,$ln,$lsn,$lf) ... ENOENT\n";
+        return 0;
+    }
+#print STDERR "scanshlibsfile($fn,$ln,$lsn,$lf) ...\n";
+    while (<SLF>) {
+        s/\s*\n$//; next if m/^\#/;
+        if (!m/^\s*(\S+)\s+(\S+)/) {
+            &warn("shared libs info file \`$fn' line $.: bad line \`$_'");
+            next;
+        }
+        next if $1 ne $ln || $2 ne $lsn;
+        $da= $';
+        for $dv (split(/,/,$da)) {
+            $dv =~ s/^\s+//; $dv =~ s/\s+$//;
+            if (defined($depstrength{$lf})) {
+                if (!defined($predefdepfdep{$dv}) ||
+                    $depstrength{$predefdepfdep{$dv}} < $depstrength{$lf}) {
+                    $predefdepfdep{$dv}= $lf;
+                }
+            } else {
+                $dk= "$lf: $dv";
+                if (!defined($unkdepfdone{$dk})) {
+                    $unkdepfdone{$dk}= 1;
+                    $unkdepf{$lf}.= ', ' if length($unkdepf{$lf});
+                    $unkdepf{$lf}.= $dv;
+                }
+            }
+        }
+        return 1;
+    }
+    close(SLF);
+    return 0;
+}
+
+if (!$stdout) {
+    $varlistfile="./$varlistfile" if $fileslistfile =~ m/^\s/;
+    open(Y,"> $varlistfile.new") ||
+        syserr("open new substvars file \`$varlistfile.new'");
+    if (open(X,"< $varlistfile")) {
+        while (<X>) {
+            s/\n$//;
+            next if m/^(\w[-:0-9A-Za-z]*):/ && $1 eq $varnameprefix;
+            print(Y "$_\n") ||
+                syserr("copy old entry to new varlist file \`$varlistfile.new'");
+        }
+    } elsif ($! != ENOENT) {
+        syserr("open old varlist file \`$varlistfile' for reading");
+    }
+    $fh= 'Y';
+} else {
+    $fh= 'STDOUT';
+}
+for $dv (sort keys %predefdepfdep) {
+    $lf= $predefdepfdep{$dv};
+    $defdepf{$lf}.= ', ' if length($defdepf{$lf});
+    $defdepf{$lf}.= $dv;
+}
+for $lf (reverse @depfields) {
+    next unless defined($defdepf{$lf});
+    print($fh "$varnameprefix:$lf=$defdepf{$lf}\n")
+        || syserr("write output entry");
+}
+for $lf (sort keys %unkdepf) {
+    print($fh "$varnameprefix:$lf=$unkdepf{$lf}\n")
+        || syserr("write userdef output entry");
+}
+close($fh) || syserr("close output");
+if (!$stdout) {
+    rename("$varlistfile.new",$varlistfile) ||
+        syserr("install new varlist file \`$varlistfile'");
+}

+ 135 - 22
scripts/dpkg-source.1

@@ -15,6 +15,9 @@ dpkg\-buildpackage, dpkg\-distaddfile, dpkg\-parsechangelog
 .B dpkg-gencontrol
 .RI [ options ]
 .br
+.B dpkg-shlibdeps
+.IR options
+.br
 .B dpkg-genchanges
 .RI [ options ]
 .br
@@ -36,6 +39,19 @@ binary package control file on standard output; it also adds an entry
 for the binary package to
 .BR debian/files .
 
+.B dpkg-shlibdeps
+calculates shared library dependencies for executables named in its
+arguments.  The dependencies are added to the substitution
+variables file
+.B debian/substvars
+as variable names
+.BI shlibs: dependencyfield
+where
+.I dependencyfield
+is a dependency field name.  Any other variables starting
+.I shlibs:
+are removed from the file.
+
 .B dpkg-genchanges
 reads information from an unpacked and built Debian source tree and
 from the files it has generated and generates a Debian upload control
@@ -43,7 +59,7 @@ file
 .RB ( .changes " file)."
 
 .B dpkg-buildpackage
-Is a control script which can be used to help automate the building of
+is a control script which can be used to help automate the building of
 a package.
 
 .B dpkg-distaddfile
@@ -87,12 +103,14 @@ This option is understood by
 See below for a discussion of output substitution.
 .TP
 .BI -T substvarsfile
-Read substitution variables from
+Read (or, for
+.BR dpkg-shlibdeps ,
+write) substitution variables in
 .IR substvarsfile ;
 the default is
 .BR debian/substvars .
 This option is understood by
-.BR dpkg-source ", " dpkg-gencontrol " and " dpkg-genchanges .
+.BR dpkg-source ", " dpkg-gencontrol ", " dpkg-shlibdeps " and " dpkg-genchanges .
 .TP
 .BI -D field = value
 Override or add an output control file field.
@@ -196,6 +214,79 @@ file.
 .B -isp
 includes both fields,
 .BR -is " only the " Section " and " -ip " only the " Priority .
+.TP
+.BI -P packagebuilddir
+Tells
+.B dpkg-source
+that the package is being built in
+.I packagebuilddir
+instead of
+.BR debian/tmp .
+This value is used to find the default value of the
+.B Installed-Size
+substitution variable and control file field (using
+.BR du ),
+and for the default location of the output file.
+.TP
+.B -O
+Causes the control file to be printed to standard output, rather than
+to
+.B debian/tmp/DEBIAN/control
+(or
+.IB packagebuilddir /DEBIAN/control
+if
+.B -P
+was used).
+.SH DPKG-SHLIBDEPS OPTIONS
+.B dpkg-shlibdeps
+interprets non-option arguments as executable names, just as if they'd
+been supplied as
+.BI -e executable\fR.
+.TP
+.BI -e executable
+Include dependencies appropriate for the shared libraries required by
+.IR executable .
+.TP
+.BI -d dependencyfield
+Add dependencies to be added to the control file dependency field
+.IR dependencyfield .
+(The dependencies for this field are placed in the variable
+.BI shlibs: dependencyfield\fR.)
+
+The
+.BI -d dependencyfield
+option takes effect for all executables after the option, until the
+next
+.BI -d dependencyfield\fR.
+The default
+.I dependencyfield
+is
+.BR Depends .
+
+If the same dependency entry (or set of alternatives) appears in more
+than one of the recognised dependency field names
+.BR Pre-Depends ", " Depends ", " Recommends " or " Suggests
+then
+.B dpkg-shlibdeps
+will automatically remove the dependency from all fields except the
+one representing the most important dependencies.
+.TP
+.BI -p varnameprefix
+Causes substitution variables to start with
+.IB varnameprefix :
+instead of
+.BR shlib: .
+Likewise, any existing substitution variables starting with
+.IB varnameprefix :
+(rather than
+.BR shlib: )
+are removed from the the substitution variables file.
+.TP
+.B -O
+Causes the substitution variable settings to be printed to standard
+output, rather than being added to the substitution variables file
+.RB ( debian/substvars
+by default).
 .SH DPKG-GENCHANGES OPTIONS
 .B dpkg-gencontrol
 does not take any non-option arguments.
@@ -293,9 +384,10 @@ they perform some variable substitutions on the output file.
 
 A variable substitution has the form
 .BI ${ variable-name }\fR.
-Variable substitutions are performed repeatedly until none are left;
-the full text of the field after the substitution is rescanned to look
-for more substitutions.
+Variable names consist of alphanumerics, hyphens and colons and start
+with an alphanumeric.  Variable substitutions are performed repeatedly
+until none are left; the full text of the field after the substitution
+is rescanned to look for more substitutions.
 
 After all the substitutions have been done each occurence of the
 string
@@ -304,36 +396,52 @@ string
 .B $
 sign.
 
-Variables whose names consist entirely of alphanumerics can be set
-using the
+Variables can be set using the
 .B -V
-common option.
-
-They can be also specified in the file
+common option.  They can be also specified in the file
 .B debian/substvars
 (or whatever other file is specified using the
 .B -T
 option).  This file consists of lines of the form
-.IB name = value
-(where
-.B name
-is a string of alphanumerics).  Trailing whitespace on each line,
-blank lines, and lines starting with a
+.IB name = value\fR.
+Trailing whitespace on each line, blank lines, and
+lines starting with a
 .B #
 symbol (comments) are ignored.
 
 Additionally, the following standard variables are available:
 .TP
-.BI arch
+.BI Arch
 The current build architecture (from
 .BR "dpkg \-\-print-architecture" ).
 .TP
-.B sourceversion
+.B Source-Version
 The source package version (from the changelog file).
 .TP
-.BI f: fieldname
+.B Installed-Size
+The total size of the package's installed files.  This value is copied
+into the corresponding control file field; setting it will modify the
+value of that field.  If this variable isn't set
+.B dpkg-gencontrol
+will use
+.B du -k debian/tmp
+to find the default value.
+.TP
+.B Extra-Size
+Additional disk space used when the package is installed.  If this
+variable is set its value is added to that of the
+.B Installed-Size
+variable (whether set explicitly or using the default value) before it
+is copied into the
+.B Installed-Size
+control file field.
+.TP
+.BI F: fieldname
 The value of the output field
-.IR fieldname .
+.IR fieldname
+(which must be given in the canonical capitalisation).  Setting these
+variables has no effect other than on places where they are expanded
+explicitly.
 .TP
 .B Format
 The
@@ -345,9 +453,14 @@ field in the
 .B .changes
 file will change too.
 .TP
-.BR newline ", " space ", " tab
+.BR Newline ", " Space ", " Tab
 These variables each hold the corresponding character.
-
+.TP
+.BI shlibs: dependencyfield
+Variable settings with names of this form are generated by
+.B dpkg-shlibdeps
+- see above.
+.LP
 If a variable is referred to but not defined it generates a warning
 and an empty value is assumed.
 .SH FILES

+ 0 - 249
scripts/dpkg-source.8

@@ -1,249 +0,0 @@
-.\" Hey, Emacs!  This is an -*- nroff -*- source file.
-.\" Authors: Ian Jackson
-.TH DPKG\-SOURCE 8 "7th Auguest" "Debian Project" "Debian GNU/Linux manual"
-.SH NAME 
-dpkg\-source, dpkg\-genchanges, dpkg\-gencontrol,
-dpkg\-buildpackage, dpkg\-distaddfile, dpkg\-parsechangelog
-\- Debian source packaging tools
-.SH SYNOPSIS
-.B dpkg-deb
-.BR -b | --build
-.IR directory " [" archive | directory ]
-.br
-.B dpkg-deb
-.BR -I | --info
-.IR archive " [" control\-file\-name " ..]"
-.br
-.B dpkg-deb
-.BR -f | --field
-.IR archive " [" control\-field\-name " ...]"
-.br
-.B dpkg-deb
-.BR -c | --contents
-.I archive
-.br
-.B dpkg-deb
-.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, 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 --build ", " -b
-Creates a debian archive from the filesystem tree stored in
-.IR directory ".  " directory
-must have a
-.B DEBIAN
-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.
-
-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
-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.
-
-If the second argument is a directory then
-.B dpkg\-deb
-will write to the file
-.IB package _ version _ arch .deb\fR,
-or
-.IB package _ version .deb
-if no
-.B Architecture
-field is present in the package control file.  When a target directory
-is specified, rather than a file, the
-.B \-\-no\-check
-option may not be used (since
-.B dpkg\-deb
-needs to read and parse the package control file to determine which
-filename to use).
-.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.
-
-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.

+ 6 - 3
scripts/dpkg-source.pl

@@ -52,7 +52,7 @@ while (@ARGV && $ARGV[0] =~ m/^-/) {
         $override{$1}= $';
     } elsif (m/^-U([^\=:]+)$/) {
         $remove{$1}= 1;
-    } elsif (m/^-V(\w+)[=:]/) {
+    } elsif (m/^-V(\w[-:0-9A-Za-z]*)[=:]/) {
         $substvar{$1}= $';
     } elsif (m/^-T/) {
         $varlistfile= $';
@@ -76,9 +76,10 @@ if ($opmode eq 'build') {
     stat($dir) || &error("cannot stat directory $dir: $!");
     -d $dir || &error("directory argument $dir is not a directory");
 
-    $!=0; if (@ARGV) {
+    if (@ARGV) {
         $origdir= shift(@ARGV);
         if (length($origdir)) {
+            $origdir= "./$origdir" unless $origdir =~ m:^/:;
             stat($origdir) || &error("cannot find orig directory $origdir: $!");
             -d $origdir || &error("orig directory argument $origdir is not a directory");
         }
@@ -90,6 +91,7 @@ if ($opmode eq 'build') {
     } else {
         &error("tentative orig directory $dir.orig is not a directory");
     }
+print STDERR ">$dir|$origdir<\n";
 
     $changelogfile= "$dir/debian/changelog" unless defined($changelogfile);
     $controlfile= "$dir/debian/control" unless defined($controlfile);
@@ -204,7 +206,8 @@ if ($opmode eq 'build') {
     if (!$c2) {
         chdir($tardirbase) || &syserr("chdir to above (orig) source $tardirbase");
         open(STDOUT,">&GZIP") || &syserr("reopen gzip for tar");
-        exec('tar','-cO','--',$tardirname); &syserr("exec tar");
+        # FIXME: put `--' argument back when tar is fixed
+        exec('tar','-cO',$tardirname); &syserr("exec tar");
     }
     close(GZIP);
     &reapgzip;

+ 166 - 0
scripts/update-rc.d.new-pl

@@ -0,0 +1,166 @@
+#! /usr/bin/perl
+#
+# update-rc.d	Perl script to update links in /etc/rc?.d
+#
+# Usage:
+#		update-rc.d [-f] <basename> remove
+#		update-rc.d <basename> [options]
+#
+# Options are:
+#		start <codenumber> <runlevel> <runlevel> <runlevel> .
+#		stop  <codenumber> <runlevel> <runlevel> <runlevel> .
+#
+#		defaults [<codenumber> | <startcode> <stopcode>]
+#		(means       start <startcode> 2 3 4 5
+#		 as well as  stop  <stopcode>  0 1 2 3 4 5 6
+#		<codenumber> defaults to 20)
+#
+# Version:	@(#)update-rc.d  1.02  11-Jul-1996  miquels@cistron.nl
+#
+# Changes:      1.00 Wrote perl version directly derived from shell version.
+#		1.01 Fixed problem when dangling symlinks are found in
+#		     /etc/rc?.d/. The shell version just exits silently!
+#		1.02 More misc bugs fixed caused by sh -> perl translation
+#
+
+$version= '1.3.2'; # This line modified by Makefile
+
+chdir('/etc') || die "chdir /etc: $!\n";
+
+$initd='init.d';
+
+sub usage {
+  print STDERR <<EOF;
+Debian GNU/Linux update-rc.d $version.  Copyright (C) 1996 Miquel van
+Smoorenburg.  This is free software; see the GNU General Public Licence
+version 2 or later for copying conditions.  There is NO warranty.
+
+update-rc.d: error: @_
+usage: update-rc.d [-f] <basename> remove
+       update-rc.d <basename> defaults [<cn> | <scn> <kcn>]
+       update-rc.d <basename> start|stop <cn> <r> <r> .  ...
+EOF
+  &leave(1);
+}
+
+
+sub getinode {
+	local @tmp;
+
+	unless (@tmp = stat($_[0])) {
+		print STDERR "stat($_[0]): $!\n";
+		$tmp[1] = 0;
+	}
+	$tmp[1];
+}
+
+sub leave {
+	eval $atexit if ($atexit ne '');
+	exit($_[0]);
+}
+
+$force = 0;
+if ($ARGV[0] eq '-f') {
+	shift @ARGV;
+	$force = 1;
+}
+
+&usage("too few arguments") if ($#ARGV < 1);
+
+$bn = shift @ARGV;
+$action = shift @ARGV;
+
+if ($action eq 'remove') {
+	&usage("remove must be only action") if ($#ARGV > 0);
+	if (-f "$initd/$bn") {
+		unless ($force) {
+			print STDERR "update-rc.d: error: /etc/$initd/$bn exists during rc.d purge (use -f to force).\n";
+			&leave(1);
+		}
+	} else {
+		$atexit = "unlink('$initd/$bn');";
+	}
+	print  " Removing any system startup links to /etc/$initd/$bn ...\n";
+	open(FD, ">>$initd/$bn");
+	close FD;
+	$own = &getinode("$initd/$bn");
+	@files = split(/\s+/, `echo rc?.d/[SK]*`);
+	foreach $f (@files) {
+		$inode = &getinode($f);
+		if ($inode == $own) {
+			unless (unlink($f))  {
+				print STDERR "unlink($f): $!\n";
+				&leave(1);
+			}
+			print "   $f\n";
+		}
+	}
+	&leave(0);
+} elsif ($action eq 'defaults') {
+	if ($#ARGV < 0) {
+		$sn = $kn = 20;
+	} elsif ($#ARGV == 0) {
+		$sn = $kn = $ARGV[0];
+	} elsif ($#ARGV == 1) {
+		$sn = $ARGV[0];
+		$kn = $ARGV[1];
+	} else {
+		&usage("defaults takes only one or two codenumbers");
+	}
+	@ARGV = ('start', "$sn", '2', '3', '4', '5', 'stop',
+			  "$kn", '0', '1', '6');
+} elsif ($action ne 'start' && $action ne 'stop') {
+	&usage("unknown mode or add action $action");
+}
+
+unless (-f "$initd/$bn") {
+	print STDERR "update-rc.d: warning /etc/$initd/$bn doesn't exist during rc.d setup.\n";
+	exit(0);
+}
+
+$own = &getinode("$initd/$bn");
+
+@files = split(/\s+/, `echo rc?.d/[SK]*`);
+foreach $f (@files) {
+	$inode = &getinode($f);
+	if ($inode == $own) {
+		print STDERR " System startup links pointing to /etc/$initd/$bn already exist.\n";
+		exit(0);
+	}
+}
+
+
+print " Adding system startup links pointing to /etc/$initd/$bn ...\n";
+while ($#ARGV >= 1) {
+	if ($ARGV[0] eq 'start') {
+		$ks = 'S';
+	} elsif ($ARGV[0] eq 'stop') {
+		$ks = 'K';
+	} else {
+		&usage("unknown action $1");
+	}
+	shift @ARGV;
+	$number = shift @ARGV;
+	while ($#ARGV >= 0) {
+		$_ = $ARGV[0];
+		if (/^\.$/) {
+			shift @ARGV;
+			last;
+		} elsif (/^.$/) {
+			symlink("../$initd/$bn", "rc$_.d/$ks$number$bn") ||
+				die "symlink: $!\n";
+			print "   rc$_.d/$ks$number$bn -> ../$initd/$bn\n";
+			shift @ARGV;
+			next;
+		} elsif (/^(start|stop)$/) {
+			last;
+		}
+		&usage('runlevel is more than one character\n');
+	}
+}
+
+if ($#ARGV >= 0) {
+	&usage("surplus arguments, but not enough for an add action: @ARGV\n");
+}
+
+0;

+ 0 - 1
scripts/update-rc.d.pl

@@ -129,7 +129,6 @@ foreach $f (@files) {
 	}
 }
 
-
 print " Adding system startup links pointing to /etc/$initd/$bn ...\n";
 while ($#ARGV >= 1) {
 	if ($ARGV[0] eq 'start') {

+ 5 - 1
scripts/update-rc.d.old-sh

@@ -91,9 +91,13 @@ while [ $# -ge 3 ]; do
 			shift
 			continue
 			;;
+		*)
+			usage "runlevel is more than one character (forgotten \`.' ?)"
 		esac
-		usage 'runlevel is more than one character (forgotten . ?)'
 	done
+	if [ $# -eq 0 ]; then
+		usage "action with list of runlevels not terminated by \`.'"
+	fi
 	shift
 done
 

+ 1 - 1
version.h

@@ -1 +1 @@
-#define DPKG_VERSION "1.3.3" /* This line modified by Makefile */
+#define DPKG_VERSION "1.3.6" /* This line modified by Makefile */