From c6295a3afd87a605f30f1de8b09d7885eb08fedb Mon Sep 17 00:00:00 2001 From: Tom Bereknyei Date: Fri, 13 Dec 2019 03:29:33 -0500 Subject: Initial gzip support Closes #3256 --- src/libutil/tarfile.cc | 1 + 1 file changed, 1 insertion(+) (limited to 'src/libutil/tarfile.cc') diff --git a/src/libutil/tarfile.cc b/src/libutil/tarfile.cc index 262bc655f..c00673182 100644 --- a/src/libutil/tarfile.cc +++ b/src/libutil/tarfile.cc @@ -24,6 +24,7 @@ void unpackTarfile(const Path & tarFile, const Path & destDir, auto decompressor = // FIXME: add .gz support hasSuffix(*baseName, ".bz2") ? makeDecompressionSink("bzip2", sink) : + hasSuffix(*baseName, ".gz") ? makeDecompressionSink("gzip", sink) : hasSuffix(*baseName, ".xz") ? makeDecompressionSink("xz", sink) : makeDecompressionSink("none", sink); readFile(tarFile, *decompressor); -- cgit v1.2.3 From 3e787423c22c34d65fd6fe0cdf2e6ec333d81c0b Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 13 Dec 2019 12:55:52 +0100 Subject: Remove FIXME --- src/libutil/tarfile.cc | 1 - 1 file changed, 1 deletion(-) (limited to 'src/libutil/tarfile.cc') diff --git a/src/libutil/tarfile.cc b/src/libutil/tarfile.cc index c00673182..79fb9f721 100644 --- a/src/libutil/tarfile.cc +++ b/src/libutil/tarfile.cc @@ -22,7 +22,6 @@ void unpackTarfile(const Path & tarFile, const Path & destDir, auto source = sinkToSource([&](Sink & sink) { // FIXME: look at first few bytes to determine compression type. auto decompressor = - // FIXME: add .gz support hasSuffix(*baseName, ".bz2") ? makeDecompressionSink("bzip2", sink) : hasSuffix(*baseName, ".gz") ? makeDecompressionSink("gzip", sink) : hasSuffix(*baseName, ".xz") ? makeDecompressionSink("xz", sink) : -- cgit v1.2.3 From ca87707c90c05289d0c7c1015f5750f6dd93708b Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 13 Dec 2019 18:29:16 +0100 Subject: Get rid of CBox --- src/libutil/tarfile.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/libutil/tarfile.cc') diff --git a/src/libutil/tarfile.cc b/src/libutil/tarfile.cc index 79fb9f721..1be0ba24c 100644 --- a/src/libutil/tarfile.cc +++ b/src/libutil/tarfile.cc @@ -3,7 +3,7 @@ extern "C" { rust::Result> * - unpack_tarfile(rust::Source source, rust::StringSlice dest_dir); + unpack_tarfile(rust::Source source, rust::StringSlice dest_dir, rust::Result> & out); } namespace nix { @@ -11,7 +11,9 @@ namespace nix { void unpackTarfile(Source & source, const Path & destDir) { rust::Source source2(source); - rust::CBox(unpack_tarfile(source2, destDir))->unwrap(); + rust::Result> res; + unpack_tarfile(source2, destDir, res); + res.unwrap(); } void unpackTarfile(const Path & tarFile, const Path & destDir, -- cgit v1.2.3