Check-in [a29f966f9d]
Overview
Comment:Updated to only produce TPM header if the package info is complete
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: a29f966f9df915b575718906ee0fbb2512131c1f
User & Date: rkeene on 2010-02-09 21:19:20
Other Links: manifest | tags
Context
2010-02-10
03:00
Updated to give more information for ActiveState packages check-in: 69fb00861c user: rkeene tags: trunk
2010-02-09
21:19
Updated to only produce TPM header if the package info is complete check-in: a29f966f9d user: rkeene tags: trunk
21:03
Updated to build additional HTML files check-in: e7e77fdcbc user: rkeene tags: trunk
Changes

Modified server/teapot_index from [4eb6497cd6] to [67f47fd5d7].

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







-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-

















+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+









-
-
+
+













-
-
+
+








		set pkginfo([list $currpkginfo(name) $currpkginfo(vers) $currpkginfo(platform)]) [array get currpkginfo]
	}

	return [array get pkginfo]
}

proc generate_tpm {entlist} {
	set pkgs [list]
	foreach part $entlist {
		set pkginfo [list]
		foreach enttype $part {
			set pkg [lindex $enttype 0]
			lappend pkginfo $pkg
		}
		lappend pkgs $pkginfo
	}

	set ret {<!-- [[TPM[[}
	append ret $pkgs
	append ret {]]MPT]] -->}

	return $ret
}

proc complete_entpath {type entinfo_arrlist} {
	array set entinfo $entinfo_arrlist

	set req_fields $::entity_definition($type)

	set retval [list $type]

	foreach req_field $req_fields {
		if {![info exists entinfo($req_field)]} {
			return ""
		}

		lappend retval $req_field $entinfo($req_field)
	}

	return $retval
}

proc generate_tpm {entlist} {
	set ents [list]
	foreach part $entlist {
		set entinfo [list]

		foreach enttype $part {
			set type [lindex $enttype 0]
			set ent [lindex $enttype 1]

			if {$type == "entity"} {
				# Only include the entity type if it is complete...
				set work [complete_entpath $ent [join $part]]

				if {$work == ""} {
					continue
				}
			}

			lappend entinfo $ent
		}

		lappend ents $entinfo
	}

	set ret {<!-- [[TPM[[}
	append ret $ents
	append ret {]]MPT]] -->}

	return $ret
}

proc generate_table {fields numitems} {
	set ret ""

	foreach field $fields {
		append ret "      <tr>\n"

		unset -nocomplain entinfo
		foreach enttype [lrange $field 0 [expr $numitems - 1]] {
			set item [lindex $enttype 0]
			set type [lindex $enttype 1]
			set type [lindex $enttype 0]
			set item [lindex $enttype 1]

			set entinfo($type) $item
		}

		if {[info exists entinfo(entity)]} {
			set entity_type $entinfo(entity)

			set req_fields $::entity_definition($entity_type)
		}

		set entpath_parts [list]

		foreach enttype [lrange $field 0 [expr $numitems - 1]] {
			set item [lindex $enttype 0]
			set type [lindex $enttype 1]
			set type [lindex $enttype 0]
			set item [lindex $enttype 1]

			if {$type != "entity"} {
				lappend entpath_parts $type $item
			}

			set complete_entpath_parts ""
			if {[info exists entity_type]} {
190
191
192
193
194
195
196
197

198
199
200
201
202
203
204
203
204
205
206
207
208
209

210
211
212
213
214
215
216
217







-
+








	set indexfile [file join $dstdir index.html]
	set altindexfile [file join $dstdir entity index.html]

	set pkglist [list]
	foreach ent [array names pkginfo] {
		set pkg [lindex $ent 0]
		set addent [list [list $pkg name]]
		set addent [list [list name $pkg]]
		if {[lsearch -exact $pkglist $addent] != -1} {
			continue
		}

		lappend pkglist $addent
	}

237
238
239
240
241
242
243
244

245
246
247
248
249
250
251
250
251
252
253
254
255
256

257
258
259
260
261
262
263
264







-
+








	set pkglist [list]
	foreach ent [array names pkginfo] {
		set pkg [lindex $ent 0]
		set ver [lindex $ent 1]
		set arch [lindex $ent 2]

		lappend pkglist [list [list package entity] [list $pkg name] [list $ver ver] [list $arch arch] [list 0 unknown]]
		lappend pkglist [list [list entity package] [list name $pkg] [list ver $ver] [list arch $arch] [list unknown 0]]
	}

	set pkglist [lsort -dictionary $pkglist]

	set fd [open $indexfile w]
	puts $fd "<html>"
	puts $fd "  <head>"
389
390
391
392
393
394
395
396

397
398

399
400
401
402
403
404
405
402
403
404
405
406
407
408

409
410

411
412
413
414
415
416
417
418







-
+

-
+







			unset -nocomplain currpkginfo
			for {set idx 0} {$idx < [llength $req_fields]} {incr idx} {
				set field [lindex $req_fields $idx]
				set value [lindex $pkgent $idx]
				set currpkginfo($field) $value
			}

			set currpkgdata [list [list $entity_type entity]]
			set currpkgdata [list [list entity $entity_type]]
			foreach dispfield $dispfields {
				lappend currpkgdata [list $currpkginfo($dispfield) $dispfield]
				lappend currpkgdata [list $dispfield $currpkginfo($dispfield)]
			}

			if {[lsearch -exact $pkglist $currpkgdata] != -1} {
				continue
			}

			lappend pkglist $currpkgdata