]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sysupdate: Allow a partial version to be vacuumed
authorPhilip Withnall <pwithnall@gnome.org>
Wed, 22 Apr 2026 16:28:31 +0000 (17:28 +0100)
committerPhilip Withnall <pwithnall@gnome.org>
Fri, 24 Apr 2026 14:29:34 +0000 (15:29 +0100)
Previously we prevented partial and pending versions from being
vacuumed. But until we support resuming downloads, there’s nothing else
which can be done with a partial version except to vacuum it and try
again.

Accordingly, allow partial versions (but not pending versions) to be
vacuumed.

This behaviour can be changed again once resuming downloads is supported
— at that point I expect we’ll want to try resuming the partial download
rather than throwing it all away and trying again.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Helps: https://github.com/systemd/systemd/issues/41502

src/sysupdate/sysupdate-transfer.c

index 3ed7a2ae3a48822d6a036608ef985d042d787cb6..8db1c81962f704fc5b72f307e98f6f056379f238 100644 (file)
@@ -816,10 +816,13 @@ int transfer_vacuum(
                         continue;
                 }
 
-                /* If this is listed among the protected versions, then let's not remove it */
-                if (strv_contains(t->protected_versions, instance->metadata.version) ||
-                    (extra_protected_version && streq(extra_protected_version, instance->metadata.version))) {
-                        log_debug("Version '%s' is pending/partial but protected, not removing.", instance->metadata.version);
+                /* If this is pending and listed among the protected versions, then let's not remove it.
+                 * In future, we will also want to keep partial protected versions, but that’s only useful
+                 * once we support resuming downloads. */
+                if (instance->is_pending &&
+                    (strv_contains(t->protected_versions, instance->metadata.version) ||
+                     (extra_protected_version && streq(extra_protected_version, instance->metadata.version)))) {
+                        log_debug("Version '%s' is pending but protected, not removing.", instance->metadata.version);
                         i++;
                         continue;
                 }