Changeset 1514 for trunk/base


Ignore:
Timestamp:
Dec 24, 2002, 8:21:55 AM (17 years ago)
Author:
landonf (Landon Fuller)
Message:

Initial .pkg support

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

Legend:

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

    r1503 r1514  
    4848
    4949proc install_start {args} {
    50     global UI_PREFIX portname build.target.install destdir
     50    global UI_PREFIX portname build.target.install destpath
    5151
    52     ui_msg "$UI_PREFIX Installing ${portname} into ${destdir} with target ${build.target.install}"
     52    ui_msg "$UI_PREFIX Installing ${portname} into ${destpath} with target ${build.target.install}"
    5353       
    54         file mkdir ${destdir}
    55         system "mtree -U -f /etc/ports/prefix.mtree -d -e -p ${destdir} > /dev/null"
     54        file mkdir ${destpath}
    5655}
    5756
  • trunk/base/src/port1.0/portmain.tcl

    r1503 r1514  
    4848option_proc default_variants handle_default_variants
    4949
     50# Hard coded version number for resource location
     51default portresourcepath {[file join $prefix share/darwinports/resources/port1.0]}
    5052default distpath {[file join $portdbpath distfiles]}
    5153default workdir work
    5254default workpath {[file join $portpath $workdir]}
    5355default prefix /opt/local
    54 default destdir {${workpath}/destdir}
     56# XXX destdir is depricated in favor of destpath, but is provided
     57# for backwards compatibility
     58default destdir destroot
     59default destpath {${workpath}/${destdir}}
    5560default filedir files
    5661default revision 0
  • trunk/base/src/port1.0/portpackage.tcl

    r1503 r1514  
    3939
    4040# define options
    41 options package.type package.dir
     41options package.type package.destpath
    4242
    4343# Set defaults
    4444default package.type tarball
    45 default package.dir ""
     45default package.destpath {${workpath}}
    4646
    4747set UI_PREFIX "---> "
     
    6767    # into another routine anyway so that this is abstract enough.
    6868
    69     return [package_tarball $portname $portversion $entry]
     69    return [package_pkg $portname $portversion $entry]
    7070}
    7171
     
    7373# method.
    7474proc package_tarball {portname portversion entry} {
    75     global portdbpath package.dir
     75    global portdbpath package.destpath
    7676
    7777    set rfile [registry_exists $portname $portversion]
     
    8888        close $pfile
    8989
    90         if [file isdirectory ${package.dir}] {
    91             set ptarget ${package.dir}/${portname}-${portversion}.tar.gz
    92         } else {
    93             set ptarget ${portname}-${portversion}.tar.gz
    94         }
     90        set ptarget ${package.destpath}/${portname}-${portversion}.tar.gz
    9591        if [catch {system "gnutar -T [lindex $plist 1] -czPpf ${ptarget}"} err] {
    9692            ui_error "Package creation failed - gnutar returned error status: $err"
     
    105101    return 0
    106102}
     103
     104proc package_pkg {portname portversion entry} {
     105    global portdbpath destpath workpath contents prefix portresourcepath description package.destpath
     106
     107    set resourcepath ${workpath}/pkg_resources
     108    set rfile [registry_exists $portname $portversion]
     109    set ix [lsearch $entry contents]
     110    if {$ix >= 0} {
     111        set plist [mkstemp ${workpath}/.${portname}.plist.XXXXXXXXX]
     112        set pfile [lindex $plist 0]
     113        # XXX hack that allows contents list to be grouped by braces
     114        # XXX split contents list up if it contains one argument
     115        # XXX this breaks contents lists that contain one filename, with spaces.
     116        if {[llength $contents] == 1} {
     117            set clist [eval return $contents]
     118        } else {
     119            set clist $contents
     120        }
     121
     122        foreach f $clist {
     123            set fname [lindex $f 0]
     124            puts $pfile $fname
     125        }
     126        close $pfile
     127
     128        if {![file isdirectory $destpath]} {
     129            if {[catch {file mkdir $destpath} result]} {
     130                ui_error "Unable to create destination root path: $result"
     131                return -code error "Unable to create destination root path: $result"
     132            }
     133        }
     134
     135        if [catch {system "(cd ${prefix} && gnutar -T [lindex $plist 1] -cPpf -) | (cd ${destpath} && tar xvf -)"} return] {
     136            ui_error "Package creation failed - gnutar returned error status: $return"
     137            file delete [lindex $plist 1]
     138            return -code error "Package creation failed - gnutar returned error status: $return"
     139        }
     140        file delete [lindex $plist 1]
     141
     142        if {![file isdirectory $resourcepath]} {
     143            if {[catch {file mkdir $resourcepath} result]} {
     144                ui_error "Unable to create package resource directory: $result"
     145                return -code error "Unable to create package resource directory: $result"
     146            }
     147        }
     148
     149        set infofile ${workpath}/${portname}.info
     150        set infofd [open ${infofile} w+]
     151
     152        puts $infofd "Title ${portname}
     153Version ${portversion}
     154Description ${description}
     155DefaultLocation ${prefix}
     156DeleteWarning
     157
     158### Package Flags
     159
     160NeedsAuthorization YES
     161Required NO
     162Relocatable NO
     163RequiresReboot NO
     164UseUserMask YES
     165OverwritePermissions NO
     166InstallFat NO
     167RootVolumeOnly NO"
     168        close $infofd
     169        system "package ${destpath} ${infofile} ${portresourcepath}/package/background.tiff -d ${package.destpath}"
     170
     171    }
     172    return 0
     173}
Note: See TracChangeset for help on using the changeset viewer.