Przeglądaj źródła

dpkg-deb: Add new -v, --verbose option

Change --extract to honour --verbose and behave as --vextract.

Closes: #293280
Guillem Jover 15 lat temu
rodzic
commit
8561eeb482
5 zmienionych plików z 20 dodań i 3 usunięć
  1. 2 0
      debian/changelog
  2. 1 0
      dpkg-deb/dpkg-deb.h
  3. 7 2
      dpkg-deb/extract.c
  4. 3 0
      dpkg-deb/main.c
  5. 7 1
      man/dpkg-deb.1

+ 2 - 0
debian/changelog

@@ -175,6 +175,8 @@ dpkg (1.16.1) UNRELEASED; urgency=low
     debian/rules.
   * Use the perl interpreter found by configure to call dpkg-architecture.pl
     in the m4 DPKG_ARCHITECTURE macro.
+  * Add new --verbose option to dpkg-deb and change --extract to honour it.
+    Closes: #293280
   * Fix possible segfault of dpkg in findbreakcycle(). LP: #733414
 
   [ Updated dpkg translations ]

+ 1 - 0
dpkg-deb/dpkg-deb.h

@@ -31,6 +31,7 @@ action_func do_extract;
 action_func do_vextract;
 action_func do_fsystarfile;
 
+extern int opt_verbose;
 extern int debugflag, nocheckflag, oldformatflag;
 
 void extracthalf(const char *debar, const char *dir,

+ 7 - 2
dpkg-deb/extract.c

@@ -377,11 +377,16 @@ do_control(const char *const *argv)
 int
 do_extract(const char *const *argv)
 {
-  return controlextractvextract(0, "xp", argv);
+  if (opt_verbose)
+    return controlextractvextract(0, "xpv", argv);
+  else
+    return controlextractvextract(0, "xp", argv);
 }
 
 int
 do_vextract(const char *const *argv)
 {
-  return controlextractvextract(0, "xpv", argv);
+  /* XXX: Backward compatibility. */
+  opt_verbose = 1;
+  return do_extract(argv);
 }

+ 3 - 0
dpkg-deb/main.c

@@ -96,6 +96,7 @@ usage(const struct cmdinfo *cip, const char *value)
   printf(_(
 "Options:\n"
 "  --showformat=<format>            Use alternative format for --show.\n"
+"  -v, --verbose                    Enable verbose output.\n"
 "  -D                               Enable debugging output.\n"
 "  --old, --new                     Select archive format.\n"
 "  --nocheck                        Suppress control file check (build bad\n"
@@ -130,6 +131,7 @@ static const char printforhelp[] =
      "Type dpkg --help for help about installing and deinstalling packages.");
 
 int debugflag=0, nocheckflag=0, oldformatflag=BUILDOLDPKGFORMAT;
+int opt_verbose = 0;
 struct compressor *compressor = &compressor_gzip;
 int compress_level = -1;
 
@@ -171,6 +173,7 @@ static const struct cmdinfo cmdinfos[]= {
   { "new",           0,   0, &oldformatflag, NULL,         NULL,          0 },
   { "old",           0,   0, &oldformatflag, NULL,         NULL,          1 },
   { "debug",         'D', 0, &debugflag,     NULL,         NULL,          1 },
+  { "verbose",       'v', 0, &opt_verbose,   NULL,         NULL,          1 },
   { "nocheck",       0,   0, &nocheckflag,   NULL,         NULL,          1 },
   { "compression",   'z', 1, NULL,           NULL,         set_compress_level },
   { "compress_type", 'Z', 1, NULL,           NULL,         setcompresstype  },

+ 7 - 1
man/dpkg-deb.1

@@ -139,7 +139,9 @@ modified to match the contents of the package.
 .BR \-X ", " \-\-vextract " \fIarchive directory\fP"
 Is like
 .BR \-\-extract " (" \-x ")"
-but prints a listing of the files extracted as it goes.
+with
+.BR \-\-verbose " (" \-v ")"
+which prints a listing of the files extracted as it goes.
 .TP
 .BR \-\-fsys\-tarfile " \fIarchive\fP"
 Extracts the filesystem tree data from a binary package and sends it
@@ -213,6 +215,10 @@ Inhibits
 usual checks on the proposed contents of an archive. You can build
 any archive you want, no matter how broken, this way.
 .TP
+.BR \-v ", " \-\-verbose
+Enables verbose output. This currently only affects \fB\-\-extract\fP making
+it behave like \fB\-\-vextract\fP.
+.TP
 .BR \-D ", " \-\-debug
 Enables debugging output. This is not very interesting.
 .