New location for KNSRC files
ClosedPublic

Authored by leinir on Feb 26 2019, 1:25 PM.

Details

Summary

This introduces a cmake variable in KNewStuffCore which contains a KDEInstallDirs based location for our knsrc files, and further adds functionality to fetch search locations from KNewStuff.

A fallback is currently included, as we have to be able to work with older software. We also unfortunately cannot properly mark anything as deprecated, as there previously was no API for this, but rather a basic instruction to just install knsrc files in the system configuration directory (instructions which previously not even a part of the API docs, which this patch also addresses). The code was written with future deprecation in mind, and we can at that time simply remove the configuration fallback options and the functionality it holds.

Rationale:
This change is being made on request from various distributions, as the current install location for knsrc files is causing a great many issues during the distribution update cycle which means we are left with stale knsrc files in various places. This in turn causes a great many issues, particularly for Discover which has suffered crashes and other strange side effects when attempting to use these stale files (some of which attempt to access servers which almost-but-not-quite respond). Discover has workarounds for some of these, but it is becoming more than a little awkward, and being able to manage this a little more tightly would come in very handy indeed.

Diff Detail

Repository
R304 KNewStuff
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
leinir created this revision.Feb 26 2019, 1:25 PM
Restricted Application added a project: Frameworks. · View Herald TranscriptFeb 26 2019, 1:25 PM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
leinir requested review of this revision.Feb 26 2019, 1:25 PM
apol added a comment.Feb 26 2019, 3:10 PM

+1 cool stuff!

this opens the possibility for files being both in /usr and /etc, can you make sure hell doesn't break loose when that happens?

Was these files look up was delegated entirely to KConfig?

In D19338#420303, @apol wrote:

+1 cool stuff!

this opens the possibility for files being both in /usr and /etc, can you make sure hell doesn't break loose when that happens?

Was these files look up was delegated entirely to KConfig?

It does indeed. Going to have to do a bit of checking first, then. Yes, it was previously entirely delegated to KConfig. It already checks to see if the config file exists, which would mean the path which looks up the config in /etc/xdg will only be hit if the config location is relative, the fallback is enabled, and there is no config of that name discovered in /usr/share/knsrcfiles :)

leinir updated this revision to Diff 53117.Mar 4 2019, 12:45 PM

Since 5.57, not 5.56

Quick ping, be good to get this in sometime before it becomes late again... :)

apol accepted this revision.Mar 13 2019, 2:36 PM
This revision is now accepted and ready to land.Mar 13 2019, 2:36 PM
ngraham accepted this revision.Mar 13 2019, 4:13 PM

Works great, thanks.

This revision was automatically updated to reflect the committed changes.
kossebau added inline comments.
README.md
60

Misses to note which version this variable was introduced, and what to do to support older versions still.

See D26248 as proposal to fix this.

Hm, why was this new variable KDE_INSTALL_KNSRCDIR not put into KDEInstallDirs?

Hm, why was this new variable KDE_INSTALL_KNSRCDIR not put into KDEInstallDirs?

On the other hand it makes sense that module-specific variables are provided by the CMake config file of the respective module. Which allows projects to use the module without having to use KDEInstallDirs, but e.g. GnuInstallDirs.

Hm, why was this new variable KDE_INSTALL_KNSRCDIR not put into KDEInstallDirs?

On the other hand it makes sense that module-specific variables are provided by the CMake config file of the respective module. Which allows projects to use the module without having to use KDEInstallDirs, but e.g. GnuInstallDirs.

That could be done with checking in KNewStuff if KDE_INSTALL_KNSRCDIR isn't already set, then provide a fallback value, right? Because right now it means just installing a .knsrc file into the right path requires KNewStuff.