]> 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)
committerLuca Boccassi <luca.boccassi@gmail.com>
Fri, 22 May 2026 12:57:29 +0000 (13:57 +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
(cherry picked from commit e1146fe710d0d1bbe0fdca974f66edd7f6c573cc)

src/sysupdate/sysupdate-transfer.c

index 35c0e05083bdf6623b79da3d92e19ab9fb7ce203..231b7cc5ba08f62c00aef0160e29708392d9597b 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;
                 }