Diff

Differences From Artifact [67f47fd5d7]:

To Artifact [bf14c565da]:


18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
set entity_fieldnames([list package arch]) "Platform"
set entity_fieldnames([list entity]) "What"

# Index all packages
proc teapot_index {srcdir} {
	array set pkginfo [list]

	foreach pkgdir [glob -directory $srcdir -type d */out/*] {
		unset -nocomplain currpkginfo
		set currpkginfo(pkgdir) $pkgdir

		set teapot [file join $pkgdir teapot.txt]

		set multifile 1
		if {![file exists $teapot]} {







|







18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
set entity_fieldnames([list package arch]) "Platform"
set entity_fieldnames([list entity]) "What"

# Index all packages
proc teapot_index {srcdir} {
	array set pkginfo [list]

	foreach pkgdir [glob -directory $srcdir -type d */*/*] {
		unset -nocomplain currpkginfo
		set currpkginfo(pkgdir) $pkgdir

		set teapot [file join $pkgdir teapot.txt]

		set multifile 1
		if {![file exists $teapot]} {
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
					set currpkginfo(name) $name
					set currpkginfo(vers) $vers
				}
				"META" {
					set var [string tolower [lindex $line 1]]
					set val [lrange $line 2 end]

					set currpkginfo($var) $val
				}
			}
		}

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








|







83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
					set currpkginfo(name) $name
					set currpkginfo(vers) $vers
				}
				"META" {
					set var [string tolower [lindex $line 1]]
					set val [lrange $line 2 end]

					lappend currpkginfo($var) $val
				}
			}
		}

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

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
		}

		lappend pkglist $addent
	}

	set pkglist [lsort -dictionary $pkglist]


	set fd [open $indexfile w]
	puts $fd "<html>"
	puts $fd "  <head>"
	puts $fd "    <title>List of all entities</title>"
	puts $fd "  </head>"
	puts $fd "  <body>"
	puts $fd [generate_tpm $pkglist]
	puts $fd "    <h1>List of all entities</h1>"
	puts $fd "    <table>"
	puts $fd [generate_table $pkglist 1]
	puts $fd "    </table>"
	puts $fd "  </body>"
	puts $fd "</html>"
	close $fd

	file delete -- $altindexfile
	file mkdir [file dirname $altindexfile]

	file link -hard $altindexfile $indexfile
}

# Create "package/list"
proc create_output_pkglist {dstdir pkginfo_arrlist} {
	array set pkginfo $pkginfo_arrlist








>















<

>







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
		}

		lappend pkglist $addent
	}

	set pkglist [lsort -dictionary $pkglist]

	file mkdir [file dirname $indexfile]
	set fd [open $indexfile w]
	puts $fd "<html>"
	puts $fd "  <head>"
	puts $fd "    <title>List of all entities</title>"
	puts $fd "  </head>"
	puts $fd "  <body>"
	puts $fd [generate_tpm $pkglist]
	puts $fd "    <h1>List of all entities</h1>"
	puts $fd "    <table>"
	puts $fd [generate_table $pkglist 1]
	puts $fd "    </table>"
	puts $fd "  </body>"
	puts $fd "</html>"
	close $fd


	file mkdir [file dirname $altindexfile]
	file delete -force -- $altindexfile
	file link -hard $altindexfile $indexfile
}

# Create "package/list"
proc create_output_pkglist {dstdir pkginfo_arrlist} {
	array set pkginfo $pkginfo_arrlist

315
316
317
318
319
320
321
322
323
324
325
326
327
328
329

				file delete -- $extfile
				exec zip -r $extfile . -x build.log
			} err]} {
				puts "Error while zipping: $err"
			}
		} else {
			set origfile [lindex [glob $pkgdir *] 0]

			file copy -force -- $origfile $extfile
		}

		file delete -- $regfile
		file link -hard $regfile $extfile
	}







|







316
317
318
319
320
321
322
323
324
325
326
327
328
329
330

				file delete -- $extfile
				exec zip -r $extfile . -x build.log
			} err]} {
				puts "Error while zipping: $err"
			}
		} else {
			set origfile [lindex [glob -directory $pkgdir *] 0]

			file copy -force -- $origfile $extfile
		}

		file delete -- $regfile
		file link -hard $regfile $extfile
	}
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
			set pathname_tail "file"
		}
		set pathname_uri "/$pathname_dir/$pathname_tail"

		puts $fd "    <h1>Details of $entity_type [join $dispname_list]</h1>"
		puts $fd "    <p><a href=\"$pathname_uri\">Package archive</a></p>"
		puts $fd "    <p>Details</p>"
		puts $fd "    <table border=\"1\">"
		puts $fd "      <tr>"
		puts $fd "        <th>Key</th>"
		puts $fd "        <th>Value</th>"
		puts $fd "      </tr>"

		foreach descfield [list rsk::build::date category description license platform require summary] {
			if {![info exists currpkginfo($descfield)]} {
				continue
			}
			set descval $currpkginfo($descfield)
			switch -- $descfield {
				"require" {
					catch {
						set descval [join $descval {, }]
					}
				}
			}

			puts $fd "      <tr>"
			puts $fd "        <td>$descfield</td>"

			puts $fd "        <td>$descval</td>"
			puts $fd "      </tr>"
		}
		puts $fd "    </table>"
	}

	puts $fd "  </body>"
	puts $fd "</html>"







|





|





|

|






<
|







454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481

482
483
484
485
486
487
488
489
			set pathname_tail "file"
		}
		set pathname_uri "/$pathname_dir/$pathname_tail"

		puts $fd "    <h1>Details of $entity_type [join $dispname_list]</h1>"
		puts $fd "    <p><a href=\"$pathname_uri\">Package archive</a></p>"
		puts $fd "    <p>Details</p>"
		puts $fd "    <table border=\"1\" cellpadding=\"5\">"
		puts $fd "      <tr>"
		puts $fd "        <th>Key</th>"
		puts $fd "        <th>Value</th>"
		puts $fd "      </tr>"

		foreach descfield [list rsk::build::date as::author as::build::date as::origin category description license platform require summary] {
			if {![info exists currpkginfo($descfield)]} {
				continue
			}
			set descval $currpkginfo($descfield)
			switch -- $descfield {
				"require" - "as::author" - "as::origin" {
					catch {
						set descval [join $descval]
					}
				}
			}

			puts $fd "      <tr>"
			puts $fd "        <td>$descfield</td>"

			puts $fd "        <td>[join $descval "<br>"]</td>"
			puts $fd "      </tr>"
		}
		puts $fd "    </table>"
	}

	puts $fd "  </body>"
	puts $fd "</html>"