Changeset 37797


Ignore:
Timestamp:
Jun 23, 2008, 10:04:58 PM (12 years ago)
Author:
pmagrath@…
Message:

Tidy up code. Replace external call to whoami with nicer tcl code with same effect.

Location:
branches/gsoc08-privileges/base/src/port1.0
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/gsoc08-privileges/base/src/port1.0/portfetch.tcl

    r37794 r37797  
    627627# Initialize fetch target and call checkfiles.
    628628proc fetch_init {args} {
    629     global usealtworkpath distfiles distname distpath all_dist_files dist_subdir fetch.type fetch_init_done
     629    global distfiles distname distpath all_dist_files dist_subdir fetch.type fetch_init_done
     630    global altprefix usealtworkpath
    630631   
    631632    if {[info exists distpath] && [info exists dist_subdir] && ![info exists fetch_init_done]} {
    632633
    633634                # start gsoc08-privileges
    634         if { $usealtworkpath} {
     635        if { $usealtworkpath } {
    635636        # I have removed ![file writable $distpath] from the if condition as
    636637        # the writable condition seems to get confused by effective uids.
    637                         set distpath "/Users/[exec whoami]/.macports/[ string range $distpath 1 end ]"
     638                        set distpath "$altprefix/[ string range $distpath 1 end ]"
    638639                        ui_debug "Going to use $distpath for fetch."
    639640        }
  • branches/gsoc08-privileges/base/src/port1.0/portutil.tcl

    r37794 r37797  
    13791379# open file to store name of completed targets
    13801380proc open_statefile {args} {
    1381     global macportsuser euid egid usealtworkpath workpath worksymlink place_worksymlink portname portpath ports_ignore_older
     1381    global workpath worksymlink place_worksymlink portname portpath ports_ignore_older
     1382    global altprefix macportsuser euid egid usealtworkpath
    13821383   
    13831384        # start gsoc08-privileges
    13841385       
    13851386        # TODO: move the macportsuser setting to macports.conf
    1386         set macportsuser "paul"
     1387        set macportsuser "[uid_to_name [getuid]]"
    13871388
    13881389        # descalate privileges - only ran if macports stated with sudo
     
    14301431   
    14311432                # do tilde expansion manually - tcl won't expand tildes automatically for curl, etc.
    1432                         set userhome "/Users/[exec whoami]"
     1433                        set userhome "/Users/[uid_to_name [getuid]]"
     1434                       
     1435                        # set alternative prefix global variables
     1436                        set altprefix "$userhome/.macports"
    14331437                       
    14341438                        # get alternative paths
    1435                         set newworkpath "$userhome/.macports/[ string range $workpath 1 end ]"
    1436                         set newworksymlink "$userhome/.macports/[ string range $worksymlink 1 end ]"
     1439                        set newworkpath "$altprefix/[ string range $workpath 1 end ]"
     1440                        set newworksymlink "$altprefix/[ string range $worksymlink 1 end ]"
    14371441                       
    14381442                        set sourcepath [string map {"work" ""} $worksymlink]
    1439                         set newsourcepath "$userhome/.macports/[ string range $sourcepath 1 end ]"
     1443                        set newsourcepath "$altprefix/[ string range $sourcepath 1 end ]"
    14401444       
    14411445                        # copy Portfile if not there already
Note: See TracChangeset for help on using the changeset viewer.