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     94   
    95     95   		set pkginfo([list $currpkginfo(name) $currpkginfo(vers) $currpkginfo(platform)]) [array get currpkginfo]
    96     96   	}
    97     97   
    98     98   	return [array get pkginfo]
    99     99   }
   100    100   
   101         -proc generate_tpm {entlist} {
   102         -	set pkgs [list]
   103         -	foreach part $entlist {
   104         -		set pkginfo [list]
   105         -		foreach enttype $part {
   106         -			set pkg [lindex $enttype 0]
   107         -			lappend pkginfo $pkg
   108         -		}
   109         -		lappend pkgs $pkginfo
   110         -	}
   111         -
   112         -	set ret {<!-- [[TPM[[}
   113         -	append ret $pkgs
   114         -	append ret {]]MPT]] -->}
   115         -
   116         -	return $ret
   117         -}
   118         -
   119    101   proc complete_entpath {type entinfo_arrlist} {
   120    102   	array set entinfo $entinfo_arrlist
   121    103   
   122    104   	set req_fields $::entity_definition($type)
   123    105   
   124    106   	set retval [list $type]
   125    107   
................................................................................
   129    111   		}
   130    112   
   131    113   		lappend retval $req_field $entinfo($req_field)
   132    114   	}
   133    115   
   134    116   	return $retval
   135    117   }
          118  +
          119  +proc generate_tpm {entlist} {
          120  +	set ents [list]
          121  +	foreach part $entlist {
          122  +		set entinfo [list]
          123  +
          124  +		foreach enttype $part {
          125  +			set type [lindex $enttype 0]
          126  +			set ent [lindex $enttype 1]
          127  +
          128  +			if {$type == "entity"} {
          129  +				# Only include the entity type if it is complete...
          130  +				set work [complete_entpath $ent [join $part]]
          131  +
          132  +				if {$work == ""} {
          133  +					continue
          134  +				}
          135  +			}
          136  +
          137  +			lappend entinfo $ent
          138  +		}
          139  +
          140  +		lappend ents $entinfo
          141  +	}
          142  +
          143  +	set ret {<!-- [[TPM[[}
          144  +	append ret $ents
          145  +	append ret {]]MPT]] -->}
          146  +
          147  +	return $ret
          148  +}
   136    149   
   137    150   proc generate_table {fields numitems} {
   138    151   	set ret ""
   139    152   
   140    153   	foreach field $fields {
   141    154   		append ret "      <tr>\n"
   142    155   
   143    156   		unset -nocomplain entinfo
   144    157   		foreach enttype [lrange $field 0 [expr $numitems - 1]] {
   145         -			set item [lindex $enttype 0]
   146         -			set type [lindex $enttype 1]
          158  +			set type [lindex $enttype 0]
          159  +			set item [lindex $enttype 1]
   147    160   
   148    161   			set entinfo($type) $item
   149    162   		}
   150    163   
   151    164   		if {[info exists entinfo(entity)]} {
   152    165   			set entity_type $entinfo(entity)
   153    166   
   154    167   			set req_fields $::entity_definition($entity_type)
   155    168   		}
   156    169   
   157    170   		set entpath_parts [list]
   158    171   
   159    172   		foreach enttype [lrange $field 0 [expr $numitems - 1]] {
   160         -			set item [lindex $enttype 0]
   161         -			set type [lindex $enttype 1]
          173  +			set type [lindex $enttype 0]
          174  +			set item [lindex $enttype 1]
   162    175   
   163    176   			if {$type != "entity"} {
   164    177   				lappend entpath_parts $type $item
   165    178   			}
   166    179   
   167    180   			set complete_entpath_parts ""
   168    181   			if {[info exists entity_type]} {
................................................................................
   190    203   
   191    204   	set indexfile [file join $dstdir index.html]
   192    205   	set altindexfile [file join $dstdir entity index.html]
   193    206   
   194    207   	set pkglist [list]
   195    208   	foreach ent [array names pkginfo] {
   196    209   		set pkg [lindex $ent 0]
   197         -		set addent [list [list $pkg name]]
          210  +		set addent [list [list name $pkg]]
   198    211   		if {[lsearch -exact $pkglist $addent] != -1} {
   199    212   			continue
   200    213   		}
   201    214   
   202    215   		lappend pkglist $addent
   203    216   	}
   204    217   
................................................................................
   237    250   
   238    251   	set pkglist [list]
   239    252   	foreach ent [array names pkginfo] {
   240    253   		set pkg [lindex $ent 0]
   241    254   		set ver [lindex $ent 1]
   242    255   		set arch [lindex $ent 2]
   243    256   
   244         -		lappend pkglist [list [list package entity] [list $pkg name] [list $ver ver] [list $arch arch] [list 0 unknown]]
          257  +		lappend pkglist [list [list entity package] [list name $pkg] [list ver $ver] [list arch $arch] [list unknown 0]]
   245    258   	}
   246    259   
   247    260   	set pkglist [lsort -dictionary $pkglist]
   248    261   
   249    262   	set fd [open $indexfile w]
   250    263   	puts $fd "<html>"
   251    264   	puts $fd "  <head>"
................................................................................
   389    402   			unset -nocomplain currpkginfo
   390    403   			for {set idx 0} {$idx < [llength $req_fields]} {incr idx} {
   391    404   				set field [lindex $req_fields $idx]
   392    405   				set value [lindex $pkgent $idx]
   393    406   				set currpkginfo($field) $value
   394    407   			}
   395    408   
   396         -			set currpkgdata [list [list $entity_type entity]]
          409  +			set currpkgdata [list [list entity $entity_type]]
   397    410   			foreach dispfield $dispfields {
   398         -				lappend currpkgdata [list $currpkginfo($dispfield) $dispfield]
          411  +				lappend currpkgdata [list $dispfield $currpkginfo($dispfield)]
   399    412   			}
   400    413   
   401    414   			if {[lsearch -exact $pkglist $currpkgdata] != -1} {
   402    415   				continue
   403    416   			}
   404    417   
   405    418   			lappend pkglist $currpkgdata