Diff

Differences From Artifact [aaeb907791]:

To Artifact [0b791688aa]:


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
<?




	set sourcedir "/web/rkeene/devel/kitcreator/all"



	foreach file [glob -tails -nocomplain -directory $sourcedir "kitcreator-*.tar.gz"] {
		regexp {^kitcreator-(.*).tar.gz$} $file -> vers
		set kitcreator_versions($vers) $vers
	}
	set kitcreator_version_selected [lindex [lsort -dictionary [array names kitcreator_versions]] end]

	set kitcreator_versions(trunk) "Fossil Trunk Tip"

	set tcl_versions(8.4.19) 8.4.19
	set tcl_versions(8.5.9) 8.5.9
	set tcl_versions(cvs_HEAD) "Fossil Trunk Tip"




	set platforms(linux-x86) "Linux on x86"
	set platforms(linux-amd64) "Linux on amd64"

	set platforms(linux-mipsel) "Linux on MIPSEL"






	set platforms(windows-x86) "Windows on x86"









	set disable {
		platform linux-amd64 tk
		platform linux-mipsel tk





	}

	set specific {
		platform windows-x86 file icon {Kit Icon}
		platform windows-x86 text description {Description}


	}















































































































?><html>
  <head>
    <title>KitCreator, Web Interface</title>











    <script>
<!--















	function verifyOptions() {
		var kitcreator_version;
		var tcl_version;
		var platform;

		kitcreator_version = document.getElementsByName('kitcreator_version')[0].value;
		tcl_version = document.getElementsByName('tcl_version')[0].value;
		platform = document.getElementsByName('platform')[0].value;

























	}
-->
    </script>
  </head>
  <body>
    <h1>KitCreator Web Interface</h1>
    <form method="post" enctype="multipart/form-data">
      <table>
        <tr>
          <td>KitCreator Version:</td>
          <td>
            <select name="kitcreator_version" onChange="verifyOptions();">

>
>
>
>

>
>
>








|
|
|

>
>
>
|
|
>
|
>
>
>
>
>
>
|
>

>
>
>
>
>
>
>

|
|
>
>
>
>
>



|
|
>
>

>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

|
|
>
>
>
>
>
>
>
>
>
>
>


>
>
>
>
>
>
>
>
>
>
>
>
>
>
>









>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>




|







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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
<?
	package require sha1

	load_response args

	set sourcedir "/web/rkeene/devel/kitcreator/all"
	set queue "/home/rkeene/devel/kitcreator/build/web/queue"
	set secretfile "/home/rkeene/etc/kitcreator-web-secret"

	foreach file [glob -tails -nocomplain -directory $sourcedir "kitcreator-*.tar.gz"] {
		regexp {^kitcreator-(.*).tar.gz$} $file -> vers
		set kitcreator_versions($vers) $vers
	}
	set kitcreator_version_selected [lindex [lsort -dictionary [array names kitcreator_versions]] end]

	set kitcreator_versions(trunk) "Fossil Trunk Tip"

	set tcl_versions(8.5.15) 8.5.15
	set tcl_versions(8.6.1) 8.6.1
	set tcl_versions(fossil_trunk) "Fossil Trunk Tip"

	set platforms(android-arm) "Android/ARM"
	set platforms(freebsd-amd64) "FreeBSD/amd64"
	set platforms(hpux-hppa64) "HP-UX/PA-RISC 2.0"
	set platforms(linux-amd64) "Linux/amd64"
	set platforms(linux-arm) "Linux/ARM"
	set platforms(linux-i386) "Linux/i386"
	set platforms(linux-mipsel) "Linux/MIPS"
	set platforms(netbsd-amd64) "NetBSD/amd64"
	set platforms(netbsd-i386) "NetBSD/i386"
	set platforms(solaris-amd64) "Solaris/amd64"
	set platforms(solaris-i386) "Solaris/i386"
	set platforms(solaris-sparc) "Solaris/SPARC"
	set platforms(solaris-sparc64) "Solaris/SPARC64"
	set platforms(win32) "Windows/i386"
	set platforms(win64) "Windows/amd64"

	set packages(tk) "Tk"
	set packages(mk4tcl) "Metakit"
	set packages(tcc4tcl) "tcc4tcl"
	set packages(tls) TLS
	set packages(dbus) D-BUS
	set packages(tclx) TclX

	set disable {
		platform linux-mipsel {tk tcc4tcl}
		platform android-arm tk
		platform netbsd-amd64 {tk tcc4tcl}
		platform netbsd-i386 {tk tcc4tcl}
		platform solaris-sparc tcc4tcl
		platform solaris-sparc64 tcc4tcl
		platform hpux-hppa64 tcc4tcl
	}

	set specific {
		platform win32 file icon {Kit Icon}
		platform win32 text description {Description}
		platform win64 file icon {Kit Icon}
		platform win64 text description {Description}
	}

	if {[info exists args(platform)] && [info exists args(tcl_version)] && [info exist args(kitcreator_version)]} {
		# Read in arguments
		## Mandatory arguments
		set build_platform $args(platform)
		set build_tcl_version $args(tcl_version)
		set build_kitcreator_version $args(kitcreator_version)

		## Optional Arguments
		set build_packages [list]
		set build_options(threaded) 0
		set build_options(kitdll) 0
		foreach arg [array names args] {
			switch -glob -- $arg {
				"option_package_*" {
					set package [join [lrange [split $arg _] 2 end] _]

					lappend build_packages $package
				}
				"option_threaded" {
					set build_options(threaded) 1
				}
				"option_kitdll" {
					set build_options(kitdll) 1
				}
			}
		}
		set build_packages [lsort -dictionary $build_packages]

		# Validate arguments
		if {![info exists platforms($build_platform)]} {
			unset build_platform
		}

		if {![info exists tcl_versions($build_tcl_version)]} {
			unset build_tcl_version
		}

		if {![info exists kitcreator_versions($build_kitcreator_version)]} {
			unset build_kitcreator_version
		}

		foreach package $build_packages {
			if {![info exists packages($package)]} {
				unset build_packages

				break
			}
		}

		# Resolve version numbers to checkin IDs
		## XXX: TODO
		set cache_tcl_version $build_tcl_version
		if {$build_tcl_version == "fossil_trunk"} {
			set cache_tcl_version [clock seconds]
		}

		set cache_kitcreator_version $build_kitcreator_version
		if {$build_kitcreator_version == "trunk"} {
			set cache_kitcreator_version [clock seconds]
		}

		# Generate a serialized hash that represents the state of the build
		## Load a secret so keys cannot be pre-computed (but remain consistent)
		set secretfd [open $secretfile "r"]
		set secret [gets $secretfd]
		close $secretfd

		## Compute basic key	
		set key [list $secret $build_platform $cache_tcl_version $cache_kitcreator_version $build_packages]

		## Update key with options in deterministic order
		foreach option [lsort -dictionary [array names build_options]] {
			lappend key [list "option:$option" $build_options($option)]
		}

		## Convert key to a user-consumable string via hashing
		set key [string tolower [sha1::sha1 -hex $key]]

		# Determine filename
		if {$build_options(kitdll)} {
			set extension "so"
			switch -- $build_platform {
				"win32" - "win64" {
					set extension "dll"
				}
				"hpux-hppa64" {
					set extension "sl"
				}
			}

			## XXX: TODO: The version here needs to match what's in the SONAME
			set filename "libtclkit[string map [list "." ""] ${cache_tcl_version}].${extension}"
		} else {
			set filename "tclkit"

			switch -- $build_platform {
				"win32" - "win64" {
					append filename ".exe"
				}
			}
		}

		# Queue build up and wait for it to complete
		set fd [open $queue a+]
		puts $fd [list filename $filename key $key platform $build_platform tcl_version $build_tcl_version kitcreator_version $build_kitcreator_version packages $build_packages options [array get build_options]]
		close $fd

		set url "http://kitcreator.rkeene.org/kits/building/$key/"

		headers redirect $url
?><html>
	<head>
		<title>KitCreator, Web Interface</title>
	</head>
	<body>
		<h1>KitCreator Web Interface</h1>
		<p>Build in progress, output will be: <a href="<? puts -nonewline $url ?>"><? puts -nonewline $url ?></a></p>
	</body>
</html>
<?
	} else {
?><html>
  <head>
    <title>KitCreator, Web Interface</title>
    <script>
<!--
	function enablePackage(package) {
		var obj;

		obj = document.getElementById('option_package_' + package);
		obj.disabled = false;
	}

	function disablePackage(package) {
		var obj;

		obj = document.getElementById('option_package_' + package);
		obj.checked = false;
		obj.disabled = true;
	}

	function verifyOptions() {
		var kitcreator_version;
		var tcl_version;
		var platform;

		kitcreator_version = document.getElementsByName('kitcreator_version')[0].value;
		tcl_version = document.getElementsByName('tcl_version')[0].value;
		platform = document.getElementsByName('platform')[0].value;

<?
		set alldisabledpackages [list]
		foreach {keyword value disablepackages} $disable {
			foreach package $disablepackages {
				if {[lsearch -exact $alldisabledpackages $package] == -1} {
					lappend alldisabledpackages $package
				}
			}
		}

		foreach package $alldisabledpackages {
			puts "\t\tenablePackage(\"$package\");"
		}

		foreach {keyword value disablepackages} $disable {
			puts "\t\tif ($keyword == \"$value\") \{"

			foreach package $disablepackages {
				puts "\t\t\tdisablePackage(\"$package\");"
			}

			puts "\t\t\}"
		}
?>
	}
-->
    </script>
  </head>
  <body onLoad="verifyOptions();">
    <h1>KitCreator Web Interface</h1>
    <form method="post" enctype="multipart/form-data">
      <table>
        <tr>
          <td>KitCreator Version:</td>
          <td>
            <select name="kitcreator_version" onChange="verifyOptions();">
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
?>
            </select>
          </td>
        </tr>
        <tr>
          <td>Kit Options:</td>
          <td>
            <input type="checkbox" name="option_package_tk">Tk<br>
            <input type="checkbox" name="option_package_itcl">[incr Tcl]<br>
            <input type="checkbox" name="option_package_mk4tcl">Metakit<br>
            <input type="checkbox" name="option_threaded">Threaded<br>
            <input type="checkbox" name="option_kitdll">Build Library (KitDLL)<br>
          </td>
        </tr>
        <tr>
          <td>Kit Icon:</td>
          <td>
            <input type="file" name="platform-windows-x86-icon">
          </td>
        </tr>
        <tr>
          <td>Description:</td>
          <td>
            <input type="text" name="platform-windows-x86-desc">
          </td>
        </tr>
      </table>
      <input type="submit" name="submit" value="Create">
    </form>
  </body>
</html>







|
|
|
|
|





|





|






|
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
?>
            </select>
          </td>
        </tr>
        <tr>
          <td>Kit Options:</td>
          <td>
<?  foreach package [lsort -dictionary [array names packages]] { ?>
            <input type="checkbox" name="option_package_<? puts -nonewline $package ?>" id="option_package_<? puts -nonewline $package ?>">Package: <? puts -nonewline $packages($package) ?><br>
<? } ?>
            <input type="checkbox" name="option_threaded">Kit: Threaded<br>
            <input type="checkbox" name="option_kitdll">Kit: Build Library (KitDLL)<br>
          </td>
        </tr>
        <tr>
          <td>Kit Icon:</td>
          <td>
            <input type="file" name="option_icon">
          </td>
        </tr>
        <tr>
          <td>Description:</td>
          <td>
            <input type="text" name="option_desc">
          </td>
        </tr>
      </table>
      <input type="submit" name="submit" value="Create">
    </form>
  </body>
</html><? } ?>