Diff

Differences From Artifact [604641f8e6]:

To Artifact [10ad08f811]:


58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
...
180
181
182
183
184
185
186

187
188
189
190
191
192
193
194
195
196
197
198
199
200
		if {![info exists ::appfs::db]} {
			file mkdir $::appfs::cachedir

			sqlite3 ::appfs::db [file join $::appfs::cachedir cache.db]
		}

		_db eval {CREATE TABLE IF NOT EXISTS packages(hostname, sha1, package, version, os, cpuArch, isLatest, haveManifest);}
		_db eval {CREATE TABLE IF NOT EXISTS files(package_sha1, type, time, source, size, file_sha1, file_name, file_directory);}
	}

	proc download {hostname hash {method sha1}} {
		set url "http://$hostname/appfs/$method/$hash"
		set file [_cachefile $url $hash]

		if {![file exists $file]} {
................................................................................
			set fileInfo(directory) [join [lrange $fileInfo(name) 0 end-1] "/"]
			set fileInfo(name) [lindex $fileInfo(name) end]

			set work [lrange $work 2 end-1]
			switch -- $fileInfo(type) {
				"file" {
					set fileInfo(size) [lindex $work 0]

					set fileInfo(sha1) [lindex $work 1]
				}
				"symlink" {
					set fileInfo(source) [lindex $work 0]
				}
			}

			_db eval {INSERT INTO files (package_sha1, type, time, source, size, file_sha1, file_name, file_directory) VALUES ($package_sha1, $fileInfo(type), $fileInfo(time), $fileInfo(source), $fileInfo(size), $fileInfo(sha1), $fileInfo(name), $fileInfo(directory) );}
			_db eval {UPDATE packages SET haveManifest = 1 WHERE sha1 = $package_sha1;}
		}

		return COMPLETE
	}
}







|







 







>
|






|






58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
...
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
		if {![info exists ::appfs::db]} {
			file mkdir $::appfs::cachedir

			sqlite3 ::appfs::db [file join $::appfs::cachedir cache.db]
		}

		_db eval {CREATE TABLE IF NOT EXISTS packages(hostname, sha1, package, version, os, cpuArch, isLatest, haveManifest);}
		_db eval {CREATE TABLE IF NOT EXISTS files(package_sha1, type, time, source, size, perms, file_sha1, file_name, file_directory);}
	}

	proc download {hostname hash {method sha1}} {
		set url "http://$hostname/appfs/$method/$hash"
		set file [_cachefile $url $hash]

		if {![file exists $file]} {
................................................................................
			set fileInfo(directory) [join [lrange $fileInfo(name) 0 end-1] "/"]
			set fileInfo(name) [lindex $fileInfo(name) end]

			set work [lrange $work 2 end-1]
			switch -- $fileInfo(type) {
				"file" {
					set fileInfo(size) [lindex $work 0]
					set fileInfo(perms) [lindex $work 1]
					set fileInfo(sha1) [lindex $work 2]
				}
				"symlink" {
					set fileInfo(source) [lindex $work 0]
				}
			}

			_db eval {INSERT INTO files (package_sha1, type, time, source, size, perms, file_sha1, file_name, file_directory) VALUES ($package_sha1, $fileInfo(type), $fileInfo(time), $fileInfo(source), $fileInfo(size), $fileInfo(perms), $fileInfo(sha1), $fileInfo(name), $fileInfo(directory) );}
			_db eval {UPDATE packages SET haveManifest = 1 WHERE sha1 = $package_sha1;}
		}

		return COMPLETE
	}
}