Diff
Not logged in

Differences From Artifact [bba4803a0e]:

To Artifact [eccf995f19]:


137
138
139
140
141
142
143











144
145
146
147
148
149
150
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161







+
+
+
+
+
+
+
+
+
+
+







    #
    variable temporaryRootDirectory; # DEFAULT: [getFileTempDirectory PKGD_TEMP]

    if {![info exists temporaryRootDirectory]} then {
      set temporaryRootDirectory \
          [::PackageRepository::getFileTempDirectory PKGD_TEMP]
    }

    #
    # NOTE: Is this package being run by the package installer tool?  If so,
    #       all downloaded packages should be automatically persisted to the
    #       library path.
    #
    variable viaInstall; # DEFAULT: false

    if {![info exists viaInstall]} then {
      set viaInstall false
    }
  }

  #
  # NOTE: This procedure escapes a single name/value pair for use in a URI
  #       query string.  The name argument is the name of the parameter.
  #       The value argument is the value of the parameter.
  #
167
168
169
170
171
172
173








































































174
175
176
177
178
179
180
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263







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







  proc getPersistentRootDirectory {} {
    #
    # NOTE: Return a directory parallel to the one containing the library
    #       directory.
    #
    return [file join [file dirname [info library]] pkgd]
  }

  #
  # NOTE: This procedure, which is only used with native Tcl, generates a
  #       package index file (i.e. "pkgIndex.tcl") suitable for use with
  #       native Tcl, 8.4 or higher.  It will recursively [source] other
  #       native Tcl package index files that are within the configured
  #       persistent root directory, thereby causing all packages located
  #       within it to become available.  Since Eagle (by default) already
  #       performs a recursive search for its package index files, this
  #       procedure is not necessary for Eagle packages.
  #
  proc maybeCreateMasterTclPackageIndex {} {
    variable persistentRootDirectory

    if {![info exists persistentRootDirectory]} then {
      error "persistent root directory not set"
    }

    if {[string length $persistentRootDirectory] == 0} then {
      error "persistent root directory is invalid"
    }

    if {![file isdirectory $persistentRootDirectory]} then {
      error "persistent root directory does not exist"
    }

    set fileName [file join $persistentRootDirectory pkgIndex.tcl]

    if {[file exists $fileName]} then {
      return false
    }

    writeFile $fileName [string trim [string map [list \r\n \n] {
###############################################################################
#
# pkgIndex.tcl --
#
# Extensible Adaptable Generalized Logic Engine (Eagle)
# Generated Recursive Package Index File -- PLEASE DO NOT EDIT
#
# Copyright (c) 2007-2012 by Joe Mistachkin.  All rights reserved.
#
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: $
#
###############################################################################

if {![package vsatisfies [package provide Tcl] 8.4]} {return}
if {[string length [package provide Eagle]] > 0} then {return}

set pkgd(savedDir) $dir; set pkgd(dirs) [list $pkgd(savedDir)]

for {set pkgd(i) 0} {$pkgd(i) < [llength $pkgd(dirs)]} {incr pkgd(i)} {
  set pkgd(dir) [lindex $pkgd(dirs) $pkgd(i)]

  if {$pkgd(i) > 0} then {
    set pkgd(file) [file join $pkgd(dir) pkgIndex.tcl]

    if {[file exists $pkgd(file)]} then {
      set dir $pkgd(dir); source $pkgd(file)
    }
  }

  eval lappend pkgd(dirs) \
      [glob -nocomplain -types {d} [file join $pkgd(dir) *]]
}

set dir $pkgd(savedDir); unset -nocomplain pkgd
    }]]
  }

  #
  # NOTE: This procedure returns non-zero if the specified file seems to be
  #       an OpenPGP signature file.  The fileName argument is the name of
  #       the file to check, which may or may not exist.  The nameOnly
  #       argument should be non-zero to ignore the contents of the file.
  #
622
623
624
625
626
627
628

629
630
631
632
633
634
635
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719







+







  #
  # <public>
  proc downloadFiles {
          language version fileNames persistent usePgp useAutoPath } {
    variable clientDirectory
    variable persistentRootDirectory
    variable temporaryRootDirectory
    variable viaInstall

    verifyLanguageAndVersion $language $version isClient

    set temporaryDirectory [file join \
        $temporaryRootDirectory [appendArgs \
        pkgd_lib_ [::PackageRepository::getUniqueSuffix]]]

689
690
691
692
693
694
695
696

697
698
699
700
701
702
703
773
774
775
776
777
778
779

780
781
782
783
784
785
786
787







-
+







    }

    set downloadDirectories [list]

    foreach downloadedFileName $downloadedFileNames {
      set directory(temporary) [lindex $downloadedFileName 1]

      if {$persistent} then {
      if {$persistent || $viaInstall} then {
        set fileNameOnly [lindex $downloadedFileName 0]
        set directory(persistent) [lindex $downloadedFileName 2]

        file mkdir $directory(persistent)
        set command [list file copy]

        if {$isClient} then {
720
721
722
723
724
725
726
727

728
729
730
731

732
733
734
735
736
737
738
804
805
806
807
808
809
810

811
812
813
814
815
816
817
818
819
820
821
822
823







-
+




+








    if {$useAutoPath} then {
      foreach downloadDirectory $downloadDirectories {
        addToAutoPath $language $downloadDirectory
      }
    }

    if {$persistent} then {
    if {$persistent || $viaInstall} then {
      if {[isEagle]} then {
        file delete -recursive -- $temporaryDirectory
      } else {
        file delete -force -- $temporaryDirectory
        maybeCreateMasterTclPackageIndex
      }
    }

    return $downloadDirectories
  }

  #