Skip to content
Permalink
Browse files

Merge pull request #3277 from darddan/kconfig_set

KConfig Set
  • Loading branch information
mpranj committed Dec 1, 2019
2 parents 68d4bb6 + 23eba9f commit 3c53b19a51b41e9588284a1943d8c25211748a42
@@ -43,6 +43,10 @@ The following section lists news about the [modules](https://www.libelektra.org/

- Improved error message for augeas to show lensPath. _(Michael Zronek)_

### KConfig

- We implemented the methods that save a KeySet into a file with the KConfig Ini format. _(Dardan Haxhimustafa)_

### SWIG

- Configure line (-DBINDINGS="..") for SWIG based bindings have been changed from `swig_foo` to `foo`. _(Manuel Mausz)_
@@ -6,4 +6,5 @@ add_plugin (
kconfig_delegate.cpp
kconfig_parser.cpp
kconfig_parser_exception.cpp
kconfig_serializer.cpp
file_utility.cpp)
@@ -7,11 +7,11 @@
- infos/placements = getstorage setstorage
- infos/status = recommended maintained compatible specific experimental unfinished nodoc concept
- infos/metadata =
- infos/description = Reads the KConfig INI format
- infos/description = Reads and writes the KConfig INI format

## Introduction

This plugin can be used to parse a [KConfig](https://cgit.kde.org/kconfig.git) INI file into a KeySet.
This plugin can be used to parse and serialize a [KConfig](https://cgit.kde.org/kconfig.git) INI file.

Information about the syntax:

@@ -73,6 +73,13 @@ echo 'key=Value' > `kdb file /tests/kconfig`
kdb get /tests/kconfig/key
#> Value
# Set the value to Example
kdb set /tests/kconfig/key Example
# Verify that the value has changed in the file too
cat `kdb file /tests/kconfig`
#> key=Example
# Manually add a gorup to the database
echo '[group][subgroup]' >> `kdb file /tests/kconfig`
@@ -87,6 +94,19 @@ kdb get /tests/kconfig/group/subgroup/key.name
kdb meta-get /tests/kconfig/group/subgroup/key.name kconfig
#> ai
# Manually add a group and a localized key
echo '[localized keys]' >> `kdb file /tests/kconfig`
echo 'greeting[en]=Hello' >> `kdb file /tests/kconfig`
echo 'greeting[de]=Hallo' >> `kdb file /tests/kconfig`
# Retrieve the english greeting
kdb get '/tests/kconfig/localized keys/greeting[en]'
#> Hello
# Retrieve the german greeting
kdb get '/tests/kconfig/localized keys/greeting[de]'
#> Hallo
# Undo modifications to the database
sudo kdb umount /tests/kconfig
```
@@ -11,7 +11,7 @@ FileUtility::FileUtility (std::string filenameParam, std::unique_ptr<std::istrea

char FileUtility::peekNextChar ()
{
return this->file->peek ();
return static_cast<char> (this->file->peek ());
}

bool FileUtility::isNextCharEOF ()
@@ -66,7 +66,7 @@ void FileUtility::skipLine ()
++currentLine;
while (true)
{
switch (this->file->get ())
switch (static_cast<char> (this->file->get ()))
{
case character_newline:
return;
@@ -101,7 +101,7 @@ void FileUtility::skipLineIfEmptyOrComment ()

inline void FileUtility::readEscapedChar (std::ostream & str)
{
switch (this->file->get ())
switch (static_cast<char> (this->file->get ()))
{
case 'n':
str << '\n';
@@ -125,7 +125,7 @@ void FileUtility::readUntilChar (std::ostream & str, const char & delimiter)
char c;
while (true)
{
c = this->file->get ();
c = static_cast<char> (this->file->get ());

if (c == EOF && isNextCharEOF ())
{
@@ -152,7 +152,7 @@ void FileUtility::readUntilChar (std::ostream & str, const char & delimiterA, co
char c;
while (true)
{
c = this->file->get ();
c = static_cast<char> (this->file->get ());
if (c == EOF && isNextCharEOF ())
{
break;
@@ -9,7 +9,9 @@

#include "kconfig.hpp"
#include "kconfig_delegate.hpp"
#include "kconfig_serializer.hpp"

#include <fstream>
#include <kdberrors.h>
#include <kdbhelper.h>

@@ -117,9 +119,34 @@ int elektraKconfigGet (Plugin * handle, KeySet * returned, Key * parentKey)
}

/** @see elektraDocSet */
int elektraKconfigSet (Plugin * handle ELEKTRA_UNUSED, KeySet * returned ELEKTRA_UNUSED, Key * parentKey ELEKTRA_UNUSED)
int elektraKconfigSet (Plugin * handle ELEKTRA_UNUSED, KeySet * returned, Key * parentKey)
{
return ELEKTRA_PLUGIN_STATUS_NO_UPDATE;
CppKeySet keys{ returned };
CppKey parent{ parentKey };

ELEKTRA_LOG_DEBUG ("Save `%s` using the kconfig plugin", parent.getFullName ().c_str ());
auto filePtr = new std::ofstream{ parent.getString () };
bool isFileOpen = filePtr->is_open ();
std::unique_ptr<std::ostream> file{ filePtr };

if (!isFileOpen)
{
ELEKTRA_SET_RESOURCE_ERRORF (parent.getKey (), "Unable to save data to file '%s'. Reason: %s", parent.getString ().c_str (),
"Could not open the file.");
parent.release ();
keys.release ();
return ELEKTRA_PLUGIN_STATUS_ERROR;
}
ELEKTRA_LOG_DEBUG ("File opened successfully, start saving the data.");

KConfigSerializer serializer{ keys, parent, std::move (file) };
serializer.save ();

ELEKTRA_LOG_DEBUG ("Data succesfully stored into `%s`.", parent.getFullName ().c_str ());

parent.release ();
keys.release ();
return ELEKTRA_PLUGIN_STATUS_SUCCESS;
}

/** @see elektraDocError */
@@ -1,7 +1,7 @@
// clang-format off
ksNew (10,
keyNew (PREFIX "meta_key", KEY_VALUE, "Some meta", KEY_META, "kconfig", "i", KEY_END),
keyNew (PREFIX "empty_group/with_meta", KEY_META, "kconfig", "a", KEY_END),
keyNew (PREFIX "group_with/localizations/localized[en]", KEY_VALUE, "Hello", KEY_END),
keyNew (PREFIX "group_with/localizations/localized[de]", KEY_VALUE, "Hallo", KEY_END),
KS_END)
keyNew ("/meta_key", KEY_VALUE, "Some meta", KEY_META, "kconfig", "i", KEY_END),
keyNew ("/empty_group/with_meta", KEY_META, "kconfig", "a", KEY_END),
keyNew ("/group_with/localizations/localized[en]", KEY_VALUE, "Hello", KEY_END),
keyNew ("/group_with/localizations/localized[de]", KEY_VALUE, "Hallo", KEY_END),
KS_END)
@@ -3,4 +3,4 @@ meta_key[$i]=Some meta
[empty_group][with_meta][$a]
[group_with][localizations]
localized[en]=Hello
localized[de]=Hallo
localized[de]=Hallo
@@ -1,5 +1,5 @@
// clang-format off
ksNew (10,
keyNew (PREFIX "groupless.key", KEY_VALUE, "Simple Value With Spaces", KEY_END),
keyNew (PREFIX "example/group/example.key", KEY_VALUE, "Key\nWith\tEscaped\\Characters", KEY_END),
KS_END)
keyNew ("/groupless.key", KEY_VALUE, "Simple Value With Spaces", KEY_END),
keyNew ("/example/group/example.key", KEY_VALUE, "Key\nWith\tEscaped\\Characters", KEY_END),
KS_END)
@@ -0,0 +1,16 @@
// clang-format off
ksNew (10, // Notice that the keys are not ordered the same as in test_valid_baserc. That is also part of testing
keyNew (TEST_VALID_PREFIX "/group/emojis", KEY_VALUE, "😂😭😍❤️🤔", KEY_END),
keyNew (TEST_VALID_PREFIX "/empty_group/with_meta/meta_key", KEY_META, "kconfig", "i", KEY_VALUE, "Some meta", KEY_END),
keyNew (TEST_VALID_PREFIX "/group/key[en]", KEY_VALUE, "Hello", KEY_META, "kconfig", "ei", KEY_END ),
keyNew (TEST_VALID_PREFIX "/group/title", KEY_VALUE, "KConfig Test", KEY_END),
keyNew (TEST_VALID_PREFIX "/group/escaped.chars", KEY_VALUE, "Hello\tTabbed\tWorld\n", KEY_END),
keyNew (TEST_VALID_PREFIX "/empty_group/with_meta", KEY_META, "kconfig", "a", KEY_END),
keyNew (TEST_VALID_PREFIX "/group_with/localizations/localized[en]", KEY_VALUE, "Hello", KEY_END),
keyNew (TEST_VALID_PREFIX "/group/key[de]", KEY_VALUE, "Hallo", KEY_END),
keyNew (TEST_VALID_PREFIX "/group/umlaute", KEY_VALUE, "äöü", KEY_END),
keyNew (TEST_VALID_PREFIX "/empty_group/with_meta/meta_key", KEY_META, "kconfig", "i", KEY_VALUE, "Some meta", KEY_END),
keyNew (TEST_VALID_PREFIX "/group_with/localizations/localized[de]", KEY_VALUE, "Hallo", KEY_END),
keyNew (TEST_VALID_PREFIX "/very/long/group/name/that/contains/a single key/with/multiple/metadata/and a random string/in the keyname/Uw6buaGdLA2LSf62XkO2uTrbprpvXLR85fOC8wkQasascjeuLlc1FrDQSz2f4iWCqEdOC3M2EmuYql5MheP9bi7v26riIfBsq538ITyhu1NDTWtk8dFQ13uVLv6TwmD1IrXdU2F4iF4qPKkIQwjN0zWnV9IwU4jEHN6sqtKZoalmXgaqo7FIoOdKAzv4WyWvdTV1N32xnT9Ytmx4TMTO4S8KgLmIXAzix0aX6EjJixdY7Szei9KT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zWlpa88LGeoPnnsMB6igv9DYElVnIlTnuRAUSGTbUI2BZN2JsSJKCJIqON1Hwu1up02lUT5MJRV5BFcuTiQzCGFwBdbDqFu4wpcusnnfqiSl0a8S0BP4VEk4a42VxuBwHVatLk1yWqq2WTt00HRzGCCOO26EFfEMe06LLzJeyLNFGuAjDHpIlyafnEUay0ed09DzivtgIrmUYoKbZVkYbecqHJi8X538RBCC1fiMCKWjl5Gc5exkB4Oco5qLeparFXl8vhZNHDIgHxwTfwaKKavVqIJx5Pr6olUWKnBQAvf70FNzEYtB8wIfjp2mvaDTAcfuHg6jsZsTBmgBHW9ICtHxmr4aAYlKi1zYjbOkVWp7aS35pVBpQeE5WZroHfoDBhpFw4lQjVdc3DymcTQEv1lfkL1ZQtjQTkVOCnjV1CCMjQPe7xIUCcEGcghS6L9QzKif", KEY_END),
KS_END)
@@ -0,0 +1,17 @@
[empty_group][with_meta][$a]
meta_key[$i]=Some meta

[group]
emojis=😂😭😍❤️🤔
escaped.chars=Hello\tTabbed\tWorld\n
key[de]=Hallo
key[en][$e][$i]=Hello
title=KConfig Test
umlaute=äöü

[group_with][localizations]
localized[de]=Hallo
localized[en]=Hello

[very][long][group][name][that][contains][a single key][with][multiple][metadata][and a random string][in the keyname][Uw6buaGdLA2LSf62XkO2uTrbprpvXLR85fOC8wkQasascjeuLlc1FrDQSz2f4iWCqEdOC3M2EmuYql5MheP9bi7v26riIfBsq538ITyhu1NDTWtk8dFQ13uVLv6TwmD1IrXdU2F4iF4qPKkIQwjN0zWnV9IwU4jEHN6sqtKZoalmXgaqo7FIoOdKAzv4WyWvdTV1N32xnT9Ytmx4TMTO4S8KgLmIXAzix0aX6EjJixdY7Szei9KTh7xjF7EyiK5K6PjcSetQKnxMEuX337CjCBwgQzOEGGoMFhjd6dsSmlmFy2DM7GXIsI1UfwkYWVmZ1ylOLQkZC0nJ8r8Z6NAT8hbk4xmyzEAq8ijESz2NdjTsPT7yg9y3FJx6vVwtT8BD2XU8pLurS7kyTwt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EUay0ed09DzivtgIrmUYoKbZVkYbecqHJi8X538RBCC1fiMCKWjl5Gc5exkB4Oco5qLeparFXl8vhZNHDIgHxwTfwaKKavVqIJx5Pr6olUWKnBQAvf70FNzEYtB8wIfjp2mvaDTAcfuHg6jsZsTBmgBHW9ICtHxmr4aAYlKi1zYjbOkVWp7aS35pVBpQeE5WZroHfoDBhpFw4lQjVdc3DymcTQEv1lfkL1ZQtjQTkVOCnjV1CCMjQPe7xIUCcEGcghS6L9QzKif
@@ -43,12 +43,15 @@ kdb::KeySet KconfigDelegate::getConfig (Key const & parent)

ELEKTRA_LOG_DEBUG ("Parse `%s` using the kconfig plugin", parent.getString ().c_str ());
auto filePtr = new std::ifstream{ parent.getString () };
if (!filePtr->is_open ())
bool isFileOpen = filePtr->is_open ();
std::unique_ptr<std::istream> file{ filePtr };

if (!isFileOpen)
{
delete filePtr;
throw std::runtime_error ("Could not open the file.");
}

std::unique_ptr<std::istream> file{ filePtr };

ELEKTRA_LOG_DEBUG ("The file opened successfully. Start parsing");
try

0 comments on commit 3c53b19

Please sign in to comment.
You can’t perform that action at this time.