Skip to content

Commit 07df876

Browse files
committed
Make keys of Derivation*Goal more legible
The property that substitution goals come first is still preserved
1 parent a629ce3 commit 07df876

File tree

6 files changed

+15
-21
lines changed

6 files changed

+15
-21
lines changed

src/libstore/build/derivation-building-goal.cc

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,7 @@ DerivationBuildingGoal::~DerivationBuildingGoal()
6666

6767
std::string DerivationBuildingGoal::key()
6868
{
69-
/* Ensure that derivations get built in order of their name,
70-
i.e. a derivation named "aardvark" always comes before
71-
"baboon". And substitution goals always happen before
72-
derivation goals (due to "bd$"). */
73-
return "bd$" + std::string(drvPath.name()) + "$" + worker.store.printStorePath(drvPath);
69+
return "dd$" + std::string(drvPath.name()) + "$" + worker.store.printStorePath(drvPath);
7470
}
7571

7672
void DerivationBuildingGoal::killChild()

src/libstore/build/derivation-goal.cc

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,7 @@ DerivationGoal::DerivationGoal(
5252

5353
std::string DerivationGoal::key()
5454
{
55-
/* Ensure that derivations get built in order of their name,
56-
i.e. a derivation named "aardvark" always comes before
57-
"baboon". And substitution goals always happen before
58-
derivation goals (due to "b$"). */
59-
return "b$" + std::string(drvPath.name()) + "$" + SingleDerivedPath::Built{
55+
return "db$" + std::string(drvPath.name()) + "$" + SingleDerivedPath::Built{
6056
.drvPath = makeConstantStorePathRef(drvPath),
6157
.output = wantedOutput,
6258
}.to_string(worker.store);

src/libstore/build/derivation-trampoline-goal.cc

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,7 @@ static StorePath pathPartOfReq(const SingleDerivedPath & req)
5858

5959
std::string DerivationTrampolineGoal::key()
6060
{
61-
/* Ensure that derivations get built in order of their name,
62-
i.e. a derivation named "aardvark" always comes before "baboon". And
63-
substitution goals, derivation goals, and derivation building goals always happen before
64-
derivation goals (due to "bt$"). */
65-
return "bt$" + std::string(pathPartOfReq(*drvReq).name()) + "$" + DerivedPath::Built{
61+
return "da$" + std::string(pathPartOfReq(*drvReq).name()) + "$" + DerivedPath::Built{
6662
.drvPath = drvReq,
6763
.outputs = wantedOutputs,
6864
}.to_string(worker.store);

src/libstore/build/drv-output-substitution-goal.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,6 @@ Goal::Co DrvOutputSubstitutionGoal::realisationFetched(
153153

154154
std::string DrvOutputSubstitutionGoal::key()
155155
{
156-
/* "a$" ensures substitution goals happen before derivation
157-
goals. */
158156
return "a$" + std::string(id.to_string());
159157
}
160158

src/libstore/include/nix/store/build/goal.hh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,18 @@ public:
456456
*/
457457
virtual void timedOut(Error && ex) = 0;
458458

459+
/**
460+
* Used for comparisons. The order matters a bit for scheduling. We
461+
* want:
462+
*
463+
* 1. Substitution
464+
* 2. Derivation administrativia
465+
* 3. Actual building
466+
*
467+
* Also, ensure that derivations get processed in order of their
468+
* name, i.e. a derivation named "aardvark" always comes before
469+
* "baboon".
470+
*/
459471
virtual std::string key() = 0;
460472

461473
/**

src/libstore/include/nix/store/build/substitution-goal.hh

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,6 @@ public:
5858
unreachable();
5959
};
6060

61-
/**
62-
* We prepend "a$" to the key name to ensure substitution goals
63-
* happen before derivation goals.
64-
*/
6561
std::string key() override
6662
{
6763
return "a$" + std::string(storePath.name()) + "$" + worker.store.printStorePath(storePath);

0 commit comments

Comments
 (0)