Compare commits

..

1 commit

Author SHA1 Message Date
Yureka f037de5ad8 fix build with latest lix 2024-10-06 13:50:15 +02:00
4 changed files with 39 additions and 41 deletions

2
.envrc
View file

@ -1 +1 @@
use flake .#clang
use flake

View file

@ -48,11 +48,11 @@
"pre-commit-hooks": "pre-commit-hooks"
},
"locked": {
"lastModified": 1728163191,
"narHash": "sha256-SW0IEBsPN1EysqzvfDT+8Kimtzy03O1BxQQm7ZB6fRY=",
"lastModified": 1728159440,
"narHash": "sha256-8DW+VfSIk5xYpYj1VDKMmUjXhMooIlAOwYG4J9PLbbg=",
"ref": "refs/heads/main",
"rev": "ed9b7f4f84fd60ad8618645cc1bae2d686ff0db6",
"revCount": 16323,
"rev": "7ff60b7445ccb599edcbf0078d181034f61a0859",
"revCount": 16318,
"type": "git",
"url": "https://git.lix.systems/lix-project/lix"
},
@ -126,11 +126,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1728193676,
"narHash": "sha256-PbDWAIjKJdlVg+qQRhzdSor04bAPApDqIv2DofTyynk=",
"lastModified": 1725001927,
"narHash": "sha256-eV+63gK0Mp7ygCR0Oy4yIYSNcum2VQwnZamHxYTNi+M=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "ecbc1ca8ffd6aea8372ad16be9ebbb39889e55b6",
"rev": "6e99f2a27d600612004fbd2c3282d614bfee6421",
"type": "github"
},
"original": {

View file

@ -1,6 +1,5 @@
#include <cmath>
#include "error.hh"
#include "state.hh"
#include "hydra-build-result.hh"
#include "finally.hh"
@ -186,7 +185,7 @@ State::StepResult State::doBuildStep(nix::ref<Store> destStore,
unlink(result.logFile.c_str());
}
} catch (...) {
ignoreExceptionInDestructor();
ignoreExceptionExceptInterrupt();
}
}
});

View file

@ -9,35 +9,6 @@ using namespace nix;
struct Extractor : NARParseVisitor
{
class MyFileHandle : public FileHandle
{
NarMemberData & memberData;
uint64_t expectedSize;
std::unique_ptr<HashSink> hashSink;
public:
MyFileHandle(NarMemberData & memberData, uint64_t size) : memberData(memberData), expectedSize(size)
{
hashSink = std::make_unique<HashSink>(HashType::SHA256);
}
void receiveContents(std::string_view data) override
{
*memberData.fileSize += data.size();
(*hashSink)(data);
if (memberData.contents) {
memberData.contents->append(data);
}
assert(memberData.fileSize <= expectedSize);
if (memberData.fileSize == expectedSize) {
auto [hash, len] = hashSink->finish();
assert(memberData.fileSize == len);
memberData.sha256 = hash;
hashSink.reset();
}
}
};
std::unordered_set<Path> filesToKeep {
"/nix-support/hydra-build-products",
"/nix-support/hydra-release-name",
@ -58,15 +29,43 @@ struct Extractor : NARParseVisitor
std::unique_ptr<FileHandle> createRegularFile(const Path & path, uint64_t size, bool executable) override
{
auto memberData = &members.insert_or_assign(prefix + path, NarMemberData {
MyFileHandle * hdl = new MyFileHandle();
hdl->memberData = &members.insert_or_assign(prefix + path, NarMemberData {
.type = FSAccessor::Type::tRegular,
.fileSize = 0,
.contents = filesToKeep.count(path) ? std::optional("") : std::nullopt,
}).first->second;
return std::make_unique<MyFileHandle>(*memberData, size);
hdl->expectedSize = size;
hdl->hashSink = std::make_unique<HashSink>(HashType::SHA256);
return std::unique_ptr<MyFileHandle>(hdl);
}
struct MyFileHandle : public FileHandle
{
uint64_t expectedSize;
std::unique_ptr<HashSink> hashSink;
NarMemberData * memberData;
void receiveContents(std::string_view data) override
{
*memberData->fileSize += data.size();
(*hashSink)(data);
if (memberData->contents) {
memberData->contents->append(data);
}
assert(memberData->fileSize <= expectedSize);
if (memberData->fileSize == expectedSize) {
auto [hash, len] = hashSink->finish();
assert(memberData->fileSize == len);
memberData->sha256 = hash;
hashSink.reset();
}
}
};
void createSymlink(const Path & path, const std::string & target) override
{
members.insert_or_assign(prefix + path, NarMemberData { .type = FSAccessor::Type::tSymlink });