Check-in [ee1a499a2e]
Overview
Comment:Updated to normalize CPU/OS
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:ee1a499a2e24f3ec176762ee6ce131f542f548e6
User & Date: rkeene on 2014-09-14 04:36:17
Other Links: manifest | tags
Context
2014-09-16
18:21
Removed blank line check-in: 17bbfdc417 user: rkeene tags: trunk
2014-09-14
04:36
Updated to normalize CPU/OS check-in: ee1a499a2e user: rkeene tags: trunk
2014-09-13
05:15
Updated to commit package change as a single transaction check-in: 86819aa4e1 user: rkeene tags: trunk
Changes

Modified appfsd.tcl from [c65cce6320] to [fc1c954390].

    79     79   
    80     80   		return true
    81     81   	}
    82     82   
    83     83   	proc _db {args} {
    84     84   		return [uplevel 1 [list ::appfs::db {*}$args]]
    85     85   	}
           86  +
           87  +	proc _normalizeOS {os} {
           88  +		set os [string tolower [string trim $os]]
           89  +
           90  +		switch -- $os {
           91  +			"linux" - "freebsd" - "openbsd" - "netbsd" {
           92  +				return $os
           93  +			}
           94  +			"sunos" {
           95  +				return "solaris"
           96  +			}
           97  +		}
           98  +
           99  +		return -code error "Unable to normalize OS: $os"
          100  +	}
          101  +
          102  +	proc _normalizeCPU {cpu} {
          103  +		set cpu [string tolower [string trim $cpu]]
          104  +
          105  +		switch -glob -- $cpu {
          106  +			"i?86" {
          107  +				return "ix86"
          108  +			}
          109  +			"x86_64" {
          110  +				return $cpu
          111  +			}
          112  +		}
          113  +
          114  +		return -code error "Unable to normalize CPU: $cpu"
          115  +	}
    86    116   
    87    117   	proc init {} {
    88    118   		if {[info exists ::appfs::init_called]} {
    89    119   			return
    90    120   		}
    91    121   
    92    122   		set ::appfs::init_called 1
................................................................................
   175    205   			}
   176    206   
   177    207   			set work [split $line ","]
   178    208   
   179    209   			unset -nocomplain pkgInfo
   180    210   			set pkgInfo(package)  [lindex $work 0]
   181    211   			set pkgInfo(version)  [lindex $work 1]
   182         -			set pkgInfo(os)       [lindex $work 2]
   183         -			set pkgInfo(cpuArch)  [lindex $work 3]
          212  +			set pkgInfo(os)       [_normalizeOS [lindex $work 2]]
          213  +			set pkgInfo(cpuArch)  [_normalizeCPU [lindex $work 3]]
   184    214   			set pkgInfo(hash)     [string tolower [lindex $work 4]]
   185    215   			set pkgInfo(hash_type) "sha1"
   186    216   			set pkgInfo(isLatest) [expr {!![lindex $work 5]}]
   187    217   
   188    218   			if {![_isHash $pkgInfo(hash)]} {
   189    219   				continue
   190    220   			}