libstore: remove Goal::key

this was a debugging aid from day one that should not have any impact on
build semantics, and if it *does* have an impact on build semantics then
build semantics are seriously broken. keeping the order imposed by these
keys will be impossible once we let a real event loop schedule our jobs.

Change-Id: I5c313324e1f213ab6453d82f41ae5e59de809a5b
This commit is contained in:
eldritch horrors 2024-09-25 23:57:46 +02:00
parent a5240b23ab
commit 7f4f86795c
8 changed files with 3 additions and 49 deletions

View file

@ -113,16 +113,6 @@ DerivationGoal::~DerivationGoal() noexcept(false)
} }
std::string DerivationGoal::key()
{
/* Ensure that derivations get built in order of their name,
i.e. a derivation named "aardvark" always comes before
"baboon". And substitution goals always happen before
derivation goals (due to "b$"). */
return "b$" + std::string(drvPath.name()) + "$" + worker.store.printStorePath(drvPath);
}
void DerivationGoal::killChild() void DerivationGoal::killChild()
{ {
hook.reset(); hook.reset();

View file

@ -247,8 +247,6 @@ struct DerivationGoal : public Goal
Finished timedOut(Error && ex); Finished timedOut(Error && ex);
std::string key() override;
kj::Promise<Result<WorkResult>> work() noexcept override; kj::Promise<Result<WorkResult>> work() noexcept override;
/** /**

View file

@ -166,13 +166,6 @@ try {
return {std::current_exception()}; return {std::current_exception()};
} }
std::string DrvOutputSubstitutionGoal::key()
{
/* "a$" ensures substitution goals happen before derivation
goals. */
return "a$" + std::string(id.to_string());
}
kj::Promise<Result<Goal::WorkResult>> DrvOutputSubstitutionGoal::work() noexcept kj::Promise<Result<Goal::WorkResult>> DrvOutputSubstitutionGoal::work() noexcept
{ {
return (this->*state)(slotToken.valid()); return (this->*state)(slotToken.valid());

View file

@ -74,8 +74,6 @@ public:
kj::Promise<Result<WorkResult>> outPathValid(bool inBuildSlot) noexcept; kj::Promise<Result<WorkResult>> outPathValid(bool inBuildSlot) noexcept;
kj::Promise<Result<WorkResult>> finished() noexcept; kj::Promise<Result<WorkResult>> finished() noexcept;
std::string key() override;
kj::Promise<Result<WorkResult>> work() noexcept override; kj::Promise<Result<WorkResult>> work() noexcept override;
JobCategory jobCategory() const override { JobCategory jobCategory() const override {

View file

@ -6,13 +6,6 @@
namespace nix { namespace nix {
bool CompareGoalPtrs::operator() (const GoalPtr & a, const GoalPtr & b) const {
std::string s1 = a->key();
std::string s2 = b->key();
return s1 < s2;
}
void Goal::trace(std::string_view s) void Goal::trace(std::string_view s)
{ {
debug("%1%: %2%", name, s); debug("%1%: %2%", name, s);

View file

@ -22,14 +22,10 @@ class Worker;
*/ */
typedef std::shared_ptr<Goal> GoalPtr; typedef std::shared_ptr<Goal> GoalPtr;
struct CompareGoalPtrs {
bool operator() (const GoalPtr & a, const GoalPtr & b) const;
};
/** /**
* Set of goals. * Set of goals.
*/ */
typedef std::set<GoalPtr, CompareGoalPtrs> Goals; typedef std::set<GoalPtr> Goals;
/** /**
* Used as a hint to the worker on how to schedule a particular goal. For example, * Used as a hint to the worker on how to schedule a particular goal. For example,
@ -167,8 +163,6 @@ public:
return name; return name;
} }
virtual std::string key() = 0;
virtual void cleanup() { } virtual void cleanup() { }
/** /**

View file

@ -90,15 +90,6 @@ public:
); );
~PathSubstitutionGoal(); ~PathSubstitutionGoal();
/**
* We prepend "a$" to the key name to ensure substitution goals
* happen before derivation goals.
*/
std::string key() override
{
return "a$" + std::string(storePath.name()) + "$" + worker.store.printStorePath(storePath);
}
kj::Promise<Result<WorkResult>> work() noexcept override; kj::Promise<Result<WorkResult>> work() noexcept override;
/** /**

View file

@ -146,11 +146,8 @@ out="$(nix build -f fod-failing.nix -L 2>&1)" && status=0 || status=$?
test "$status" = 1 test "$status" = 1
# one "hash mismatch" error, one "build of ... failed" # one "hash mismatch" error, one "build of ... failed"
test "$(<<<"$out" grep -E '^error:' | wc -l)" = 2 test "$(<<<"$out" grep -E '^error:' | wc -l)" = 2
<<<"$out" grepQuiet -E "hash mismatch in fixed-output derivation '.*-x1\\.drv'" <<<"$out" grepQuiet -E "hash mismatch in fixed-output derivation '.*-x.\\.drv'"
<<<"$out" grepQuiet -vE "hash mismatch in fixed-output derivation '.*-x3\\.drv'" <<<"$out" grepQuiet -E "likely URL: "
<<<"$out" grepQuiet -vE "hash mismatch in fixed-output derivation '.*-x2\\.drv'"
<<<"$out" grepQuiet -E "likely URL: https://meow.puppy.forge/puppy.tar.gz"
<<<"$out" grepQuiet -vE "likely URL: https://kitty.forge/cat.tar.gz"
<<<"$out" grepQuiet -E "error: build of '.*-x[1-4]\\.drv\\^out', '.*-x[1-4]\\.drv\\^out', '.*-x[1-4]\\.drv\\^out', '.*-x[1-4]\\.drv\\^out' failed" <<<"$out" grepQuiet -E "error: build of '.*-x[1-4]\\.drv\\^out', '.*-x[1-4]\\.drv\\^out', '.*-x[1-4]\\.drv\\^out', '.*-x[1-4]\\.drv\\^out' failed"
out="$(nix build -f fod-failing.nix -L x1 x2 x3 --keep-going 2>&1)" && status=0 || status=$? out="$(nix build -f fod-failing.nix -L x1 x2 x3 --keep-going 2>&1)" && status=0 || status=$?