[90013] branches/release_2_0
jmr at macports.org
jmr at macports.org
Sun Feb 19 10:32:47 PST 2012
Revision: 90013
http://trac.macports.org/changeset/90013
Author: jmr at macports.org
Date: 2012-02-19 10:32:47 -0800 (Sun, 19 Feb 2012)
Log Message:
-----------
merge r89994, r90004 from trunk:
set env(HOME) to our own dirs (#31827) and copy user's xcode 4.3 plist into them
Revision Links:
--------------
http://trac.macports.org/changeset/89994
http://trac.macports.org/changeset/90004
Modified Paths:
--------------
branches/release_2_0/base/src/macports1.0/macports.tcl
branches/release_2_0/base/src/port1.0/portmain.tcl
branches/release_2_0/base/src/port1.0/portutil.tcl
Property Changed:
----------------
branches/release_2_0/
branches/release_2_0/base/
Property changes on: branches/release_2_0
___________________________________________________________________
Modified: svn:mergeinfo
- /trunk:79584,79586,79590-79594,79599-79600,79649,79686,79689,79692,79750,79762,79787,79864,79943,80069,80088,80178,80220,80222,80224,80226,80229,80245,80287,80335,80443,80581,80583,80586,80779,80797-80798,80894,80928,80932,80934,80969,80971,81119,81146,81234,81361,81371,81414-81415,81454,81464,81467,81522,81557-81558,81562,81565,81567,81577,81630,81657,81830-81832,82111,82767,82921,82924,82947,83136,83149,83267,83270-83271,83391,83395,83443,84351,88045,89988,89993,90002,90010
+ /trunk:79584,79586,79590-79594,79599-79600,79649,79686,79689,79692,79750,79762,79787,79864,79943,80069,80088,80178,80220,80222,80224,80226,80229,80245,80287,80335,80443,80581,80583,80586,80779,80797-80798,80894,80928,80932,80934,80969,80971,81119,81146,81234,81361,81371,81414-81415,81454,81464,81467,81522,81557-81558,81562,81565,81567,81577,81630,81657,81830-81832,82111,82767,82921,82924,82947,83136,83149,83267,83270-83271,83391,83395,83443,84351,88045,89988,89993-89994,90002,90004,90010
Property changes on: branches/release_2_0/base
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/gsoc08-privileges/base:37343-46937
/branches/gsoc09-logging/base:51231-60371
/branches/universal-sanity/base:51872-52323
/branches/variant-descs-14482/base:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
/trunk/base:79584,79586,79590-79594,79599-79600,79649,79686,79689,79692,79750,79762,79771-79774,79782,79787,79864,79943,80069,80088,80178,80220,80222,80224,80226,80229,80245,80287,80335,80443,80581,80583,80586,80779,80797-80798,80894,80928,80932,80934,80969,80971,81005,81119,81146,81171,81234,81269,81361,81371,81414-81415,81454,81464,81467,81475,81522,81556-81558,81562,81565,81567,81577,81630,81657,81830-81832,82111,82135,82767,82921,82924,82947,83136,83149,83267,83270-83271,83391,83395,83443,83471,83537,84351,88045,89988,89993,90002,90010
/users/perry/base-bugs_and_notes:45682-46060
/users/perry/base-select:44044-44692
+ /branches/gsoc08-privileges/base:37343-46937
/branches/gsoc09-logging/base:51231-60371
/branches/universal-sanity/base:51872-52323
/branches/variant-descs-14482/base:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
/trunk/base:79584,79586,79590-79594,79599-79600,79649,79686,79689,79692,79750,79762,79771-79774,79782,79787,79864,79943,80069,80088,80178,80220,80222,80224,80226,80229,80245,80287,80335,80443,80581,80583,80586,80779,80797-80798,80894,80928,80932,80934,80969,80971,81005,81119,81146,81171,81234,81269,81361,81371,81414-81415,81454,81464,81467,81475,81522,81556-81558,81562,81565,81567,81577,81630,81657,81830-81832,82111,82135,82767,82921,82924,82947,83136,83149,83267,83270-83271,83391,83395,83443,83471,83537,84351,88045,89988,89993-89994,90002,90004,90010
/users/perry/base-bugs_and_notes:45682-46060
/users/perry/base-select:44044-44692
Modified: branches/release_2_0/base/src/macports1.0/macports.tcl
===================================================================
--- branches/release_2_0/base/src/macports1.0/macports.tcl 2012-02-19 18:31:37 UTC (rev 90012)
+++ branches/release_2_0/base/src/macports1.0/macports.tcl 2012-02-19 18:32:47 UTC (rev 90013)
@@ -6,7 +6,7 @@
# Copyright (c) 2004 - 2005 Paul Guyot, <pguyot at kallisys.net>.
# Copyright (c) 2004 - 2006 Ole Guldberg Jensen <olegb at opendarwin.org>.
# Copyright (c) 2004 - 2005 Robert Shaw <rshaw at opendarwin.org>
-# Copyright (c) 2004 - 2011 The MacPorts Project
+# Copyright (c) 2004 - 2012 The MacPorts Project
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -52,7 +52,7 @@
variable user_options "submitter_name submitter_email submitter_key"
variable portinterp_options "\
portdbpath porturl portpath portbuildpath auto_path prefix prefix_frozen portsharepath \
- registry.path registry.format \
+ registry.path registry.format user_home \
portarchivetype archivefetch_pubkeys portautoclean porttrace keeplogs portverbose destroot_umask \
rsync_server rsync_options rsync_dir startupitem_type place_worksymlink macportsuser \
mp_remote_url mp_remote_submit_url configureccache ccache_dir ccache_size configuredistcc configurepipe buildnicevalue buildmakejobs \
@@ -484,16 +484,6 @@
# Set the system encoding to utf-8
encoding system utf-8
- # Ensure that the macports user directory exists if HOME is defined
- if {[info exists env(HOME)]} {
- set macports::macports_user_dir [file normalize $macports::autoconf::macports_user_dir]
- } else {
- # Otherwise define the user directory as a direcotory that will never exist
- set macports::macports_user_dir "/dev/null/NO_HOME_DIR"
- # Tcl library code wants to do tilde expansion in various places
- set env(HOME) ${macports::macports_user_dir}
- }
-
# set up platform info variables
set os_arch $tcl_platform(machine)
if {$os_arch == "Power Macintosh"} { set os_arch "powerpc" }
@@ -509,6 +499,23 @@
set macosx_version [expr 10.0 + ($os_major - 4) / 10.0]
}
+ # Ensure that the macports user directory (i.e. ~/.macports) exists if HOME is defined.
+ # Also save $HOME for later use before replacing it with our own.
+ if {[info exists env(HOME)]} {
+ set macports::user_home $env(HOME)
+ set macports::macports_user_dir [file normalize $macports::autoconf::macports_user_dir]
+ } elseif {[info exists env(SUDO_USER)] && $os_platform == "darwin"} {
+ set macports::user_home [exec dscl -q . -read /Users/$env(SUDO_USER) NFSHomeDirectory | cut -d ' ' -f 2]
+ set macports::macports_user_dir [file join ${macports::user_home} [string range $macports::autoconf::macports_user_dir 2 end]]
+ } elseif {[exec id -u] != 0 && $os_platform == "darwin"} {
+ set macports::user_home [exec dscl -q . -read /Users/[exec id -un] NFSHomeDirectory | cut -d ' ' -f 2]
+ set macports::macports_user_dir [file join ${macports::user_home} [string range $macports::autoconf::macports_user_dir 2 end]]
+ } else {
+ # Otherwise define the user directory as a directory that will never exist
+ set macports::macports_user_dir "/dev/null/NO_HOME_DIR"
+ set macports::user_home "/dev/null/NO_HOME_DIR"
+ }
+
# Configure the search path for configuration files
set conf_files ""
lappend conf_files "${macports_conf_path}/macports.conf"
@@ -648,6 +655,7 @@
}
}
+ set env(HOME) [file join $portdbpath home]
set registry.path $portdbpath
# Format for receipts; currently only "sqlite" is allowed
@@ -889,6 +897,10 @@
trace add variable macports::xcodebuildcmd read macports::setxcodeinfo
}
+ if {[vercmp $xcodeversion 4.3] >= 0} {
+ macports::copy_xcode_plist $env(HOME)
+ }
+
# Set the default umask
if {![info exists destroot_umask]} {
set destroot_umask 022
@@ -987,6 +999,21 @@
registry::close
}
+# link plist for xcode 4.3's benefit
+proc macports::copy_xcode_plist {target_homedir} {
+ global macports::user_home
+ set user_plist "${user_home}/Library/Preferences/com.apple.dt.Xcode.plist"
+ set target_dir "${target_homedir}/Library/Preferences"
+ if {[file isfile $user_plist]} {
+ if {[catch {
+ file mkdir "${target_homedir}/Library/Preferences"
+ file copy -force $user_plist $target_dir
+ } result]} {
+ ui_debug "Failed to copy com.apple.dt.Xcode.plist: $result"
+ }
+ }
+}
+
proc macports::worker_init {workername portpath porturl portbuildpath options variations} {
global macports::portinterp_options macports::portinterp_deferred_options
@@ -1046,6 +1073,7 @@
$workername alias realpath realpath
$workername alias _mportsearchpath _mportsearchpath
$workername alias _portnameactive _portnameactive
+ $workername alias _copy_xcode_plist macports::copy_xcode_plist
# New Registry/Receipts stuff
$workername alias registry_new registry::new_entry
Modified: branches/release_2_0/base/src/port1.0/portmain.tcl
===================================================================
--- branches/release_2_0/base/src/port1.0/portmain.tcl 2012-02-19 18:31:37 UTC (rev 90012)
+++ branches/release_2_0/base/src/port1.0/portmain.tcl 2012-02-19 18:32:47 UTC (rev 90013)
@@ -55,7 +55,7 @@
supported_archs depends_skip_archcheck installs_libs \
copy_log_files \
compiler.cpath compiler.library_path \
- add_users
+ add_users altprefix
# Order of option_proc and option_export matters. Filter before exporting.
@@ -157,30 +157,9 @@
set euid [geteuid]
set egid [getegid]
-# resolve the alternate work path in ~/.macports
-proc portmain::set_altprefix {} {
- global altprefix env euid
-
- # do tilde expansion manually - Tcl won't expand tildes automatically for curl, etc.
- if {[info exists env(HOME)]} {
- # HOME environment var is set, use it.
- set userhome "$env(HOME)"
- } elseif {$euid == 0 && [info exists env(SUDO_USER)] && $env(SUDO_USER) != ""} {
- set userhome [file normalize "~$env(SUDO_USER)"]
- } else {
- # the environment var isn't set, expand ~user instead
- set username [uid_to_name [getuid]]
- if {[catch {set userhome [file normalize "~$username"]}]} {
- set userhome ""
- }
- }
-
- set altprefix [file join $userhome .macports]
-}
-
# if unable to write to workpath, implies running without either root privileges
# or a shared directory owned by the group so use ~/.macports
-portmain::set_altprefix
+default altprefix {[file join $user_home .macports]}
if { $euid != 0 && (([info exists workpath] && [file exists $workpath] && ![file writable $workpath]) || ([info exists portdbpath] && ![file writable [file join $portdbpath build]])) } {
# set global variable indicating to other functions to use ~/.macports as well
Modified: branches/release_2_0/base/src/port1.0/portutil.tcl
===================================================================
--- branches/release_2_0/base/src/port1.0/portutil.tcl 2012-02-19 18:31:37 UTC (rev 90012)
+++ branches/release_2_0/base/src/port1.0/portutil.tcl 2012-02-19 18:32:47 UTC (rev 90013)
@@ -5,7 +5,7 @@
# Copyright (c) 2002-2003 Apple Inc.
# Copyright (c) 2004 Robert Shaw <rshaw at opendarwin.org>
# Copyright (c) 2006-2007 Markus W. Weissmann <mww at macports.org>
-# Copyright (c) 2004-2011 The MacPorts Project
+# Copyright (c) 2004-2012 The MacPorts Project
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -1229,11 +1229,14 @@
set ports_dry_last_skipped ""
proc target_run {ditem} {
- global target_state_fd workpath portpath ports_trace PortInfo ports_dryrun ports_dry_last_skipped worksrcpath prefix subport
+ global target_state_fd workpath portpath ports_trace PortInfo ports_dryrun \
+ ports_dry_last_skipped worksrcpath prefix subport env portdbpath
set portname $subport
set result 0
set skipped 0
set procedure [ditem_key $ditem procedure]
+ set savedhome [file join $portdbpath home]
+ set env(HOME) "${workpath}/.home"
if {[ditem_key $ditem state] != "no"} {
set target_state_fd [open_statefile]
@@ -1428,6 +1431,8 @@
close $target_state_fd
}
+ set env(HOME) $savedhome
+
return $result
}
@@ -1533,8 +1538,8 @@
# open_statefile
# open file to store name of completed targets
proc open_statefile {args} {
- global workpath worksymlink place_worksymlink subport portpath ports_ignore_older ports_dryrun
- global usealtworkpath altprefix env applications_dir subbuildpath
+ global workpath worksymlink place_worksymlink subport portpath ports_ignore_older ports_dryrun \
+ usealtworkpath altprefix env applications_dir subbuildpath
if {$usealtworkpath} {
ui_warn_once "privileges" "MacPorts running without privileges.\
@@ -1559,9 +1564,15 @@
}
}
- if {![file isdirectory $workpath] && ![tbool ports_dryrun]} {
- file mkdir $workpath
- chownAsRoot $subbuildpath
+ if {![tbool ports_dryrun]} {
+ if {![file isdirectory $workpath]} {
+ file mkdir "${workpath}/.home"
+ global xcodeversion
+ if {[vercmp $xcodeversion 4.3] >= 0} {
+ _copy_xcode_plist "${workpath}/.home"
+ }
+ chownAsRoot $subbuildpath
+ }
# Create a symlink to the workpath for port authors
if {[tbool place_worksymlink] && ![file isdirectory $worksymlink]} {
ui_debug "Attempting ln -sf $workpath $worksymlink"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20120219/9a492442/attachment.html>
More information about the macports-changes
mailing list