From 3fafb89bdccdce15145e08cfa1ef0528dcaffda1 Mon Sep 17 00:00:00 2001 From: Ulf Wiger Date: Thu, 16 Apr 2026 23:26:43 +0200 Subject: [PATCH] Add zompify support, verup to 0.2.0 --- ebin/gmserialization.app | 2 +- src/gmser_api_encoder.erl | 2 +- src/gmser_chain_objects.erl | 2 +- src/gmser_contract_code.erl | 2 +- src/gmser_delegation.erl | 2 +- src/gmser_dyn.erl | 1 + src/gmser_dyn_types.erl | 1 + src/gmser_id.erl | 2 +- src/gmser_rlp.erl | 2 +- src/gmserialization.app.src | 2 +- src/gmserialization.app.src.script | 14 +++++++++ src/gmserialization.erl | 2 +- zomp.meta | 4 +-- zompify.sh | 49 ++++++++++++++++++++++++++++++ 14 files changed, 76 insertions(+), 11 deletions(-) create mode 100644 src/gmserialization.app.src.script create mode 100755 zompify.sh diff --git a/ebin/gmserialization.app b/ebin/gmserialization.app index c1861e8..fda31c0 100644 --- a/ebin/gmserialization.app +++ b/ebin/gmserialization.app @@ -1,6 +1,6 @@ {application,gmserialization, [{description,"Serialization of data for the Gajumaru"}, - {vsn,"0.1.2"}, + {vsn,"0.2.0"}, {registered,[]}, {applications,[kernel,stdlib,crypto,base58]}, {env,[]}, diff --git a/src/gmser_api_encoder.erl b/src/gmser_api_encoder.erl index c7914ba..9013b66 100644 --- a/src/gmser_api_encoder.erl +++ b/src/gmser_api_encoder.erl @@ -6,7 +6,7 @@ %%% @end %%%------------------------------------------------------------------- -module(gmser_api_encoder). --vsn("0.1.2"). +-vsn("0.2.0"). -export([encode/2, decode/1, diff --git a/src/gmser_chain_objects.erl b/src/gmser_chain_objects.erl index e8bf58f..4c89e07 100644 --- a/src/gmser_chain_objects.erl +++ b/src/gmser_chain_objects.erl @@ -8,7 +8,7 @@ %%%------------------------------------------------------------------- -module(gmser_chain_objects). --vsn("0.1.2"). +-vsn("0.2.0"). -export([ serialize/4 , deserialize/4 diff --git a/src/gmser_contract_code.erl b/src/gmser_contract_code.erl index c50efae..5c72e07 100644 --- a/src/gmser_contract_code.erl +++ b/src/gmser_contract_code.erl @@ -6,7 +6,7 @@ %%% @end %%%------------------------------------------------------------------- -module(gmser_contract_code). --vsn("0.1.2"). +-vsn("0.2.0"). -include("gmser_contract_code.hrl"). diff --git a/src/gmser_delegation.erl b/src/gmser_delegation.erl index 18af0c9..abd4d1b 100644 --- a/src/gmser_delegation.erl +++ b/src/gmser_delegation.erl @@ -6,7 +6,7 @@ %%% @end %%%------------------------------------------------------------------- -module(gmser_delegation). --vsn("0.1.2"). +-vsn("0.2.0"). -export([ aens_preclaim_sig/3 , aens_name_sig/4 diff --git a/src/gmser_dyn.erl b/src/gmser_dyn.erl index 9ca5ffc..4a297c2 100644 --- a/src/gmser_dyn.erl +++ b/src/gmser_dyn.erl @@ -1,4 +1,5 @@ -module(gmser_dyn). +-vsn("0.2.0"). -export([ encode/1 %% (Term) -> rlp() , encode/2 %% (Term, Types) -> rlp() diff --git a/src/gmser_dyn_types.erl b/src/gmser_dyn_types.erl index 1a41f1c..31051e6 100644 --- a/src/gmser_dyn_types.erl +++ b/src/gmser_dyn_types.erl @@ -1,4 +1,5 @@ -module(gmser_dyn_types). +-vsn("0.2.0"). -export([ add_type/3 %% (Tag, Code, Template) -> Types1 , add_type/4 %% (Tag, Code, Template, Types) -> Types1 diff --git a/src/gmser_id.erl b/src/gmser_id.erl index 2734027..80a592a 100644 --- a/src/gmser_id.erl +++ b/src/gmser_id.erl @@ -8,7 +8,7 @@ %%%------------------------------------------------------------------- -module(gmser_id). --vsn("0.1.2"). +-vsn("0.2.0"). -export([ create/2 , specialize/1 diff --git a/src/gmser_rlp.erl b/src/gmser_rlp.erl index 817b756..cbe508b 100644 --- a/src/gmser_rlp.erl +++ b/src/gmser_rlp.erl @@ -11,7 +11,7 @@ %%%------------------------------------------------------------------- -module(gmser_rlp). --vsn("0.1.2"). +-vsn("0.2.0"). -export([ decode/1 , decode_one/1 diff --git a/src/gmserialization.app.src b/src/gmserialization.app.src index b4f5f37..7a5a58f 100644 --- a/src/gmserialization.app.src +++ b/src/gmserialization.app.src @@ -1,6 +1,6 @@ {application, gmserialization, [{description, "Serialization of data for the Gajumaru"}, - {vsn, "0.1.0"}, + {vsn, "zomp"}, {registered, []}, {applications, [kernel, diff --git a/src/gmserialization.app.src.script b/src/gmserialization.app.src.script new file mode 100644 index 0000000..becbb46 --- /dev/null +++ b/src/gmserialization.app.src.script @@ -0,0 +1,14 @@ +%% -*- erlang-mode; erlang-indent-level: 4; indent-tabs-mode: nil -*- + +[{application, Name, Opts}] = CONFIG. +case lists:keyfind(vsn, 1, Opts) of + {vsn, "zomp"} -> + ZompMetaF = filename:join(filename:dirname(filename:dirname(SCRIPT)), "zomp.meta"), + {ok, ZMeta} = file:consult(ZompMetaF), + {_, {_, _, {Vmaj,Vmin,Vpatch}}} = lists:keyfind(package_id, 1, ZMeta), + VsnStr = unicode:characters_to_list(io_lib:fwrite("~w.~w.~w", [Vmaj, Vmin, Vpatch])), + Opts1 = lists:keyreplace(vsn, 1, Opts, {vsn, VsnStr}), + [{application, Name, Opts1}]; + _ -> + CONFIG +end. diff --git a/src/gmserialization.erl b/src/gmserialization.erl index 327823f..8f70d57 100644 --- a/src/gmserialization.erl +++ b/src/gmserialization.erl @@ -7,7 +7,7 @@ %%%------------------------------------------------------------------- -module(gmserialization). --vsn("0.1.2"). +-vsn("0.2.0"). -export([ decode_fields/2 , decode_field/2 diff --git a/zomp.meta b/zomp.meta index ca2ea67..4570c9c 100644 --- a/zomp.meta +++ b/zomp.meta @@ -2,9 +2,9 @@ {type,lib}. {modules,[]}. {prefix,none}. -{author,"Hans Svensson"}. {desc,"Serialization helpers for the Gajumaru."}. -{package_id,{"otpr","gmserialization",{0,1,2}}}. +{author,"Hans Svensson"}. +{package_id,{"otpr","gmserialization",{0,2,0}}}. {deps,[{"otpr","eblake2",{1,0,1}},{"otpr","base58",{0,1,1}}]}. {key_name,none}. {a_email,[]}. diff --git a/zompify.sh b/zompify.sh new file mode 100755 index 0000000..8ce3a4e --- /dev/null +++ b/zompify.sh @@ -0,0 +1,49 @@ +#!/bin/sh +set -e + +APP=$(basename "$PWD") + +SRC="_build/default/lib/$APP" +DST="$PWD/_build/zomp/lib/$APP" +IGNORE_FILE="zomp.ignore" + +mkdir -p "$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/" + +# copy generated schema +SCHEMA="$SRC/priv/gmhc_schema.json" +if [ -e "$SCHEMA" ]; then + mkdir -p "$DST/priv" + cp -a "$SCHEMA" "$DST/priv/$(basename "$SCHEMA")" +fi + +# Clean up beam files just in case +[ -d "$DST/ebin" ] && find "$DST/ebin" -name '*.beam' -exec rm -f {} + || true