sed/miner/worker

This commit is contained in:
Ulf Wiger 2025-05-14 08:49:56 +02:00
parent 63928d065f
commit fabddfecbd
3 changed files with 35 additions and 7 deletions

View File

@ -6,8 +6,6 @@
{ref, "0288719ae1"}}}
]}.
{post_hooks, [{compile, "./zompify.sh"}]}.
{xref_checks, [undefined_function_calls, undefined_functions,
locals_not_used,
deprecated_function_calls, deprecated_functions]}.

View File

@ -334,7 +334,7 @@ valid_(pos_int, I) -> pos_integer(I);
valid_(string, S) -> is_binary(S);
valid_(boolean, B) -> is_boolean(B);
valid_(contract, Id) -> ok_tuple(gmser_api_encoder:safe_decode(contract_pubkey, Id));
valid_(type, T) -> lists:member(T, [miner, monitor]);
valid_(type, T) -> lists:member(T, [worker, monitor]);
valid_(solutions, S) -> lists:all(fun(#{nonce := N, evidence := Evd}) ->
valid_(pos_int, N),
valid_({list, pos_int}, Evd)

View File

@ -2,11 +2,41 @@
set -e
APP=$(basename "$PWD")
SRC="_build/default/lib/$APP"
DST="$PWD/_build/zomp/lib/$APP"
IGNORE_FILE="zomp.ignore"
mkdir -p "$DST"
find "$SRC" -type l ! -exec test -e {} \; -delete
cp -aR -L "$SRC/." "$DST/"
# Remove broken symlinks
find "$SRC" -type l ! -exec test -e {} \; -delete || true
# Build ignore matcher
IGNORE_TEMP=$(mktemp)
trap "rm -f $IGNORE_TEMP" EXIT
# Expand globs in zomp.ignore to patterns suitable for grep
if [ -e "$IGNORE_FILE" ]; then
grep -v '^\s*#' "$IGNORE_FILE" | sed 's#/#\\/#g' | sed 's/\./\\./g' | sed 's/\*/.*/g' > "$IGNORE_TEMP"
fi
# Copy Git-tracked and Zomp-allowed files
git ls-files -z | while IFS= read -r -d '' file; do
# Skip if ignored
echo "$file" | grep -Eq -f "$IGNORE_TEMP" && continue
# Only copy if file exists in the build dir
if [ -e "$SRC/$file" ]; then
mkdir -p "$DST/$(dirname "$file")"
cp -a "$SRC/$file" "$DST/$file"
fi
done
rm "$IGNORE_TEMP"
# Copy metadata
cp "$PWD/zomp.meta" "$DST/"
cp "$PWD/Emakefile" "$DST"
rm "$DST"/ebin/*.beam
cp "$PWD/Emakefile" "$DST/"
# Clean up beam files just in case
[ -d "$DST/ebin" ] && find "$DST/ebin" -name '*.beam' -exec rm -f {} + || true