︙ | | |
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
|
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
|
-
+
+
+
|
#
# NOTE: The code must be the literal string "OK" for the package lookup
# request to be considered successful.
#
return [expr {$code eq "OK"}]
}
proc extractAndVerifyLookupMetadata { result varName } {
proc extractAndVerifyLookupMetadata { result varName caller } {
variable strictUnknownLanguage
#
# NOTE: Grab the language for the package script. It must be an empty
# string, "Tcl", or "Eagle". If it is an empty string, "Eagle"
# will be assumed.
#
set language [getDictionaryValue $result Language]
|
︙ | | |
283
284
285
286
287
288
289
290
291
292
293
294
295
296
|
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
# this client. In that case, just raise an error.
#
set certificate [getDictionaryValue $result Certificate]
if {[string length $certificate] == 0} then {
error "missing script certificate"
}
#
# NOTE: Are we being called from the [package unknown] handler
# in "strict" mode?
#
if {$strictUnknownLanguage && $caller eq "handler"} then {
#
# NOTE: If so, the package script must be targeted at the this
# language; otherwise, there is no way that the package
# will actually be provided to this language.
#
if {[isEagle]} then {
if {$language ne "Eagle"} then {
error "repository package is not for Eagle"
}
} else {
if {$language ne "Tcl"} then {
error "repository package is not for Tcl"
}
}
}
#
# NOTE: If the caller wants the package metadata, use the array variable
# name they specified.
#
if {[string length $varName] > 0} then {
upvar 1 $varName metadata
|
︙ | | |
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
|
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
|
-
+
|
# Eagle does not add a version argument when one is not supplied to
# the [package require] sub-command itself.
#
proc packageUnknownHandler { package {version ""} } {
#
# NOTE: First, run our [package unknown] handler.
#
if {[catch {main $package $version} error(1)] == 0} then {
if {[catch {main $package $version handler} error(1)] == 0} then {
#
# NOTE: The repository [package unknown] handler succeeded, run the
# saved [package unknown] handler.
#
if {[catch {
runSavedPackageUnknownHandler $package $version
} error(2)] == 0} then {
|
︙ | | |
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
|
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
|
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
|
# downloaded package scripts.
#
variable pgpCommand; # DEFAULT: gpg2 --verify {${fileName}}
if {![info exists pgpCommand]} then {
set pgpCommand {gpg2 --verify {${fileName}}}
}
}
proc main { package version } {
#
# NOTE: Verify that the package script matches the current language
# when called from the [package unknown] handler?
#
variable strictUnknownLanguage; # DEFAULT: true
if {![info exists strictUnknownLanguage]} then {
set strictUnknownLanguage true
}
}
proc main { package version caller } {
#
# NOTE: Issue the lookup request to the remote package repository.
#
set data [getLookupData \
[getLookupApiKey] $package [getLookupVersion $version]]
#
|
︙ | | |
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
|
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
|
-
+
|
}
}
#
# NOTE: Process the lookup data into the pieces of metadata that we
# need to load the requested package.
#
extractAndVerifyLookupMetadata $result metadata
extractAndVerifyLookupMetadata $result metadata $caller
#
# NOTE: Attempt to load the requested package using the metadata
# extracted in the previous step.
#
processLookupMetadata metadata
}
|
︙ | | |