@ -187,7 +187,7 @@ namespace eval ::punkboot {
variable foldername [ file tail $scriptfolder ]
variable pkg_requirements [ list ] ; variable pkg_missing [ list ] ; variable pkg_loaded [ list ]
variable help_flags [ list - help - - help / ? - h]
variable known_commands [ list bakehouse packages modules libs bake bakelist vfslibs bin info check shell vendorupdate bootsupport vfscommonupdate projectversion workflow buildsuite tool project vfs]
variable known_commands [ list bakehouse packages modules libs bake bakelist vfslibs bin info check shell vendorupdate libfetch bootsupport vfscommonupdate projectversion workflow buildsuite tool project vfs]
}
@ -2135,6 +2135,10 @@ proc ::punkboot::punkboot_gethelp {args} {
append h " - p r o p a g a t e d e c l a r e d v e n d o r e d p l a t f o r m - l i b r a r y p a c k a g e s i n t o k i t v f s l i b _ t c l < N > t r e e s " \ n
append h " - d e c l a r a t i o n s ( p e r - p a c k a g e p e r - k i t , w i t h s u p e r s e d e d - v e r s i o n r e m o v a l ) l i v e i n s r c / r u n t i m e / v e n d o r l i b _ v f s . t o m l " \ n
append h " - a l s o r u n s a u t o m a t i c a l l y a s a p h a s e o f ' $ s c r i p t n a m e b a k e ' ( a n d t h e r e f o r e o f ' $ s c r i p t n a m e b a k e h o u s e ' ) " \ n \ n
append h " $ s c r i p t n a m e l i b f e t c h ? - s e r v e r u r l < u r l > ? ? - t r u s t - s e r v e r ? ? - f o r c e ? " \ n
append h " - f e t c h d e c l a r e d p u n k b i n l i b - t i e r l i b r a r y a r t i f a c t s ( s r c / r u n t i m e / l i b p a c k a g e s . t o m l ) i n t o b i n / p a c k a g e s / < t a r g e t > " \ n
append h " - s h a 1 - v e r i f i e d a g a i n s t t h e s e r v e r ' s p e r - t a r g e t s h a 1 s u m s . t x t ; m a t e r i a l i z e s p a c k a g e t r e e s u n d e r b i n / p a c k a g e s / < t a r g e t > / t c l < N > " \ n
append h " - c a n o n i c a l o r i g i n t r u s t e d b y d e f a u l t ; o t h e r s e r v e r s ( i n c l . P U N K B I N _ U R L o v e r r i d e s ) r e q u i r e - t r u s t - s e r v e r " \ n \ n
append h " $ s c r i p t n a m e v f s c o m m o n u p d a t e " \ n
append h " - p r o m o t i o n g a t e : u p d a t e t h e s r c / v f s / _ v f s c o m m o n . v f s f r o m c o m p i l e d s r c / m o d u l e s a n d s r c / l i b e t c " \ n
append h " - b e f o r e c a l l i n g t h i s ( f o l l o w e d b y ' $ s c r i p t n a m e b a k e ' ) - y o u c a n t e s t u s i n g ' < b u i l t e x e > ( . e x e ) d e v ' " \ n
@ -2323,6 +2327,26 @@ DIAGRAM 2 - KIT ASSEMBLY DETAIL (the 'make.tcl bake' stage; incl. vfslibs phase)
running shell still holds the old exe [ K5 ]
LIBRARY-ARTIFACT FETCH ( G-139 ; input tier so far - lib_tcl< N> / kit consumption follows)
----------------------------------------------------------------------------
src / runtime/ libpackages.toml which punkbin LIB-TIER artifacts this checkout
consumes ( declared artifact names + targets)
|
| ' make.tcl libfetch' - sha1-verified download of the declared
| < pkg > - < tcl8| tcl9> - r< N> .zip artifacts + .toml sidecars from
| < origin > / lib/ < target> / ( canonical punkbin origin trusted by
| default ; -serverurl / PUNKBIN_URL override needs - trust-server;
| file : / / origins serve local mirrors/ fixtures) , then
| materialization of each verified zip' s package tree
v
bin / packages/ < target> / verified - r< N> zips + toml sidecars ( input tier,
untracked - mirrors bin/ runtime/ < target> )
bin / packages/ < target> / tcl< N> / < pkgfolder> /
materialized installed-shape trees, self-describing
via their embedded punkbin-artifact.toml records
KEY / NOTES
----------------------------------------------------------------------------
[ K1 ] Source modules carry the literal magic version 999999.0 a1.0 in the filename.
@ -2527,6 +2551,7 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO
vfslibs " P r o p a g a t e d e c l a r e d v e n d o r e d p l a t f o r m - l i b r a r y p a c k a g e s i n t o k i t v f s l i b _ t c l < N > t r e e s "
bin " I n s t a l l e x e c u t a b l e s f r o m s r c / b i n i n t o < p r o j e c t d i r > / b i n , t h e n b u i l d k i t s a s f o r b a k e "
vendorupdate " U p d a t e s r c / v e n d o r m o d u l e s b a s e d o n s r c / v e n d o r m o d u l e s / i n c l u d e _ m o d u l e s . c o n f i g "
libfetch " F e t c h d e c l a r e d p u n k b i n l i b - t i e r l i b r a r y a r t i f a c t s i n t o b i n / p a c k a g e s / < t a r g e t > ( s h a 1 - v e r i f i e d ) a n d m a t e r i a l i z e t h e p a c k a g e t r e e s "
bootsupport " P r o m o t i o n g a t e : u p d a t e s r c / b o o t s u p p o r t m o d u l e s f r o m b u i l t p r o j e c t m o d u l e s "
vfscommonupdate " P r o m o t i o n g a t e : r e p l a c e s r c / v f s / _ v f s c o m m o n . v f s m o d u l e s a n d l i b s w i t h t h e p r o j e c t ' s b u i l t s e t "
info " S h o w t h e n a m e a n d b a s e f o l d e r o f t h e p r o j e c t t o b e b u i l t "
@ -2630,6 +2655,24 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO
Also runs automatically as a phase of ' make.tcl bake' ( and therefore
of ' make.tcl bakehouse' ) ; this standalone narrowing serves quick
iteration on the declarations."
libfetch
"
Fetch the punkbin LIB-TIER library artifacts declared in
src / runtime/ libpackages.toml into the untracked input tier
bin / packages/ < target> / - immutable < pkg> - < tcl8| tcl9> - r< N> .zip
artifacts plus their .toml sidecars, each verified against the
server ' s per-target sha1sums.txt - then materialize each verified
zip ' s installed-shape package tree under
bin / packages/ < target> / tcl< N> / ( self-describing via the embedded
punkbin-artifact.toml record; G-138 / G-139) .
Present artifacts that already verify are skipped ( -force
re-downloads ) . The canonical punkbin origin is trusted by
default ; -serverurl ( or env PUNKBIN_URL) overrides it, and any
NON-canonical origin requires the explicit - trust-server flag
( never an interactive prompt - unattended runs stay unattended) .
A file:/ / origin is supported for local mirrors/ fixtures.
Transport for http( s ) : Tcl http+ tls when loadable, else curl,
else PowerShell ( windows ) ."
bin
"
Install executables from src/ bin to < projectdir> / bin, then check vfs
@ -2799,6 +2842,30 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO
( packages - > test - > bootsupport/ vfscommonupdate - > commit - > bake) .
Pass - dirty-abort 0 to build anyway with PROVENANCE-WARNINGs."
}
# l i b f e t c h f r a g m e n t s ( G - 1 3 9 ) : c o n s e n t i s k e y e d t o S E R V E R T R U S T ( t h e G - 1 2 3
# p o s t u r e ) - t h e c a n o n i c a l p u n k b i n o r i g i n n e e d s n o a c k n o w l e d g e m e n t , a n y
# o t h e r o r i g i n n e e d s t h e e x p l i c i t f l a g . N e v e r a n i n t e r a c t i v e p r o m p t .
variable OPT_SERVERURL {
-serverurl - type string - default " " - help\
" A r t i f a c t s e r v e r b a s e u r l o v e r r i d e ( d e f a u l t : t h e c a n o n i c a l p u n k b i n
origin ; env PUNKBIN_URL overrides the default, this flag overrides
both ) . The lib tier is addressed as < serverurl> / lib/ < target> / .
file : / / urls are supported for local mirrors and fixtures.
A NON-canonical origin additionally requires - trust-server."
}
variable OPT_TRUSTSERVER {
-trust-server - type none - default 0 - help\
" A c k n o w l e d g e f e t c h i n g f r o m a N O N - c a n o n i c a l a r t i f a c t s e r v e r
( consent keyed to server trust - the interim G-123/ G-006
mechanism ) . Without this flag, a non-canonical - serverurl or
PUNKBIN_URL aborts before any network access. Fetches from the
canonical origin never require it."
}
variable OPT_FORCE {
-force - type none - default 0 - help\
" R e - d o w n l o a d a n d r e - m a t e r i a l i z e e v e n w h e n a p r e s e n t a r t i f a c t
already verifies against the server sha1sums."
}
# w h i c h s h a r e d o p t i o n f r a g m e n t s e a c h s u b c o m m a n d d e c l a r e s
# ( s h e l l a n d h e l p h a v e b e s p o k e d e f i n i t i o n s b e l o w : s h e l l p a s s e s t r a i l i n g a r g s
# t h r o u g h t o t h e r e p l u n t o u c h e d , h e l p t a k e s a s u b j e c t v a l u e )
@ -2812,6 +2879,7 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO
vfslibs { OPT_DIRTYABORT OPT_CONFIRM}
bin { OPT_FORCEKILL OPT_DIRTYABORT OPT_CONFIRM}
vendorupdate { OPT_CONFIRM }
libfetch { OPT_SERVERURL OPT_TRUSTSERVER OPT_FORCE}
bootsupport { OPT_DIRTYABORT OPT_CONFIRM}
vfscommonupdate { OPT_DIRTYABORT OPT_CONFIRM}
info { OPT_CONFIRM }
@ -2829,6 +2897,9 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO
OPT_DIRTYABORT " ? - d i r t y - a b o r t ? "
OPT_DIRTYABORT_ON " ? - d i r t y - a b o r t 1 | 0 ? "
OPT_CONFIRM " ? - c o n f i r m 0 | 1 ? "
OPT_SERVERURL " ? - s e r v e r u r l < u r l > ? "
OPT_TRUSTSERVER " ? - t r u s t - s e r v e r ? "
OPT_FORCE " ? - f o r c e ? "
}
# p e r - s u b c o m m a n d p o s i t i o n a l v a l u e s ( d e f a u l t : n o n e ) . b a k e ( a n d i t s d e p r e c a t e d
# a l i a s v f s ) a n d b a k e l i s t t a k e o p t i o n a l k i t n a m e s ( G - 1 2 1 s e l e c t i v e b a k e ) .
@ -2940,7 +3011,7 @@ if {[info exists ::env(PUNKBOOT_PLAIN)] && [string is true -strict $::env(PUNKBO
variable SUBGROUPS {
" b u i l d & b a k e " { bakehouse packages modules libs bake vfslibs bin}
" p r o m o t i o n g a t e s " { bootsupport vfscommonupdate}
" s o u r c e m a i n t e n a n c e " { vendorupdate }
" s o u r c e m a i n t e n a n c e " { vendorupdate libfetch }
" b u i l d s u i t e s " { buildsuite }
" v e n d o r e d t o o l s " { tool }
" i n f o r m a t i o n a l " { info check bakelist projectversion workflow help}
@ -2996,6 +3067,9 @@ set help_exitcode 0
set : : punkboot::opt_forcekill 0
set : : punkboot::opt_dirty_abort 0
set : : punkboot::opt_confirm 1
set : : punkboot::opt_serverurl " "
set : : punkboot::opt_trust_server 0
set : : punkboot::opt_force 0
set : : punkboot::opt_kitnames [ list ] ; # G - 1 2 1 : r e q u e s t e d k i t n a m e s f o r b a k e / b a k e l i s t ( e m p t y = a l l c o n f i g u r e d )
if { $::punkboot::punkargs_ok } {
@ -3046,7 +3120,7 @@ if {$::punkboot::punkargs_ok} {
}
set : : punkboot::command $subcommand
set _opts [ dict get $argd opts]
foreach { _optname _var} { -k opt_forcekill - dirty-abort opt_dirty_abort - confirm opt_confirm} {
foreach { _optname _var} { -k opt_forcekill - dirty-abort opt_dirty_abort - confirm opt_confirm - serverurl opt_serverurl - trust-server opt_trust_server - force opt_force } {
if { [ dict exists $_opts $_optname ] } {
set : : punkboot::$_var [ dict get $_opts $_optname ]
}
@ -3083,6 +3157,12 @@ if {$::punkboot::punkargs_ok} {
switch - - $a {
-k { set : : punkboot::opt_forcekill 1 }
-dirty-abort { set : : punkboot::opt_dirty_abort 1 }
-trust-server { set : : punkboot::opt_trust_server 1 }
-force { set : : punkboot::opt_force 1 }
-serverurl {
set : : punkboot::opt_serverurl [ lindex $argsleft 0 ]
set argsleft [ lrange $argsleft 1 end]
}
-confirm {
set v [ lindex $argsleft 0 ]
set argsleft [ lrange $argsleft 1 end]
@ -5121,6 +5201,303 @@ if {$::punkboot::command eq "bootsupport"} {
if { $::punkboot::command eq " l i b f e t c h " } {
# G - 1 3 9 p h a s e 1 : f e t c h t h e p u n k b i n L I B - T I E R a r t i f a c t s d e c l a r e d i n
# s r c / r u n t i m e / l i b p a c k a g e s . t o m l i n t o t h e u n t r a c k e d b i n / p a c k a g e s / < t a r g e t > i n p u t
# t i e r ( m i r r o r i n g b i n / r u n t i m e / < t a r g e t > ) w i t h s h a 1 v e r i f i c a t i o n a g a i n s t t h e
# s e r v e r ' s p e r - t a r g e t s h a 1 s u m s . t x t , t h e n m a t e r i a l i z e e a c h v e r i f i e d z i p ' s
# i n s t a l l e d - s h a p e p a c k a g e t r e e u n d e r b i n / p a c k a g e s / < t a r g e t > / t c l < N > / ( t h e t r e e
# i s s e l f - d e s c r i b i n g v i a i t s e m b e d d e d p u n k b i n - a r t i f a c t . t o m l - t h e G - 1 3 8
# r e c o r d ) . C o n s u m p t i o n i n t o l i b _ t c l < N > / a n d k i t v f s t r e e s i s t h e r e m a i n d e r
# o f G - 1 3 9 - t h i s e n t r y p o i n t o w n s f e t c h + v e r i f y + m a t e r i a l i z e o n l y .
proc : : punkboot::libfetch_transfer { url outfile} {
# o n e u r l - > l o c a l f i l e . f i l e : / / i s s e r v e d n a t i v e l y ( l o c a l m i r r o r s ,
# f i x t u r e s - n o n e t w o r k , n o e x t e r n a l t o o l s ) . h t t p ( s ) t r a n s p o r t s i n
# o r d e r : T c l h t t p ( + t l s f o r h t t p s ) w h e n l o a d a b l e , c u r l ( u b i q u i t o u s ,
# i n c l u d i n g s t o c k w i n d o w s 1 0 + ) , p o w e r s h e l l I n v o k e - W e b R e q u e s t ( w i n d o w s ) .
# R e t u r n s t h e t r a n s p o r t u s e d ; e r r o r s w h e n a l l f a i l .
file mkdir [ file dirname $outfile ]
if { [ string match - nocase " f i l e : / / * " $url ] } {
set path [ string range $url 7 end]
if { [ regexp { ^ / + ( [ A-Za-z ] : / . * ) $ } $path - > winpath] } {
set path $winpath ; # f i l e : / / / C : / x - > C : / x
}
if { ! [ file isfile $path ] } {
error " f i l e o r i g i n h a s n o s u c h f i l e : $ p a t h "
}
file copy - force $path $outfile
return " f i l e - c o p y "
}
set is_https [ string match - nocase " h t t p s : / / * " $url ]
set tcl_http_ok 0
if { ! [ catch { package require http} ] } {
if { ! $is_https } {
set tcl_http_ok 1
} elseif { ! [ catch { package require tls} ] } {
catch { http : : register https 443 [ list : : tls::socket - autoservername true] }
set tcl_http_ok 1
}
}
if { $tcl_http_ok } {
set fd [ open $outfile wb]
set ok 0
if { ! [ catch { http : : geturl $url - channel $fd - binary 1 } tok] } {
if { [ http : : status $tok ] eq " o k " && [ http : : ncode $tok ] == 200 } { set ok 1 }
http : : cleanup $tok
}
close $fd
if { $ok } { return " t c l - h t t p " }
file delete - force $outfile
}
set curl [ auto_execok curl]
if { $curl ne " " } {
if { ! [ catch { exec { * } $curl - - fail - sSL - o $outfile $url 2 > @ 1 } curlerr] } {
return " c u r l "
}
file delete - force $outfile
}
if { $::tcl_platform ( platform ) eq " w i n d o w s " } {
set ps [ auto_execok powershell]
if { $ps ne " " } {
set pscmd " \$ P r o g r e s s P r e f e r e n c e = ' S i l e n t l y C o n t i n u e ' ; I n v o k e - W e b R e q u e s t - U r i ' $ u r l ' - O u t F i l e ' $ o u t f i l e ' - E r r o r A c t i o n S t o p "
if { ! [ catch { exec { * } $ps - NoProfile - NonInteractive - Command $pscmd 2 > @ 1 } pserr] } {
return " p o w e r s h e l l "
}
file delete - force $outfile
}
}
set detail " "
if { [ info exists curlerr] } { set detail " ( c u r l : [ s t r i n g r a n g e $ c u r l e r r 0 2 0 0 ] ) " }
error " a l l t r a n s p o r t s f a i l e d f o r $ u r l $ d e t a i l "
}
set libfetch_config $sourcefolder / runtime/ libpackages.toml
# C a n o n i c a l o r i g i n : t h e p u n k b i n r a w - f i l e b a s e ( t h e p u n k - r u n t i m e . c m d
# c o n v e n t i o n ; l i b t i e r a d d r e s s e d a s < o r i g i n > / l i b / < t a r g e t > / . . . ) .
# S e r v e r - t r u s t c o n s e n t ( G - 1 3 9 , t h e G - 1 2 3 p o s t u r e ) : t h e c a n o n i c a l o r i g i n
# n e v e r g a t e s ; A N Y o t h e r o r i g i n - f l a g o r P U N K B I N _ U R L e n v - r e q u i r e s t h e
# e x p l i c i t - t r u s t - s e r v e r f l a g . N e v e r a n i n t e r a c t i v e p r o m p t : u n a t t e n d e d
# r u n s s t a y u n a t t e n d e d , a n d r e f u s a l h a p p e n s b e f o r e a n y n e t w o r k a c c e s s .
set libfetch_canonical " h t t p s : / / w w w . g i t e a 1 . i n t x . c o m . a u / j n / p u n k b i n / r a w / b r a n c h / m a s t e r "
set libfetch_origin $libfetch_canonical
if { [ info exists : : env( PUNKBIN_URL ) ] && $::env ( PUNKBIN_URL ) ne " " } {
set libfetch_origin $::env ( PUNKBIN_URL )
}
if { $::punkboot::opt_serverurl ne " " } {
set libfetch_origin $::punkboot::opt_serverurl
}
set libfetch_origin [ string trimright $libfetch_origin / ]
if { $libfetch_origin ne $libfetch_canonical && ! $::punkboot::opt_trust_server } {
puts stderr " $ A ( B A D ) L I B F E T C H : o r i g i n ' $ l i b f e t c h _ o r i g i n ' i s n o t t h e c a n o n i c a l p u n k b i n o r i g i n $ A ( R S T ) "
puts stderr " L I B F E T C H : c a n o n i c a l : $ l i b f e t c h _ c a n o n i c a l "
puts stderr " L I B F E T C H : f e t c h i n g f r o m a n o n - c a n o n i c a l s e r v e r r e q u i r e s t h e e x p l i c i t - t r u s t - s e r v e r f l a g ( c o n s e n t k e y e d t o s e r v e r t r u s t - G - 1 3 9 / G - 1 2 3 ) . N o t h i n g w a s f e t c h e d . "
exit 3
}
if { ! [ file exists $libfetch_config ] } {
puts stdout " L I B F E T C H : n o c o n f i g a t $ l i b f e t c h _ c o n f i g - n o t h i n g d e c l a r e d , n o t h i n g t o f e t c h "
} else {
if { [ catch { package require tomlish} tomlish_err] } {
puts stderr " $ A ( B A D ) L I B F E T C H : c a n n o t p r o c e s s $ l i b f e t c h _ c o n f i g - t o m l i s h p a c k a g e u n a v a i l a b l e ( $ t o m l i s h _ e r r ) $ A ( R S T ) "
exit 3
}
if { [ catch { package require sha1} sha1_err] } {
puts stderr " $ A ( B A D ) L I B F E T C H : s h a 1 p a c k a g e u n a v a i l a b l e ( $ s h a 1 _ e r r ) - c a n n o t v e r i f y a r t i f a c t s $ A ( R S T ) "
exit 3
}
if { [ catch { package require punk::zip} punkzip_err] } {
puts stderr " $ A ( B A D ) L I B F E T C H : p u n k : : z i p p a c k a g e u n a v a i l a b l e ( $ p u n k z i p _ e r r ) - c a n n o t m a t e r i a l i z e p a c k a g e t r e e s $ A ( R S T ) "
exit 3
}
set fd [ open $libfetch_config r]
fconfigure $fd - encoding utf-8
set libfetch_tomldata [ read $fd ]
close $fd
if { [ catch { tomlish : : to_dict [ tomlish : : from_toml $libfetch_tomldata ] } libfetch_dict] } {
puts stderr " $ A ( B A D ) L I B F E T C H : f a i l e d t o p a r s e $ l i b f e t c h _ c o n f i g \n $ l i b f e t c h _ d i c t $ A ( R S T ) "
exit 3
}
if { ! [ llength [ info commands : : punkboot::lib::toml_untag] ] } {
# t o m l i s h : : t o _ d i c t v a l u e s a r e t y p e - t a g g e d ( a l s o d e f i n e d b y t h e v f s l i b s
# p h a s e - t h a t b l o c k d o e s n o t r u n f o r t h e l i b f e t c h c o m m a n d )
proc : : punkboot::lib::toml_untag { tagged } {
if { [ dict get $tagged type] eq " A R R A Y " } {
set plain [ list ]
foreach el [ dict get $tagged value] {
lappend plain [ : : punkboot : : lib::toml_untag $el ]
}
return $plain
}
return [ dict get $tagged value]
}
}
set libfetch_artifacts [ dict create]
if { [ dict exists $libfetch_dict artifact] } {
set libfetch_artifacts [ dict get $libfetch_dict artifact]
}
if { ! [ dict size $libfetch_artifacts ] } {
puts stdout " L I B F E T C H : n o \[ a r t i f a c t . < n a m e > \] e n t r i e s f o u n d i n $ l i b f e t c h _ c o n f i g "
}
puts stdout " L I B F E T C H : o r i g i n $ l i b f e t c h _ o r i g i n ( [ d i c t s i z e $ l i b f e t c h _ a r t i f a c t s ] d e c l a r e d a r t i f a c t ( s ) ) "
set libfetch_sums [ dict create] ; # t a r g e t - > d i c t ( f i l e n a m e - > s h a 1 ) f r o m t h e s e r v e r ' s s h a 1 s u m s . t x t
set libfetch_failed 0
set libfetch_actions [ list ]
dict for { aname aentry} $libfetch_artifacts {
foreach reqkey { name target} {
if { ! [ dict exists $aentry $reqkey ] } {
puts stderr " $ A ( B A D ) L I B F E T C H : e n t r y a r t i f a c t . $ a n a m e i n $ l i b f e t c h _ c o n f i g i s m i s s i n g r e q u i r e d k e y ' $ r e q k e y ' $ A ( R S T ) "
exit 3
}
}
set artifact [ punkboot : : lib::toml_untag [ dict get $aentry name] ]
set target [ punkboot : : lib::toml_untag [ dict get $aentry target] ]
if { ! [ regexp { ^ ( . + ) - ( tcl [ 0-9 ] + ) - r( [ 0-9 ] + ) \ .zip$ } $artifact - > pkgfolder generation rev] } {
puts stderr " $ A ( B A D ) L I B F E T C H : a r t i f a c t . $ a n a m e n a m e ' $ a r t i f a c t ' d o e s n o t m a t c h < p k g f o l d e r > - t c l < N > - r < N > . z i p $ A ( R S T ) "
exit 3
}
set tierdir $projectroot / bin/ packages/ $target
file mkdir $tierdir
# s e r v e r t r u t h p e r t a r g e t : l i b / < t a r g e t > / s h a 1 s u m s . t x t ( f e t c h e d o n c e p e r
# r u n p e r t a r g e t ; t h e l o c a l c o p y i n t h e t i e r m i r r o r s t h e p u n k - r u n t i m e
# s t o r e i d i o m )
if { ! [ dict exists $libfetch_sums $target ] } {
set sumsurl " $ l i b f e t c h _ o r i g i n / l i b / $ t a r g e t / s h a 1 s u m s . t x t "
set sumslocal $tierdir / sha1sums.txt
if { [ catch { : : punkboot : : libfetch_transfer $sumsurl $sumslocal } terr] } {
puts stderr " $ A ( B A D ) L I B F E T C H : c a n n o t f e t c h $ s u m s u r l - $ t e r r $ A ( R S T ) "
exit 3
}
set sfd [ open $sumslocal r]
set sumsdata [ read $sfd ]
close $sfd
set sums [ dict create]
foreach ln [ split $sumsdata \ n] {
set ln [ string trim $ln ]
if { $ln eq " " } { continue }
set sp [ string first " " $ln ]
if { $sp < 1 } { continue }
set h [ string range $ln 0 $sp-1 ]
set tag [ string range $ln $sp + 1 end]
dict set sums [ string range $tag 1 end] [ string tolower $h ]
}
dict set libfetch_sums $target $sums
}
set sums [ dict get $libfetch_sums $target ]
if { ! [ dict exists $sums $artifact ] } {
puts stderr " $ A ( B A D ) L I B F E T C H : a r t i f a c t . $ a n a m e : ' $ a r t i f a c t ' i s n o t l i s t e d i n t h e s e r v e r ' s l i b / $ t a r g e t / s h a 1 s u m s . t x t $ A ( R S T ) "
set libfetch_failed 1
continue
}
set want_sha1 [ dict get $sums $artifact ]
set ziplocal $tierdir / $artifact
set have_ok 0
if { [ file isfile $ziplocal ] && ! $::punkboot::opt_force } {
if { [ string tolower [ sha1 : : sha1 - hex - file $ziplocal ] ] eq $want_sha1 } {
set have_ok 1
}
}
if { ! $have_ok } {
set zipurl " $ l i b f e t c h _ o r i g i n / l i b / $ t a r g e t / $ a r t i f a c t "
set partfile $ziplocal.part
if { [ catch { : : punkboot : : libfetch_transfer $zipurl $partfile } terr] } {
puts stderr " $ A ( B A D ) L I B F E T C H : a r t i f a c t . $ a n a m e : f e t c h f a i l e d - $ t e r r $ A ( R S T ) "
set libfetch_failed 1
continue
}
set got_sha1 [ string tolower [ sha1 : : sha1 - hex - file $partfile ] ]
if { $got_sha1 ne $want_sha1 } {
file delete - force $partfile
puts stderr " $ A ( B A D ) L I B F E T C H : a r t i f a c t . $ a n a m e : s h a 1 M I S M A T C H f o r $ a r t i f a c t ( g o t $ g o t _ s h a 1 , s e r v e r s h a 1 s u m s s a y s $ w a n t _ s h a 1 ) - d e l e t e d $ A ( R S T ) "
set libfetch_failed 1
continue
}
file rename - force $partfile $ziplocal
lappend libfetch_actions " f e t c h e d l i b / $ t a r g e t / $ a r t i f a c t "
} else {
lappend libfetch_actions " v e r i f i e d - p r e s e n t l i b / $ t a r g e t / $ a r t i f a c t "
}
# b e s i d e - t o m l s i d e c a r ( a l s o s h a 1 s u m s - l i s t e d b y e m i s s i o n )
set sidecar " [ s t r i n g r a n g e $ a r t i f a c t 0 e n d - 4 ] . t o m l "
set sidecarlocal $tierdir / $sidecar
set sidecar_ok 0
if { [ dict exists $sums $sidecar ] } {
set want_side [ dict get $sums $sidecar ]
if { [ file isfile $sidecarlocal ] && ! $::punkboot::opt_force } {
if { [ string tolower [ sha1 : : sha1 - hex - file $sidecarlocal ] ] eq $want_side } {
set sidecar_ok 1
}
}
if { ! $sidecar_ok } {
if { [ catch { : : punkboot : : libfetch_transfer " $ l i b f e t c h _ o r i g i n / l i b / $ t a r g e t / $ s i d e c a r " $sidecarlocal.part } terr] } {
puts stderr " $ A ( B A D ) L I B F E T C H : a r t i f a c t . $ a n a m e : s i d e c a r f e t c h f a i l e d - $ t e r r $ A ( R S T ) "
set libfetch_failed 1
continue
}
if { [ string tolower [ sha1 : : sha1 - hex - file $sidecarlocal.part ] ] ne $want_side } {
file delete - force $sidecarlocal.part
puts stderr " $ A ( B A D ) L I B F E T C H : a r t i f a c t . $ a n a m e : s i d e c a r s h a 1 M I S M A T C H f o r $ s i d e c a r - d e l e t e d $ A ( R S T ) "
set libfetch_failed 1
continue
}
file rename - force $sidecarlocal.part $sidecarlocal
}
} else {
puts stderr " L I B F E T C H : n o t e - $ s i d e c a r n o t l i s t e d i n s e r v e r s h a 1 s u m s ( a r t i f a c t a c c e p t e d ; s i d e c a r s k i p p e d ) "
}
# m a t e r i a l i z e : i n s t a l l e d - s h a p e t r e e u n d e r < t a r g e t > / t c l < N > / < p k g f o l d e r >
# ( g e n e r a t i o n s u b d i r b e c a u s e b o t h g e n e r a t i o n s i n s t a l l i d e n t i c a l l y - n a m e d
# f o l d e r s ) . F r e s h t r e e p e r m a t e r i a l i z a t i o n ; - m t i m e r e s t o r e s m e m b e r
# m t i m e s s o t h e t r e e m i r r o r s w h a t w a s z i p p e d .
set gendir $tierdir / $generation
file mkdir $gendir
set treedir $gendir / $pkgfolder
if { [ file isdirectory $treedir ] && ! $::punkboot::opt_force } {
# r e - m a t e r i a l i z e o n l y w h e n t h e t r e e ' s e m b e d d e d r e c o r d n o l o n g e r
# m a t c h e s t h i s a r t i f a c t n a m e ( s e l f - d e s c r i b i n g t i e r - G - 1 3 8 )
set embrec $treedir / punkbin-artifact.toml
set tree_current 0
if { [ file isfile $embrec ] } {
set efd [ open $embrec r]
set edata [ read $efd ]
close $efd
if { [ regexp - line " ^ n a m e = \" $ a r t i f a c t \" $ " $edata ] } {
set tree_current 1
}
}
if { $tree_current } {
lappend libfetch_actions " t r e e - c u r r e n t $ t a r g e t / $ g e n e r a t i o n / $ p k g f o l d e r "
continue
}
}
file delete - force $treedir
# d e f a u l t s : w h o l e a r c h i v e , - o v e r w r i t e 1 - m t i m e 1 ( m e m b e r m t i m e s r e s t o r e d )
# - v e r i f y 1 ( p e r - m e m b e r c r c 3 2 ) - a n d a c c e l e r a t o r - e l i g i b l e ( p u n k z i p e x e )
if { [ catch { punk : : zip::unzip $ziplocal $gendir } unzip_err] } {
puts stderr " $ A ( B A D ) L I B F E T C H : a r t i f a c t . $ a n a m e : m a t e r i a l i z a t i o n f a i l e d - $ u n z i p _ e r r $ A ( R S T ) "
file delete - force $treedir
set libfetch_failed 1
continue
}
if { ! [ file isfile $treedir / pkgIndex.tcl] || ! [ file isfile $treedir / punkbin-artifact.toml] } {
puts stderr " $ A ( B A D ) L I B F E T C H : a r t i f a c t . $ a n a m e : m a t e r i a l i z e d t r e e a t $ t r e e d i r l a c k s p k g I n d e x . t c l a n d / o r p u n k b i n - a r t i f a c t . t o m l $ A ( R S T ) "
set libfetch_failed 1
continue
}
lappend libfetch_actions " m a t e r i a l i z e d $ t a r g e t / $ g e n e r a t i o n / $ p k g f o l d e r "
}
foreach act $libfetch_actions {
puts stdout " L I B F E T C H : $ a c t "
}
if { $libfetch_failed } {
puts stderr " $ A ( B A D ) L I B F E T C H : F A I L E D - o n e o r m o r e d e c l a r e d a r t i f a c t s c o u l d n o t b e f e t c h e d / v e r i f i e d / m a t e r i a l i z e d ( s e e a b o v e ) $ A ( R S T ) "
exit 3
}
puts stdout " L I B F E T C H : d o n e ( [ l l e n g t h $ l i b f e t c h _ a c t i o n s ] a c t i o n ( s ) ) - > $ p r o j e c t r o o t / b i n / p a c k a g e s "
}
flush stdout
: : exit 0
}
if { $::punkboot::command ni { bakehouse packages modules libs bake vfslibs bin} } {
puts stderr " C o m m a n d $ : : p u n k b o o t : : c o m m a n d n o t i m p l e m e n t e d - a b o r t i n g . "
flush stderr
@ -5241,6 +5618,36 @@ if {$::punkboot::command in {bakehouse packages libs}} {
if { ! [ llength $vendorlibfolders ] } {
puts stderr " $ A ( B A D ) V E N D O R L I B : N o s r c / v e n d o r l i b o r s r c / v e n d o r l i b _ t c l * f o l d e r f o u n d . $ A ( R S T ) "
}
# G - 1 3 9 : p u n k b i n l i b - t i e r p a c k a g e s f r o m t h e b i n / p a c k a g e s i n p u t t i e r ( p o p u l a t e d
# b y ' m a k e . t c l l i b f e t c h ' ) i n t o t h e d e p l o y e d l i b _ t c l < N > t r e e s - a l l p l a t f o r m s +
# t h i s h o s t ' s p l a t f o r m d i r , m i r r o r i n g t h e v e n d o r l i b _ t c l < N > s h a p e a b o v e . T h e
# m a t e r i a l i z e d t r e e s a r e s e l f - d e s c r i b i n g ( e m b e d d e d p u n k b i n - a r t i f a c t . t o m l
# r e c o r d s - G - 1 3 8 ) a n d t h e r e c o r d s r i d e a l o n g i n t o t h e d e p l o y e d t r e e s , a n d
# f r o m t h e r e i n t o k i t v f s p a y l o a d s v i a t h e v f s l i b s d e c l a r a t i o n s . A n a b s e n t
# t i e r ( o r t a r g e t / g e n e r a t i o n s u b d i r ) i s a s i l e n t p e r - i t e m n o - o p : t h e t i e r i s
# f e t c h - r e g e n e r a b l e a n d o p t i o n a l u n t i l a r t i f a c t s a r e d e c l a r e d a n d f e t c h e d .
set packages_root $projectroot / bin/ packages
if { [ file isdirectory $packages_root ] } {
foreach ptarget [ list allplatforms $this_platform_generic ] {
foreach gendir [ lsort [ glob - nocomplain - dir $packages_root / $ptarget - type d tcl* ] ] {
set which [ file tail $gendir ] ; # t c l 8 | t c l 9 . . .
foreach pkgdir [ lsort [ glob - nocomplain - dir $gendir - type d * ] ] {
set pkgtail [ file tail $pkgdir ]
set target_lib_folder $projectroot / lib_$which / $ptarget
file mkdir $target_lib_folder
puts stdout " P A C K A G E S _ $ w h i c h : c o p y i n g $ p t a r g e t / $ w h i c h / $ p k g t a i l f r o m t h e b i n / p a c k a g e s t i e r t o $ t a r g e t _ l i b _ f o l d e r ( i f s o u r c e f i l e c h a n g e d ) "
set resultdict [ punkcheck : : install $pkgdir $target_lib_folder / $pkgtail \
-createdir 1 \
-overwrite installedsourcechanged-targets\
-progresschannel stdout\
]
puts stdout [ punkcheck : : summarize_install_resultdict $resultdict ]
}
}
}
} else {
puts stdout " P A C K A G E S : n o b i n / p a c k a g e s t i e r a t $ p a c k a g e s _ r o o t ( p o p u l a t e v i a ' m a k e . t c l l i b f e t c h ' ) - s k i p p i n g l i b - t i e r p a c k a g e d e p l o y m e n t "
}
}
if { $::punkboot::command in { bakehouse bake vfslibs} } {
@ -5295,9 +5702,42 @@ if {$::punkboot::command in {bakehouse bake vfslibs}} {
if { [ dict exists $ientry supersedes] } {
set isupersedes [ punkboot : : lib::toml_untag [ dict get $ientry supersedes] ]
}
set source_pkg_folder $sourcefolder / $isource
# s o u r c e _ r o o t ( G - 1 3 9 ) : ' s r c ' ( d e f a u l t - t h e o r i g i n a l v e n d o r l i b
# d e c l a r a t i o n s ) o r ' p a c k a g e s ' - r e s o l v e a g a i n s t t h e u n t r a c k e d
# b i n / p a c k a g e s l i b - t i e r i n p u t ( p o p u l a t e d b y ' m a k e . t c l l i b f e t c h ' ) .
set isource_root " s r c "
if { [ dict exists $ientry source_root] } {
set isource_root [ punkboot : : lib::toml_untag [ dict get $ientry source_root] ]
}
# r e p l a c e ( G - 1 3 9 ) : c l e a n - s l a t e a S A M E - N A M E D e x i s t i n g t a r g e t f o l d e r
# b e f o r e i n s t a l l . s u p e r s e d e s d e l i b e r a t e l y c a n n o t n a m e t h e f o l d e r b e i n g
# i n s t a l l e d ; r e p l a c e c o v e r s s a m e - n a m e r e f r e s h e s w h e r e t h e o l d c o p y m a y
# c a r r y s t r a y s t h e n e w t r e e l a c k s ( e . g . h a n d - d r o p s n e s t i n g m d 5 c / t c l l i b c
# i n s i d e t c l l i b 2 . 0 ) .
set ireplace 0
if { [ dict exists $ientry replace] } {
set ireplace [ punkboot : : lib::toml_untag [ dict get $ientry replace] ]
if { ! [ string is boolean - strict $ireplace ] } {
puts stderr " $ A ( B A D ) V F S L I B S : e n t r y i n s t a l l . $ i n a m e ' r e p l a c e ' m u s t b e b o o l e a n ( g o t ' $ i r e p l a c e ' ) $ A ( R S T ) "
exit 3
}
}
switch - - $isource_root {
src {
set source_pkg_folder $sourcefolder / $isource
set source_missing_hint " "
}
packages {
set source_pkg_folder $projectroot / bin/ packages/ $isource
set source_missing_hint " - p o p u l a t e t h e b i n / p a c k a g e s t i e r f i r s t : ' t c l s h s r c / m a k e . t c l l i b f e t c h ' ( d e c l a r a t i o n s i n s r c / r u n t i m e / l i b p a c k a g e s . t o m l ) "
}
default {
puts stderr " $ A ( B A D ) V F S L I B S : e n t r y i n s t a l l . $ i n a m e h a s u n k n o w n s o u r c e _ r o o t ' $ i s o u r c e _ r o o t ' ( e x p e c t e d s r c | p a c k a g e s ) $ A ( R S T ) "
exit 3
}
}
if { ! [ file isdirectory $source_pkg_folder ] } {
puts stderr " $ A ( B A D ) V F S L I B S : e n t r y i n s t a l l . $ i n a m e s o u r c e ' $ i s o u r c e ' n o t f o u n d a t $ s o u r c e _ p k g _ f o l d e r $ A ( R S T ) "
puts stderr " $ A ( B A D ) V F S L I B S : e n t r y i n s t a l l . $ i n a m e s o u r c e ' $ i s o u r c e ' n o t f o u n d a t $ s o u r c e _ p k g _ f o l d e r $ s o u r c e _ m i s s i n g _ h i n t $ A( R S T ) "
exit 3
}
set pkgtail [ file tail $source_pkg_folder ]
@ -5327,6 +5767,10 @@ if {$::punkboot::command in {bakehouse bake vfslibs}} {
file delete - force $suppath
}
}
if { $ireplace && [ file isdirectory $target_lib_folder / $pkgtail ] } {
puts stdout " V F S L I B S i n s t a l l . $ i n a m e : r e p l a c e = t r u e - r e m o v i n g e x i s t i n g ' $ p k g t a i l ' f r o m v f s / $ t ( c l e a n - s l a t e i n s t a l l ) "
file delete - force $target_lib_folder / $pkgtail
}
puts stdout " V F S L I B S i n s t a l l . $ i n a m e : $ i s o u r c e - > v f s / $ t / $ p k g t a i l ( i f s o u r c e f i l e c h a n g e d ) "
set resultdict [ punkcheck : : install $source_pkg_folder $target_lib_folder / $pkgtail \
-installer make.tcl\
@ -5341,6 +5785,7 @@ if {$::punkboot::command in {bakehouse bake vfslibs}} {
}
}
if { $::punkboot::command in { bakehouse packages libs} } {
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
lappend projectlibfolders lib