mirror of
https://github.com/NixOS/nix.git
synced 2025-12-21 16:31:07 +01:00
Move /src to /subprojects
This will facilitate breaking up Nix into multiple packages for each component with Meson.
This commit is contained in:
parent
4db9487823
commit
84e2963f8e
737 changed files with 504 additions and 505 deletions
46
subprojects/libutil/tarfile.hh
Normal file
46
subprojects/libutil/tarfile.hh
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
#pragma once
|
||||
///@file
|
||||
|
||||
#include "serialise.hh"
|
||||
#include "fs-sink.hh"
|
||||
#include <archive.h>
|
||||
|
||||
namespace nix {
|
||||
|
||||
struct TarArchive
|
||||
{
|
||||
struct archive * archive;
|
||||
Source * source;
|
||||
std::vector<unsigned char> buffer;
|
||||
|
||||
void check(int err, const std::string & reason = "failed to extract archive (%s)");
|
||||
|
||||
explicit TarArchive(const std::filesystem::path & path);
|
||||
|
||||
/// @brief Create a generic archive from source.
|
||||
/// @param source - Input byte stream.
|
||||
/// @param raw - Whether to enable raw file support. For more info look in docs:
|
||||
/// https://manpages.debian.org/stretch/libarchive-dev/archive_read_format.3.en.html
|
||||
/// @param compression_method - Primary compression method to use. std::nullopt means 'all'.
|
||||
TarArchive(Source & source, bool raw = false, std::optional<std::string> compression_method = std::nullopt);
|
||||
|
||||
/// Disable copy constructor. Explicitly default move assignment/constructor.
|
||||
TarArchive(const TarArchive &) = delete;
|
||||
TarArchive & operator=(const TarArchive &) = delete;
|
||||
TarArchive(TarArchive &&) = default;
|
||||
TarArchive & operator=(TarArchive &&) = default;
|
||||
|
||||
void close();
|
||||
|
||||
~TarArchive();
|
||||
};
|
||||
|
||||
int getArchiveFilterCodeByName(const std::string & method);
|
||||
|
||||
void unpackTarfile(Source & source, const std::filesystem::path & destDir);
|
||||
|
||||
void unpackTarfile(const std::filesystem::path & tarFile, const std::filesystem::path & destDir);
|
||||
|
||||
time_t unpackTarfileToSink(TarArchive & archive, ExtendedFileSystemObjectSink & parseSink);
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue