Ticket #1068: dports.2.patch

File dports.2.patch, 3.8 KB (added by jdputsch@…, 21 years ago)

Sample implementation patch to base/...

  • ./base/src/port1.0/portinstall.tcl

    ? ./base/config.log
    ? ./base/config.status
    ? ./base/Makefile
    ? ./base/Mk/dports.autoconf.mk
    ? ./base/doc/ports.conf
    ? ./base/doc/prefix.mtree
    ? ./base/src/config.h
    ? ./base/src/darwinports1.0/Darwinports.dylib
    ? ./base/src/darwinports1.0/darwinports_autoconf.tcl
    ? ./base/src/pextlib1.0/Pextlib.dylib
    ? ./base/src/port/port
    ? ./base/src/port/portall
    ? ./base/src/port/portindex
    ? ./base/src/port1.0/portpackage.tcl.jdp.1
    ? ./base/src/port1.0/portpackage.tcl.jdp.2
    ? ./base/src/programs/Makefile
    RCS file: /Volumes/src/cvs/od/proj/darwinports/base/src/port1.0/portinstall.tcl,v
    retrieving revision 1.65
    diff -b -u -r1.65 portinstall.tcl
     
    111111    cd $pwd
    112112}
    113113
     114proc run_inst_helper_script {script} {
     115    global workdir prefix
     116
     117    set script_src [file join [option filespath] [option $script]]
     118    set script_exe [file join $workdir [option $script]]
     119
     120    if {[file exists $script_src]} {
     121        system "cp $script_src $script_exe"
     122        reinplace "s|@PREFIX@|$prefix|g" $script_exe
     123        system "chmod a+rx ${script_exe}"
     124        system $script_exe
     125    }
     126}
     127
     128
    114129proc install_main {args} {
    115130    global portname portversion portpath categories description long_description homepage depends_run installPlist package-install uninstall workdir worksrcdir prefix UI_PREFIX destroot
    116131
     132    # Run preinstall script if it exists
     133    run_inst_helper_script [option preinstall]
     134
    117135    # Install ${destroot} contents into /
    118136    directory_dig ${destroot} ${destroot}
     137
     138    # Run postinstall script if it exists
     139    run_inst_helper_script [option postinstall]
    119140
    120141    # Package installed successfully, so now we must register it
    121142    set rhandle [registry_new $portname $portversion]
  • ./base/src/port1.0/portmain.tcl

    RCS file: /Volumes/src/cvs/od/proj/darwinports/base/src/port1.0/portmain.tcl,v
    retrieving revision 1.45
    diff -b -u -r1.45 portmain.tcl
     
    6868default filesdir {files}
    6969default filespath {[file join $portpath $filesdir]}
    7070default worksrcpath {[file join $workpath $worksrcdir]}
     71default preinstall {preinstall}
     72default postinstall {postinstall}
     73default postremove {postremove}
    7174
    7275# Compatibility namespace
    7376default portname {$name}
  • ./base/src/port1.0/portpackage.tcl

    RCS file: /Volumes/src/cvs/od/proj/darwinports/base/src/port1.0/portpackage.tcl,v
    retrieving revision 1.44
    diff -b -u -r1.44 portpackage.tcl
     
    7777            set pkg_$variable [set $variable]
    7878        }
    7979    }
     80    # Add pre/post install scripts if they exist
     81
     82    foreach script {preinstall postinstall postremove} {
     83        set script_src [file join [option filespath] [option $script]]
     84        set script_dst "${pkgpath}/Contents/Resources/$script"
     85
     86        if {[file exists $script_src]} {
     87            system "cp ${script_src} ${script_dst}"
     88            reinplace "s|@PREFIX@|$prefix|g" $script_dst
     89            system "chmod a+rx ${script_dst}"
     90        }
     91    }
     92
    8093    write_welcome_html ${pkgpath}/Contents/Resources/Welcome.html $portname $portversion $pkg_long_description $pkg_description $pkg_homepage
    8194    file copy -force -- ${portresourcepath}/package/background.tiff ${pkgpath}/Contents/Resources/background.tiff
    8295    system "mkbom ${destpath} ${pkgpath}/Contents/Archive.bom"