Overview
| Comment: | Updated to commit package change as a single transaction |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
86819aa4e1bc89c95043b563f16adea6 |
| User & Date: | rkeene on 2014-09-13 05:15:19 |
| Other Links: | manifest | tags |
Context
|
2014-09-14
| ||
| 04:36 | Updated to normalize CPU/OS check-in: ee1a499a2e user: rkeene tags: trunk | |
|
2014-09-13
| ||
| 05:15 | Updated to commit package change as a single transaction check-in: 86819aa4e1 user: rkeene tags: trunk | |
|
2014-09-12
| ||
| 05:39 | Fixed typo in previous commit check-in: a48b533f86 user: rkeene tags: trunk | |
Changes
Modified appfsd.c from [56848bb56b] to [f1b76341ae].
| ︙ | ︙ | |||
9 10 11 12 13 14 15 | #include <unistd.h> #include <errno.h> #include <fcntl.h> #include <stdio.h> #include <fuse.h> #include <tcl.h> | | | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
#include <unistd.h>
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <fuse.h>
#include <tcl.h>
#define APPFS_CACHEDIR "/var/cache/appfs"
#define APPFS_DEBUG(x...) { fprintf(stderr, "[debug] %s:%i:%s: ", __FILE__, __LINE__, __func__); fprintf(stderr, x); fprintf(stderr, "\n"); }
static pthread_key_t interpKey;
struct appfs_thread_data {
sqlite3 *db;
|
| ︙ | ︙ |
Modified appfsd.tcl from [ca9b582274] to [c65cce6320].
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
#! /usr/bin/env tclsh
package require http 2.7
package require sqlite3
namespace eval ::appfs {
variable cachedir "/tmp/appfs-cache"
variable ttl 3600
proc _hash_sep {hash {seps 4}} {
for {set idx 0} {$idx < $seps} {incr idx} {
append retval "[string range $hash [expr {$idx * 2}] [expr {($idx * 2) + 1}]]/"
}
append retval "[string range $hash [expr {$idx * 2}] end]"
| > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
#! /usr/bin/env tclsh
package require http 2.7
package require sqlite3
namespace eval ::appfs {
variable cachedir "/tmp/appfs-cache"
variable ttl 3600
variable nttl 60
proc _hash_sep {hash {seps 4}} {
for {set idx 0} {$idx < $seps} {incr idx} {
append retval "[string range $hash [expr {$idx * 2}] [expr {($idx * 2) + 1}]]/"
}
append retval "[string range $hash [expr {$idx * 2}] end]"
|
| ︙ | ︙ | |||
141 142 143 144 145 146 147 |
}
::http::reset $token
$token cleanup
}
if {![info exists indexhash_data]} {
# Cache this result for 60 seconds
| | | 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
}
::http::reset $token
$token cleanup
}
if {![info exists indexhash_data]} {
# Cache this result for 60 seconds
_db eval {INSERT OR REPLACE INTO sites (hostname, lastUpdate, ttl) VALUES ($hostname, $now, $::appfs::nttl);}
return -code error "Unable to fetch $url"
}
set indexhash [lindex [split $indexhash_data ","] 0]
if {![_isHash $indexhash]} {
|
| ︙ | ︙ | |||
235 236 237 238 239 240 241 242 243 244 245 246 247 248 |
}
set file [download $hostname $package_sha1]
set fd [open $file]
set pkgdata [read $fd]
close $fd
foreach line [split $pkgdata "\n"] {
set line [string trim $line]
if {$line == ""} {
continue
}
| > | 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 |
}
set file [download $hostname $package_sha1]
set fd [open $file]
set pkgdata [read $fd]
close $fd
_db transaction {
foreach line [split $pkgdata "\n"] {
set line [string trim $line]
if {$line == ""} {
continue
}
|
| ︙ | ︙ | |||
271 272 273 274 275 276 277 278 279 280 281 |
set fileInfo(name) [split [string trim $fileInfo(name) "/"] "/"]
set fileInfo(directory) [join [lrange $fileInfo(name) 0 end-1] "/"]
set fileInfo(name) [lindex $fileInfo(name) end]
_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
}
}
| > | 273 274 275 276 277 278 279 280 281 282 283 284 |
set fileInfo(name) [split [string trim $fileInfo(name) "/"] "/"]
set fileInfo(directory) [join [lrange $fileInfo(name) 0 end-1] "/"]
set fileInfo(name) [lindex $fileInfo(name) end]
_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
}
}
|