Add extracted tools: CitrineOS, OpenOCPP, ShapeShifter

- CitrineOS core extracted (CSMS OCPP 2.0.1)
- OpenOCPP extracted (firmware OCPP 1.6J/2.0.1)
- ShapeShifter library installed (pip install -e)
- ShapeShifter specification extracted
- EVerest extracted

TODO updated with progress
This commit is contained in:
Eric F
2026-06-08 00:38:27 -04:00
parent 468cfeaa50
commit d398a6ced2
7326 changed files with 1177561 additions and 7 deletions

View File

@@ -0,0 +1,18 @@
#
# SPDX-License-Identifier: Apache-2.0
# Copyright Pionix GmbH and Contributors to EVerest
#
"""Everest Dependency Manager."""
from edm_tool import edm
__version__ = "0.8.0"
def get_parser():
"""Return the command line parser."""
return edm.get_parser(__version__)
def main():
"""Main entrypoint of edm."""
edm.main(get_parser())

View File

@@ -0,0 +1,88 @@
"Bazel related functions for edm_tool."
import yaml
from typing import List, Optional, Dict
def _format_optional_string(value: Optional[str]):
"""Formats a string value as a string literal (with quotes) or `None` if the value is None."""
if value is None:
return "None"
return f'"{value}"'
def _is_commit(revision: str):
# Revision is a commit if it is a hexadecimal 40-character string
return len(revision) == 40 and all(c in "0123456789abcdef" for c in revision.lower())
def _get_depname_for_label(label: str) -> str:
build, depname, bazel = label.split(":")[1].split(".")
if build != "BUILD" or bazel != "bazel":
raise ValueError(f"Invalid build file name: {label}")
return depname
def _parse_build_file_labels(labels: Optional[List[str]]) -> Dict[str, str]:
# For easier matching of build files with dependencies
# we convert the list of build files:
# ```
# [
# "@workspace//path/to/build:BUILD.<depname>.bazel",
# ...
# ]
# ```
# into a dictionary:
# ```
# {
# "<depname>": "@workspace//path/to/build:BUILD.<depname>.bazel",
# ...
# }
# ```
# and check that all build files have proper names.
if labels is None:
return {}
return dict((_get_depname_for_label(label), label) for label in labels)
def generate_deps(args):
"Parse the dependencies.yaml and print content of *.bzl file to stdout."
with open(args.dependencies_yaml, 'r', encoding='utf-8') as f:
deps = yaml.safe_load(f)
build_files = _parse_build_file_labels(args.build_file)
for name in build_files:
if name not in deps:
raise ValueError(f"Build file {name} does not have a corresponding dependency in {args.dependencies_yaml}")
print("""
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
def edm_deps():""")
for name, desc in deps.items():
repo = desc["git"]
# The parameter is called `git_tag` but it can be a tag or a commit
revision = desc["git_tag"]
tag = None
commit = None
if _is_commit(revision):
commit = revision
else:
tag = revision
build_file = build_files.get(name)
print(
f"""
maybe(
git_repository,
name = "{name}",
remote = "{repo}",
tag = {_format_optional_string(tag)},
commit = {_format_optional_string(commit)},
build_file = {_format_optional_string(build_file)},
)
"""
)

View File

@@ -0,0 +1,144 @@
# AUTOMATCALLY GENERATED by `shtab`
_shtab_edm_tool_option_strings=('-h' '--help' '--version' '--workspace' '--working_dir' '--out' '--include_deps' '--config' '--create-vscode-workspace' '--update' '--cmake' '--verbose' '--nocolor' '--install-bash-completion' '--create-config' '--external-in-config' '--include-remotes' '--create-snapshot' '--git-info' '--git-fetch' '--git-pull')
_shtab_edm_tool_pos_0_nargs=A...
_shtab_edm_tool__h_nargs=0
_shtab_edm_tool___help_nargs=0
_shtab_edm_tool___version_nargs=0
_shtab_edm_tool___include_deps_nargs=0
_shtab_edm_tool___create_vscode_workspace_nargs=0
_shtab_edm_tool___update_nargs=0
_shtab_edm_tool___cmake_nargs=0
_shtab_edm_tool___verbose_nargs=0
_shtab_edm_tool___nocolor_nargs=0
_shtab_edm_tool___install_bash_completion_nargs=0
_shtab_edm_tool___external_in_config_nargs=0
_shtab_edm_tool___include_remotes_nargs=*
_shtab_edm_tool___create_snapshot_nargs=?
_shtab_edm_tool___git_info_nargs=0
_shtab_edm_tool___git_fetch_nargs=0
_shtab_edm_tool___git_pull_nargs=*
# $1=COMP_WORDS[1]
_shtab_compgen_files() {
compgen -f -- $1 # files
}
# $1=COMP_WORDS[1]
_shtab_compgen_dirs() {
compgen -d -- $1 # recurse into subdirs
}
# $1=COMP_WORDS[1]
_shtab_replace_nonword() {
echo "${1//[^[:word:]]/_}"
}
# set default values (called for the initial parser & any subparsers)
_set_parser_defaults() {
local subparsers_var="${prefix}_subparsers[@]"
sub_parsers=${!subparsers_var}
local current_option_strings_var="${prefix}_option_strings[@]"
current_option_strings=${!current_option_strings_var}
completed_positional_actions=0
_set_new_action "pos_${completed_positional_actions}" true
}
# $1=action identifier
# $2=positional action (bool)
# set all identifiers for an action's parameters
_set_new_action() {
current_action="${prefix}_$(_shtab_replace_nonword $1)"
local current_action_compgen_var=${current_action}_COMPGEN
current_action_compgen="${!current_action_compgen_var}"
local current_action_choices_var="${current_action}_choices"
current_action_choices="${!current_action_choices_var}"
local current_action_nargs_var="${current_action}_nargs"
if [ -n "${!current_action_nargs_var}" ]; then
current_action_nargs="${!current_action_nargs_var}"
else
current_action_nargs=1
fi
current_action_args_start_index=$(( $word_index + 1 ))
current_action_is_positional=$2
}
# Notes:
# `COMPREPLY`: what will be rendered after completion is triggered
# `completing_word`: currently typed word to generate completions for
# `${!var}`: evaluates the content of `var` and expand its content as a variable
# hello="world"
# x="hello"
# ${!x} -> ${hello} -> "world"
_shtab_edm_tool() {
local completing_word="${COMP_WORDS[COMP_CWORD]}"
COMPREPLY=()
prefix=_shtab_edm_tool
word_index=0
_set_parser_defaults
word_index=1
# determine what arguments are appropriate for the current state
# of the arg parser
while [ $word_index -ne $COMP_CWORD ]; do
local this_word="${COMP_WORDS[$word_index]}"
if [[ -n $sub_parsers && " ${sub_parsers[@]} " =~ " ${this_word} " ]]; then
# valid subcommand: add it to the prefix & reset the current action
prefix="${prefix}_$(_shtab_replace_nonword $this_word)"
_set_parser_defaults
fi
if [[ " ${current_option_strings[@]} " =~ " ${this_word} " ]]; then
# a new action should be acquired (due to recognised option string or
# no more input expected from current action);
# the next positional action can fill in here
_set_new_action $this_word false
fi
if [[ "$current_action_nargs" != "*" ]] && \
[[ "$current_action_nargs" != "+" ]] && \
[[ "$current_action_nargs" != *"..." ]] && \
(( $word_index + 1 - $current_action_args_start_index >= \
$current_action_nargs )); then
$current_action_is_positional && let "completed_positional_actions += 1"
_set_new_action "pos_${completed_positional_actions}" true
fi
let "word_index+=1"
done
# Generate the completions
if [[ "${completing_word}" == -* ]]; then
# optional argument started: use option strings
COMPREPLY=( $(compgen -W "${current_option_strings[*]}" -- "${completing_word}") )
else
# use choices & compgen
local IFS=$'\n'
COMPREPLY=( $(compgen -W "${current_action_choices}" -- "${completing_word}") \
$([ -n "${current_action_compgen}" ] \
&& "${current_action_compgen}" "${completing_word}") )
fi
return 0
}
complete -o filenames -F _shtab_edm_tool edm

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,61 @@
set(ENV{EVEREST_EDM_WORKSPACE} {{ workspace["workspace"] }})
set(CPM_USE_NAMED_CACHE_DIRECTORIES ON)
{% for dep in checkout %}
set(CPM_{{ dep["name"] }}_SOURCE "{{ dep["path"] }}")
{% endfor %}
{% for name, value in dependencies.items() %}
if("{{name}}" IN_LIST EVEREST_EXCLUDE_DEPENDENCIES)
message(STATUS "Excluding dependency {{name}}")
{% if "cmake_condition" in value and value["cmake_condition"]|length > 0 %}
elseif({{ value["cmake_condition"] }})
{% else %}
else()
{% endif %}
{% if value and "git" in value %}
CPMAddPackage(
NAME {{ name }}
GIT_REPOSITORY {{ value["git"] }}
{% if "git_tag" in value %}
GIT_TAG {{ value["git_tag"] }}
{% endif %}
{% if "options" in value and value["options"]|length > 0 %}
OPTIONS
{{value["options"]|quote|join(" ")}}
{% endif %}
{% if "prevent_install" in value and value["prevent_install"] %}
EXCLUDE_FROM_ALL YES
{% endif %}
)
{% else %}
find_package(
{{ name }}
{% if value and "components" in value and value["components"]|length > 0 %}
COMPONENTS
{{value["components"]|quote|join(" ")}}
{% endif %}
{% if not value or "optional" not in value or not value["optional"] %}
REQUIRED
{% endif %}
)
{% endif %}
{% if value and "alias" in value %}
if({{name}}_ADDED)
add_library({{value["alias"]["name"]}} ALIAS {{value["alias"]["target"]}})
endif()
{% endif %}
{% if "cmake_condition" in value and value["cmake_condition"]|length > 0 %}
else()
message(STATUS "Excluding dependency {{name}} based on cmake_condition")
{% endif %}
endif()
{% endfor %}
execute_process(
COMMAND "${EVEREST_DEPENDENCY_MANAGER}" release --everest-dir ${PROJECT_SOURCE_DIR} --build-dir ${CMAKE_BINARY_DIR} --out ${CMAKE_BINARY_DIR}/release.json
)
install(
FILES "${CMAKE_BINARY_DIR}/release.json"
DESTINATION "${CMAKE_INSTALL_SYSCONFDIR}/everest"
)