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

Move headers Part 3 #4941

Merged
merged 41 commits into from
Jun 14, 2023
Merged
Show file tree
Hide file tree
Changes from 40 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
bd8099f
cmake: severly reduce use of include_directories in global context
kodebach Jun 2, 2023
4b3ba3d
general: split elektra folder into core and kdb
kodebach Jun 2, 2023
a6fb544
utility: use static inline for some functions
kodebach Jun 2, 2023
b063fa1
doc: update details of library_split decision
kodebach Jun 2, 2023
78719b6
types: split type system into separate library
kodebach Jun 2, 2023
8e90877
cmake: fix BUILD_FULL and BUILD_STATIC and cleanup cruft in the process
kodebach Jun 2, 2023
c855305
doc: fix links
kodebach Jun 2, 2023
f56b0ee
general: update includes after move
kodebach Jun 2, 2023
679085b
general: fix new gcc warnings
kodebach Jun 2, 2023
b7e7377
general: fix formatting
kodebach Jun 2, 2023
58387fd
doc: move decisions to 6_implemented
kodebach Jun 2, 2023
5dd0940
doc: add release notes highlight
kodebach Jun 2, 2023
844bac7
doc: fix formatting
kodebach Jun 2, 2023
63da455
doc: fix links
kodebach Jun 2, 2023
7b2354e
include: move stuff needed for highlevel codegen to installed headers
kodebach Jun 1, 2023
9d84d7c
doc: fix man page
kodebach Jun 2, 2023
3023170
core: fix duplicate symbol
kodebach Jun 2, 2023
d7859ab
tests: fix codegen tests
kodebach Jun 2, 2023
8c0390f
doc: fix man pages
kodebach Jun 2, 2023
24e9aa5
base: Remove unnecessary svr from elektraRealloc
kodebach Jun 3, 2023
3209579
kdb: fix rpath
kodebach Jun 4, 2023
a2f7c21
Revert "kdb: fix rpath"
kodebach Jun 4, 2023
63e13f3
ci: re-enable webui tests on Jenkins
kodebach Jun 4, 2023
8fea904
general: add todos
kodebach Apr 24, 2023
70f5d30
cmake: fix kdb lib
kodebach Jun 4, 2023
4ff4e9d
cmake: fix core lib
kodebach Jun 4, 2023
9454c1b
cmake: fix dlopen etc. symbols
kodebach Jun 4, 2023
cc71104
cmake: fix kdb lib built without shared
kodebach Jun 4, 2023
3fbba2a
benchmark: fix uninit bug
kodebach Jun 5, 2023
b29778f
ci: run more tests on ubuntu kinetic to diagnose packaging issue
kodebach Jun 6, 2023
73b4bf7
doc: update release notes
flo91 Jun 10, 2023
a2fd515
CI: Update Dockerfile for Arch on Cirrus
flo91 Jun 10, 2023
22f584d
bindings: include <cstdint> in key.hpp for uint8_t
flo91 Jun 10, 2023
061dfc2
Cirrus: Add `texlive-latexextra` for varwidth.sty
flo91 Jun 10, 2023
4e5d5c3
Cirrus: Add `texlive-fontsextra` for stix.sty
flo91 Jun 10, 2023
b4afa92
Cirrus: Add `texlive-science`
flo91 Jun 10, 2023
2ea3fec
doc: fix Doxygen for `keyName` function
flo91 Jun 10, 2023
f3b783b
ci: fix cirrus clone script
kodebach Jun 13, 2023
3ec05e1
ci: fix macos python issue
kodebach Jun 13, 2023
3af13a2
toml: use elektraWriteArrayNumber instead of custom code
kodebach Jun 13, 2023
26537ec
general: apply suggestions from code review
kodebach Jun 13, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 4 additions & 2 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,8 @@ task:
$CIRRUS_WORKING_DIR
git reset --hard $CIRRUS_CHANGE_IN_REPO
else
git clone https://x-access-token:${CIRRUS_REPO_CLONE_TOKEN}@github.com/${CIRRUS_REPO_FULL_NAME}.git $CIRRUS_WORKING_DIR
git clone --branch=$CIRRUS_BASE_BRANCH https://x-access-token:${CIRRUS_REPO_CLONE_TOKEN}@github.com/${CIRRUS_REPO_FULL_NAME}.git \
$CIRRUS_WORKING_DIR
git fetch origin pull/$CIRRUS_PR/head:pull/$CIRRUS_PR
git config user.email "[email protected]"
git config user.name "nobody"
Expand Down Expand Up @@ -309,7 +310,8 @@ task:
$CIRRUS_WORKING_DIR
git reset --hard $CIRRUS_CHANGE_IN_REPO
else
git clone https://x-access-token:${CIRRUS_REPO_CLONE_TOKEN}@github.com/${CIRRUS_REPO_FULL_NAME}.git $CIRRUS_WORKING_DIR
git clone --branch=$CIRRUS_BASE_BRANCH https://x-access-token:${CIRRUS_REPO_CLONE_TOKEN}@github.com/${CIRRUS_REPO_FULL_NAME}.git \
$CIRRUS_WORKING_DIR
git fetch origin pull/$CIRRUS_PR/head:pull/$CIRRUS_PR
git config user.email "[email protected]"
git config user.name "nobody"
Expand Down
32 changes: 27 additions & 5 deletions .github/workflows/macOS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,31 @@ jobs:

- name: Install Dependencies
run: |
brew update
set -ex

brew config
# Unlink parallel package, because of conflict with moreutils
brew unlink parallel || >&2 printf 'Unlinking parallel failed.`\n'
# Uninstall old Python versions and azure-cli due to file conflicts
brew remove azure-cli pipx [email protected] [email protected]|| >&2 printf 'Uninstalling old python versions and azure-cli failed.`\n'

brew update

# homebrew fails to upgrade python due to unlinking failure
# (cf. https://github.com/actions/setup-python/issues/577 )
rm -f /usr/local/bin/2to3
rm -f /usr/local/bin/idle3
rm -f /usr/local/bin/pydoc3
rm -f /usr/local/bin/python3
rm -f /usr/local/bin/python3-config
rm -f /usr/local/bin/2to3-3.11
rm -f /usr/local/bin/idle3.11
rm -f /usr/local/bin/pydoc3.11
rm -f /usr/local/bin/python3.11
rm -f /usr/local/bin/python3.11-config
rm -f /usr/local/lib/libtcl8.6.dylib
rm -f /usr/local/lib/libtk8.6.dylib
rm -f /usr/local/bin/go
rm -f /usr/local/bin/gofmt

brew upgrade

brew install augeas \
antlr \
antlr4-cpp-runtime \
Expand Down Expand Up @@ -113,10 +132,13 @@ jobs:
yajl \
yaml-cpp \
zeromq

if [ "$CC" = 'clang' ]; then
brew install --cask oclint
fi

brew install --cask adoptopenjdk

# Try to install `checkbashisms` (The file server that hosts the package is unfortunately quite unreliable.)
brew install checkbashisms || >&2 printf 'Warning: Unable to install `checkbashims`\n'

Expand Down
5 changes: 2 additions & 3 deletions benchmarks/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
include (LibAddMacros)

add_headers (HDR_FILES)

macro (do_benchmark source)
include_directories ("${CMAKE_CURRENT_SOURCE_DIR}")
set (SOURCES ${HDR_FILES} ${ADDITIONAL_SOURCES} benchmarks.c benchmarks.h ${source}.c)
add_executable (benchmark_${source} ${SOURCES})
target_include_directories (benchmark_${source} PRIVATE "${CMAKE_SOURCE_DIR}/src/include" "${CMAKE_BINARY_DIR}/src/include")

target_link_elektra (benchmark_${source} elektra-kdb elektra-meta)

Expand Down Expand Up @@ -55,6 +53,7 @@ if (ENABLE_OPTIMIZATIONS AND NOT WIN32)
endif (ENABLE_OPTIMIZATIONS AND NOT WIN32)

add_executable (benchmark_plugingetset plugingetset.c)
target_include_directories (benchmark_plugingetset PRIVATE "${CMAKE_SOURCE_DIR}/src/include" "${CMAKE_BINARY_DIR}/src/include")
target_link_elektra (benchmark_plugingetset elektra-core elektra-kdb)

target_link_elektra (benchmark_diff elektra-kdb)
Expand Down
3 changes: 2 additions & 1 deletion benchmarks/benchmarks.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@
*/

#define _GNU_SOURCE
#include <benchmarks.h>
#include "./benchmarks.h"
#ifdef HAVE_HSEARCHR
#include <search.h>
#endif
#include <sys/time.h>

#include <internal/macros/attributes.h>
#include <internal/utility/alloc.h>

struct timeval start;
Expand Down
3 changes: 3 additions & 0 deletions benchmarks/changetracking.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#include "./benchmarks.h"

#include <internal/macros/attributes.h>

#include <getopt.h>
#include <stdbool.h>
#include <stddef.h>

size_t keys = 5000;
char * keyNameFormat = "user:/test/sw/org/myapp/#0/current/section/subsection/key%zu";
Expand Down
4 changes: 2 additions & 2 deletions benchmarks/cmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @copyright BSD License (see LICENSE.md or https://www.libelektra.org)
*/

#include <benchmarks.h>
#include "./benchmarks.h"

#include <ctype.h>

Expand Down Expand Up @@ -86,7 +86,7 @@ int main (void)
long long nrIterations = 100000000;
const char str1[] = "some string to be compared with/some\\/more with a long common part, and only a bit different";
char * str2 = elektraMalloc (sizeof (str1));
strcat (str2, str1);
strcpy (str2, str1);
kodebach marked this conversation as resolved.
Show resolved Hide resolved
str2[sizeof (str1) - 5] = 'X';

int res = 0;
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/createkeys.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @copyright BSD License (see LICENSE.md or https://www.libelektra.org)
*/

#include <benchmarks.h>
#include "./benchmarks.h"

void benchmarkDel (void)
{
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/deepdup.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @copyright BSD License (see LICENSE.md or https://www.libelektra.org)
*/

#include <benchmarks.h>
#include "./benchmarks.h"

Key * key;

Expand Down
3 changes: 2 additions & 1 deletion benchmarks/diff.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <benchmarks.h>
#include "./benchmarks.h"

#include <elektra/core.h>
#include <elektra/diff.h>

Expand Down
4 changes: 3 additions & 1 deletion benchmarks/kdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@

#include <stdio.h>

#include <benchmarks.h>
#include "./benchmarks.h"

#include <elektra/core/key.h>
#include <elektra/core/keyset.h>
#include <elektra/kdb/kdb.h>

#define NUM_RUNS 7

#define CSV_STR_FMT "%s;%s;%d\n"
Expand Down
4 changes: 3 additions & 1 deletion benchmarks/kdbget.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@

#include <stdio.h>

#include <benchmarks.h>
#include "./benchmarks.h"

#include <elektra/core/key.h>
#include <elektra/core/keyset.h>
#include <elektra/kdb/kdb.h>

#define CSV_STR_FMT "%s;%s;%d\n"


Expand Down
4 changes: 3 additions & 1 deletion benchmarks/kdbmodify.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@

#include <stdio.h>

#include <benchmarks.h>
#include "./benchmarks.h"

#include <elektra/core/key.h>
#include <elektra/core/keyset.h>
#include <elektra/kdb/kdb.h>

#define CSV_STR_FMT "%s;%s;%d\n"


Expand Down
2 changes: 1 addition & 1 deletion benchmarks/large.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @copyright BSD License (see LICENSE.md or https://www.libelektra.org)
*/

#include <benchmarks.h>
#include "./benchmarks.h"

KDB * kdb;
Key * key;
Expand Down
5 changes: 3 additions & 2 deletions benchmarks/memoryleak.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@
*/

#include <stdio.h>
#include <unistd.h>

#include "./benchmarks.h"

#include <benchmarks.h>
#include <elektra/core/key.h>
#include <elektra/core/keyset.h>
#include <elektra/kdb/kdb.h>
#include <unistd.h>

#define NUM_RUNS 30

Expand Down
9 changes: 5 additions & 4 deletions benchmarks/opmphm.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#endif

// ==== INCLUDE SECTION ====
#include "benchmarks.h"
#include "./benchmarks.h"
#ifdef HAVE_HSEARCHR
#include <search.h>
#endif
Expand All @@ -29,13 +29,14 @@
#include <omp.h>
#endif

#include "../src/libs/elektra/opmphm.c"
#include "../src/libs/elektra/opmphmpredictor.c"
#include "../src/libs/elektra/rand.c"
#include "../src/libs/core/opmphm.c"
#include "../src/libs/core/opmphmpredictor.c"
#include "../src/libs/core/rand.c"
#include <sys/time.h>

#include <internal/core/keyset.h>
#include <internal/core/lookup.h>
#include <internal/macros/attributes.h>

int32_t elektraRandBenchmarkInitSeed;

Expand Down
2 changes: 1 addition & 1 deletion benchmarks/plugingetset.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
#include <elektra/core/key.h>
#include <elektra/core/keyset.h>

#include <elektra/utility/format.h>
#include <internal/plugin/load.h>
#include <internal/plugin/struct.h>
#include <internal/pluginload/module.h>
#include <internal/utility/alloc.h>
#include <internal/utility/compare.h>
#include <internal/utility/format.h>

int main (int argc, char ** argv)
{
Expand Down
4 changes: 3 additions & 1 deletion benchmarks/storage.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@
#include <stdio.h>
#include <stdlib.h>

#include <benchmarks.h>
#include "./benchmarks.h"

#include <internal/plugin/load.h>

#include <tests.h>

#define CSV_STR_FMT "%s;%s;%d\n"
Expand Down
2 changes: 1 addition & 1 deletion doc/CODING.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ You can also enable that formatting runs automatically before commiting using `s
- C-Files have extension `.c`, Header files `.h`.
- Use internal functions: prefer to use `elektraMalloc`, `elektraFree`.

**Example:** [src/libs/elektra/kdb.c](/src/libs/elektra/kdb.c)
**Example:** [src/libs/kdb/kdb.c](/src/libs/kdb/kdb.c)

#### Clang Format

Expand Down
4 changes: 2 additions & 2 deletions doc/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -907,8 +907,8 @@ WARN_LOGFILE = @OUTPUT_DIRECTORY@/doxygen.log
# Note: If this tag is empty the current directory is searched.

INPUT = @PROJECT_SOURCE_DIR@/src/libs \
@PROJECT_SOURCE_DIR@/src/libs/loader/doc.c \
@PROJECT_SOURCE_DIR@/src/libs/getenv/README.md \
@PROJECT_SOURCE_DIR@/src/libs/pluginload/doc.c \
@PROJECT_SOURCE_DIR@/src/bindings/intercept/env/README.md \
@PROJECT_SOURCE_DIR@/src/include \
@PROJECT_SOURCE_DIR@/src/bindings/cpp/include \
@PROJECT_SOURCE_DIR@/src/bindings/jna/libelektra/src \
Expand Down
2 changes: 1 addition & 1 deletion doc/KEYNAMES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This document is a full explanation of how _key names_ work in Elektra.

In addition to this document, a reference Python implementation can be found in [keynames.py](../scripts/keynames.py).
The goal of the Python implementation is not to be fast, or to be used in any way other than as a reference.
If there are any discrepancies between this document, the Python implementation and the actual C implementation in [src/libs/elektra/keyname.c](../src/libs/elektra/keyname.c), you should consider them as follows:
If there are any discrepancies between this document, the Python implementation and the actual C implementation in [src/libs/elektra/keyname.c](../src/libs/core/keyname.c), you should consider them as follows:
kodebach marked this conversation as resolved.
Show resolved Hide resolved

1. The C implementation is optimized for speed and thus much harder to implement correctly.
2. In most cases, this document outranks the Python implementation.
Expand Down
2 changes: 1 addition & 1 deletion doc/decisions/2_solutions_clear/simplify_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Problem

According to [symbols.map](/src/libs/elektra/symbols.map) the public core API has 124 symbols¹, which is arguable too much for a key-value API which has as highest goal simplicity.
According to [symbols.map](/src/libs/core/symbols.map) the public core API has 124 symbols¹, which is arguable too much for a key-value API which has as highest goal simplicity.
kodebach marked this conversation as resolved.
Show resolved Hide resolved

In particular following areas have many functions and are not simple:

Expand Down
4 changes: 2 additions & 2 deletions doc/decisions/4_decided/private_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ All other headers are anybody's guess.
- Also allow other libraries (e.g. a new `libelektra-operations`) to access non-public API.
Such libraries need to have a good reason (e.g. performance, impossible otherwise, etc.) why they access non-public API and they need to be kept up-to-date.
If a library cannot provide a stable API on top of the unstable non-public API, it clearly needs to state which APIs are not stable.
- Put struct definitions of Key/KeySet in a separate header file, which gets included by parts that need it (see also [Header File Structure](../5_partially_implemented/header_file_structure.md)).
- Put struct definitions of Key/KeySet in a separate header file, which gets included by parts that need it (see also [Header File Structure](../6_implemented/header_file_structure.md)).

## Rationale

Expand All @@ -48,6 +48,6 @@ All other headers are anybody's guess.

## Related Decisions

- [Header File Structure](../5_partially_implemented/header_file_structure.md)
- [Header File Structure](../6_implemented/header_file_structure.md)

## Notes
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ All currently planned libraries and their respective API prefixes are listed in
(Note: previously `libelektra-plugin` merged with `libelektra-invoke`)

- `libelektra-pluginload`:
Internal static library, linked into `libelektra-plugin` (re-exported) and `libelektra-kdb` (not exported).
Internal object library, linked into `libelektra-plugin` (re-exported) and `libelektra-kdb` (not exported).
Contains the code for loading plugins.

**Prefix:**: `elektraPlugin*` (shared with `libelektra-plugin` because exported there)
Expand Down Expand Up @@ -140,7 +140,7 @@ All currently planned libraries and their respective API prefixes are listed in
**Prefix:** `elektraUtil*`

- `libelektra-base`:
Internal static library, linked into `libelektra-core` (not exported) and `libelektra-utility` (partially re-exported).
Internal object library, linked into `libelektra-core` (not exported) and `libelektra-utility` (partially re-exported).
Contains helper functions for e.g., memory allocations, string formatting, etc.

**Prefix:** `elektra*` (for internal), `elektraUtil*` (for exported)
2 changes: 1 addition & 1 deletion doc/dev/data-structures.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ The OPMPHM is a non-dynamic randomized hash map of the Las Vegas type, that crea
to gain O(1) access.

The elements must be arranged in an array and each element must have a unique name, to identify the elements.
The source can be found in [opmphm.h](/src/include/internal/core/opmphm.h) and [opmphm.c](/src/libs/elektra/opmphm.c)
The source can be found in [opmphm.h](/src/include/internal/core/opmphm.h) and [opmphm.c](/src/libs/core/opmphm.c)
and also works outside of Elektra.

The OPMPHM does not store any buckets, your array of elements are the buckets and the OPMPHM represent an arbitrary
Expand Down
2 changes: 1 addition & 1 deletion doc/dev/symbol-versioning.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ The setup used is based on the one used by FreeBSD. The main script [`version_ge
(with small modifications to enable Alpine Linux compatibility).

The main script, is called by CMake during the build process. It parses the `symbols.map` files of all libraries (e.g.
[`/src/libs/elektra/symbols.map`](/src/libs/elektra/symbols.map)) and combines them into a single file, which is then used by the compiler
[`/src/libs/core/symbols.map`](/src/libs/core/symbols.map)) and combines them into a single file, which is then used by the compiler
and the linker.

### `versions.def`
Expand Down
2 changes: 1 addition & 1 deletion doc/help/elektra-key-names.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ the key names of software-applications should always start with:

- [see application integration tutorial](/doc/tutorials/application-integration.md)
- [see namespaces tutorial](/doc/tutorials/namespaces.md)
- [key name source file](/src/libs/elektra/keyname.c) or [its rendered API documentation](https://doc.libelektra.org/api/master/html/group__keyname.html#details)
- [key name source file](/src/libs/core/keyname.c) or [its rendered API documentation](https://doc.libelektra.org/api/master/html/group__keyname.html#details)

- [elektra-namespaces(7)](elektra-namespaces.md)
- [elektra-cascading(7)](elektra-cascading.md)
4 changes: 2 additions & 2 deletions doc/man/man7/elektra-key-names.7
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.\" generated with Ronn-NG/v0.10.1
.\" http://github.com/apjanke/ronn-ng/tree/0.10.1.pre3
.TH "ELEKTRA\-KEY\-NAMES" "7" "November 2021" ""
.TH "ELEKTRA\-KEY\-NAMES" "7" "June 2023" ""
.SH "NAME"
\fBelektra\-key\-names\fR \- the names of keys
.P
Expand Down Expand Up @@ -71,7 +71,7 @@ see application integration tutorial \fI/doc/tutorials/application\-integration\
.IP "\(bu" 4
see namespaces tutorial \fI/doc/tutorials/namespaces\.md\fR
.IP "\(bu" 4
key name source file \fI/src/libs/elektra/keyname\.c\fR or its rendered API documentation \fIhttps://doc\.libelektra\.org/api/master/html/group__keyname\.html#details\fR
key name source file \fI/src/libs/core/keyname\.c\fR or its rendered API documentation \fIhttps://doc\.libelektra\.org/api/master/html/group__keyname\.html#details\fR
.IP "\(bu" 4
elektra\-namespaces(7) \fIelektra\-namespaces\.md\fR
.IP "\(bu" 4
Expand Down
Loading