Check-in [83a6196bd7]
Overview
Comment:Cleanup and updated to use a random filename
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:83a6196bd7ce4b98bcc7862afdf8e175c9989b7e
User & Date: rkeene on 2014-11-05 18:39:52
Other Links: manifest | tags
Context
2014-11-05
21:15
Updated to normalize "noarch" and not error out for all packages if one cannot be normalized check-in: 7357a0fcfc user: rkeene tags: trunk
18:39
Cleanup and updated to use a random filename check-in: 83a6196bd7 user: rkeene tags: trunk
18:39
Updated to hide commands which are not used and may cause slow-ness check-in: c3c642f5c8 user: rkeene tags: trunk
Changes

Modified appfsd.tcl from [d941737404] to [7c607fdb04].

    30     30   			set filekey [_hash_sep $filekey]
    31     31   		}
    32     32   
    33     33   		set file [file join $::appfs::cachedir $filekey]
    34     34   
    35     35   		file mkdir [file dirname $file]
    36     36   
    37         -		if {![file exists $file]} {
    38         -			set tmpfile "${file}.new"
    39         -
    40         -			set fd [open $tmpfile "w"]
    41         -			fconfigure $fd -translation binary
    42         -
    43         -			catch {
    44         -				set token [::http::geturl $url -channel $fd -binary true]
    45         -			}
    46         -
    47         -			if {[info exists token]} {
    48         -				set ncode [::http::ncode $token]
    49         -				::http::reset $token
    50         -			} else {
    51         -				set ncode "900"
    52         -			}
    53         -
    54         -			close $fd
    55         -
    56         -			if {$keyIsHash} {
    57         -				set hash [string tolower [sha1::sha1 -hex -file $tmpfile]]
    58         -			} else {
    59         -				set hash $key
    60         -			}
    61         -
    62         -			if {$ncode == "200" && $hash == $key} {
    63         -				file rename -force -- $tmpfile $file
    64         -			} else {
    65         -				file delete -force -- $tmpfile
    66         -			}
           37  +		if {[file exists $file]} {
           38  +			return $file
           39  +		}
           40  +
           41  +		set tmpfile "${file}.[expr {rand()}]"
           42  +
           43  +		set fd [open $tmpfile "w"]
           44  +		fconfigure $fd -translation binary
           45  +
           46  +		catch {
           47  +			set token [::http::geturl $url -channel $fd -binary true]
           48  +		}
           49  +
           50  +		if {[info exists token]} {
           51  +			set ncode [::http::ncode $token]
           52  +			::http::reset $token
           53  +		} else {
           54  +			set ncode "900"
           55  +		}
           56  +
           57  +		close $fd
           58  +
           59  +		if {$keyIsHash} {
           60  +			set hash [string tolower [sha1::sha1 -hex -file $tmpfile]]
           61  +		} else {
           62  +			set hash $key
           63  +		}
           64  +
           65  +		if {$ncode == "200" && $hash == $key} {
           66  +			file rename -force -- $tmpfile $file
           67  +		} else {
           68  +			file delete -force -- $tmpfile
    67     69   		}
    68     70   
    69     71   		return $file
    70     72   	}
    71     73   
    72     74   
    73     75   	proc _isHash {value} {