Use apt-pkg to get the correct URL to fetch the Changelog.
BUG: 390475
sitter |
Use apt-pkg to get the correct URL to fetch the Changelog.
BUG: 390475
Muon now shows the Changelog in the respective tab.
Automatic diff as part of commit; lint not applicable. |
Automatic diff as part of commit; unit tests not applicable. |
Looks good. I am not sure this is entirely correct though.
From looking at the ::URI() code it seems this will only work if AlwaysOnline isn't set to false (false is the default value). If it is false, ::URI() will try to give out a URI to the local file system using the somewhat non-standard schemes copy:// or gzip:// which I am willing to bet frontends cannot handle properly. Which makes this a backwards incompatible change. So, I'd say you need to apply a filter for http(s) and return QUrl() if it is none of those.
As an addition, you could add another function changelogUrlWithLocal() which returns all URIs, irregardless of scheme, and maybe even coerces those copy:// and gzip:// schemes to file:// (I do not quite understand why they aren't file to begin with though). The two functions could then get merged in the next ABI break.
you might want to make the string cost. other than that good to land. ๐
src/package.cpp | ||
---|---|---|
573 | could be const |
On my system (Ubuntu 17.10 artful) the apt package ships with /etc/apt/apt.conf.d/01-vendor-ubuntu which contains
Acquire::Changelogs::AlwaysOnline "true";
$ apt-config dump |grep AlwaysOnline Acquire::Changelogs::AlwaysOnline "true"; Acquire::Changelogs::AlwaysOnline::Origin ""; Acquire::Changelogs::AlwaysOnline::Origin::Ubuntu "1";
We could force the setting to true when initializing the library, but that would mean to override user settings without notice for no good reason.
Regarding the addition of the function changelogUrlWithLocal() you proposed, I don't care (given the widespread use of the library... Muon and a couple kubuntu tools). I would rather have apt-pkg handle the download/copy/decompression and give me a local file in /tmp/ to pass over. This way the frontend wouldn't have to figure out whether it is compressed and we behave the same way as apt. Although yes, being able to get just the URL makes sense.