-
Notifications
You must be signed in to change notification settings - Fork 594
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
daemon: look for snap icon in icons directory as fallback #15027
base: master
Are you sure you want to change the base?
daemon: look for snap icon in icons directory as fallback #15027
Conversation
These new functions, `downloadIconImpl` and `DownloadIcon`, mirror their non-icon counterparts `downloadImpl` and `Download`, except that because snap icons are small, simple assets on a fileserver, there is no need for snap-specific headers, authentication, partial downloads, or caching. These will be used in the future in order to download a snap's icon whenever the new `.snap` blob is downloaded for that snap and linked to a snap icons directory so that the snapd API can serve snap icons from local icon files, rather than returning an error if the snap does not ship an icon at `meta/gui/icon.*`. Signed-off-by: Oliver Calder <[email protected]>
Signed-off-by: Oliver Calder <[email protected]>
Signed-off-by: Oliver Calder <[email protected]>
Signed-off-by: Oliver Calder <[email protected]>
Signed-off-by: Oliver Calder <[email protected]>
Signed-off-by: Oliver Calder <[email protected]>
During the "download-snap" task, download the snap icon as well. During "link-snap" and "unlink-snap", link/unlink the snap icon from the downloaded icons pool to the the installed icons directory, managed much the same way is snap auxinfo. This is because snap icons, like auxinfo, are not revision-specific. Instead, they reflect the current state of the snap listing in the snap store. Lastly, discard the downloaded snap icon when the final revision of the snap is discarded from disk. We want to ensure that the snap icon remains in the pool during any situation when it's possible to install the snap without doing another "download-snap" task, such as via a revert. Signed-off-by: Oliver Calder <[email protected]>
Signed-off-by: Oliver Calder <[email protected]>
Signed-off-by: Oliver Calder <[email protected]>
…p icon url Signed-off-by: Oliver Calder <[email protected]>
The lifecycle of snap icons in the icons pool directory should mirror that of `.snap` files, and only be cleaned up during `doDiscardSnap`, if there are no other revisions of the snap present on the system. There is no need for the `undoDownloadSnap` callback to remove the icon from the pool, since that would prevent an immediately subsequent `doLinkSnap` from finding the icon in the directory. Signed-off-by: Oliver Calder <[email protected]>
…ap icons Signed-off-by: Oliver Calder <[email protected]>
…dy linked It may be useful to revise this behavior in the future, to allow linkSnapIcon to be idempotent. Otherwise, if a snap icon is already linked to the icons directory, but a new icon is downloaded, attempting to link that new icon will fail and the old icon will still be linked. Signed-off-by: Oliver Calder <[email protected]>
Signed-off-by: Oliver Calder <[email protected]>
Signed-off-by: Oliver Calder <[email protected]>
Signed-off-by: Oliver Calder <[email protected]>
These functions work with snap icons, not app-specific icons. Signed-off-by: Oliver Calder <[email protected]>
Signed-off-by: Oliver Calder <[email protected]>
If a snap doesn't ship an icon in `meta/gui/icon.*`, then look for an icon for the snap in question in the snap icons install directory. Signed-off-by: Oliver Calder <[email protected]>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #15027 +/- ##
=========================================
Coverage ? 78.00%
=========================================
Files ? 1143
Lines ? 153486
Branches ? 0
=========================================
Hits ? 119725
Misses ? 26368
Partials ? 7393
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Wed Feb 5 03:02:27 UTC 2025 Failures:Executing:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a little idea.
if len(found) == 0 { | ||
return "" | ||
if len(found) > 0 { | ||
return found[0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it would be better to prioritize .svg over .png, in the case that both do exist?
This PR is based on #15003.
If a snap doesn't ship an icon in
meta/gui/icon.*
, then look for an icon for the snap in question in the snap icons install directory.This work is tracked internally by https://warthogs.atlassian.net/browse/SNAPDENG-34437