[about-distro] update osrelease parser for latest values in spec

Authored by sitter on Feb 19 2019, 3:04 PM.



and add a simple unit test so one can refactor without fear of regressing
something :((

  • osrelease now takes an optional filepath as ctor argument to enable dummy data for testing
  • instead of exhaustively if-deffing the config keys are now mapped to member variables in a hash and then resolved through that. this makes the mapping a bit more readable but most importantly reduces the syntactic cruft around it so as to make everything easier to copy paste without messing up by not seeing the important elements clearly
  • all currently supported values are now under test

among the newly supported keys is LOGO which we'll be able to use for
our logo \o/

Diff Detail

R102 KInfoCenter
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.
sitter created this revision.Feb 19 2019, 3:04 PM
Restricted Application added a project: Plasma. · View Herald TranscriptFeb 19 2019, 3:04 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
sitter requested review of this revision.Feb 19 2019, 3:04 PM
sitter edited the summary of this revision. (Show Details)Feb 19 2019, 3:04 PM
apol accepted this revision.Feb 21 2019, 7:52 PM
apol added a subscriber: apol.

Makes sense, also thanks for adding a test!
In Discover we're also parsing os-release files (in 2 places), it could make sense to share this code somehow.

This revision is now accepted and ready to land.Feb 21 2019, 7:52 PM

@apol I agree, alas, there was not much interest when I brought it up ;)

This revision was automatically updated to reflect the committed changes.