aboutsummaryrefslogtreecommitdiffstats
path: root/pkgs/populate/tests
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-20 01:48:55 +0000
committertv <tv@krebsco.de>2026-11-20 01:48:55 +0000
commit7837a236e728988fcd501917444828b790c367f9 (patch)
treef2f3b91ffe0fd7f60f71f12c5f4f871c92916665 /pkgs/populate/tests
parentf02b09eae7e806f2fe9caa26b4975b94351d7e27 (diff)
populate: lock files rewritten in place change only if they differ
A file or git source whose lock file the flakes step rewrites in place gets the original back from delivering it, on every run, from rsync, or from git reset, which also printed HEAD is now at, and Nix printed that it updates the lock file, so the record said the source changed on every run. Populate keeps a copy of the rewritten lock file in .populate/locks/<name>, and the flakes step compares with it, printing what Nix says about the lock file, and changed, only if it differs. Delivering such a source doesn't count bringing back the lock file: rsync returns the paths of what it changed, and the git source's script takes the lock file's path, and resets quietly if that's all that differs. relock also checks that the second, unchanged, run prints nothing about lock files, and says nothing changed, now for rewriting in place too.
Diffstat (limited to 'pkgs/populate/tests')
-rw-r--r--pkgs/populate/tests/scenarios.nix16
1 files changed, 10 insertions, 6 deletions
diff --git a/pkgs/populate/tests/scenarios.nix b/pkgs/populate/tests/scenarios.nix
index a5ac6ea..fbcae73 100644
--- a/pkgs/populate/tests/scenarios.nix
+++ b/pkgs/populate/tests/scenarios.nix
@@ -546,11 +546,13 @@ in
};
}))
# The lock file gets rewritten or generated again when a source inputs
- # get drawn from changes. What Nix prints about a generated flake's lock
- # file only gets printed then.
+ # get drawn from changes. What Nix prints about the lock file only gets
+ # printed then, and the record only says x changed then, also when
+ # delivering x brings back the lock file that gets rewritten in place.
(modes "relock" ({ draw, flake, mode, ... }: let
x.file = { path = "/fixtures/filesrc"; } // draw { dep.follows = "a"; };
- generated = optional (mode == "generated");
+ # Nix updates the lock file of x, or creates it, if x has none.
+ message = if mode == "generated" then "creating lock file" else "lock file";
in {
phases = [
{
@@ -558,20 +560,22 @@ in
check = ''
expect_eq msg "$(nix_eval_online ${flake "x"}#msg)" top:alt,sub
'';
- output = generated "creating lock file";
+ output = [ message ];
}
{
sources = { inherit x; a.file = "/fixtures/alt"; };
check = ''
expect_eq msg "$(nix_eval_online ${flake "x"}#msg)" top:alt,sub
+ expect_eq changed "$(record changed)" false
'';
- unexpected = generated "lock file";
+ unexpected = [ "lock file" ];
}
{
- output = generated "creating lock file";
+ output = [ message ];
sources = { inherit x; a.file = "/fixtures/alt2"; };
check = ''
expect_eq msg "$(nix_eval_online ${flake "x"}#msg)" top:alt2,sub
+ expect_eq "x changed" "$(record sources.x.changed)" true
'';
}
];