Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

Commit

Permalink
Merge branch 'ElektraInitiative:master' into kdb_cli_rewrite
Browse files Browse the repository at this point in the history
  • Loading branch information
hannes99 authored Sep 16, 2022
2 parents 59baf0d + e3c31c7 commit c756e73
Show file tree
Hide file tree
Showing 39 changed files with 612 additions and 928 deletions.
8 changes: 5 additions & 3 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,25 @@ task:
freebsd_instance:
cpu: 4
memory: 8G
image_family: freebsd-12-2
image_family: freebsd-12-3

- name: 😈 FreeBSD 13
freebsd_instance:
cpu: 4
memory: 8G
image_family: freebsd-13-0
image_family: freebsd-13-1

- name: 😈 ASAN
freebsd_instance:
cpu: 8
memory: 8G
image_family: freebsd-13-0
image_family: freebsd-13-1
env:
ENABLE_ASAN: ON

install_script:
- pkg update -f
- pkg upgrade -y
- >
pkg install -y
bison
Expand Down
21 changes: 6 additions & 15 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required (VERSION 3.4)
cmake_minimum_required (VERSION 3.12)

# allows us to override platform specific variables
set (CMAKE_USER_MAKE_RULES_OVERRIDE "${CMAKE_SOURCE_DIR}/scripts/cmake/Platform.cmake")
Expand All @@ -12,20 +12,11 @@ set (ELEKTRA_DESCRIPTION
"Elektra serves as a universal and secure framework to access configuration settings in a global, hierarchical key database.")
set (ELEKTRA_HOMEPAGE_URL "https://www.libelektra.org")

if (CMAKE_VERSION VERSION_LESS 3.9)
project (Elektra VERSION "${KDB_VERSION}")
elseif (CMAKE_VERSION VERSION_LESS 3.12)
project (
Elektra
VERSION ${KDB_VERSION}
DESCRIPTION ${ELEKTRA_DESCRIPTION})
else (CMAKE_VERSION VERSION_LESS 3.12)
project (
Elektra
VERSION ${KDB_VERSION}
DESCRIPTION ${ELEKTRA_DESCRIPTION}
HOMEPAGE_URL ${ELEKTRA_HOMEPAGE_URL})
endif (CMAKE_VERSION VERSION_LESS 3.9)
project (
Elektra
VERSION ${KDB_VERSION}
DESCRIPTION ${ELEKTRA_DESCRIPTION}
HOMEPAGE_URL ${ELEKTRA_HOMEPAGE_URL})

# fix macOS RPATH issues
if (APPLE)
Expand Down
2 changes: 1 addition & 1 deletion doc/AUTHORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ notification system, I/O bindings

## Maximilian Irlinger

documentation
documentation, Python bindings for elektraMerge

- email: [email protected]
- github user: [atmaxinger](https://github.com/atmaxinger)
Expand Down
2 changes: 1 addition & 1 deletion doc/news/2019-08-06_0.9.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,7 @@ mounted, use `kdb gen -F <plugin>:<file> elektra <parentKey> <outputName>` to lo

- The Docker images for

- [Debian stretch](../../scripts/docker/debian/stretch/Dockerfile), and
- [Debian stretch](https://git.libelektra.org/blob/799fecd94dcb482ea9338facaf63d39f8e5ab5bd/scripts/docker/debian/stretch/Dockerfile), and
- [Debian sid](../../scripts/docker/debian/sid/Dockerfile),

now include the Python YAML library recommended by [cmake format](https://github.com/cheshirekow/cmake_format). _(René Schwaiger)_
Expand Down
2 changes: 1 addition & 1 deletion doc/news/2021-02-01_0.9.4.md
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ you up to date with the multi-language support provided by Elektra.

### Docker

- We added a Docker image for [building the documentation on Debian Sid](../../scripts/docker/debian/sid/doc.Dockerfile). _(René Schwaiger)_
- We added a Docker image for [building the documentation on Debian Sid](https://github.com/ElektraInitiative/libelektra/blob/799fecd94dcb482ea9338facaf63d39f8e5ab5bd/scripts/docker/debian/sid/doc.Dockerfile). _(René Schwaiger)_
- We removed the Docker image for building the documentation on Debian Stretch. _(René Schwaiger)_
- Add Fedora 33 Dockerfile for Cirrus and Jenkins CI. _(Mihael Pranjić)_
- Debian Sid: update to clang 11. _(Mihael Pranjić)_
Expand Down
25 changes: 16 additions & 9 deletions doc/news/_preparation_next_release.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ docker run -it elektra/elektra

The following section lists news about the [plugins](https://www.libelektra.org/plugins/readme) we updated in this release.

### <<Plugin>>
### csvstorage

- <<TODO>>
- Remove superfluous if-conditions that lead to a build error on Debian Unstable _(Maximilian Irlinger @atmaxinger)_
- <<TODO>>
- <<TODO>>

Expand Down Expand Up @@ -127,7 +127,7 @@ The text below summarizes updates to the [C (and C++)-based libraries](https://w

### <<Library>>

- <<TODO>>
- opts: fix possible 'free(): invalid pointer' error and add test for it _(@hannes99)_
- <<TODO>>
- <<TODO>>

Expand All @@ -148,6 +148,12 @@ The text below summarizes updates to the [C (and C++)-based libraries](https://w
Bindings allow you to utilize Elektra using [various programming languages](https://www.libelektra.org/bindings/readme). This section keeps
you up-to-date with the multi-language support provided by Elektra.

### Python

- add merging based on elektraMerge _(Maximilian Irlinger @atmaxinger)_
- <<TODO>>
- <<TODO>>

### <<Binding>>

- <<TODO>>
Expand All @@ -160,8 +166,9 @@ you up-to-date with the multi-language support provided by Elektra.
- <<TODO>>
- <<TODO>>

### <<Binding>>
### Rust

- start again to publish on crates.io _(Markus Raab)_
- <<TODO>>
- <<TODO>>
- <<TODO>>
Expand Down Expand Up @@ -241,7 +248,7 @@ you up-to-date with the multi-language support provided by Elektra.

### Tutorials

- <<TODO>>
- opts: use arg/help instead of arg/name _(@hannes99)_
- <<TODO>>
- <<TODO>>
- <<TODO>>
Expand Down Expand Up @@ -317,7 +324,7 @@ you up-to-date with the multi-language support provided by Elektra.
### CMake

- Fix build with newer libgit2 versions _(Fabian Vogt)_
- <<TODO>>
- We now require at least CMake `3.12` (released in July 2018). _(Maximilian Irlinger @atmaxinger)_
- <<TODO>>
- <<TODO>>
- <<TODO>>
Expand All @@ -327,7 +334,7 @@ you up-to-date with the multi-language support provided by Elektra.
### Docker

- Bump Alpine Linux to 3.16.0. _(Mihael Pranjić @mpranj)_
- <<TODO>>
- The Docker image for building the documentation is now [based on Debian Bullseye](../../scripts/docker/debian/bullseye/doc.Dockerfile). _(Maximilian Irlinger @atmaxinger)_
- <<TODO>>
- <<TODO>>
- <<TODO>>
Expand All @@ -337,7 +344,7 @@ you up-to-date with the multi-language support provided by Elektra.

### Jenkins

- <<TODO>>
- We no longer build and test on Ubuntu Xenial and Debian Stretch due to outdated CMake versions _(Maximilian Irlinger @atmaxinger)_
- <<TODO>>
- <<TODO>>
- <<TODO>>
Expand All @@ -346,7 +353,7 @@ you up-to-date with the multi-language support provided by Elektra.

### Cirrus

- <<TODO>>
- Update FreeBSD images to 13.1 and 12.3 and update packages before builds. _(Mihael Pranjić @mpranj)_
- <<TODO>>
- <<TODO>>
- <<TODO>>
Expand Down
4 changes: 2 additions & 2 deletions doc/tutorials/command-line-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -397,10 +397,10 @@ opt/#0 = i
opt/#0/long = interactive
opt/#0/arg = optional
opt/#0/flagvalue = always
opt/#0/arg/help = WHEN
opt/#1 = I
opt/#1/flagvalue = once
opt/#1/arg = none
opt/arg/name = WHEN
description = prompt according to WHEN: never, once (-I), or always (-i); without WHEN, prompt always
[singlefs]
Expand All @@ -416,7 +416,7 @@ description = do not treat '/' specially
[preserve]
opt/long = preserve-root
opt/arg = optional
opt/arg/name = all
opt/arg/help = all
opt/flagvalue = root
description = do not remove '/' (default); with 'all', reject any command line argument on a separate device from its parent
Expand Down
37 changes: 37 additions & 0 deletions doc/tutorials/python-kdb.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- [Import kdb](#Import-kdb)
- [Keyset](#Keyset)
- [Keys](#Keys)
- [Merging KeySets](#Merging KeySets)

## Introduction

Expand Down Expand Up @@ -284,3 +285,39 @@ with KDB() as data:
keyset.append(newer_key)
print(describe(keyset, "Replace Key", newline=False))
```

## Merging KeySets

The internal three-way merge algorithm is also included in the Python bindings.

```py
import kdb, kdb.merge

baseKeys = kdb.KeySet(100,
kdb.Key("system:/test/key1", "k1"),
kdb.Key("system:/test/key2", "k2"),
kdb.KS_END,
)

ourKeys = kdb.KeySet(100,
kdb.Key("system:/test/key1", "k1"),
kdb.Key("system:/test/key3", "k3"),
kdb.KS_END,
)

theirKeys = kdb.KeySet(100,
kdb.Key("system:/test/key1", "k1"),
kdb.Key("system:/test/key4", "k4"),
kdb.KS_END,
)

base = kdb.merge.MergeKeys(baseKeys, kdb.Key("system:/test"))
theirs = kdb.merge.MergeKeys(theirKeys, kdb.Key("system:/test"))
ours = kdb.merge.MergeKeys(ourKeys, kdb.Key("system:/test"))

merger = kdb.merge.Merger()
mergeResult = merger.merge(base, ours, theirs, kdb.Key("system:/test"), kdb.merge.ConflictStrategy.THEIR)

# prints ['system:/test/key1', 'system:/test/key3', 'system:/test/key4']
print(mergeResult.mergedKeys)
```
4 changes: 2 additions & 2 deletions examples/gopts.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ static KeySet * createSpec (void)
"prompt according to WHEN: never, once (-I), or always (-i), without WHEN, prompt always", KEY_META, "opt", "#1",
KEY_META, "opt/#0", "i", KEY_META, "opt/#0/arg", "optional", KEY_META, "opt/#0/flagvalue", "always", KEY_META,
"opt/#0/long", "interactive", KEY_META, "opt/#1", "I", KEY_META, "opt/#1/arg", "none", KEY_META, "opt/#1/flagvalue",
"once", KEY_META, "opt/arg/name", "WHEN", KEY_END),
"once", KEY_META, "opt/#0/arg/help", "WHEN", KEY_END),
keyNew (SPEC_BASE_KEY "/nopreserve", KEY_META, "description", "do not treat '/' specially", KEY_META, "opt/arg", "none",
KEY_META, "opt/long", "no-preserve-root", KEY_END),
keyNew (SPEC_BASE_KEY "/preserve", KEY_META, "description",
"do not remove '/' (default), with 'all', reject any command line argument on a separate device from its parent",
KEY_META, "opt/arg", "optional", KEY_META, "opt/arg/name", "all", KEY_META, "opt/flagvalue", "root", KEY_META,
KEY_META, "opt/arg", "optional", KEY_META, "opt/arg/help", "all", KEY_META, "opt/flagvalue", "root", KEY_META,
"opt/long", "preserve-root", KEY_END),
keyNew (SPEC_BASE_KEY "/recursive", KEY_META, "description", "remove directories and their contents recursively", KEY_META,
"opt", "#1", KEY_META, "opt/#0", "r", KEY_META, "opt/#0/arg", "none", KEY_META, "opt/#0/long", "recursive",
Expand Down
2 changes: 1 addition & 1 deletion examples/kdbset.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ while (ret == -1) // as long as we have an error
ksCut(theirs, parentKey), parentKey,
ksCut(base, parentKey), parentKey,
parentKey, strategy, parentKey);
int numberOfConflicts = getConflicts (parentKey);
int numberOfConflicts = elektraMergeGetConflicts (parentKey);
ksDel (theirs);
if (result != NULL) {
ret = kdbSet (handle, result, parentKey);
Expand Down
4 changes: 2 additions & 2 deletions examples/opts.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ static KeySet * createSpec (void)
"prompt according to WHEN: never, once (-I), or always (-i), without WHEN, prompt always", KEY_META, "opt", "#1",
KEY_META, "opt/#0", "i", KEY_META, "opt/#0/arg", "optional", KEY_META, "opt/#0/flagvalue", "always", KEY_META,
"opt/#0/long", "interactive", KEY_META, "opt/#1", "I", KEY_META, "opt/#1/arg", "none", KEY_META, "opt/#1/flagvalue",
"once", KEY_META, "opt/arg/name", "WHEN", KEY_END),
"once", KEY_META, "opt/#0/arg/help", "WHEN", KEY_END),
keyNew (SPEC_BASE_KEY "/nopreserve", KEY_META, "description", "do not treat '/' specially", KEY_META, "opt/arg", "none",
KEY_META, "opt/long", "no-preserve-root", KEY_END),
keyNew (SPEC_BASE_KEY "/preserve", KEY_META, "description",
"do not remove '/' (default), with 'all', reject any command line argument on a separate device from its parent",
KEY_META, "opt/arg", "optional", KEY_META, "opt/arg/name", "all", KEY_META, "opt/flagvalue", "root", KEY_META,
KEY_META, "opt/arg", "optional", KEY_META, "opt/arg/help", "all", KEY_META, "opt/flagvalue", "root", KEY_META,
"opt/long", "preserve-root", KEY_END),
keyNew (SPEC_BASE_KEY "/recursive", KEY_META, "description", "remove directories and their contents recursively", KEY_META,
"opt", "#1", KEY_META, "opt/#0", "r", KEY_META, "opt/#0/arg", "none", KEY_META, "opt/#0/long", "recursive",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM debian:sid
FROM debian:bullseye

ENV LANG C.UTF-8
ENV LANGUAGE C.UTF-8
Expand Down Expand Up @@ -52,5 +52,5 @@ RUN useradd \
USER ${JENKINS_USERID}

# Ronn-NG
ENV PATH="$PATH:/home/jenkins/.local/share/gem/ruby/3.0.0/bin"
ENV PATH="$PATH:/home/jenkins/.local/share/gem/ruby/2.7.0/bin"
RUN gem install --user-install ronn-ng -v 0.10.1.pre1 && ronn --version
Loading

0 comments on commit c756e73

Please sign in to comment.