Skip to content
This repository was archived by the owner on Aug 18, 2026. It is now read-only.

Commit 69e98a4

Browse files
committed
maint/update+perf/speed(Bonfire): halt update when no update upstream
1 parent 71f6341 commit 69e98a4

1 file changed

Lines changed: 29 additions & 9 deletions

File tree

pkgs/by-name/bonfire/package.nix

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
callPackage,
44
fetchFromGitHub,
55
gitUpdater,
6+
gitMinimal,
67
lib,
78
writeText,
89
writeShellApplication,
@@ -57,18 +58,37 @@ lib.recurseIntoAttrs (
5758
updateScript = _experimental-update-script-combinators.sequence [
5859
(gitUpdater { rev-prefix = "v"; })
5960
{
60-
command = (
61-
writeShellApplication {
62-
name = "bonfire-update-flavours";
63-
text = ''
61+
command = lib.getExe (writeShellApplication {
62+
name = "bonfire-update-flavours";
63+
runtimeInputs = [
64+
gitMinimal
65+
];
66+
text = lib.concatLines [
67+
# Avoid a costly update if `gitUpdater` has not modified this file.
68+
''
69+
if git diff --exit-code -- pkgs/by-name/bonfire/package.nix; then
70+
exit 0
71+
fi
72+
''
73+
# Clean everything to begin with to avoid leftovers.
74+
''
6475
rm -rf pkgs/by-name/bonfire/extensions/*/
6576
mkdir -p pkgs/by-name/bonfire/extensions/
6677
''
67-
+ lib.concatMapStringsSep "\n" (flavour: ''
68-
${finalFlavours.${flavour}.passthru.update.script}
69-
'') flavours;
70-
}
71-
);
78+
# Updating all flavours using the same `src` set by `gitUpdater`
79+
# to avoid any flavour ending up using a `src` no longer matching
80+
# the files generated in pkgs/by-name/bonfire/extensions/${flavour}/,
81+
# which can happen when upstream releases a new version
82+
# during the update of a flavour,
83+
# which is likely since each flavour update takes roughly one hour.
84+
(lib.concatMapStringsSep "\n" (
85+
flavour:
86+
lib.optionalString (!(finalFlavours.${flavour}.meta.broken or false)) ''
87+
${lib.getExe finalFlavours.${flavour}.passthru.update.script}
88+
''
89+
) flavours)
90+
];
91+
});
7292
supportedFeatures = [ "silent" ];
7393
}
7494
];

0 commit comments

Comments
 (0)