@calltelemetry/fmix 2.7.5 → 2.7.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/fmix +124 -23
- package/package.json +3 -3
package/bin/fmix
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
# ./fmix test [--worktree <path>] [--session <id>] [--isolate] [--cache-base <N.N.N-stable>] [--unit] -- <mix test args>
|
|
7
7
|
# ./fmix coverage --worktree <path> [--session <id>] --base <git-ref> -- <test paths>
|
|
8
8
|
# ./fmix task [--worktree <path>] [--session <id>] [--database <name>] [--mix-env <env>] [--allow-run] -- <mix task> [args]
|
|
9
|
-
# ./fmix format [--worktree <path>] [--session <id>] [--mix-env <env>] [--check] -- <files...>
|
|
9
|
+
# ./fmix format [--worktree <path>] [--session <id>] [--mix-env <env>] [--dot-formatter <path>] [--check] -- <files...>
|
|
10
10
|
# ./fmix setup [--worktree <path>] [--session <id>] [--rebuild-db|--cold-db|--from-zero]
|
|
11
11
|
# ./fmix seed publish --worktree <path> [--session <id>] --cache-base <N.N.N-stable>
|
|
12
12
|
# ./fmix cache explain --worktree <path> --cache-base <N.N.N-stable>
|
|
@@ -24,7 +24,7 @@ set -uo pipefail
|
|
|
24
24
|
# ---------------------------------------------------------------------------
|
|
25
25
|
# Constants & config
|
|
26
26
|
# ---------------------------------------------------------------------------
|
|
27
|
-
FMIX_VERSION="2.7.
|
|
27
|
+
FMIX_VERSION="2.7.7"
|
|
28
28
|
FMIX_HOME="${FMIX_HOME:-${HOME}/.ct-fmix}"
|
|
29
29
|
FMIX_OS="$(uname -s)"
|
|
30
30
|
FMIX_ARCH="$(uname -m)"
|
|
@@ -667,6 +667,100 @@ fmix_hash_file_batches() {
|
|
|
667
667
|
fi
|
|
668
668
|
}
|
|
669
669
|
|
|
670
|
+
fmix_hash_tracked_compile_inputs() {
|
|
671
|
+
local root="$1" tracked_file="$2" py_bin
|
|
672
|
+
py_bin="$(fmix_python_bin 2>/dev/null || echo python3)"
|
|
673
|
+
"$py_bin" - "$root" "$tracked_file" <<'PY'
|
|
674
|
+
import hashlib
|
|
675
|
+
import os
|
|
676
|
+
import sys
|
|
677
|
+
|
|
678
|
+
|
|
679
|
+
root = os.fsencode(sys.argv[1])
|
|
680
|
+
tracked_file = sys.argv[2]
|
|
681
|
+
output = sys.stdout.buffer
|
|
682
|
+
error_output = sys.stderr.buffer
|
|
683
|
+
|
|
684
|
+
|
|
685
|
+
def iter_nul_records(stream):
|
|
686
|
+
pending = bytearray()
|
|
687
|
+
while True:
|
|
688
|
+
chunk = stream.read(64 * 1024)
|
|
689
|
+
if not chunk:
|
|
690
|
+
break
|
|
691
|
+
pending.extend(chunk)
|
|
692
|
+
start = 0
|
|
693
|
+
while True:
|
|
694
|
+
try:
|
|
695
|
+
end = pending.index(0, start)
|
|
696
|
+
except ValueError:
|
|
697
|
+
if start:
|
|
698
|
+
del pending[:start]
|
|
699
|
+
break
|
|
700
|
+
yield bytes(pending[start:end])
|
|
701
|
+
start = end + 1
|
|
702
|
+
if start == len(pending):
|
|
703
|
+
pending.clear()
|
|
704
|
+
break
|
|
705
|
+
|
|
706
|
+
if pending:
|
|
707
|
+
yield bytes(pending)
|
|
708
|
+
|
|
709
|
+
|
|
710
|
+
def report_error(message):
|
|
711
|
+
error_output.write(b" [fmix ERROR] " + message + b"\n")
|
|
712
|
+
error_output.flush()
|
|
713
|
+
|
|
714
|
+
|
|
715
|
+
def hash_file(path):
|
|
716
|
+
digest = hashlib.sha256()
|
|
717
|
+
with open(path, "rb") as source:
|
|
718
|
+
while True:
|
|
719
|
+
chunk = source.read(1024 * 1024)
|
|
720
|
+
if not chunk:
|
|
721
|
+
break
|
|
722
|
+
digest.update(chunk)
|
|
723
|
+
return digest.hexdigest().encode("ascii")
|
|
724
|
+
|
|
725
|
+
|
|
726
|
+
try:
|
|
727
|
+
with open(tracked_file, "rb") as records:
|
|
728
|
+
for entry in iter_nul_records(records):
|
|
729
|
+
try:
|
|
730
|
+
metadata, path = entry.split(b"\t", 1)
|
|
731
|
+
mode = metadata.split(b" ", 1)[0]
|
|
732
|
+
except ValueError:
|
|
733
|
+
report_error(b"Malformed tracked compiler input record")
|
|
734
|
+
raise SystemExit(1)
|
|
735
|
+
|
|
736
|
+
if mode == b"160000":
|
|
737
|
+
continue
|
|
738
|
+
|
|
739
|
+
candidate = root + b"/" + path
|
|
740
|
+
output.write(b"tracked:" + metadata + b":" + path + b":")
|
|
741
|
+
if os.path.islink(candidate):
|
|
742
|
+
output.flush()
|
|
743
|
+
report_error(
|
|
744
|
+
b"Symlinked compiler input is unsupported: " + candidate
|
|
745
|
+
)
|
|
746
|
+
raise SystemExit(1)
|
|
747
|
+
if os.path.isfile(candidate):
|
|
748
|
+
try:
|
|
749
|
+
digest = hash_file(candidate)
|
|
750
|
+
except OSError:
|
|
751
|
+
output.flush()
|
|
752
|
+
report_error(b"Could not hash compiler input: " + candidate)
|
|
753
|
+
raise SystemExit(1)
|
|
754
|
+
output.write(digest + b"\n")
|
|
755
|
+
else:
|
|
756
|
+
output.write(b"missing\n")
|
|
757
|
+
output.flush()
|
|
758
|
+
except OSError:
|
|
759
|
+
report_error(b"Could not read tracked compiler input records")
|
|
760
|
+
raise SystemExit(1)
|
|
761
|
+
PY
|
|
762
|
+
}
|
|
763
|
+
|
|
670
764
|
fmix_now() {
|
|
671
765
|
date -u +%Y-%m-%dT%H:%M:%SZ
|
|
672
766
|
}
|
|
@@ -7939,7 +8033,7 @@ fmix_reject_repo_elixir_input_symlinks() {
|
|
|
7939
8033
|
}
|
|
7940
8034
|
|
|
7941
8035
|
fmix_hash_compile_paths() {
|
|
7942
|
-
local root="$1" tracked_file="" untracked_file=""
|
|
8036
|
+
local root="$1" tracked_file="" untracked_file="" path file
|
|
7943
8037
|
shift
|
|
7944
8038
|
for path in "$@"; do
|
|
7945
8039
|
fmix_reject_compile_input_symlink_components "$root" "$path" || return 1
|
|
@@ -7953,23 +8047,10 @@ fmix_hash_compile_paths() {
|
|
|
7953
8047
|
rm -f "$tracked_file"
|
|
7954
8048
|
return 1
|
|
7955
8049
|
fi
|
|
7956
|
-
|
|
7957
|
-
|
|
7958
|
-
|
|
7959
|
-
|
|
7960
|
-
[[ "$mode" != "160000" ]] || continue
|
|
7961
|
-
printf 'tracked:%s:%s:' "$metadata" "$path"
|
|
7962
|
-
if [[ -L "$root/$path" ]]; then
|
|
7963
|
-
fmix_error "Symlinked compiler input is unsupported: $root/$path"
|
|
7964
|
-
rm -f "$tracked_file"
|
|
7965
|
-
return 1
|
|
7966
|
-
elif [[ -f "$root/$path" ]]; then
|
|
7967
|
-
fmix_hash_stdin <"$root/$path" \
|
|
7968
|
-
|| { rm -f "$tracked_file"; return 1; }
|
|
7969
|
-
else
|
|
7970
|
-
printf 'missing\n'
|
|
7971
|
-
fi
|
|
7972
|
-
done <"$tracked_file"
|
|
8050
|
+
if ! fmix_hash_tracked_compile_inputs "$root" "$tracked_file"; then
|
|
8051
|
+
rm -f "$tracked_file"
|
|
8052
|
+
return 1
|
|
8053
|
+
fi
|
|
7973
8054
|
rm -f "$tracked_file"
|
|
7974
8055
|
untracked_file="$(mktemp)" || return 1
|
|
7975
8056
|
if ! (
|
|
@@ -11156,6 +11237,7 @@ cmd_format() {
|
|
|
11156
11237
|
local worktree_arg="auto"
|
|
11157
11238
|
local session_arg=""
|
|
11158
11239
|
local mix_env_arg="test"
|
|
11240
|
+
local dot_formatter_arg=""
|
|
11159
11241
|
local check_only=0
|
|
11160
11242
|
local found_sep=0
|
|
11161
11243
|
local -a fmt_args=()
|
|
@@ -11179,10 +11261,16 @@ cmd_format() {
|
|
|
11179
11261
|
shift 2
|
|
11180
11262
|
;;
|
|
11181
11263
|
--mix-env=*) mix_env_arg="${1#--mix-env=}"; shift ;;
|
|
11264
|
+
--dot-formatter)
|
|
11265
|
+
[[ $# -ge 2 ]] || { fmix_error "--dot-formatter requires a path argument."; return 2; }
|
|
11266
|
+
dot_formatter_arg="$2"
|
|
11267
|
+
shift 2
|
|
11268
|
+
;;
|
|
11269
|
+
--dot-formatter=*) dot_formatter_arg="${1#--dot-formatter=}"; shift ;;
|
|
11182
11270
|
--check) check_only=1; shift ;;
|
|
11183
11271
|
--) found_sep=1; shift; break ;;
|
|
11184
11272
|
*)
|
|
11185
|
-
fmix_error "Unknown option: $1. Usage: fmix format [--worktree <path>] [--session <id>] [--mix-env <env>] [--check] -- <files...>"
|
|
11273
|
+
fmix_error "Unknown option: $1. Usage: fmix format [--worktree <path>] [--session <id>] [--mix-env <env>] [--dot-formatter <path>] [--check] -- <files...>"
|
|
11186
11274
|
return 2
|
|
11187
11275
|
;;
|
|
11188
11276
|
esac
|
|
@@ -11240,6 +11328,14 @@ cmd_format() {
|
|
|
11240
11328
|
if (( check_only == 1 )); then
|
|
11241
11329
|
mix_cmd+=(--check-formatted)
|
|
11242
11330
|
fi
|
|
11331
|
+
# Formatter-configuration scopes: repos with `subdirectories` entries in
|
|
11332
|
+
# .formatter.exs (e.g. Ecto migrations under priv/*/migrations) format
|
|
11333
|
+
# those files with a different import_deps/locals_without_parens set than
|
|
11334
|
+
# the root config. --dot-formatter selects that config explicitly while
|
|
11335
|
+
# deps still resolve from the project root.
|
|
11336
|
+
if [[ -n "$dot_formatter_arg" ]]; then
|
|
11337
|
+
mix_cmd+=(--dot-formatter "$dot_formatter_arg")
|
|
11338
|
+
fi
|
|
11243
11339
|
mix_cmd+=("${fmt_args[@]}")
|
|
11244
11340
|
|
|
11245
11341
|
local fmt_rc=0
|
|
@@ -17039,7 +17135,7 @@ fmix format - format Elixir sources with the exact pinned toolchain.
|
|
|
17039
17135
|
|
|
17040
17136
|
Usage:
|
|
17041
17137
|
fmix format [--worktree <path>] [--session <id>] [--mix-env <env>]
|
|
17042
|
-
[--check] -- <files...>
|
|
17138
|
+
[--dot-formatter <path>] [--check] -- <files...>
|
|
17043
17139
|
|
|
17044
17140
|
Notes:
|
|
17045
17141
|
Uses the repo's .tool-versions pin and the same session deps/_build as
|
|
@@ -17047,12 +17143,17 @@ Notes:
|
|
|
17047
17143
|
way CI compiles them. Never uses an ambient mise/asdf/global Elixir, which
|
|
17048
17144
|
can silently rewrite unrelated hunks when its version differs from the
|
|
17049
17145
|
pin. --check is read-only (--check-formatted) for CI and pre-push gates.
|
|
17146
|
+
--dot-formatter <path> formats the passed files with a specific formatter
|
|
17147
|
+
configuration (e.g. priv/repo/migrations/.formatter.exs) while deps still
|
|
17148
|
+
resolve from the project root — the equivalent of the `subdirectories`
|
|
17149
|
+
entries in a root .formatter.exs.
|
|
17050
17150
|
Formatting is DB-free: no database is provisioned or contacted.
|
|
17051
17151
|
|
|
17052
17152
|
Examples:
|
|
17053
17153
|
fmix format --worktree ./cisco-cdr -- lib/cdrcisco/pipeline_data.ex
|
|
17054
17154
|
fmix format -- lib/**/*.ex
|
|
17055
17155
|
fmix format --check -- lib/cdrcisco/pipeline_data.ex
|
|
17156
|
+
fmix format --dot-formatter priv/repo/migrations/.formatter.exs -- priv/repo/migrations/*.exs
|
|
17056
17157
|
VERB
|
|
17057
17158
|
;;
|
|
17058
17159
|
setup)
|
|
@@ -17178,7 +17279,7 @@ Usage:
|
|
|
17178
17279
|
./fmix test [--worktree <path>] [--session <id>] [--cache-base <N.N.N-stable>] [--event-fd <fd>] [--unit] -- <mix test args>
|
|
17179
17280
|
./fmix coverage [--worktree <path>] [--session <id>] --base <git-ref> [--source <lib/**/*.ex>] [--threshold 80] -- <test paths>
|
|
17180
17281
|
./fmix task [--worktree <path>] [--session <id>] [--database <name>] [--mix-env <env>] [--allow-run] -- <mix task> [args]
|
|
17181
|
-
./fmix format [--worktree <path>] [--session <id>] [--mix-env <env>] [--check] -- <files...>
|
|
17282
|
+
./fmix format [--worktree <path>] [--session <id>] [--mix-env <env>] [--dot-formatter <path>] [--check] -- <files...>
|
|
17182
17283
|
./fmix setup [--worktree <path>] [--session <id>] [--rebuild-db|--cold-db|--from-zero]
|
|
17183
17284
|
./fmix seed publish --worktree <path> [--session <id>] --cache-base <N.N.N-stable>
|
|
17184
17285
|
./fmix cache explain --worktree <path> --cache-base <N.N.N-stable>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@calltelemetry/fmix",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.7",
|
|
4
4
|
"description": "Verified native FMix runner for CallTelemetry workspaces",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": {
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"directory": "packages/npm"
|
|
27
27
|
},
|
|
28
28
|
"fmix": {
|
|
29
|
-
"runnerSha256": "
|
|
30
|
-
"sourceTag": "fmix-v2.7.
|
|
29
|
+
"runnerSha256": "fabfe3e1c9c9c3dc8d15c36bdc9c0f974b3a577b00cc366d76c5f464ac5db5f4",
|
|
30
|
+
"sourceTag": "fmix-v2.7.7"
|
|
31
31
|
}
|
|
32
32
|
}
|