Diff
Not logged in

Differences From Artifact [3ae0666b79]:

To Artifact [5880778674]:


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
264
265
266
267
268

269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
    } elseif {$language eq "tcl"} then {
      return pkgIndex.tcl
    } else {
      return ""
    }
  }

  #
  # NOTE: This procedure returns non-zero if the specified file appears
  #       to contain a master package index for native Tcl.  The fileName
  #       argument is the name of the file to check.
  #
  proc isMasterTclPackageIndex { fileName } {
    #
    # NOTE: Read all data from the specified file.  This should always be
    #       a relatively small file with a constant size.
    #
    set data [readFile $fileName]

    #
    # NOTE: Check the data read from the file for the magic string that
    #       we use to indicate a "master package index" file.
    #
    if {[string first <MASTER_PACKAGE_INDEX> $data] == -1} then {
      return false
    }

    #
    # TODO: Make this procedure smarter?
    #
    return true
  }

  #
  # NOTE: This procedure, which is only used for 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.  This procedure
  #       will return non-zero if productive work was done.
  #
  proc maybeModifyMasterTclPackageIndex {} {
    variable persistentRootDirectory

    verifyPersistentRootDirectory
    set persistentDirectory $persistentRootDirectory

    set fileName [file join $persistentDirectory pkgIndex.tcl]

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

    writeFile $fileName [string trim [string map [list \r\n \n] {
###############################################################################
#
# pkgIndex.tcl --
#
# Extensible Adaptable Generalized Logic Engine (Eagle)








<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<

|
|
|
>
|
|
|
<
|

|






<
|
<
<







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
    } elseif {$language eq "tcl"} then {
      return pkgIndex.tcl
    } else {
      return ""
    }
  }

  #


























  # NOTE: This procedure, which is only used for native Tcl, generates a
  #       "master" package index file (i.e. "pkgIndex.tcl") suitable for
  #       use with native Tcl 8.4 (or higher).  It will recursively scan
  #       for all other native Tcl package index files that are within the
  #       configured persistent root directory and [source] them, thereby
  #       causing all packages located within them to become available.
  #       Since Eagle (by default) already performs recursive searches for
  #       its package index files, this procedure is not needed for Eagle.

  #       The return value is undefined.
  #
  proc maybeCreateMasterTclPackageIndex {} {
    variable persistentRootDirectory

    verifyPersistentRootDirectory
    set persistentDirectory $persistentRootDirectory

    set fileName [file join $persistentDirectory pkgIndex.tcl]

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



    writeFile $fileName [string trim [string map [list \r\n \n] {
###############################################################################
#
# pkgIndex.tcl --
#
# Extensible Adaptable Generalized Logic Engine (Eagle)
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
  }

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

set dir $pkgd(savedDir); unset -nocomplain pkgd
## <MASTER_PACKAGE_INDEX> ##
    }]]

    return true
  }

  #
  # 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.







<


|







289
290
291
292
293
294
295

296
297
298
299
300
301
302
303
304
305
  }

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

set dir $pkgd(savedDir); unset -nocomplain pkgd

    }]]

    return ""
  }

  #
  # 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.
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028

1029
1030
1031
1032
1033
1034
1035
1036
      if {[isEagle]} then {
        file delete -recursive -- $temporaryDirectory
      } else {
        file delete -force -- $temporaryDirectory
      }

      #
      # NOTE: When dealing with packages for native Tcl, modify the master
      #       package index.
      #
      if {$language eq "tcl"} then {

        set addPersistentDirectoryToAutoPath [maybeModifyMasterTclPackageIndex]
      }
    }

    #
    # NOTE: Sort the list of directories that downloaded files were written
    #       to, removing any duplicates in the process.
    #







|
|


>
|







988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
      if {[isEagle]} then {
        file delete -recursive -- $temporaryDirectory
      } else {
        file delete -force -- $temporaryDirectory
      }

      #
      # NOTE: When the target language is native Tcl, try to create the
      #       master package index, if necessary.
      #
      if {$language eq "tcl"} then {
        maybeCreateMasterTclPackageIndex
        set addPersistentDirectoryToAutoPath true
      }
    }

    #
    # NOTE: Sort the list of directories that downloaded files were written
    #       to, removing any duplicates in the process.
    #