Changes On Branch e5470474bde90458
Not logged in

Changes In Branch vNext Through [e5470474bd] Excluding Merge-Ins

This is equivalent to a diff from fecb8511da to e5470474bd

2022-03-02
20:43
Merge various recent fixes and enhancements to the package client toolset. check-in: 372ee60877 user: mistachkin tags: trunk
2022-02-20
15:47
Skip adding temporary package directories if they do not contain an appropriate package index file. check-in: badaf4f7d9 user: test tags: vNext
02:30
Optionally allow reuse of temporary package directories. check-in: e5470474bd user: test tags: vNext
2021-11-11
15:23
Pickup the platform detection changes from upstream. check-in: fecb8511da user: mistachkin tags: trunk
2021-08-08
00:11
Pickup the Harpy script signing tooling changes from upstream. check-in: 7f8b164b2f user: mistachkin tags: trunk

Modified client/1.0/neutral/pkgd.eagle from [0aa315b515] to [d3a201ce4a].

697
698
699
700
701
702
703




























704
705
706
707
708
709
710
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







        return true
      }
    } else {
      return false
    }
  }

  #
  # NOTE: This procedure attempts to verify the OpenPGP signature file that
  #       is associated with the specified file.  The forcePgp parameter is
  #       used to force verification attempts to be performed even when the
  #       file does not appear to be an OpenPGP signature file.
  #
  proc maybeVerifyOpenPgpSignature { fileName forcePgp } {
    #
    # NOTE: Is this temporary package file actually just an OpenPGP
    #       signature file?  If so, skip it.
    #
    if {$forcePgp || \
        [isOpenPgpSignatureFileName $fileName true]} then {
      #
      # NOTE: Attempt to verify the OpenPGP signature.  If this fails,
      #       an error is raised.
      #
      ::PackageRepository::probeForOpenPgpInstallation
      ::PackageRepository::openPgpMustBeInstalled

      if {![::PackageRepository::verifyOpenPgpSignature \
          $fileName]} then {
        error [appendArgs \
            "bad OpenPGP signature \"" $fileName \"]
      }
    }
  }

  #
  # NOTE: This procedure returns the auto-path for the language specified by
  #       the language argument.  An empty list is returned if the auto-path
  #       does not exist in the target language.  This procedure may raise
  #       script errors.
  #
  proc getAutoPath { language } {
1896
1897
1898
1899
1900
1901
1902
1903

1904
1905
1906
1907


1908
1909
1910
1911
1912

1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1924
1925
1926
1927
1928
1929
1930

1931

1932


1933
1934
1935




1936



1937
1938
1939
1940
1941
1942
1943







-
+
-

-
-
+
+

-
-
-
-
+
-
-
-







    #
    writeFile $localFileName [getPackageFile $uri]

    #
    # NOTE: Is use of OpenPGP for signature verification enabled?  Also,
    #       did we just download an OpenPGP signature file?
    #
    if {$usePgp && ($forcePgp || \
    if {$usePgp} then {
        [isOpenPgpSignatureFileName $localFileName true])} then {
      #
      # NOTE: Attempt to verify the OpenPGP signature.  If this fails,
      #       an error is raised.
      # NOTE: Maybe attempt to verify the OpenPGP signature.  If this
      #       fails, an error is raised.
      #
      ::PackageRepository::probeForOpenPgpInstallation
      ::PackageRepository::openPgpMustBeInstalled

      if {![::PackageRepository::verifyOpenPgpSignature $localFileName]} then {
      maybeVerifyOpenPgpSignature $localFileName $forcePgp
        error [appendArgs \
            "bad OpenPGP signature \"" $localFileName \"]
      }
    }
  }

  #
  # NOTE: This procedure downloads a single file from the package file server,
  #       writing its contents to the specified local file name.  It can also
  #       verify the OpenPGP signatures.  When an OpenPGP signature file is
2204
2205
2206
2207
2208
2209
2210



































































2211
2212
2213
2214
2215
2216
2217
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+








    #
    # NOTE: Always return the list of directories that were actually added
    #       to the auto-path, if any.
    #
    return $downloadDirectories
  }

  #
  # NOTE: This procedure adds temporary package directories to the auto-path
  #       of the specified language (i.e. native Tcl or Eagle).  Directories
  #       will not be added if already present.  The language argument must
  #       be the literal string "eagle" or the literal string "tcl".  The
  #       pattern argument is the optional pattern to match against each of
  #       the candidate temporary package directories.  If the pattern is an
  #       empty string then all candidate temporary package directories will
  #       be added to the auto-path; otherwise, the pattern will be matched
  #       against the final portion of the temporary package directory name
  #       and only those temporary package directories that actually match
  #       the pattern will be added to the auto-path.  The options argument
  #       must be a dictionary of name/value pairs.  This procedure does not
  #       currently support any options.  This procedure may raise script
  #       errors.  This procedure assumes the local temporary directory is
  #       writable only by applications that are implicitly trusted by the
  #       current user.  If this assumption does not hold on your platform,
  #       DO NOT USE THIS PROCEDURE AS IT MAY BE UNSAFE.
  #
  # <public>
  proc maybeAddTemporaryPackagesToAutoPath { language options {pattern *} } {
    variable temporaryRootDirectory
    variable verboseTemporaryDirectory

    #
    # NOTE: Initially, no temporary package directories have been added
    #       to the auto-path.
    #
    set result [list]; set packageNames [list]

    #
    # HACK: Obtain the list of candidate temporary package directories
    #       that may need to be added to the auto-path.  The prefix we
    #       use here is considered "well-known" by this package.
    #
    set directories(1) [glob -nocomplain -types {d} \
        [file join $temporaryRootDirectory pkgd_lib_*]]

    foreach directory(1) $directories(1) {
      set directories(2) [glob -nocomplain -types {d} \
          [file join $directory(1) *]]

      foreach directory(2) $directories(2) {
        set directoryNameOnly(2) [file tail $directory(2)]
        set packageName $directoryNameOnly(2); # HACK: Well-known.

        if {[lsearch -exact $packageNames $packageName] == -1} then {
          if {[string length $pattern] == 0 || \
              [string match $pattern $directoryNameOnly(2)]} then {
            if {[maybeAddToAutoPath $language $directory(2)]} then {
              lappend packageNames $directoryNameOnly(2)
              lappend result $directory(2)

              if {$verboseTemporaryDirectory} then {
                pkgLog [appendArgs \
                    "added temporary package directory named \"" \
                    $directory(2) "\" to auto-path..."]
              }
            }
          }
        }
      }
    }

    return $result
  }

  #
  # NOTE: This package requires the package repository client package.
  #
  package require Eagle.Package.Repository

  #