Revert "Update to Nix 2.19"

This reverts commit c922e73c11.
This commit is contained in:
leo60228 2024-05-10 14:35:46 -04:00
parent 249620b49e
commit 803b8ee731
Signed by untrusted user: vriska
GPG key ID: 6F3EB461799AD95E
9 changed files with 14 additions and 28 deletions

View file

@ -8,8 +8,6 @@
#include "eval.hh" #include "eval.hh"
#include "eval-inline.hh" #include "eval-inline.hh"
#include "eval-settings.hh" #include "eval-settings.hh"
#include "signals.hh"
#include "terminal.hh"
#include "util.hh" #include "util.hh"
#include "get-drvs.hh" #include "get-drvs.hh"
#include "globals.hh" #include "globals.hh"
@ -97,7 +95,7 @@ static std::string queryMetaStrings(EvalState & state, DrvInfo & drv, const std:
rec = [&](Value & v) { rec = [&](Value & v) {
state.forceValue(v, noPos); state.forceValue(v, noPos);
if (v.type() == nString) if (v.type() == nString)
res.emplace_back(v.string_view()); res.push_back(v.string.s);
else if (v.isList()) else if (v.isList())
for (unsigned int n = 0; n < v.listSize(); ++n) for (unsigned int n = 0; n < v.listSize(); ++n)
rec(*v.listElems()[n]); rec(*v.listElems()[n]);
@ -228,7 +226,7 @@ static void worker(
auto v = a->value->listElems()[n]; auto v = a->value->listElems()[n];
state.forceValue(*v, noPos); state.forceValue(*v, noPos);
if (v->type() == nString) if (v->type() == nString)
job["namedConstituents"].push_back(v->string_view()); job["namedConstituents"].push_back(v->str());
} }
} }

View file

@ -2,7 +2,6 @@
#include "hydra-config.hh" #include "hydra-config.hh"
#include "pool.hh" #include "pool.hh"
#include "shared.hh" #include "shared.hh"
#include "signals.hh"
#include <algorithm> #include <algorithm>
#include <thread> #include <thread>

View file

@ -9,8 +9,6 @@
#include "path.hh" #include "path.hh"
#include "serve-protocol.hh" #include "serve-protocol.hh"
#include "state.hh" #include "state.hh"
#include "current-process.hh"
#include "processes.hh"
#include "util.hh" #include "util.hh"
#include "serve-protocol.hh" #include "serve-protocol.hh"
#include "serve-protocol-impl.hh" #include "serve-protocol-impl.hh"

View file

@ -1,7 +1,7 @@
#include "hydra-build-result.hh" #include "hydra-build-result.hh"
#include "store-api.hh" #include "store-api.hh"
#include "util.hh" #include "util.hh"
#include "source-accessor.hh" #include "fs-accessor.hh"
#include <regex> #include <regex>
@ -63,7 +63,7 @@ BuildOutput getBuildOutput(
auto productsFile = narMembers.find(outputS + "/nix-support/hydra-build-products"); auto productsFile = narMembers.find(outputS + "/nix-support/hydra-build-products");
if (productsFile == narMembers.end() || if (productsFile == narMembers.end() ||
productsFile->second.type != SourceAccessor::Type::tRegular) productsFile->second.type != FSAccessor::Type::tRegular)
continue; continue;
assert(productsFile->second.contents); assert(productsFile->second.contents);
@ -94,7 +94,7 @@ BuildOutput getBuildOutput(
product.name = product.path == store->printStorePath(output) ? "" : baseNameOf(product.path); product.name = product.path == store->printStorePath(output) ? "" : baseNameOf(product.path);
if (file->second.type == SourceAccessor::Type::tRegular) { if (file->second.type == FSAccessor::Type::tRegular) {
product.isRegular = true; product.isRegular = true;
product.fileSize = file->second.fileSize.value(); product.fileSize = file->second.fileSize.value();
product.sha256hash = file->second.sha256.value(); product.sha256hash = file->second.sha256.value();
@ -116,7 +116,7 @@ BuildOutput getBuildOutput(
auto file = narMembers.find(product.path); auto file = narMembers.find(product.path);
assert(file != narMembers.end()); assert(file != narMembers.end());
if (file->second.type == SourceAccessor::Type::tDirectory) if (file->second.type == FSAccessor::Type::tDirectory)
res.products.push_back(product); res.products.push_back(product);
} }
} }
@ -125,7 +125,7 @@ BuildOutput getBuildOutput(
for (auto & output : outputs) { for (auto & output : outputs) {
auto file = narMembers.find(store->printStorePath(output) + "/nix-support/hydra-release-name"); auto file = narMembers.find(store->printStorePath(output) + "/nix-support/hydra-release-name");
if (file == narMembers.end() || if (file == narMembers.end() ||
file->second.type != SourceAccessor::Type::tRegular) file->second.type != FSAccessor::Type::tRegular)
continue; continue;
res.releaseName = trim(file->second.contents.value()); res.releaseName = trim(file->second.contents.value());
// FIXME: validate release name // FIXME: validate release name
@ -135,7 +135,7 @@ BuildOutput getBuildOutput(
for (auto & output : outputs) { for (auto & output : outputs) {
auto file = narMembers.find(store->printStorePath(output) + "/nix-support/hydra-metrics"); auto file = narMembers.find(store->printStorePath(output) + "/nix-support/hydra-metrics");
if (file == narMembers.end() || if (file == narMembers.end() ||
file->second.type != SourceAccessor::Type::tRegular) file->second.type != FSAccessor::Type::tRegular)
continue; continue;
for (auto & line : tokenizeString<Strings>(file->second.contents.value(), "\n")) { for (auto & line : tokenizeString<Strings>(file->second.contents.value(), "\n")) {
auto fields = tokenizeString<std::vector<std::string>>(line); auto fields = tokenizeString<std::vector<std::string>>(line);

View file

@ -11,7 +11,6 @@
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
#include "signals.hh"
#include "state.hh" #include "state.hh"
#include "hydra-build-result.hh" #include "hydra-build-result.hh"
#include "store-api.hh" #include "store-api.hh"
@ -535,7 +534,7 @@ void State::markSucceededBuild(pqxx::work & txn, Build::ptr build,
product.type, product.type,
product.subtype, product.subtype,
product.fileSize ? std::make_optional(*product.fileSize) : std::nullopt, product.fileSize ? std::make_optional(*product.fileSize) : std::nullopt,
product.sha256hash ? std::make_optional(product.sha256hash->to_string(HashFormat::Base16, false)) : std::nullopt, product.sha256hash ? std::make_optional(product.sha256hash->to_string(Base16, false)) : std::nullopt,
product.path, product.path,
product.name, product.name,
product.defaultPath); product.defaultPath);

View file

@ -24,13 +24,13 @@ struct Extractor : ParseSink
void createDirectory(const Path & path) override void createDirectory(const Path & path) override
{ {
members.insert_or_assign(prefix + path, NarMemberData { .type = SourceAccessor::Type::tDirectory }); members.insert_or_assign(prefix + path, NarMemberData { .type = FSAccessor::Type::tDirectory });
} }
void createRegularFile(const Path & path) override void createRegularFile(const Path & path) override
{ {
curMember = &members.insert_or_assign(prefix + path, NarMemberData { curMember = &members.insert_or_assign(prefix + path, NarMemberData {
.type = SourceAccessor::Type::tRegular, .type = FSAccessor::Type::tRegular,
.fileSize = 0, .fileSize = 0,
.contents = filesToKeep.count(path) ? std::optional("") : std::nullopt, .contents = filesToKeep.count(path) ? std::optional("") : std::nullopt,
}).first->second; }).first->second;
@ -66,14 +66,8 @@ struct Extractor : ParseSink
void createSymlink(const Path & path, const std::string & target) override void createSymlink(const Path & path, const std::string & target) override
{ {
members.insert_or_assign(prefix + path, NarMemberData { .type = SourceAccessor::Type::tSymlink }); members.insert_or_assign(prefix + path, NarMemberData { .type = FSAccessor::Type::tSymlink });
} }
void isExecutable() override
{ }
void closeRegularFile() override
{ }
}; };

View file

@ -1,13 +1,13 @@
#pragma once #pragma once
#include "source-accessor.hh" #include "fs-accessor.hh"
#include "types.hh" #include "types.hh"
#include "serialise.hh" #include "serialise.hh"
#include "hash.hh" #include "hash.hh"
struct NarMemberData struct NarMemberData
{ {
nix::SourceAccessor::Type type; nix::FSAccessor::Type type;
std::optional<uint64_t> fileSize; std::optional<uint64_t> fileSize;
std::optional<std::string> contents; std::optional<std::string> contents;
std::optional<nix::Hash> sha256; std::optional<nix::Hash> sha256;

View file

@ -2,7 +2,6 @@
#include <pqxx/pqxx> #include <pqxx/pqxx>
#include "environment-variables.hh"
#include "util.hh" #include "util.hh"

View file

@ -2,7 +2,6 @@
#include <map> #include <map>
#include "file-system.hh"
#include "util.hh" #include "util.hh"
struct HydraConfig struct HydraConfig