The following commit has been merged in the master branch: commit 02c28c63a34e252d75f893cb0869f9480f603822 Author: Guillem Jover <guil...@debian.org> Date: Tue Apr 26 07:35:16 2011 +0200
dpkg-deb: Add --raw-extract option combining --control and --extract This allows to extract the control and file system members of a .deb into a single directory using the same layout dpkg-deb -b expects for building a package. Closes: #552123 diff --git a/debian/changelog b/debian/changelog index 255790c..1b72f8e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -177,6 +177,8 @@ dpkg (1.16.1) UNRELEASED; urgency=low in the m4 DPKG_ARCHITECTURE macro. * Add new --verbose option to dpkg-deb and change --extract to honour it. Closes: #293280 + * Add new --raw-extract option to dpkg-deb combining --control and + --extract. Closes: #552123 * Fix possible segfault of dpkg in findbreakcycle(). LP: #733414 [ Updated dpkg translations ] diff --git a/dpkg-deb/dpkg-deb.h b/dpkg-deb/dpkg-deb.h index fb96742..1605967 100644 --- a/dpkg-deb/dpkg-deb.h +++ b/dpkg-deb/dpkg-deb.h @@ -29,6 +29,7 @@ action_func do_info; action_func do_field; action_func do_extract; action_func do_vextract; +action_func do_raw_extract; action_func do_fsystarfile; extern int opt_verbose; diff --git a/dpkg-deb/extract.c b/dpkg-deb/extract.c index 7e1ba96..f80955e 100644 --- a/dpkg-deb/extract.c +++ b/dpkg-deb/extract.c @@ -390,3 +390,35 @@ do_vextract(const char *const *argv) opt_verbose = 1; return do_extract(argv); } + +int +do_raw_extract(const char *const *argv) +{ + const char *debar, *dir; + char *control_dir; + + debar = *argv++; + if (debar == NULL) + badusage(_("--%s needs a .deb filename argument"), cipaction->olong); + + dir = *argv++; + if (dir == NULL) + badusage(_("--%s needs a target directory.\n" + "Perhaps you should be using dpkg --install ?"), + cipaction->olong); + else if (*argv) + badusage(_("--%s takes at most two arguments (.deb and directory)"), + cipaction->olong); + + m_asprintf(&control_dir, "%s/%s", dir, EXTRACTCONTROLDIR); + + if (opt_verbose) + extracthalf(debar, dir, "xpv", 0); + else + extracthalf(debar, dir, "xp", 0); + extracthalf(debar, control_dir, "x", 1); + + free(control_dir); + + return 0; +} diff --git a/dpkg-deb/main.c b/dpkg-deb/main.c index fb2fd06..88f765c 100644 --- a/dpkg-deb/main.c +++ b/dpkg-deb/main.c @@ -79,6 +79,8 @@ usage(const struct cmdinfo *cip, const char *value) " -e|--control <deb> [<directory>] Extract control info.\n" " -x|--extract <deb> <directory> Extract files.\n" " -X|--vextract <deb> <directory> Extract & list files.\n" +" -R|--raw-extract <deb> <directory>\n" +" Extract control info and files.\n" " --fsys-tarfile <deb> Output filesystem tarfile.\n" "\n")); @@ -167,6 +169,7 @@ static const struct cmdinfo cmdinfos[]= { ACTION("field", 'f', 0, do_field), ACTION("extract", 'x', 0, do_extract), ACTION("vextract", 'X', 0, do_vextract), + ACTION("raw-extract", 'R', 0, do_raw_extract), ACTION("fsys-tarfile", 0, 0, do_fsystarfile), ACTION("show", 'W', 0, do_showinfo), diff --git a/man/dpkg-deb.1 b/man/dpkg-deb.1 index 4afc326..bd13e56 100644 --- a/man/dpkg-deb.1 +++ b/man/dpkg-deb.1 @@ -143,6 +143,13 @@ with .BR \-\-verbose " (" \-v ")" which prints a listing of the files extracted as it goes. .TP +.BR \-R ", " \-\-raw\-extract " \fIarchive directory\fP" +Extracts the filesystem tree from a package archive into a specified +directory, and the control information files into a DEBIAN subdirectory +of the specified directory. + +The target directory (but not its parents) will be created if necessary. +.TP .BR \-\-fsys\-tarfile " \fIarchive\fP" Extracts the filesystem tree data from a binary package and sends it to standard output in -- dpkg's main repository -- To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org