Selaa lähdekoodia

dpkg-deb: Add new --ctrl-tarfile command

This allows to easily extract the entire control member in tar format,
for further processing.
Guillem Jover 12 vuotta sitten
vanhempi
commit
03c0873bd7
5 muutettua tiedostoa jossa 32 lisäystä ja 2 poistoa
  1. 1 0
      debian/changelog
  2. 1 0
      dpkg-deb/dpkg-deb.h
  3. 17 0
      dpkg-deb/extract.c
  4. 2 0
      dpkg-deb/main.c
  5. 11 2
      man/dpkg-deb.1

+ 1 - 0
debian/changelog

@@ -9,6 +9,7 @@ dpkg (1.17.14) UNRELEASED; urgency=low
   * Disable unused run-time type information for dselect.
   * Disable unused run-time type information for dselect.
   * Fix compiler flag detection with non-GCC compilers in the build system.
   * Fix compiler flag detection with non-GCC compilers in the build system.
   * Fix perl warning on dpkg-source when typing Ctrl-D on patch name prompt.
   * Fix perl warning on dpkg-source when typing Ctrl-D on patch name prompt.
+  * Add new dpkg-deb --ctrl-tarfile command.
 
 
   [ Raphaël Hertzog ]
   [ Raphaël Hertzog ]
   * Explain better in deb-triggers(5) why interest/activate-noawait should be
   * Explain better in deb-triggers(5) why interest/activate-noawait should be

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

@@ -33,6 +33,7 @@ action_func do_field;
 action_func do_extract;
 action_func do_extract;
 action_func do_vextract;
 action_func do_vextract;
 action_func do_raw_extract;
 action_func do_raw_extract;
+action_func do_ctrltarfile;
 action_func do_fsystarfile;
 action_func do_fsystarfile;
 
 
 extern int opt_verbose;
 extern int opt_verbose;

+ 17 - 0
dpkg-deb/extract.c

@@ -376,6 +376,23 @@ extracthalf(const char *debar, const char *dir,
   }
   }
 }
 }
 
 
+int
+do_ctrltarfile(const char *const *argv)
+{
+  const char *debar;
+
+  debar = *argv++;
+  if (debar == NULL)
+    badusage(_("--%s needs a .deb filename argument"), cipaction->olong);
+  if (*argv)
+    badusage(_("--%s takes only one argument (.deb filename)"),
+             cipaction->olong);
+
+  extracthalf(debar, NULL, DPKG_TAR_PASSTHROUGH, 1);
+
+  return 0;
+}
+
 int
 int
 do_fsystarfile(const char *const *argv)
 do_fsystarfile(const char *const *argv)
 {
 {

+ 2 - 0
dpkg-deb/main.c

@@ -82,6 +82,7 @@ usage(const struct cmdinfo *cip, const char *value)
 "  -X|--vextract <deb> <directory>  Extract & list files.\n"
 "  -X|--vextract <deb> <directory>  Extract & list files.\n"
 "  -R|--raw-extract <deb> <directory>\n"
 "  -R|--raw-extract <deb> <directory>\n"
 "                                   Extract control info and files.\n"
 "                                   Extract control info and files.\n"
+"  --ctrl-tarfile <deb>             Output control tarfile.\n"
 "  --fsys-tarfile <deb>             Output filesystem tarfile.\n"
 "  --fsys-tarfile <deb>             Output filesystem tarfile.\n"
 "\n"));
 "\n"));
 
 
@@ -228,6 +229,7 @@ static const struct cmdinfo cmdinfos[]= {
   ACTION("extract",       'x', 0, do_extract),
   ACTION("extract",       'x', 0, do_extract),
   ACTION("vextract",      'X', 0, do_vextract),
   ACTION("vextract",      'X', 0, do_vextract),
   ACTION("raw-extract",   'R', 0, do_raw_extract),
   ACTION("raw-extract",   'R', 0, do_raw_extract),
+  ACTION("ctrl-tarfile",  0,   0, do_ctrltarfile),
   ACTION("fsys-tarfile",  0,   0, do_fsystarfile),
   ACTION("fsys-tarfile",  0,   0, do_fsystarfile),
   ACTION("show",          'W', 0, do_showinfo),
   ACTION("show",          'W', 0, do_showinfo),
 
 

+ 11 - 2
man/dpkg-deb.1

@@ -3,7 +3,7 @@
 .\" Copyright © 1995-1996 Ian Jackson <ian@chiark.chu.cam.ac.uk>
 .\" Copyright © 1995-1996 Ian Jackson <ian@chiark.chu.cam.ac.uk>
 .\" Copyright © 1999 Wichert Akkerman <wakkerma@debian.org>
 .\" Copyright © 1999 Wichert Akkerman <wakkerma@debian.org>
 .\" Copyright © 2006 Frank Lichtenheld <djpig@debian.org>
 .\" Copyright © 2006 Frank Lichtenheld <djpig@debian.org>
-.\" Copyright © 2007-2012 Guillem Jover <guillem@debian.org>
+.\" Copyright © 2007-2014 Guillem Jover <guillem@debian.org>
 .\"
 .\"
 .\" This is free software; you can redistribute it and/or modify
 .\" This is free software; you can redistribute it and/or modify
 .\" it under the terms of the GNU General Public License as published by
 .\" it under the terms of the GNU General Public License as published by
@@ -18,7 +18,7 @@
 .\" You should have received a copy of the GNU General Public License
 .\" You should have received a copy of the GNU General Public License
 .\" along with this program.  If not, see <https://www.gnu.org/licenses/>.
 .\" along with this program.  If not, see <https://www.gnu.org/licenses/>.
 .
 .
-.TH dpkg\-deb 1 "2013-03-27" "Debian Project" "dpkg suite"
+.TH dpkg\-deb 1 "2014-08-20" "Debian Project" "dpkg suite"
 .SH NAME
 .SH NAME
 dpkg\-deb \- Debian package archive (.deb) manipulation tool
 dpkg\-deb \- Debian package archive (.deb) manipulation tool
 .
 .
@@ -170,6 +170,15 @@ of the specified directory.
 
 
 The target directory (but not its parents) will be created if necessary.
 The target directory (but not its parents) will be created if necessary.
 .TP
 .TP
+.BR \-\-ctrl\-tarfile " \fIarchive\fP"
+Extracts the control data from a binary package and sends it to standard
+output in
+.B tar
+format. Together with
+.BR tar (1)
+this can be used to extract a particular control file from a package archive.
+The input archive will always be processed sequentially.
+.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
 to standard output in
 to standard output in