Diff
Not logged in

Differences From Artifact [5d8da8ea5d]:

To Artifact [6a1409dce3]:


22
23
24
25
26
27
28
29

30
31
32
33
34
35
36
22
23
24
25
26
27
28

29
30
31
32
33
34
35
36







-
+







namespace eval ::PackageDownloader {
  #
  # NOTE: This procedure sets up the default values for all URN configuration
  #       parameters used by the package downloader client.  If the force
  #       argument is non-zero, any existing values will be overwritten and
  #       set back to their default values.
  #
  proc setupDownloadUrnVars { force } {
  proc setupDownloadServerVars { force } {
    #
    # NOTE: The URN, relative to the base URI, where the Package Signing Key
    #       may be downloaded.
    #
    variable openPgpKeyUrn; # DEFAULT: pkg_key

    if {$force || ![info exists openPgpKeyUrn]} then {
74
75
76
77
78
79
80


















81
82
83
84
85
86
87
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105







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







    variable logoutUrn; # DEFAULT: pkgd_logout

    if {$force || ![info exists logoutUrn]} then {
      set logoutUrn pkgd_logout
    }
  }

  #
  # NOTE: This procedure sets up the default values for all version
  #       configuration parameters used by the package downloader client.
  #       If the force argument is non-zero, any existing values will be
  #       overwritten and set back to their default values.
  #
  proc setupDownloadVersionVars { force } {
    #
    # NOTE: The name of the branch where the package files should be fetched
    #       from.
    #
    variable branchName; # DEFAULT: trunk

    if {$force || ![info exists branchName]} then {
      set branchName trunk
    }
  }

  #
  # NOTE: This procedure sets up the default values for all URI configuration
  #       parameters used by the package downloader client.  If the force
  #       argument is non-zero, any existing values will be overwritten and
  #       set back to their default values.
  #
  proc setupDownloadUriVars { force } {
119
120
121
122
123
124
125
126

127
128
129
130
131
132
133
134
135
136
137

138
139
140
141
142
143
144
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
162







-
+










-
+







    #
    # NOTE: The URI where the list of supported platforms for a single
    #       package may be found.
    #
    variable platformsUri; # DEFAULT: ${baseUri}/${platformsUrn}?...

    if {$force || ![info exists platformsUri]} then {
      set platformsUri {${baseUri}/${platformsUrn}?download&name=trunk}
      set platformsUri {${baseUri}/${platformsUrn}?download&name=${branchName}}
    }

    #
    # NOTE: The URI where a single package file may be found.  This file will
    #       belong to a specific version of one package.
    #
    variable downloadUri; # DEFAULT: ${baseUri}/${downloadUrn}?...

    if {$force || ![info exists downloadUri]} then {
      set downloadUri [appendArgs \
          {${baseUri}/${downloadUrn}?download&ci=trunk&} \
          {${baseUri}/${downloadUrn}?download&ci=${branchName}&} \
          {[uriEscape filename $fileName]}]
    }

    #
    # NOTE: The URI where a logout request should be sent.  This should
    #       return a payload indicating that the logout was successful.
    #
268
269
270
271
272
273
274
275






























276
277
278
279
280
281
282
286
287
288
289
290
291
292

293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329







-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







      set loginUrn [appendArgs pkgd_login_ $serverId]
      set downloadUrn [appendArgs pkgd_file_ $serverId]
      set logoutUrn [appendArgs pkgd_logout_ $serverId]
    } else {
      #
      # NOTE: Forcibly reset URN variables to their default values.
      #
      setupDownloadUrnVars true
      setupDownloadServerVars true
    }
  }

  #
  # NOTE: This procedure modifies the version variables used by the package
  #       downloader client so that a specific version will be used.  The
  #       versionId argument must consist only of hexadecimal characters.
  #
  # <public>
  proc useVersionId { {versionId ""} } {
    variable branchName

    if {[string length $versionId] > 0 && \
        ![regexp -nocase -- {^[0-9A-F]*$} $versionId]} then {
      error "version Id must be hexadecimal"
    }

    if {[string length $versionId] > 0} then {
      #
      # NOTE: Set the variables to values that should cause the specified
      #       version Id to be used (assume the version Id itself is valid
      #       and active).
      #
      set branchName $versionId; # TODO: Translations here?
    } else {
      #
      # NOTE: Forcibly reset the variables to their default values.
      #
      setupDownloadVersionVars true
    }
  }

  #
  # 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.
1156
1157
1158
1159
1160
1161
1162

1163
1164
1165
1166
1167
1168
1169
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217







+







  #       directory on the package file server and may be an empty string.
  #       The fileNames argument is the list of file names to be downloaded.
  #       The usePgp argument should be non-zero when an OpenPGP signature
  #       needs to be verified for the downloaded file.
  #
  proc downloadAllPlatforms { language version packageName fileNames usePgp } {
    variable baseUri
    variable branchName
    variable platformsUri
    variable platformsUrn
    variable temporaryRootDirectory

    set temporaryDirectory [file join \
        $temporaryRootDirectory [appendArgs \
        pkgd_plat_ [::PackageRepository::getUniqueSuffix]]]
1289
1290
1291
1292
1293
1294
1295

1296
1297
1298
1299
1300
1301
1302
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351







+







  #       file should be written.  The usePgp argument should be non-zero when
  #       the OpenPGP signature file needs to be verified for the downloaded
  #       file.
  #
  proc downloadOneFile {
          language version platform fileName localFileName usePgp } {
    variable baseUri
    variable branchName
    variable downloadUri
    variable downloadUrn

    #
    # NOTE: First, build the full relative file name to download from
    #       the remote package repository.
    #
1547
1548
1549
1550
1551
1552
1553
1554
1555


1556


1557

1558
1559
1560
1561
1562
1563
1564
1596
1597
1598
1599
1600
1601
1602


1603
1604
1605
1606
1607

1608
1609
1610
1611
1612
1613
1614
1615







-
-
+
+

+
+
-
+








  #
  # NOTE: Setup the variables, within this namespace, used by this script.
  #
  setupDownloadVars [info script]

  #
  # NOTE: Setup the URI and URN variables, within this namespace, used by
  #       this script.
  # NOTE: Setup the server, version, and URI variables, in this namespace,
  #       that are used by this script.
  #
  setupDownloadServerVars false
  setupDownloadVersionVars false
  setupDownloadUriVars false; setupDownloadUrnVars false
  setupDownloadUriVars false

  #
  # NOTE: If necessary, add the package persistence root directory to the
  #       auto-path for the current language.  This will only be done if
  #       it falls outside of the existing auto-path.
  #
  variable persistentRootDirectory