@ -2300,15 +2300,24 @@ DIAGRAM 2 - KIT ASSEMBLY DETAIL (the 'make.tcl bake' stage; incl. vfslibs phase)
( gate ) -- > refused: kit listed under FAILED KITS, nothing
( gate ) -- > refused: kit listed under FAILED KITS, nothing
| built , nothing deployed, bin/ < kit> untouched
| built , nothing deployed, bin/ < kit> untouched
|
|
| zip image appended to the runtime exe: tcl::zipfs::mkimg,
| kit icon step ( G-057 ) : < kit> .resources.toml sidecar records
| or ( driving tcl without zipfs, e.g 8.6 ) raw-runtime split
| the icon choice for every target ( default src/ runtime/
| + punk : : zip::mkzip + concatenation - both mount the same
| punkshell.ico ; override = punkshell.ico in the kit' s own .vfs
| folder , pre-merge) ; win32 targets on a twapi-capable host get
| the icon stamped into a per-kit copy of the raw runtime stub
| BEFORE the payload attach ( non-PE target: not applicable;
| incapable host: distinct notice - sidecar written either way)
|
| zip image appended to the ( stamped ) runtime exe: tcl::zipfs::
| mkimg , or ( driving tcl without zipfs, e.g 8.6 ) raw-runtime
| split + punk::zip::mkzip + concatenation - both mount the same
v
v
src / _build/ < kit> .exe
src / _build/ < kit> .exe ( + < kit > .exe.resources.toml)
|
|
| smoke-require probe ( host-runnable kits with declared
| smoke-require probe ( host-runnable kits with declared
| packages ) : plain ' package require' inside the artifact [ K11 ]
| packages ) : plain ' package require' inside the artifact [ K11 ]
| deploy step: delete old bin/ < kit> .exe, copy new one in
| deploy step: delete old bin/ < kit> .exe, copy new one in
| ( the resource sidecar deploys beside the kit)
v
v
bin / < kit> .exe < - - FAILS ( kit listed under FAILED KITS) if a
bin / < kit> .exe < - - FAILS ( kit listed under FAILED KITS) if a
running shell still holds the old exe [ K5 ]
running shell still holds the old exe [ K5 ]
@ -6296,6 +6305,378 @@ proc ::punkboot::assemble_zipcat_image {raw_runtime wrapvfs outfile zipfile} {
return $zipbytes
return $zipbytes
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# G - 0 5 7 k i t i c o n s t e p . E v e r y b u i l t k i t g e t s a < k i t n a m e > . r e s o u r c e s . t o m l s i d e c a r
# r e c o r d i n g t h e b u i l d - t i m e i c o n c h o i c e ( d e f a u l t s r c / r u n t i m e / p u n k s h e l l . i c o ,
# o v e r r i d a b l e b y a r o o t - l e v e l p u n k s h e l l . i c o i n t h e k i t ' s o w n c u s t o m . v f s f o l d e r ,
# c o n s u l t e d P R E - m e r g e s o t h e _ v f s c o m m o n c o p y n e v e r r e a d s a s a n o v e r r i d e ) , a n d
# w i n 3 2 - t a r g e t k i t s g e t t h a t i c o n e m b e d d e d a s P E R T _ I C O N / R T _ G R O U P _ I C O N r e s o u r c e s
# w h e n t h i s h o s t c a n w r i t e t h e m . T h e m e c h a n i s m f o l l o w s t c l - s f e ' s s f e - 0 . 2 . t m
# R e p l a c e I c o n I n S t u b ( t w a p i r e s o u r c e - u p d a t e A P I s ; A s h o k P . N a d k a r n i ) g e n e r a l i z e d
# t o a r b i t r a r y s t u b s : e n u m e r a t e , d e l e t e A L L i c o n / g r o u p e n t r i e s , w r i t e f r e s h -
# i d e m p o t e n t b y c o n s t r u c t i o n . O r d e r i n g i s s t u b - f i r s t : a p e r - k i t c o p y o f t h e
# p a y l o a d - f r e e r a w r u n t i m e p r e f i x i s s t a m p e d B E F O R E a n y p a y l o a d i s a p p e n d e d , s o
# t h e r e s o u r c e r e w r i t e c a n n e v e r c o r r u p t a n o v e r l a y . k i t _ i c o n _ p r o c e s s i s t h e
# s i n g l e i n t e r n a l e n t r y p o i n t - m e c h a n i s m s e l e c t i o n l i v e s i n s i d e i t ( a n d
# k i t _ i c o n _ e m b e d _ t w a p i ) s o a p o r t a b l e s t a m p e r ( G - 1 2 8 ) i s a s u b s t i t u t i o n , n o t a
# c a l l e r r e w r i t e . N o n - P E t a r g e t s s k i p a s N O T A P P L I C A B L E ; a w i n 3 2 t a r g e t o n a n
# i n c a p a b l e h o s t s k i p s w i t h a d i s t i n c t n o t i c e ; b o t h s t i l l w r i t e t h e s i d e c a r .
# D e c i s i o n s a n d s k i p t a x o n o m y : g o a l s G - 0 5 7 d e t a i l f i l e . S i d e c a r f o r m a t d o c :
# b i n / A G E N T S . m d .
# s h a 2 5 6 i s s e l f - c o n t a i n e d ( s a m e a l g o r i t h m a s s r c / a s s e t s / l o g o / m a k e - i c o . t c l a n d
# s c r i p t l i b / d e v e l o p e r / a s s e t o r i g i n _ c h e c k . t c l - e a c h s t a y s s t a n d a l o n e : m a k e . t c l
# m u s t n o t d e p e n d o n s c r i p t l i b , a n d t h i s s t e p m u s t n o t d e p e n d o n b o o t s u p p o r t
# f r e s h n e s s ; b o o t s u p p o r t c a r r i e s o n l y s h a 1 / m d 5 ) . M e m o i z e d p e r p a t h p e r r u n .
namespace eval : : punkboot::kiticon {
variable sha256_cache
if { ! [ info exists sha256_cache] } { set sha256_cache [ dict create] }
variable twapi_state " "
variable K {
0x428a2f98 0x71374491 0xb5c0fbcf 0xe9b5dba5 0x3956c25b 0x59f111f1 0x923f82a4 0xab1c5ed5
0xd807aa98 0x12835b01 0x243185be 0x550c7dc3 0x72be5d74 0x80deb1fe 0x9bdc06a7 0xc19bf174
0xe49b69c1 0xefbe4786 0x0fc19dc6 0x240ca1cc 0x2de92c6f 0x4a7484aa 0x5cb0a9dc 0x76f988da
0x983e5152 0xa831c66d 0xb00327c8 0xbf597fc7 0xc6e00bf3 0xd5a79147 0x06ca6351 0x14292967
0x27b70a85 0x2e1b2138 0x4d2c6dfc 0x53380d13 0x650a7354 0x766a0abb 0x81c2c92e 0x92722c85
0xa2bfe8a1 0xa81a664b 0xc24b8b70 0xc76c51a3 0xd192e819 0xd6990624 0xf40e3585 0x106aa070
0x19a4c116 0x1e376c08 0x2748774c 0x34b0bcb5 0x391c0cb3 0x4ed8aa4a 0x5b9cca4f 0x682e6ff3
0x748f82ee 0x78a5636f 0x84c87814 0x8cc70208 0x90befffa 0xa4506ceb 0xbef9a3f7 0xc67178f2
}
}
proc : : punkboot::kiticon::sha256_data { data } {
variable K
set bitlen [ expr { wide ( [ string length $data ] ) * 8 } ]
append data \ x80
set pad [ expr { ( 56 - [ string length $data ] % 64 + 64 ) % 64 } ]
append data [ string repeat \ x00 $pad ] [ binary format W $bitlen ]
set h0 0x6a09e667 ; set h1 0xbb67ae85 ; set h2 0x3c6ef372 ; set h3 0xa54ff53a
set h4 0x510e527f ; set h5 0x9b05688c ; set h6 0x1f83d9ab ; set h7 0x5be0cd19
set n [ string length $data ]
for { set off 0 } { $off < $n } { incr off 64 } {
binary scan [ string range $data $off [ expr { $off + 63 } ] ] Iu16 w
for { set t 16 } { $t < 64 } { incr t} {
set x [ lindex $w [ expr { $t - 15 } ] ]
set s0 [ expr { ( ( ( $x >> 7 ) | ( $x << 25 ) ) ^ ( ( $x >> 18 ) | ( $x << 14 ) ) ^ ( $x >> 3 ) ) & 0xffffffff } ]
set x [ lindex $w [ expr { $t - 2 } ] ]
set s1 [ expr { ( ( ( $x >> 17 ) | ( $x << 15 ) ) ^ ( ( $x >> 19 ) | ( $x << 13 ) ) ^ ( $x >> 10 ) ) & 0xffffffff } ]
lappend w [ expr { ( [ lindex $w [ expr { $t - 16 } ] ] + $s0 + [ lindex $w [ expr { $t - 7 } ] ] + $s1 ) & 0xffffffff } ]
}
set a $h0 ; set b $h1 ; set c $h2 ; set d $h3
set e $h4 ; set f $h5 ; set g $h6 ; set h $h7
for { set t 0 } { $t < 64 } { incr t} {
set S1 [ expr { ( ( ( $e >> 6 ) | ( $e << 26 ) ) ^ ( ( $e >> 11 ) | ( $e << 21 ) ) ^ ( ( $e >> 25 ) | ( $e << 7 ) ) ) & 0xffffffff } ]
set ch [ expr { ( ( $e & $f ) ^ ( ~ $e & $g ) ) & 0xffffffff } ]
set T1 [ expr { ( $h + $S1 + $ch + [ lindex $K $t ] + [ lindex $w $t ] ) & 0xffffffff } ]
set S0 [ expr { ( ( ( $a >> 2 ) | ( $a << 30 ) ) ^ ( ( $a >> 13 ) | ( $a << 19 ) ) ^ ( ( $a >> 22 ) | ( $a << 10 ) ) ) & 0xffffffff } ]
set maj [ expr { ( $a & $b ) ^ ( $a & $c ) ^ ( $b & $c ) } ]
set T2 [ expr { ( $S0 + $maj ) & 0xffffffff } ]
set h $g ; set g $f ; set f $e ; set e [ expr { ( $d + $T1 ) & 0xffffffff } ]
set d $c ; set c $b ; set b $a ; set a [ expr { ( $T1 + $T2 ) & 0xffffffff } ]
}
set h0 [ expr { ( $h0 + $a ) & 0xffffffff } ] ; set h1 [ expr { ( $h1 + $b ) & 0xffffffff } ]
set h2 [ expr { ( $h2 + $c ) & 0xffffffff } ] ; set h3 [ expr { ( $h3 + $d ) & 0xffffffff } ]
set h4 [ expr { ( $h4 + $e ) & 0xffffffff } ] ; set h5 [ expr { ( $h5 + $f ) & 0xffffffff } ]
set h6 [ expr { ( $h6 + $g ) & 0xffffffff } ] ; set h7 [ expr { ( $h7 + $h ) & 0xffffffff } ]
}
return [ format % 08 x% 08 x% 08 x% 08 x% 08 x% 08 x% 08 x% 08 x $h0 $h1 $h2 $h3 $h4 $h5 $h6 $h7 ]
}
proc : : punkboot::kiticon::sha256_file { path } {
variable sha256_cache
set key [ file normalize $path ]
if { [ dict exists $sha256_cache $key ] } {
return [ dict get $sha256_cache $key ]
}
set f [ open $path rb]
set data [ read $f ]
close $f
set hex [ sha256_data $data ]
dict set sha256_cache $key $hex
return $hex
}
proc : : punkboot::kiticon::toml_escape { s } {
return [ string map { \ \ \ \ \ \ \ " \\ \" } $ s ]
}
# T o l e r a n t s u b s e t r e a d e r f o r t h e c h o s e n i c o n ' s G - 1 3 5 a s s e t o r i g i n s i d e c a r - l i f t s
# s o u r c e / s o u r c e _ h a s h s o t h e k i t r e c o r d r e a c h e s b a c k t o t h e S V G - d e r i v e d m a s t e r .
# M i s s i n g s i d e c a r , u n k n o w n s c h e m a o r m a l f o r m e d c o n t e n t s i m p l y y i e l d s n o
# p r o v e n a n c e f i e l d s ( n e v e r a n e r r o r ) .
proc : : punkboot::kiticon::assetorigin_read { assetpath } {
set sc $assetpath.assetorigin.toml
set out [ dict create]
if { ! [ file isfile $sc ] } {
return $out
}
if { [ catch {
set f [ open $sc rb]
set raw [ read $f ]
close $f
} ] } {
return $out
}
foreach line [ split [ encoding convertfrom utf-8 $raw ] \ n] {
set line [ string trim [ string map [ list \ r { } ] $line ] ]
if { $line eq " " || [ string index $line 0 ] eq " # " } continue
if { [ string index $line 0 ] eq " \[ " } break
set eq [ string first = $line ]
if { $eq < 1 } continue
set key [ string trim [ string range $line 0 [ expr { $eq - 1 } ] ] ]
if { $key ni { schema source source_hash} } continue
set val [ string trim [ string range $line [ expr { $eq + 1 } ] end] ]
if { [ string index $val 0 ] eq " \" " } {
set parsed " "
set ok 0
set len [ string length $val ]
for { set i 1 } { $i < $len } { incr i} {
set chr [ string index $val $i ]
if { $chr eq " \\ " } {
incr i
append parsed [ string index $val $i ]
} elseif { $chr eq " \" " } {
set ok 1
break
} else {
append parsed $chr
}
}
if { ! $ok } continue
set val $parsed
} else {
set cmt [ string first # $val ]
if { $cmt >= 0 } {
set val [ string trim [ string range $val 0 [ expr { $cmt - 1 } ] ] ]
}
}
dict set out $key $val
}
if { ! [ dict exists $out schema] || [ dict get $out schema] ne " 1 " } {
return [ dict create]
}
return $out
}
proc : : punkboot::kiticon::writefile_ifchanged { path content} {
if { [ file exists $path ] } {
set f [ open $path rb]
set existing [ read $f ]
close $f
if { $existing eq $content } {
return unchanged
}
}
set f [ open $path wb]
puts - nonewline $f $content
close $f
return written
}
proc : : punkboot::kiticon::copy_ifchanged { from to} {
if { ! [ file isfile $from ] } {
return absent
}
set f [ open $from rb]
set fromdata [ read $f ]
close $f
if { [ file exists $to ] } {
set f [ open $to rb]
set todata [ read $f ]
close $f
if { $todata eq $fromdata } {
return unchanged
}
}
file copy - force $from $to
return copied
}
# M e m o i z e d o n c e p e r r u n : c a n t h i s h o s t ' s t c l s h w r i t e P E r e s o u r c e s ? R e t u r n s
# { 1 { } } o r { 0 r e a s o n } w i t h t h e r e a s o n d i s t i n g u i s h i n g c r o s s - h o s t f r o m
# t w a p i - u n a v a i l a b l e ( t h e a c c e p t a n c e r e q u i r e s d i s t i n c t n o t i c e s ) .
proc : : punkboot::kiticon::twapi_available { } {
variable twapi_state
if { $twapi_state eq " o k " } {
return [ list 1 { } ]
}
if { $twapi_state ne " " } {
return [ list 0 $twapi_state ]
}
if { [ punkboot : : lib::platform_process_family $::punkboot::host_platform ] ne " w i n d o w s " } {
set twapi_state " c r o s s - h o s t : w i n 3 2 t a r g e t b a k e d o n a $ : : p u n k b o o t : : h o s t _ p l a t f o r m h o s t c a n n o t r u n t h e t w a p i r e s o u r c e A P I s ( p o r t a b l e p o s t - h o c s t a m p i n g i s t h e G - 1 2 8 r e m e d y ) "
return [ list 0 $twapi_state ]
}
if { [ catch { package require twapi_resource} ] && [ catch { package require twapi} ] } {
set twapi_state " t w a p i r e s o u r c e A P I s n o t l o a d a b l e i n t h i s t c l s h ( [ i n f o n a m e o f e x e c u t a b l e ] ) - t h e v e n d o r e d t w a p i u n d e r v e n d o r l i b _ t c l < N > / w i n 3 2 - x 8 6 _ 6 4 s e r v e s n a t i v e w i n d o w s t c l s h b u i l d s "
return [ list 0 $twapi_state ]
}
if { ! [ llength [ info commands : : twapi::begin_resource_update] ] } {
set twapi_state " t w a p i l o a d e d b u t i t s r e s o u r c e - u p d a t e A P I s a r e a b s e n t "
return [ list 0 $twapi_state ]
}
set twapi_state ok
return [ list 1 { } ]
}
# R e p l a c e R T _ I C O N ( t y p e 3 ) a n d R T _ G R O U P _ I C O N ( t y p e 1 4 ) i n t h e P E a t e x e p a t h w i t h
# t h e i m a g e s o f i c o p a t h . F o l l o w s s f e - 0 . 2 . t m R e p l a c e I c o n I n S t u b g e n e r a l i z e d : a l l
# e x i s t i n g i c o n / g r o u p e n t r i e s ( a n y n a m e , a n y l a n g ) a r e d e l e t e d a n d t h e n e w s e t
# w r i t t e n a s i d s 1 . . N u n d e r t h e f i r s t p r e - e x i s t i n g g r o u p ' s n a m e + l a n g ( f a l l b a c k
# n a m e 1 , l a n g 1 0 3 3 ) , i n o n e r e s o u r c e - u p d a t e t r a n s a c t i o n . R a i s e s a n e r r o r o n
# f a i l u r e ( a f t e r - d i s c a r d ) ; r e t u r n s t h e n u m b e r o f i m a g e s e m b e d d e d . T h e f i l e a t
# e x e p a t h m u s t c a r r y N O a p p e n d e d p a y l o a d - a r e s o u r c e u p d a t e r e w r i t e s t h e i m a g e .
proc : : punkboot::kit_icon_embed_twapi { exepath icopath} {
set f [ open $icopath rb]
set icondata [ read $f ]
close $f
binary scan $icondata ttt ico_reserved ico_type ico_count
if { $ico_reserved != 0 || $ico_type != 1 } {
error " $ i c o p a t h i s n o t r e c o g n i s a b l e a s a . i c o f i l e "
}
if { $ico_count == 0 } {
error " n o i m a g e s i n $ i c o p a t h "
}
set old_icons [ list ]
set old_groups [ list ]
set libh [ twapi : : load_library $exepath - datafile]
try {
set resources [ twapi : : extract_resources $libh ]
foreach { restype var} { 3 old_icons 14 old_groups} {
if { [ dict exists $resources $restype ] } {
foreach rname [ dict keys [ dict get $resources $restype ] ] {
foreach rlang [ dict keys [ dict get $resources $restype $rname ] ] {
lappend $var [ list $rname $rlang ]
}
}
}
}
} trap { TWAPI_WIN32 1812 } { } {
# n o r e s o u r c e s e c t i o n a t a l l - n o t h i n g t o e n u m e r a t e
} finally {
twapi : : free_library $libh
}
set group_name 1
set group_lang 1033
if { [ llength $old_groups ] } {
lassign [ lindex $old_groups 0 ] group_name group_lang
}
set update_h [ twapi : : begin_resource_update $exepath ]
try {
foreach entry $old_icons {
lassign $entry rname rlang
twapi : : delete_resource $update_h 3 $rname $rlang
}
foreach entry $old_groups {
lassign $entry rname rlang
twapi : : delete_resource $update_h 14 $rname $rlang
}
set grouphdr [ binary format ttt 0 1 $ico_count ]
for { set i 0 } { $i < $ico_count } { incr i} {
# . i c o I C O N D I R E N T R Y i s 1 6 b y t e s ; G R P I C O N D I R E N T R Y i s 1 4 - t h e t r a i l i n g
# 4 - b y t e i m a g e o f f s e t b e c o m e s a 2 - b y t e i c o n r e s o u r c e i d . R a w w i d t h a n d
# h e i g h t b y t e s a r e c a r r i e d a s - i s ( 0 m e a n s 2 5 6 i n b o t h f o r m a t s ) .
set off [ expr { 6 + 16 * $i } ]
binary scan $icondata " @ $ { o f f } c u c u c u c u t u t u n u n u " w h cc rsv planes bits bytesinres imgoff
set iconid [ expr { $i + 1 } ]
append grouphdr [ binary format " c u c u c u c u t u t u n u t u " $w $h $cc $rsv $planes $bits $bytesinres $iconid ]
twapi : : update_resource $update_h 3 $iconid $group_lang [ string range $icondata $imgoff [ expr { $imgoff + $bytesinres - 1 } ] ]
}
twapi : : update_resource $update_h 14 $group_name $group_lang $grouphdr
} on error { msg ropts} {
catch { twapi : : end_resource_update $update_h - discard}
return - options $ropts $msg
}
twapi : : end_resource_update $update_h
return $ico_count
}
# G - 0 5 7 s i n g l e i n t e r n a l e n t r y p o i n t . D e c i d e s t h e k i t ' s i c o n ( o v e r r i d e : r o o t
# p u n k s h e l l . i c o i n t h e k i t ' s o w n c u s t o m . v f s f o l d e r , p r e - m e r g e ; e l s e t h e p r o j e c t
# d e f a u l t s r c / r u n t i m e / p u n k s h e l l . i c o ) , w r i t e s / r e f r e s h e s t h e k i t ' s
# < k i t n a m e > . r e s o u r c e s . t o m l s i d e c a r i n t h e b u i l d f o l d e r , a n d - w h e n t h e t a r g e t
# h a s P E r e s o u r c e s a n d t h i s h o s t c a n w r i t e t h e m - s t a m p s a p e r - k i t c o p y o f t h e
# p a y l o a d - f r e e r a w r u n t i m e p r e f i x . R e t u r n s { w r a p _ r u n t i m e s i d e c a r p a t h } :
# w r a p _ r u n t i m e i s t h e r u n t i m e p r e f i x t h e a s s e m b l y s t e p m u s t c o n s u m e ( t h e s t a m p e d
# c o p y w h e n e m b e d d i n g h a p p e n e d , t h e u n t o u c h e d r a w p r e f i x o t h e r w i s e ) .
proc : : punkboot::kit_icon_process { targetkit rt_target rtname kit_type sourcefolder vfstail raw_runtime buildfolder} {
set repo_root [ file dirname $sourcefolder ]
set override_icon $sourcefolder / vfs/ $vfstail / punkshell.ico
if { [ file isfile $override_icon ] } {
set icon_origin override
set icon_path $override_icon
} else {
set icon_origin default
set icon_path $sourcefolder / runtime/ punkshell.ico
}
set have_icon [ file isfile $icon_path ]
set embedding none
set status " "
set reason " "
if { ! [ string match " w i n 3 2 - * " $rt_target ] } {
set status not-applicable
set reason " t a r g e t $ r t _ t a r g e t h a s n o P E r e s o u r c e s "
} elseif { $rtname eq " - " } {
set status not-applicable
set reason " r u n t i m e l e s s . k i t a r t i f a c t h a s n o P E c o n t a i n e r "
} elseif { $kit_type in { cookit cookfs} } {
set status unavailable
set reason " k i t t y p e $ k i t _ t y p e e d i t s t h e p a y l o a d i n p l a c e i n s i d e t h e m o u n t e d r u n t i m e - n o p a y l o a d - f r e e s t u b m o m e n t t o s t a m p "
} elseif { ! $have_icon } {
set status unavailable
set reason " i c o n f i l e n o t f o u n d a t $ i c o n _ p a t h "
} elseif { $raw_runtime in { { } - } || ! [ file isfile $raw_runtime ] } {
set status unavailable
set reason " e x t r a c t i o n p r o d u c e d n o r a w r u n t i m e p r e f i x t o s t a m p "
} else {
lassign [ : : punkboot : : kiticon::twapi_available] twapi_ok twapi_reason
if { ! $twapi_ok } {
set status unavailable
set reason $twapi_reason
}
}
set wrap_runtime $raw_runtime
if { $status eq " " } {
set stamped $buildfolder / iconed_$targetkit
file copy - force $raw_runtime $stamped
catch { exec chmod + w $stamped }
if { [ catch { : : punkboot : : kit_icon_embed_twapi $stamped $icon_path } embed_result] } {
: : punkboot : : print_build_warnings [ list " k i t i c o n e m b e d d i n g F A I L E D f o r $ t a r g e t k i t ( $ i c o n _ o r i g i n i c o n $ i c o n _ p a t h ) : $ e m b e d _ r e s u l t - k i t k e e p s i t s r u n t i m e ' s o w n i c o n " ]
set embedding twapi
set status failed
set reason $embed_result
catch { file delete $stamped }
} else {
set embedding twapi
set status embedded
set wrap_runtime $stamped
puts stdout " k i t i c o n ( G - 0 5 7 ) : e m b e d d e d $ i c o n _ o r i g i n i c o n i n t o $ t a r g e t k i t s t u b v i a t w a p i ( $ e m b e d _ r e s u l t i m a g e s f r o m [ f i l e t a i l $ i c o n _ p a t h ] ) "
}
} elseif { $status eq " n o t - a p p l i c a b l e " } {
puts stdout " k i t i c o n ( G - 0 5 7 ) : e m b e d d i n g N O T A P P L I C A B L E f o r $ t a r g e t k i t - $ r e a s o n ( s i d e c a r s t i l l w r i t t e n ) "
} else {
puts stdout " k i t i c o n ( G - 0 5 7 ) : e m b e d d i n g U N A V A I L A B L E f o r $ t a r g e t k i t - $ r e a s o n ( s i d e c a r s t i l l w r i t t e n ) "
}
set esc : : punkboot::kiticon::toml_escape
set lines [ list ]
lappend lines " # k i t r e s o u r c e r e c o r d ( s c h e m a 1 ) f o r t h e k i t a r t i f a c t n a m e d b y t h i s f i l e "
lappend lines " # w i t h t h e . r e s o u r c e s . t o m l s u f f i x s t r i p p e d . E m i t t e d b y t h e m a k e . t c l b a k e "
lappend lines " # i c o n s t e p ( G - 0 5 7 ) . O p t i o n a l a n d a d v i s o r y ; f o r m a t : b i n / A G E N T S . m d . "
lappend lines " s c h e m a = 1 "
lappend lines " k i t = \" [ $ e s c $ t a r g e t k i t ] \" "
lappend lines " t a r g e t = \" [ $ e s c $ r t _ t a r g e t ] \" "
lappend lines " k i t _ t y p e = \" [ $ e s c $ k i t _ t y p e ] \" "
lappend lines " i c o n _ o r i g i n = \" $ i c o n _ o r i g i n \" "
lappend lines " i c o n _ s o u r c e = \" [ $ e s c [ p u n k c h e c k : : l i b : : p a t h _ r e l a t i v e $ r e p o _ r o o t $ i c o n _ p a t h ] ] \" "
if { $have_icon } {
lappend lines " i c o n _ h a s h = \" s h a 2 5 6 : [ : : p u n k b o o t : : k i t i c o n : : s h a 2 5 6 _ f i l e $ i c o n _ p a t h ] \" "
set ao [ : : punkboot : : kiticon::assetorigin_read $icon_path ]
if { [ dict exists $ao source] } {
lappend lines " i c o n _ p r o v e n a n c e _ s o u r c e = \" [ $ e s c [ d i c t g e t $ a o s o u r c e ] ] \" "
}
if { [ dict exists $ao source_hash] } {
lappend lines " i c o n _ p r o v e n a n c e _ s o u r c e _ h a s h = \" [ $ e s c [ d i c t g e t $ a o s o u r c e _ h a s h ] ] \" "
}
}
lappend lines " e m b e d d i n g = \" $ e m b e d d i n g \" "
lappend lines " e m b e d d i n g _ s t a t u s = \" $ s t a t u s \" "
lappend lines " e m b e d d i n g _ r e a s o n = \" [ $ e s c $ r e a s o n ] \" "
set sidecar $buildfolder / $targetkit.resources.toml
: : punkboot : : kiticon::writefile_ifchanged $sidecar " [ j o i n $ l i n e s \n ] \n "
return [ list $wrap_runtime $sidecar ]
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
set startdir [ pwd ]
set startdir [ pwd ]
puts stdout " F o u n d [ l l e n g t h $ v f s _ t a i l s ] . v f s f o l d e r s - c h e c k i n g e a c h f o r e x e c u t a b l e s t h a t m a y n e e d t o b e b u i l t "
puts stdout " F o u n d [ l l e n g t h $ v f s _ t a i l s ] . v f s f o l d e r s - c h e c k i n g e a c h f o r e x e c u t a b l e s t h a t m a y n e e d t o b e b u i l t "
cd [ file dirname $buildfolder ]
cd [ file dirname $buildfolder ]
@ -6461,6 +6842,11 @@ foreach vfstail $vfs_tails {
$vfs_event targetset_addsource $sourcefolder / vfs/ _config ; # s o m e f i l e s l i n k e d v i a f a u x l i n k - n e e d t o d e t e c t c h a n g e
$vfs_event targetset_addsource $sourcefolder / vfs/ _config ; # s o m e f i l e s l i n k e d v i a f a u x l i n k - n e e d t o d e t e c t c h a n g e
$vfs_event targetset_addsource $sourcefolder / vfs/ _vfscommon.vfs
$vfs_event targetset_addsource $sourcefolder / vfs/ _vfscommon.vfs
$vfs_event targetset_addsource $sourcefolder / vfs/ $vfstail
$vfs_event targetset_addsource $sourcefolder / vfs/ $vfstail
if { [ file isfile $sourcefolder / runtime/ punkshell.ico] } {
# G - 0 5 7 : t h e d e f a u l t k i t i c o n i s a b u i l d i n p u t - a c h a n g e d i c o n r e b u i l d s
# k i t s ( a n o v e r r i d e i c o n l i v e s i n s i d e t h e . v f s f o l d e r , a l r e a d y a s o u r c e )
$vfs_event targetset_addsource $sourcefolder / runtime/ punkshell.ico
}
if { $rtname ne " - " } {
if { $rtname ne " - " } {
set building_runtime $buildfolder / build_$runtime_fullname ; # w o r k i n g c o p y o f r u n t i m e e x e c u t a b l e - ( p o s s i b l y w i t h k i t / z i p f s / c o o k f s e t c a t t a c h e d ! )
set building_runtime $buildfolder / build_$runtime_fullname ; # w o r k i n g c o p y o f r u n t i m e e x e c u t a b l e - ( p o s s i b l y w i t h k i t / z i p f s / c o o k f s e t c a t t a c h e d ! )
$vfs_event targetset_addsource $building_runtime
$vfs_event targetset_addsource $building_runtime
@ -6857,6 +7243,13 @@ foreach vfstail $vfs_tails {
continue
continue
}
}
# G - 0 5 7 k i t i c o n s t e p : s i d e c a r f o r e v e r y k i t ; P E i c o n e m b e d d i n g w h e r e
# t h e t a r g e t h a s P E r e s o u r c e s a n d t h i s h o s t c a n w r i t e t h e m . S t u b - f i r s t :
# t h e a s s e m b l e r s b e l o w c o n s u m e w r a p _ r u n t i m e - t h e s t a m p e d p e r - k i t c o p y
# o f t h e p a y l o a d - f r e e r a w p r e f i x w h e n e m b e d d i n g h a p p e n e d , t h e u n t o u c h e d
# r a w p r e f i x o t h e r w i s e . R u n t i m e s t o r e o r i g i n a l s a r e n e v e r m o d i f i e d .
lassign [ : : punkboot : : kit_icon_process $targetkit $rt_target $rtname $target_kit_type $sourcefolder $vfstail $raw_runtime $buildfolder ] wrap_runtime kiticon_sidecar
set wrapvfs $targetvfs
set wrapvfs $targetvfs
switch - - $target_kit_type {
switch - - $target_kit_type {
zip {
zip {
@ -6886,14 +7279,14 @@ foreach vfstail $vfs_tails {
}
}
if { [ info commands : : tcl::zipfs::mkimg] ne " " } {
if { [ info commands : : tcl::zipfs::mkimg] ne " " } {
# n o t e - a s a t 2 0 2 4 - 0 8 - t h e r e i s s o m e d i s c u s s i o n a b o u t t h e i n t e r f a c e t o m k i m g - i t i s c o n s i d e r e d u n s t a b l e ( m a y c h a n g e t o - o p t i o n v a l u e s y n t a x )
# n o t e - a s a t 2 0 2 4 - 0 8 - t h e r e i s s o m e d i s c u s s i o n a b o u t t h e i n t e r f a c e t o m k i m g - i t i s c o n s i d e r e d u n s t a b l e ( m a y c h a n g e t o - o p t i o n v a l u e s y n t a x )
puts stderr " c a l l i n g : t c l : : z i p f s : : m k i m g $ b u i l d f o l d e r / $ v f s n a m e . n e w $ w r a p v f s $ w r a p v f s \" \" $ r a w _ r u n t i m e "
puts stderr " c a l l i n g : t c l : : z i p f s : : m k i m g $ b u i l d f o l d e r / $ v f s n a m e . n e w $ w r a p v f s $ w r a p v f s \" \" $ w ra p _ r u n t i m e "
tcl : : zipfs::mkimg $buildfolder / $vfsname.new $wrapvfs $wrapvfs " " $raw _runtime
tcl : : zipfs::mkimg $buildfolder / $vfsname.new $wrapvfs $wrapvfs " " $wrap _runtime
} else {
} else {
# G - 1 2 2 : t h e d r i v i n g t c l h a s n o z i p f s ( 8 . 6 ) - a s s e m b l e t h e s a m e
# G - 1 2 2 : t h e d r i v i n g t c l h a s n o z i p f s ( 8 . 6 ) - a s s e m b l e t h e s a m e
# k i n d o f i m a g e b y c o n c a t e n a t i o n . T h e r e s u l t m o u n t s o n a n y
# k i n d o f i m a g e b y c o n c a t e n a t i o n . T h e r e s u l t m o u n t s o n a n y
# z i p f s - c a p a b l e r u n t i m e ( a r c h i v e - s t a r t - r e l a t i v e o f f s e t s ) .
# z i p f s - c a p a b l e r u n t i m e ( a r c h i v e - s t a r t - r e l a t i v e o f f s e t s ) .
puts stderr " W A R N I N G : t c l s h e l l ' [ i n f o n a m e o f e x e c u t a b l e ] ' h a s n o z i p f s - a s s e m b l i n g z i p k i t $ t a r g e t k i t b y c o n c a t e n a t i o n ( r a w r u n t i m e + m k z i p ) "
puts stderr " W A R N I N G : t c l s h e l l ' [ i n f o n a m e o f e x e c u t a b l e ] ' h a s n o z i p f s - a s s e m b l i n g z i p k i t $ t a r g e t k i t b y c o n c a t e n a t i o n ( r a w r u n t i m e + m k z i p ) "
: : punkboot : : assemble_zipcat_image $raw _runtime $wrapvfs $buildfolder / $vfsname.new $buildfolder / $vfsname.zip
: : punkboot : : assemble_zipcat_image $wrap _runtime $wrapvfs $buildfolder / $vfsname.new $buildfolder / $vfsname.zip
}
}
} result ] } {
} result ] } {
set failmsg " z i p f s m k i m g f a i l e d w i t h m s g : $ r e s u l t "
set failmsg " z i p f s m k i m g f a i l e d w i t h m s g : $ r e s u l t "
@ -6930,7 +7323,7 @@ foreach vfstail $vfs_tails {
}
}
# ' a r c h i v e ' b a s e d z i p o f f s e t s - e d i t a b l e i n 7 z , p e a z i p
# ' a r c h i v e ' b a s e d z i p o f f s e t s - e d i t a b l e i n 7 z , p e a z i p
: : punkboot : : assemble_zipcat_image $raw _runtime $wrapvfs $buildfolder / $vfsname.new $buildfolder / $vfsname.zip
: : punkboot : : assemble_zipcat_image $wrap _runtime $wrapvfs $buildfolder / $vfsname.new $buildfolder / $vfsname.zip
} result ] } {
} result ] } {
set failmsg " c r e a t i n g z i p c a t i m a g e f a i l e d w i t h m s g : $ r e s u l t "
set failmsg " c r e a t i n g z i p c a t i m a g e f a i l e d w i t h m s g : $ r e s u l t "
puts stderr " c r e a t i n g i m a g e ( z i p c a t ) $ t a r g e t k i t f a i l e d "
puts stderr " c r e a t i n g i m a g e ( z i p c a t ) $ t a r g e t k i t f a i l e d "
@ -7005,13 +7398,13 @@ foreach vfstail $vfs_tails {
cd [ file dirname $building_runtime ] ; # m a k e s u r e S D X i s c a l l e d w i t h t h e s a m e w o r k i n g d i r a s t h e f i l e s w e ' r e w o r k i n g o n .
cd [ file dirname $building_runtime ] ; # m a k e s u r e S D X i s c a l l e d w i t h t h e s a m e w o r k i n g d i r a s t h e f i l e s w e ' r e w o r k i n g o n .
if { [ catch {
if { [ catch {
if { $rtname ne " - " } {
if { $rtname ne " - " } {
exec { * } $::sdxpath wrap $buildfolder / $vfsname.new - vfs $wrapvfs - runtime $raw _runtime { * } $verbose
exec { * } $::sdxpath wrap $buildfolder / $vfsname.new - vfs $wrapvfs - runtime $wrap _runtime { * } $verbose
} else {
} else {
exec { * } $::sdxpath wrap $buildfolder / $vfsname.new - vfs $wrapvfs { * } $verbose
exec { * } $::sdxpath wrap $buildfolder / $vfsname.new - vfs $wrapvfs { * } $verbose
}
}
} result ] } {
} result ] } {
if { $rtname ne " - " } {
if { $rtname ne " - " } {
set sdxmsg " $ : : s d x p a t h w r a p $ b u i l d f o l d e r / $ v f s n a m e . n e w - v f s $ w r a p v f s - r u n t i m e $ r a w _ r u n t i m e { * } $ v e r b o s e f a i l e d w i t h m s g : $ r e s u l t "
set sdxmsg " $ : : s d x p a t h w r a p $ b u i l d f o l d e r / $ v f s n a m e . n e w - v f s $ w r a p v f s - r u n t i m e $ w ra p _ r u n t i m e { * } $ v e r b o s e f a i l e d w i t h m s g : $ r e s u l t "
} else {
} else {
set sdxmsg " $ : : s d x p a t h w r a p $ b u i l d f o l d e r / $ v f s n a m e . n e w - v f s $ w r a p v f s { * } $ v e r b o s e f a i l e d w i t h m s g : $ r e s u l t "
set sdxmsg " $ : : s d x p a t h w r a p $ b u i l d f o l d e r / $ v f s n a m e . n e w - v f s $ w r a p v f s { * } $ v e r b o s e f a i l e d w i t h m s g : $ r e s u l t "
}
}
@ -7249,6 +7642,10 @@ foreach vfstail $vfs_tails {
puts stdout " $ d e p l o y m e n t _ f o l d e r / $ t a r g e t k i t "
puts stdout " $ d e p l o y m e n t _ f o l d e r / $ t a r g e t k i t "
after 300
after 300
file copy $buildfolder / $targetkit $deployment_folder / $targetkit
file copy $buildfolder / $targetkit $deployment_folder / $targetkit
# G - 0 5 7 : t h e k i t r e s o u r c e s i d e c a r s h i p s w i t h t h e k i t
if { [ file isfile $buildfolder / $targetkit.resources.toml ] } {
file copy - force $buildfolder / $targetkit.resources.toml $deployment_folder / $targetkit.resources.toml
}
lappend installed_kits $targetkit
lappend installed_kits $targetkit
# - - - - - - - - - - - -
# - - - - - - - - - - - -
$bin_event targetset_end OK
$bin_event targetset_end OK
@ -7257,6 +7654,12 @@ foreach vfstail $vfs_tails {
set skipped_kit_install 1
set skipped_kit_install 1
puts stderr " . "
puts stderr " . "
puts stdout " S k i p p i n g k i t i n s t a l l f o r $ t a r g e t k i t w i t h v f s $ v f s t a i l r u n t i m e $ r t n a m e - n o c h a n g e d e t e c t e d "
puts stdout " S k i p p i n g k i t i n s t a l l f o r $ t a r g e t k i t w i t h v f s $ v f s t a i l r u n t i m e $ r t n a m e - n o c h a n g e d e t e c t e d "
# G - 0 5 7 : k e e p t h e d e p l o y e d r e s o u r c e s i d e c a r c u r r e n t e v e n w h e n t h e k i t
# i t s e l f i s u n c h a n g e d ( t h e r e c o r d c a n b e n e w e r t h a n t h e k i t r e b u i l d -
# e . g t h e s i d e c a r f e a t u r e a r r i v i n g , o r a h o s t - c a p a b i l i t y c h a n g e )
if { [ : : punkboot : : kiticon::copy_ifchanged $buildfolder / $targetkit.resources.toml $deployment_folder / $targetkit.resources.toml ] eq " c o p i e d " } {
puts stdout " k i t i c o n ( G - 0 5 7 ) : r e f r e s h e d d e p l o y e d s i d e c a r $ d e p l o y m e n t _ f o l d e r / $ t a r g e t k i t . r e s o u r c e s . t o m l "
}
lappend skipped_kit_installs [ list kit $targetkit reason " n o c h a n g e d e t e c t e d " ]
lappend skipped_kit_installs [ list kit $targetkit reason " n o c h a n g e d e t e c t e d " ]
$bin_event targetset_end SKIPPED
$bin_event targetset_end SKIPPED
}
}