Fix testpackage-appstream: XDG_DATA_DIRS needs to be explicitly extended
ClosedPublic

Authored by kossebau on Apr 21 2020, 4:39 PM.

Details

Summary

Setting XDG_DATA_DIRS in the ENVIRONMENT property using
"XDG_DATA_DIRS=/path:$XDG_DATA_DIRS" has two flaws

  • the value string is not evaluated e.g. by a shell but set directly, so $XDG_DATA_DIRS will stay verbatim
  • if XDG_DATA_DIRS was not set before, setting it now will trigger the rules to use the default /usr/local/share & /usr/share only if XDG_DATA_DIRS is not set, thus effectively removing these dirs now

Diff Detail

Repository
R290 KPackage
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
kossebau created this revision.Apr 21 2020, 4:39 PM
Restricted Application added a project: Frameworks. · View Herald TranscriptApr 21 2020, 4:39 PM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
kossebau requested review of this revision.Apr 21 2020, 4:39 PM

Small disadvantage of the current code is that this binds things to the value of XDG_DATA_DIRS at "cmake" runtime, not "make test" runtime. That would need the move of the env var setting into kpackagetoolappstreamtest.cmake I guess. Tell if you think that is important.

Looks reasonable.

@apol thoughts?

apol accepted this revision.Apr 22 2020, 2:02 AM

Looks like an improvement

This revision is now accepted and ready to land.Apr 22 2020, 2:02 AM
This revision was automatically updated to reflect the committed changes.
pino added a subscriber: pino.Apr 22 2020, 7:10 AM

(Commented in the wrong place)

Shouldn't the test completely ignore the system location, to avoid interferences from the system installation?

The failure which triggered this patch is that appstreamcli or one of the things it links to (since recently?) wants to use some gsettings stuff, which it tries to look up in the system via XDG_DATA_DIRS, as found by sitter.
See https://build.kde.org/job/Frameworks/job/kpackage/job/kf5-qt5%20SUSEQt5.12/96/testReport/projectroot/autotests/testpackage_appstream/

The old code tried to still make any existing XDG_DATA_DIRS content used, just in a broken way. Which this patch fixes. Or: I do not take further responsibilities :P
If that setup is broken/questionable by design, could be possible, did not investigate that, leaving to the actual kpackage maintainers/experts.