@calltelemetry/fmix 2.7.6 → 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 +100 -19
- package/package.json +3 -3
package/bin/fmix
CHANGED
|
@@ -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 ! (
|
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
|
}
|