diff --git a/.github/workflows/maxver.yml b/.github/workflows/maxver.yml new file mode 100644 index 0000000000..6e916c7f6b --- /dev/null +++ b/.github/workflows/maxver.yml @@ -0,0 +1,14 @@ +name: Daily (maxver) +on: + # schedule: + # - cron: "0 6 * * *" + push: + branches: + - maxver-minver + +jobs: + call-multi-nim-common: + uses: ./.github/workflows/daily_common.yml + with: + nim-branch: "['version-1-6', 'devel']" + cpu: "['i386']" diff --git a/.github/workflows/minver.yml b/.github/workflows/minver.yml new file mode 100644 index 0000000000..e69de29bb2 diff --git a/asd.min b/asd.min new file mode 100644 index 0000000000..9755551912 --- /dev/null +++ b/asd.min @@ -0,0 +1,11 @@ +nim==1.6.0 +nimcrypto==0.4.1 +dnsclient==0.3.0 +bearssl==0.1.4 +chronicles==0.10.2 +chronos==3.0.6 +metrics +secp256k1 +stew#head +websock +unittest2 diff --git a/scripts/build_libp2p_minver.py b/scripts/build_libp2p_minver.py new file mode 100644 index 0000000000..ceca63abba --- /dev/null +++ b/scripts/build_libp2p_minver.py @@ -0,0 +1,59 @@ +import re +from itertools import groupby + +requires_pattern = r"(?Prequires *)(?P(?P(?P\".*\")(?P,? *\n? *))*)" +file_path: str = "libp2p.nimble" + + +def get_dependencies_group(path: str) -> str: + with open(path, "r") as file: + match = re.search(requires_pattern, file.read()) + return match.group("dependencies") + + +def parse_group(_group: str) -> list[str]: + return _group.replace(" ", "").replace("\n", "").split(",") + + +def clean_dependency(_dependency: str) -> str: + return _dependency.replace("\"", "") + + +# Nimble symbols: <, <=, >, >=, ==, ~=, ^=, # +eq_symbols = ("#", "==") +def contains_eq_symbol(_dependency: str) -> bool: + return any((eq_symbol in _dependency for eq_symbol in eq_symbols)) + + +def classify_dependency(_dependency: str) -> str: + if contains_eq_symbol(_dependency): + return "eq" + elif ">" in _dependency: + return "gt" + else: + return "" + + +def classify_dependencies(_dependencies: list[str]) -> dict[str, list[str]]: + d = { + "eq": [], + "gt": [], + "": [], + } + for _dependency in _dependencies: + d[classify_dependency(_dependency)].append(_dependency) + return d + + +def parse_versions(_classified_dependencies: dict[str, list[str]]): + eq, gt, nothing = _classified_dependencies["eq"], _classified_dependencies["gt"], _classified_dependencies[""] + eq = [re.sub(r"#", "", eq_) for eq_ in eq] + print(eq) + + +dependencies_group: str = get_dependencies_group(file_path) +dependencies: list[str] = [clean_dependency(dependency) for dependency in parse_group(dependencies_group)] +classified_dependencies: dict[str, list[str]] = classify_dependencies(dependencies) +asd = parse_versions(classified_dependencies) # No classifier needed, just replace >= with ==, and remove second part if there is + +print(asd) diff --git a/scripts/build_libp2p_minver.sh b/scripts/build_libp2p_minver.sh new file mode 100755 index 0000000000..4cc60d0197 --- /dev/null +++ b/scripts/build_libp2p_minver.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +requires_pattern="requires *(((\".*\")(,? *\n? *))*)" +file_path="libp2p.nimble" + +get_dependencies_group() { + dependencies=$(grep -Pzo "$requires_pattern" $1 | tr -d '\0') + dependencies=$(sed 's/.*requires *//p' <<< "$dependencies") + echo $dependencies +} + +parse_group() { + group=$(echo $1 | tr -d ' ' | tr -d '\n' | tr ',' ' ' | tr -d '\0') + echo $group +} + +clean_dependency() { + dependency=$(echo $1 | tr -d '"') + echo $dependency +} + +dependencies_group=$(get_dependencies_group $file_path) +dependencies=$(parse_group "$dependencies_group") +var=() +for dependency in $dependencies; do + var+=($(clean_dependency $dependency)) +done + +# print all elements in var +# +for i in "${var[@]}"; do + echo "'"$i"'" +done +# echo "${var[@]}"