Changeset 1804 for trunk/base


Ignore:
Timestamp:
Jan 21, 2003, 2:38:19 AM (17 years ago)
Author:
landonf (Landon Fuller)
Message:

Remove dependency on defunct registry target
Remove tar ball package package format.
Pull in files from destroot and ignore registry
Write out Welcome message in HTML

File:
1 edited

Legend:

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

    r1638 r1804  
    3636${com.apple.package} set runtype always
    3737${com.apple.package} provides package
    38 ${com.apple.package} requires registry
     38${com.apple.package} requires install
    3939
    4040# define options
     
    4242
    4343# Set defaults
    44 default package.type pkg
    4544default package.destpath {${workpath}}
    4645
     
    5049    global portname portversion package.type package.destpath UI_PREFIX
    5150
    52     set rfile [registry_exists $portname $portversion]
    53     if ![string length $rfile] {
    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}]"
    57     if [regexp .bz2$ $rfile] {
    58         set fd [open "|bunzip2 -c $rfile" r]
    59     } else {
    60         set fd [open $rfile r]
    61     }
    62     set entry [read $fd]
    63     close $fd
    64 
    65     # Make sure the destination path exists.
    66     system "mkdir -p ${package.destpath}"
    67 
    68     # For now we only support pkg and tarball package types.
    69     switch -exact -- ${package.type} {
    70         pkg {
    71             return [package_pkg $portname $portversion $entry]
    72         }
    73         tarball {
    74             return [package_tarball $portname $portversion $entry]
    75         }
    76         default {
    77             return -code error [format [msgcat::mc "Unknown package type: %s"] ${package.type}]
    78         }
    79     }
    80 }
    81 
    82 # Make a tarball version of a package.  This is our "built-in" packaging
    83 # method.
    84 proc package_tarball {portname portversion entry} {
    85     global portdbpath package.destpath
    86 
    87     set rfile [registry_exists $portname $portversion]
    88     set ix [lsearch $entry contents]
    89     if {$ix >= 0} {
    90         set contents [lindex $entry [incr ix]]
    91         set plist [mkstemp /tmp/XXXXXXXX]
    92         set pfile [lindex $plist 0]
    93         foreach f $contents {
    94             set fname [lindex $f 0]
    95             puts $pfile $fname
    96         }
    97         puts $pfile $rfile
    98         close $pfile
    99 
    100         set ptarget ${package.destpath}/${portname}-${portversion}.tar.gz
    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]
    104         }
    105         exec rm [lindex $plist 1]
    106     } else {
    107         return -code error [format [msgcat::mc "Bad registry entry for %s-%s, no contents"] ${portname} ${portversion}]
    108     }
    109     return 0
    110 }
    111 
    112 proc package_pkg {portname portversion entry} {
     51    ui_msg "$UI_PREFIX [format [msgcat::mc "Creating package for %s-%s"] ${portname} ${portversion}]"
     52
     53    return [package_pkg $portname $portversion]
     54}
     55
     56proc package_pkg {portname portversion} {
    11357    global portdbpath destpath workpath prefix portresourcepath description package.destpath long_description homepage
    11458
    11559    set resourcepath ${workpath}/pkg_resources
    116     set rfile [registry_exists $portname $portversion]
    117     set ix [lsearch $entry contents]
    118     # If contents entry exists, transplant installed files into ${destpath}
    119     # Otherwise, presume that they are already installed in ${destpath} path
    120     if {$ix >= 0} {
    121         set plist [mkstemp ${workpath}/.${portname}.plist.XXXXXXXXX]
    122         set pfile [lindex $plist 0]
    123 
    124         set receipt_contents [lindex $entry [incr ix]]
    125         foreach f $receipt_contents {
    126             set fname [lindex $f 0]
    127             puts $pfile $fname
    128         }
    129         close $pfile
    130 
    131         if {![file isdirectory $destpath]} {
    132             if {[catch {file mkdir $destpath} result]} {
    133                 return -code error [format [msgcat::mc "Unable to create destination root path: %s"] $result]
    134             }
    135         }
    136 
    137         if [catch {system "gnutar -T [lindex $plist 1] -cPpf - | (cd ${destpath} && tar xvf -)"} return] {
    138             file delete [lindex $plist 1]
    139             return -code error [format [msgcat::mc "Package creation failed - gnutar returned error status: %s"] $result]
    140         }
    141         file delete [lindex $plist 1]
    142     }
    143     if {![file isdirectory $resourcepath]} {
    144         if {[catch {file mkdir $resourcepath} result]} {
    145             return -code error [format [msgcat::mc "Unable to create package resource directory: %s"] $result]
    146         }
    147     }
    148 
    14960    # XXX: we need to support .lproj in resources.
    15061    set pkgpath ${package.destpath}/${portname}.pkg
     
    16273        }
    16374    }
    164     write_welcome_rtf ${pkgpath}/Contents/Resources/Welcome.rtf $portname $portversion $pkg_long_description $pkg_description $pkg_homepage
     75    write_welcome_html ${pkgpath}/Contents/Resources/Welcome.html $portname $portversion $pkg_long_description $pkg_description $pkg_homepage
    16576    file copy -force -- ${portresourcepath}/package/background.tiff ${pkgpath}/Contents/Resources/background.tiff
    16677    system "mkbom ${destpath} ${pkgpath}/Contents/Archive.bom"
     
    286197}
    287198
    288 proc write_welcome_rtf {filename portname portversion long_description description homepage} {
     199proc write_welcome_html {filename portname portversion long_description description homepage} {
    289200    set fd [open ${filename} w+]
    290201    if {$long_description == ""} {
    291202        set long_description $description
    292203    }
    293     puts $fd \
    294 "{\\rtf1\\mac\\ansicpg10000\\cocoartf102
    295 {\\fonttbl\\f0\\fswiss\\fcharset77 Helvetica-Bold;\\f1\\fswiss\\fcharset77 Helvetica;}
    296 {\\colortbl;\\red255\\green255\\blue255;\\red1\\green1\\blue1;}
    297 \\vieww9000\\viewh9000\\viewkind0
    298 \\pard\\tx560\\tx1120\\tx1680\\tx2240\\tx2800\\tx3360\\tx3920\\tx4480\\tx5040\\tx5600\\tx6160\\tx6720\\ql\\qnatural
    299 
    300 \\f0\\b\\fs24 \\cf2 Welcome to the ${portname} for Mac OS X Installer\\
    301 \\
    302 \\pard\\tx560\\tx1120\\tx1680\\tx2240\\tx2800\\tx3360\\tx3920\\tx4480\\tx5040\\tx5600\\tx6160\\tx6720\\ql\\qnatural
    303 "
    304     puts $fd "\\f1\\b0 \\cf2 ${long_description} \\\n\\"
     204
     205puts $fd "
     206<html lang=\"en\">
     207<head>
     208        <meta http-equiv=\"content-type\" content=\"text/html; charset=iso-8859-1\">
     209        <title>Install ${portname}</title>
     210</head>
     211<body>
     212<font face=\"Helvetica\"><b>Welcome to the ${portname} for Mac OS X Installer</b></font>
     213<p>
     214<font face=\"Helvetica\">${long_description}</font>
     215<p>"
     216
    305217    if {$homepage != ""} {
    306         puts $fd "${homepage} \\\n\\"
    307     }
    308     puts $fd "This installer guides you through the steps necessary to install ${portname} ${portversion} for Mac OS X. To get started, click Continue.\\\n}"
     218        puts $fd "<font face=\"Helvetica\">${homepage}</font><p>"
     219    }
     220
     221    puts $fd "<font face=\"Helvetica\">This installer guides you through the steps necessary to install ${portname} ${portversion} for Mac OS X. To get started, click Continue.</font>
     222</body>
     223</html>"
    309224
    310225    close $fd
Note: See TracChangeset for help on using the changeset viewer.