From 00843e816aa1705b116faead42a9193227d11730 Mon Sep 17 00:00:00 2001 From: Ulf Wiger Date: Thu, 24 Apr 2025 12:03:18 +0200 Subject: [PATCH 01/11] Adapt to zomp (realm:uwiger) --- Emakefile | 1 + LICENSE | 25 +++++++++++++++++++++++++ rebar.config | 3 ++- src/setup.erl | 36 ++++++++++++++++++++++++++++++++++-- zomp.meta | 17 +++++++++++++++++ zompify.sh | 12 ++++++++++++ 6 files changed, 91 insertions(+), 3 deletions(-) create mode 100644 Emakefile create mode 100644 zomp.meta create mode 100755 zompify.sh diff --git a/Emakefile b/Emakefile new file mode 100644 index 0000000..68c7b67 --- /dev/null +++ b/Emakefile @@ -0,0 +1 @@ +{"src/*", [debug_info, {i, "include/"}, {outdir, "ebin/"}]}. diff --git a/LICENSE b/LICENSE index e454a52..aca9c04 100644 --- a/LICENSE +++ b/LICENSE @@ -176,3 +176,28 @@ END OF TERMS AND CONDITIONS + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2025 Ulf Wiger + + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/rebar.config b/rebar.config index 2fa99bb..6f69367 100644 --- a/rebar.config +++ b/rebar.config @@ -26,7 +26,8 @@ {dialyzer, [{plt_extra_apps, [sasl]}]}. -{post_hooks, [{"(linux|darwin|solaris|freebsd|netbsd|openbsd)", +{post_hooks, [{compile, "./zompify.sh"}, + {"(linux|darwin|solaris|freebsd|netbsd|openbsd)", escriptize, "cp \"$REBAR_BUILD_DIR/bin/setup_gen\" ./setup_gen"}, {"win32", diff --git a/src/setup.erl b/src/setup.erl index 5fb193a..018e181 100644 --- a/src/setup.erl +++ b/src/setup.erl @@ -221,7 +221,7 @@ log_dir() -> log_dir_([]). log_dir_(Vis) -> - setup_dir(log_dir, "log." ++ atom_to_list(node()), Vis). + setup_dir(log_dir, default_dir(log), Vis). %% @spec data_dir() -> Directory %% @doc Returns the configured data dir, or a best guess (`home()/data.Node'). @@ -232,7 +232,39 @@ data_dir() -> data_dir_([]). data_dir_(Vis) -> - setup_dir(data_dir, "data." ++ atom_to_list(node()), Vis). + setup_dir(data_dir, default_dir(data), Vis). + +default_dir(Type) -> + case zomp_context() of + true -> + zomp_default_dir(Type); + false -> + setup_default_dir(Type) + end. + +zomp_context() -> + is_pid(whereis(zx_daemon)). + +zomp_default_dir(data) -> + #{package_id := PId} = zx_daemon:meta(), + Dir = zx_lib:ppath(var, PId), + filename:join(Dir, "setup.data"); +zomp_default_dir(log) -> + try zomp_default_log_dir() + catch + error:_ -> + setup_default_dir(log) + end. + +zomp_default_log_dir() -> + {ok, H} = logger:get_handler_config(default), + #{config := #{file := F}} = H, + [Base,_] = re:split(F,"\\.log$",[{return,list}]), + Base. + +setup_default_dir(log) -> "log." ++ atom_to_list(node()); +setup_default_dir(data) -> "data." ++ atom_to_list(node()). + setup_dir(Key, Default, Vis) -> case get_env_v(setup, Key, Vis) of diff --git a/zomp.meta b/zomp.meta new file mode 100644 index 0000000..ff06942 --- /dev/null +++ b/zomp.meta @@ -0,0 +1,17 @@ +{name,"setup"}. +{type,app}. +{modules,[]}. +{prefix,"setup"}. +{author,"Ulf Wiger"}. +{desc,"Generic setup utility for Erlang-based systems"}. +{package_id,{"uwiger","setup",{2,2,3}}}. +{deps,[]}. +{key_name,none}. +{a_email,"ulf@wiger.net"}. +{c_email,"ulf@wiger.net"}. +{copyright,"Ulf Wiger"}. +{file_exts,[]}. +{license,"Apache-2.0"}. +{repo_url,"https://github.com/uwiger/setup"}. +{tags,[]}. +{ws_url,[]}. diff --git a/zompify.sh b/zompify.sh new file mode 100755 index 0000000..3c56b80 --- /dev/null +++ b/zompify.sh @@ -0,0 +1,12 @@ +#!/bin/sh +set -e + +APP=$(basename "$PWD") +SRC="_build/default/lib/$APP" +DST="$PWD/_build/zomp/lib/$APP" +mkdir -p "$DST" +find "$SRC" -type l ! -exec test -e {} \; -delete +cp -aR -L "$SRC/." "$DST/" +cp "$PWD/zomp.meta" "$DST/" +cp "$PWD/Emakefile" "$DST" +rm "$DST"/ebin/*.beam From ab16cf6b30f393f973c7f108b565effa2f919601 Mon Sep 17 00:00:00 2001 From: Ulf Wiger Date: Thu, 24 Apr 2025 22:17:22 +0200 Subject: [PATCH 02/11] Add ebin/setup.app --- .gitignore | 2 +- ebin/setup.app | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 ebin/setup.app diff --git a/.gitignore b/.gitignore index dd16358..d21fe31 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ deps *.beam -ebin/*.app +ebin/*.beam setup_gen xtest/releases xtest/testapp-*/ebin diff --git a/ebin/setup.app b/ebin/setup.app new file mode 100644 index 0000000..0a80cf3 --- /dev/null +++ b/ebin/setup.app @@ -0,0 +1,16 @@ +{application,setup, + [{description,"Generic setup utility for Erlang-based systems"}, + {vsn,"2.2.3"}, + {registered,[]}, + {applications,[kernel,stdlib]}, + {mod,{setup_app,[]}}, + {start_phases,[{run_setup,[]}]}, + {env,[]}, + {maintainers,["Ulf Wiger"]}, + {licenses,["Apache 2.0"]}, + {links,[{"Github","https://github.com/uwiger/setup"}]}, + {files,["src","c_src","include","rebar.config.script","priv", + "rebar.config","rebar.lock","README*","readme*", + "LICENSE*","license*","NOTICE","Makefile"]}, + {modules,[setup,setup_app,setup_file,setup_file_io_server, + setup_gen,setup_lib,setup_srv,setup_sup]}]}. From 3ad83ed3cade6780897d11f5f0d987012b93345b Mon Sep 17 00:00:00 2001 From: Ulf Wiger Date: Tue, 6 May 2025 11:03:25 +0200 Subject: [PATCH 03/11] Slightly better structure for zomp + additional archive access functions --- src/setup.erl | 29 ++------- src/setup_app.erl | 64 +++++++++++++++++++ src/setup_file.erl | 152 ++++++++++++++++++++++++++++++++++++++++++++- src/setup_zomp.erl | 63 +++++++++++++++++++ 4 files changed, 284 insertions(+), 24 deletions(-) create mode 100644 src/setup_zomp.erl diff --git a/src/setup.erl b/src/setup.erl index 018e181..7be7125 100644 --- a/src/setup.erl +++ b/src/setup.erl @@ -175,6 +175,7 @@ -export([main/1]). % new escript entry point -include_lib("kernel/include/file.hrl"). +-include_lib("kernel/include/logger.hrl"). -ifdef(TEST). -compile([export_all, nowarn_export_all]). @@ -235,36 +236,18 @@ data_dir_(Vis) -> setup_dir(data_dir, default_dir(data), Vis). default_dir(Type) -> - case zomp_context() of + case setup_zomp:is_zomp_context() of true -> - zomp_default_dir(Type); + case setup_zomp:default_dir(Type) of + undefined -> setup_default_dir(Type); + Dir -> Dir + end; false -> setup_default_dir(Type) end. -zomp_context() -> - is_pid(whereis(zx_daemon)). - -zomp_default_dir(data) -> - #{package_id := PId} = zx_daemon:meta(), - Dir = zx_lib:ppath(var, PId), - filename:join(Dir, "setup.data"); -zomp_default_dir(log) -> - try zomp_default_log_dir() - catch - error:_ -> - setup_default_dir(log) - end. - -zomp_default_log_dir() -> - {ok, H} = logger:get_handler_config(default), - #{config := #{file := F}} = H, - [Base,_] = re:split(F,"\\.log$",[{return,list}]), - Base. - setup_default_dir(log) -> "log." ++ atom_to_list(node()); setup_default_dir(data) -> "data." ++ atom_to_list(node()). - setup_dir(Key, Default, Vis) -> case get_env_v(setup, Key, Vis) of diff --git a/src/setup_app.erl b/src/setup_app.erl index 3ee07f4..70a8384 100644 --- a/src/setup_app.erl +++ b/src/setup_app.erl @@ -22,7 +22,16 @@ start_phase/3, stop/1]). +-include_lib("kernel/include/logger.hrl"). + start(_Type, _Args) -> + case setup_zomp:is_zomp_context() of + true -> + setup_zomp:update_env(), + load_setup_conf(setup_zomp:setup_conf_path()); + false -> + load_setup_conf(default_setup_conf_path()) + end, setup_sup:start_link(). start_phase(run_setup, _Type, []) -> @@ -36,3 +45,58 @@ start_phase(run_setup, _Type, []) -> stop(_) -> ok. + +default_setup_conf_path() -> + ["."]. + +load_setup_conf(Path) -> + case setup:get_env(setup, conf) of + {ok, F} -> + load_setup_conf_(F); + undefined -> + try_path_load(Path) + end. + +load_setup_conf_(F) -> + case lists:reverse(F) of + "tpircs.gifnoc." ++ _ -> %% .config.script + Cfg = ok(setup_file:script(F, script_env()), script, F), + process_conf(Cfg, script, F); + "gifnoc." ++ _ -> %% .config + Cfg = ok(file:consult(F), consult, F), + process_conf(Cfg, consult, F); + _ -> + ?LOG_WARNING("Unusual setup conf filename (~s), will try file:consult()", [F]), + Cfg = ok(file:consult(F), consult, F), + process_conf(Cfg, consult, F) + end. + +try_path_load(Path) -> + case setup_file:path_script(Path, "setup.config.script") of + {error, enoent} -> + case setup_file:path_consult(Path, "setup.config") of + {ok, List, Full} -> + process_conf(List, consult, Full); + {error, enoent} -> + ok + end; + {ok, Cfg, Full} -> + process_conf(Cfg, script, Full) + end. + +script_env() -> + []. + +process_conf(Cfg, _Op, _F) -> + lists:foreach( + fun({App, Vars}) -> + lists:foreach( + fun({K, V}) -> + application:set_env(App, K, V) + end, Vars) + end, Cfg). + +ok({ok, Value}, _, _) -> + Value; +ok(Error, Op, F) -> + error({unexpected, {Error, Op, F}}). diff --git a/src/setup_file.erl b/src/setup_file.erl index 76083df..be725b1 100644 --- a/src/setup_file.erl +++ b/src/setup_file.erl @@ -9,7 +9,11 @@ eval_binary/1, eval_binary/2, script/1, - script/2]). + script/2, + path_open/3, + path_consult/2, + path_script/2, + path_script/3]). -include_lib("stdlib/include/zip.hrl"). -include_lib("kernel/include/file.hrl"). @@ -163,6 +167,152 @@ script(File, Bindings) -> Other end. +-spec path_consult(Path, Filename) -> {ok, Terms, FullName} | {error, Reason} when + Path :: [Dir], + Dir :: file:name_all(), + Filename :: file:name_all(), + Terms :: [term()], + FullName :: file:filename_all(), + Reason :: file:posix() | badarg | terminated | system_limit + | {Line :: integer(), Mod :: module(), Term :: term()}. + +path_consult(Path, File) -> + case path_open(Path, File, [read]) of + {ok, Fd, Full} -> + case consult_stream(Fd) of + {ok, List} -> + _ = close(Fd), + {ok, List, Full}; + E1 -> + _ = close(Fd), + E1 + end; + E2 -> + E2 + end. + +-spec path_script(Path, Filename) -> + {ok, Value, FullName} | {error, Reason} when + Path :: [Dir :: file:name_all()], + Filename :: file:name_all(), + Value :: term(), + FullName :: file:filename_all(), + Reason :: file:posix() | badarg | terminated | system_limit + | {Line :: integer(), Mod :: module(), Term :: term()}. + +path_script(Path, File) -> + path_script(Path, File, erl_eval:new_bindings()). + +-doc """ +The same as [`path_script/2`](`path_script/2`) but the variable bindings +`Bindings` are used in the evaluation. See `m:erl_eval` about variable bindings. +""". +-spec path_script(Path, Filename, Bindings) -> + {ok, Value, FullName} | {error, Reason} when + Path :: [Dir :: file:name_all()], + Filename :: file:name_all(), + Bindings :: erl_eval:binding_struct(), + Value :: term(), + FullName :: file:filename_all(), + Reason :: file:posix() | badarg | terminated | system_limit + | {Line :: integer(), Mod :: module(), Term :: term()}. + +path_script(Path, File, Bs) -> + case path_open(Path, File, [read]) of + {ok,Fd,Full} -> + case eval_stream(Fd, return, Bs) of + {ok,R} -> + _ = close(Fd), + {ok, R, Full}; + E1 -> + _ = close(Fd), + E1 + end; + E2 -> + E2 + end. + +%% We duplicate this as well, since the open() function needs to be modified +%% +-spec path_open(Path, Filename, Modes) -> + {ok, IoDevice, FullName} | {error, Reason} when + Path :: [Dir :: file:name_all()], + Filename :: file:name_all(), + Modes :: [file:mode() | directory], + IoDevice :: file:io_device(), + FullName :: file:filename_all(), + Reason :: file:posix() | badarg | system_limit. + +path_open(PathList, Name, Mode) -> + case file_name(Name) of + {error, _} = Error -> + Error; + FileName -> + case filename:pathtype(FileName) of + relative -> + path_open_first(PathList, FileName, Mode, enoent); + _ -> + case open(Name, Mode) of + {ok, Fd} -> + {ok, Fd, Name}; + Error -> + Error + end + end + end. + +path_open_first([Path|Rest], Name, Mode, LastError) -> + case file_name(Path) of + {error, _} = Error -> + Error; + FilePath -> + FileName = fname_join(FilePath, Name), + case open(FileName, Mode) of + {ok, Fd} -> + {ok, Fd, FileName}; + {error, Reason} when Reason =:= enoent; Reason =:= enotdir -> + path_open_first(Rest, Name, Mode, LastError); + Error -> + Error + end + end; +path_open_first([], _Name, _Mode, LastError) -> + {error, LastError}. + +fname_join(".", Name) -> + Name; +fname_join(Dir, Name) -> + filename:join(Dir, Name). + +%% Duplicated since it's not exported from file.erl +%% + +%% file_name(FileName) +%% Generates a flat file name from a deep list of atoms and +%% characters (integers). + +file_name(N) when is_binary(N) -> + N; +file_name(N) -> + try + file_name_1(N,file:native_name_encoding()) + catch Reason -> + {error, Reason} + end. + +file_name_1([C|T],latin1) when is_integer(C), C < 256-> + [C|file_name_1(T,latin1)]; +file_name_1([C|T],utf8) when is_integer(C) -> + [C|file_name_1(T,utf8)]; +file_name_1([H|T],E) -> + file_name_1(H,E) ++ file_name_1(T,E); +file_name_1([],_) -> + []; +file_name_1(N,_) when is_atom(N) -> + atom_to_list(N); +file_name_1(_,_) -> + throw(badarg). + contains_zip_file(File) when is_atom(File) -> contains_zip_file(atom_to_binary(File, utf8)); contains_zip_file(File) -> diff --git a/src/setup_zomp.erl b/src/setup_zomp.erl new file mode 100644 index 0000000..74e5e3a --- /dev/null +++ b/src/setup_zomp.erl @@ -0,0 +1,63 @@ +-module(setup_zomp). + +-export([ is_zomp_context/0 + , update_env/0 + , setup_conf_path/0 + , default_dir/1 ]). + +-include_lib("kernel/include/logger.hrl"). + +is_zomp_context() -> + is_pid(whereis(zx_daemon)). + +update_env() -> + Args = init:get_plain_arguments(), + ?LOG_INFO("Plain args: ~p", [Args]), + look_for_setup_env(Args). + +default_dir(data) -> + #{package_id := PId} = zx_daemon:meta(), + Dir = zx_lib:ppath(var, PId), + filename:join(Dir, "setup.data"); +default_dir(log) -> + try zomp_default_log_dir() + catch + error:_ -> + undefined + end. + +setup_conf_path() -> + #{package_id := TopPId} = zx_daemon:meta(), + TopPPath = zx_lib:ppath(lib, TopPId), + [".", TopPPath]. + +zomp_default_log_dir() -> + {ok, H} = logger:get_handler_config(default), + #{config := #{file := F}} = H, + [Base,_] = re:split(F,"\\.log$",[{return,list}]), + Base. + +look_for_setup_env(["-setup", K, V | Rest]) -> + ?LOG_INFO("Processing env: ~p ~p", [K, V]), + process_env(K, V), + look_for_setup_env(Rest); +look_for_setup_env([_|T]) -> + look_for_setup_env(T); +look_for_setup_env([]) -> + ok. + +process_env(K, V) -> + case valid_env(K, V) of + {true, {Key, Value}} -> + ?LOG_INFO("Valid env: ~p: ~p", [Key, Value]), + application:set_env(setup, Key, Value); + false -> + ?LOG_INFO("Invalid env", []), + ignore + end. + +valid_env("log_dir" , D) -> {true, {log_dir , D}}; +valid_env("data_dir", D) -> {true, {data_dir, D}}; +valid_env("conf", D) -> {true, {conf , D}}; +valid_env(_, _) -> + false. From de15e8d67312f7078799ad6782baef647e756179 Mon Sep 17 00:00:00 2001 From: Ulf Wiger Date: Mon, 12 May 2025 23:22:19 +0200 Subject: [PATCH 04/11] update zompify.sh, zomp.meta --- zomp.meta | 2 +- zompify.sh | 38 ++++++++++++++++++++++++++++++++++---- 2 files changed, 35 insertions(+), 5 deletions(-) diff --git a/zomp.meta b/zomp.meta index ff06942..ce2c1c4 100644 --- a/zomp.meta +++ b/zomp.meta @@ -4,7 +4,7 @@ {prefix,"setup"}. {author,"Ulf Wiger"}. {desc,"Generic setup utility for Erlang-based systems"}. -{package_id,{"uwiger","setup",{2,2,3}}}. +{package_id,{"uwiger","setup",{2,2,4}}}. {deps,[]}. {key_name,none}. {a_email,"ulf@wiger.net"}. diff --git a/zompify.sh b/zompify.sh index 3c56b80..66aca1c 100755 --- a/zompify.sh +++ b/zompify.sh @@ -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 From 0d89f1b11413b8ed80f16d4b3a512be7555cd6a0 Mon Sep 17 00:00:00 2001 From: Ulf Wiger Date: Tue, 13 May 2025 09:47:31 +0200 Subject: [PATCH 05/11] drop (very) old OTP versions for CI --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8e56353..6ffd61a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - otp: [21, 22, 23, 24, 25] + otp: [25, 26, 27] fail-fast: false container: image: erlang:${{ matrix.otp }} From 480f351a1c11cb49d667a29ffca00900709a3aba Mon Sep 17 00:00:00 2001 From: Ulf Wiger Date: Tue, 13 May 2025 09:50:23 +0200 Subject: [PATCH 06/11] convert (copy-pasted) -doc line to a regular comment --- src/setup_file.erl | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/setup_file.erl b/src/setup_file.erl index be725b1..a789e8e 100644 --- a/src/setup_file.erl +++ b/src/setup_file.erl @@ -203,10 +203,8 @@ path_consult(Path, File) -> path_script(Path, File) -> path_script(Path, File, erl_eval:new_bindings()). --doc """ -The same as [`path_script/2`](`path_script/2`) but the variable bindings -`Bindings` are used in the evaluation. See `m:erl_eval` about variable bindings. -""". +%% The same as [`path_script/2`](`path_script/2`) but the variable bindings +%% `Bindings` are used in the evaluation. See `m:erl_eval` about variable bindings. -spec path_script(Path, Filename, Bindings) -> {ok, Value, FullName} | {error, Reason} when Path :: [Dir :: file:name_all()], From a21794cb6457ad49a7f8b29012e864d108f4e0d1 Mon Sep 17 00:00:00 2001 From: Ulf Wiger Date: Tue, 13 May 2025 09:59:30 +0200 Subject: [PATCH 07/11] try to force zompify to run as bash script --- zompify.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zompify.sh b/zompify.sh index 66aca1c..83c63b7 100755 --- a/zompify.sh +++ b/zompify.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env bash set -e APP=$(basename "$PWD") From aaf796b30b49b4533ca98daca789b81662e9495b Mon Sep 17 00:00:00 2001 From: Ulf Wiger Date: Tue, 13 May 2025 10:09:09 +0200 Subject: [PATCH 08/11] Address git permissions issue in ci --- .github/workflows/ci.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6ffd61a..fdd1175 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,5 +20,10 @@ jobs: image: erlang:${{ matrix.otp }} steps: - uses: actions/checkout@v3 - - name: Test + + - name: Mark Git directory as safe + run: git config --global --add safe.directory "$GITHUB_WORKSPACE" + + - name: Run CI + shell: bash run: make ci From d6695e5d072fe35441e176935c70cc34c0789031 Mon Sep 17 00:00:00 2001 From: Ulf Wiger Date: Tue, 13 May 2025 12:10:34 +0200 Subject: [PATCH 09/11] WIP add verbosity to the test run --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 6f41d33..9365eb2 100644 --- a/Makefile +++ b/Makefile @@ -33,7 +33,7 @@ eunit: compile ${REBAR3} eunit test: eunit compile_test - ERL_LIBS=${PWD}/_build/test/lib ./setup_gen test xtest/test.conf xtest/releases/1 + ERL_LIBS=${PWD}/_build/test/lib ./setup_gen -v -name test -conf xtest/test.conf -out xtest/releases/1 run_test: erl -boot xtest/releases/1/start -config xtest/releases/1/sys From 78a808632bf2e81330d067dad57bbf46d1b53798 Mon Sep 17 00:00:00 2001 From: Ulf Wiger Date: Tue, 13 May 2025 13:41:38 +0200 Subject: [PATCH 10/11] more thorough git fetch in ci --- .github/workflows/ci.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fdd1175..b55d175 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,7 +22,10 @@ jobs: - uses: actions/checkout@v3 - name: Mark Git directory as safe - run: git config --global --add safe.directory "$GITHUB_WORKSPACE" + run: | + git config --global --add safe.directory "$GITHUB_WORKSPACE" + git fetch --unshallow + git fetch --tags - name: Run CI shell: bash From d9b0b51505ff75c459f1ab62bd907ca5e3a32291 Mon Sep 17 00:00:00 2001 From: Ulf Wiger Date: Wed, 14 May 2025 09:16:57 +0200 Subject: [PATCH 11/11] remove zompify post-hook --- rebar.config | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/rebar.config b/rebar.config index 6f69367..2fa99bb 100644 --- a/rebar.config +++ b/rebar.config @@ -26,8 +26,7 @@ {dialyzer, [{plt_extra_apps, [sasl]}]}. -{post_hooks, [{compile, "./zompify.sh"}, - {"(linux|darwin|solaris|freebsd|netbsd|openbsd)", +{post_hooks, [{"(linux|darwin|solaris|freebsd|netbsd|openbsd)", escriptize, "cp \"$REBAR_BUILD_DIR/bin/setup_gen\" ./setup_gen"}, {"win32",