Check-in [a629ae4e7c]
Not logged in
Overview
Comment:Always run the originally saved 'package unknown' handler. Also, fixup the package version to prevent sending requirement-spec style package versions to the server.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: a629ae4e7c6497c27ce2a445a0f78d048b3e4b13
User & Date: mistachkin on 2016-08-15 20:47:10
Other Links: manifest | tags
Context
2016-08-15
21:03
Enable 'quiet' mode for the package lookup request to the package repository server. check-in: 878e274ae3 user: mistachkin tags: trunk
20:47
Always run the originally saved 'package unknown' handler. Also, fixup the package version to prevent sending requirement-spec style package versions to the server. check-in: a629ae4e7c user: mistachkin tags: trunk
19:46
The ampersand character needs to be unescaped in the returned data from the package server. check-in: 306c8151d8 user: mistachkin tags: trunk
Changes

Modified client/pkgr.eagle from [a326722ba1] to [9aa5b5aab0].

56
57
58
59
60
61
62



















63
64
65
66
67
68
69

    if {[info exists $varName]} then {
      return [set $varName]
    }

    return ""; # NOTE: System default, which is "public".
  }




















  proc getLookupBaseUri {} {
    set varName [appendArgs [getLookupVarNamePrefix] base_uri]

    if {[info exists $varName]} then {
      return [set $varName]
    }







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88

    if {[info exists $varName]} then {
      return [set $varName]
    }

    return ""; # NOTE: System default, which is "public".
  }

  proc getLookupVersion { requirement } {
    if {[set index [string first - $requirement]] != -1} then {
      incr index -1; set requirement [string range $requirement 0 $index]
    }

    if {[set index [string first a $requirement]] != -1 || \
        [set index [string first b $requirement]] != -1} then {
      incr index -1; set requirement [string range $requirement 0 $index]
    }

    if {$requirement eq "0"} then {
      set requirement ""
    } elseif {[regexp -- {^\d+$} $requirement]} then {
      append requirement .0
    }

    return $requirement
  }

  proc getLookupBaseUri {} {
    set varName [appendArgs [getLookupVarNamePrefix] base_uri]

    if {[info exists $varName]} then {
      return [set $varName]
    }
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
      error "package unknown handler is not hooked"
    }

    package unknown [set $varName]
    unset $varName
  }














  #
  # NOTE: This version argument to this procedure must be optional, because
  #       Eagle does not add a version argument when one is not supplied to
  #       the [package require] sub-command itself.
  #
  proc packageUnknownHandler { package {version ""} } {



    if {[catch {main $package $version} error(1)] == 0} then {
      #







      # NOTE: Success?  Just return and let Tcl (or Eagle) handle the
      #       rest.
      #
      return










    } else {
      #
      # NOTE: Failure?  Attempt to log the error message and then maybe
      #       try the original [package unknown] handler.
      #
      catch {
        tclLog [appendArgs \
            "pkgr: new handler failed for \"" [appendArgs [string \
            trim $package " " $version]] "\", error: " $error(1)]
      }
    }

    #
    # NOTE: See if there is a saved [package unknown] handler.  If so, we
    #       will attempt to use it.
    #
    set varName [appendArgs [getLookupVarNamePrefix] saved_package_unknown]

    if {[info exists $varName]} then {
      set oldHandler [set $varName]
    } else {
      set oldHandler ""
    }

    if {[string length $oldHandler] > 0} then {
      lappend oldHandler $package $version

      if {[catch {uplevel #0 $oldHandler} error(2)] == 0} then {
        #
        # NOTE: Success?  Just return and let Tcl (or Eagle) handle the
        #       rest.
        #
        return
      } else {
        #







>
>
>
>
>
>
>
>
>
>
>
>
>






>
>
>


>
>
>
>
>
>
>
|
|
|
|
>
>
>
>
>
>
>
>
>
>










|
|
<
|
|
<
<
|
<
<
<
<
<
|
|
|
<
|







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
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536

537
538


539





540
541
542

543
544
545
546
547
548
549
550
      error "package unknown handler is not hooked"
    }

    package unknown [set $varName]
    unset $varName
  }

  proc runSavedPackageUnknownHandler { package version } {
    #
    # NOTE: See if there is a saved [package unknown] handler.  If so, then
    #       attempt to use it.
    #
    set varName [appendArgs [getLookupVarNamePrefix] saved_package_unknown]
    set oldHandler [expr {[info exists $varName] ? [set $varName] : ""}]

    if {[string length $oldHandler] > 0} then {
      lappend oldHandler $package $version; uplevel #0 $oldHandler
    }
  }

  #
  # NOTE: This version argument to this procedure must be optional, because
  #       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 {
      #
      # NOTE: The repository [package unknown] handler succeeded, run the
      #       saved [package unknown] handler.
      #
      if {[catch {
        runSavedPackageUnknownHandler $package $version
      } error(2)] == 0} then {
        #
        # NOTE: Success?  Just return and let Tcl (or Eagle) handle the
        #       rest.  This is the "happy" path.
        #
        return
      } else {
        #
        # NOTE: Failure?  Attempt to log the error message.
        #
        catch {
          tclLog [appendArgs \
              "pkgr: saved handler failed for \"" [appendArgs [string \
              trim $package " " $version]] "\", error: " $error(2)]
        }
      }
    } else {
      #
      # NOTE: Failure?  Attempt to log the error message and then maybe
      #       try the original [package unknown] handler.
      #
      catch {
        tclLog [appendArgs \
            "pkgr: new handler failed for \"" [appendArgs [string \
            trim $package " " $version]] "\", error: " $error(1)]
      }

      #

      # NOTE: The repository [package unknown] handler failed, run the
      #       saved [package unknown] handler anyway.  There is almost


      #       no chance of this actually providing the package.





      #
      if {[catch {
        runSavedPackageUnknownHandler $package $version

      } error(2)] == 0} then {
        #
        # NOTE: Success?  Just return and let Tcl (or Eagle) handle the
        #       rest.
        #
        return
      } else {
        #
522
523
524
525
526
527
528
529

530
531
532
533
534
535
536
    error [array get error]
  }

  proc main { package version } {
    #
    # NOTE: Issue the lookup request to the remote package repository.
    #
    set data [getLookupData [getLookupApiKey] $package $version]


    #
    # NOTE: Attempt to grab the lookup code from the response data.
    #
    set code [getLookupCodeFromData $data]

    #







|
>







565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
    error [array get error]
  }

  proc main { package version } {
    #
    # NOTE: Issue the lookup request to the remote package repository.
    #
    set data [getLookupData \
        [getLookupApiKey] $package [getLookupVersion $version]]

    #
    # NOTE: Attempt to grab the lookup code from the response data.
    #
    set code [getLookupCodeFromData $data]

    #

Modified client/pkgr.eagle.harpy from [b3f7c3de66] to [fc092c0b5d].

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>d1f6abbf-494e-449f-b492-cc8dbe4312f3</Id>
  <HashAlgorithm>SHA512</HashAlgorithm>
  <EntityType>Script</EntityType>
  <TimeStamp>2016-08-15T19:46:02.7331563Z</TimeStamp>
  <Duration>-1.00:00:00</Duration>
  <Key>0x2c322765603b5278</Key>
  <Signature>
    IL5aKCAgC3hCVM1ivfniDqu8A/e5W7jvAnT0TQz37GRfHVXpQe3cr4IhNC/SSm9O2h7ForjxRZ2h
    wly8qdR28WMaUz+kUFsIPaZVi4UKJw0L/K+YNb7zaJok/13+zFkOhdZ3kzxaea/+OWtqvLunanPL
    mnRjowZATNV2oJ1FnsHUoA1Wyk6fTxsGDKtV0WaYiYgZKDMKAAzimzJB7ivE7XDN5+3BVxVwKnSU
    yc5TLF/FhShxe85Y52VFMkXJht1MUPNL1dVZrlY8GvTUJ+gy/WUuCtv0EkcJeDPxuwflq6o2xDmZ
    Nl4ag+kONnc2dPzn8brHoP1/PgzHtziT4j9NKrBcyM7QQ5+tmkpjR8EZ+0b83Fd0o9NO1C9+cxtv
    Uq+64+r4BeSnX5QFxF2M1n3OdEUmixLAneYKPmNobUCITxMS7CiXOV6u28Id+TC8fPjTxvBqt+Zy
    XA8AGsuS9H4Hxmt09UHfzERHvNvsNCcHKIPnmKWVflnw6eSUDeZB+8pCsTRI5+yaw7LkuxeRWyJu
    gDM4Ks20bKPxGUG7ipEy6UVuAB+q7hyH0/FC+OYsgqcxhzkY1F/C68Hr2MFQ7LfvuYfbue9R8pB4
    EEgzUrcRChLesppwsGfyV7hDq+TPgfWcIhsEz6sEsfLdba/xhnUCB6P1iICqA/qLkhPd2yp5bDRZ
    U1yIuwUHNRvXnt6eqqOL+1r+LpQN0InvOCstzna3jxAXIftf71FbmYqHN+d6nun53aviO0VsilKr
    ghzB/Z3JuejzCasrVUw8elpStbb1CUGkcxwEv+hIMhV19JPB0CxW3L5QE0nrhB23gNfZx2MfDHm9
    oWL9UEuhe6ALXIcLe/cOkmm6W7ksvr9SwOi7uHHws4rlaFADpIl7CY5pp5XoFt/bTN/5yDrCagZI
    Fe32vq1tbtEzJvjrU4X5tEI+vK9PsXr99zWWPX1NCWpwbYYBLHJUGRV+axAGQhEOLFi3h/SSY7pl
    N+ZNHTFf/C8Xq25IY3YdfP19z3KfjR5RNCUXfJs5AYY9kTpTk39/7l9wKNvfKIXNiaoXKUjecgVo
    wW5Oj4He6tRLHsZP9wvZ8A9U04AxgrjWgVo4UQ5YulIc22acbvnPT87tcLfOnPx73YLDR6yXmoEe
    EwYKO371WkDgZkT7EyV+ZOdTOSMIRRdPual7MLKLFdyxUAVjDT+sbBucJHXSeyXMjCpsMMQy/Jgo
    CMBeGAQ0okMHgnO6cigmXnSd6xdC5uQxTUIxQ4Mp/omjbRKVGpj6GzYxjN/7s+4O7WWfX/esJJuy
    ijCSJb5qVw3CQdBbpF7RZ06ov2xdqGl6m2Sit1nDHGwqemOE2ZoSctjgLwaBatBpiabmpn0tTw==
  </Signature>
</Certificate>







|


|



|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|


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>dbd36350-702f-4e2a-8087-a4b40e13524f</Id>
  <HashAlgorithm>SHA512</HashAlgorithm>
  <EntityType>Script</EntityType>
  <TimeStamp>2016-08-15T20:37:30.8308125Z</TimeStamp>
  <Duration>-1.00:00:00</Duration>
  <Key>0x2c322765603b5278</Key>
  <Signature>
    azosgrwxz2hRxDq3u70bB7tWoRqW4P7d5mKVkbUM9c9h08ShQgF4OCQX3dBkJc3u76KE9pEstTxk
    MlZ1I9InkCfM+UlrqwSxrzoXnT/jwEIgeSnkR5c+CZUS5yCduNbd3YJJwGjyZ3Gk7cHCKcX7eKyg
    vsjopX2vroZVBy4PzIKtLdLjaiBAfeiWUKdKdgYbagYNrao3b9i3FvhqLv+1shvYeM0DddWIDEQh
    DplSUyhdcPLnNnSU5d6jF34rJzUGbxFeg+zrsw6cbEQrpiwbZpc5nIzgoB2/EXXtgCCpmJelm7YK
    nwSIRyeDukXZH8j2LEtB5i8J+Ha4qVXYN+ocKhXDy+T0005wSxauXRI7f9XU+nH2D7zbu9hq/p2b
    KZMcy/8mmsWXOkkuXU71WAxUtQlOEORYp2Y+FtcdmCyj8ad0udLytdFWH95USqH/kP2IIOvIsOS/
    nAIHO/R8mkBkt5+L0vLFzv5pW9bUgLpKlIJLblsCKSCMBfWwPiFyMSXtH2oQqqltN2sqjbx/SGzQ
    3KWCQwLOu/bcDFLzhNcghlvXNN4QKMQKUYSS2keS+SSSbT+dkHOeH0qBfyZLWzKoijKRzNcW1RvV
    nM9W6h/Rf0KshlHspTPRuT0EDzhyaACkauHRuqiEzQivcZzJoX47uRZZ7tXHeFQQ7ko+ZTP0fTSr
    5HAk/I3yk9gJrULZvtIvH4xP3DPyLvqFQf0iiENCkUAZkobd8dDUtgX5+W7Ak6fKjti0Tkl42Glh
    EeNCgnkBpLf/sQFR2s48Vrv/VI7v9wDGYGE0tqZYeUSBVG9B3JQcUQzRmroP+tPk/CdcRUb1XS7s
    aWpqh+craPK08hRuZFC0FaSqu1aM9TQW4afoc8d0VsLyiFjT0SU8elurWxN+/0X+AfaZZ63r6fpH
    srW+rJ/fVVkqWWtIuZb/ZZDeGSIWbiwV4TYHSVrsv+bDZRg44m78FM4ruBsGf6NPBGxU8orD5ukY
    H/RLm4pfiGWkBeFnbE+aboEQhkutlk30q7o06pmu6cf83/RmMIMPG1799uztFNfm+BiPfdBzVUVT
    1LWljMxkYsmb4Cvtt+DwHwE4F6bpAe3MAJT5P8hhAlluJUEhdJLvghj/qF+MIh1uPPz9uYLHy3pa
    gaCzKOhC6G/AxmXyx2jbpJVLQYSvAAPoIsxEuw14Y6SzZWajgsqLxh6do0eAgKj6KN+QR8KQXFA+
    9s2l08qLb0sln1OBGQxfn/bky8LXnjR7wJfbOeW+3tnDtrpd994661mtCg8XrAB2cygU5PTl0uRO
    PRW7mt3wA+MQBw0Tusqv9F8ohymR3s0JW4KlEEUbMgygjZvB+k+UCP0DiumW5nqv+pD+mc2CeA==
  </Signature>
</Certificate>