Check-in [83a6196bd7]
Overview
Comment:Cleanup and updated to use a random filename
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 83a6196bd7ce4b98bcc7862afdf8e175c9989b7e
User & Date: rkeene on 2014-11-05 18:39:52.768
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
30
31
32
33
34
35
36
37



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
			set filekey [_hash_sep $filekey]
		}

		set file [file join $::appfs::cachedir $filekey]

		file mkdir [file dirname $file]

		if {![file exists $file]} {



			set tmpfile "${file}.new"

			set fd [open $tmpfile "w"]
			fconfigure $fd -translation binary

			catch {
				set token [::http::geturl $url -channel $fd -binary true]
			}

			if {[info exists token]} {
				set ncode [::http::ncode $token]
				::http::reset $token
			} else {
				set ncode "900"
			}

			close $fd

			if {$keyIsHash} {
				set hash [string tolower [sha1::sha1 -hex -file $tmpfile]]
			} else {
				set hash $key
			}

			if {$ncode == "200" && $hash == $key} {
				file rename -force -- $tmpfile $file
			} else {
				file delete -force -- $tmpfile
			}
		}

		return $file
	}


	proc _isHash {value} {







|
>
>
>
|

|
|

|
|
|

|
|
|
|
|
|

|

|
|
|
|
|

|
|
|
|
<







30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68

69
70
71
72
73
74
75
			set filekey [_hash_sep $filekey]
		}

		set file [file join $::appfs::cachedir $filekey]

		file mkdir [file dirname $file]

		if {[file exists $file]} {
			return $file
		}

		set tmpfile "${file}.[expr {rand()}]"

		set fd [open $tmpfile "w"]
		fconfigure $fd -translation binary

		catch {
			set token [::http::geturl $url -channel $fd -binary true]
		}

		if {[info exists token]} {
			set ncode [::http::ncode $token]
			::http::reset $token
		} else {
			set ncode "900"
		}

		close $fd

		if {$keyIsHash} {
			set hash [string tolower [sha1::sha1 -hex -file $tmpfile]]
		} else {
			set hash $key
		}

		if {$ncode == "200" && $hash == $key} {
			file rename -force -- $tmpfile $file
		} else {
			file delete -force -- $tmpfile

		}

		return $file
	}


	proc _isHash {value} {