Przeglądaj źródła

dpkg (1.3.9) unstable; urgency=low (high for new source format)

  * dpkg --get-selections and --set-selections added.
  * New dpkg --force-not-root flag.

  * Don't replace directory with another package's file.  (Bug#4202.)

  * All manpages now installed compressed.
  * Copyright file moved to /usr/doc/dpkg/copyright.
  * Standards-Version updated (0.2.1.1).

 -- Ian Jackson <ian@chiark.chu.cam.ac.uk>  Sat, 24 Aug 1996 19:09:30 +0100
Ian Jackson 30 lat temu
rodzic
commit
7ee3463b07
18 zmienionych plików z 224 dodań i 27472 usunięć
  1. 13 0
      debian/changelog
  2. 1 1
      debian/control
  3. 3 2
      debian/rules
  4. 6 0
      doc/changelog
  5. 2 2
      doc/manuals-version
  6. 0 3415
      doc/policy.sasp
  7. 0 4222
      doc/policy.sasp-lout
  8. 0 8795
      doc/programmer.sasp
  9. 0 11025
      doc/programmer.sasp-lout
  10. 12 0
      doc/programmer.sgml
  11. 2 2
      main/Makefile.in
  12. 10 3
      main/archives.c
  13. 2 2
      main/enquiry.c
  14. 9 0
      main/main.c
  15. 12 1
      main/main.h
  16. 4 1
      main/packages.c
  17. 147 0
      main/select.c
  18. 1 1
      version.h

+ 13 - 0
debian/changelog

@@ -1,3 +1,16 @@
+dpkg (1.3.9) unstable; urgency=low (high for new source format)
+
+  * dpkg --get-selections and --set-selections added.
+  * New dpkg --force-not-root flag.
+
+  * Don't replace directory with another package's file.  (Bug#4202.)
+
+  * All manpages now installed compressed.
+  * Copyright file moved to /usr/doc/dpkg/copyright.
+  * Standards-Version updated (0.2.1.1).
+
+ -- Ian Jackson <ian@chiark.chu.cam.ac.uk>  Sat, 24 Aug 1996 19:09:30 +0100
+
 dpkg (1.3.8) unstable; urgency=low (high for new source format)
 
   * dpkg-buildpackage -sa, -si options work correctly.

+ 1 - 1
debian/control

@@ -2,7 +2,7 @@ Source: dpkg
 Section: base
 Priority: required
 Maintainer: Ian Jackson <ian@chiark.chu.cam.ac.uk>
-Standards-Version: 0.1
+Standards-Version: 0.2.1.1
 
 Package: dpkg
 Architecture: any

+ 3 - 2
debian/rules

@@ -44,9 +44,10 @@ binary-arch:	checkroot build
 		datadir=$(DIR)/debian/tmp/var/lib/dpkg \
 		etcdir=$(DIR)/debian/tmp/etc \
 		install
-	cp debian/copyright debian/tmp/usr/doc/copyright/dpkg
-	cp TODO debian/tmp/usr/doc/dpkg/WISHLIST
+	find debian/tmp/usr/man -type f | xargs gzip -9v
 	gzip -9v debian/tmp/usr/doc/dpkg/changelog.*
+	cp debian/copyright debian/tmp/usr/doc/dpkg/copyright
+	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

+ 6 - 0
doc/changelog

@@ -1,3 +1,9 @@
+debian-manuals (0.2.1.1) unstable;
+
+  * Can't overwrite directories in one package with files in another.
+
+ -- Ian Jackson <ian@chiark.chu.cam.ac.uk>  Sat, 24 Aug 1996 18:44:54 +0100
+
 debian-manuals (0.2.1.0) unstable;
 
   * Policy says when and how to include original source in upload.

+ 2 - 2
doc/manuals-version

@@ -1,2 +1,2 @@
-<!entity manuals-version "0.2.0.0">
-<!entity dpkg-version "1.3.7">
+<!entity manuals-version "0.2.1.1">
+<!entity dpkg-version "1.3.9">

Plik diff jest za duży
+ 0 - 3415
doc/policy.sasp


Plik diff jest za duży
+ 0 - 4222
doc/policy.sasp-lout


Plik diff jest za duży
+ 0 - 8795
doc/programmer.sasp


Plik diff jest za duży
+ 0 - 11025
doc/programmer.sasp-lout


+ 12 - 0
doc/programmer.sgml

@@ -2000,12 +2000,24 @@ enabled, downgrading it to a warning, but this may not always be the
 case.
 <p>
 
+It is a more serious error for a package to contain a plain file or
+other kind of nondirectory where another package has a directory
+(again, unless <tt/Replaces/ is used).  This error can be overridden
+if desired using <tt/--force-overwrite-dir/, but this is not -->
+--advisable.
+<p>
+
 Packages which overwrite each other's files produce behaviour which
 though deterministic is hard for the system administrator to
 understand.  It can easily lead to `missing' programs if, for example,
 a package is installed which overwrites a file from another package,
 and is then removed again.<footnote>Part of the problem is due to what
 is arguably a bug in <prgn/dpkg/.</footnote>
+<p>
+
+A directory will never be replaced by a symbolic links to a directory
+or vice versa; instead, the existing state (symlink or not) will be
+left alone and <prgn/dpkg/ will follow the symlink if there is one.
 
 <item>
 

+ 2 - 2
main/Makefile.in

@@ -26,10 +26,10 @@ mandir = $(prefix)/man
 man8dir = $(mandir)/man8
 man8 = 8
 
-SRC = main.c enquiry.c filesdb.c archives.c processarc.c cleanup.c \
+SRC = main.c enquiry.c filesdb.c archives.c processarc.c cleanup.c select.c \
       packages.c configure.c remove.c help.c depcon.c errors.c update.c
 
-OBJ = main.o enquiry.o filesdb.o archives.o processarc.o cleanup.o \
+OBJ = main.o enquiry.o filesdb.o archives.o processarc.o cleanup.o select.o \
       packages.o configure.o remove.o help.o depcon.o errors.o update.o
 
 INSTALL = @INSTALL@

+ 10 - 3
main/archives.c

@@ -350,9 +350,15 @@ int tarobject(struct TarInfo *ti) {
           printf("Replacing files in old package %s ...\n",otherpkg->name);
           otherpkg->clientdata->replacingfilesandsaid= 1;
         } else {
-          forcibleerr(fc_overwrite,
-                      "trying to overwrite `%.250s', which is also in package %.250s",
-                      nifd->namenode->name,otherpkg->name);
+          if (S_ISDIR(stab.st_mode)) {
+            forcibleerr(fc_overwritedir, "trying to overwrite directory `%.250s' "
+                        "in package %.250s with nondirectory",
+                        nifd->namenode->name,otherpkg->name);
+          } else {
+            forcibleerr(fc_overwrite,
+                        "trying to overwrite `%.250s', which is also in package %.250s",
+                        nifd->namenode->name,otherpkg->name);
+          }
         }
       }
     }
@@ -747,6 +753,7 @@ void archivefiles(const char *const *argv) {
   modstatdb_init(admindir,
                  f_noact ?                     msdbrw_readonly
                : cipaction->arg == act_avail ? msdbrw_write
+               : fc_nonroot ?                  msdbrw_write
                :                               msdbrw_needsuperuser);
 
   currenttime= time(0);

+ 2 - 2
main/enquiry.c

@@ -36,7 +36,7 @@
 #include "filesdb.h"
 #include "main.h"
 
-static int listqcmp(const void *a, const void *b) {
+int pkglistqsortcmp(const void *a, const void *b) {
   struct pkginfo *pa= *(struct pkginfo**)a;
   struct pkginfo *pb= *(struct pkginfo**)b;
   return strcmp(pa->name,pb->name);
@@ -100,7 +100,7 @@ void listpackages(const char *const *argv) {
   iterpkgend(it);
   assert(i==np);
 
-  qsort(pkgl,np,sizeof(struct pkginfo*),listqcmp);
+  qsort(pkgl,np,sizeof(struct pkginfo*),pkglistqsortcmp);
   head=0;
   
   if (!*argv) {

+ 9 - 0
main/main.c

@@ -60,6 +60,8 @@ Usage: \n\
   " DPKG " -A|--record-avail <.deb file name> ... | -R|--recursive <dir> ...\n\
   " DPKG " --configure           <package name> ... | -a|--pending\n\
   " DPKG " -r|--remove | --purge <package name> ... | -a|--pending\n\
+  " DPKG " --get-selections [<pattern> ...]   get list of selections to stdout\n\
+  " DPKG " --set-selections                   set package selections from stdin\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\
@@ -125,6 +127,7 @@ unsigned long f_debug=0;
 int fc_downgrade=1, fc_configureany=0, fc_hold=0, fc_removereinstreq=0, fc_overwrite=1;
 int fc_removeessential=0, fc_conflicts=0, fc_depends=0, fc_dependsversion=0;
 int fc_autoselect=1, fc_badpath=0, fc_overwritediverted=0, fc_architecture=0;
+int fc_nonroot=0, fc_overwritedir=0;
 
 const char *admindir= ADMINDIR;
 const char *instdir= "";
@@ -144,8 +147,10 @@ static const struct forceinfo {
   { "depends-version",     &fc_dependsversion           },
   { "auto-select",         &fc_autoselect               },
   { "bad-path",            &fc_badpath                  },
+  { "not-root",            &fc_nonroot                  },
   { "overwrite",           &fc_overwrite                },
   { "overwrite-diverted",  &fc_overwritediverted        },
+  { "overwrite-dir",       &fc_overwritedir             },
   { "architecture",        &fc_architecture             },
   {  0                                                  }
 };
@@ -243,12 +248,14 @@ 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\
+  not-root               Try to (de)install things even when not root\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\
   conflicts [!]          Allow installation of conflicting packages\n\
   architecture [!]       Process even packages with wrong architecture\n\
+  overwrite-dir [!]      Overwrite one package's directory with another's file\n\
   remove-reinstreq [!]   Remove packages which require installation\n\
   remove-essential [!]   Remove an essential package\n\
 \n\
@@ -294,6 +301,8 @@ static const struct cmdinfo cmdinfos[]= {
   ACTION( "purge",                           0,  act_purge,         packages        ),
   ACTION( "listfiles",                      'L', act_listfiles,     enqperpackage   ),
   ACTION( "status",                         's', act_status,        enqperpackage   ),
+  ACTION( "get-selections",                  0,  act_getselections, getselections   ),
+  ACTION( "set-selections",                  0,  act_setselections, setselections   ),
   ACTION( "print-avail",                     0,  act_printavail,    enqperpackage   ),
   ACTION( "update-avail",                    0,  act_avreplace,     updateavailable ),
   ACTION( "merge-avail",                     0,  act_avmerge,       updateavailable ),

+ 12 - 1
main/main.h

@@ -53,7 +53,7 @@ enum action { act_unset, act_install, act_unpack, act_avail, act_configure,
               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_forgetold };
+              act_forgetold, act_getselections, act_setselections };
 
 enum conffopt {
   cfof_prompt        =     001,
@@ -82,6 +82,7 @@ extern unsigned long f_debug;
 extern int fc_downgrade, fc_configureany, fc_hold, fc_removereinstreq, fc_overwrite;
 extern int fc_removeessential, fc_conflicts, fc_depends, fc_dependsversion;
 extern int fc_autoselect, fc_badpath, fc_overwritediverted, fc_architecture;
+extern int fc_nonroot, fc_overwritedir;
 
 extern const char *admindir;
 extern const char *instdir;
@@ -115,6 +116,16 @@ void printarch(const char *const *argv);
 void printinstarch(const char *const *argv);
 void cmpversions(const char *const *argv);
 
+/* Intended for use as a comparison function for qsort when
+ * sorting an array of pointers to struct pkginfo:
+ */
+int pkglistqsortcmp(const void *a, const void *b);
+
+/* from select.c */
+
+void getselections(const char *const *argv);
+void setselections(const char *const *argv);
+
 /* from packages.c, remove.c and configure.c */
 
 void add_to_queue(struct pkginfo *pkg);

+ 4 - 1
main/packages.c

@@ -68,7 +68,10 @@ void packages(const char *const *argv) {
   int l;
   
   checkpath();
-  modstatdb_init(admindir, f_noact ? msdbrw_readonly : msdbrw_needsuperuser);
+  modstatdb_init(admindir,
+                 f_noact ?    msdbrw_readonly
+               : fc_nonroot ? msdbrw_write
+               :              msdbrw_needsuperuser);
 
   if (f_pending) {
 

+ 147 - 0
main/select.c

@@ -0,0 +1,147 @@
+/*
+ * dpkg - main program for package management
+ * select.c - by-hand (rather than dselect-based) package selection
+ *
+ * Copyright (C) 1995,1996 Ian Jackson <ijackson@gnu.ai.mit.edu>
+ *
+ * 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 Software Foundation; either version 2,
+ * or (at your option) any later version.
+ *
+ * This is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with dpkg; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+#include <fnmatch.h>
+#include <ctype.h>
+
+#include "config.h"
+#include "dpkg.h"
+#include "dpkg-db.h"
+#include "myopt.h"
+
+#include "filesdb.h"
+#include "main.h"
+
+static void getsel1package(struct pkginfo *pkg) {
+  int l;
+
+  if (pkg->want == want_unknown) return;
+  l= strlen(pkg->name); l >>= 3; l= 6-l; if (l<1) l=1;
+  printf("%s%.*s%s\n",pkg->name,l,"\t\t\t\t\t\t",wantinfos[pkg->want].name);
+}         
+
+void getselections(const char *const *argv) {
+  struct pkgiterator *it;
+  struct pkginfo *pkg;
+  struct pkginfo **pkgl;
+  const char *thisarg;
+  int np, i, head, found;
+
+  modstatdb_init(admindir,msdbrw_readonly);
+
+  np= countpackages();
+  pkgl= m_malloc(sizeof(struct pkginfo*)*np);
+  it= iterpkgstart(); i=0;
+  while ((pkg= iterpkgnext(it))) {
+    assert(i<np);
+    pkgl[i++]= pkg;
+  }
+  iterpkgend(it);
+  assert(i==np);
+
+  qsort(pkgl,np,sizeof(struct pkginfo*),pkglistqsortcmp);
+  head=0;
+  
+  if (!*argv) {
+    for (i=0; i<np; i++) {
+      pkg= pkgl[i];
+      if (pkg->status == stat_notinstalled) continue;
+      getsel1package(pkg);
+    }
+  } else {
+    while ((thisarg= *argv++)) {
+      found= 0;
+      for (i=0; i<np; i++) {
+        pkg= pkgl[i];
+        if (fnmatch(thisarg,pkg->name,0)) continue;
+        getsel1package(pkg); found++;
+      }
+      if (!found)
+        fprintf(stderr,"No packages found matching %s.\n",thisarg);
+    }
+  }
+  if (ferror(stdout)) werr("stdout");
+  if (ferror(stderr)) werr("stderr");
+}
+
+void setselections(const char *const *argv) {
+  const struct namevalue *nvp;
+  struct pkginfo *pkg;
+  const char *e;
+  int c, lno;
+  struct varbuf namevb;
+  struct varbuf selvb;
+
+  if (*argv) badusage("--set-selections does not take any argument");
+
+  modstatdb_init(admindir,msdbrw_write);
+
+  varbufinit(&namevb);
+  varbufinit(&selvb);
+  lno= 1;
+  for (;;) {
+    varbufreset(&namevb);
+    varbufreset(&selvb);
+    do { c= getchar(); if (c == '\n') lno++; } while (c != EOF && isspace(c));
+    if (c == EOF) break;
+    if (c == '#') {
+      do { c= getchar(); if (c == '\n') lno++; } while (c != EOF && c != '\n');
+      continue;
+    }
+    while (!isspace(c)) {
+      varbufaddc(&namevb,c);
+      c= getchar();
+      if (c == EOF) ohshit("unexpected eof in package name at line %d",lno);
+      if (c == '\n') ohshit("unexpected end of line in package name at line %d",lno);
+    }
+    while (c != EOF && isspace(c)) {
+      c= getchar();
+      if (c == EOF) ohshit("unexpected eof after package name at line %d",lno);
+      if (c == '\n') ohshit("unexpected end of line after package name at line %d",lno);
+    }
+    while (c != EOF && !isspace(c)) {
+      varbufaddc(&selvb,c);
+      c= getchar();
+    }
+    while (c != EOF && c != '\n') {
+      c= getchar();
+      if (!isspace(c))
+        ohshit("unexpected data after package and selection at line %d",lno);
+    }
+    varbufaddc(&namevb,0);
+    varbufaddc(&selvb,0);
+    e= illegal_packagename(namevb.buf,0);
+    if (e) ohshit("illegal package name at line %d: %.250s",lno,e);
+    for (nvp=wantinfos; nvp->name && strcmp(nvp->name,selvb.buf); nvp++);
+    if (!nvp->name) ohshit("unknown wanted status at line %d: %.250s",lno,selvb.buf);
+    pkg= findpackage(namevb.buf);
+    pkg->want= nvp->value;
+    if (c == EOF) break;
+    lno++;
+  }
+  if (ferror(stdin)) ohshite("read error on standard input");
+  modstatdb_shutdown();
+  varbufreset(&namevb);
+  varbufreset(&selvb);
+}

+ 1 - 1
version.h

@@ -1 +1 @@
-#define DPKG_VERSION "1.3.7" /* This line modified by Makefile */
+#define DPKG_VERSION "1.3.9" /* This line modified by Makefile */