| Name | Message | Date |
|---|---|---|
| 📄 sync-tracel-lock.awk | 5 hours ago |
📄
scripts/sync-tracel-lock.awk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# Sync the tracel-ai git dependencies (burn, cubecl, cubek, tracel-llvm)
# in this workspace's Cargo.lock to the exact revisions recorded in
# Brush's committed Cargo.lock.
#
# Why: brush-render (a git dependency) requires burn from
# `https://github.com/tracel-ai/burn?branch=main`, and a branch
# requirement resolves to that branch's *current* HEAD on any fresh
# resolution. burn's `main` regularly drifts ahead of Brush and breaks
# its build (it did once during build-order step 1). Cargo honours
# whatever revision the lockfile already pins for a branch, though — the
# same mechanism Brush's own CI relies on — so we keep our lock pinned
# to the burn revisions Brush was actually tested with.
#
# Usage:
# curl -s <brush-url>/Cargo.lock -o /tmp/brush.lock
# awk -f scripts/sync-tracel-lock.awk /tmp/brush.lock Cargo.lock > Cargo.lock.new
# grep -c dd... # sanity: no unwanted HEAD revisions remain
# mv Cargo.lock.new Cargo.lock
#
# Packages present in our lock but absent from Brush's are pruned (they
# are crates that only exist at burn revisions newer than Brush's).
#
# Never run `cargo update -p burn …` blindly — it re-resolves the branch
# to HEAD and undoes this pin.
FNR == NR {
# Pass 1: collect Brush's known-good resolutions by package name.
if ($0 == "[[package]]") { inb = 1; bname = ""; bver = ""; bsrc = ""; next }
if (inb) {
if ($0 ~ /^name = /) { bname = $0 }
if ($0 ~ /^version = /) { bver = $0 }
if ($0 ~ /^source = /) { bsrc = $0 }
if ($0 == "") {
if (bsrc ~ /tracel-ai/ && bname != "") {
map[bname] = bver "\n" bsrc
}
inb = 0
}
}
next
}
# Pass 2: rewrite our lockfile block by block.
{
if ($0 != "[[package]]") { print; next }
n = 1; buf[1] = $0
name = ""; veridx = 0; srcidx = 0
while ((getline line) > 0) {
buf[++n] = line
if (line == "") break
if (line ~ /^name = /) { name = line }
if (line ~ /^version = /) { veridx = n }
if (line ~ /^source = /) { srcidx = n }
}
if (srcidx > 0 && buf[srcidx] ~ /tracel-ai/) {
if (name in map) {
split(map[name], repl, "\n")
buf[veridx] = repl[1]
buf[srcidx] = repl[2]
for (i = 1; i <= n; i++) print buf[i]
}
# else: crate does not exist at Brush's revision — prune the block.
} else {
for (i = 1; i <= n; i++) print buf[i]
}
}