[54855] branches/images-and-archives/base

blb at macports.org blb at macports.org
Sun Aug 2 21:22:39 PDT 2009


Revision: 54855
          http://trac.macports.org/changeset/54855
Author:   blb at macports.org
Date:     2009-08-02 21:22:38 -0700 (Sun, 02 Aug 2009)
Log Message:
-----------
Merge from trunk

Modified Paths:
--------------
    branches/images-and-archives/base/ChangeLog
    branches/images-and-archives/base/Mk/macports.autoconf.mk.in
    branches/images-and-archives/base/Mk/macports.tea.mk
    branches/images-and-archives/base/doc/macports.conf.in
    branches/images-and-archives/base/doc/port.1
    branches/images-and-archives/base/doc/portfile.7
    branches/images-and-archives/base/doc/prefix.mtree.in
    branches/images-and-archives/base/src/cregistry/Makefile
    branches/images-and-archives/base/src/macports1.0/Makefile
    branches/images-and-archives/base/src/macports1.0/macports.c
    branches/images-and-archives/base/src/macports1.0/macports.tcl
    branches/images-and-archives/base/src/pextlib1.0/Makefile
    branches/images-and-archives/base/src/pextlib1.0/Pextlib.c
    branches/images-and-archives/base/src/port/port-help.tcl
    branches/images-and-archives/base/src/port/port.tcl
    branches/images-and-archives/base/src/port/portindex.tcl
    branches/images-and-archives/base/src/port1.0/portconfigure.tcl
    branches/images-and-archives/base/src/port1.0/portdestroot.tcl
    branches/images-and-archives/base/src/port1.0/portfetch.tcl
    branches/images-and-archives/base/src/port1.0/portlint.tcl
    branches/images-and-archives/base/src/port1.0/portmain.tcl
    branches/images-and-archives/base/src/port1.0/porttrace.tcl
    branches/images-and-archives/base/src/port1.0/portutil.tcl
    branches/images-and-archives/base/src/programs/daemondo/Makefile.in
    branches/images-and-archives/base/src/programs/daemondo/main.c
    branches/images-and-archives/base/src/upgrade_sources_conf_default.tcl

Added Paths:
-----------
    branches/images-and-archives/base/src/macports1.0/sysctl.c
    branches/images-and-archives/base/src/macports1.0/sysctl.h

Removed Paths:
-------------
    branches/images-and-archives/base/src/pextlib1.0/sysctl.c
    branches/images-and-archives/base/src/pextlib1.0/sysctl.h

Property Changed:
----------------
    branches/images-and-archives/base/


Property changes on: branches/images-and-archives/base
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/gsoc08-privileges/base:37343-46937
/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:50249-54197
/users/perry/base-bugs_and_notes:45682-46060
/users/perry/base-select:44044-44692
   + /branches/gsoc08-privileges/base:37343-46937
/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:50249-54852
/users/perry/base-bugs_and_notes:45682-46060
/users/perry/base-select:44044-44692

Modified: branches/images-and-archives/base/ChangeLog
===================================================================
--- branches/images-and-archives/base/ChangeLog	2009-08-03 04:20:56 UTC (rev 54854)
+++ branches/images-and-archives/base/ChangeLog	2009-08-03 04:22:38 UTC (rev 54855)
@@ -5,39 +5,163 @@
 
 
 Release 1.8.0 (unreleased):
+    - There is now a 'build_arch' variable, available in portfiles and
+      configurable in macports.conf, which sets the CPU architecture that
+      ports should be compiled for (when not building universal). Its default
+      is the same as that of the Apple-supplied /usr/bin/gcc.
+      (#19874, jmr in r53217,r53386,r53420,r53494,r53860,r54236)
+
+    - MacPorts base now works on and has appropriate default settings for
+      Mac OS X 10.6 Snow Leopard. (#19874, toby/mww/jkh in r38271,r40060,
+      r40836,r43976,r52397)
+
+    - The universal_sysroot and universal_target keys have been removed from
+      macports.conf. These settings are now handled automatically.
+      (toby in r52324)
+
+    - Added a 'replaced_by' portfile option. This causes upgrade to deactivate
+      the current port and install the port specified by this option. This
+      also allows ports to be renamed. Upgrade accepts a --no-replace option
+      which disables this behaviour. (#20157, jmr in r54378)
+
+    - The upgrade action now accepts --force and --enforce-variants options.
+      The former causes ports to be rebuilt even if they are not outdated, and
+      the global -f option no longer has this effect (it had too many effects
+      already). The latter causes ports to be rebuilt if the requested
+      variants do not match those installed (even if they are not outdated).
+      (#20156, jmr in r54376)
+
+    - Dependencies can be satisfied by ports that are installed but not
+      available in the ports tree (useful for testing uncommitted ports).
+      (jmr in r52075, r52160)
+
+    - Ports that are installed but not available in the ports tree no longer
+      cause an error when running commands like 'port clean installed'. They
+      are skipped and a warning is printed. (#19253, jmr in r50865)
+
+    - Selfupdate no longer disables readline support unless readline is found
+      in /usr/local, which has historically caused failures.
+      (#19035, jmr in r50868)
+
+    - Uninstalling a port that is not installed now produces an informational
+      message rather than an error. (#18984, jmr in r53709)
+
+    - Added a 'conflicts' portfile option. Conflicting ports will be detected
+      during dependency calculation. (#18794, blb/jmr in r51525)
+
+    - 'port selfupdate' now explicitly states precisely what it does. (#18512)
+
+    - Operating system and architecture information is now shown in debug
+      output. (#18435, raimue in r46669)
+
+    - Fixed a bug that could break some symlinks to man pages. (#18302)
+
+    - Switched to a more efficient algorithm for looking up port information
+      in the index, which makes many operations faster.
+      (#18259, jmr/blb in r47110)
+
+    - MacPorts base now tries to avoid using commands that come from ports, so
+      that a broken port can't break the base code. (#18149)
+
+    - Deleting all the contents of a portfile option no longer unsets the
+      option entirely. (#17865, toby in r44901)
+
+    - Removed the code that upgrades from the old DarwinPorts filesystem
+      layout. Trying to upgrade to 1.8.0+ from a version older than 1.5.0 will
+      produce an error message saying you need to install 1.7.1 first.
+      (#17619, jmr in r53260)
+
+    - port(1) now reports its version as dotted-decimal rather than floating
+      point. (#17420)
+
+    - Dependencies are now always obtained by parsing the Portfile and not
+      from the PortIndex, since the latter can't provide expanded variables
+      like $prefix which may be used in path: depspecs. (#17182)
+
+    - Newline characters in long_description can no longer cause receipt
+      corruption. (#16619, blb in r50663)
+
+    - Now unlocking the filemap when it is not in use. This allows e.g.
+      'port contents' to be run while another port instance is performing
+      installs. Note that running more than one simultaneous port instance
+      that will modify the registry can easily fail, though hopefully
+      without corrupting anything. (#16246, jmr in r51133)
+
+    - Removed some irrelevant debug output that was being printed when a port
+      failed. (#16203, jmr in r53706)
+
+    - Added new depends_fetch and depends_extract options, for dependencies
+      that are needed to fetch or extract the port, respectively.
+      (#15161, jmr in r51780)
+
+    - Packages (including the one for MacPorts base) now correctly indicate
+      that they can only be installed on the root volume.
+      (#14809, jmr in r53250)
+
+    - Using an alternative fetch or extract type now adds appropriate
+      dependencies automatically, e.g. 'use_zip yes' adds a dep on unzip, and
+      'fetch.type svn' adds a dep on subversion. (#13981, jmr in r43782)
+
+    - port(1) should now exit with an appropriate status code when an error is
+      encountered. Use the -p option to continue despite errors.
+      (#13918, jmr in r53704)
+
+    - Proxy information can now be obtained from System Preferences and from
+      macports.conf. The older method using environment variables no longer
+      works out of the box on Leopard due to changes that Apple made to the
+      default /etc/sudoers. (#13158, blb in r47194)
+
+    - Improved handling of malformed variant definitions.
+      (#12596, jmr in r50719, r50721)
+
+    - Cope a little better with missing receipt files. (#19540, jmr in r51138)
+
+    - Fixed a major memory leak in the filemap code.
+      (#12022, pguyot in r51419)
+
+    - Improved the logic for determining whether phases can be skipped. This
+      fixes the specific problems of being unable to build packages of ports
+      that are installed, port not running specific phases (e.g. build)
+      when told to if the port is installed, and inactive dependencies being
+      rebuilt instead of simply activated. (#10881, #16260, jmr in r50490)
+
+    - When archive mode is enabled, ports will no longer be rebuilt if an
+      archive is available. (#10785, jmr in r50416)
+
+    - Activating a port will now first deactivate any other version of the
+      same port that is already active. (#10571, jmr in r53711)
+
+    - Added a 'license' portfile option, which is displayed in 'port info'
+      output. (#7493, jmr in r50801)
+
     - port lint recognizes new top-level category php (#19329, ryandesign)
 
     - Do not print header lines when the quiet option -q is set
-    (r48558, raimue)
+      (raimue in r48558)
 
-    - svn.tag is deprecated, use svn.revision instead (r48222-48223, raimue)
+    - svn.tag is deprecated, use svn.revision instead (raimue in r48222-48223)
 
-    - port -i option has been removed (r48218, blb)
+    - port -i option has been removed (blb in r48218)
 
-    - ui_warn logs to stderr instead of stdout (r48217, raimue)
+    - ui_warn logs to stderr instead of stdout (raimue in r48217)
 
     - Remove --pretend option for port selfupdate, use global dry-run option
-      instead (r48125, raimue)
+      instead (raimue in r48125)
 
-    - port(1) option -y for dry-run (#11892, gwhitney) 
+    - port(1) option -y for dry-run (#11892, gwhitney/jmr in r43726) 
 
     - New pseudo-port 'obsolete' to identify ports which are installed but no
-      longer in the PortIndex (r47253, raimue)
+      longer in the PortIndex (raimue in r47253)
 
-    - MacPorts now performs fetch, extract, patch, configure and build in a
+    - MacPorts can now perform fetch, extract, patch, configure and build in a
       user rather than system owned location. By default, this is
       ~/.macports/opt. This allows MacPorts to do all but the install of the
       port without root privileges. (gsoc08-privileges)
 
-    - MacPorts now automatically drops privileges whenever possible so as to
-      avoid running as root whenever possible. (gsoc08-privileges)
+    - MacPorts can now automatically drop privileges so as to avoid running as
+      root whenever possible. To enable this, pass the desired user to run as
+      to configure with the --with-macports-user option. (gsoc08-privileges)
 
-    - MacPorts will prompt for the root password if you attempt to install a
-      port into the /opt/local hierarchy and did not start MacPorts with sudo.
-      It will not do so however until the install stage. The fetch, extract,
-      patch, configure and build will proceed first under the privileges
-      MacPorts is started with. (gsoc08-privileges)
-
     - The Portfile format has a number of new boolean attributes to indicate
       when an action should or should not be run with root privileges:
       'patch.asroot', 'build.asroot', 'configure.asroot', 'destroot.asroot',
@@ -61,6 +185,8 @@
       --prefix=/Users/{your-user-name-here}/.macports/opt
       --with-no-root-privileges" (gsoc08-privileges)
 
+    - MacPorts now requires Mac OS X 10.4 Tiger or later. (gsoc08-privileges)
+
     - Add several new options to port search, looks in name and description by
       default (#15434, raimue)
 
@@ -71,11 +197,11 @@
     - Make dependencies displayed in port info respect variants
       specified in variants.conf; collapse port deps to be an alias
       for port info with appropriate flags. Note this changes output
-      format of port deps somewhat.  (#11891, gwhitney)
+      format of port deps somewhat.  (#11891, gwhitney in r44340)
 
     - Make dependencies in port upgrade respect variants as specified
       (in order of precedence) on command line, latest installed
-      version, or variants.conf .  (#8221, gwhitney)
+      version, or variants.conf .  (#8221, gwhitney in r44362)
 
     - Add select action, which integrates *_select tools into port.
       (#17477, perry)
@@ -84,9 +210,12 @@
       variants and variants' dependencies. (#14178, #15628, perry)
 
     - Implicit variants (e.g., darwin) can no longer be explicitly
-      set/unset. (#12563, perry)
+      set/unset. (#12563, perry in r46938, jmr in r53371)
 
 Release 1.7.1 (2009-03-28 by raimue):
+    - Trailing slashes are stripped from the prefix passed to configure, which
+      prevents incorrect mtree violation warnings. (#13789)
+
     - Fix freshmeat-based livecheck (#18887)
 
     - Fix issue on direct-mode installs where checking for installed ports
@@ -269,7 +398,7 @@
 
     - Change default +universal platform back to: 10.4/10.4u.sdk/i386 ppc (r33087, r33107).
 
-    - Add `port platform` info target that outputs current platform (#12302, afb in r32724).
+    - Add `port platform` info action that outputs current platform (#12302, afb in r32724).
 
     - Enable 64 bit environment, ppc64 x86_64, for all +universal builds (mww in r32194).
 
@@ -317,7 +446,7 @@
 
     - readline is now disabled by default, in order to avoid support issues.
       use --enable-readine parameter to configure to enable support for readine.
-      (jberry r31139, r31140).
+      (#10651, jberry in r31139, r31140).
 
     - daemondo now monitors kevents for the death of the daemon process, which means that it
       now detects the death of processes (even those that aren't direct child processes)

Modified: branches/images-and-archives/base/Mk/macports.autoconf.mk.in
===================================================================
--- branches/images-and-archives/base/Mk/macports.autoconf.mk.in	2009-08-03 04:20:56 UTC (rev 54854)
+++ branches/images-and-archives/base/Mk/macports.autoconf.mk.in	2009-08-03 04:22:38 UTC (rev 54855)
@@ -7,8 +7,8 @@
 VPATH			= @srcdir@
 
 CC			= @CC@
-CFLAGS			= @CFLAGS@ $(CFLAGS_QUICHEEATERS) $(CFLAGS_WERROR) $(CPPFLAGS)
-OBJCFLAGS		= @OBJCFLAGS@ $(CFLAGS_QUICHEEATERS) $(CFLAGS_WERROR) $(CPPFLAGS)
+CFLAGS			= @CFLAGS@ $(CFLAGS_QUICHEEATERS) $(CFLAGS_WERROR)
+OBJCFLAGS		= @OBJCFLAGS@ $(CFLAGS_QUICHEEATERS) $(CFLAGS_WERROR)
 CPPFLAGS		= @CPPFLAGS@ @DEFS@ @INCLUDES@ @TCL_INCLUDES@
 TCL_DEFS		= @TCL_DEFS@
 SHLIB_CFLAGS		= @SHLIB_CFLAGS@

Modified: branches/images-and-archives/base/Mk/macports.tea.mk
===================================================================
--- branches/images-and-archives/base/Mk/macports.tea.mk	2009-08-03 04:20:56 UTC (rev 54854)
+++ branches/images-and-archives/base/Mk/macports.tea.mk	2009-08-03 04:22:38 UTC (rev 54855)
@@ -3,17 +3,17 @@
 .SUFFIXES: .m
 
 .m.o:
-	${CC} -c -DUSE_TCL_STUBS -DTCL_NO_DEPRECATED ${OBJCFLAGS} ${SHLIB_CFLAGS} $< -o $@
+	${CC} -c -DUSE_TCL_STUBS -DTCL_NO_DEPRECATED ${OBJCFLAGS} ${CPPFLAGS} ${SHLIB_CFLAGS} $< -o $@
 
 .c.o:
-	${CC} -c -DUSE_TCL_STUBS -DTCL_NO_DEPRECATED ${CFLAGS} ${SHLIB_CFLAGS} $< -o $@
+	${CC} -c -DUSE_TCL_STUBS -DTCL_NO_DEPRECATED ${CFLAGS} ${CPPFLAGS} ${SHLIB_CFLAGS} $< -o $@
 
 all:: ${SHLIB_NAME} pkgIndex.tcl
 
 $(SHLIB_NAME):: ${OBJS}
 	${SHLIB_LD} ${OBJS} -o ${SHLIB_NAME} ${TCL_STUB_LIB_SPEC} ${SHLIB_LDFLAGS} ${LIBS}
 
-pkgIndex.tcl:
+pkgIndex.tcl: $(SHLIB_NAME)
 	$(SILENT) ../pkg_mkindex.sh .
 
 clean::

Modified: branches/images-and-archives/base/doc/macports.conf.in
===================================================================
--- branches/images-and-archives/base/doc/macports.conf.in	2009-08-03 04:20:56 UTC (rev 54854)
+++ branches/images-and-archives/base/doc/macports.conf.in	2009-08-03 04:22:38 UTC (rev 54855)
@@ -115,4 +115,3 @@
 # hosts not to go through the proxy (comma-separated, applies to HTTP, HTTPS,
 # and FTP, but not rsync):
 #proxy_skip            internal1, internal2, internal3
-

Modified: branches/images-and-archives/base/doc/port.1
===================================================================
--- branches/images-and-archives/base/doc/port.1	2009-08-03 04:20:56 UTC (rev 54854)
+++ branches/images-and-archives/base/doc/port.1	2009-08-03 04:22:38 UTC (rev 54855)
@@ -358,7 +358,7 @@
 .Pp
 To force an upgrade (rebuild) use:
 .Pp
-.Dl "port -f upgrade vim"
+.Dl "port upgrade --force vim"
 .Pp
 To upgrade
 .Ar portname
@@ -373,7 +373,7 @@
 then the variants active in the latest installed version of the port, and 
 finally the global variants specified in variants.conf, if any.  Note that 
 upgrade will not normally rebuild a port only to change the selected 
-variants; you can either specify -f, or deactivate the port and reinstall it 
+variants; you can either specify --enforce-variants, or deactivate the port and reinstall it 
 with different variants. 
 .Ss clean
 Clean the files used for building

Modified: branches/images-and-archives/base/doc/portfile.7
===================================================================
--- branches/images-and-archives/base/doc/portfile.7	2009-08-03 04:20:56 UTC (rev 54854)
+++ branches/images-and-archives/base/doc/portfile.7	2009-08-03 04:22:38 UTC (rev 54855)
@@ -883,6 +883,17 @@
 .Sh CONFIGURE OPTIONS
 MacPorts provide special support for configure flags (CFLAGS, LDFLAGS, CPPFLAGS, CXXFLAGS, CC, CXX, CPP, FC, F77, F90). Please note that the previous way to alter these flags (using configure.env) may become deprecated at some point. The following options are defined:
 .Bl -tag -width lc
+.It Ic configure.optflags
+Flags to use for optimization.
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Default:
+.Em -O2
+.br
+.Sy Example:
+.Dl configure.optflags -O3
 .It Ic configure.cflags
 Flags to put in the CFLAGS environment variable when invoking the configure script.
 .br
@@ -890,7 +901,7 @@
 .Em optional
 .br
 .Sy Default:
-.Em -O2
+.Em ${configure.optflags}
 .br
 .Sy Example:
 .Dl configure.cflags-append -DHAS_LRINTF
@@ -909,7 +920,7 @@
 .Em optional
 .br
 .Sy Default:
-.Em -O2
+.Em ${configure.optflags}
 .It Ic configure.objcflags
 Flags to put in the OBJCFLAGS environment variable when invoking the configure script.
 .br
@@ -917,7 +928,7 @@
 .Em optional
 .br
 .Sy Default:
-.Em -O2
+.Em ${configure.optflags}
 .It Ic configure.ldflags
 Flags to put in the LDFLAGS environment variable when invoking the configure script.
 .br
@@ -933,7 +944,7 @@
 .Em optional
 .br
 .Sy Default:
-.Em -O2
+.Em ${configure.optflags}
 .It Ic configure.f90flags
 Flags to put in the F90FLAGS environment variable when invoking the configure script.
 .br 
@@ -941,7 +952,7 @@
 .Em optional
 .br
 .Sy Default:
-.Em -O2
+.Em ${configure.optflags}
 .It Ic configure.fcflags
 Flags to put in the FCFLAGS environment variable when invoking the configure script.
 .br 
@@ -949,7 +960,7 @@
 .Em optional
 .br
 .Sy Default:
-.Em -O2
+.Em ${configure.optflags}
 .It Ic configure.classpath
 Flags to put in the CLASSPATH environment variable when invoking the configure script.
 .br 

Modified: branches/images-and-archives/base/doc/prefix.mtree.in
===================================================================
--- branches/images-and-archives/base/doc/prefix.mtree.in	2009-08-03 04:20:56 UTC (rev 54854)
+++ branches/images-and-archives/base/doc/prefix.mtree.in	2009-08-03 04:22:38 UTC (rev 54855)
@@ -12,6 +12,8 @@
     include
     ..
     lib
+        pkgconfig
+        ..
     ..
     libexec
     ..

Modified: branches/images-and-archives/base/src/cregistry/Makefile
===================================================================
--- branches/images-and-archives/base/src/cregistry/Makefile	2009-08-03 04:20:56 UTC (rev 54854)
+++ branches/images-and-archives/base/src/cregistry/Makefile	2009-08-03 04:22:38 UTC (rev 54855)
@@ -11,7 +11,7 @@
 all:: ${STLIB_NAME}
 
 .c.o:
-	${CC} -c -DUSE_TCL_STUBS ${CFLAGS} ${SHLIB_CFLAGS} $< -o $@
+	${CC} -c -DUSE_TCL_STUBS ${CFLAGS} ${CPPFLAGS} ${SHLIB_CFLAGS} $< -o $@
 
 ${STLIB_NAME}:: ${OBJS}
 	${STLIB_LD} ${STLIB_NAME} ${OBJS}

Modified: branches/images-and-archives/base/src/macports1.0/Makefile
===================================================================
--- branches/images-and-archives/base/src/macports1.0/Makefile	2009-08-03 04:20:56 UTC (rev 54854)
+++ branches/images-and-archives/base/src/macports1.0/Makefile	2009-08-03 04:22:38 UTC (rev 54855)
@@ -1,6 +1,6 @@
 SRCS=		macports.tcl macports_dlist.tcl macports_util.tcl \
 		macports_autoconf.tcl macports_index.tcl macports_fastload.tcl
-OBJS=		macports.o get_systemconfiguration_proxies.o
+OBJS=		macports.o get_systemconfiguration_proxies.o sysctl.o
 SHLIB_NAME=	MacPorts${SHLIB_SUFFIX}
 
 INSTALLDIR=	${DESTDIR}${TCL_PACKAGE_DIR}/macports1.0

Modified: branches/images-and-archives/base/src/macports1.0/macports.c
===================================================================
--- branches/images-and-archives/base/src/macports1.0/macports.c	2009-08-03 04:20:56 UTC (rev 54854)
+++ branches/images-and-archives/base/src/macports1.0/macports.c	2009-08-03 04:22:38 UTC (rev 54855)
@@ -38,6 +38,7 @@
 #include <tcl.h>
 
 #include "get_systemconfiguration_proxies.h"
+#include "sysctl.h"
 
 static int
 macports__version(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[])
@@ -57,6 +58,7 @@
 		return TCL_ERROR;
 	Tcl_CreateObjCommand(interp, "macports::version", macports__version, NULL, NULL);
 	Tcl_CreateObjCommand(interp, "get_systemconfiguration_proxies", GetSystemConfigurationProxiesCmd, NULL, NULL);
+	Tcl_CreateObjCommand(interp, "sysctl", SysctlCmd, NULL, NULL);
 	if (Tcl_PkgProvide(interp, "macports", "1.0") != TCL_OK)
 		return TCL_ERROR;
 	return TCL_OK;

Modified: branches/images-and-archives/base/src/macports1.0/macports.tcl
===================================================================
--- branches/images-and-archives/base/src/macports1.0/macports.tcl	2009-08-03 04:20:56 UTC (rev 54854)
+++ branches/images-and-archives/base/src/macports1.0/macports.tcl	2009-08-03 04:22:38 UTC (rev 54855)
@@ -647,7 +647,7 @@
     # Platform Settings
     set os_arch $tcl_platform(machine)
     if {$os_arch == "Power Macintosh"} { set os_arch "powerpc" }
-    if {$os_arch == "i586" || $os_arch == "i686"} { set os_arch "i386" }
+    if {$os_arch == "i586" || $os_arch == "i686" || $os_arch == "x86_64"} { set os_arch "i386" }
     set os_endian [string range $tcl_platform(byteOrder) 0 end-6]
     set os_version $tcl_platform(osVersion)
     set os_major [lindex [split $os_version .] 0]
@@ -806,6 +806,7 @@
     $workername alias getportdir macports::getportdir
     $workername alias findBinary macports::findBinary
     $workername alias binaryInPath macports::binaryInPath
+    $workername alias sysctl sysctl
 
     # New Registry/Receipts stuff
     $workername alias registry_new registry::new_entry
@@ -2371,19 +2372,10 @@
     # remove implicit variants, without printing warnings
     set oldvariantlist [mport_filtervariants $oldvariantlist no]
 
-    # check if the variants are present in $version_in_tree
-    if {[info exists portinfo(variants)]} {
-        set avariants $portinfo(variants)
-    } else {
-        set avariants {}
-    }
-    ui_debug "available variants are : $avariants"
+    # merge in the old variants
     foreach {variation value} $oldvariantlist {
-        if {[lsearch $avariants $variation] != -1} {
-            ui_debug "variant $variation is present in $portname $version_in_tree"
-            if { ![info exists variations($variation)]} {
-                set variations($variation) $value
-            }
+        if { ![info exists variations($variation)]} {
+            set variations($variation) $value
         }
     }
 
@@ -2397,7 +2389,33 @@
     }
 
     ui_debug "new fully merged portvariants: [array get variations]"
+    
+    # at this point we need to check if a different port will be replacing this one
+    if {[info exists portinfo(replaced_by)] && ![info exists options(ports_upgrade_no-replace)]} {
+        ui_debug "$portname is replaced by $portinfo(replaced_by)"
+        if {[catch {mportlookup $portinfo(replaced_by)} result]} {
+            global errorInfo
+            ui_debug "$errorInfo"
+            ui_error "port lookup failed: $result"
+            return 1
+        }
+        if {$result == ""} {
+            ui_error "No port $portinfo(replaced_by) found."
+            return 1
+        }
+        array unset portinfo
+        array set portinfo [lindex $result 1]
+        set newname $portinfo(name)
 
+        set porturl $portinfo(porturl)
+        if {![info exists porturl]} {
+            set porturl file://./
+        }
+        set depscache(port:${newname}) 1
+    } else {
+        set newname $portname
+    }
+
     if {[catch {set workername [mportopen $porturl [array get options] [array get variations]]} result]} {
         global errorInfo
         ui_debug "$errorInfo"
@@ -2407,7 +2425,6 @@
 
     array unset portinfo
     array set portinfo [mportinfo $workername]
-    set portwasopened 1
     set version_in_tree "$portinfo(version)"
     set revision_in_tree "$portinfo(revision)"
     set epoch_in_tree "$portinfo(epoch)"
@@ -2429,13 +2446,21 @@
     if { ( [rpm-vercomp $version_installed $version_in_tree] > 0
             || ([rpm-vercomp $version_installed $version_in_tree] == 0
                 && [rpm-vercomp $revision_installed $revision_in_tree] >= 0 ))
-        && ![info exists options(ports_force)] } {
-        ui_debug "No need to upgrade! $portname ${version_installed}_${revision_installed} >= $portname ${version_in_tree}_${revision_in_tree}"
-        if {[info exists portinfo(canonical_active_variants)]
-            && $portinfo(canonical_active_variants) != $oldvariant} {
-            ui_warn "Skipping upgrade since $portname ${version_installed}_${revision_installed} >= $portname ${version_in_tree}_${revision_in_tree}, even though installed variant $oldvariant does not match $portinfo(canonical_active_variants). Specify -f to force upgrade."
-        }
-        if { $epoch_installed >= $epoch_in_tree } {
+        && ![info exists options(ports_upgrade_force)] } {
+        if {$portname != $newname} { 
+            ui_debug "ignoring versions, installing replacement port"
+        } elseif { $epoch_installed < $epoch_in_tree } {
+            set epoch_override 1
+            ui_debug "epoch override ... upgrading!"
+        } elseif {[info exists options(ports_upgrade_enforce-variants)] && $options(ports_upgrade_enforce-variants) eq "yes"
+                  && [info exists portinfo(canonical_active_variants)] && $portinfo(canonical_active_variants) != $oldvariant} {
+            ui_debug "variant override ... upgrading!"
+        } else {
+            if {[info exists portinfo(canonical_active_variants)] && $portinfo(canonical_active_variants) != $oldvariant} {
+                ui_warn "Skipping upgrade since $portname ${version_installed}_${revision_installed} >= $portname ${version_in_tree}_${revision_in_tree}, even though installed variants \"$oldvariant\" do not match \"$portinfo(canonical_active_variants)\". Use 'upgrade --enforce-variants' to switch to the requested variants."
+            } else {
+                ui_debug "No need to upgrade! $portname ${version_installed}_${revision_installed} >= $portname ${version_in_tree}_${revision_in_tree}"
+            }
             # Check if we have to do dependents
             if {[info exists options(ports_do_dependents)]} {
                 # We do dependents ..
@@ -2459,16 +2484,13 @@
             }
             mportclose $workername
             return 0
-        } else {
-            set epoch_override 1
-            ui_debug "epoch override ... upgrading!"
         }
     }
 
 
     # avoid building again unnecessarily
-    if {[info exists options(ports_force)] || $epoch_override == 1
-        || ![registry::entry_exists $portname $version_in_tree $revision_in_tree $portinfo(canonical_active_variants)]} {
+    if {[info exists options(ports_upgrade_force)] || $epoch_override == 1
+        || ![registry::entry_exists $newname $version_in_tree $revision_in_tree $portinfo(canonical_active_variants)]} {
         if {[catch {set result [mportexec $workername imagefile]} result] || $result != 0} {
             global errorInfo
             ui_debug "$errorInfo"
@@ -2479,17 +2501,18 @@
     }
 
     # are we installing an existing version due to force or epoch override?
-    if {[registry::entry_exists $portname $version_in_tree $revision_in_tree $portinfo(canonical_active_variants)]} {
-         ui_debug "Uninstalling $portname ${version_in_tree}_${revision_in_tree}$portinfo(canonical_active_variants)"
+    if {[registry::entry_exists $newname $version_in_tree $revision_in_tree $portinfo(canonical_active_variants)]
+        && ([info exists options(ports_upgrade_force)] || $epoch_override == 1)} {
+        ui_debug "Uninstalling $newname ${version_in_tree}_${revision_in_tree}$portinfo(canonical_active_variants)"
         # we have to force the uninstall in case of dependents
         set force_cur [info exists options(ports_force)]
         set options(ports_force) yes
         if {$is_dryrun eq "yes"} {
-            ui_msg "Skipping uninstall $portname @${version_in_tree}_${revision_in_tree}$portinfo(canonical_active_variants) (dry run)"
-        } elseif {[catch {portuninstall::uninstall $portname ${version_in_tree}_${revision_in_tree}$portinfo(canonical_active_variants) [array get options]} result]} {
+            ui_msg "Skipping uninstall $newname @${version_in_tree}_${revision_in_tree}$portinfo(canonical_active_variants) (dry run)"
+        } elseif {[catch {portuninstall::uninstall $newname ${version_in_tree}_${revision_in_tree}$portinfo(canonical_active_variants) [array get options]} result]} {
             global errorInfo
             ui_debug "$errorInfo"
-            ui_error "Uninstall $portname ${version_in_tree}_${revision_in_tree}$portinfo(canonical_active_variants) failed: $result"
+            ui_error "Uninstall $newname ${version_in_tree}_${revision_in_tree}$portinfo(canonical_active_variants) failed: $result"
             catch {mportclose $workername}
             return 1
         }
@@ -2497,7 +2520,7 @@
             unset options(ports_force)
         }
         if {$anyactive && $version_in_tree == $version_active && $revision_in_tree == $revision_active
-            && $portinfo(canonical_active_variants) == $variant_active} {
+            && $portinfo(canonical_active_variants) == $variant_active && $portname == $newname} {
             set anyactive no
         }
     }
@@ -2520,11 +2543,11 @@
     }
 
     if {$is_dryrun eq "yes"} {
-        ui_msg "Skipping activate $portname @${version_in_tree}_${revision_in_tree} (dry run)"
+        ui_msg "Skipping activate $newname @${version_in_tree}_${revision_in_tree} (dry run)"
     } elseif {[catch {set result [mportexec $workername install]} result]} {
         global errorInfo
         ui_debug "$errorInfo"
-        ui_error "Couldn't activate $portname ${version_in_tree}_${revision_in_tree}: $result"
+        ui_error "Couldn't activate $newname ${version_in_tree}_${revision_in_tree}: $result"
         catch {mportclose $workername}
         return 1
     }
@@ -2534,7 +2557,7 @@
             set version [lindex $i 1]
             set revision [lindex $i 2]
             set variant [lindex $i 3]
-            if {$version == $version_in_tree && $revision == $revision_in_tree && $variant == $portinfo(canonical_active_variants)} {
+            if {$version == $version_in_tree && $revision == $revision_in_tree && $variant == $portinfo(canonical_active_variants) && $portname == $newname} {
                 continue
             }
             ui_debug "Uninstalling $portname ${version}_${revision}${variant}"
@@ -2543,9 +2566,12 @@
             } elseif {[catch {portuninstall::uninstall $portname ${version}_${revision}${variant} $optionslist} result]} {
                 global errorInfo
                 ui_debug "$errorInfo"
-                ui_error "Uninstall $portname @${version}_${revision}${variant} failed: $result"
-                catch {mportclose $workername}
-                return 1
+                # replaced_by can mean that we try to uninstall all versions of the old port, so handle errors due to dependents
+                if {$result != "Please uninstall the ports that depend on $portname first." && ![ui_isset ports_processall]} {
+                    ui_error "Uninstall $portname @${version}_${revision}${variant} failed: $result"
+                    catch {mportclose $workername}
+                    return 1
+                }
             }
         }
     }
@@ -2556,7 +2582,10 @@
         set options(ports_nodeps) 1
 
         registry::open_dep_map
-        set deplist [registry::list_dependents $portname]
+        set deplist [registry::list_dependents $newname]
+        if {$portname != $newname} {
+            set deplist [concat $deplist [registry::list_dependents $portname]]
+        }
 
         if { [llength deplist] > 0 } {
             foreach dep $deplist {

Copied: branches/images-and-archives/base/src/macports1.0/sysctl.c (from rev 54753, trunk/base/src/macports1.0/sysctl.c)
===================================================================
--- branches/images-and-archives/base/src/macports1.0/sysctl.c	                        (rev 0)
+++ branches/images-and-archives/base/src/macports1.0/sysctl.c	2009-08-03 04:22:38 UTC (rev 54855)
@@ -0,0 +1,75 @@
+/*
+ * sysctl.c
+ * $Id$
+ *
+ * Copyright (c) 2009 The MacPorts Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of The MacPorts Project nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <tcl.h>
+
+#include <string.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/sysctl.h>
+
+#include "sysctl.h"
+
+/*
+ * Read-only wrapper for sysctlbyname(3). Only works for values of type CTLTYPE_INT.
+ */
+int SysctlCmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
+{
+    const char error_message[] = "sysctl failed: ";
+    Tcl_Obj *tcl_result;
+    int res;
+    char *name;
+    int value;
+    size_t len = sizeof(value);
+
+    if (objc != 2) {
+        Tcl_WrongNumArgs(interp, 1, objv, "name");
+        return TCL_ERROR;
+    }
+
+    name = Tcl_GetString(objv[1]);
+    res = sysctlbyname(name, &value, &len, NULL, 0);
+    if (res == -1) {
+        tcl_result = Tcl_NewStringObj(error_message, sizeof(error_message) - 1);
+        Tcl_AppendObjToObj(tcl_result, Tcl_NewStringObj(strerror(errno), -1));
+        Tcl_SetObjResult(interp, tcl_result);
+        return TCL_ERROR;
+    }
+
+    tcl_result = Tcl_NewIntObj(value);
+    Tcl_SetObjResult(interp, tcl_result);
+    return TCL_OK;
+}

Copied: branches/images-and-archives/base/src/macports1.0/sysctl.h (from rev 54753, trunk/base/src/macports1.0/sysctl.h)
===================================================================
--- branches/images-and-archives/base/src/macports1.0/sysctl.h	                        (rev 0)
+++ branches/images-and-archives/base/src/macports1.0/sysctl.h	2009-08-03 04:22:38 UTC (rev 54855)
@@ -0,0 +1,34 @@
+/*
+ * sysctl.h
+ * $Id$
+ *
+ * Copyright (c) 2009 The MacPorts Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of The MacPorts Project nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* Read-only wrapper for sysctlbyname(3) */
+int SysctlCmd(ClientData, Tcl_Interp *, int, Tcl_Obj *CONST objv[]);

Modified: branches/images-and-archives/base/src/pextlib1.0/Makefile
===================================================================
--- branches/images-and-archives/base/src/pextlib1.0/Makefile	2009-08-03 04:20:56 UTC (rev 54854)
+++ branches/images-and-archives/base/src/pextlib1.0/Makefile	2009-08-03 04:22:38 UTC (rev 54855)
@@ -2,7 +2,7 @@
 	Pextlib.o strsed.o fgetln.o md5cmd.o setmode.o xinstall.o \
 	fs-traverse.o strcasecmp.o vercomp.o filemap.o \
 	sha1cmd.o curl.o rmd160cmd.o readline.o uid.o \
-	tracelib.o tty.o sysctl.o readdir.o pipe.o flock.o \
+	tracelib.o tty.o readdir.o pipe.o flock.o \
 	system.o
 SHLIB_NAME= Pextlib${SHLIB_SUFFIX}
 INSTALLDIR= ${DESTDIR}${datadir}/macports/Tcl/pextlib1.0

Modified: branches/images-and-archives/base/src/pextlib1.0/Pextlib.c
===================================================================
--- branches/images-and-archives/base/src/pextlib1.0/Pextlib.c	2009-08-03 04:20:56 UTC (rev 54854)
+++ branches/images-and-archives/base/src/pextlib1.0/Pextlib.c	2009-08-03 04:22:38 UTC (rev 54855)
@@ -94,7 +94,6 @@
 #include "uid.h"
 #include "tracelib.h"
 #include "tty.h"
-#include "sysctl.h"
 #include "strsed.h"
 #include "readdir.h"
 #include "pipe.h"
@@ -599,7 +598,6 @@
 	Tcl_CreateObjCommand(interp, "symlink", CreateSymlinkCmd, NULL, NULL);
 	Tcl_CreateObjCommand(interp, "unsetenv", UnsetEnvCmd, NULL, NULL);
 	Tcl_CreateObjCommand(interp, "lchown", lchownCmd, NULL, NULL);
-	Tcl_CreateObjCommand(interp, "sysctl", SysctlCmd, NULL, NULL);
 
 	Tcl_CreateObjCommand(interp, "readline", ReadlineCmd, NULL, NULL);
 	Tcl_CreateObjCommand(interp, "rl_history", RLHistoryCmd, NULL, NULL);

Deleted: branches/images-and-archives/base/src/pextlib1.0/sysctl.c
===================================================================
--- branches/images-and-archives/base/src/pextlib1.0/sysctl.c	2009-08-03 04:20:56 UTC (rev 54854)
+++ branches/images-and-archives/base/src/pextlib1.0/sysctl.c	2009-08-03 04:22:38 UTC (rev 54855)
@@ -1,75 +0,0 @@
-/*
- * sysctl.c
- * $Id$
- *
- * Copyright (c) 2009 The MacPorts Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the name of The MacPorts Project nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- * 
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#if HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <tcl.h>
-
-#include <string.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/sysctl.h>
-
-#include "sysctl.h"
-
-/*
- * Read-only wrapper for sysctlbyname(3). Only works for values of type CTLTYPE_INT.
- */
-int SysctlCmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
-{
-    const char error_message[] = "sysctl failed: ";
-    Tcl_Obj *tcl_result;
-    int res;
-    char *name;
-    int value;
-    size_t len = sizeof(value);
-
-    if (objc != 2) {
-        Tcl_WrongNumArgs(interp, 1, objv, "name");
-        return TCL_ERROR;
-    }
-
-    name = Tcl_GetString(objv[1]);
-    res = sysctlbyname(name, &value, &len, NULL, 0);
-    if (res == -1) {
-        tcl_result = Tcl_NewStringObj(error_message, sizeof(error_message) - 1);
-        Tcl_AppendObjToObj(tcl_result, Tcl_NewStringObj(strerror(errno), -1));
-        Tcl_SetObjResult(interp, tcl_result);
-        return TCL_ERROR;
-    }
-
-    tcl_result = Tcl_NewIntObj(value);
-    Tcl_SetObjResult(interp, tcl_result);
-    return TCL_OK;
-}

Deleted: branches/images-and-archives/base/src/pextlib1.0/sysctl.h
===================================================================
--- branches/images-and-archives/base/src/pextlib1.0/sysctl.h	2009-08-03 04:20:56 UTC (rev 54854)
+++ branches/images-and-archives/base/src/pextlib1.0/sysctl.h	2009-08-03 04:22:38 UTC (rev 54855)
@@ -1,34 +0,0 @@
-/*
- * sysctl.h
- * $Id$
- *
- * Copyright (c) 2009 The MacPorts Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the name of The MacPorts Project nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- * 
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-/* Read-only wrapper for sysctlbyname(3) */
-int SysctlCmd(ClientData, Tcl_Interp *, int, Tcl_Obj *CONST objv[]);

Modified: branches/images-and-archives/base/src/port/port-help.tcl
===================================================================
--- branches/images-and-archives/base/src/port/port-help.tcl	2009-08-03 04:20:56 UTC (rev 54854)
+++ branches/images-and-archives/base/src/port/port-help.tcl	2009-08-03 04:22:38 UTC (rev 54855)
@@ -264,10 +264,17 @@
 
 set porthelp(upgrade) {
 Upgrades the given ports to the latest version. Respects global options
--n, -R, -u, and -f (see the port man page).  Note that in selecting variants
+-n, -R, and -u (see the port man page).  Note that in selecting variants
 to use in the upgraded build of the port, the order of precedence is variants
 specified on the command line, then variants active in the latest installed
 version of the port, then the variants.conf file.
+
+--force             Ignore circumstances that would normally cause ports to be
+                    skipped (e.g. not outdated).
+--enforce-variants  If the installed variants do not match those requested,
+                    upgrade even if the port is not outdated.
+--no-replace        Do not replace one port with another according to the
+                    replaced_by field
 }
 
 set porthelp(url) {

Modified: branches/images-and-archives/base/src/port/port.tcl
===================================================================
--- branches/images-and-archives/base/src/port/port.tcl	2009-08-03 04:20:56 UTC (rev 54854)
+++ branches/images-and-archives/base/src/port/port.tcl	2009-08-03 04:22:38 UTC (rev 54855)
@@ -1489,11 +1489,13 @@
             maintainers Maintainers
             license     License
             conflicts   "Conflicts with"
+            replaced_by "Replaced by"
         }
 
         # Wrap-length map for pretty printing
         array set pretty_wrap {
             heading 0
+            replaced_by 22
             variants 22
             depends_fetch 22
             depends_extract 22
@@ -1557,7 +1559,9 @@
         set opts_todo [array names options ports_info_*]
         set fields_tried {}
         if {![llength $opts_todo]} {
-            set opts_todo {ports_info_heading ports_info_variants 
+            set opts_todo {ports_info_heading
+                ports_info_replaced_by
+                ports_info_variants 
                 ports_info_skip_line
                 ports_info_long_description ports_info_homepage 
                 ports_info_skip_line ports_info_depends_fetch
@@ -3080,7 +3084,7 @@
                  depends description epoch fullname heading homepage index license
                  line long_description
                  maintainer maintainers name platform platforms portdir pretty
-                 revision variant variants version}
+                 replaced_by revision variant variants version}
     search      {case-sensitive category categories depends_fetch
                  depends_extract depends_build depends_lib depends_run
                  depends description epoch exact glob homepage line
@@ -3093,6 +3097,7 @@
     mirror      {new}
     lint        {nitpick}
     select      {list set show}
+    upgrade     {force enforce-variants no-replace}
 }
 
 global cmd_implied_options

Modified: branches/images-and-archives/base/src/port/portindex.tcl
===================================================================
--- branches/images-and-archives/base/src/port/portindex.tcl	2009-08-03 04:20:56 UTC (rev 54854)
+++ branches/images-and-archives/base/src/port/portindex.tcl	2009-08-03 04:22:38 UTC (rev 54855)
@@ -68,7 +68,7 @@
             }
         }
 
-        set keepkeys {categories depends_fetch depends_extract depends_build depends_lib depends_run description epoch homepage long_description maintainers name platforms revision variants version portdir portarchive}
+        set keepkeys {categories depends_fetch depends_extract depends_build depends_lib depends_run description epoch homepage long_description maintainers name platforms revision variants version portdir portarchive replaced_by}
         foreach availkey [array names portinfo] {
             if {[lsearch -exact ${keepkeys} $availkey] == -1} {
                 unset portinfo($availkey)

Modified: branches/images-and-archives/base/src/port1.0/portconfigure.tcl
===================================================================
--- branches/images-and-archives/base/src/port1.0/portconfigure.tcl	2009-08-03 04:20:56 UTC (rev 54854)
+++ branches/images-and-archives/base/src/port1.0/portconfigure.tcl	2009-08-03 04:22:38 UTC (rev 54855)
@@ -109,9 +109,12 @@
 default configure.pkg_config        {}
 default configure.pkg_config_path   {}
 
-options configure.build_arch configure.archflags
+options configure.build_arch
 default configure.build_arch {${build_arch}}
-default configure.archflags  {[portconfigure::configure_get_archflags]}
+foreach tool {cc cxx objc f77 f90 fc} {
+    options configure.${tool}_archflags
+    default configure.${tool}_archflags  "\[portconfigure::configure_get_archflags $tool\]"
+}
 
 options configure.universal_archs configure.universal_args configure.universal_cflags configure.universal_cppflags configure.universal_cxxflags configure.universal_ldflags
 default configure.universal_archs       {${universal_archs}}
@@ -167,7 +170,7 @@
 }
 
 # internal function to determine the compiler flags to select an arch
-proc portconfigure::configure_get_archflags {args} {
+proc portconfigure::configure_get_archflags {tool} {
     global configure.build_arch configure.m32 configure.m64 configure.compiler
     set flags ""
     if {[tbool configure.m64]} {
@@ -175,7 +178,7 @@
     } elseif {[tbool configure.m32]} {
         set flags "-m32"
     } elseif {${configure.build_arch} != ""} {
-        if {[arch_flag_supported]} {
+        if {[arch_flag_supported] && $tool == "cc" || $tool == "cxx" || $tool == "objc"} {
             set flags "-arch ${configure.build_arch}"
         } elseif {${configure.build_arch} == "x86_64" || ${configure.build_arch} == "ppc64"} {
             set flags "-m64"
@@ -299,6 +302,7 @@
                 cc   { set ret /usr/bin/gcc-4.2 }
                 objc { set ret /usr/bin/gcc-4.2 }
                 cxx  { set ret /usr/bin/g++-4.2 }
+                cpp  { set ret /usr/bin/cpp-4.2 }
             }
         }
         llvm-gcc-4.2 {
@@ -410,9 +414,15 @@
 proc portconfigure::configure_main {args} {
     global [info globals]
     global worksrcpath use_configure use_autoreconf use_autoconf use_automake use_xmkmf
-    global configure.env configure.pipe configure.cflags configure.cppflags configure.cxxflags configure.objcflags configure.ldflags configure.libs configure.fflags configure.f90flags configure.fcflags configure.classpath
+    global configure.env configure.pipe configure.libs configure.classpath configure.universal_args
     global configure.perl configure.python configure.ruby configure.install configure.awk configure.bison configure.pkg_config configure.pkg_config_path
-    global configure.ccache configure.distcc configure.cc configure.cxx configure.cpp configure.objc configure.f77 configure.f90 configure.fc configure.javac
+    global configure.ccache configure.distcc configure.cpp configure.javac configure.march configure.mtune
+    foreach tool {cc cxx objc f77 f90 fc} {
+        global configure.${tool} configure.${tool}_archflags
+    }
+    foreach flags {cflags cppflags cxxflags objcflags ldflags fflags f90flags fcflags} {
+        global configure.${flags} configure.universal_${flags}
+    }
     
     if {[tbool use_autoreconf]} {
         if {[catch {command_exec autoreconf} result]} {
@@ -465,7 +475,6 @@
 
         # Append configure flags.
         append_list_to_environment_value configure "CC" ${filter}${configure.cc}
-        append_list_to_environment_value configure "CPP" ${filter}${configure.cpp}
         append_list_to_environment_value configure "CXX" ${filter}${configure.cxx}
         append_list_to_environment_value configure "OBJC" ${filter}${configure.objc}
         append_list_to_environment_value configure "FC" ${configure.fc}
@@ -490,6 +499,27 @@
         append_list_to_environment_value configure "BISON" ${configure.bison}
         append_list_to_environment_value configure "PKG_CONFIG" ${configure.pkg_config}
         append_list_to_environment_value configure "PKG_CONFIG_PATH" ${configure.pkg_config_path}
+        
+        # add extra flags that are conditional on whether we're building universal
+        if {[variant_exists universal] && [variant_isset universal]} {
+            foreach flags {CFLAGS OBJCFLAGS} {
+                append_list_to_environment_value configure $flags ${configure.universal_cflags}
+            }
+            append_list_to_environment_value configure "CXXFLAGS" ${configure.universal_cxxflags}
+            append_list_to_environment_value configure "CPPFLAGS" ${configure.universal_cppflags}
+            append_list_to_environment_value configure "LDFLAGS" ${configure.universal_ldflags}
+            eval configure.pre_args-append ${configure.universal_args}
+        } else {
+            foreach {tool flags} {cc CFLAGS cxx CXXFLAGS objc OBJCFLAGS f77 FFLAGS f90 F90FLAGS fc FCFLAGS} {
+                append_list_to_environment_value configure $flags [set configure.${tool}_archflags]
+                if {${configure.march} != {}} {
+                    append_list_to_environment_value configure $flags "-march=${configure.march}"
+                }
+                if {${configure.mtune} != {}} {
+                    append_list_to_environment_value configure $flags "-mtune=${configure.mtune}"
+                }
+            }
+        }
 
         # Execute the command (with the new environment).
         if {[catch {command_exec configure} result]} {

Modified: branches/images-and-archives/base/src/port1.0/portdestroot.tcl
===================================================================
--- branches/images-and-archives/base/src/port1.0/portdestroot.tcl	2009-08-03 04:20:56 UTC (rev 54854)
+++ branches/images-and-archives/base/src/port1.0/portdestroot.tcl	2009-08-03 04:22:38 UTC (rev 54855)
@@ -88,7 +88,7 @@
 
 proc portdestroot::destroot_start {args} {
     global UI_PREFIX prefix name porturl destroot os.platform destroot.clean portsharepath
-    global destroot.umask destroot.asroot macportsuser euid egid usealtworkpath altprefix
+    global destroot.umask destroot.asroot macportsuser euid egid
     global applications_dir frameworks_dir
     variable oldmask
 
@@ -109,14 +109,6 @@
         return -code error "You cannot run this port without root privileges. You need to re-run with 'sudo port'.";
     }
 
-    if {[info exists usealtworkpath] && $usealtworkpath == "yes"} {
-        # rewrite destroot.args
-        set argprefix "=[option prefix]"
-        set newargprefix "=${altprefix}[option prefix]"
-        set newdestrootargs [string map [list $argprefix $newargprefix] [option destroot.args]]
-        option destroot.args $newdestrootargs
-    }
-
     # end gsoc08-privileges
 
     set oldmask [umask ${destroot.umask}]

Modified: branches/images-and-archives/base/src/port1.0/portfetch.tcl
===================================================================
--- branches/images-and-archives/base/src/port1.0/portfetch.tcl	2009-08-03 04:20:56 UTC (rev 54854)
+++ branches/images-and-archives/base/src/port1.0/portfetch.tcl	2009-08-03 04:22:38 UTC (rev 54855)
@@ -84,12 +84,13 @@
 default cvs.args ""
 default cvs.post_args {"${cvs.module}"}
 
-default svn.cmd {[findBinary svn $portutil::autoconf::svn_path]}
+# we want the svn port so we know --trust-server-cert will work
+default svn.cmd {${prefix}/bin/svn}
 default svn.dir {${workpath}}
 default svn.method {export}
 default svn.revision ""
 default svn.env {}
-default svn.pre_args {"--non-interactive"}
+default svn.pre_args "--non-interactive --trust-server-cert"
 default svn.args ""
 default svn.post_args {"${svn.url}"}
 
@@ -165,7 +166,7 @@
                 depends_fetch-append bin:cvs:cvs
             }
             svn {
-                depends_fetch-append bin:svn:subversion
+                depends_fetch-append port:subversion
             }
             git {
                 depends_fetch-append bin:git:git-core
@@ -703,19 +704,9 @@
 # Initialize fetch target and call checkfiles.
 proc portfetch::fetch_init {args} {
     global distfiles distname distpath all_dist_files dist_subdir fetch.type fetch_init_done
-    global altprefix usealtworkpath
     variable fetch_urls
 
     if {[info exists distpath] && [info exists dist_subdir] && ![info exists fetch_init_done]} {
-
-        # start gsoc08-privileges
-        if {[info exists usealtworkpath] && $usealtworkpath == "yes"} {
-            # I have removed ![file writable $distpath] from the if condition as
-            # the writable condition seems to get confused by effective uids.
-            set distpath "$altprefix/[ string range $distpath 1 end ]"
-            ui_debug "Going to use $distpath for fetch."
-        }
-        # end gsoc08-privileges
         set distpath ${distpath}/${dist_subdir}
         set fetch_init_done yes
     }

Modified: branches/images-and-archives/base/src/port1.0/portlint.tcl
===================================================================
--- branches/images-and-archives/base/src/port1.0/portlint.tcl	2009-08-03 04:20:56 UTC (rev 54854)
+++ branches/images-and-archives/base/src/port1.0/portlint.tcl	2009-08-03 04:22:38 UTC (rev 54855)
@@ -328,6 +328,13 @@
             ui_info "OK: Found optional variable: $opt_var"
         }
     }
+    
+    if {[info exists name]} {
+        if {[regexp {[^[:alnum:]_.-]} $name]} {
+            ui_error "Port name '$name' contains unsafe characters. Names should only contain alphanumeric characters, underscores, dashes or dots."
+            incr errors
+        }
+    }
 
     if {[info exists platforms]} {
         foreach platform $platforms {

Modified: branches/images-and-archives/base/src/port1.0/portmain.tcl
===================================================================
--- branches/images-and-archives/base/src/port1.0/portmain.tcl	2009-08-03 04:20:56 UTC (rev 54854)
+++ branches/images-and-archives/base/src/port1.0/portmain.tcl	2009-08-03 04:22:38 UTC (rev 54855)
@@ -45,19 +45,18 @@
 
 # define options
 options prefix macportsuser name version revision epoch categories maintainers
-options long_description description homepage license provides conflicts
+options long_description description homepage license provides conflicts replaced_by
 options worksrcdir filesdir distname portdbpath libpath distpath sources_conf os.platform os.version os.major os.arch os.endian platforms default_variants install.user install.group macosx_deployment_target
 options universal_variant os.universal_supported
+options compiler.cpath compiler.library_path
 
 # Export options via PortInfo
-options_export name version revision epoch categories maintainers platforms description long_description homepage license provides conflicts
+options_export name version revision epoch categories maintainers platforms description long_description homepage license provides conflicts replaced_by
 
 # Assign option procedure to default_variants
 option_proc default_variants handle_default_variants
 
-default distpath {[file join $portdbpath distfiles]}
 default workpath {[getportworkpath_from_buildpath $portbuildpath]}
-default worksymlink {[file join $portpath work]}
 default prefix /opt/local
 default applications_dir /Applications/MacPorts
 default frameworks_dir {${prefix}/Library/Frameworks}
@@ -105,6 +104,9 @@
 
 default universal_variant yes
 
+default compiler.cpath {${prefix}/include}
+default compiler.library_path {${prefix}/lib}
+
 # Select implicit variants
 if {[info exists os.platform] && ![info exists variations(${os.platform})]} { variant_set ${os.platform}}
 if {[info exists os.arch] && ![info exists variations(${os.arch})]} { variant_set ${os.arch} }
@@ -116,10 +118,47 @@
     option os.universal_supported yes
 }
 
+# start gsoc08-privileges
+
 # Record initial euid/egid
 set euid [geteuid]
 set egid [getegid]
 
+# if unable to write to workpath, implies running without either root privileges
+# or a shared directory owned by the group so use ~/.macports
+if { $euid != 0 && ([info exists workpath] && [file exists $workpath] && ![file writable $workpath]) || [info exists portdbpath] && ![file writable [file join $portdbpath build]] } {
+
+    set username [uid_to_name [getuid]]
+
+    # set global variable indicating to other functions to use ~/.macports as well
+    set usealtworkpath yes
+
+    # 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)"
+    } else {
+        # the environment var isn't set, expand ~user instead
+        set userhome [file normalize "~${username}"]
+    }
+
+    # set alternative prefix global variable
+    set altprefix [file join $userhome .macports]
+
+    default worksymlink {[file join ${altprefix}${portpath} work]}
+    default distpath {[file join ${altprefix}${portdbpath} distfiles]}
+    set portbuildpath "${altprefix}${portbuildpath}"
+
+    ui_debug "Going to use alternate build prefix: $altprefix"
+    ui_debug "portbuildpath = $portbuildpath"
+    ui_debug "workpath = $workpath"
+} else {
+    set usealtworkpath no
+    default worksymlink {[file join $portpath work]}
+    default distpath {[file join $portdbpath distfiles]}
+}
+# end gsoc08-privileges
+
 proc portmain::main {args} {
     return 0
 }

Modified: branches/images-and-archives/base/src/port1.0/porttrace.tcl
===================================================================
--- branches/images-and-archives/base/src/port1.0/porttrace.tcl	2009-08-03 04:20:56 UTC (rev 54854)
+++ branches/images-and-archives/base/src/port1.0/porttrace.tcl	2009-08-03 04:22:38 UTC (rev 54855)
@@ -44,7 +44,7 @@
         if {[catch {package require Thread} error]} {
             ui_warn "trace requires Tcl Thread package ($error)"
         } else {
-            global env trace_fifo trace_sandboxbounds portpath distpath
+            global env trace_fifo trace_sandboxbounds portpath distpath altprefix
             # Create a fifo.
             # path in unix socket limited to 109 chars
             # # set trace_fifo "$workpath/trace_fifo"

Modified: branches/images-and-archives/base/src/port1.0/portutil.tcl
===================================================================
--- branches/images-and-archives/base/src/port1.0/portutil.tcl	2009-08-03 04:20:56 UTC (rev 54854)
+++ branches/images-and-archives/base/src/port1.0/portutil.tcl	2009-08-03 04:22:38 UTC (rev 54855)
@@ -358,6 +358,12 @@
     if {[option macosx_deployment_target] ne ""} {
         set ${command}.env_array(MACOSX_DEPLOYMENT_TARGET) [option macosx_deployment_target]
     }
+    if {[option compiler.cpath] ne ""} {
+        set ${command}.env_array(CPATH) [join [option compiler.cpath] :]
+    }
+    if {[option compiler.library_path] ne ""} {
+        set ${command}.env_array(LIBRARY_PATH) [join [option compiler.library_path] :]
+    }
 
     # Debug that.
     ui_debug "Environment: [environment_array_to_string ${command}.env_array]"
@@ -911,7 +917,7 @@
             return -code error "reinplace copy failed"
         }
 
-        eval file attributes {$file} $attributes
+        fileAttrsAsRoot $file $attributes
 
         file delete "$tmpfile"
     }
@@ -1219,7 +1225,9 @@
 
     if {$procedure != ""} {
         set targetname [ditem_key $ditem name]
-        if { [tbool ${targetname}.asroot] } {
+        set target [ditem_key $ditem provides]
+        global ${target}.asroot
+        if { [tbool ${target}.asroot] } {
             elevateToRoot $targetname
         }
 
@@ -1489,83 +1497,41 @@
 # open file to store name of completed targets
 proc open_statefile {args} {
     global workpath worksymlink place_worksymlink name portpath ports_ignore_older
-    global altprefix usealtworkpath env applications_dir portbuildpath distpath
+    global usealtworkpath altprefix env applications_dir portbuildpath
 
-    # start gsoc08-privileges
-    if { ![file exists $workpath] } {
-        if {[catch {set result [file mkdir $workpath]} result]} {
-            global errorInfo
-            ui_debug "mkdir $workpath: $errorInfo"
-        }
+    if {![file isdirectory $workpath]} {
+        file mkdir $workpath
+        chownAsRoot $portbuildpath
     }
-
-    # if unable to write to workpath, implies running without either root privileges
-    # or a shared directory owned by the group so use ~/.macports
-    if { ![file writable $workpath] } {
-
-        set userid [getuid]
-        set username [uid_to_name $userid]
-
-        if { $userid !=0 } {
-            ui_msg "MacPorts running without privileges.\
-                    You may be unable to complete certain actions (eg install)."
-        }
-
-        # set global variable indicating to other functions to use ~/.macports as well
-        set usealtworkpath yes
-
-        # 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)"
-        } else {
-            # the environment var isn't set, expand ~user instead
-            set userhome [file normalize "~${username}"]
-        }
-
-        # set alternative prefix global variables
-        set altprefix "$userhome/.macports"
-
-        # get alternative paths
-        set newworkpath "$altprefix$workpath"
-        set newworksymlink "$altprefix$worksymlink"
-        set newportbuildpath "$altprefix$portbuildpath"
-        set newdistpath "$altprefix$distpath"
-
-        set sourcepath [string map {"work" ""} $worksymlink]
-        set newsourcepath "$altprefix/[ string range $sourcepath 1 end ]"
-
+    
+    if { [getuid] != 0 } {
+        ui_msg "MacPorts running without privileges.\
+                You may be unable to complete certain actions (eg install)."
+    }
+    
+    # de-escalate privileges if MacPorts was started with sudo
+    dropPrivileges
+    
+    if {$usealtworkpath} {
+        set newsourcepath "$altprefix/$portpath"
+    
         # copy Portfile (and patch files) if not there already
         # note to maintainers/devs: the original portfile in /opt/local is ALWAYS the one that will be
         #    read by macports. The copying of the portfile is done to preserve the symlink provided
         #    historically by macports from the portfile directory to the work directory.
         #    It is NOT read by MacPorts.
-        if {![file exists ${newsourcepath}Portfile] } {
+        if {![file exists ${newsourcepath}/Portfile] } {
             file mkdir $newsourcepath
             ui_debug "$newsourcepath created"
-            ui_debug "Going to copy: ${sourcepath}Portfile"
-            file copy ${sourcepath}Portfile $newsourcepath
-            if {[file exists ${sourcepath}files] } {
-                ui_debug "Going to copy: ${sourcepath}files"
-                file copy ${sourcepath}files $newsourcepath
+            ui_debug "Going to copy: ${portpath}/Portfile"
+            file copy ${portpath}/Portfile $newsourcepath
+            if {[file exists ${portpath}/files] } {
+                ui_debug "Going to copy: ${portpath}/files"
+                file copy ${portpath}/files $newsourcepath
             }
         }
-
-        set workpath $newworkpath
-        set worksymlink $newworksymlink
-        set portbuildpath $newportbuildpath
-        set distpath $newdistpath
-
-        ui_debug "Going to use $newworkpath for statefile."
-    } else {
-        set usealtworkpath no
     }
-    # end gsoc08-privileges
 
-    if {![file isdirectory $workpath]} {
-        file mkdir $workpath
-    }
-
     # flock Portfile
     set statefile [file join $workpath .macports.${name}.state]
     if {[file exists $statefile]} {
@@ -1575,22 +1541,19 @@
         if {!([info exists ports_ignore_older] && $ports_ignore_older == "yes") && [file mtime $statefile] < [file mtime ${portpath}/Portfile]} {
             if {!([info exists ports_dryrun] && $ports_dryrun == "yes")} {
                 ui_msg "Portfile changed since last build; discarding previous state."
-                delete [file join $workpath]
-                file mkdir [file join $workpath]
+                delete $workpath
+                file mkdir $workpath
             } else {
                 ui_msg "Portfile changed since last build but not discarding previous state (dry run)"
             }
         }
     }
-    chownAsRoot $workpath
 
     # Create a symlink to the workpath for port authors
     if {[tbool place_worksymlink] && ![file isdirectory $worksymlink]} {
         ui_debug "Attempting ln -sf $workpath $worksymlink"
         ln -sf $workpath $worksymlink
     }
-    # de-escalate privileges - only run if MacPorts was started with sudo
-    dropPrivileges
 
     set fd [open $statefile a+]
     if {[catch {flock $fd -exclusive -noblock} result]} {
@@ -1867,14 +1830,8 @@
     return $result
 }
 
-# add the default universal variant if appropriate, and set up flags that are
-# conditional on whether universal is set
+# add the default universal variant if appropriate
 proc universal_setup {args} {
-    global configure.archflags
-    global configure.march configure.mtune configure.universal_cflags
-    global configure.universal_cxxflags configure.universal_cppflags 
-    global configure.universal_ldflags configure.universal_args
-    
     if {[variant_exists universal]} {
         ui_debug "universal variant already exists, so not adding the default one"
     } elseif {[exists universal_variant] && ![option universal_variant]} {
@@ -1890,28 +1847,6 @@
         ui_debug "adding the default universal variant"
         variant universal {}
     }
-
-    # add in extra CFLAGS etc
-    if {[variant_exists universal] && [variant_isset universal]} {
-        foreach flag {cflags objcflags fflags f90flags fcflags} {
-            eval configure.${flag}-append ${configure.universal_cflags}
-        }
-        eval configure.cxxflags-append ${configure.universal_cxxflags}
-        eval configure.cppflags-append ${configure.universal_cppflags}
-        eval configure.ldflags-append ${configure.universal_ldflags}
-        eval configure.pre_args-append ${configure.universal_args}
-    } else {
-        foreach flag {cflags cxxflags objcflags fflags f90flags fcflags} {
-            eval configure.${flag}-append ${configure.archflags}
-            if {${configure.march} != {}} {
-                configure.${flag}-append "-march=${configure.march}"
-            }
-            if {${configure.mtune} != {}} {
-                configure.${flag}-append "-mtune=${configure.mtune}"
-            }
-        }
-        eval configure.ldflags-append ${configure.archflags}
-    }
 }
 
 # Target class definition.
@@ -2318,6 +2253,26 @@
 }
 
 ##
+# Change attributes of file while running as root
+#
+# @param file the file in question
+# @param attributes the attributes for the file
+proc fileAttrsAsRoot {file attributes} {
+    global euid macportsuser
+    if {[getuid] == 0 && [geteuid] != 0} {
+        # Started as root, but not root now
+        seteuid $euid
+        ui_debug "euid changed to: [geteuid]"
+        ui_debug "setting attributes on $file"
+        eval file attributes {$file} $attributes
+        seteuid [name_to_uid "$macportsuser"]
+        ui_debug "euid changed to: [geteuid]"
+    } else {
+        eval file attributes {$file} $attributes
+    }
+}
+
+##
 # Elevate privileges back to root.
 #
 # @param action the action for which privileges are being elevated

Modified: branches/images-and-archives/base/src/programs/daemondo/Makefile.in
===================================================================
--- branches/images-and-archives/base/src/programs/daemondo/Makefile.in	2009-08-03 04:20:56 UTC (rev 54854)
+++ branches/images-and-archives/base/src/programs/daemondo/Makefile.in	2009-08-03 04:22:38 UTC (rev 54855)
@@ -8,7 +8,8 @@
 mandir=		@mandir@
 mandircat8=	${mandir}/cat8
 
-CFLAGS_QUICHEEATERS	= -W -Wall -Wno-unused-parameter
+CFLAGS_QUICHEEATERS	= -W -Wall
+CPPFLAGS	+= -I../..
 SRCS		= main.c
 OBJS		= main.o
 LIBS		= -framework CoreFoundation \
@@ -32,7 +33,7 @@
 distclean: clean
 	rm -f Makefile
 
-install:
+install: daemondo
 	${INSTALL} -o ${DSTUSR} -g ${DSTGRP} -m 555 ${PROGRAM} ${DESTDIR}${bindir}
 
 test:

Modified: branches/images-and-archives/base/src/programs/daemondo/main.c
===================================================================
--- branches/images-and-archives/base/src/programs/daemondo/main.c	2009-08-03 04:20:56 UTC (rev 54854)
+++ branches/images-and-archives/base/src/programs/daemondo/main.c	2009-08-03 04:22:38 UTC (rev 54855)
@@ -47,7 +47,11 @@
     
         com.apple.system.config.network_change
 */
-    
+
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include <stdio.h>
 #include <unistd.h>
 #include <signal.h>
@@ -707,7 +711,7 @@
 
 
 void
-ScheduledRestartCallback(CFRunLoopTimerRef timer, void *info)
+ScheduledRestartCallback(CFRunLoopTimerRef timer UNUSED, void *info UNUSED)
 {
     if (verbosity >= 3)
         LogMessage("Scheduled restart time has arrived.\n");
@@ -759,9 +763,9 @@
 
 void
 DynamicStoreChanged(
-                    SCDynamicStoreRef   store,
+                    SCDynamicStoreRef   store UNUSED,
                     CFArrayRef          changedKeys,
-                    void                *info
+                    void                *info UNUSED
                     )
 {
     if (verbosity >= 3)
@@ -789,7 +793,7 @@
 
 
 void
-PowerCallBack(void *x, io_service_t y, natural_t messageType, void *messageArgument)
+PowerCallBack(void *x UNUSED, io_service_t y UNUSED, natural_t messageType, void *messageArgument)
 {
     switch (messageType)
     {
@@ -814,11 +818,11 @@
 
 void
 NotificationCenterCallback(
-                                CFNotificationCenterRef center, 
-                                void *observer, 
-                                CFStringRef name, 
-                                const void *object, 
-                                CFDictionaryRef userInfo)
+                                CFNotificationCenterRef center UNUSED,
+                                void *observer UNUSED,
+                                CFStringRef name,
+                                const void *object UNUSED,
+                                CFDictionaryRef userInfo UNUSED)
 {
     if (verbosity >= 3)
     {
@@ -832,7 +836,7 @@
 
 
 void
-SignalCallback(CFMachPortRef port, void *msg, CFIndex size, void *info)
+SignalCallback(CFMachPortRef port UNUSED, void *msg, CFIndex size UNUSED, void *info UNUSED)
 {
     mach_msg_header_t* hdr = (mach_msg_header_t*)msg;
     switch (hdr->msgh_id)
@@ -865,8 +869,8 @@
 }
 
 
-void KQueueCallBack (CFSocketRef socketRef, CFSocketCallBackType type,
-             CFDataRef address, const void *data, void *context)
+void KQueueCallBack (CFSocketRef socketRef, CFSocketCallBackType type UNUSED,
+             CFDataRef address UNUSED, const void *data UNUSED, void *context UNUSED)
 {
     int fd = CFSocketGetNative(socketRef);
     

Modified: branches/images-and-archives/base/src/upgrade_sources_conf_default.tcl
===================================================================
--- branches/images-and-archives/base/src/upgrade_sources_conf_default.tcl	2009-08-03 04:20:56 UTC (rev 54854)
+++ branches/images-and-archives/base/src/upgrade_sources_conf_default.tcl	2009-08-03 04:22:38 UTC (rev 54855)
@@ -41,15 +41,26 @@
          } elseif {[regexp {rsync://rsync\.(macports|darwinports)\.org/(release|dpupdate)/d?ports} $url]} {
             set addDefault true
          } elseif {[regexp {file://(/.+)} $url -> filepath]} {
-            if {[file exists [file join ${filepath} .svn]] && ![catch {set svnChannel [open "|svn info ${filepath}" r]}]} {
-               set svnURL {}
-               while {[gets $svnChannel svnLine] >= 0} {
-                  regexp {^URL: (.*)} $svnLine -> svnURL
+            if {[file exists [file join ${filepath} .svn]]} {
+               if {![catch {set svnChannel [open "|svn info ${filepath}" r]} err]} {
+                  set svnURL {}
+                  while {[gets $svnChannel svnLine] >= 0} {
+                     regexp {^URL: (.*)} $svnLine -> svnURL
+                  }
+                  if {[catch {close $svnChannel} err]} {
+                     if {![string match "*This client is too old to work with working copy*" $err]} {
+                        return -code error $err
+                     } else {
+                        puts $err
+                        puts "WARNING: Unable to check svn URL for '$filepath' as it has been checked out with a newer Subversion client; please manually verify $sourcesConf!"
+                     }
+                  }
+                  if {[regexp {^https?://svn\.(macports|macosforge)\.org/repository/macports/trunk/dports} $svnURL]} {
+                     set addDefault true
+                  }
+               } else {
+                  return -code error $err
                }
-               close $svnChannel
-               if {[regexp {^https?://svn\.(macports|macosforge)\.org/repository/macports/trunk/dports} $svnURL]} {
-                  set addDefault true
-               }
             }
          }
          if {$addDefault} {
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20090802/26f1ff67/attachment-0001.html>


More information about the macports-changes mailing list