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

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

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

Closes: #293280
Guillem Jover лет назад: 15
Родитель
Сommit
8561eeb482
5 измененных файлов с 20 добавлено и 3 удалено
  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.
     debian/rules.
   * Use the perl interpreter found by configure to call dpkg-architecture.pl
   * Use the perl interpreter found by configure to call dpkg-architecture.pl
     in the m4 DPKG_ARCHITECTURE macro.
     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
   * Fix possible segfault of dpkg in findbreakcycle(). LP: #733414
 
 
   [ Updated dpkg translations ]
   [ 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_vextract;
 action_func do_fsystarfile;
 action_func do_fsystarfile;
 
 
+extern int opt_verbose;
 extern int debugflag, nocheckflag, oldformatflag;
 extern int debugflag, nocheckflag, oldformatflag;
 
 
 void extracthalf(const char *debar, const char *dir,
 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
 int
 do_extract(const char *const *argv)
 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
 int
 do_vextract(const char *const *argv)
 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(_(
   printf(_(
 "Options:\n"
 "Options:\n"
 "  --showformat=<format>            Use alternative format for --show.\n"
 "  --showformat=<format>            Use alternative format for --show.\n"
+"  -v, --verbose                    Enable verbose output.\n"
 "  -D                               Enable debugging output.\n"
 "  -D                               Enable debugging output.\n"
 "  --old, --new                     Select archive format.\n"
 "  --old, --new                     Select archive format.\n"
 "  --nocheck                        Suppress control file check (build bad\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.");
      "Type dpkg --help for help about installing and deinstalling packages.");
 
 
 int debugflag=0, nocheckflag=0, oldformatflag=BUILDOLDPKGFORMAT;
 int debugflag=0, nocheckflag=0, oldformatflag=BUILDOLDPKGFORMAT;
+int opt_verbose = 0;
 struct compressor *compressor = &compressor_gzip;
 struct compressor *compressor = &compressor_gzip;
 int compress_level = -1;
 int compress_level = -1;
 
 
@@ -171,6 +173,7 @@ static const struct cmdinfo cmdinfos[]= {
   { "new",           0,   0, &oldformatflag, NULL,         NULL,          0 },
   { "new",           0,   0, &oldformatflag, NULL,         NULL,          0 },
   { "old",           0,   0, &oldformatflag, NULL,         NULL,          1 },
   { "old",           0,   0, &oldformatflag, NULL,         NULL,          1 },
   { "debug",         'D', 0, &debugflag,     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 },
   { "nocheck",       0,   0, &nocheckflag,   NULL,         NULL,          1 },
   { "compression",   'z', 1, NULL,           NULL,         set_compress_level },
   { "compression",   'z', 1, NULL,           NULL,         set_compress_level },
   { "compress_type", 'Z', 1, NULL,           NULL,         setcompresstype  },
   { "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"
 .BR \-X ", " \-\-vextract " \fIarchive directory\fP"
 Is like
 Is like
 .BR \-\-extract " (" \-x ")"
 .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
 .TP
 .BR \-\-fsys\-tarfile " \fIarchive\fP"
 .BR \-\-fsys\-tarfile " \fIarchive\fP"
 Extracts the filesystem tree data from a binary package and sends it
 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
 usual checks on the proposed contents of an archive. You can build
 any archive you want, no matter how broken, this way.
 any archive you want, no matter how broken, this way.
 .TP
 .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
 .BR \-D ", " \-\-debug
 Enables debugging output. This is not very interesting.
 Enables debugging output. This is not very interesting.
 .
 .