aboutsummaryrefslogtreecommitdiff
path: root/src/libutil/tarfile.hh
diff options
context:
space:
mode:
authorYorick van Pelt <yorick@yorickvanpelt.nl>2019-12-10 15:47:38 +0700
committerLars Jellema <lars.jellema@gmail.com>2021-03-10 22:34:29 +0100
commit8a0c00b85600991cdb9aa05902defec6ac44b777 (patch)
tree79ec2c00b1c0131abbdb8d9e433274d51d8a5e95 /src/libutil/tarfile.hh
parentb19aec7eeb8353be6c59b2967a511a5072612d99 (diff)
Use libarchive for all compression
Diffstat (limited to 'src/libutil/tarfile.hh')
-rw-r--r--src/libutil/tarfile.hh19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/libutil/tarfile.hh b/src/libutil/tarfile.hh
index 89a024f1d..18adf3490 100644
--- a/src/libutil/tarfile.hh
+++ b/src/libutil/tarfile.hh
@@ -1,7 +1,26 @@
#include "serialise.hh"
+#include <archive.h>
namespace nix {
+struct TarArchive {
+ struct archive *archive;
+ Source *source;
+ std::vector<unsigned char> buffer;
+
+ void check(int err, const char *reason = "Failed to extract archive (%s)");
+
+ TarArchive(Source& source, bool raw = false);
+
+ TarArchive(const Path &path);
+
+ // disable copy constructor
+ TarArchive(const TarArchive&) = delete;
+
+ void close();
+
+ ~TarArchive();
+};
void unpackTarfile(Source & source, const Path & destDir);
void unpackTarfile(const Path & tarFile, const Path & destDir);