Overview
Comment: | Remove hacks for TIP #268 and attempt to actually support it instead. Require the package patch level to be received from the server. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
f68d914acaeb911806e735a75558568e |
User & Date: | mistachkin on 2016-08-19 00:11:33 |
Other Links: | manifest | tags |
Context
2016-08-19
| ||
01:20 | For the AES Tcl package, use PGP signatures. check-in: 96c1cb0da8 user: mistachkin tags: trunk | |
00:11 | Remove hacks for TIP #268 and attempt to actually support it instead. Require the package patch level to be received from the server. check-in: f68d914aca user: mistachkin tags: trunk | |
2016-08-17
| ||
23:15 | Slight fix to 'after' cleanup handling. check-in: 7960da64e8 user: mistachkin tags: trunk | |
Changes
Modified client/pkgr.eagle from [c0be15c7c6] to [637e610e45].
︙ | ︙ | |||
30 31 32 33 34 35 36 | package require Eagle.Library # # NOTE: This procedure returns a formatted, possibly version-specific, # package name, for use in logging. # proc formatPackageName { package version } { | | < | 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | package require Eagle.Library # # NOTE: This procedure returns a formatted, possibly version-specific, # package name, for use in logging. # proc formatPackageName { package version } { return [string trim [appendArgs $package " " $version]] } # # NOTE: This procedure returns a formatted script result. If the string # result is empty, only the return code is used. The code argument # must be an integer Tcl return code (e.g. from [catch]) and the # result argument is the script result or error message. |
︙ | ︙ | |||
308 309 310 311 312 313 314 | # # NOTE: This procedure accepts a package requirement (spec) and returns # a simple package version, if possible. An empty string will be # returned, if appropriate (i.e. any version should be allowed). # The requirement argument must be a package specification that # conforms to TIP #268. # | | > > | | | | | | | | | | | 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 | # # NOTE: This procedure accepts a package requirement (spec) and returns # a simple package version, if possible. An empty string will be # returned, if appropriate (i.e. any version should be allowed). # The requirement argument must be a package specification that # conforms to TIP #268. # proc packageRequirementToVersion { requirement } { set result $requirement if {[set index [string first - $result]] != -1} then { incr index -1; set result [string range $result 0 $index] } if {[set index [string first a $result]] != -1 || \ [set index [string first b $result]] != -1} then { incr index -1; set result [string range $result 0 $index] } if {$result eq "0"} then { set result "" } elseif {[regexp -- {^\d+$} $result]} then { append result .0 } return $result } # # NOTE: This procedure issues an HTTP request that should return metadata # that can be used to load and/or provide the specified package. # The apiKey argument is the API key to use -OR- an empty string if # a public package is being looked up. The package argument is the |
︙ | ︙ | |||
410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 | # # NOTE: The code must be the literal string "OK" for the package lookup # request to be considered successful. # return [expr {$code eq "OK"}] } # # NOTE: This procedure attempts to extract the package lookup metadata from # the lookup result. The result argument is the lookup result. The # varName argument is the name of an array variable, in the call frame # of the immediate caller, that should receive the extracted package # lookup metadata. The caller argument must be an empty string -OR- # the literal string "handler". # 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] | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 | # # NOTE: The code must be the literal string "OK" for the package lookup # request to be considered successful. # return [expr {$code eq "OK"}] } # # NOTE: This procedure was stolen from the "common.tcl" script used by the # package repository server. It has been modified to support both # native Tcl and Eagle. It should be noted here that TIP #268 syntax # is not supported by Eagle. For native Tcl, the requirement argument # must be a package version or requirement conforming to the TIP #268 # syntax. For Eagle, the requirement argument must be a simple dotted # package version, with up to four components, without any 'a' or 'b'. # The emptyOk argument should be non-zero if an empty string should be # considered to be valid by the caller. The rangeOk argument should # be non-zero if the version range syntax is allowed; this argument is # ignored for Eagle because it requires TIP #268 support. # proc isValidPackageRequirement { requirement rangeOk {emptyOk false} } { if {$emptyOk && [string length $requirement] == 0} then { return true } if {[isEagle]} then { # # NOTE: Eagle does not support TIP #268. Use the built-in sub-command # that checks a version number. # return [string is version -strict $requirement] } else { # # HACK: If a version range is not allowed, make sure that the dash # character is not present. # if {!$rangeOk && [string first - $requirement] != -1} then { return false } # # HACK: There is no direct way to check if a package requirement # that uses the TIP #268 syntax is valid; however, we can # purposely "misuse" the [package present] command for this # purpose. We know the "Tcl" package is always present; # therefore, if an error is raised here, then the package # requirement is probably invalid. Unfortunately, the error # message text has to be checked as well; otherwise, there # is no way to verify version numbers that happen to be less # than the running patch level of Tcl. # if {[catch {package present Tcl $requirement} error] == 0} then { return true } else { # # TODO: Maybe this will require updates in the future? # set pattern(1) "expected version number but got *" set pattern(2) "expected versionMin-versionMax but got *" if {![string match $pattern(1) $error] && \ ![string match $pattern(2) $error]} then { return true } else { return false } } } } # # NOTE: This procedure attempts to extract the package lookup metadata from # the lookup result. The result argument is the lookup result. The # varName argument is the name of an array variable, in the call frame # of the immediate caller, that should receive the extracted package # lookup metadata. The caller argument must be an empty string -OR- # the literal string "handler". # proc extractAndVerifyLookupMetadata { result varName caller } { variable strictUnknownLanguage # # NOTE: Grab the returned patch level. It cannot be an empty string # and it must conform to the TIP #268 requirements for a single # package version. # set patchLevel [getDictionaryValue $result PatchLevel] if {[string length $patchLevel] == 0} then { error "missing patch level" } if {![isValidPackageRequirement $patchLevel false]} then { error "bad patch level" } # # 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] |
︙ | ︙ | |||
482 483 484 485 486 487 488 489 490 491 492 493 494 495 | # # NOTE: If the caller wants the package lookup metadata, use their # array variable name. # if {[string length $varName] > 0} then { upvar 1 $varName metadata set metadata(language) $language set metadata(script) $script set metadata(certificate) $certificate } } # | > | 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 | # # NOTE: If the caller wants the package lookup metadata, use their # array variable name. # if {[string length $varName] > 0} then { upvar 1 $varName metadata set metadata(patchLevel) $patchLevel set metadata(language) $language set metadata(script) $script set metadata(certificate) $certificate } } # |
︙ | ︙ | |||
583 584 585 586 587 588 589 590 591 592 593 594 595 596 | # # NOTE: If the entire package metadata array is missing, fail. # if {![info exists metadata]} then { error "missing metadata" } # # NOTE: If the language for the package script is mising, fail. # if {![info exists metadata(language)]} then { error "missing language" } | > > > > > > > | 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 | # # NOTE: If the entire package metadata array is missing, fail. # if {![info exists metadata]} then { error "missing metadata" } # # NOTE: If the patch level for the package is mising, fail. # if {![info exists metadata(patchLevel)]} then { error "missing patch level" } # # NOTE: If the language for the package script is mising, fail. # if {![info exists metadata(language)]} then { error "missing language" } |
︙ | ︙ | |||
1029 1030 1031 1032 1033 1034 1035 | } # # NOTE: Maybe check for the package and then optionally log results. # if {$verboseUnknownResult} then { set ifNeededVersion [getIfNeededVersion \ | | | 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 | } # # NOTE: Maybe check for the package and then optionally log results. # if {$verboseUnknownResult} then { set ifNeededVersion [getIfNeededVersion \ $package [packageRequirementToVersion $version]] if {[string length $ifNeededVersion] > 0} then { set command [list package ifneeded $package $ifNeededVersion] if {[catch $command result(3)] == 0 && \ [string length $result(3)] > 0} then { pkgLog [appendArgs \ |
︙ | ︙ | |||
1183 1184 1185 1186 1187 1188 1189 | # set apiKeys [getLookupApiKeys]; lappend apiKeys "" foreach apiKey $apiKeys { # # NOTE: Issue the lookup request to the remote package repository. # | | < | 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 | # set apiKeys [getLookupApiKeys]; lappend apiKeys "" foreach apiKey $apiKeys { # # NOTE: Issue the lookup request to the remote package repository. # set data [getLookupData $apiKey $package $version] # # NOTE: Attempt to grab the lookup code from the response data. # set code [getLookupCodeFromData $data] # |
︙ | ︙ |
Modified client/pkgr.eagle.harpy from [6721fc9472] to [098ea262fd].
︙ | ︙ | |||
17 18 19 20 21 22 23 | THE ASSOCIATED SOFTWARE MAY NOT WORK PROPERLY IF THIS FILE IS ALTERED. --> <Certificate xmlns="https://eagle.to/2011/harpy" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Protocol>None</Protocol> <Vendor>Mistachkin Systems</Vendor> | | | | | | | | | | | | | | | | | | | | | | 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | THE ASSOCIATED SOFTWARE MAY NOT WORK PROPERLY IF THIS FILE IS ALTERED. --> <Certificate xmlns="https://eagle.to/2011/harpy" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Protocol>None</Protocol> <Vendor>Mistachkin Systems</Vendor> <Id>ba94806a-9b8d-4e88-bab7-13bf861cac0d</Id> <HashAlgorithm>SHA512</HashAlgorithm> <EntityType>Script</EntityType> <TimeStamp>2016-08-19T00:09:46.0088359Z</TimeStamp> <Duration>-1.00:00:00</Duration> <Key>0x2c322765603b5278</Key> <Signature> QwuM/tDLPKZLpAVJgsRw0+sjnxIouFcqm1IDjMqfdIv35x4sKBaXvMRTzid60II+xLcH7HlPB5yA TdoxpEOpQDcxb1td6QA6x83QR/sNrHjENQhdBLRlMB85zb4BDYoeBxRZffaVJ9/DcUGMBFjaCnq9 fvMwy8Zrfn9gchj62qIQi325ZmoAEjx9gNxqZ04VgKS9gVv/zrtCTjI0a005UnoCLvJ9pYwbI8JT +froJJNq33wGV6AhZgtDz68oztHEoeo4VPn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A== </Signature> </Certificate> |