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 | 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 } { |
︙ | |||
308 309 310 311 312 313 314 | 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. # |
︙ | |||
410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 | 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 | 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 | 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 | 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 \ |
︙ | |||
1183 1184 1185 1186 1187 1188 1189 | 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. # |
︙ |
Modified client/pkgr.eagle.harpy from [6721fc9472] to [098ea262fd].
︙ | |||
17 18 19 20 21 22 23 | 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> |