Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hplip: prevent conflicts with the GUI package #40559

Merged
merged 1 commit into from Dec 2, 2022

Conversation

ahesford
Copy link
Member

The hplip-gui package uses the exact same files as the regular hplip package, plus a few extra for the UI and three changes in the configuration file. Rather than copy the entire package contents and register conflict= and provides= to fool the package manager, we can make hplip-gui depend on hplip 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.

The hplip-gui package uses the exact same files as the regular hplip
package, plus a few extra for the UI and three changes in the
configuration file. Rather than copy the entire package contents and
register conflict= and provides= to fool the package manager, we can
make hplip-gui depend on hplip and just manage a symlink between two
alternative configuration files.
@ahesford
Copy link
Member Author

I moved every usr/bin/hp* strictly-GUI application and its corresponding script in usr/share/hplip to the hplip-gui package. These are clearly intended to be __main__ entrypoints, so their absence from the hplip packge shouldn't break anything over there.

@ahesford ahesford merged commit 316bc35 into void-linux:master Dec 2, 2022
@ahesford ahesford deleted the hplip-sanity branch December 2, 2022 19:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant