Skip to content

Commit 2f799fe

Browse files
committed
Remove dependent realisations
This progress on #11896. It introduces some issues temporarily which will be fixed when #11928 is fixed.
1 parent 70fbd1c commit 2f799fe

File tree

22 files changed

+116
-414
lines changed

22 files changed

+116
-414
lines changed
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
1-
{{#include build-trace-entry-v1-fixed.md}}
1+
{{#include build-trace-entry-v2-fixed.md}}
22

33
## Examples
44

55
### Simple build trace entry
66

77
```json
8-
{{#include schema/build-trace-entry-v1/simple.json}}
8+
{{#include schema/build-trace-entry-v2/simple.json}}
99
```
1010

1111
### Build trace entry with dependencies
1212

1313
```json
14-
{{#include schema/build-trace-entry-v1/with-dependent-realisations.json}}
14+
{{#include schema/build-trace-entry-v2/with-dependent-realisations.json}}
1515
```
1616

1717
### Build trace entry with signature
1818

1919
```json
20-
{{#include schema/build-trace-entry-v1/with-signature.json}}
20+
{{#include schema/build-trace-entry-v2/with-signature.json}}
2121
```
2222

2323
<!--
2424
## Raw Schema
2525
26-
[JSON Schema for Build Trace Entry v1](schema/build-trace-entry-v1.json)
26+
[JSON Schema for Build Trace Entry v1](schema/build-trace-entry-v2.json)
2727
-->

doc/manual/source/protocols/json/meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ schemas = [
1515
'store-object-info-v1',
1616
'derivation-v3',
1717
'deriving-path-v1',
18-
'build-trace-entry-v1',
18+
'build-trace-entry-v2',
1919
]
2020

2121
schema_files = files()

doc/manual/source/protocols/json/schema/build-trace-entry-v1.yaml renamed to doc/manual/source/protocols/json/schema/build-trace-entry-v2.yaml

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"$schema": "http://json-schema.org/draft-04/schema"
2-
"$id": "https://nix.dev/manual/nix/latest/protocols/json/schema/build-trace-entry-v1.json"
2+
"$id": "https://nix.dev/manual/nix/latest/protocols/json/schema/build-trace-entry-v2.json"
33
title: Build Trace Entry
44
description: |
55
A record of a successful build outcome for a specific derivation output.
@@ -12,11 +12,16 @@ description: |
1212
> [**experimental**](@docroot@/development/experimental-features.md#xp-feature-ca-derivations)
1313
> and subject to change.
1414
15+
Verision history:
16+
17+
- Version 1: Original format
18+
19+
- Version 2: Remove `dependentRealisations`
20+
1521
type: object
1622
required:
1723
- id
1824
- outPath
19-
- dependentRealisations
2025
- signatures
2126
properties:
2227
id:
@@ -41,26 +46,6 @@ properties:
4146
description: |
4247
The path to the store object that resulted from building this derivation for the given output name.
4348
44-
dependentRealisations:
45-
type: object
46-
title: Underlying Base Build Trace
47-
description: |
48-
This is for [*derived*](@docroot@/store/build-trace.md#derived) build trace entries to ensure coherence.
49-
50-
Keys are derivation output IDs (same format as the main `id` field).
51-
Values are the store paths that those dependencies resolved to.
52-
53-
As described in the linked section on derived build trace traces, derived build trace entries must be kept in addition and not instead of the underlying base build entries.
54-
This is the set of base build trace entries that this derived build trace is derived from.
55-
(The set is also a map since this miniature base build trace must be coherent, mapping each key to a single value.)
56-
57-
patternProperties:
58-
"^sha256:[0-9a-f]{64}![a-zA-Z_][a-zA-Z0-9_-]*$":
59-
$ref: "store-path-v1.yaml"
60-
title: Dependent Store Path
61-
description: Store path that this dependency resolved to during the build
62-
additionalProperties: false
63-
6449
signatures:
6550
type: array
6651
title: Build Signatures
@@ -71,4 +56,7 @@ properties:
7156
title: Signature
7257
description: A single cryptographic signature
7358

74-
additionalProperties: false
59+
additionalProperties:
60+
dependentRealisations:
61+
description: deprecated field
62+
type: object

src/json-schema-checks/meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ schemas = [
5656
},
5757
{
5858
'stem' : 'build-trace-entry',
59-
'schema' : schema_dir / 'build-trace-entry-v1.yaml',
59+
'schema' : schema_dir / 'build-trace-entry-v2.yaml',
6060
'files' : [
6161
'simple.json',
6262
'with-dependent-realisations.json',

src/libstore-test-support/include/nix/store/tests/protocol.hh

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,20 @@ public:
6969
}
7070
};
7171

72-
#define VERSIONED_CHARACTERIZATION_TEST(FIXTURE, NAME, STEM, VERSION, VALUE) \
73-
TEST_F(FIXTURE, NAME##_read) \
74-
{ \
75-
readProtoTest(STEM, VERSION, VALUE); \
76-
} \
77-
TEST_F(FIXTURE, NAME##_write) \
78-
{ \
79-
writeProtoTest(STEM, VERSION, VALUE); \
72+
#define VERSIONED_READ_CHARACTERIZATION_TEST(FIXTURE, NAME, STEM, VERSION, VALUE) \
73+
TEST_F(FIXTURE, NAME##_read) \
74+
{ \
75+
readProtoTest(STEM, VERSION, VALUE); \
8076
}
8177

78+
#define VERSIONED_WRITE_CHARACTERIZATION_TEST(FIXTURE, NAME, STEM, VERSION, VALUE) \
79+
TEST_F(FIXTURE, NAME##_write) \
80+
{ \
81+
writeProtoTest(STEM, VERSION, VALUE); \
82+
}
83+
84+
#define VERSIONED_CHARACTERIZATION_TEST(FIXTURE, NAME, STEM, VERSION, VALUE) \
85+
VERSIONED_READ_CHARACTERIZATION_TEST(FIXTURE, NAME, STEM, VERSION, VALUE) \
86+
VERSIONED_WRITE_CHARACTERIZATION_TEST(FIXTURE, NAME, STEM, VERSION, VALUE)
87+
8288
} // namespace nix

src/libstore-tests/common-protocol.cc

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,22 @@ class CommonProtoTest : public ProtoTest<CommonProto, commonProtoDir>
4646
}
4747
};
4848

49-
#define CHARACTERIZATION_TEST(NAME, STEM, VALUE) \
50-
TEST_F(CommonProtoTest, NAME##_read) \
51-
{ \
52-
readProtoTest(STEM, VALUE); \
53-
} \
54-
TEST_F(CommonProtoTest, NAME##_write) \
55-
{ \
56-
writeProtoTest(STEM, VALUE); \
49+
#define READ_CHARACTERIZATION_TEST(NAME, STEM, VALUE) \
50+
TEST_F(CommonProtoTest, NAME##_read) \
51+
{ \
52+
readProtoTest(STEM, VALUE); \
5753
}
5854

55+
#define WRITE_CHARACTERIZATION_TEST(NAME, STEM, VALUE) \
56+
TEST_F(CommonProtoTest, NAME##_write) \
57+
{ \
58+
writeProtoTest(STEM, VALUE); \
59+
}
60+
61+
#define CHARACTERIZATION_TEST(NAME, STEM, VALUE) \
62+
READ_CHARACTERIZATION_TEST(NAME, STEM, VALUE) \
63+
WRITE_CHARACTERIZATION_TEST(NAME, STEM, VALUE)
64+
5965
CHARACTERIZATION_TEST(
6066
string,
6167
"string",
@@ -132,24 +138,14 @@ CHARACTERIZATION_TEST(
132138
},
133139
}))
134140

135-
CHARACTERIZATION_TEST(
141+
READ_CHARACTERIZATION_TEST(
136142
realisation_with_deps,
137143
"realisation-with-deps",
138144
(std::tuple<Realisation>{
139145
Realisation{
140146
{
141147
.outPath = StorePath{"g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-foo"},
142148
.signatures = {"asdf", "qwer"},
143-
.dependentRealisations =
144-
{
145-
{
146-
DrvOutput{
147-
.drvHash = Hash::parseSRI("sha256-b4afnqKCO9oWXgYHb9DeQ2berSwOjS27rSd9TxXDc/U="),
148-
.outputName = "quux",
149-
},
150-
StorePath{"g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-foo"},
151-
},
152-
},
153149
},
154150
{
155151
.drvHash = Hash::parseSRI("sha256-FePFYIlMuycIXPZbWi7LGEiMmZSX9FMbaQenWBzm1Sc="),

src/libstore-tests/realisation.cc

Lines changed: 36 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -44,54 +44,45 @@ TEST_P(RealisationJsonTest, to_json)
4444
writeJsonTest(name, value);
4545
}
4646

47+
Realisation simple{
48+
{
49+
.outPath = StorePath{"g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-foo.drv"},
50+
},
51+
{
52+
.drvHash = Hash::parseExplicitFormatUnprefixed(
53+
"ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad",
54+
HashAlgorithm::SHA256,
55+
HashFormat::Base16),
56+
.outputName = "foo",
57+
},
58+
};
59+
4760
INSTANTIATE_TEST_SUITE_P(
4861
RealisationJSON,
4962
RealisationJsonTest,
50-
([] {
51-
Realisation simple{
52-
{
53-
.outPath = StorePath{"g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-foo.drv"},
54-
},
55-
{
56-
.drvHash = Hash::parseExplicitFormatUnprefixed(
57-
"ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad",
58-
HashAlgorithm::SHA256,
59-
HashFormat::Base16),
60-
.outputName = "foo",
61-
},
62-
};
63-
return ::testing::Values(
64-
std::pair{
65-
"simple",
66-
simple,
67-
},
68-
std::pair{
69-
"with-signature",
70-
[&] {
71-
auto r = simple;
72-
// FIXME actually sign properly
73-
r.signatures = {"asdfasdfasdf"};
74-
return r;
75-
}()},
76-
std::pair{
77-
"with-dependent-realisations",
78-
[&] {
79-
auto r = simple;
80-
r.dependentRealisations = {{
81-
{
82-
.drvHash = Hash::parseExplicitFormatUnprefixed(
83-
"ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad",
84-
HashAlgorithm::SHA256,
85-
HashFormat::Base16),
86-
.outputName = "foo",
87-
},
88-
StorePath{"g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-foo.drv"},
89-
}};
90-
return r;
91-
}(),
92-
});
93-
}
63+
::testing::Values(
64+
std::pair{
65+
"simple",
66+
simple,
67+
},
68+
std::pair{
69+
"with-signature",
70+
[&] {
71+
auto r = simple;
72+
// FIXME actually sign properly
73+
r.signatures = {"asdfasdfasdf"};
74+
return r;
75+
}(),
76+
}));
9477

95-
()));
78+
/**
79+
* We no longer have a notion of "dependent realisations", but we still
80+
* want to parse old realisation files. So make this just be a read test
81+
* (no write direction), accordingly.
82+
*/
83+
TEST_F(RealisationTest, dependent_realisations_from_json)
84+
{
85+
readJsonTest("with-dependent-realisations", simple);
86+
}
9687

9788
} // namespace nix

src/libstore-tests/serve-protocol.cc

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ VERSIONED_CHARACTERIZATION_TEST(
115115
},
116116
}))
117117

118-
VERSIONED_CHARACTERIZATION_TEST(
118+
VERSIONED_READ_CHARACTERIZATION_TEST(
119119
ServeProtoTest,
120120
realisation_with_deps,
121121
"realisation-with-deps",
@@ -125,16 +125,6 @@ VERSIONED_CHARACTERIZATION_TEST(
125125
{
126126
.outPath = StorePath{"g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-foo"},
127127
.signatures = {"asdf", "qwer"},
128-
.dependentRealisations =
129-
{
130-
{
131-
DrvOutput{
132-
.drvHash = Hash::parseSRI("sha256-b4afnqKCO9oWXgYHb9DeQ2berSwOjS27rSd9TxXDc/U="),
133-
.outputName = "quux",
134-
},
135-
StorePath{"g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-foo"},
136-
},
137-
},
138128
},
139129
{
140130
.drvHash = Hash::parseSRI("sha256-FePFYIlMuycIXPZbWi7LGEiMmZSX9FMbaQenWBzm1Sc="),

src/libstore-tests/worker-protocol.cc

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ VERSIONED_CHARACTERIZATION_TEST(
168168
},
169169
}))
170170

171-
VERSIONED_CHARACTERIZATION_TEST(
171+
VERSIONED_READ_CHARACTERIZATION_TEST(
172172
WorkerProtoTest,
173173
realisation_with_deps,
174174
"realisation-with-deps",
@@ -178,16 +178,6 @@ VERSIONED_CHARACTERIZATION_TEST(
178178
{
179179
.outPath = StorePath{"g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-foo"},
180180
.signatures = {"asdf", "qwer"},
181-
.dependentRealisations =
182-
{
183-
{
184-
DrvOutput{
185-
.drvHash = Hash::parseSRI("sha256-b4afnqKCO9oWXgYHb9DeQ2berSwOjS27rSd9TxXDc/U="),
186-
.outputName = "quux",
187-
},
188-
StorePath{"g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-foo"},
189-
},
190-
},
191181
},
192182
{
193183
.drvHash = Hash::parseSRI("sha256-FePFYIlMuycIXPZbWi7LGEiMmZSX9FMbaQenWBzm1Sc="),

0 commit comments

Comments
 (0)