hplip: prevent conflicts with the GUI package #40559
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The
hplip-gui
package uses the exact same files as the regularhplip
package, plus a few extra for the UI and three changes in the configuration file. Rather than copy the entire package contents and registerconflict=
andprovides=
to fool the package manager, we can makehplip-gui
depend onhplip
and just manage a symlink between two alternative configuration files.The only really sophisticated part is handling the configuration symlink when removing
hplip-gui
. Because a user might remove the GUI package and want to keep the non-GUI version installed, the remove hook should detect whether a) it owns the existing symlink (i.e., the link points at the GUI configuration) and b) whether the non-GUI configuration exists (in which case the link should be moved to the non-GUI config; otherwise, it should be removed). The rest of the hooks are very basic:hplip
only claims the configuration symlink on installation if no valid configuration symlink exists, to avoid clobbering, e.g., the existing GUI link on an upgrade.hplip-gui
claims any configuration symlink (but leaves regular files alone) because a user installing the GUI package probably wants it to work.hplip
just removes any configuration symlink it owns when the package is removed.The removal hooks also treat a failure of
readlink
(which really ought to never happen) as if they "own" the symlink.I've run through a few installation and removal cycles, and this seems to do what I expect.