summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillem Jover <guillem@debian.org>2014-12-16 18:25:29 +0100
committerGuillem Jover <guillem@debian.org>2015-02-11 04:42:41 +0100
commitd3d8d778d7e00eceb0073123caf6ca718ae9e82c (patch)
treed35a5b1f32189ffe1cf141cbca66561d17fdd3da
parentc3972f49f90ed4cc94421c4be5af523df7dd23c4 (diff)
downloaddpkg-d3d8d778d7e00eceb0073123caf6ca718ae9e82c.tar.gz
dpkg-deb: Add support for reading the archive from standard input
All commands reading archives support this, except for --raw-extract that does not. Closes: #616614 Based-on-patch-by: Johannes Schauer <j.schauer@email.de>
-rw-r--r--debian/changelog3
-rw-r--r--dpkg-deb/extract.c8
-rw-r--r--man/dpkg-deb.18
3 files changed, 18 insertions, 1 deletions
diff --git a/debian/changelog b/debian/changelog
index ceff59e90..a5349310d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -72,6 +72,9 @@ dpkg (1.18.0) UNRELEASED; urgency=low
an Architecture field. Regression introduced in dpkg 1.16.2.
* Fix «dpkg --audit» to report missing and empty architecture fields.
Regression introduced in dpkg 1.16.2.
+ * Add support to dpkg-deb for reading the archive from standard input,
+ except for --raw-extract which does not yet support it. Closes: #616614
+ Based on a patch by Johannes Schauer <j.schauer@email.de>.
[ Updated manpages translations ]
* German (Helge Kreutzmann).
diff --git a/dpkg-deb/extract.c b/dpkg-deb/extract.c
index 3e814c9f8..70c2c0b12 100644
--- a/dpkg-deb/extract.c
+++ b/dpkg-deb/extract.c
@@ -123,7 +123,10 @@ extracthalf(const char *debar, const char *dir,
bool header_done;
enum compressor_type decompressor = COMPRESSOR_TYPE_GZIP;
- arfd = open(debar, O_RDONLY);
+ if (strcmp(debar, "-") == 0)
+ arfd = STDIN_FILENO;
+ else
+ arfd = open(debar, O_RDONLY);
if (arfd < 0)
ohshite(_("failed to read archive `%.255s'"), debar);
if (fstat(arfd, &stab))
@@ -475,6 +478,9 @@ do_raw_extract(const char *const *argv)
if (debar == NULL)
badusage(_("--%s needs .deb filename and directory arguments"),
cipaction->olong);
+ else if (strcmp(debar, "-") == 0)
+ badusage(_("--%s does not support (yet) reading the .deb from standard input"),
+ cipaction->olong);
dir = *argv++;
if (dir == NULL)
diff --git a/man/dpkg-deb.1 b/man/dpkg-deb.1
index 131fc15fb..832468769 100644
--- a/man/dpkg-deb.1
+++ b/man/dpkg-deb.1
@@ -43,6 +43,11 @@ with whatever options you want to pass to
will spot that you wanted
.B dpkg\-deb
and run it for you.
+.PP
+For most commands taking an input archive argument, the archive can be
+read from standard input if the archive name is given as a single minus
+character (\fB\-\fP); otherwise lack of support will be documented in
+their respective command description.
.
.SH COMMANDS
.TP
@@ -169,6 +174,9 @@ directory, and the control information files into a DEBIAN subdirectory
of the specified directory (since dpkg 1.16.1).
The target directory (but not its parents) will be created if necessary.
+
+The input archive is not (currently) processed sequentially, so reading
+it from standard input (\fB-\fP) is \fBnot\fP supported.
.TP
.BR \-\-ctrl\-tarfile " \fIarchive\fP"
Extracts the control data from a binary package and sends it to standard