Diff
Not logged in

Differences From Artifact [8f95de070a]:

To Artifact [db99d690a9]:


81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104

    if {![info exists temporaryRootDirectory]} then {
      set temporaryRootDirectory \
          [::PackageRepository::getFileTempDirectory PKGD_TEMP]
    }
  }

  #
  # NOTE: This procedure returns a directory name suffix that is unique to
  #       the running process at the current point in time.  There are no
  #       arguments.
  #
  proc getUniqueDirectorySuffix {} {
    return [appendArgs \
        [string trim [pid] -] _ [string trim [clock seconds] -]]
  }

  #
  # NOTE: This procedure returns the root directory where any packages that
  #       are downloaded should be saved to permanent storage for subsequent
  #       use.  There are no arguments.
  #
  proc getPersistentRootDirectory {} {
    #







<
<
<
<
<
<
<
<
<
<







81
82
83
84
85
86
87










88
89
90
91
92
93
94

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










  #
  # NOTE: This procedure returns the root directory where any packages that
  #       are downloaded should be saved to permanent storage for subsequent
  #       use.  There are no arguments.
  #
  proc getPersistentRootDirectory {} {
    #
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
293


294
295
296
297
298
299
300
    variable clientDirectory
    variable temporaryRootDirectory

    verifyLanguageAndVersion $language $version isClient

    set temporaryDirectory [file join \
        $temporaryRootDirectory [appendArgs \
        pkgd_ver_ [getUniqueDirectorySuffix]]]

    if {$isClient} then {
      set persistentDirectory $clientDirectory
    } else {
      set persistentDirectory $persistentRootDirectory
    }

    set fileName [file join $packageName VERSION]
    set downloadFileName [file join $temporaryDirectory $fileName]

    file mkdir [file dirname $downloadFileName]
    downloadOneFile $language $version $fileName $downloadFileName $usePgp

    if {$usePgp} then {
      downloadOneFile $language $version [appendArgs $fileName .asc] \
          [appendArgs $downloadFileName .asc] $usePgp
    }

    set localFileName [file join $persistentDirectory $fileName]

    if {[package vcompare \
        [string trim [readFile $downloadFileName]] \
        [string trim [readFile $localFileName]]] > 0} then {
      return true
    } else {
      return false
    }


  }

  #
  # 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
  #       downloaded, this procedure assumes the corresponding data file was







|




















|

|
<
<
<
|
>
>







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
    variable clientDirectory
    variable temporaryRootDirectory

    verifyLanguageAndVersion $language $version isClient

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

    if {$isClient} then {
      set persistentDirectory $clientDirectory
    } else {
      set persistentDirectory $persistentRootDirectory
    }

    set fileName [file join $packageName VERSION]
    set downloadFileName [file join $temporaryDirectory $fileName]

    file mkdir [file dirname $downloadFileName]
    downloadOneFile $language $version $fileName $downloadFileName $usePgp

    if {$usePgp} then {
      downloadOneFile $language $version [appendArgs $fileName .asc] \
          [appendArgs $downloadFileName .asc] $usePgp
    }

    set localFileName [file join $persistentDirectory $fileName]

    set compare [package vcompare \
        [string trim [readFile $downloadFileName]] \
        [string trim [readFile $localFileName]]]




    file delete -force -- $temporaryDirectory
    return [expr {$compare > 0}]
  }

  #
  # 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
  #       downloaded, this procedure assumes the corresponding data file was
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
    variable persistentRootDirectory
    variable temporaryRootDirectory

    verifyLanguageAndVersion $language $version isClient

    set temporaryDirectory [file join \
        $temporaryRootDirectory [appendArgs \
        pkgd_lib_ [getUniqueDirectorySuffix]]]

    if {$isClient} then {
      set persistentDirectory $clientDirectory
    } else {
      set persistentDirectory $persistentRootDirectory
    }








|







363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
    variable persistentRootDirectory
    variable temporaryRootDirectory

    verifyLanguageAndVersion $language $version isClient

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

    if {$isClient} then {
      set persistentDirectory $clientDirectory
    } else {
      set persistentDirectory $persistentRootDirectory
    }

466
467
468
469
470
471
472




473
474
475
476
477
478
479
    set downloadDirectories [lsort -unique $downloadDirectories]

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





    return $downloadDirectories
  }

  #
  # NOTE: This package requires the package repository client package.
  #







>
>
>
>







455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
    set downloadDirectories [lsort -unique $downloadDirectories]

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

    if {$persistent} then {
      file delete -force -- $temporaryDirectory
    }

    return $downloadDirectories
  }

  #
  # NOTE: This package requires the package repository client package.
  #