diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2021-04-15 13:39:04 +0200 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2021-04-15 13:39:04 +0200 |
commit | 6fb75824137de8af12491558c72d2eabc348f6f4 (patch) | |
tree | 9870c29c0c11453bdde0437b4a03a3c2ba902ecb /src/libutil/tarfile.hh | |
parent | f716779c1f3426763fb75cd7f80edfc99e442d50 (diff) | |
parent | 88c8804b4fb2253c9970bb06d9e534c347dfea4e (diff) |
Merge branch 'libarchive-decompress' of https://github.com/serokell/nix
Diffstat (limited to 'src/libutil/tarfile.hh')
-rw-r--r-- | src/libutil/tarfile.hh | 19 |
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); |