Check-in [749ff2a6ed]
Overview
Comment:Updated to change the "platform" symlink to point to noarch-noarch if it is the only platform offered
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:749ff2a6ed8907088a4bf8944565b36b92eda31f
User & Date: rkeene on 2014-11-18 04:28:55
Other Links: manifest | tags
Context
2014-11-18
15:09
Added documentation on index format check-in: 5ec33cd653 user: rkeene tags: trunk
04:28
Updated to change the "platform" symlink to point to noarch-noarch if it is the only platform offered check-in: 749ff2a6ed user: rkeene tags: trunk
03:21
Updated to include build script in the AppFS appfs package check-in: 5e29d51203 user: rkeene tags: trunk
Changes

Modified appfsd.tcl from [ef3b70a74a] to [eb68884ad6].

    43     43   }
    44     44   
    45     45   namespace eval ::appfs {
    46     46   	variable cachedir "/tmp/appfs-cache"
    47     47   	variable ttl 3600
    48     48   	variable nttl 60
    49     49   	variable trusted_cas [list]
           50  +	variable platform [::platform::generic]
    50     51   
    51     52   	proc _hash_sep {hash {seps 4}} {
    52     53   		for {set idx 0} {$idx < $seps} {incr idx} {
    53     54   			append retval "[string range $hash [expr {$idx * 2}] [expr {($idx * 2) + 1}]]/"
    54     55   		}
    55     56   		append retval "[string range $hash [expr {$idx * 2}] end]"
    56     57   
................................................................................
   139    140   		if {![::pki::x509::verify_cert $certificate $::appfs::trusted_cas]} {
   140    141   			return false
   141    142   		}
   142    143   
   143    144   		return true
   144    145   	}
   145    146   
   146         -	proc _normalizeOS {os} {
          147  +	proc _normalizeOS {os {tolerant 0}} {
   147    148   		set os [string tolower [string trim $os]]
   148    149   
   149    150   		switch -- $os {
   150    151   			"linux" - "freebsd" - "openbsd" - "netbsd" {
   151    152   				return $os
   152    153   			}
   153    154   			"sunos" {
   154    155   				return "solaris"
   155    156   			}
   156    157   			"noarch" - "none" - "any" - "all" {
   157    158   				return "noarch"
   158    159   			}
   159    160   		}
          161  +
          162  +		if {$tolerant} {
          163  +			return $os
          164  +		}
   160    165   
   161    166   		return -code error "Unable to normalize OS: $os"
   162    167   	}
   163    168   
   164         -	proc _normalizeCPU {cpu} {
          169  +	proc _normalizeCPU {cpu {tolerant 0}} {
   165    170   		set cpu [string tolower [string trim $cpu]]
   166    171   
   167    172   		switch -glob -- $cpu {
   168    173   			"i?86" {
   169    174   				return "ix86"
   170    175   			}
   171    176   			"x86_64" {
   172    177   				return $cpu
   173    178   			}
   174    179   			"noarch" - "none" - "any" - "all" {
   175    180   				return "noarch"
   176    181   			}
   177    182   		}
          183  +
          184  +		if {$tolerant} {
          185  +			return $cpu
          186  +		}
   178    187   
   179    188   		return -code error "Unable to normalize CPU: $cpu"
   180    189   	}
   181    190   
   182    191   	proc _as_user {code} {
   183    192   		::appfsd::simulate_user_fs_enter
   184    193   
................................................................................
   524    533   					set retval(_children) os-cpu
   525    534   					set retval(_type) packages
   526    535   
   527    536   					if {$pathlen > 2} {
   528    537   						set os_cpu [lindex $path 2]
   529    538   						set os_cpu [split $os_cpu "-"]
   530    539   
   531         -						set retval(os) [lindex $os_cpu 0]
   532         -						set retval(cpu) [lindex $os_cpu 1]
          540  +						set retval(os) [_normalizeOS [lindex $os_cpu 0] 1]
          541  +						set retval(cpu) [_normalizeCPU [lindex $os_cpu 1] 1]
   533    542   						set retval(_children) versions
   534    543   						set retval(_type) os-cpu
   535    544   
   536    545   						if {$pathlen > 3} {
   537    546   							set retval(version) [lindex $path 3]
   538    547   							set retval(_children) files
   539    548   							set retval(_type) versions
................................................................................
   670    679   				if {$check == "1"} {
   671    680   					set retval(type) directory
   672    681   					set retval(childcount) [llength [getchildren $path]]
   673    682   				}
   674    683   			}
   675    684   			"os-cpu" {
   676    685   				if {$pathinfo(os) == "platform" && $pathinfo(cpu) == ""} {
          686  +					set check [::appfs::db eval {
          687  +						SELECT DISTINCT os, cpuArch FROM packages WHERE hostname = $pathinfo(hostname) AND package = $pathinfo(package);
          688  +					}]
          689  +
   677    690   					set retval(type) symlink
   678         -					set retval(source) [platform::generic]
          691  +
          692  +					if {$check == [list "noarch" "noarch"]} {
          693  +						set retval(source) "noarch-noarch"
          694  +					} else {
          695  +						set retval(source) $::appfs::platform
          696  +					}
   679    697   				} else {
   680    698   					set check [::appfs::db onecolumn {
   681    699   						SELECT 1 FROM packages WHERE hostname = $pathinfo(hostname) AND package = $pathinfo(package) AND os = $pathinfo(os) AND cpuArch = $pathinfo(cpu);
   682    700   					}]
   683    701   					if {$check == "1"} {
   684    702   						set retval(type) directory
   685    703   						set retval(childcount) [llength [getchildren $path]]