Ignore:
Timestamp:
Jan 6, 2003, 12:30:55 PM (18 years ago)
Author:
landonf (Landon Fuller)
Message:

Format with 4 character tabs
Write out a useful Welcome.rtf file

File:
1 edited

Legend:

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

    r1579 r1580  
    120120    set rfile [registry_exists $portname $portversion]
    121121    set ix [lsearch $entry contents]
     122    # If contents entry exists, transplant installed files into ${destpath}
     123    # Otherwise, presume that they are already installed in ${destpath} path
    122124    if {$ix >= 0} {
    123                 set plist [mkstemp ${workpath}/.${portname}.plist.XXXXXXXXX]
    124                 set pfile [lindex $plist 0]
    125                 # XXX hack that allows contents list to be grouped by braces
    126                 # XXX split contents list up if it contains one argument
    127                 # XXX this breaks contents lists that contain one filename, with spaces.
    128                 if {[llength $contents] == 1} {
    129                         set clist [eval concat $contents]
    130                 } else {
    131                         set clist $contents
    132                 }
    133        
    134                 foreach f $clist {
    135                         set fname [lindex $f 0]
    136                         puts $pfile $fname
    137                 }
    138                 close $pfile
    139        
    140                 if {![file isdirectory $destpath]} {
    141                         if {[catch {file mkdir $destpath} result]} {
    142                         ui_error "Unable to create destination root path: $result"
    143                         return -code error "Unable to create destination root path: $result"
    144                         }
    145                 }
    146        
    147                 if [catch {system "(cd ${prefix} && gnutar -T [lindex $plist 1] -cPpf -) | (cd ${destpath} && tar xvf -)"} return] {
    148                         ui_error "Package creation failed - gnutar returned error status: $return"
    149                         file delete [lindex $plist 1]
    150                         return -code error "Package creation failed - gnutar returned error status: $return"
    151                 }
    152                 file delete [lindex $plist 1]
    153         }
    154         if {![file isdirectory $resourcepath]} {
    155             if {[catch {file mkdir $resourcepath} result]} {
    156                 ui_error "Unable to create package resource directory: $result"
    157                 return -code error "Unable to create package resource directory: $result"
     125        set plist [mkstemp ${workpath}/.${portname}.plist.XXXXXXXXX]
     126        set pfile [lindex $plist 0]
     127
     128        foreach f $contents {
     129            set fname [lindex $f 0]
     130            puts $pfile $fname
     131        }
     132        close $pfile
     133
     134        if {![file isdirectory $destpath]} {
     135            if {[catch {file mkdir $destpath} result]} {
     136                ui_error "Unable to create destination root path: $result"
     137                return -code error "Unable to create destination root path: $result"
    158138            }
    159139        }
    160140
    161 # XXX: we need to support .lproj in resources.
    162         set pkgpath ${package.destpath}/${portname}.pkg
    163         system "mkdir -p -m 0755 ${pkgpath}/Contents/Resources"
    164         write_PkgInfo ${pkgpath}/Contents/PkgInfo
    165         write_info_file ${pkgpath}/Contents/Resources/${portname}.info $portname $portversion $description $prefix
    166         write_info_plist ${pkgpath}/Contents/Info.plist $portname $portversion $prefix
    167         write_description_plist ${pkgpath}/Contents/Resources/Description.plist $portname $portversion $description
    168         file copy -force -- ${portresourcepath}/package/background.tiff ${pkgpath}/Contents/Resources/background.tiff
    169         system "mkbom ${destpath} ${pkgpath}/Contents/Archive.bom"
    170         system "cd ${pkgpath}/Contents/Resources/ && ln -fs ../Archive.bom ${portname}.bom"
    171         system "cd ${destpath} && pax -w -z . > ${pkgpath}/Contents/Archive.pax.gz"
    172         system "cd ${pkgpath}/Contents/Resources/ && ln -fs ../Archive.pax.gz ${portname}.pax.gz"
    173 
    174         write_sizes_file ${pkgpath}/Contents/Resources/${portname}.sizes ${portname} ${pkgpath} ${destpath}
     141        if [catch {system "(cd ${prefix} && gnutar -T [lindex $plist 1] -cPpf -) | (cd ${destpath} && tar xvf -)"} return] {
     142            ui_error "Package creation failed - gnutar returned error status: $return"
     143            file delete [lindex $plist 1]
     144            return -code error "Package creation failed - gnutar returned error status: $return"
     145        }
     146        file delete [lindex $plist 1]
     147    }
     148    if {![file isdirectory $resourcepath]} {
     149        if {[catch {file mkdir $resourcepath} result]} {
     150            ui_error "Unable to create package resource directory: $result"
     151            return -code error "Unable to create package resource directory: $result"
     152        }
     153    }
     154
     155    # XXX: we need to support .lproj in resources.
     156    set pkgpath ${package.destpath}/${portname}.pkg
     157    system "mkdir -p -m 0755 ${pkgpath}/Contents/Resources"
     158    write_PkgInfo ${pkgpath}/Contents/PkgInfo
     159    write_info_file ${pkgpath}/Contents/Resources/${portname}.info $portname $portversion $description $prefix
     160    write_info_plist ${pkgpath}/Contents/Info.plist $portname $portversion $prefix
     161    write_description_plist ${pkgpath}/Contents/Resources/Description.plist $portname $portversion $description
     162    # long_description, description, or homepage may not exist
     163    foreach variable {long_description description homepage} {
     164        if {![info exists $variable]} {
     165            set pkg_$variable ""
     166        } else {
     167            set pkg_$variable [set $variable]
     168        }
     169    }
     170    write_welcome_rtf ${pkgpath}/Contents/Resources/Welcome.rtf $portname $portversion $pkg_long_description $pkg_description $pkg_homepage
     171    file copy -force -- ${portresourcepath}/package/background.tiff ${pkgpath}/Contents/Resources/background.tiff
     172    system "mkbom ${destpath} ${pkgpath}/Contents/Archive.bom"
     173    system "cd ${pkgpath}/Contents/Resources/ && ln -fs ../Archive.bom ${portname}.bom"
     174    system "cd ${destpath} && pax -w -z . > ${pkgpath}/Contents/Archive.pax.gz"
     175    system "cd ${pkgpath}/Contents/Resources/ && ln -fs ../Archive.pax.gz ${portname}.pax.gz"
     176
     177    write_sizes_file ${pkgpath}/Contents/Resources/${portname}.sizes ${portname} ${pkgpath} ${destpath}
    175178
    176179    return 0
     
    295298}
    296299
     300proc write_welcome_rtf {filename portname portversion long_description description homepage} {
     301    set fd [open ${filename} w+]
     302    if {$long_description == ""} {
     303        set long_description $description
     304    }
     305    puts $fd \
     306"{\\rtf1\\mac\\ansicpg10000\\cocoartf102
     307{\\fonttbl\\f0\\fswiss\\fcharset77 Helvetica-Bold;\\f1\\fswiss\\fcharset77 Helvetica;}
     308{\\colortbl;\\red255\\green255\\blue255;\\red1\\green1\\blue1;}
     309\\vieww9000\\viewh9000\\viewkind0
     310\\pard\\tx560\\tx1120\\tx1680\\tx2240\\tx2800\\tx3360\\tx3920\\tx4480\\tx5040\\tx5600\\tx6160\\tx6720\\ql\\qnatural
     311
     312\\f0\\b\\fs24 \\cf2 Welcome to the ${portname} for Mac OS X Installer\\
     313\\
     314\\pard\\tx560\\tx1120\\tx1680\\tx2240\\tx2800\\tx3360\\tx3920\\tx4480\\tx5040\\tx5600\\tx6160\\tx6720\\ql\\qnatural
     315"
     316puts -nonewline $fd "\\f1\\b0 \\cf2 "
     317    puts $fd "${portname} ${portversion}\\"
     318    if {$homepage != ""} {
     319        puts $fd "${homepage} \\\n\\"
     320    }
     321    puts $fd \
     322"${long_description} \\
     323\\
     324This installer guides you through the steps necessary to install ${portname} ${portversion} for Mac OS X. To get started, click Continue.\\
     325}"
     326
     327    close $fd
     328}
     329
    297330proc write_sizes_file {sizesfile portname pkgpath destpath} {
    298331   
Note: See TracChangeset for help on using the changeset viewer.