Hello,
we are delighted to announce our latest feature release providing major updates in:
Elektra now is fully XDG 0.8 compliant. Following changes were necessary:
For example, we could use resolver_fm_xhp_x
:
kdb mount --resolver=resolver_fm_xhp_x file.dump /example dump
kdb file user/example
kdb file system/example
Will show you that for both user+system the resolver respects XDG environment variables, e.g. above lines will print:
/home/m/.config/file.dump
/etc/xdg/file.dump
Of course, any attempts to get and set keys below user/example and system/example will also be in these files.
The letters after _
describe the variant of the resolver:
f
.. file-based lockingm
.. mutex based locking (for multiple KDB per process)_
)x
.. first check XDG_CONFIG_HOME
environmenth
.. then check HOME
environmentp
.. then fall back to passwd_
)x
.. check all paths in XDG_CONFIG_DIRS
and falls back to /etc/xdg
A lot of such resolver variants are added when -DPLUGINS=ALL
is used.
Of course you can create new variants with different behavior by adding
them to PLUGINS.
To make your application (that uses Elektra) XDG aware, you have nothing to do: you get it to free. Make sure to always use cascading lookup. Additionally, an XDG conforming application should not write system/ keys.
Based on that, Elektra now also implements the draft for the OpenICC specification.
The mount command looks like quite complicated, but it consists of simple parts:
kdb mount --resolver=resolver_fm_xhp_x \
color/settings/openicc-devices.json /org/freedesktop/openicc \
yajl rename cut=org/freedesktop/openicc
We already know the first two lines: we use the XDG resolver already introduced above. Only the file name and the path where it should be mounted differs.
The plugin yajl is a storage plugin that reads/writes json. The plugin rename was the missing link to support OpenICC (thanks to Felix Berlakovich for closing this gap). It is needed, because every OpenICC file starts like this:
{ "org": { "freedesktop": { "openicc": {
Because the backend is mounted at /org/freedesktop/openicc, it would lead to keys below /org/freedesktop/openicc/org/freedesktop/openicc which we obviously do not want. So we simply get rid of the common prefix by cutting it out using the rename plugin.
Of course this renaming functionality can be used in every situation and is not limited to OpenICC.
A large number of old and new tools were added, mostly for convenience e.g.:
kdb mount-openicc
saves you from writing the long mount command we had in the previous section.
To get a list of all tools that are installed, now the command (which is also an external tool and as such currently not displayed in kdb --help):
kdb list-tools
is available. Do not be surprised: on typical installations this will
be a large list. You can run each of these tools by using kdb
kdb run_all
Other tools are "old friends", e.g. convert-fstab written in 2006 by Avi Alkalay still works:
kdb convert-fstab | kdb import system/filesystems xmltool
It will parse your /etc/fstab and generate a XML. This XML then can be imported. Other convert tools directly produce kdb commands, though.
kdb now uses KDB itself for many commands:
By default the plugin "sync" is added automatically (it makes sure that fsync is executed on config files, the directory is already done by the resolver), you should not remove it from /sw/kdb/current/plugins otherwise the next mount command will not add it. To preserve it use a space separated list, e.g.:
kdb set user/sw/kdb/current/plugins "sync syslog"
Last, but not least, kdb get now supports cascading get:
kdb get /sw/kdb/current/plugins
This feature allows you to see the configuration exactly as seen by the application.
Other options:
kdb mount
kdb mount
The core API (kdb.h), as always, stayed API/ABI compatible. The only
changes in kdb.h is the addition of KEY_CASCADING_NAME
and
KEY_META_NAME
. So applications compiled against 0.8.10 and using these
constants, will not work with Elektra 0.8.9.
The constants allow us to create following kinds of keys:
Usage in C is:
Key *c = keyNew("/org/freedesktop", KEY_CASCADING_NAME, KEY_END);
Key *m = keyNew("comment/#0", KEY_META_NAME, KEY_END);
The same functionality exists, of course, in available in all bindings, too.
Changes in non-core API are:
It is now possible to remove a plugin/binding/tools by prefixing a name with "-". The new "-element" syntax is accepted by TOOLS, BINDINGS and PLUGINS. It is very handy in combination with ALL, e.g.:
-DPLUGINS="ALL;-xmltool"
will include all plugins except xmltool.
Comment preserving was improved a lot. Especially, the hosts plugin was rewritten completely. Now multiple different comment styles can be intermixed without losing information. E.g. some INI formats support both ; and # for comments. With the new comments it is possible to preserve that information and even better: applications can iterate over that information (metadata).
To mount the new hosts plugin use (if you already have mounted it, you have nothing to do):
kdb mount /etc/hosts system/hosts hosts
The hosts plugin now separates from ipv4 and ipv6 which makes the host names canonical again, e.g.:
kdb get system/hosts/ipv4/localhost
kdb get system/hosts/ipv6/localhost
To access the inline-comment, use:
kdb getmeta system/hosts/ipv4/localhost "comment/#0"
For other meta information, see:
kdb lsmeta system/hosts/ipv4/localhost
Additionally, a small API for specific metadata operations emerges. These operations will be moved to a separate library and will not stay in Elektra’s core library.
KDB_O_SPEC
uses the lookup key as specificationKDB_O_CREATE
creates a key if it could not be foundelektraKeyGetMetaKeySet
creates a KeySet from metadataelektraKsFilter
allows us to filter a KeySet arbitrarily (not only
keyIsBelow
in case of ksCut
). It reintroduces more functional
programming.keyGetNamespace
was reintroduced. In one of the next versions of
Elektra we will introduce new namespaces. keyGetNamespace
allows the
compiler to output a warning when some namespaces are not handled in
your C/C++ code.Elektra now fully supports applications written in Java and also Plugins written in the same language.
The new binding was developed using jna. For the plugin interface JNI was used. We developed already some plugins.
Raffael Pancheri released the version 0.0.2 of the Qt-Gui:
on_open
/trigger_warnings
to be consistentkdb check
You can download the release from here
already built API documentation can be found here
Subscribe to the new RSS feed to always get the release notifications.
For more information, see https://www.libelektra.org
Best regards, Markus