Changeset 1516 for trunk/base


Ignore:
Timestamp:
Dec 24, 2002, 9:33:28 PM (17 years ago)
Author:
kevin
Message:

Don't use /usr/bin/package. It makes .pkg files in an obsolete format.
Instead we will implement our own.

File:
1 edited

Legend:

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

    r1514 r1516  
    103103
    104104proc package_pkg {portname portversion entry} {
    105     global portdbpath destpath workpath contents prefix portresourcepath description package.destpath
     105    global portdbpath destpath workpath contents prefix portresourcepath description package.destpath long_description
    106106
    107107    set resourcepath ${workpath}/pkg_resources
     
    147147        }
    148148
    149         set infofile ${workpath}/${portname}.info
    150         set infofd [open ${infofile} w+]
    151 
     149# XXX: we need to support .lproj in resources.
     150        set pkgpath ${workpath}/${portname}-${portversion}.pkg
     151        system "mkdir -p -m 0755 ${pkgpath}/Contents/Resources"
     152        write_PkgInfo ${pkgpath}/Contents/PkgInfo
     153        write_info_file ${pkgpath}/Contents/Resources/${portname}.info $portname $portversion $description $prefix
     154        write_info_plist ${pkgpath}/Contents/Info.plist $portname $portversion $prefix
     155        write_description_plist ${pkgpath}/Contents/Resources/Description.plist $portname $portversion $description
     156        system "cp ${portresourcepath}/package/background.tiff ${pkgpath}/Contents/Resources/background.tiff"
     157        system "mkbom ${destpath} ${pkgpath}/Contents/Archive.bom"
     158        system "cd ${pkgpath}/Contents/Resources/ && ln -s ../Archive.bom ${portname}.bom"
     159        system "cd ${destpath} && pax -w -z . > ${pkgpath}/Contents/Archive.pax.gz"
     160        system "cd ${pkgpath}/Contents/Resources/ && ln -s ../Archive.pax.gz ${portname}.pax.gz"
     161
     162        write_sizes_file ${pkgpath}/Contents/Resources/${portname}.sizes ${pkgpath} ${destpath}
     163       
     164#       system "package ${destpath} ${infofile} ${portresourcepath}/package/background.tiff -d ${package.destpath}"
     165
     166    }
     167    return 0
     168}
     169
     170proc write_PkgInfo {infofile} {
     171        set infofd [open ${infofile} w+]
     172        puts $infofd "pmkrpkg1"
     173        close $infofd
     174}
     175
     176proc write_info_file {infofile portname portversion description destination} {
     177        if {[string index $destination end] != "/"} {
     178                append destination /
     179        }
     180
     181        set infofd [open ${infofile} w+]
    152182        puts $infofd "Title ${portname}
    153183Version ${portversion}
    154184Description ${description}
    155 DefaultLocation ${prefix}
     185DefaultLocation ${destination}
    156186DeleteWarning
    157187
     
    167197RootVolumeOnly NO"
    168198        close $infofd
    169         system "package ${destpath} ${infofile} ${portresourcepath}/package/background.tiff -d ${package.destpath}"
    170 
    171     }
    172     return 0
    173 }
     199}
     200
     201proc write_info_plist {infofile portname portversion destination} {
     202        set vers [split $portversion "."]
     203        set major [lindex $vers 0]
     204        set minor [lindex $vers 1]
     205       
     206        if {[string index $destination end] != "/"} {
     207                append destination /
     208        }
     209
     210        set infofd [open ${infofile} w+]
     211        puts $infofd {<?xml version="1.0" encoding="UTF-8"?>
     212<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
     213<plist version="1.0">
     214}
     215        puts $infofd "<dict>
     216        <key>CFBundleGetInfoString</key>
     217        <string>${portname} ${portversion}</string>
     218        <key>CFBundleIdentifier</key>
     219        <string>org.opendarwin.darwinports.${portname}</string>
     220        <key>CFBundleName</key>
     221        <string>${portname}</string>
     222        <key>CFBundleShortVersionString</key>
     223        <string>${portversion}</string>
     224        <key>IFMajorVersion</key>
     225        <integer>${major}</integer>
     226        <key>IFMinorVersion</key>
     227        <integer>${minor}</integer>
     228        <key>IFPkgFlagAllowBackRev</key>
     229        <false/>
     230        <key>IFPkgFlagAuthorizationAction</key>
     231        <string>RootAuthorization</string>
     232        <key>IFPkgFlagDefaultLocation</key>
     233        <string>${destination}</string>
     234        <key>IFPkgFlagInstallFat</key>
     235        <false/>
     236        <key>IFPkgFlagIsRequired</key>
     237        <false/>
     238        <key>IFPkgFlagRelocatable</key>
     239        <false/>
     240        <key>IFPkgFlagRestartAction</key>
     241        <string>NoRestart</string>
     242        <key>IFPkgFlagRootVolumeOnly</key>
     243        <false/>
     244        <key>IFPkgFlagUpdateInstalledLanguages</key>
     245        <false/>
     246        <key>IFPkgFormatVersion</key>
     247        <real>0.10000000149011612</real>
     248</dict>
     249</plist>"
     250        close $infofd
     251}
     252
     253proc write_description_plist {infofile portname portversion description} {
     254        set infofd [open ${infofile} w+]
     255        puts $infofd {<?xml version="1.0" encoding="UTF-8"?>
     256<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
     257<plist version="1.0">
     258}
     259        puts $infofd "<dict>
     260        <key>IFPkgDescriptionDeleteWarning</key>
     261        <string></string>
     262        <key>IFPkgDescriptionDescription</key>
     263        <string>${description}</string>
     264        <key>IFPkgDescriptionTitle</key>
     265        <string>${portname}</string>
     266        <key>IFPkgDescriptionVersion</key>
     267        <string>${portversion}</string>
     268</dict>
     269</plist>"
     270        close $infofd
     271}
     272
     273proc write_sizes_file {sizesfile pkgpath destpath} {
     274set numFiles 0
     275set compressedSize 0
     276set installedSize 0
     277#       set numFiles `lsbom -s "${pkgpath}/Contents/Archive.bom" | wc -l`
     278#       set compresedSize `du -k -s "$pkgpath" | awk '{print $1}'`
     279#       incr compressedSize 3
     280#       set infoSize `ls -s "${pkgpath}/Contents/Resources/${portname}.info" | awk '{print $1}'`
     281#       set bomSize `ls -s "${pkgpath}/Contents/Archive.bom" | awk '{print $1}'`
     282#       set installedSize `du -k -s "$destpath" | awk '{print $1}'`
     283#       incr installedSize $infoSize
     284#       incr installedSize $bomSize
     285#       incr installedSize 3
     286       
     287        set fd [open ${sizesfile} w+]
     288        puts $fd "NumFiles $numFiles
     289InstalledSize $installedSize
     290CompressedSize $compressedSize"
     291        close $fd
     292}
Note: See TracChangeset for help on using the changeset viewer.