210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
|
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
|
-
-
-
-
-
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
|
# no arguments.
#
proc getLookupVarNamePrefix {} {
return ::pkgr_; # TODO: Make non-global?
}
#
# NOTE: This procedure returns a unique suffix for a fully qualified
# variable name that MAY be present in the global namespace.
# It is used (internally) to avoid any name collisions with
# variables and commands in the global namespace. There are
# no arguments.
# NOTE: This procedure returns a name suffix (directory, variable, etc)
# that is unique to the running process at the current point in
# time. It is used (internally) to avoid name collisions with any
# preexisting variables or commands that may be present in the
# global namespace. The paranoia argument represents the relative
# level of paranoia required by the caller; the higher this level,
# the more uniqueness is required.
#
proc getLookupVarNameSuffix {} {
return [appendArgs \
[string trim [pid] -] _ [string trim [clock seconds] -] _ \
[string trim [clock clicks -milliseconds] -]]; # TODO: Bad?
proc getUniqueSuffix { {paranoia 1} } {
set result [string trim [pid] -]
if {$paranoia > 0} then {
append result _ [string trim [clock seconds] -]
}
if {$paranoia > 1} then {
append result _ [string trim \
[clock clicks -milliseconds] -]; # TODO: Bad?
}
return $result
}
#
# NOTE: This procedure returns the list of API keys to use when looking
# up packages via the package repository server. An empty list
# is returned if no API keys are currently configured. There are
# no arguments.
|
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
|
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
|
-
+
-
+
-
+
-
+
-
+
|
if {[isHarpyCertificate $metadata(certificate)]} then {
#
# NOTE: Attempt to create a completely unique array variable name to
# hold the package metadata in this scripting language as well
# as possibly in the other necessary scripting language(s).
#
set newVarName(1) [appendArgs \
[getLookupVarNamePrefix] metadata_ [getLookupVarNameSuffix]]
[getLookupVarNamePrefix] metadata_ [getUniqueSuffix 2]]
set newVarName(2) [appendArgs \
[getLookupVarNamePrefix] cleanup_ [getLookupVarNameSuffix]]
[getLookupVarNamePrefix] cleanup_ [getUniqueSuffix 2]]
set newProcName(1) [appendArgs \
[getLookupVarNamePrefix] eagleHasSecurity_ [getLookupVarNameSuffix]]
[getLookupVarNamePrefix] eagleHasSecurity_ [getUniqueSuffix 2]]
set newProcName(2) [appendArgs \
[getLookupVarNamePrefix] getFileTempName_ [getLookupVarNameSuffix]]
[getLookupVarNamePrefix] getFileTempName_ [getUniqueSuffix 2]]
set newProcName(3) [appendArgs \
[getLookupVarNamePrefix] tclMustBeReady_ [getLookupVarNameSuffix]]
[getLookupVarNamePrefix] tclMustBeReady_ [getUniqueSuffix 2]]
#
# NOTE: Create the Eagle script block that will be used to securely
# evaluate a signed package script. This must be evaluated in
# Eagle because it uses several plugins only available there.
#
set script(outer) [string map [list \
|