Diff

Differences From Artifact [604641f8e6]:

To Artifact [10ad08f811]:


    58     58   		if {![info exists ::appfs::db]} {
    59     59   			file mkdir $::appfs::cachedir
    60     60   
    61     61   			sqlite3 ::appfs::db [file join $::appfs::cachedir cache.db]
    62     62   		}
    63     63   
    64     64   		_db eval {CREATE TABLE IF NOT EXISTS packages(hostname, sha1, package, version, os, cpuArch, isLatest, haveManifest);}
    65         -		_db eval {CREATE TABLE IF NOT EXISTS files(package_sha1, type, time, source, size, file_sha1, file_name, file_directory);}
           65  +		_db eval {CREATE TABLE IF NOT EXISTS files(package_sha1, type, time, source, size, perms, file_sha1, file_name, file_directory);}
    66     66   	}
    67     67   
    68     68   	proc download {hostname hash {method sha1}} {
    69     69   		set url "http://$hostname/appfs/$method/$hash"
    70     70   		set file [_cachefile $url $hash]
    71     71   
    72     72   		if {![file exists $file]} {
................................................................................
   180    180   			set fileInfo(directory) [join [lrange $fileInfo(name) 0 end-1] "/"]
   181    181   			set fileInfo(name) [lindex $fileInfo(name) end]
   182    182   
   183    183   			set work [lrange $work 2 end-1]
   184    184   			switch -- $fileInfo(type) {
   185    185   				"file" {
   186    186   					set fileInfo(size) [lindex $work 0]
   187         -					set fileInfo(sha1) [lindex $work 1]
          187  +					set fileInfo(perms) [lindex $work 1]
          188  +					set fileInfo(sha1) [lindex $work 2]
   188    189   				}
   189    190   				"symlink" {
   190    191   					set fileInfo(source) [lindex $work 0]
   191    192   				}
   192    193   			}
   193    194   
   194         -			_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) );}
          195  +			_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) );}
   195    196   			_db eval {UPDATE packages SET haveManifest = 1 WHERE sha1 = $package_sha1;}
   196    197   		}
   197    198   
   198    199   		return COMPLETE
   199    200   	}
   200    201   }