Should we just ignore small packaging errors and run 'apk fix' afterwards?
During an upgrade, oftentimes at least one new-package gets installed instead of (or in addition to) an old-package, and takes over a file from old-package. If that is the case, the new-package must have
replaces="old-package" or else we get an error like the following:
(491/542) Installing bemenu (0.6.7-r0) ERROR: bemenu-0.6.7-r0: trying to overwrite usr/bin/bemenu owned by sxmo-bemenu-0.6.3.0-r0.
(example from aports!34975)
How should we deal with this?
Initially I thought we should just add the
replaces="old-package" each time we see that happening, and try to catch all of these errors with CI. However our CI currently only tests qemu (not other devices) and so we didn't catch a similar bug happening for a few samsung devices where udev rules have been moved to postmarketos-base (#4 (closed)). The fix with using replaces would be in pmaports!3233 (closed). It spawned a discussion regarding how long we should keep the replaces in the package.
Another solution was proposed in !9 (merged), to just try to run
apk fix if there's any packaging error.
While I disliked just running
apk fix at first, on second thought it seems like a nice solution. It only runs if apk did not exit with 0 before, and only runs once. If it still fails, the same error path will be taken (a detailed message with instructions about what the user can do now, see the source). By doing that we avoid a lot of maintenance tasks for patching up the replaces="" everywhere, and to not break upgrades we would need to keep them around forever which adds bloat to the APKBUILDs.
I also thought about only running
apk fix when using the script to do a real upgrade, but not in our CI check. Then we would still catch the errors with missing replaces and would be able to fix them. But it has the same downsides, creating additional maintenance effort with no practical benefit.
So... I think it's fine to just run
apk fix if needed and not bother with setting the replaces for release upgrades.
I'll merge !9 (merged) now to have it fixed for people who try to do the upgrade now, and to avoid the discussion on how long to keep the replaces for these devices in the APKBUILD of postmarketos-base.
But I'm curious of there are other opinions, let's discuss here for a bit.