1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-28 22:01:15 +02:00

Use libarchive for all compression

This commit is contained in:
Yorick van Pelt 2019-12-10 15:47:38 +07:00 committed by Lars Jellema
parent b19aec7eeb
commit 8a0c00b856
No known key found for this signature in database
GPG key ID: 563A03936D48B4BC
7 changed files with 241 additions and 378 deletions

View file

@ -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);