Ticket #43208: PortIndex2MySQL.tcl.diff

File PortIndex2MySQL.tcl.diff, 2.2 KB (added by ryandesign (Ryan Carsten Schmidt), 11 years ago)

proposed patch

  • PortIndex2MySQL.tcl

     
    1 #!/opt/local/bin/tclsh
     1#!/bin/sh
    22# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4
     3# $Id$
    34#
    4 # PortIndex2MySQL.tcl
    55# Kevin Van Vechten | kevin@opendarwin.org
    66# 3-Oct-2002
    77# Juan Manuel Palacios | jmpp@macports.org
    88# 22-Nov-2007
    9 # $Id$
    109#
    1110# Copyright (c) 2007 Juan Manuel Palacios, The MacPorts Project.
    1211# Copyright (c) 2003 Apple Inc.
     
    3736# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    3837# POSSIBILITY OF SUCH DAMAGE.
    3938
     39# A short Bourne shell script to relaunch this file under MacPorts' tclsh.\
     40PORT="$(which port 2>&1)" #\
     41if [ ! -x "$PORT" ]; then #\
     42    echo "Could not find port command in PATH." 1>&2 #\
     43    exit 1 #\
     44fi #\
     45MACPORTS_PREFIX=${PORT%/bin/port} #\
     46exec "$MACPORTS_PREFIX/libexec/macports/bin/tclsh8.5" "$0" "$@"
    4047
     48
    4149#####
    4250# The PortIndex2MySQL script populates a database with key information extracted
    4351# from the Portfiles in the ports tree pointed to by the sources.conf file in a
     
    5765# setup.
    5866#####
    5967
     68set macports_prefix [file join {*}[lrange [file split [info nameofexecutable]] 0 end-4]]
    6069
    6170
    6271# Runtime information log file and reciepient.
     
    178187}
    179188
    180189# Load macports1.0 so that we can use some of its procs and the portinfo array.
    181 if {[catch { source [file join "@macports_tcl_dir@" macports1.0 macports_fastload.tcl] } errstr]} {
     190if {[catch { source [file join $macports_prefix share macports Tcl macports1.0 macports_fastload.tcl] } errstr]} {
    182191    puts $runlog_fd "${::errorInfo}"
    183192    puts $runlog_fd "Failed to locate the macports1.0 Tcl package file: $errstr"
    184193    cleanup lockfile
     
    208217set portsdb_host localhost
    209218set portsdb_name macports
    210219set portsdb_user macports
    211 set passwdfile "/opt/local/share/macports/resources/portmgr/password_file"
     220set passwdfile [file join $macports_prefix share macports resources portmgr password_file]
    212221set portsdb_passwd [getpasswd $passwdfile]
    213222set portsdb_cmd [macports::findBinary mysql5]
    214223