2019-09-11 11:10:46 +00:00
|
|
|
#include "serialise.hh"
|
2019-12-10 08:47:38 +00:00
|
|
|
#include <archive.h>
|
2019-09-11 11:10:46 +00:00
|
|
|
|
|
|
|
namespace nix {
|
|
|
|
|
2019-12-10 08:47:38 +00:00
|
|
|
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();
|
|
|
|
};
|
2019-09-11 13:25:43 +00:00
|
|
|
void unpackTarfile(Source & source, const Path & destDir);
|
|
|
|
|
2019-12-07 15:35:14 +00:00
|
|
|
void unpackTarfile(const Path & tarFile, const Path & destDir);
|
2019-09-11 11:10:46 +00:00
|
|
|
|
|
|
|
}
|