Browse Source

add sha1sums maintenance script + freebsd-arm64 and linux-x86_64 runtime additions

- src/build_sha1sums.tcl: the checksum regeneration script AGENTS.md references (sums git-tracked artifacts per platform folder, reports NEW/SAME/CHANGED)
- freebsd-arm64/tclkit-851-freebsd7-x86_64 (+ new sha1sums.txt)
- linux-x86_64/tclkit-902-Linux64-intel-dyn_basic (sha1sums.txt updated)

Assisted-by: harness=claude; primary-model=claude-fable-5; api-location=anthropic.com
master
Julian Noble 3 weeks ago
parent
commit
31cd264207
  1. 1
      freebsd-arm64/sha1sums.txt
  2. BIN
      freebsd-arm64/tclkit-851-freebsd7-x86_64
  3. 1
      linux-x86_64/sha1sums.txt
  4. BIN
      linux-x86_64/tclkit-902-Linux64-intel-dyn_basic
  5. 114
      src/build_sha1sums.tcl

1
freebsd-arm64/sha1sums.txt

@ -0,0 +1 @@
a08dd02077733a7c0efa733dcfc4990a2e989122 *tclkit-851-freebsd7-x86_64

BIN
freebsd-arm64/tclkit-851-freebsd7-x86_64

Binary file not shown.

1
linux-x86_64/sha1sums.txt

@ -1 +1,2 @@
41c81c8cf4020ea67a4e0238c96f9550bdadd8c3 *tclkit-902-Linux64-intel-dyn
a0c299db0429e799833eb77d7962f410c9a2bfb1 *tclkit-902-Linux64-intel-dyn_basic

BIN
linux-x86_64/tclkit-902-Linux64-intel-dyn_basic

Binary file not shown.

114
src/build_sha1sums.tcl

@ -0,0 +1,114 @@
package require sha1
set srcdir [file dirname [file normalize [info script]]]
set basedir [file dirname $srcdir]
puts stdout "processing using base folder $basedir"
set rootfolders [glob -dir $basedir -types {d} -tail *]
set os_list [list linux macosx win32 freebsd netbsd dragonflybsd]
set known_skip_tails [list src test]
set skip_extensions [list .md .txt]
set original_cwd [pwd]
set R "\x1b\[31m" ;#Red
set G "\x1b\[32m" ;#Green
set Y "\x1b\[33m" ;#Yellow
set C "\x1b\[36m" ;#Cyan
set RST "\x1b\[m" ;#reset
proc do_sha1_in_folder {binaryfolder level} {
global R G Y C RST skip_extensions
set indent [string repeat " " $level]
puts stdout "${indent}${C}[string repeat - 50]$RST"
if {$level == 0} {
puts stdout "${indent}Processing runtime folder $binaryfolder"
} else {
puts stdout "${indent}Processing sub folder $binaryfolder"
}
#temp
if {$level > 0} {
#return
}
set shafile [file join $binaryfolder sha1sums.txt]
set existing_sha_dict [dict create]
if {[file exists $shafile]} {
puts stdout "${indent}Existing sha1sums.txt found"
set fd [open $shafile r]
set existing_sha_data [read $fd]
close $fd
foreach ln [split $existing_sha_data \n] {
set trimln [string trim $ln]
if {$trimln eq ""} {continue}
set first_sp [string first " " $trimln]
set h [string range $trimln 0 $first_sp-1]
set tag [string range $trimln $first_sp+1 end]
# e.g *tclkit where * indicates binary was used
# or possibly a space instead of * (same output as unix 'sha1sum -b <filename>')
dict set existing_sha_dict [string range $tag 1 end] $h
}
} else {
puts stdout "${indent}No current sha1sums.txt file"
}
set candidate_file_tails [glob -nocomplain -dir $binaryfolder -type f -tail *]
cd $binaryfolder
set git_files [exec git ls-files --exclude-standard ":(glob)*"]
set new_sha_dict [dict create]
foreach ftail $candidate_file_tails {
if {[string tolower [file extension $ftail]] in $skip_extensions} {continue}
if {$ftail in $git_files} {
set hash [sha1::sha1 -hex -filename [file join $binaryfolder $ftail]]
dict set new_sha_dict $hash $ftail
} else {
puts stdout "${indent}${R}Skipping $ftail$RST (not in result of 'git ls-files --exclude-standard :(glob)*')"
}
}
set changes 0
dict for {h f} $new_sha_dict {
if {[dict exists $existing_sha_dict $f]} {
if {$h ne [dict get $existing_sha_dict $f]} {
puts -nonewline stdout "${indent}${Y}*UPD*$RST $h $f\n"
incr changes
} else {
puts -nonewline stdout "${indent}SAME $h *$f$RST\n"
}
} else {
puts -nonewline stdout "${indent}${G}*NEW*$RST $h *$f\n"
incr changes
}
}
if {[dict size $existing_sha_dict] != [dict size $new_sha_dict] || $changes > 0} {
puts stderr "${indent}rewriting sha file at $shafile"
set fd [open $shafile w]
dict for {h f} $new_sha_dict {
puts -nonewline $fd "$h *$f\n"
}
close $fd
} else {
puts stderr "${indent}No changes or additions detected"
}
set subfolder_tails [glob -nocomplain -dir $binaryfolder -type d -tail *]
foreach sftail $subfolder_tails {
if {[string match .* $sftail]} {
continue
}
do_sha1_in_folder [file join $binaryfolder $sftail] [expr {$level + 1}]
}
}
set level 0
foreach dirtail $rootfolders {
set level 0
set indent ""
if {$dirtail in $known_skip_tails} {continue}
set firstword [lindex [split $dirtail -] 0]
if {$firstword ni $os_list} {
puts stderr "skipping unrecognised folder: $f"
continue
}
set runtimefolder [file join $basedir $dirtail]
do_sha1_in_folder $runtimefolder 0
}
cd $original_cwd
Loading…
Cancel
Save