topgrade-rs / topgrade

Upgrade all the things
GNU General Public License v3.0
1.7k stars 113 forks source link

feat: new step Lensfun's database update #839

Closed SteveLauC closed 3 days ago

SteveLauC commented 3 days ago

What does this PR do

This PR adds support for updating Lensfun's lenses database via its cli tool lensfun-update-data.

Per the documentation, this update command can be invoked with or without sudo so that one can decide where to install the update. If sudo is used, then the update will be installed system-wide, available to all users. Otherwise, update will be install under user's home directory and thus exclusive to the user.

This option is controlled through the following configuration entry in Topgrade:

[lensfun]
# If disabled, Topgrade invokes `lensfun‑update‑data` without root priviledge, 
# then the update will be only available to you. Otherwise, `sudo` is required,
# and the update will be installed system-wide, i.e., available to all users.
# (default: false)
# use_sudo = false

Standards checklist

For new steps

It should work as this is a one command step.

The lensfun-update-data command does not accept options.

If you developed a feature or a bug fix for someone else and you do not have the means to test it, please tag this person here.

SteveLauC commented 3 days ago

cc @Tokariew, would you like to give this a test?

Tokariew commented 3 days ago

It look good, for root/user when there is update, in case there isn't one the lensfun-update-data return 1 as exit status and topgrade return that lensfun failed

✗  ./topgrade --only lensfun

── 12:39:31 - Lensfun's database update ────────────────────────────────────────
Info: root privileges needed for updating the system database.
Info: updating user DB in '/home/tokariew/.local/share/lensfun/updates'
Reading http://lensfun.sourceforge.net/db/versions.json …
Reading http://wilson.bronger.org/lensfun-db/versions.json …
Info: No newer database was found for last installed Lensfun.
Lensfun's database update failed: 
   0: Command failed: `/usr/bin/lensfun-update-data`
   1: `/usr/bin/lensfun-update-data` failed: exit status: 1

Location:
   src/steps/generic.rs:994
Retry? (y)es/(N)o/(s)hell/(q)uit

── 12:39:33 - Summary ──────────────────────────────────────────────────────────
Lensfun's database update: FAILED

So not sure, how topgrade should behave in case there is no update.

SteveLauC commented 3 days ago

Thanks for testing it!

Try the latest commit, it now takes 1 as a normal exit code:)

Tokariew commented 3 days ago

seems good for me, in all 4 basic cases root/normal user update/no update

tested with no internet and when added to pihole blacklist, and it fail in this case, so it look fine without lensfun installed it's not called. Not sure what else i can test

SteveLauC commented 3 days ago

Thanks for the test, let's merge this pr.