97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
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
|
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
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
145
146
|
-
+
+
-
+
-
+
-
+
+
-
+
-
+
|
#
return [file join [file dirname [info library]] 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 file to check, which may or may not exist. The nameOnly
# argument should be non-zero to ignore the contents of the file.
#
proc isPgpSignatureFileName { fileName } {
proc isPgpSignatureFileName { fileName nameOnly } {
if {[string length $fileName] == 0} then {
return false
}
set extension [file extension $fileName]
if {$extension eq ".asc"} then {
if {[file exists $fileName]} then {
if {!$nameOnly && [file exists $fileName]} then {
return [::PackageRepository::isPgpSignature [readFile $fileName]]
} else {
return true
}
} else {
return false
}
}
#
# NOTE: This procedure returns non-zero if the specified file seems to be
# a Harpy script certificate file. The fileName argument is the name
# of the file to check, which may or may not exist.
# 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.
#
proc isHarpyCertificateFileName { fileName } {
proc isHarpyCertificateFileName { fileName nameOnly } {
if {[string length $fileName] == 0} then {
return false
}
set extension [file extension $fileName]
if {$extension eq ".harpy"} then {
if {[file exists $fileName]} then {
if {!$nameOnly && [file exists $fileName]} then {
return [::PackageRepository::isHarpyCertificate [readFile $fileName]]
} else {
return true
}
} else {
return false
}
|
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
|
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
|
-
+
|
[::PackageRepository::getFileViaHttp $uri 10 stdout $quiet]
}
#
# NOTE: Is use of OpenPGP for signature verification enabled? Also,
# did we just download an OpenPGP signature file?
#
if {$usePgp && [isPgpSignatureFileName $localFileName]} then {
if {$usePgp && [isPgpSignatureFileName $localFileName true]} then {
#
# NOTE: Attempt to verify the OpenPGP signature. If this fails,
# an error is raised.
#
if {![::PackageRepository::verifyPgpSignature $localFileName]} then {
error [appendArgs \
"bad PGP signature \"" $localFileName \"]
|
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
|
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
|
-
+
|
file mkdir [file dirname $downloadFileName]
downloadOneFile $language $version $fileName $downloadFileName $usePgp
lappend downloadedFileNames [list \
$fileNameOnly $directory(temporary) $directory(persistent)]
if {$usePgp && ![isPgpSignatureFileName $downloadFileName]} then {
if {$usePgp && ![isPgpSignatureFileName $downloadFileName true]} then {
downloadOneFile $language $version [appendArgs $fileName .asc] \
[appendArgs $downloadFileName .asc] $usePgp
lappend downloadedFileNames [list \
[appendArgs $fileNameOnly .asc] $directory(temporary) \
$directory(persistent)]
}
|