-
Notifications
You must be signed in to change notification settings - Fork 0
Shell formatting #115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Shell formatting #115
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -99,7 +99,7 @@ short=$(echo "$commit" | coreutils cut -c1-7) | |
|
|
||
| asset="${stem}-${short}.onnx" | ||
| coreutils mv original.onnx "$asset" | ||
| coreutils sha256sum "$asset" > "${asset}.sha256" | ||
| coreutils sha256sum "$asset" >"${asset}.sha256" | ||
|
|
||
| # Sanity-check the computed SHA256 against HF's recorded LFS oid. | ||
| # The SHA256 we just computed must match HF's recorded LFS oid for the blob; mismatch means the download was | ||
|
|
@@ -123,7 +123,7 @@ cksum_path="{{ config_root }}/config/upstream-cache/data.toml" | |
| mise_path="{{ config_root }}/.mise/config.toml" | ||
|
|
||
| augtool --transform="Toml incl $cksum_path" --autosave <<EOF | ||
| set "/files$cksum_path/table[. = 'asset.\"$asset\"']/entry[. = 'sha256']/string" "$actual" | ||
| set "/files$cksum_path/table[. = 'asset."$asset"']/entry[. = 'sha256']/string" "$actual" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- target file context ---'
sed -n '110,175p;230,255p;380,405p' .mise/config.maint.toml
printf '%s\n' '--- related task definitions and augtool commands ---'
rg -n -C 4 'augtool|cksum_path|asset=|publish|table\[|entry\[|sha256' .mise/config.maint.toml .mise 2>/dev/null || true
printf '%s\n' '--- available validation tools ---'
command -v augtool || true
command -v mise || true
command -v bash || true
command -v python3 || trueRepository: edge-toolkit/core Length of output: 50374 🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- target file context ---'
sed -n '118,170p;238,252p;388,400p' .mise/config.maint.toml
printf '%s\n' '--- augtool commands in target file ---'
rg -n -C 3 'augtool' .mise/config.maint.toml
printf '%s\n' '--- task shell settings and publish flow ---'
rg -n -C 5 'shell =|publish|curl|rclone|augtool|cksum_path' .mise/config.maint.tomlRepository: edge-toolkit/core Length of output: 28767 🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- shell heredoc behavior ---'
asset='face1-abc.onnx'
cksum_path='/repo/config/upstream-cache/data.toml'
actual='0123456789abcdef'
payload=$(
cat <<EOF
set "/files$cksum_path/table[. = 'asset."$asset"']/entry[. = 'sha256']/string" "$actual"
EOF
)
printf 'payload=%s\n' "$payload"
printf 'payload_q=%q\n' "$payload"
case "$payload" in
*"'asset.\"face1-abc.onnx\"'"*) echo 'nested quotes preserved in heredoc input' ;;
*) echo 'nested quotes absent from heredoc input'; exit 1 ;;
esac
printf '%s\n' '--- target manifest table names ---'
rg -n -C 2 '^\[asset\.|^\[tools\."http:(rp-wasm|et-rp)"\]|^\[vars\]' config/upstream-cache/data.toml .mise/config.toml
printf '%s\n' '--- augtool availability ---'
if command -v augtool >/dev/null 2>&1; then
augtool --version 2>&1 | head -n 2
else
echo 'augtool not available'
fiRepository: edge-toolkit/core Length of output: 6505 🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- line 307 context ---'
sed -n '292,318p' .mise/config.maint.toml
printf '%s\n' '--- declarations for utilities used near line 307 ---'
rg -n -C 2 '(^\[tools\]|(^|["= ])(tr|grep|paste|coreutils|rclone|gh|git|augtool)([" =]|$))' .mise/config.maint.toml .mise/config.toml | head -n 240Repository: edge-toolkit/core Length of output: 18735 🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- coreutils and related tool configuration ---'
rg -n -C 3 'coreutils|uutils|grep|paste|augtool|mise which' .mise/config.toml .mise/config.maint.toml .mise/config.windows.tomlRepository: edge-toolkit/core Length of output: 49639 Use mise-managed utilities in the Windows PATH rewrite. Lines 307 and 312 invoke bare 🤖 Prompt for AI Agents |
||
| EOF | ||
|
|
||
| augtool --transform="Toml incl $mise_path" --autosave <<EOF | ||
|
|
@@ -153,14 +153,14 @@ coreutils mkdir -p "$work" | |
| cd "$work" | ||
|
|
||
| rclone copyurl "$src" "$asset" | ||
| coreutils sha256sum "$asset" > "${asset}.sha256" | ||
| coreutils sha256sum "$asset" >"${asset}.sha256" | ||
| actual=$(coreutils cut -c1-64 "${asset}.sha256") | ||
|
|
||
| gh release upload "{{ vars.a_hf_cache_tag }}" --clobber --repo "$GH_REPO" "$asset" "${asset}.sha256" | ||
|
|
||
| cksum_path="{{ config_root }}/config/upstream-cache/data.toml" | ||
| augtool --transform="Toml incl $cksum_path" --autosave <<EOF | ||
| set "/files$cksum_path/table[. = 'asset.\"$asset\"']/entry[. = 'sha256']/string" "$actual" | ||
| set "/files$cksum_path/table[. = 'asset."$asset"']/entry[. = 'sha256']/string" "$actual" | ||
| EOF | ||
|
|
||
| echo "uploaded $asset to {{ vars.a_hf_cache_tag }}" | ||
|
|
@@ -228,7 +228,7 @@ tarball="$RP_WORK/$asset" | |
|
|
||
| pkg_dir="$rp_dir/crates/wasm/pkg" | ||
| tar -C "$pkg_dir" --exclude='package.json' --exclude='README.md' --exclude='.gitignore' -czf "$tarball" . | ||
| coreutils sha256sum "$tarball" > "${tarball}.sha256" | ||
| coreutils sha256sum "$tarball" >"${tarball}.sha256" | ||
| actual=$(coreutils cut -c1-64 "${tarball}.sha256") | ||
|
|
||
| gh release upload "$RP_RELEASE" --clobber --repo "$GH_REPO" "$tarball" "${tarball}.sha256" | ||
|
|
@@ -240,13 +240,13 @@ gh release upload "$RP_RELEASE" --clobber --repo "$GH_REPO" "$tarball" "${tarbal | |
| cksum_path="{{ config_root }}/config/upstream-cache/data.toml" | ||
| mise_path="{{ config_root }}/.mise/config.toml" | ||
| augtool --transform="Toml incl $cksum_path" --autosave <<EOF | ||
| set "/files$cksum_path/table[. = 'asset.\"$asset\"']/entry[. = 'sha256']/string" "$actual" | ||
| set "/files$cksum_path/table[. = 'asset."$asset"']/entry[. = 'sha256']/string" "$actual" | ||
| EOF | ||
| augtool --transform="Toml incl $mise_path" --autosave <<EOF | ||
| set "/files$mise_path/table[. = 'vars']/entry[. = 'a_rp_wasm_short']/string" "$short" | ||
| set "/files$mise_path/table[. = 'vars']/entry[. = 'a_rp_wasm_asset']/string" "$asset" | ||
| set "/files$mise_path/table[. = 'tools.\"http:rp-wasm\"']/entry[. = 'version']/string" "$short" | ||
| set "/files$mise_path/table[. = 'tools.\"http:rp-wasm\"']/entry[. = 'checksum']/string" "sha256:$actual" | ||
| set "/files$mise_path/table[. = 'tools."http:rp-wasm"']/entry[. = 'version']/string" "$short" | ||
| set "/files$mise_path/table[. = 'tools."http:rp-wasm"']/entry[. = 'checksum']/string" "sha256:$actual" | ||
| EOF | ||
|
|
||
| echo "uploaded $asset to $RP_RELEASE (commit $commit)" | ||
|
|
@@ -304,12 +304,12 @@ if [ "${OS:-}" = "Windows_NT" ]; then | |
| # lookup below works regardless of which envs were exported. The conda-m2-gnupg directory is only needed by | ||
| # this repo's own build (NOT rustpython's), so dropping it for the cargo install is safe. PATH on git-bash | ||
| # uses `:` as the separator. | ||
| PATH=$(echo "$PATH" | tr ':' '\n' | grep -v 'conda-m2-gnupg' | paste -sd ':' -) | ||
| PATH=$(echo "$PATH" | tr ':' '\\n' | grep -v 'conda-m2-gnupg' | paste -sd ':' -) | ||
| export PATH | ||
|
Comment on lines
+307
to
308
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win Use repository-managed commands in this mise task. This changed command calls bare As per coding guidelines, “A mise task must never assume a command-line utility happens to exist on the host.” 🤖 Prompt for AI AgentsSource: Coding guidelines |
||
| # Pick the first where.exe match under an MSVC tools dir. | ||
| # where.exe returns every match newline-separated. If none is found we | ||
| # leave the default lookup alone (the PATH strip above is usually enough). | ||
| msvc_link=$(where.exe link.exe 2>/dev/null | tr -d '\r' | grep -iE 'MSVC[\\/].*Hostx64' | head -1 || true) | ||
| msvc_link=$(where.exe link.exe 2>/dev/null | tr -d '\\r' | grep -iE 'MSVC[\\/].*Hostx64' | head -1 || true) | ||
| if [ -n "${msvc_link:-}" ]; then | ||
| export CARGO_TARGET_X86_64_PC_WINDOWS_MSVC_LINKER="$msvc_link" | ||
| fi | ||
|
|
@@ -348,12 +348,15 @@ else | |
| fi | ||
|
|
||
| case "$triple" in | ||
| x86_64-apple-darwin) plat="macos-x64" ;; | ||
| aarch64-apple-darwin) plat="macos-arm64" ;; | ||
| x86_64-unknown-linux-gnu) plat="linux-x64" ;; | ||
| aarch64-unknown-linux-gnu) plat="linux-arm64" ;; | ||
| x86_64-pc-windows-*) plat="windows-x64" ;; | ||
| *) echo "unsupported host triple: $triple" >&2; exit 1 ;; | ||
| x86_64-apple-darwin) plat="macos-x64" ;; | ||
| aarch64-apple-darwin) plat="macos-arm64" ;; | ||
| x86_64-unknown-linux-gnu) plat="linux-x64" ;; | ||
| aarch64-unknown-linux-gnu) plat="linux-arm64" ;; | ||
| x86_64-pc-windows-*) plat="windows-x64" ;; | ||
| *) | ||
| echo "unsupported host triple: $triple" >&2 | ||
| exit 1 | ||
| ;; | ||
| esac | ||
|
|
||
| # Glob the produced binary so the same tar line works on every host. | ||
|
|
@@ -367,7 +370,7 @@ fi | |
| asset="rustpython-${short}-${triple}.tar.gz" | ||
| tarball="$RP_WORK/$asset" | ||
| tar -C "$prefix" -czf "$tarball" "$bin_rel" | ||
| coreutils sha256sum "$tarball" > "${tarball}.sha256" | ||
| coreutils sha256sum "$tarball" >"${tarball}.sha256" | ||
| actual=$(coreutils cut -c1-64 "${tarball}.sha256") | ||
|
|
||
| gh release upload "$RP_RELEASE" --clobber --repo "$GH_REPO" "$tarball" "${tarball}.sha256" | ||
|
|
@@ -387,9 +390,9 @@ if ! command -v augtool >/dev/null 2>&1; then | |
| exit 0 | ||
| fi | ||
| augtool --transform="Toml incl $mise_path" --autosave <<EOF | ||
| set "/files$mise_path/table[. = 'tools.\"http:et-rp\"']/entry[. = 'version']/string" "$short" | ||
| set "/files$mise_path/table[. = 'tools.\"http:et-rp\".platforms.$plat']/entry[. = 'url']/string" "$new_url" | ||
| set "/files$mise_path/table[. = 'tools.\"http:et-rp\".platforms.$plat']/entry[. = 'checksum']/string" "sha256:$actual" | ||
| set "/files$mise_path/table[. = 'tools."http:et-rp"']/entry[. = 'version']/string" "$short" | ||
| set "/files$mise_path/table[. = 'tools."http:et-rp".platforms.$plat']/entry[. = 'url']/string" "$new_url" | ||
| set "/files$mise_path/table[. = 'tools."http:et-rp".platforms.$plat']/entry[. = 'checksum']/string" "sha256:$actual" | ||
| EOF | ||
|
|
||
| echo "updated http:et-rp version + platforms.${plat}.{url,checksum} in .mise/config.toml" | ||
|
|
@@ -463,7 +466,7 @@ if [ ! -f "$shared_venv/bin/pip" ]; then | |
| shared_site="$(coreutils ls -d "$shared_venv"/lib/*/site-packages)" | ||
| coreutils cp -R "$pip_extracted/pip" "$shared_site/" | ||
| coreutils cp -R "$pip_extracted"/pip-*.dist-info "$shared_site/" | ||
| coreutils cat > "$shared_venv/bin/pip" <<'PIP_SHIM' | ||
| coreutils cat >"$shared_venv/bin/pip" <<'PIP_SHIM' | ||
| #!/bin/sh | ||
| exec "$(dirname "$0")/python" -m pip "$@" | ||
| PIP_SHIM | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔒 Security & Privacy | 🟡 Minor | ⚡ Quick win
Set the Homebrew-check command for
binutils.The first
caseassignscmd=""tobinutils, but the secondcaseverifiesas. The later empty-command guard skips the Homebrew path check foras. Setcmd=asforbinutils; otherwise a Homebrew assembler can pass this prerequisite check.Proposed fix
📝 Committable suggestion
🤖 Prompt for AI Agents