mirror of
https://github.com/NixOS/nix
synced 2025-06-28 22:01:15 +02:00
Revert "Use the hash modulo in the derivation outputs"
This reverts commit bab1cda0e6
.
This commit is contained in:
parent
fb028ae701
commit
c6fefcb2f4
48 changed files with 920 additions and 961 deletions
|
@ -25,12 +25,11 @@ BuildResult ServeProto::Serialise<BuildResult>::read(const StoreDirConfig & stor
|
|||
>> status.isNonDeterministic
|
||||
>> status.startTime
|
||||
>> status.stopTime;
|
||||
if (GET_PROTOCOL_MINOR(conn.version) >= 6) {
|
||||
auto builtOutputs = ServeProto::Serialise<DrvOutputs>::read(store, conn);
|
||||
for (auto && [output, realisation] : builtOutputs)
|
||||
status.builtOutputs.insert_or_assign(
|
||||
std::move(output.outputName),
|
||||
std::move(realisation));
|
||||
if (GET_PROTOCOL_MINOR(conn.version) >= 8) {
|
||||
status.builtOutputs = ServeProto::Serialise<std::map<OutputName, UnkeyedRealisation>>::read(store, conn);
|
||||
} else if (GET_PROTOCOL_MINOR(conn.version) >= 6) {
|
||||
// We no longer support these types of realisations
|
||||
(void) ServeProto::Serialise<StringMap>::read(store, conn);
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
@ -47,11 +46,11 @@ void ServeProto::Serialise<BuildResult>::write(const StoreDirConfig & store, Ser
|
|||
<< status.isNonDeterministic
|
||||
<< status.startTime
|
||||
<< status.stopTime;
|
||||
if (GET_PROTOCOL_MINOR(conn.version) >= 6) {
|
||||
DrvOutputs builtOutputs;
|
||||
for (auto & [output, realisation] : status.builtOutputs)
|
||||
builtOutputs.insert_or_assign(realisation.id, realisation);
|
||||
ServeProto::write(store, conn, builtOutputs);
|
||||
if (GET_PROTOCOL_MINOR(conn.version) >= 8) {
|
||||
ServeProto::write(store, conn, status.builtOutputs);
|
||||
} else if (GET_PROTOCOL_MINOR(conn.version) >= 6) {
|
||||
// We no longer support these types of realisations
|
||||
ServeProto::write(store, conn, StringMap{});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -134,4 +133,80 @@ void ServeProto::Serialise<ServeProto::BuildOptions>::write(const StoreDirConfig
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
UnkeyedRealisation ServeProto::Serialise<UnkeyedRealisation>::read(const StoreDirConfig & store, ReadConn conn)
|
||||
{
|
||||
if (GET_PROTOCOL_MINOR(conn.version) < 39) {
|
||||
throw Error("daemon protocol %d.%d is too old (< 1.29) to understand build trace",
|
||||
GET_PROTOCOL_MAJOR(conn.version),
|
||||
GET_PROTOCOL_MINOR(conn.version));
|
||||
}
|
||||
|
||||
auto outPath = ServeProto::Serialise<StorePath>::read(store, conn);
|
||||
auto signatures = ServeProto::Serialise<StringSet>::read(store, conn);
|
||||
|
||||
return UnkeyedRealisation {
|
||||
.outPath = std::move(outPath),
|
||||
.signatures = std::move(signatures),
|
||||
};
|
||||
}
|
||||
|
||||
void ServeProto::Serialise<UnkeyedRealisation>::write(const StoreDirConfig & store, WriteConn conn, const UnkeyedRealisation & info)
|
||||
{
|
||||
if (GET_PROTOCOL_MINOR(conn.version) < 39) {
|
||||
throw Error("daemon protocol %d.%d is too old (< 1.29) to understand build trace",
|
||||
GET_PROTOCOL_MAJOR(conn.version),
|
||||
GET_PROTOCOL_MINOR(conn.version));
|
||||
}
|
||||
ServeProto::write(store, conn, info.outPath);
|
||||
ServeProto::write(store, conn, info.signatures);
|
||||
}
|
||||
|
||||
|
||||
DrvOutput ServeProto::Serialise<DrvOutput>::read(const StoreDirConfig & store, ReadConn conn)
|
||||
{
|
||||
if (GET_PROTOCOL_MINOR(conn.version) < 39) {
|
||||
throw Error("daemon protocol %d.%d is too old (< 1.29) to understand build trace",
|
||||
GET_PROTOCOL_MAJOR(conn.version),
|
||||
GET_PROTOCOL_MINOR(conn.version));
|
||||
}
|
||||
|
||||
auto drvPath = ServeProto::Serialise<StorePath>::read(store, conn);
|
||||
auto outputName = ServeProto::Serialise<std::string>::read(store, conn);
|
||||
|
||||
return DrvOutput {
|
||||
.drvPath = std::move(drvPath),
|
||||
.outputName = std::move(outputName),
|
||||
};
|
||||
}
|
||||
|
||||
void ServeProto::Serialise<DrvOutput>::write(const StoreDirConfig & store, WriteConn conn, const DrvOutput & info)
|
||||
{
|
||||
if (GET_PROTOCOL_MINOR(conn.version) < 39) {
|
||||
throw Error("daemon protocol %d.%d is too old (< 1.29) to understand build trace",
|
||||
GET_PROTOCOL_MAJOR(conn.version),
|
||||
GET_PROTOCOL_MINOR(conn.version));
|
||||
}
|
||||
ServeProto::write(store, conn, info.drvPath);
|
||||
ServeProto::write(store, conn, info.outputName);
|
||||
}
|
||||
|
||||
|
||||
Realisation ServeProto::Serialise<Realisation>::read(const StoreDirConfig & store, ReadConn conn)
|
||||
{
|
||||
auto id = ServeProto::Serialise<DrvOutput>::read(store, conn);
|
||||
auto unkeyed = ServeProto::Serialise<UnkeyedRealisation>::read(store, conn);
|
||||
|
||||
return Realisation {
|
||||
std::move(unkeyed),
|
||||
std::move(id),
|
||||
};
|
||||
}
|
||||
|
||||
void ServeProto::Serialise<Realisation>::write(const StoreDirConfig & store, WriteConn conn, const Realisation & info)
|
||||
{
|
||||
ServeProto::write(store, conn, info.id);
|
||||
ServeProto::write(store, conn, static_cast<const UnkeyedRealisation &>(info));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue