I-Dream-in-Code / kde-arch-update-plasmoid

30 stars 9 forks source link

[Feature request] Add support for snap #34

Closed navarroaxel closed 5 years ago

navarroaxel commented 6 years ago

Add support for upgrade snaps (apps installed via https://snapcraft.io).

The command to upgrade snaps is sudo snap refresh and requires snapd package installed (https://aur.archlinux.org/packages/snapd).

Could you add a check to append the refresh command to the upgrade process?

Thanks!

I-Dream-in-Code commented 6 years ago

Snaps should automatically update in background once a day correct?

navarroaxel commented 6 years ago

The answer is yes.

I have been investigating but I can't find which pattern use snap for the refresh interval. Looks like snap use a 4 times per day refresh event.

In my laptop:

$ snap refresh --time
timer: 00:00~24:00/4
last: today at 12:24 -03
next: today at 22:09 -03

This Ubuntu doc page is useless even on 18.04https://docs.ubuntu.com/core/en/reference/automatic-refreshes

And I found here https://forum.snapcraft.io/t/system-options/87 that I can set refresh intervals by snap package using this:

sudo snap set core refresh.timer=4:00-7:00,19:00-22:10 

But my goal is this: If I decide to upgrade my system right now I want to check if there are snap packages to be refreshed in the same upgrade process. And your plasmoid and its config panel is the perfect place to trigger the full upgrade process. :smile:

Otherwise I need to write the sudo snap refresh command when your the plasmoid upgrade has finished :crying_cat_face:

I-Dream-in-Code commented 6 years ago

I might as well add full support for snaps and add the ones available to update to the plasmoid

navarroaxel commented 6 years ago

I don't know how to list which packages are available to refresh like checkupdates does.

I-Dream-in-Code commented 6 years ago

I think it's sudo snap refresh --list

I-Dream-in-Code commented 6 years ago

I hope i can do it without sudo

navarroaxel commented 6 years ago

I have tested snap refresh --list and sudo is not required. :+1:

Snap has the characteristic that if you ran snap refresh (without arguments) the command opens a modal requiring authentication for sudo.

I-Dream-in-Code commented 6 years ago

Yeah that'll be a really quick fix then

Question:

I sort the packages both regular and aur

Do you want the snap sorted to or to distinguish it as a snap somehow?

I-Dream-in-Code commented 6 years ago

Can you post the output of snap refresh --list?

I don't have any to test

navarroaxel commented 6 years ago

snap refresh --list

Without pending refresh

All snaps up to date.

With available snaps for refresh:

Name      Version   Rev  Publisher  Notes
webstorm  2017.3.5  16   jetbrains  classic
I-Dream-in-Code commented 6 years ago

Thanks

Is there a way to see the current version?

Trying to have it the same format as checkupdates

navarroaxel commented 6 years ago

I think we need to look up the "refreshable" snaps into the snap list output to generate the same output format that checkupdates has.

Name      Version                 Rev   Tracking  Publisher  Notes
cheat     v2.2.3                  16    stable    bernermic  -
core      16-2.33.1               4917  stable    canonical  core
pubip     0.6                     31    stable    thibran    -
webstorm  2018.2                  39    edge      jetbrains  classic

snap list list all the installed snaps with the current version.

Another type of "upgrade": you can switch the channel for a snap and the refresh is change the current snap to the switched channel, not only applies to upgrades. By example:

$ sudo snap install node --channel=10/stable --classic # install latest node v10 stable version
node (10/stable) 10.7.0 from 'nodesource' installed
$ sudo snap switch node --channel=8/stable # switch to the latest node LTS version
"node" switched to the "8/stable" channel
$ snap refresh --list
Name  Version  Rev  Publisher   Notes
node  8.11.3   732  nodesource  classic
$ snap list
Name      Version                 Rev   Tracking  Publisher   Notes
node      10.7.0                  885   8         nodesource  classic
$ sudo snap refresh # applies the channel switching
node (8/stable) 8.11.3 from 'nodesource' refreshed

In this example the "checkupdates-snap" output could be node 10.7.0 -> 8.11.3 This is not a real upgrade, it's just pending refresh operation for channel switching.

I-Dream-in-Code commented 6 years ago

It might just be easier to list all snaps installed then run refresh --list and just match the ones that have updated

I-Dream-in-Code commented 6 years ago

I'll need to wait until a package can be downgraded to get full functionality

sorry for the wait

I-Dream-in-Code commented 5 years ago

0396cdbb494b01cf490fe46015204e11ed308651 adds support for snap

master and AUR Package are updated

sorry it took so long