Changes In Branch private
Excluding Merge-Ins
This is equivalent to a diff from
8e422c69d7
to be047fad60
Added build/utils/download-tclkit.tcl version [092ef76dba].
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
#!/usr/bin/env tclsh
# Tclkit Downloader v0.2.2 -- download Tclkits created with the KitCreator
# Web Interface. Works with Tcl 8.5+ and Jim Tcl v0.75+. This script requires
# that cURL be available through [exec curl].
# Copyright (C) 2016, dbohdan.
# License: MIT.
proc download url {
if {![string match */buildinfo $url]} {
# Guess at what the buildinfo URL might be if we are given, e.g., a
# building page URL.
set url [string map {/building {}} $url]
set checksum {}
foreach piece [split $url /] {
if {[regexp {^[a-z0-9]{40}$} $piece checksum]} {
break
}
}
if {$checksum eq {}} {
error "can't determine how to get the from the URL \"$url\" to the\
buildinfo"
}
set url [regexp -inline "^.*$checksum" $url]/buildinfo
}
set buildInfo [exec curl -s $url]
set filename [dict get $buildInfo filename]
append filename -[dict get $buildInfo tcl_version]
append filename -[dict get $buildInfo platform]
if {[llength [dict get $buildInfo packages]] > 0} {
foreach option {staticpkgs threaded debug} {
if {[dict exists $buildInfo options $option] &&
[dict get $buildInfo options $option]} {
append filename -$option
}
}
append filename -[join [dict get $buildInfo packages] -]
}
set tail [file tail $url]
# We can't use [file dirname] here because it will transform
# "http://example.com/" into "http:/example.com/".
set baseUrl [string range $url 0 end-[string length $tail]]
if {[string index $baseUrl end] ne {/}} {
append baseUrl /
}
set tclkit $baseUrl[dict get $buildInfo filename]
puts "Downloading $tclkit to $filename..."
exec curl -o $filename $tclkit >@ stdout 2>@ stderr
catch {exec chmod +x $filename}
}
set url [lindex $argv 0]
if {$url eq {}} {
puts "usage: $argv0 url"
puts {The URL should be a KitCreator Web Interface buildinfo page.\
If it is instead, e.g., a building page or a direct Tclkit download\
URL, the script will try to guess where the buildinfo is.}
} else {
download $url
}
|
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
Deleted build/utils/kitcreator-downloader.tcl version [d8b2ec6c7d].
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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
|
|
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
|
#!/usr/bin/env tclsh
# KitCreator downloader v0.2.2 -- download Tclkits created with the KitCreator
# Web Interface. Works with Tcl 8.5+ and Jim Tcl v0.75+. This script requires
# that cURL be available through [exec curl].
# Copyright (C) 2016, dbohdan.
# License: MIT.
proc download url {
if {![string match */buildinfo $url]} {
# Guess at what the buildinfo URL might be if we are given, e.g., a
# building page URL.
set url [string map {/building {}} $url]
set checksum {}
foreach piece [split $url /] {
if {[regexp {^[a-z0-9]{40}$} $piece checksum]} {
break
}
}
if {$checksum eq {}} {
error "can't determine how to get the from the URL \"$url\" to the\
buildinfo"
}
set url [regexp -inline "^.*$checksum" $url]/buildinfo
}
set buildInfo [exec curl -s $url]
set filename [dict get $buildInfo filename]
append filename -[dict get $buildInfo tcl_version]
append filename -[dict get $buildInfo platform]
if {[llength [dict get $buildInfo packages]] > 0} {
foreach option {staticpkgs threaded debug} {
if {[dict exists $buildInfo options $option] &&
[dict get $buildInfo options $option]} {
append filename -$option
}
}
append filename -[join [dict get $buildInfo packages] -]
}
set tail [file tail $url]
# We can't use [file dirname] here because it will transform
# "http://example.com/" into "http:/example.com/".
set baseUrl [string range $url 0 end-[string length $tail]]
if {[string index $baseUrl end] ne {/}} {
append baseUrl /
}
set tclkit $baseUrl[dict get $buildInfo filename]
puts "Downloading $tclkit to $filename..."
exec curl -o $filename $tclkit >@ stdout 2>@ stderr
catch {exec chmod +x $filename}
}
set url [lindex $argv 0]
if {$url eq {}} {
puts "usage: $argv0 url"
puts {The URL should be a KitCreator Web Interface buildinfo page.\
If it is instead, e.g., a building page or a direct Tclkit download\
URL, the script will try to guess where the buildinfo is.}
} else {
download $url
}
|