350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
|
}
return [eval ::PackageRepository::getFileViaHttp \
[list $uri] [list 20] [list stdout] [list $quiet] $options]
}
}
#
# NOTE: This procedure resets the currently configured login cookie, if
# any, and then attempts to login using the configured package
# repository server API key -OR- using the public access account.
# Upon success, it will set the login cookie to the one from the
# raw response data. Upon failure, a script error will be raised.
# There are no arguments.
#
# <public>
proc resetCookieAndLoginSimple {} {
variable publicPassword
variable publicUserName
set apiKey [lindex [::PackageRepository::getLookupApiKeys] 0]
if {[string length $apiKey] > 0} then {
return [resetCookieAndLogin $apiKey $apiKey]
}
if {[string length $publicUserName] > 0 && \
[string length $publicPassword] > 0} then {
return [resetCookieAndLogin $publicUserName $publicPassword]
}
error "missing API key and no public login credentials configured"
}
#
# NOTE: This procedure resets the currently configured login cookie, if
# any, and then attempts to login using the specified user name and
# password. Upon success, it will set the login cookie to the one
# from the raw response data. Upon failure, a script error will be
|
>
>
>
>
>
>
>
>
>
|
>
|
|
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
|
}
return [eval ::PackageRepository::getFileViaHttp \
[list $uri] [list 20] [list stdout] [list $quiet] $options]
}
}
#
# NOTE: This procedure returns the prefix for fully qualified variable
# names that MAY be present in the global namespace. There are
# no arguments.
#
proc getDownloadVarNamePrefix {} {
return ::pkgd_; # TODO: Make non-global?
}
#
# NOTE: This procedure resets the currently configured login cookie, if
# any, and then attempts to login using the configured package
# repository server API key -OR- using the public access account.
# Upon success, it will set the login cookie to the one from the
# raw response data. Upon failure, a script error will be raised.
# There are no arguments.
#
# <public>
proc resetCookieAndLoginSimple {} {
variable publicPassword
variable publicUserName
set apiKey [lindex [::PackageRepository::getApiKeys \
[getDownloadVarNamePrefix]] 0]
if {[string length $apiKey] > 0} then {
return [resetCookieAndLogin $apiKey $apiKey]
}
if {[string length $publicUserName] > 0 && \
[string length $publicPassword] > 0} then {
return [resetCookieAndLogin $publicUserName $publicPassword]
}
error "missing API keys and no public login credentials configured"
}
#
# NOTE: This procedure resets the currently configured login cookie, if
# any, and then attempts to login using the specified user name and
# password. Upon success, it will set the login cookie to the one
# from the raw response data. Upon failure, a script error will be
|