Changeset 1638


Ignore:
Timestamp:
Jan 12, 2003, 10:54:38 AM (15 years ago)
Author:
landonf
Message:

Standardized return values for targets
Added msgcat calls to allow for target localization
Updated copyright date

Location:
trunk/base/src/port1.0
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/base/src/port1.0/portbuild.tcl

    r1503 r1638  
    22# portbuild.tcl
    33#
    4 # Copyright (c) 2002 Apple Computer, Inc.
     4# Copyright (c) 2002 - 2003 Apple Computer, Inc.
    55# All rights reserved.
    66#
     
    7575        }
    7676        default {
    77             ui_warn "Unknown build.type ${build.type}, using 'gnumake'"
     77            ui_warn "[format [msgcat::mc "Unknown build.type %s, using 'gnumake'"] ${build.type}]"
    7878            return gnumake
    7979        }
     
    8484    global UI_PREFIX portname build.target.all
    8585
    86     ui_msg "$UI_PREFIX Building $portname with target ${build.target.all}"
     86    ui_msg "$UI_PREFIX [format [msgcat::mc "Building %s with target %s"] ${portname} ${build.target.all}]"
    8787}
    8888
  • trunk/base/src/port1.0/portchecksum.tcl

    r1549 r1638  
    22# portchecksum.tcl
    33#
    4 # Copyright (c) 2002 Apple Computer, Inc.
     4# Copyright (c) 2002 - 2003 Apple Computer, Inc.
    55# All rights reserved.
    66#
     
    4747
    4848    set md5regex "^(MD5)\[ \]\\((.+)\\)\[ \]=\[ \](\[A-Za-z0-9\]+)\n$"
    49     set pipe [open "|md5 \"${file}\"" r]
     49    if {[catch {set pipe [open "|md5 \"${file}\"" r]} result]} {
     50        return -code error "[format [msgcat::mc "Unable to parse checksum: %s"] $result]"
     51    }
    5052    set line [read $pipe]
    5153    if {[regexp $md5regex $line match type filename sum] == 1} {
     
    5759        }
    5860    } else {
    59         # XXX Handle this error beter
    6061        close $pipe
    61         ui_error "$line - md5sum failed!"
    62         return -1
     62        return -code error "[format [msgcat::mc "Unable to parse checksum: %s"] $line]"
    6363    }
    6464}
     
    7878    global UI_PREFIX portname
    7979
    80     ui_msg "$UI_PREFIX Verifying checksum for $portname"
     80    ui_msg "$UI_PREFIX [format [msgcat::mc "Verifying checksum for %s"] $portname]"
    8181}
    8282
     
    9090
    9191    if ![info exists checksums] {
    92         ui_error "No checksums statement in Portfile.  File checksums are:"
     92        ui_error "[msgcat::mc "No checksums statement in Portfile.  File checksums are:"]"
    9393        foreach distfile $all_dist_files {
    9494            ui_msg "$distfile md5 [md5 $distpath/$distfile]"
    9595        }
    96         return -code error "No checksums statement in Portfile."
     96        return -code error "[msgcat::mc "No checksums statement in Portfile."]"
    9797    }
    9898
     
    106106        set dchecksum [dmd5 $distfile]
    107107        if {$dchecksum == -1} {
    108             ui_warn "No checksum recorded for $distfile"
     108            ui_warn "[format [msgcat::mc "No checksum recorded for %s"] $distfile]"
    109109        } elseif {$checksum != $dchecksum} {
    110             ui_error "Checksum mismatch for $distfile"
    111             return -code error "Checksum mismatch for $distfile"
     110            return -code error "[format [msgcat::mc "Checksum mismatch for %s"] $distfile]"
    112111        }
    113112    }
  • trunk/base/src/port1.0/portclean.tcl

    r1503 r1638  
    22# portclean.tcl
    33#
    4 # Copyright (c) 2002 Apple Computer, Inc.
     4# Copyright (c) 2002 - 2003 Apple Computer, Inc.
    55# All rights reserved.
    66#
     
    4444    global UI_PREFIX portname
    4545
    46     ui_msg "$UI_PREFIX Cleaning $portname"
     46    ui_msg "$UI_PREFIX [format [msgcat::mc "Cleaning %s"] $portname]"
    4747}
    4848
  • trunk/base/src/port1.0/portconfigure.tcl

    r1503 r1638  
    22# portconfigure.tcl
    33#
    4 # Copyright (c) 2002 Apple Computer, Inc.
     4# Copyright (c) 2002 - 2003 Apple Computer, Inc.
    55# All rights reserved.
    66#
     
    5656    global UI_PREFIX portname
    5757
    58     ui_msg "$UI_PREFIX Configuring $portname"
     58    ui_msg "$UI_PREFIX [format [msgcat::mc "Configuring %s"] $portname]"
    5959}
    6060
     
    6666        # XXX depend on automake
    6767        if {[catch {system "[command automake]"} result]} {
    68             ui_error "configure target failed: $result"
    69             return -code error "configure target failed: $result"
     68            return -code error "[format [msgcat::mc "%s failure: %s"] automake $result]"
    7069        }
    7170    }
     
    7473        # XXX depend on autoconf
    7574        if {[catch {system "[command autoconf]"} result]} {
    76             ui_error "configure target failed: $result"
    77             return -code error "configure target failed: $result"
     75            return -code error "[format [msgcat::mc "%s failure: %s"] autoconf $result]"
    7876        }
    7977    }
     
    8280        # XXX depend on xmkmf
    8381        if {[catch {system "[command xmkmf]"} result]} {
    84             ui_error "configure target failed: $result"
    85             return -code error "configure target failed: $result"
     82            return -code error "[format [msgcat::mc "%s failure: %s"] xmkmf $result]"
    8683        } else {
    8784            # XXX should probably use make command abstraction but we know that
     
    9188    } elseif [tbool use_configure] {
    9289        if {[catch {system "[command configure]"} result]} {
    93             ui_error "configure target failed: $result"
    94             return -code error "configure target failed: $result"
     90            return -code error "[format [msgcat::mc "%s failure: %s"] configure $result]"
    9591        }
    9692    }
  • trunk/base/src/port1.0/portcontents.tcl

    r1503 r1638  
    22# portuninstall.tcl
    33#
    4 # Copyright (c) 2002 Apple Computer, Inc.
     4# Copyright (c) 2002 - 2003 Apple Computer, Inc.
    55# All rights reserved.
    66#
     
    5858            set contents [lindex $entry [incr ix]]
    5959            set uninst_err 0
    60             ui_msg "Contents of ${portname}-${portversion}"
     60            ui_msg "[format [msgcat::mc "Contents of %s-%s"] ${portname} ${portversion}]"
    6161            foreach f $contents {
    6262                ui_msg "\t[lindex $f 0]"
    6363            }
    6464        } else {
    65             return -code error "No contents list for ${portname}-${portversion}"
     65            return -code error "[format [msgcat::mc "No contents list for %s-%s"] ${portname} ${portversion}]"
    6666        }
    6767    } else {
    68         return -code error "Contents listing failed - no registry entry"
     68        return -code error [msgcat::mc "Contents listing failed - no registry entry"]
    6969    }
    7070}
  • trunk/base/src/port1.0/portdepends.tcl

    r1503 r1638  
    22# portdepends.tcl
    33#
    4 # Copyright (c) 2002 Apple Computer, Inc.
     4# Copyright (c) 2002 - 2003 Apple Computer, Inc.
    55# All rights reserved.
    66#
     
    6565                                        }
    6666                                } else {
    67                                         ui_error "unknown depspec type: $deppath"
     67                                        return -code error [format [msgcat::mc ["unknown depspec type: %s"] $deppath]
    6868                                }
    6969                        } else {
    70                                 ui_error "invalid depspec: $depspec"
     70                                return -code error [format [msgcat::mc "invalid depspec: %s"] $depspec]
    7171                        }
    7272            }
  • trunk/base/src/port1.0/portextract.tcl

    r1503 r1638  
    22# portextract.tcl
    33#
    4 # Copyright (c) 2002 Apple Computer, Inc.
     4# Copyright (c) 2002 - 2003 Apple Computer, Inc.
    55# All rights reserved.
    66#
     
    7171    global UI_PREFIX portname
    7272
    73     ui_msg "$UI_PREFIX Extracting $portname"
     73    ui_msg "$UI_PREFIX [format [msgcat::mc "Extracting %s"] $portname]"
    7474}
    7575
     
    8383
    8484    foreach distfile ${extract.only} {
    85         ui_info "$UI_PREFIX Extracting $distfile ... " -nonewline
     85        ui_info "$UI_PREFIX [format [msgcat::mc "Extracting %s"] $distfile] ... " -nonewline
    8686        set extract.args "$distpath/$distfile"
    8787        if [catch {system "[command extract]"} result] {
    88             ui_error "$result"
    8988            return -code error "$result"
    9089        }
    91         ui_info "Done"
     90        ui_info [msgcat::mc "Done"]
    9291    }
    9392    return 0
  • trunk/base/src/port1.0/portfetch.tcl

    r1522 r1638  
    22# portfetch.tcl
    33#
    4 # Copyright (c) 2002 Apple Computer, Inc.
     4# Copyright (c) 2002 - 2003 Apple Computer, Inc.
    55# All rights reserved.
    66#
     
    196196    set cvs.cmd "echo ${cvs.password} | /usr/bin/env ${cvs.env} cvs"
    197197    if {[catch {system "[command cvs] 2>&1"} result]} {
    198         ui_error "CVS login failed"
    199         return -code error "CVS login failed"
     198        return -code error [msgcat::mc "CVS login failed"]
    200199    }
    201200    set cvs.args "co -r ${cvs.tag}"
     
    203202    set cvs.post_args "${cvs.module}"
    204203    if {[catch {system "[command cvs] 2>&1"} result]} {
    205         ui_error "CVS check out failed"
    206         return -code error "CVS check out failed"
     204        return -code error [msgcat::mc "CVS check out failed"]
    207205    }
    208206    return 0
     
    222220    if {![file isdirectory $distpath]} {
    223221        if {[catch {file mkdir $distpath} result]} {
    224             ui_error "Unable to create distribution files path: $result"
    225             return -code error "Unable to create distribution files path: $result"
     222            return -code error [format [msgcat::mc "Unable to create distribution files path: %s"] $result]
    226223        }
    227224    }
    228225    if {![file writable $distpath]} {
    229         ui_error "$distpath must be writable"
    230         return -code error "$distpath must be writable"
     226        return -code error [format [msgcat::mc "%s must be writable"] $distpath]
    231227    }
    232228    foreach {url_var distfile} $fetch_urls {
    233229        if {![file isfile $distpath/$distfile]} {
    234             ui_info "$UI_PREFIX $distfile doesn't seem to exist in $distpath"
     230            ui_info "$UI_PREFIX [format [msgcat::mc "%s doesn't seem to exist in %s"] $distfile $distpath]"
    235231            global portfetch::$url_var
    236232            if ![info exists $url_var] {
    237                 ui_error "No defined site for tag: $url_var, using master_sites"
     233                ui_error [format [msgcat::mc "No defined site for tag: %s, using master_sites"] $url_var]
    238234                set url_var master_sites
    239235                global portfetch::$url_var
    240236            }
    241237            foreach site [set $url_var] {
    242                 ui_msg "$UI_PREFIX Attempting to fetch $distfile from $site"
     238                ui_msg "$UI_PREFIX [format [msgcat::mc "Attempting to fetch %s from %s"] $distfile $site]"
    243239                if {![catch {system "[command fetch]"} result] &&
    244240                    ![catch {system "mv ${distpath}/${distfile}.TMP ${distpath}/${distfile}"}]} {
     
    246242                    break
    247243                } else {
    248                     ui_error "fetch failed: $result"
    249244                    exec rm -f ${distpath}/${distfile}.TMP
     245                    return -code error "[msgcat::mc "fetch failed"]: $result"
    250246                }
    251247            }
    252248            if {![info exists fetched]} {
    253                 return -code error "fetch failed."
     249                return -code error [msgcat::mc "fetch failed"]
    254250            } else {
    255251                unset fetched
     
    275271    global UI_PREFIX portname
    276272
    277     ui_msg "$UI_PREFIX Fetching $portname"
     273    ui_msg "$UI_PREFIX [format [msgcat::mc "Fetching %s"] $portname]"
    278274}
    279275
  • trunk/base/src/port1.0/portinstall.tcl

    r1548 r1638  
    22# portinstall.tcl
    33#
    4 # Copyright (c) 2002 Apple Computer, Inc.
     4# Copyright (c) 2002 - 2003 Apple Computer, Inc.
    55# All rights reserved.
    66#
     
    5050    global UI_PREFIX portname build.target.install destpath
    5151
    52     ui_msg "$UI_PREFIX Installing ${portname} with target ${build.target.install}"
     52    ui_msg "$UI_PREFIX [format [msgcat::mc "Installing %s"] ${portname}]"
    5353       
    5454        file mkdir ${destpath}
     
    6060    set build.target.current ${build.target.install}
    6161    if [catch {system "[command build]"}] {
    62         ui_error "Installation failed."
    63         return -code error "Installation failed."
     62        return -code error [msgcat::mc "Installation failed"]
    6463    }
    6564    return 0
  • trunk/base/src/port1.0/portmain.tcl

    r1515 r1638  
    22# portmain.tcl
    33#
    4 # Copyright (c) 2002 Apple Computer, Inc.
     4# Copyright (c) 2002 - 2003 Apple Computer, Inc.
    55# All rights reserved.
    66#
  • trunk/base/src/port1.0/portmpkg.tcl

    r1607 r1638  
    22# portpackage.tcl
    33#
    4 # Copyright (c) 2002 Apple Computer, Inc.
     4# Copyright (c) 2002 - 2003 Apple Computer, Inc.
    55# All rights reserved.
    66#
     
    5555        }
    5656        default {
    57             ui_error "Do not know how to generate package of type ${package.type}"
    58             return -code error "Unknown package type: ${package.type}"
     57            return -code error [format [msgcat::mc "Unknown package type: %s"] ${package.type}]
    5958        }
    6059    }
  • trunk/base/src/port1.0/portpackage.tcl

    r1607 r1638  
    22# portpackage.tcl
    33#
    4 # Copyright (c) 2002 Apple Computer, Inc.
     4# Copyright (c) 2002 - 2003 Apple Computer, Inc.
    55# All rights reserved.
    66#
     
    5252    set rfile [registry_exists $portname $portversion]
    5353    if ![string length $rfile] {
    54         ui_error "Package ${portname}-${portversion} not installed on this system"
    55         return -code error "Package ${portname}-${portversion} not installed on this system"
    56     }
    57     ui_msg "$UI_PREFIX Creating ${package.type} format package for ${portname}-${portversion}"
     54        return -code error [format [msgcat::mc "Package %s-%s not installed on this system"] ${portname} ${portversion}]
     55    }
     56    ui_msg "$UI_PREFIX [format [msgcat::mc "Creating %s format package for %s-%s"] ${package.type} ${portname} ${portversion}]"
    5857    if [regexp .bz2$ $rfile] {
    5958        set fd [open "|bunzip2 -c $rfile" r]
     
    7675        }
    7776        default {
    78             ui_error "Do not know how to generate package of type ${package.type}"
    79             return -code error "Unknown package type: ${package.type}"
     77            return -code error [format [msgcat::mc "Unknown package type: %s"] ${package.type}]
    8078        }
    8179    }
     
    10199
    102100        set ptarget ${package.destpath}/${portname}-${portversion}.tar.gz
    103         if [catch {system "gnutar -T [lindex $plist 1] -czPpf ${ptarget}"} err] {
    104             ui_error "Package creation failed - gnutar returned error status: $err"
    105             ui_info "Failed packing list left in [lindex $plist 1]"
    106             return -code error "Package creation failed - gnutar returned error status: $err"
     101        if [catch {system "gnutar -T [lindex $plist 1] -czPpf ${ptarget}"} result] {
     102            ui_info [format [msgcat::mc "Package creation failed - Failed packing list left in %s"] [lindex $plist 1]]
     103            return -code error [format [msgcat::mc "Package creation failed - gnutar returned error status: %s"] $result]
    107104        }
    108105        exec rm [lindex $plist 1]
    109106    } else {
    110         ui_error "Bad registry entry for ${portname}-${portversion}, no contents"
    111         return -code error "Bad registry entry for ${portname}-${portversion}, no contents"
     107        return -code error [format [msgcat::mc "Bad registry entry for %s-%s, no contents"] ${portname} ${portversion}]
    112108    }
    113109    return 0
     
    135131        if {![file isdirectory $destpath]} {
    136132            if {[catch {file mkdir $destpath} result]} {
    137                 ui_error "Unable to create destination root path: $result"
    138                 return -code error "Unable to create destination root path: $result"
     133                return -code error [format [msgcat::mc "Unable to create destination root path: %s"] $result]
    139134            }
    140135        }
    141136
    142137        if [catch {system "gnutar -T [lindex $plist 1] -cPpf - | (cd ${destpath} && tar xvf -)"} return] {
    143             ui_error "Package creation failed - gnutar returned error status: $return"
    144138            file delete [lindex $plist 1]
    145             return -code error "Package creation failed - gnutar returned error status: $return"
     139            return -code error [format [msgcat::mc "Package creation failed - gnutar returned error status: %s"] $result]
    146140        }
    147141        file delete [lindex $plist 1]
     
    149143    if {![file isdirectory $resourcepath]} {
    150144        if {[catch {file mkdir $resourcepath} result]} {
    151             ui_error "Unable to create package resource directory: $result"
    152             return -code error "Unable to create package resource directory: $result"
     145            return -code error [format [msgcat::mc "Unable to create package resource directory: %s"] $result]
    153146        }
    154147    }
     
    321314   
    322315    if {[catch {set numFiles [exec lsbom -s ${pkgpath}/Contents/Archive.bom | wc -l]} result]} {
    323         return -code error "Reading package bom failed: $result"
     316        return -code error [format [msgcat::mc "Reading package bom failed: %s"] $result]
    324317    }
    325318    if {[catch {set compressedSize [expr [dirSize ${pkgpath}] / 1024]} result]} {
    326         return -code error "Error determining compressed size: $result"
     319        return -code error [format [msgcat::mc "Error determining compressed size: %s"] $result]
    327320    }
    328321    if {[catch {set installedSize [expr [dirSize ${destpath}] / 1024]} result]} {
    329         return -code error "Error determining installed size: $result"
     322        return -code error [format [msgcat::mc "Error determining installed size: %s"] $result]
    330323    }
    331324    if {[catch {set infoSize [file size ${pkgpath}/Contents/Resources/${portname}.info]} result]} {
    332         return -code error "Error determining info file size: $result"
     325        return -code error [format [msgcat::mc "Error determining info file size: %s"] $result]
    333326    }
    334327    if {[catch {set bomSize [file size ${pkgpath}/Contents/Archive.bom]} result]} {
    335         return -code error "Error determining bom file size: $result"
     328        return -code error [format [msgcat::mc "Error determining bom file size: %s"] $result]
    336329    }
    337330    incr installedSize $infoSize
  • trunk/base/src/port1.0/portpatch.tcl

    r1503 r1638  
    22# portpatch.tcl
    33#
    4 # Copyright (c) 2002 Apple Computer, Inc.
     4# Copyright (c) 2002 - 2003 Apple Computer, Inc.
    55# All rights reserved.
    66#
     
    6363    }
    6464    if ![info exists patchlist] {
    65         return -code error "Patch files missing"
     65        return -code error [msgcat::mc "Patch files missing"]
    6666    }
    6767    cd ${worksrcpath}
    6868    foreach patch $patchlist {
    69         ui_info "$UI_PREFIX Applying $patch"
     69        ui_info "$UI_PREFIX [format [msgcat::mc "Applying %s"] $patch]"
    7070        switch -glob -- [file tail $patch] {
    7171            *.Z -
  • trunk/base/src/port1.0/portregistry.tcl

    r1560 r1638  
    22# portregistry.tcl
    33#
    4 # Copyright (c) 2002 Apple Computer, Inc.
     4# Copyright (c) 2002 - 2003 Apple Computer, Inc.
    55# All rights reserved.
    66#
     
    5252    global UI_PREFIX portname
    5353
    54     ui_msg "$UI_PREFIX Adding $portname to registry, this may take a moment..."
     54    ui_msg "$UI_PREFIX [format [msgcat::mc "Adding %s to registry, this may take a moment..."] ${portname}]"
    5555}
    5656
     
    184184        }
    185185        if {[file isdirectory $fname] && [tbool registry.contents_recurse]} {
    186             ui_msg "$UI_PREFIX Warning: Registry adding contents of directory $fname"
     186            ui_msg "$UI_PREFIX [format [msgcat::mc "Warning: Registry adding contents of directory %s"] $fname]"
    187187        }
    188188        fileinfo_for_entry rval $dir $file
  • trunk/base/src/port1.0/portuninstall.tcl

    r1503 r1638  
    22# portuninstall.tcl
    33#
    4 # Copyright (c) 2002 Apple Computer, Inc.
     4# Copyright (c) 2002 - 2003 Apple Computer, Inc.
    55# All rights reserved.
    66#
     
    4848
    4949    if [string length [registry_exists $portname $portversion]] {
    50         ui_msg "$UI_PREFIX Uninstalling $portname-$portversion"
     50        ui_msg "$UI_PREFIX [format [msgcat::mc "Uninstalling %s-%s"] $portname $portversion]"
    5151    }
    5252}
     
    7777                pkg_uninstall $portname $portversion
    7878            } else {
    79                 ui_error "Could not evaluate pkg_uninstall procedure: $err"
     79                ui_error [format [msgcat::mc "Could not evaluate pkg_uninstall procedure: %s"] $err]
    8080            }
    8181        }
     
    9494                        if ![string match $sum1 $sum2] {
    9595                            if ![tbool uninstall.force] {
    96                                 ui_info "$UI_PREFIX  Original checksum does not match for $fname, not removing"
     96                                ui_info "$UI_PREFIX  [format [msgcat::mc "Original checksum does not match for %s, not removing"] $fname]"
    9797                                set uninst_err 1
    9898                                continue
    9999                            } else {
    100                                 ui_info "$UI_PREFIX  Original checksum does not match for $fname, removing anyway [force in effect]"
     100                                ui_info "$UI_PREFIX  [format [msgcat::mc "Original checksum does not match for %s, removing anyway [force in effect]"] $fname]"
    101101                            }
    102102                        }
    103103                    }
    104104                }
    105                 ui_info "$UI_PREFIX Uninstall is removing $fname"
     105                ui_info "$UI_PREFIX [format [msgcat::mc "Uninstall is removing %s"] $fname]"
    106106                if [file isdirectory $fname] {
    107107                    if [catch {exec rmdir $fname}] {
    108108                        if ![tbool uninstall.force] {
    109                             ui_info "$UI_PREFIX  Uninstall unable to remove directory $fname (not empty?)"
     109                            ui_info "$UI_PREFIX  [format [msgcat::mc "Uninstall unable to remove directory %s (not empty?)"] $fname]"
    110110                            set uninst_err 1
    111111                        } else {
     
    116116                } else {
    117117                    if [catch {exec rm $fname}] {
    118                         ui_info "$UI_PREFIX  Uninstall unable to remove file $fname"
     118                        ui_info "$UI_PREFIX  [format [msgcat::mc "Uninstall unable to remove file %s"] $fname]"
    119119                        set uninst_err 1
    120120                    }
     
    126126            }
    127127        } else {
    128             return -code error "Uninstall failed: Port has no contents entry"
     128            return -code error [msgcat::mc "Uninstall failed: Port has no contents entry"]
    129129        }
    130130    }
    131     return -code error "Uninstall failed: Port not registered as installed"
     131    return -code error [msgcat::mc "Uninstall failed: Port not registered as installed"]
    132132}
  • trunk/base/src/port1.0/portutil.tcl

    r1594 r1638  
    3232package provide portutil 1.0
    3333package require Pextlib 1.0
     34package require msgcat
    3435
    3536global targets target_uniqid all_variants
     
    546547            }
    547548        } else {
    548             ui_error "Target error: $name returned: $errstr"
     549            ui_error "Target $name returned: $errstr"
    549550            set result 1
    550551        }
Note: See TracChangeset for help on using the changeset viewer.