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

feat: new step Lensfun's database update #839

Merged
merged 2 commits into from
Jun 30, 2024

Conversation

SteveLauC
Copy link
Member

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

  • The PR title is descriptive.
  • I have read CONTRIBUTING.md
  • Optional: I have tested the code myself

For new steps

  • Optional: Topgrade skips this step where needed
  • Optional: The --dry-run option works with this step

It should work as this is a one command step.

  • Optional: The --yes option works with this step if it is supported by
    the underlying command

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 SteveLauC linked an issue Jun 30, 2024 that may be closed by this pull request
@SteveLauC
Copy link
Member Author

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

@Tokariew
Copy link

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
Copy link
Member Author

Thanks for testing it!

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

@Tokariew
Copy link

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
Copy link
Member Author

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

@SteveLauC SteveLauC merged commit 55e1bbf into topgrade-rs:main Jun 30, 2024
11 checks passed
@SteveLauC SteveLauC deleted the feat/lensfun branch June 30, 2024 14:41
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.

Support for lensfun
2 participants