[69810] branches/new-help-system/base

raimue at macports.org raimue at macports.org
Fri Jul 16 17:51:10 PDT 2010


Revision: 69810
          http://trac.macports.org/changeset/69810
Author:   raimue at macports.org
Date:     2010-07-16 17:51:07 -0700 (Fri, 16 Jul 2010)
Log Message:
-----------
Merge from trunk

Modified Paths:
--------------
    branches/new-help-system/base/ChangeLog
    branches/new-help-system/base/LICENSE
    branches/new-help-system/base/Makefile.in
    branches/new-help-system/base/NEWS
    branches/new-help-system/base/config/RELEASE_URL
    branches/new-help-system/base/config/macports_version
    branches/new-help-system/base/configure
    branches/new-help-system/base/configure.ac
    branches/new-help-system/base/doc/Makefile
    branches/new-help-system/base/doc/macports.conf.5
    branches/new-help-system/base/doc/macports.conf.in
    branches/new-help-system/base/doc/portfile.7
    branches/new-help-system/base/doc/prefix.mtree.in
    branches/new-help-system/base/portmgr/ReleaseProcess
    branches/new-help-system/base/portmgr/dmg/InstallationCheck
    branches/new-help-system/base/portmgr/dmg/InstallationCheck.strings
    branches/new-help-system/base/portmgr/dmg/License.html
    branches/new-help-system/base/portmgr/dmg/ReadMe.rtf
    branches/new-help-system/base/portmgr/dmg/postflight
    branches/new-help-system/base/portmgr/jobs/README
    branches/new-help-system/base/portmgr/jobs/mprsyncup
    branches/new-help-system/base/portmgr/packaging/dpkgall.tcl
    branches/new-help-system/base/portmgr/packaging/rpmall.tcl
    branches/new-help-system/base/src/cregistry/entry.c
    branches/new-help-system/base/src/cregistry/registry.c
    branches/new-help-system/base/src/cregistry/sql.c
    branches/new-help-system/base/src/darwintracelib1.0/darwintrace.c
    branches/new-help-system/base/src/macports1.0/Makefile
    branches/new-help-system/base/src/macports1.0/macports.tcl
    branches/new-help-system/base/src/package1.0/Makefile
    branches/new-help-system/base/src/package1.0/portarchive.tcl
    branches/new-help-system/base/src/package1.0/portarchivefetch.tcl
    branches/new-help-system/base/src/package1.0/portunarchive.tcl
    branches/new-help-system/base/src/pextlib1.0/Pextlib.c
    branches/new-help-system/base/src/pextlib1.0/curl.c
    branches/new-help-system/base/src/pextlib1.0/strsed.c
    branches/new-help-system/base/src/pextlib1.0/tracelib.c
    branches/new-help-system/base/src/pextlib1.0/xinstall.c
    branches/new-help-system/base/src/port/Makefile
    branches/new-help-system/base/src/port/port-help.tcl
    branches/new-help-system/base/src/port/port.tcl
    branches/new-help-system/base/src/port/portindex.tcl
    branches/new-help-system/base/src/port/portmirror.tcl
    branches/new-help-system/base/src/port1.0/Makefile
    branches/new-help-system/base/src/port1.0/fetch_common.tcl
    branches/new-help-system/base/src/port1.0/port_autoconf.tcl.in
    branches/new-help-system/base/src/port1.0/portactivate.tcl
    branches/new-help-system/base/src/port1.0/portbuild.tcl
    branches/new-help-system/base/src/port1.0/portchecksum.tcl
    branches/new-help-system/base/src/port1.0/portclean.tcl
    branches/new-help-system/base/src/port1.0/portconfigure.tcl
    branches/new-help-system/base/src/port1.0/portdeactivate.tcl
    branches/new-help-system/base/src/port1.0/portdestroot.tcl
    branches/new-help-system/base/src/port1.0/portdistfiles.tcl
    branches/new-help-system/base/src/port1.0/portextract.tcl
    branches/new-help-system/base/src/port1.0/portfetch.tcl
    branches/new-help-system/base/src/port1.0/portinstall.tcl
    branches/new-help-system/base/src/port1.0/portmain.tcl
    branches/new-help-system/base/src/port1.0/portpatch.tcl
    branches/new-help-system/base/src/port1.0/portstartupitem.tcl
    branches/new-help-system/base/src/port1.0/porttest.tcl
    branches/new-help-system/base/src/port1.0/porttrace.tcl
    branches/new-help-system/base/src/port1.0/portutil.tcl
    branches/new-help-system/base/src/registry2.0/Makefile
    branches/new-help-system/base/src/registry2.0/portimage.tcl
    branches/new-help-system/base/src/registry2.0/portuninstall.tcl
    branches/new-help-system/base/src/registry2.0/receipt_flat.tcl
    branches/new-help-system/base/src/registry2.0/receipt_sqlite.tcl
    branches/new-help-system/base/src/registry2.0/registry_util.tcl

Added Paths:
-----------
    branches/new-help-system/base/doc/pubkeys.conf.in
    branches/new-help-system/base/macports-pubkey.pem

Removed Paths:
-------------
    branches/new-help-system/base/portmgr/jobs/PortIndexRegen.sh
    branches/new-help-system/base/portmgr/jobs/org.macports.PortIndexRegen.plist

Property Changed:
----------------
    branches/new-help-system/base/
    branches/new-help-system/base/doc/
    branches/new-help-system/base/src/pextlib1.0/sha2.c
    branches/new-help-system/base/src/pextlib1.0/sha2.h
    branches/new-help-system/base/src/pextlib1.0/sha256cmd.c
    branches/new-help-system/base/src/pextlib1.0/sha256cmd.h
    branches/new-help-system/base/src/registry2.0/receipt_sqlite.tcl


Property changes on: branches/new-help-system/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:49341-66610
/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:49341-69809
/users/perry/base-bugs_and_notes:45682-46060
/users/perry/base-select:44044-44692

Modified: branches/new-help-system/base/ChangeLog
===================================================================
--- branches/new-help-system/base/ChangeLog	2010-07-16 23:53:45 UTC (rev 69809)
+++ branches/new-help-system/base/ChangeLog	2010-07-17 00:51:07 UTC (rev 69810)
@@ -2,12 +2,193 @@
 # This is a log of major user-visible changes in each MacPorts release.
 # $Id$
 ###
+Release 1.9.2 (future):
+    - Fixed sha256 checksum (snc in r68955)
 
-Release 1.9.0 (unreleased):
+    - Fixed premature privilege dropping (jmr in r68952)
 
-    - Add "fs-traverse" -tails which only returns the part following the
-      specified directory (raimue in r65785)
 
+Release 1.9.1 (2010-06-18):
+    - Fixed a couple of problems with new 1.9 features when using the flat
+      registry format (jmr in r68910, r68913)
+
+    - Ports using the replaced_by option will once again be deactivated when
+      an upgrade is performed on them (#25270, jmr in r68872)
+
+    - Fixed the possibility of some empty directories being left behind when
+      a port is deactivated (#25268, jmr in r68864)
+
+    - Fixed failure to detect conflicts with files that are not provided by
+      a port before activation starts (#25255, jmr in r68849)
+
+    - Fixed problems with distfile names containing spaces (#25245, #25246;
+      jmr in r68816, r68817)
+
+    - Fixed a problem with uninstall when using direct mode, and started
+      running pre/post activate and deactivate procedures when installing and
+      uninstalling in direct mode, respectively (#11562, jmr in r68697)
+
+    - fixed a crasher that affected Tiger (#25194, jmr in r68675, r68680,
+      r68691)
+
+Release 1.9.0 (2010-06-08 by jmr):
+
+    - It is no longer possible to use include statements in Portfiles
+      (raimue in r68206)
+
+    - Command line options can be abbreviated if unambiguous
+      (raimue in r66837)
+
+    - Added a new variable 'os.subplatform'. When os.platform is darwin, the
+      subplatform is either 'macosx' or 'puredarwin'.
+
+    - 'platform' no longer creates a variant, instead it executes the code in
+      the body immediately if the current platform matches the one specified.
+
+    - Using a Portfile with a modification date in the future now causes an
+      informative error early on, instead of just discarding the workdir at
+      the start of every phase. (#24717, raimue in r65246)
+
+    - Fetching from servers that require a cookie to be set now works.
+      (#24584, raimue in r66785)
+
+    - Fixed an error when everything is deleted from the patchfiles list.
+      (#24178, raimue in r65243)
+
+    - Added 'license:' pseudo-port selector. (#24123, perry in r65033)
+
+    - Added new fetch.type 'bzr'. (#23436, perry in r65096)
+
+    - Added 'rdeps' and 'rdependents' actions, recursive versions of 'deps'
+      and 'dependents' respectively. Also added 'depof:', 'rdepof:',
+      'dependentof:' and 'rdependentof:' pseudo-port selectors, for specifying
+      the ports that are dependencies or dependents of the given port.
+      (#22346, jmr in r65858/r66198)
+
+    - Updated the description of the search action in the port(1) man page.
+      (#23749, jmr in r66670)
+
+    - Dry-run now uses /dev/null as the statefile, which prevents a couple of
+      problems involving locking and variant checks.
+      (#21794, #21962; jmr in r66921)
+
+    - The list of dependencies to be installed is now displayed immediately
+      after computing them. (#21540, jmr in r66321)
+
+    - The quick index is now reloaded after syncing in interactive mode, which
+      prevents errors due to it not matching the updated PortIndex.
+      (#20874, jmr in r66319, refinement of patch from carrel.org:edward)
+
+    - The architectures of dependencies are checked when installing a port. If
+      a dependency does not provide the required arch(s), it is rebuilt with
+      +universal if that is possible and will help, otherwise the install fails
+      and an error message explains why. (#20728, jmr in r65087)
+
+    - New supported_archs option allows ports to indicate which architectures
+      they can be built for. The default values of configure.build_arch and
+      configure.universal_archs change based on this list. Set this to
+      'noarch' if a port installs only architecture-independent files.
+      (#20739, jmr in r64372/r64945)
+
+    - Declaring a variant that requires one or more other variants will now
+      correctly set the required variants, so they can be checked with
+      variant_isset. (#19224, jmr in r66642)
+
+    - 'port outdated' now indicates the reason why a port that appears to have
+      the same version as that in the tree is considered outdated. Possible
+      reasons are that the epoch is higher, or the installed version was built
+      on a different OS version. (#19138, jmr in r64960)
+
+    - Distfile names are now percent-escaped in the download URLs when needed.
+      (#18736, jmr in r66794)
+
+    - buildnicevalue is now applied to configure and destroot commands, and to
+      build commands with unusual names. (#18304, raimue in r65076/r65808)
+
+    - Removed hardcoded /opt/local prefix from the base dmg resources.
+      (#17633, jmr in r66776)
+
+    - Fixed an error that occurred when archive mode was enabled but
+      ${prefix}/var/macports/packages did not exist. (#17579, jmr in r66775)
+
+    - Syncing rsync sources now tries to get a platform-specific version of
+      the PortIndex from the server, and skips this if the local copy is less
+      than a day old. All sync methods now update the PortIndex at the end.
+      (#17157, jmr in r66846/r67207)
+
+    - portindex(1) now skips parsing Portfiles whose modification time is
+      older than the current PortIndex, instead reusing the existing entry.
+      (#16235, jmr in r66845)
+
+    - Added a 'requested' flag to the registry that indicates which ports were
+      installed explicitly (as opposed to as a dependency of something else).
+      This enables the new 'requested', 'unrequested' and 'leaves' pseudo-
+      ports, as well as the --follow-dependencies option for uninstall.
+      The setrequested and unsetrequested actions will set and clear the flag,
+      respectively.
+      (#15260, jmr in r64517, r64663, r65546, r66037, r66200, r66215)
+
+    - The macports1.0 directory is now installed to
+      ${prefix}/share/macports/Tcl rather than /Library/Tcl. A symlink will be
+      installed in the old location if there is nothing there already, so
+      'package require macports' will still work in tclsh.
+      (#12943, jmr in r65055)
+
+    - Added warning and error messags when Xcode is old enough to cause
+      problems or too old to use at all, respectively. (#12794, jmr in r66771)
+
+    - Removed the rather outdated copy of sqlite3 from the source tree, made
+      the sqlite3 directory configurable, and added defaults for non-darwin
+      platforms. (#12231, jmr in r64358/r64363)
+
+    - There is a new 'archivefetch' target which is run before unarchive when
+      archive mode is enabled, and attempts to download the archive from a
+      server. There are currently no sites configured to download from (these
+      are stored in the ports tree like the mirror sites used for fetch), but
+      you can set ARCHIVE_SITE_LOCAL in the environment. Note that there is no
+      integrity checking for archives yet. (#8571, jmr in r64816)
+
+    - Now recording negative variants in the registry, which stops deselected
+      variants from being reactivated on upgrade due to default_variants or
+      variants.conf settings. (#2377, jmr in r64533)
+
+    - Added support for pre- and post- procedures for the activate, deactivate
+      and uninstall targets. This feature requires portdbformat sqlite. There
+      was limited support for pre- and post-activate previously, but the
+      procedures were only run when installing the port, not when activating
+      an inactive version. (#1068, #4228, #18273; jmr in r64638/r64639)
+
+    - Integrated the sqlite-based registry2.0 code. The portdbformat variable
+      in macports.conf can be set to 'sqlite' to enable it. Existing flat
+      receipts will be converted the first time port(1) is run with sufficient
+      privileges. Original code by sfiera, fixed and integrated by jmr in
+      r63398 and following. The new format lacks a number of problems that the
+      old one suffers from, including #13054 (dependencies from old port
+      versions stick around across upgrades) and #14123 (files whose paths
+      differ only in case are left behind when uninstalling).
+
+    - Fixed file list in +CONTENTS file in archives. (#21864, jmr in r59882)
+
+    - Fixed a few issues reported with building MacPorts on Linux. (#22716)
+
+    - Upgrade will now always choose the port that is active when following
+      dependencies that could be satisfied by more than one port and more than
+      one of these is installed, instead of choosing the one actually named in
+      the depspec. (#23921, jmr in r60883)
+
+    - Extracting from a disk image ("use_dmg yes") no longer fails when there
+      is a space in $worksrcdir. (#23456, raimue in r67089)
+
+    - Added a configure.sdkroot option which can be used to build against a
+      Mac OS X SDK. It is empty by default unless the value of
+      macosx_deployment_target is not the current OS version, or the universal
+      variant is set and the current platform is PowerPC Tiger. It is also
+      possible to set macosx_deployment_target globally in macports.conf now,
+      but this is unsupported. (#19875, jmr in r66924)
+
+    - Add "fs-traverse -tails" which only returns the part following the
+      specified directory (#21873, raimue in r65785)
+
     - Allow gcc45 port to be used in configure.compiler (ryandesign in r62223)
 
     - svn checkouts now use peg revisions instead of operative revisions,
@@ -26,9 +207,8 @@
       for GNU make. Only makes a difference for BSD patch and BSD make.
       (afb in r58020)
 
-    - Update the FreeBSD package, drop the old Fedora/Ubuntu packages.
-      (MacPorts now requires BSD, but objc/Foundation is now optional)
-      (afb in r57858, r57889)
+    - Updated the FreeBSD package (ObjC/Foundation is now optional).
+      (afb in r57889)
 
     - Don't use "make -j1" for build.jobs=1, but prefer "make" instead.
       (afb in r57998)
@@ -36,22 +216,19 @@
     - Add new "use_xz yes" port option to allow distfiles in xz format.
       (afb in r57827)
 
-    - Archivemode now uses build_arch to create and extract archives.
-      This is a step in the direction of enabling binary distribution.
+    - Archive mode now uses build_arch in archive names rather than os.arch.
       (snc in r58977)
 
     - Add new log command and keeping of debug output for easy access
       after port has run (GSoC 2009 logging project by enl, merged in r60372)
 
-Release 1.8.3 (unreleased):
-
     - Some of the build_arch flags now appear in LDFLAGS as well, fixing
       several ports when building for a different architecture (jeremyhu in
       r60662, jmr in r60680)
 
     - Fixed 'merge' proc for paths with spaces, and for symlinks on Snow
       Leopard, and added an error message for when 'merge' is not called
-      correctly (ryandesign in r58776, r58777, r58778)
+      correctly (#21852, ryandesign in r58776, r58777, r58778)
 
 Release 1.8.2 (2010-01-01 by jmr):
 

Modified: branches/new-help-system/base/LICENSE
===================================================================
--- branches/new-help-system/base/LICENSE	2010-07-16 23:53:45 UTC (rev 69809)
+++ branches/new-help-system/base/LICENSE	2010-07-17 00:51:07 UTC (rev 69810)
@@ -1,5 +1,5 @@
 Copyright (c) 2002 - 2003, Apple Inc.
-Copyright (c) 2004 - 2009, The MacPorts Project.
+Copyright (c) 2004 - 2010, The MacPorts Project.
 All rights reserved.
 
 Redistribution and use in source and binary forms, with or without

Modified: branches/new-help-system/base/Makefile.in
===================================================================
--- branches/new-help-system/base/Makefile.in	2010-07-16 23:53:45 UTC (rev 69809)
+++ branches/new-help-system/base/Makefile.in	2010-07-17 00:51:07 UTC (rev 69810)
@@ -34,6 +34,7 @@
 install::
 	[ ! -f $(DESTDIR)${sysconfdir}/macports/mp_version ] || rm -vf $(DESTDIR)${sysconfdir}/macports/mp_version
 	$(INSTALL) -o ${DSTUSR} -g ${DSTGRP} -m 444 setupenv.bash  $(DESTDIR)${datadir}/macports/
+	$(INSTALL) -o ${DSTUSR} -g ${DSTGRP} -m 444 macports-pubkey.pem  $(DESTDIR)${datadir}/macports/
 # Only run these scripts when not building in a destroot
 ifeq ($(DESTDIR),)
 # Add [default] tag to the central MacPorts repository, if it isn't already

Modified: branches/new-help-system/base/NEWS
===================================================================
--- branches/new-help-system/base/NEWS	2010-07-16 23:53:45 UTC (rev 69809)
+++ branches/new-help-system/base/NEWS	2010-07-17 00:51:07 UTC (rev 69810)
@@ -1,3 +1,35 @@
+== Overview of changes from MacPorts 1.8.2 to 1.9.0 ==
+
+# For regular users:
+
+*) All output is now logged to a file, whose location will be shown if a port
+   target fails. This should be attached to bug reports. The new 'log' action
+   can also be used to view the log for a port.
+*) Command line options can be abbreviated if unambiguous.
+*) New actions: rdeps, rdependents, setrequested, unsetrequested
+*) --follow-dependencies option for uninstall (ports with the requested flag
+   set or with other dependents are skipped).
+*) New pseudo-ports and selectors: requested, unrequested, leaves, depof:,
+   rdepof:, dependentof:, rdependentof:.
+*) Architectures of dependencies are checked before install, and in many cases
+   will be automatically fixed by upgrading with +universal.
+*) New sqlite registry format which is faster and lacks some of the old
+   format's inconvenient limitations.
+*) Explicitly deselected variants (e.g. -foo) are now recorded, so they will
+   not be set to + when upgrading if +foo appears in variants.conf or
+   the port's default_variants.
+
+# For Portfile writers:
+
+*) New os.subplatform variable.
+*) New configure.ld_archflags option to match configure.cc_archflags et al.
+*) 'platform' acts like an 'if' statement rather than a variant.
+*) New supported_archs option for indicating a port only supports certain
+   archs or is noarch.
+*) pre-/post-deactivate and pre-/post-uninstall procedures can now be used,
+   and pre-/post-activate procedures are run every time the port is activated,
+   not just the first time when it is installed.
+
 == Overview of changes from MacPorts 1.7.1 to 1.8.0 ==
 
 # For regular users:

Modified: branches/new-help-system/base/config/RELEASE_URL
===================================================================
--- branches/new-help-system/base/config/RELEASE_URL	2010-07-16 23:53:45 UTC (rev 69809)
+++ branches/new-help-system/base/config/RELEASE_URL	2010-07-17 00:51:07 UTC (rev 69810)
@@ -1 +1 @@
-http://svn.macports.org/repository/macports/tags/release_1_8_2/base
+http://svn.macports.org/repository/macports/tags/release_1_9_1/base

Modified: branches/new-help-system/base/config/macports_version
===================================================================
--- branches/new-help-system/base/config/macports_version	2010-07-16 23:53:45 UTC (rev 69809)
+++ branches/new-help-system/base/config/macports_version	2010-07-17 00:51:07 UTC (rev 69810)
@@ -1 +1 @@
-1.8.99
+1.9.99

Modified: branches/new-help-system/base/configure
===================================================================
--- branches/new-help-system/base/configure	2010-07-16 23:53:45 UTC (rev 69809)
+++ branches/new-help-system/base/configure	2010-07-17 00:51:07 UTC (rev 69810)
@@ -1,13 +1,13 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.65 for MacPorts 1.8.99.
+# Generated by GNU Autoconf 2.66 for MacPorts 1.9.99.
 #
 # Report bugs to <macports-dev at lists.macosforge.org>.
 #
 #
 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
-# Inc.
+# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software
+# Foundation, Inc.
 #
 #
 # This configure script is free software; the Free Software Foundation
@@ -319,7 +319,7 @@
       test -d "$as_dir" && break
     done
     test -z "$as_dirs" || eval "mkdir $as_dirs"
-  } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir"
+  } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
 
 
 } # as_fn_mkdir_p
@@ -359,19 +359,19 @@
 fi # as_fn_arith
 
 
-# as_fn_error ERROR [LINENO LOG_FD]
-# ---------------------------------
+# as_fn_error STATUS ERROR [LINENO LOG_FD]
+# ----------------------------------------
 # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
 # provided, also output the error to LOG_FD, referencing LINENO. Then exit the
-# script with status $?, using 1 if that was 0.
+# script with STATUS, using 1 if that was 0.
 as_fn_error ()
 {
-  as_status=$?; test $as_status -eq 0 && as_status=1
-  if test "$3"; then
-    as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-    $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3
+  as_status=$1; test $as_status -eq 0 && as_status=1
+  if test "$4"; then
+    as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+    $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
   fi
-  $as_echo "$as_me: error: $1" >&2
+  $as_echo "$as_me: error: $2" >&2
   as_fn_exit $as_status
 } # as_fn_error
 
@@ -533,7 +533,7 @@
 exec 6>&1
 
 # Name of the host.
-# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
+# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status,
 # so uname gets run too.
 ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
 
@@ -552,8 +552,8 @@
 # Identity of this package.
 PACKAGE_NAME='MacPorts'
 PACKAGE_TARNAME='macports'
-PACKAGE_VERSION='1.8.99'
-PACKAGE_STRING='MacPorts 1.8.99'
+PACKAGE_VERSION='1.9.99'
+PACKAGE_STRING='MacPorts 1.9.99'
 PACKAGE_BUGREPORT='macports-dev at lists.macosforge.org'
 PACKAGE_URL=''
 
@@ -688,6 +688,7 @@
 UNZIP
 TAR
 SED
+OPENSSL
 RSYNC
 RMDIR
 PATCH
@@ -816,6 +817,7 @@
 MTREE
 CVS
 SVN
+OPENSSL
 RSYNC
 SED
 TAR
@@ -936,7 +938,7 @@
     ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
     # Reject names that are not valid shell variable names.
     expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
-      as_fn_error "invalid feature name: $ac_useropt"
+      as_fn_error $? "invalid feature name: $ac_useropt"
     ac_useropt_orig=$ac_useropt
     ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
     case $ac_user_opts in
@@ -962,7 +964,7 @@
     ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
     # Reject names that are not valid shell variable names.
     expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
-      as_fn_error "invalid feature name: $ac_useropt"
+      as_fn_error $? "invalid feature name: $ac_useropt"
     ac_useropt_orig=$ac_useropt
     ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
     case $ac_user_opts in
@@ -1166,7 +1168,7 @@
     ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
     # Reject names that are not valid shell variable names.
     expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
-      as_fn_error "invalid package name: $ac_useropt"
+      as_fn_error $? "invalid package name: $ac_useropt"
     ac_useropt_orig=$ac_useropt
     ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
     case $ac_user_opts in
@@ -1182,7 +1184,7 @@
     ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
     # Reject names that are not valid shell variable names.
     expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
-      as_fn_error "invalid package name: $ac_useropt"
+      as_fn_error $? "invalid package name: $ac_useropt"
     ac_useropt_orig=$ac_useropt
     ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
     case $ac_user_opts in
@@ -1212,8 +1214,8 @@
   | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
     x_libraries=$ac_optarg ;;
 
-  -*) as_fn_error "unrecognized option: \`$ac_option'
-Try \`$0 --help' for more information."
+  -*) as_fn_error $? "unrecognized option: \`$ac_option'
+Try \`$0 --help' for more information"
     ;;
 
   *=*)
@@ -1221,7 +1223,7 @@
     # Reject names that are not valid shell variable names.
     case $ac_envvar in #(
       '' | [0-9]* | *[!_$as_cr_alnum]* )
-      as_fn_error "invalid variable name: \`$ac_envvar'" ;;
+      as_fn_error $? "invalid variable name: \`$ac_envvar'" ;;
     esac
     eval $ac_envvar=\$ac_optarg
     export $ac_envvar ;;
@@ -1239,13 +1241,13 @@
 
 if test -n "$ac_prev"; then
   ac_option=--`echo $ac_prev | sed 's/_/-/g'`
-  as_fn_error "missing argument to $ac_option"
+  as_fn_error $? "missing argument to $ac_option"
 fi
 
 if test -n "$ac_unrecognized_opts"; then
   case $enable_option_checking in
     no) ;;
-    fatal) as_fn_error "unrecognized options: $ac_unrecognized_opts" ;;
+    fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;;
     *)     $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
   esac
 fi
@@ -1268,7 +1270,7 @@
     [\\/$]* | ?:[\\/]* )  continue;;
     NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
   esac
-  as_fn_error "expected an absolute directory name for --$ac_var: $ac_val"
+  as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val"
 done
 
 # There might be people who depend on the old broken behavior: `$host'
@@ -1282,8 +1284,8 @@
 if test "x$host_alias" != x; then
   if test "x$build_alias" = x; then
     cross_compiling=maybe
-    $as_echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
-    If a cross compiler is detected then cross compile mode will be used." >&2
+    $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host.
+    If a cross compiler is detected then cross compile mode will be used" >&2
   elif test "x$build_alias" != "x$host_alias"; then
     cross_compiling=yes
   fi
@@ -1298,9 +1300,9 @@
 ac_pwd=`pwd` && test -n "$ac_pwd" &&
 ac_ls_di=`ls -di .` &&
 ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
-  as_fn_error "working directory cannot be determined"
+  as_fn_error $? "working directory cannot be determined"
 test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
-  as_fn_error "pwd does not report name of working directory"
+  as_fn_error $? "pwd does not report name of working directory"
 
 
 # Find the source files, if location was not specified.
@@ -1339,11 +1341,11 @@
 fi
 if test ! -r "$srcdir/$ac_unique_file"; then
   test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
-  as_fn_error "cannot find sources ($ac_unique_file) in $srcdir"
+  as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir"
 fi
 ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
 ac_abs_confdir=`(
-	cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error "$ac_msg"
+	cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg"
 	pwd)`
 # When building in place, set srcdir=.
 if test "$ac_abs_confdir" = "$ac_pwd"; then
@@ -1369,7 +1371,7 @@
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures MacPorts 1.8.99 to adapt to many kinds of systems.
+\`configure' configures MacPorts 1.9.99 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1383,7 +1385,7 @@
       --help=short        display options specific to this package
       --help=recursive    display the short help of all the included packages
   -V, --version           display version information and exit
-  -q, --quiet, --silent   do not print \`checking...' messages
+  -q, --quiet, --silent   do not print \`checking ...' messages
       --cache-file=FILE   cache test results in FILE [disabled]
   -C, --config-cache      alias for \`--cache-file=config.cache'
   -n, --no-create         do not create output files
@@ -1435,7 +1437,7 @@
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of MacPorts 1.8.99:";;
+     short | recursive ) echo "Configuration of MacPorts 1.9.99:";;
    esac
   cat <<\_ACEOF
 
@@ -1495,6 +1497,7 @@
   MTREE       path to mtree command
   CVS         path to cvs command
   SVN         path to svn command
+  OPENSSL     path to openssl command
   RSYNC       path to rsync command
   SED         path to sed command
   TAR         path to tar command
@@ -1574,10 +1577,10 @@
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-MacPorts configure 1.8.99
-generated by GNU Autoconf 2.65
+MacPorts configure 1.9.99
+generated by GNU Autoconf 2.66
 
-Copyright (C) 2009 Free Software Foundation, Inc.
+Copyright (C) 2010 Free Software Foundation, Inc.
 This configure script is free software; the Free Software Foundation
 gives unlimited permission to copy, distribute and modify it.
 _ACEOF
@@ -1755,10 +1758,10 @@
 ac_fn_objc_check_header_mongrel ()
 {
   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+  if eval "test \"\${$3+set}\"" = set; then :
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
 $as_echo_n "checking for $2... " >&6; }
-if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval "test \"\${$3+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 fi
 eval ac_res=\$$3
@@ -1817,17 +1820,15 @@
 $as_echo "$as_me: WARNING: $2:     section \"Present But Cannot Be Compiled\"" >&2;}
     { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
-( cat <<\_ASBOX
-## ------------------------------------------------ ##
+( $as_echo "## ------------------------------------------------ ##
 ## Report this to macports-dev at lists.macosforge.org ##
-## ------------------------------------------------ ##
-_ASBOX
+## ------------------------------------------------ ##"
      ) | sed "s/^/$as_me: WARNING:     /" >&2
     ;;
 esac
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
 $as_echo_n "checking for $2... " >&6; }
-if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval "test \"\${$3+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 else
   eval "$3=\$ac_header_compiler"
@@ -1891,7 +1892,7 @@
   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
 $as_echo_n "checking for $2... " >&6; }
-if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval "test \"\${$3+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -2046,10 +2047,10 @@
 ac_fn_c_check_header_mongrel ()
 {
   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+  if eval "test \"\${$3+set}\"" = set; then :
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
 $as_echo_n "checking for $2... " >&6; }
-if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval "test \"\${$3+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 fi
 eval ac_res=\$$3
@@ -2108,17 +2109,15 @@
 $as_echo "$as_me: WARNING: $2:     section \"Present But Cannot Be Compiled\"" >&2;}
     { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
-( cat <<\_ASBOX
-## ------------------------------------------------ ##
+( $as_echo "## ------------------------------------------------ ##
 ## Report this to macports-dev at lists.macosforge.org ##
-## ------------------------------------------------ ##
-_ASBOX
+## ------------------------------------------------ ##"
      ) | sed "s/^/$as_me: WARNING:     /" >&2
     ;;
 esac
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
 $as_echo_n "checking for $2... " >&6; }
-if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval "test \"\${$3+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 else
   eval "$3=\$ac_header_compiler"
@@ -2139,7 +2138,7 @@
   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
 $as_echo_n "checking for $2... " >&6; }
-if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval "test \"\${$3+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -2198,15 +2197,18 @@
 
 } # ac_fn_c_check_func
 
-# ac_fn_c_check_decl LINENO SYMBOL VAR
-# ------------------------------------
-# Tests whether SYMBOL is declared, setting cache variable VAR accordingly.
+# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES
+# ---------------------------------------------
+# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR
+# accordingly.
 ac_fn_c_check_decl ()
 {
   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $2 is declared" >&5
-$as_echo_n "checking whether $2 is declared... " >&6; }
-if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+  as_decl_name=`echo $2|sed 's/ *(.*//'`
+  as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'`
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5
+$as_echo_n "checking whether $as_decl_name is declared... " >&6; }
+if eval "test \"\${$3+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -2215,9 +2217,13 @@
 int
 main ()
 {
-#ifndef $2
-  (void) $2;
+#ifndef $as_decl_name
+#ifdef __cplusplus
+  (void) $as_decl_use;
+#else
+  (void) $as_decl_name;
 #endif
+#endif
 
   ;
   return 0;
@@ -2240,8 +2246,8 @@
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by MacPorts $as_me 1.8.99, which was
-generated by GNU Autoconf 2.65.  Invocation command line was
+It was created by MacPorts $as_me 1.9.99, which was
+generated by GNU Autoconf 2.66.  Invocation command line was
 
   $ $0 $@
 
@@ -2351,11 +2357,9 @@
   {
     echo
 
-    cat <<\_ASBOX
-## ---------------- ##
+    $as_echo "## ---------------- ##
 ## Cache variables. ##
-## ---------------- ##
-_ASBOX
+## ---------------- ##"
     echo
     # The following way of writing the cache mishandles newlines in values,
 (
@@ -2389,11 +2393,9 @@
 )
     echo
 
-    cat <<\_ASBOX
-## ----------------- ##
+    $as_echo "## ----------------- ##
 ## Output variables. ##
-## ----------------- ##
-_ASBOX
+## ----------------- ##"
     echo
     for ac_var in $ac_subst_vars
     do
@@ -2406,11 +2408,9 @@
     echo
 
     if test -n "$ac_subst_files"; then
-      cat <<\_ASBOX
-## ------------------- ##
+      $as_echo "## ------------------- ##
 ## File substitutions. ##
-## ------------------- ##
-_ASBOX
+## ------------------- ##"
       echo
       for ac_var in $ac_subst_files
       do
@@ -2424,11 +2424,9 @@
     fi
 
     if test -s confdefs.h; then
-      cat <<\_ASBOX
-## ----------- ##
+      $as_echo "## ----------- ##
 ## confdefs.h. ##
-## ----------- ##
-_ASBOX
+## ----------- ##"
       echo
       cat confdefs.h
       echo
@@ -2483,7 +2481,12 @@
 ac_site_file1=NONE
 ac_site_file2=NONE
 if test -n "$CONFIG_SITE"; then
-  ac_site_file1=$CONFIG_SITE
+  # We do not want a PATH search for config.site.
+  case $CONFIG_SITE in #((
+    -*)  ac_site_file1=./$CONFIG_SITE;;
+    */*) ac_site_file1=$CONFIG_SITE;;
+    *)   ac_site_file1=./$CONFIG_SITE;;
+  esac
 elif test "x$prefix" != xNONE; then
   ac_site_file1=$prefix/share/config.site
   ac_site_file2=$prefix/etc/config.site
@@ -2498,7 +2501,11 @@
     { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5
 $as_echo "$as_me: loading site script $ac_site_file" >&6;}
     sed 's/^/| /' "$ac_site_file" >&5
-    . "$ac_site_file"
+    . "$ac_site_file" \
+      || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "failed to load site script $ac_site_file
+See \`config.log' for more details" "$LINENO" 5; }
   fi
 done
 
@@ -2574,7 +2581,7 @@
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
   { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5
 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}
-  as_fn_error "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5
+  as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5
 fi
 ## -------------------- ##
 ## Main body of script. ##
@@ -2593,16 +2600,22 @@
 
 ac_aux_dir=
 for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
-  for ac_t in install-sh install.sh shtool; do
-    if test -f "$ac_dir/$ac_t"; then
-      ac_aux_dir=$ac_dir
-      ac_install_sh="$ac_aux_dir/$ac_t -c"
-      break 2
-    fi
-  done
+  if test -f "$ac_dir/install-sh"; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install-sh -c"
+    break
+  elif test -f "$ac_dir/install.sh"; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install.sh -c"
+    break
+  elif test -f "$ac_dir/shtool"; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/shtool install -c"
+    break
+  fi
 done
 if test -z "$ac_aux_dir"; then
-  as_fn_error "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5
+  as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5
 fi
 
 # These three variables are undocumented and unsupported,
@@ -2616,7 +2629,7 @@
 
 # Make sure we can run config.sub.
 $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
-  as_fn_error "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
+  as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5
 $as_echo_n "checking build system type... " >&6; }
@@ -2627,16 +2640,16 @@
 test "x$ac_build_alias" = x &&
   ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
 test "x$ac_build_alias" = x &&
-  as_fn_error "cannot guess build type; you must specify one" "$LINENO" 5
+  as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5
 ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
-  as_fn_error "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5
+  as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5
 
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5
 $as_echo "$ac_cv_build" >&6; }
 case $ac_cv_build in
 *-*-*) ;;
-*) as_fn_error "invalid value of canonical build" "$LINENO" 5;;
+*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;;
 esac
 build=$ac_cv_build
 ac_save_IFS=$IFS; IFS='-'
@@ -2661,7 +2674,7 @@
   ac_cv_host=$ac_cv_build
 else
   ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
-    as_fn_error "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5
+    as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5
 fi
 
 fi
@@ -2669,7 +2682,7 @@
 $as_echo "$ac_cv_host" >&6; }
 case $ac_cv_host in
 *-*-*) ;;
-*) as_fn_error "invalid value of canonical host" "$LINENO" 5;;
+*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;;
 esac
 host=$ac_cv_host
 ac_save_IFS=$IFS; IFS='-'
@@ -2694,7 +2707,7 @@
   ac_cv_target=$ac_cv_host
 else
   ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` ||
-    as_fn_error "$SHELL $ac_aux_dir/config.sub $target_alias failed" "$LINENO" 5
+    as_fn_error $? "$SHELL $ac_aux_dir/config.sub $target_alias failed" "$LINENO" 5
 fi
 
 fi
@@ -2702,7 +2715,7 @@
 $as_echo "$ac_cv_target" >&6; }
 case $ac_cv_target in
 *-*-*) ;;
-*) as_fn_error "invalid value of canonical target" "$LINENO" 5;;
+*) as_fn_error $? "invalid value of canonical target" "$LINENO" 5;;
 esac
 target=$ac_cv_target
 ac_save_IFS=$IFS; IFS='-'
@@ -2728,7 +2741,7 @@
 # Read in the MacPorts version from the base/config/macports_version file
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking MacPorts version" >&5
 $as_echo_n "checking MacPorts version... " >&6; }
-MACPORTS_VERSION=1.8.99
+MACPORTS_VERSION=1.9.99
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MACPORTS_VERSION" >&5
 $as_echo "$MACPORTS_VERSION" >&6; }
 
@@ -2891,7 +2904,7 @@
 
 case "$MACOSX_VERSION" in
   10.0*|10.1*|10.2*|10.3*)
-    as_fn_error "This version of Mac OS X is not supported
+    as_fn_error $? "This version of Mac OS X is not supported
                   Please upgrade at http://store.apple.com/" "$LINENO" 5
     ;;
   10.4.[0-9]|10.4.10|10.5.[0-7]|10.6.[0-1])
@@ -3251,8 +3264,8 @@
 
 test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error "no acceptable C compiler found in \$PATH
-See \`config.log' for more details." "$LINENO" 5; }
+as_fn_error $? "no acceptable C compiler found in \$PATH
+See \`config.log' for more details" "$LINENO" 5; }
 
 # Provide some information about the compiler.
 $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
@@ -3366,9 +3379,8 @@
 
 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ as_fn_set_status 77
-as_fn_error "C compiler cannot create executables
-See \`config.log' for more details." "$LINENO" 5; }; }
+as_fn_error 77 "C compiler cannot create executables
+See \`config.log' for more details" "$LINENO" 5; }
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
@@ -3410,8 +3422,8 @@
 else
   { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error "cannot compute suffix of executables: cannot compile and link
-See \`config.log' for more details." "$LINENO" 5; }
+as_fn_error $? "cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details" "$LINENO" 5; }
 fi
 rm -f conftest conftest$ac_cv_exeext
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
@@ -3468,9 +3480,9 @@
     else
 	{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error "cannot run C compiled programs.
+as_fn_error $? "cannot run C compiled programs.
 If you meant to cross compile, use \`--host'.
-See \`config.log' for more details." "$LINENO" 5; }
+See \`config.log' for more details" "$LINENO" 5; }
     fi
   fi
 fi
@@ -3521,8 +3533,8 @@
 
 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error "cannot compute suffix of object files: cannot compile
-See \`config.log' for more details." "$LINENO" 5; }
+as_fn_error $? "cannot compute suffix of object files: cannot compile
+See \`config.log' for more details" "$LINENO" 5; }
 fi
 rm -f conftest.$ac_cv_objext conftest.$ac_ext
 fi
@@ -4090,7 +4102,7 @@
 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
 set x ${MAKE-make}
 ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
-if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 else
   cat >conftest.make <<\_ACEOF
@@ -4098,7 +4110,7 @@
 all:
 	@echo '@@@%%%=$(MAKE)=@@@%%%'
 _ACEOF
-# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+# GNU make sometimes prints "make[1]: Entering ...", which would confuse us.
 case `${MAKE-make} -f conftest.make 2>/dev/null` in
   *@@@%%%=?*=@@@%%%*)
     eval ac_cv_prog_make_${ac_make}_set=yes;;
@@ -4810,6 +4822,46 @@
 fi
 
 
+# Extract the first word of "openssl", so it can be a program name with args.
+set dummy openssl; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_OPENSSL+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $OPENSSL in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_OPENSSL="$OPENSSL" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_OPENSSL="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+OPENSSL=$ac_cv_path_OPENSSL
+if test -n "$OPENSSL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OPENSSL" >&5
+$as_echo "$OPENSSL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
 # Extract the first word of "sed", so it can be a program name with args.
 set dummy sed; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
@@ -5607,6 +5659,7 @@
 
 
 
+
 	# Extract the first word of "sed", so it can be a program name with args.
 set dummy sed; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
@@ -5649,7 +5702,7 @@
 
 
 	if test "x$SED" = "x"; then
-		as_fn_error "cannot find sed. Is sed installed?" "$LINENO" 5
+		as_fn_error $? "cannot find sed. Is sed installed?" "$LINENO" 5
 	fi
 
 	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking which sed flag to use for extended regexp" >&5
@@ -6398,8 +6451,8 @@
 else
   { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error "Objective C preprocessor \"$OBJCPP\" fails sanity check
-See \`config.log' for more details." "$LINENO" 5; }
+as_fn_error $? "Objective C preprocessor \"$OBJCPP\" fails sanity check
+See \`config.log' for more details" "$LINENO" 5; }
 fi
 
 ac_ext=m
@@ -6460,7 +6513,7 @@
   done
 IFS=$as_save_IFS
   if test -z "$ac_cv_path_GREP"; then
-    as_fn_error "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+    as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
   fi
 else
   ac_cv_path_GREP=$GREP
@@ -6526,7 +6579,7 @@
   done
 IFS=$as_save_IFS
   if test -z "$ac_cv_path_EGREP"; then
-    as_fn_error "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+    as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
   fi
 else
   ac_cv_path_EGREP=$EGREP
@@ -6658,8 +6711,7 @@
   as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
 ac_fn_objc_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
 "
-eval as_val=\$$as_ac_Header
-   if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
   cat >>confdefs.h <<_ACEOF
 #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
 _ACEOF
@@ -6687,7 +6739,7 @@
 			no)
 				;;
 			*)
-				as_fn_error "${with_objc_runtime} is not a valid argument to --with-objc-runtime. Please specify either \"GNU\" or \"apple\"" "$LINENO" 5
+				as_fn_error $? "${with_objc_runtime} is not a valid argument to --with-objc-runtime. Please specify either \"GNU\" or \"apple\"" "$LINENO" 5
 				;;
 		esac
 	fi
@@ -6711,7 +6763,7 @@
 _ACEOF
 
 else
-  as_fn_error "Can't locate Objective C runtime headers" "$LINENO" 5
+  as_fn_error $? "Can't locate Objective C runtime headers" "$LINENO" 5
 fi
 
 done
@@ -6956,8 +7008,8 @@
 	else
 			{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error "Could not locate a working Objective-C runtime.
-See \`config.log' for more details." "$LINENO" 5; }
+as_fn_error $? "Could not locate a working Objective-C runtime.
+See \`config.log' for more details" "$LINENO" 5; }
 	fi
 
 	# Restore LIBS & OBJCFLAGS
@@ -6999,7 +7051,7 @@
 			no)
 				;;
 			*)
-				as_fn_error "${with_objc_foundation} is not a valid argument to --with-objc-foundation. Please specify either \"GNU\" or \"apple\"" "$LINENO" 5
+				as_fn_error $? "${with_objc_foundation} is not a valid argument to --with-objc-foundation. Please specify either \"GNU\" or \"apple\"" "$LINENO" 5
 				;;
 		esac
 	fi
@@ -7080,7 +7132,7 @@
 		GNUSTEP_CONFIG=/usr/bin/gnustep-config
 		if test ! -x "${GNUSTEP_CONFIG}" -a x"${GNUSTEP_SYSTEM_ROOT}" == x; then
 			if test x"${with_objc_foundation}" == x"GNUstep"; then
-				as_fn_error "GNUSTEP_SYSTEM_ROOT is not defined in your environment, preventing the use of GNUstep's Foundation library" "$LINENO" 5
+				as_fn_error $? "GNUSTEP_SYSTEM_ROOT is not defined in your environment, preventing the use of GNUstep's Foundation library" "$LINENO" 5
 			else
 				{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: GNUSTEP_SYSTEM_ROOT is not defined in your environment, preventing the use of GNUstep's Foundation library" >&5
 $as_echo "$as_me: WARNING: GNUSTEP_SYSTEM_ROOT is not defined in your environment, preventing the use of GNUstep's Foundation library" >&2;}
@@ -7186,7 +7238,7 @@
 		{ $as_echo "$as_me:${as_lineno-$LINENO}: Not using Foundation implementation" >&5
 $as_echo "$as_me: Not using Foundation implementation" >&6;}
 	else
-		as_fn_error "Could not find a working Foundation implementation" "$LINENO" 5
+		as_fn_error $? "Could not find a working Foundation implementation" "$LINENO" 5
 	fi
 
 
@@ -7476,7 +7528,7 @@
 # Check for paths
 
 if test x$prefix = x/usr/local; then
-    as_fn_error "Installing MacPorts into /usr/local is not supported" "$LINENO" 5
+    as_fn_error $? "Installing MacPorts into /usr/local is not supported" "$LINENO" 5
 fi
 
 
@@ -7495,7 +7547,7 @@
  	  if test -d "$portsdir" -a -e "$portsdir/PortIndex" ; then
  		:
  	  else
- 		as_fn_error "$portsdir not a valid ports tree" "$LINENO" 5
+ 		as_fn_error $? "$portsdir not a valid ports tree" "$LINENO" 5
  	  fi
  	else
  		 		if test "x$PORTS_DIR_DEFAULT" != "x" ; then
@@ -7568,7 +7620,7 @@
 	    TCL_PACKAGE_DIR=${PACKAGE_DIR_NATIVE}
 
 		if test x"${ac_cv_c_tclpkgd}" = x ; then
-			as_fn_error "Tcl package directory not found.  Please specify its location with --with-tclpackage" "$LINENO" 5
+			as_fn_error $? "Tcl package directory not found.  Please specify its location with --with-tclpackage" "$LINENO" 5
 	    else
 			{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${ac_cv_c_tclpkgd}" >&5
 $as_echo "${ac_cv_c_tclpkgd}" >&6; }
@@ -7908,8 +7960,8 @@
 else
   { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error "C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details." "$LINENO" 5; }
+as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details" "$LINENO" 5; }
 fi
 
 ac_ext=c
@@ -8036,7 +8088,7 @@
   as_ac_Header=`$as_echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh`
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_hdr that defines DIR" >&5
 $as_echo_n "checking for $ac_hdr that defines DIR... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval "test \"\${$as_ac_Header+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -8063,8 +8115,7 @@
 eval ac_res=\$$as_ac_Header
 	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Header
-   if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
   cat >>confdefs.h <<_ACEOF
 #define `$as_echo "HAVE_$ac_hdr" | $as_tr_cpp` 1
 _ACEOF
@@ -8236,8 +8287,7 @@
 do :
   as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
 ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
-eval as_val=\$$as_ac_Header
-   if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
   cat >>confdefs.h <<_ACEOF
 #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
 _ACEOF
@@ -8254,8 +8304,7 @@
 do :
   as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
 ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
-eval as_val=\$$as_ac_var
-   if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
   cat >>confdefs.h <<_ACEOF
 #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
@@ -8383,7 +8432,7 @@
 $as_echo "$as_me: Please install the libmd developer headers for your platform." >&6;}
 					;;
 			esac
-			as_fn_error "libmd was found, but md5.h is missing." "$LINENO" 5
+			as_fn_error $? "libmd was found, but md5.h is missing." "$LINENO" 5
 
 fi
 
@@ -8397,7 +8446,7 @@
 fi
 
 	if test "x$MD5_LIBS" = "x"; then
-		as_fn_error "Neither CommonCrypto nor libmd were found. A working md5 implementation is required." "$LINENO" 5
+		as_fn_error $? "Neither CommonCrypto nor libmd were found. A working md5 implementation is required." "$LINENO" 5
 	fi
 
 
@@ -8593,7 +8642,7 @@
 		if test -f "${with_tclconfig}/tclConfig.sh" ; then
 		    ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)`
 		else
-		    as_fn_error "${with_tclconfig} directory doesn't contain tclConfig.sh" "$LINENO" 5
+		    as_fn_error $? "${with_tclconfig} directory doesn't contain tclConfig.sh" "$LINENO" 5
 		fi
 	    fi
 
@@ -8649,7 +8698,7 @@
 
 	if test x"${ac_cv_c_tclconfig}" = x ; then
 	    TCL_BIN_DIR="# no Tcl configs found"
-	    as_fn_error "Can't find Tcl configuration definitions" "$LINENO" 5
+	    as_fn_error $? "Can't find Tcl configuration definitions" "$LINENO" 5
 	else
 	    no_tcl=
 	    TCL_BIN_DIR=${ac_cv_c_tclconfig}
@@ -8728,7 +8777,7 @@
 	if test -f "${with_tclinclude}/tcl.h" ; then
 	    ac_cv_c_tclh=${with_tclinclude}
 	else
-	    as_fn_error "${with_tclinclude} directory does not contain Tcl public header file tcl.h" "$LINENO" 5
+	    as_fn_error $? "${with_tclinclude} directory does not contain Tcl public header file tcl.h" "$LINENO" 5
 	fi
     else
 	if test "${ac_cv_c_tclh+set}" = set; then :
@@ -8761,7 +8810,7 @@
     # Print a message based on how we determined the include path
 
     if test x"${ac_cv_c_tclh}" = x ; then
-	as_fn_error "tcl.h not found.  Please specify its location with --with-tclinclude" "$LINENO" 5
+	as_fn_error $? "tcl.h not found.  Please specify its location with --with-tclinclude" "$LINENO" 5
     else
 	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${ac_cv_c_tclh}" >&5
 $as_echo "${ac_cv_c_tclh}" >&6; }
@@ -8871,7 +8920,7 @@
 			;;
 	esac
 	if test "x$TCLSH" = "x" ; then
-		as_fn_error "Could not find tclsh" "$LINENO" 5
+		as_fn_error $? "Could not find tclsh" "$LINENO" 5
 	fi
 
 
@@ -8942,7 +8991,7 @@
     fi
 
     if test x"${ac_cv_c_tclpkgd}" = x ; then
-	as_fn_error "Tcl package directory not found.  Please specify its location with --with-tclpackage" "$LINENO" 5
+	as_fn_error $? "Tcl package directory not found.  Please specify its location with --with-tclpackage" "$LINENO" 5
     else
 	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${ac_cv_c_tclpkgd}" >&5
 $as_echo "${ac_cv_c_tclpkgd}" >&6; }
@@ -8968,7 +9017,7 @@
 	else
 		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
-		as_fn_error "tcl wasn't compiled with threads enabled" "$LINENO" 5
+		as_fn_error $? "tcl wasn't compiled with threads enabled" "$LINENO" 5
 	fi
 
 
@@ -9066,7 +9115,7 @@
 	fi
 
 	if test "x$CURL_CONFIG" = "x"; then
-		as_fn_error "cannot find curl-config. Is libcurl installed?" "$LINENO" 5
+		as_fn_error $? "cannot find curl-config. Is libcurl installed?" "$LINENO" 5
 	fi
 
 	CFLAGS_LIBCURL=$($CURL_CONFIG --cflags)
@@ -9141,7 +9190,7 @@
 if test "x$ac_cv_header_sqlite3_h" = x""yes; then :
 
 else
-  as_fn_error "cannot find sqlite3 header" "$LINENO" 5
+  as_fn_error $? "cannot find sqlite3 header" "$LINENO" 5
 fi
 
 
@@ -9340,7 +9389,7 @@
 
 	eval dpversionfile="${sysconfdir}/ports/dp_version"
 	if test -f $dpversionfile; then
-		as_fn_error "Existing MacPorts or DarwinPorts install is too old to be upgraded. Install MacPorts 1.7.1 first." "$LINENO" 5
+		as_fn_error $? "Existing MacPorts or DarwinPorts install is too old to be upgraded. Install MacPorts 1.7.1 first." "$LINENO" 5
 	else
 		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
@@ -9365,7 +9414,7 @@
 
 
 # Output
-ac_config_files="$ac_config_files Doxyfile Makefile Mk/macports.autoconf.mk doc/prefix.mtree doc/macosx.mtree doc/macports.conf portmgr/freebsd/Makefile src/Makefile src/macports1.0/macports_autoconf.tcl src/port1.0/port_autoconf.tcl src/registry2.0/registry_autoconf.tcl src/programs/Makefile src/macports1.0/macports_fastload.tcl setupenv.bash"
+ac_config_files="$ac_config_files Doxyfile Makefile Mk/macports.autoconf.mk doc/prefix.mtree doc/macosx.mtree doc/macports.conf doc/pubkeys.conf portmgr/freebsd/Makefile src/Makefile src/macports1.0/macports_autoconf.tcl src/port1.0/port_autoconf.tcl src/registry2.0/registry_autoconf.tcl src/programs/Makefile src/macports1.0/macports_fastload.tcl setupenv.bash"
 
 
 ac_config_files="$ac_config_files src/pkg_mkindex.sh"
@@ -9454,6 +9503,7 @@
 
 ac_libobjs=
 ac_ltlibobjs=
+U=
 for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
   # 1. Remove the extension, and $U if already installed.
   ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
@@ -9615,19 +9665,19 @@
 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
 
 
-# as_fn_error ERROR [LINENO LOG_FD]
-# ---------------------------------
+# as_fn_error STATUS ERROR [LINENO LOG_FD]
+# ----------------------------------------
 # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
 # provided, also output the error to LOG_FD, referencing LINENO. Then exit the
-# script with status $?, using 1 if that was 0.
+# script with STATUS, using 1 if that was 0.
 as_fn_error ()
 {
-  as_status=$?; test $as_status -eq 0 && as_status=1
-  if test "$3"; then
-    as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-    $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3
+  as_status=$1; test $as_status -eq 0 && as_status=1
+  if test "$4"; then
+    as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+    $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
   fi
-  $as_echo "$as_me: error: $1" >&2
+  $as_echo "$as_me: error: $2" >&2
   as_fn_exit $as_status
 } # as_fn_error
 
@@ -9823,7 +9873,7 @@
       test -d "$as_dir" && break
     done
     test -z "$as_dirs" || eval "mkdir $as_dirs"
-  } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir"
+  } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
 
 
 } # as_fn_mkdir_p
@@ -9876,8 +9926,8 @@
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by MacPorts $as_me 1.8.99, which was
-generated by GNU Autoconf 2.65.  Invocation command line was
+This file was extended by MacPorts $as_me 1.9.99, which was
+generated by GNU Autoconf 2.66.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
   CONFIG_HEADERS  = $CONFIG_HEADERS
@@ -9938,11 +9988,11 @@
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-MacPorts config.status 1.8.99
-configured by $0, generated by GNU Autoconf 2.65,
+MacPorts config.status 1.9.99
+configured by $0, generated by GNU Autoconf 2.66,
   with options \\"\$ac_cs_config\\"
 
-Copyright (C) 2009 Free Software Foundation, Inc.
+Copyright (C) 2010 Free Software Foundation, Inc.
 This config.status script is free software; the Free Software Foundation
 gives unlimited permission to copy, distribute and modify it."
 
@@ -9996,7 +10046,7 @@
     ac_need_defaults=false;;
   --he | --h)
     # Conflict between --help and --header
-    as_fn_error "ambiguous option: \`$1'
+    as_fn_error $? "ambiguous option: \`$1'
 Try \`$0 --help' for more information.";;
   --help | --hel | -h )
     $as_echo "$ac_cs_usage"; exit ;;
@@ -10005,7 +10055,7 @@
     ac_cs_silent=: ;;
 
   # This is an error.
-  -*) as_fn_error "unrecognized option: \`$1'
+  -*) as_fn_error $? "unrecognized option: \`$1'
 Try \`$0 --help' for more information." ;;
 
   *) as_fn_append ac_config_targets " $1"
@@ -10062,6 +10112,7 @@
     "doc/prefix.mtree") CONFIG_FILES="$CONFIG_FILES doc/prefix.mtree" ;;
     "doc/macosx.mtree") CONFIG_FILES="$CONFIG_FILES doc/macosx.mtree" ;;
     "doc/macports.conf") CONFIG_FILES="$CONFIG_FILES doc/macports.conf" ;;
+    "doc/pubkeys.conf") CONFIG_FILES="$CONFIG_FILES doc/pubkeys.conf" ;;
     "portmgr/freebsd/Makefile") CONFIG_FILES="$CONFIG_FILES portmgr/freebsd/Makefile" ;;
     "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
     "src/macports1.0/macports_autoconf.tcl") CONFIG_FILES="$CONFIG_FILES src/macports1.0/macports_autoconf.tcl" ;;
@@ -10072,7 +10123,7 @@
     "setupenv.bash") CONFIG_FILES="$CONFIG_FILES setupenv.bash" ;;
     "src/pkg_mkindex.sh") CONFIG_FILES="$CONFIG_FILES src/pkg_mkindex.sh" ;;
 
-  *) as_fn_error "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
+  *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
   esac
 done
 
@@ -10109,7 +10160,7 @@
 {
   tmp=./conf$$-$RANDOM
   (umask 077 && mkdir "$tmp")
-} || as_fn_error "cannot create a temporary directory in ." "$LINENO" 5
+} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5
 
 # Set up the scripts for CONFIG_FILES section.
 # No need to generate them if there are no CONFIG_FILES.
@@ -10126,7 +10177,7 @@
 fi
 ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
 if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
-  ac_cs_awk_cr='\r'
+  ac_cs_awk_cr='\\r'
 else
   ac_cs_awk_cr=$ac_cr
 fi
@@ -10140,18 +10191,18 @@
   echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
   echo "_ACEOF"
 } >conf$$subs.sh ||
-  as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5
-ac_delim_num=`echo "$ac_subst_vars" | grep -c '$'`
+  as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'`
 ac_delim='%!_!# '
 for ac_last_try in false false false false false :; do
   . ./conf$$subs.sh ||
-    as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5
+    as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
 
   ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X`
   if test $ac_delim_n = $ac_delim_num; then
     break
   elif $ac_last_try; then
-    as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5
+    as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
   else
     ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
   fi
@@ -10240,20 +10291,28 @@
 else
   cat
 fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \
-  || as_fn_error "could not setup config files machinery" "$LINENO" 5
+  || as_fn_error $? "could not setup config files machinery" "$LINENO" 5
 _ACEOF
 
-# VPATH may cause trouble with some makes, so we remove $(srcdir),
-# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
+# VPATH may cause trouble with some makes, so we remove sole $(srcdir),
+# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and
 # trailing colons and then remove the whole line if VPATH becomes empty
 # (actually we leave an empty line to preserve line numbers).
 if test "x$srcdir" = x.; then
-  ac_vpsub='/^[	 ]*VPATH[	 ]*=/{
-s/:*\$(srcdir):*/:/
-s/:*\${srcdir}:*/:/
-s/:*@srcdir@:*/:/
-s/^\([^=]*=[	 ]*\):*/\1/
+  ac_vpsub='/^[	 ]*VPATH[	 ]*=[	 ]*/{
+h
+s///
+s/^/:/
+s/[	 ]*$/:/
+s/:\$(srcdir):/:/g
+s/:\${srcdir}:/:/g
+s/:@srcdir@:/:/g
+s/^:*//
 s/:*$//
+x
+s/\(=[	 ]*\).*/\1/
+G
+s/\n//
 s/^[^=]*=[	 ]*$//
 }'
 fi
@@ -10281,7 +10340,7 @@
   if test -z "$ac_t"; then
     break
   elif $ac_last_try; then
-    as_fn_error "could not make $CONFIG_HEADERS" "$LINENO" 5
+    as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5
   else
     ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
   fi
@@ -10366,7 +10425,7 @@
 _ACAWK
 _ACEOF
 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-  as_fn_error "could not setup config headers machinery" "$LINENO" 5
+  as_fn_error $? "could not setup config headers machinery" "$LINENO" 5
 fi # test -n "$CONFIG_HEADERS"
 
 
@@ -10379,7 +10438,7 @@
   esac
   case $ac_mode$ac_tag in
   :[FHL]*:*);;
-  :L* | :C*:*) as_fn_error "invalid tag \`$ac_tag'" "$LINENO" 5;;
+  :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;;
   :[FH]-) ac_tag=-:-;;
   :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
   esac
@@ -10407,7 +10466,7 @@
 	   [\\/$]*) false;;
 	   *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
 	   esac ||
-	   as_fn_error "cannot find input file: \`$ac_f'" "$LINENO" 5;;
+	   as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;;
       esac
       case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
       as_fn_append ac_file_inputs " '$ac_f'"
@@ -10434,7 +10493,7 @@
 
     case $ac_tag in
     *:-:* | *:-) cat >"$tmp/stdin" \
-      || as_fn_error "could not create $ac_file" "$LINENO" 5 ;;
+      || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;
     esac
     ;;
   esac
@@ -10565,22 +10624,22 @@
 $ac_datarootdir_hack
 "
 eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \
-  || as_fn_error "could not create $ac_file" "$LINENO" 5
+  || as_fn_error $? "could not create $ac_file" "$LINENO" 5
 
 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
   { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
   { ac_out=`sed -n '/^[	 ]*datarootdir[	 ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } &&
   { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir'
-which seems to be undefined.  Please make sure it is defined." >&5
+which seems to be undefined.  Please make sure it is defined" >&5
 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
-which seems to be undefined.  Please make sure it is defined." >&2;}
+which seems to be undefined.  Please make sure it is defined" >&2;}
 
   rm -f "$tmp/stdin"
   case $ac_file in
   -) cat "$tmp/out" && rm -f "$tmp/out";;
   *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";;
   esac \
-  || as_fn_error "could not create $ac_file" "$LINENO" 5
+  || as_fn_error $? "could not create $ac_file" "$LINENO" 5
  ;;
   :H)
   #
@@ -10591,19 +10650,19 @@
       $as_echo "/* $configure_input  */" \
       && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs"
     } >"$tmp/config.h" \
-      || as_fn_error "could not create $ac_file" "$LINENO" 5
+      || as_fn_error $? "could not create $ac_file" "$LINENO" 5
     if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then
       { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5
 $as_echo "$as_me: $ac_file is unchanged" >&6;}
     else
       rm -f "$ac_file"
       mv "$tmp/config.h" "$ac_file" \
-	|| as_fn_error "could not create $ac_file" "$LINENO" 5
+	|| as_fn_error $? "could not create $ac_file" "$LINENO" 5
     fi
   else
     $as_echo "/* $configure_input  */" \
       && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \
-      || as_fn_error "could not create -" "$LINENO" 5
+      || as_fn_error $? "could not create -" "$LINENO" 5
   fi
  ;;
 
@@ -10623,7 +10682,7 @@
 ac_clean_files=$ac_clean_files_save
 
 test $ac_write_fail = 0 ||
-  as_fn_error "write failure creating $CONFIG_STATUS" "$LINENO" 5
+  as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5
 
 
 # configure is writing to config.log, and then calls config.status.
@@ -10644,7 +10703,7 @@
   exec 5>>config.log
   # Use ||, not &&, to avoid exiting from the if with $? = 1, which
   # would make configure fail if this is the last instruction.
-  $ac_cs_success || as_fn_exit $?
+  $ac_cs_success || as_fn_exit 1
 fi
 
 #
@@ -10785,7 +10844,7 @@
       # The eval makes quoting arguments work.
       eval "\$SHELL \"\$ac_sub_configure\" $ac_sub_configure_args \
 	   --cache-file=\"\$ac_sub_cache_file\" --srcdir=\"\$ac_srcdir\"" ||
-	as_fn_error "$ac_sub_configure failed for $ac_dir" "$LINENO" 5
+	as_fn_error $? "$ac_sub_configure failed for $ac_dir" "$LINENO" 5
     fi
 
     cd "$ac_popdir"

Modified: branches/new-help-system/base/configure.ac
===================================================================
--- branches/new-help-system/base/configure.ac	2010-07-16 23:53:45 UTC (rev 69809)
+++ branches/new-help-system/base/configure.ac	2010-07-17 00:51:07 UTC (rev 69810)
@@ -103,6 +103,7 @@
 AC_PATH_PROG(PATCH, [patch], [])
 AC_PATH_PROG(RMDIR, [rmdir], [])
 AC_PATH_PROG(RSYNC, [rsync], [])
+AC_PATH_PROG(OPENSSL, [openssl], [])
 AC_PATH_PROG(SED, [sed])
 AC_PATH_PROG(TAR, [tar])
 AC_PATH_PROG(UNZIP, [unzip])
@@ -127,6 +128,7 @@
 AC_ARG_VAR(MTREE, [path to mtree command])
 AC_ARG_VAR(CVS, [path to cvs command])
 AC_ARG_VAR(SVN, [path to svn command])
+AC_ARG_VAR(OPENSSL, [path to openssl command])
 AC_ARG_VAR(RSYNC, [path to rsync command])
 AC_ARG_VAR(SED, [path to sed command])
 AC_ARG_VAR(TAR, [path to tar command])
@@ -346,6 +348,7 @@
 	doc/prefix.mtree
 	doc/macosx.mtree
 	doc/macports.conf
+	doc/pubkeys.conf
 	portmgr/freebsd/Makefile
 	src/Makefile
 	src/macports1.0/macports_autoconf.tcl


Property changes on: branches/new-help-system/base/doc
___________________________________________________________________
Modified: svn:ignore
   - macports.conf
prefix.mtree
macosx.mtree
asciidoc.conf
*[0-9].gz
*[0-9].xml
*[0-9].html
.dep

   + macports.conf
pubkeys.conf
prefix.mtree
macosx.mtree
asciidoc.conf
*[0-9].gz
*[0-9].xml
*[0-9].html
.dep


Modified: branches/new-help-system/base/doc/Makefile
===================================================================
--- branches/new-help-system/base/doc/Makefile	2010-07-16 23:53:45 UTC (rev 69809)
+++ branches/new-help-system/base/doc/Makefile	2010-07-17 00:51:07 UTC (rev 69810)
@@ -12,6 +12,7 @@
 MAN5=		macports.conf.5
 MAN7=		portfile.7 portstyle.7 porthier.7 portgroup.7
 MAN=		${MAN1} ${MAN5} ${MAN7}
+CONF=       macports.conf pubkeys.conf sources.conf variants.conf
 INSTALLDIR=	${DESTDIR}${prefix}
 TOPSRCDIR=	..
 
@@ -43,7 +44,7 @@
 test:
 
 distclean: clean
-	rm -f prefix.mtree macports.conf macosx.mtree
+	rm -f macports.conf macosx.mtree prefix.mtree pubkeys.conf
 
 %.1.gz: %.1
 	gzip -c $^ > $@
@@ -82,21 +83,13 @@
 		$(LN_S) share/man ${INSTALLDIR}/man; \
 	fi
 
-	$(INSTALL) -o ${DSTUSR} -g ${DSTGRP} -m 444 macports.conf ${DESTDIR}${mpconfigdir}/macports.conf.default
-	if test ! -e ${DESTDIR}${mpconfigdir}/macports.conf ; then \
-		set -x; \
-		$(INSTALL) -o ${DSTUSR} -g ${DSTGRP} -m 644 macports.conf ${DESTDIR}${mpconfigdir}; \
-	fi
-	$(INSTALL) -o ${DSTUSR} -g ${DSTGRP} -m 444 sources.conf ${DESTDIR}${mpconfigdir}/sources.conf.default
-	if test ! -e ${DESTDIR}${mpconfigdir}/sources.conf ; then \
-		set -x; \
-		$(INSTALL) -o ${DSTUSR} -g ${DSTGRP} -m 644 sources.conf ${DESTDIR}${mpconfigdir}; \
-	fi
-	$(INSTALL) -o ${DSTUSR} -g ${DSTGRP} -m 444 variants.conf ${DESTDIR}${mpconfigdir}/variants.conf.default
-	if test ! -e ${DESTDIR}${mpconfigdir}/variants.conf ; then \
-		set -x; \
-		$(INSTALL) -o ${DSTUSR} -g ${DSTGRP} -m 644 variants.conf ${DESTDIR}${mpconfigdir}; \
-	fi
+	for f in ${CONF}; do \
+		$(INSTALL) -o ${DSTUSR} -g ${DSTGRP} -m 444 $$f ${DESTDIR}${mpconfigdir}/$${f}.default; \
+		if test ! -e ${DESTDIR}${mpconfigdir}/$$f ; then \
+			set -x; \
+			$(INSTALL) -o ${DSTUSR} -g ${DSTGRP} -m 644 $$f ${DESTDIR}${mpconfigdir}; \
+		fi; \
+	done
 
 	# delete old uncompressed man pages if they exist
 	for m in ${MAN1}; do rm -f ${INSTALLDIR}/share/man/man1/$$m ; done

Modified: branches/new-help-system/base/doc/macports.conf.5
===================================================================
--- branches/new-help-system/base/doc/macports.conf.5	2010-07-16 23:53:45 UTC (rev 69809)
+++ branches/new-help-system/base/doc/macports.conf.5	2010-07-17 00:51:07 UTC (rev 69810)
@@ -62,10 +62,11 @@
 .Ic Default:
 ${prefix}/var/macports
 .It Va portdbformat
-Storage type to use for the MacPorts registry. Currently the only supported format is "flat".
+Storage type to use for the MacPorts registry. The preferred format is "sqlite", with "flat"
+also available as a legacy format.
 .br
 .Ic Default:
-flat
+sqlite
 .It Va portinstalltype
 Sets the mode in which ports are installed by MacPorts. Supported values are 'direct' or 'image'.
 The 'direct' mode is often used on systems that do not support 'image' due to limitations in their

Modified: branches/new-help-system/base/doc/macports.conf.in
===================================================================
--- branches/new-help-system/base/doc/macports.conf.in	2010-07-16 23:53:45 UTC (rev 69809)
+++ branches/new-help-system/base/doc/macports.conf.in	2010-07-17 00:51:07 UTC (rev 69810)
@@ -11,8 +11,8 @@
 portdbpath		@localstatedir_expanded@/macports
 
 # Type of storage to use for the port registry information, "flat" or "sqlite"
-# default is flat, sqlite is still experimental
-#portdbformat		flat
+# default is sqlite, flat is legacy
+#portdbformat		sqlite
 
 # Type of installation to do for ports, "direct" or "image".  See macports.conf(5) and online documentation.
 #portinstalltype		image
@@ -21,8 +21,8 @@
 # paths are given in the example; it need not be uncommented.  Customizing binpath is intended for advanced users only.
 #binpath		@prefix_expanded@/bin:@prefix_expanded@/sbin:/bin:/sbin:/usr/bin:/usr/sbin
 
-# Directory containing Xcode Tools
-developer_dir       @DEVELOPER_DIR@
+# Directory containing Xcode Tools (default is to ask xcode-select)
+#developer_dir       @DEVELOPER_DIR@
 
 # Directory containing Applications from ports.
 applications_dir	@MPAPPLICATIONSDIR@
@@ -113,7 +113,8 @@
 
 # Extra environment variables to keep. Any variables listed here are added
 # to the list of variables that are not removed from the environment used
-# while processing ports
+# while processing ports. As with binpath, setting extra_env is intended for
+# advanced users and is unsupported.
 # extra_env		KEEP_THIS THIS_TOO
 
 # Proxy support

Modified: branches/new-help-system/base/doc/portfile.7
===================================================================
--- branches/new-help-system/base/doc/portfile.7	2010-07-16 23:53:45 UTC (rev 69809)
+++ branches/new-help-system/base/doc/portfile.7	2010-07-17 00:51:07 UTC (rev 69810)
@@ -515,8 +515,13 @@
 .br
 .Sy Type:
 .Em read-only
+.It Ic os.major
+Major version number of operating system (e.g. "7").
+.br
+.Sy Type:
+.Em read-only
 .It Ic os.endian
-Endianness of the processor (e.g. "bigEndian").
+Endianness of the processor (e.g. "big").
 .br
 .Sy Type:
 .Em read-only
@@ -525,6 +530,11 @@
 .br
 .Sy Type:
 .Em read-only
+.It Ic os.subplatform
+Name of specific operating system variant (e.g. "macosx").
+.br
+.Sy Type:
+.Em read-only
 .It Ic install.user
 User for MacPorts installation (e.g.
 .Pa root )
@@ -585,6 +595,42 @@
 .Sy Example:
 .Dl lib:libX11.6:XFree86
 .Bl -tag -width lc
+.It Ic depends_fetch
+List of dependencies to check before
+.Cm fetch ,
+.Cm checksum ,
+.Cm extract ,
+.Cm patch ,
+.Cm configure ,
+.Cm build ,
+.Cm destroot ,
+.Cm install ,
+and
+.Cm package
+targets.
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Example:
+.Dl depends_fetch port:mercurial
+.It Ic depends_extract
+List of dependencies to check before
+.Cm extract ,
+.Cm patch ,
+.Cm configure ,
+.Cm build ,
+.Cm destroot ,
+.Cm install ,
+and
+.Cm package
+targets.
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Example:
+.Dl depends_extract port:xz-devel
 .It Ic depends_build
 List of dependencies to check before
 .Cm configure ,
@@ -606,7 +652,8 @@
 .Cm install
 and
 .Cm package
-targets.
+targets. Will be recorded in the registry as being required by the dependent
+port when it is installed.
 .br
 .Sy Type:
 .Em optional
@@ -621,7 +668,8 @@
 .Cm install ,
 and
 .Cm package
-targets.
+targets. Will be recorded in the registry as being required by the dependent
+port when it is installed.
 .br
 .Sy Type:
 .Em optional
@@ -1188,15 +1236,18 @@
 .Em make
 .br
 .Sy Example:
-.Dl build.cmd pbxbuild
+.Dl build.cmd scons
 .It Ic build.type
-Defines which 'make' is required, either 'gnu' or 'bsd'.
+Defines which 'make' is required, either 'gnu' or 'bsd'. Can also choose 'xcode'
+(or the deprecated synonym 'pbx'), however you should generally use
+the xcode PortGroup rather than setting this directly.
 Sets
 .Ic build.cmd
 to either
-.Pa gnumake
+.Pa gnumake,
+.Pa bsdmake
 or
-.Pa bsdmake
+.Pa xcodebuild
 accordingly.
 .br
 .Sy Type:
@@ -1235,25 +1286,7 @@
 .Em ${build.cmd}
 .br
 .Sy Example:
-.Dl destroot.cmd pbxbuild
-.It Ic destroot.type
-Defines which 'make' is required, either 'gnu' or 'bsd'.
-Sets
-.Ic destroot.cmd
-to either
-.Pa gnumake
-or
-.Pa bsdmake
-accordingly.
-.br
-.Sy Type:
-.Em optional
-.br
-.Sy Default:
-.Em ${build.type}
-.br
-.Sy Example:
-.Dl destroot.type gnu
+.Dl destroot.cmd scons
 .It Ic destroot.destdir
 Arguments passed to
 .Ic destroot.cmd
@@ -1656,7 +1689,7 @@
 .Op Cm conflicts Ar variant
 .Op Cm description Ar "description"
 .Xc
-The value is usually a TCL script which modifies other port's
+The value is usually a TCL script which modifies one or more
 .Nm
 variables. Dependencies and conflicts with other variants in the same
 port can be expressed with
@@ -1708,10 +1741,10 @@
 .Dl universal_variant no
 .El
 .Sh PLATFORM OPTIONS
-MacPorts allows for platform-specific conditional modification to be
+MacPorts allows for platform-specific conditional code to be
 specified in a
 .Nm ,
-much like variants, for handling differences between platforms and
+for handling differences between platforms and
 versions of the same platform.
 .Bl -tag -width lc
 .It Xo
@@ -1719,9 +1752,11 @@
 .Ar platform
 .Op Ar version
 .Op Ar arch
+.Ar body
 .Xc
-The platform key is used to begin the darwin platform definitions as
-shown in the examples from the databases/db4 and devel/libidl1
+The body is executed if the given platform/version/arch combination matches
+os.platform or os.subplatform and/or os.major and/or os.arch.
+The following examples are from the databases/db4 and devel/libidl1
 .Nm Portfiles
 respectively.
 .br

Modified: branches/new-help-system/base/doc/prefix.mtree.in
===================================================================
--- branches/new-help-system/base/doc/prefix.mtree.in	2010-07-16 23:53:45 UTC (rev 69809)
+++ branches/new-help-system/base/doc/prefix.mtree.in	2010-07-17 00:51:07 UTC (rev 69810)
@@ -247,6 +247,8 @@
             ..
             logs
             ..
+            packages
+            ..
             receipts
             ..
             registry

Copied: branches/new-help-system/base/doc/pubkeys.conf.in (from rev 69809, trunk/base/doc/pubkeys.conf.in)
===================================================================
--- branches/new-help-system/base/doc/pubkeys.conf.in	                        (rev 0)
+++ branches/new-help-system/base/doc/pubkeys.conf.in	2010-07-17 00:51:07 UTC (rev 69810)
@@ -0,0 +1,10 @@
+# Downloaded archives will only be used if they can be verified by a public
+# key listed here. Use full paths, one per line.
+
+ at prefix_expanded@/share/macports/macports-pubkey.pem
+
+# To distribute archives of your own, you need a key pair generated like so:
+# openssl genrsa -des3 -out privkey.pem 2048
+# openssl rsa -in privkey.pem -pubout -out pubkey.pem
+# Then sign the archives like this:
+# openssl dgst -ripemd160 -sign privkey.pem -out archive.tbz2.rmd160 archive.tbz2

Copied: branches/new-help-system/base/macports-pubkey.pem (from rev 69809, trunk/base/macports-pubkey.pem)
===================================================================
--- branches/new-help-system/base/macports-pubkey.pem	                        (rev 0)
+++ branches/new-help-system/base/macports-pubkey.pem	2010-07-17 00:51:07 UTC (rev 69810)
@@ -0,0 +1,9 @@
+-----BEGIN PUBLIC KEY-----
+MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxPlw2FSMEavmtuHq5O+f
+XPUXndBnUyoX8iJvQ7NlsNY+hleE307kOAly79WFq2aAGIyKB/Ob8V+qCLW4FGOO
+4NfvOnte1WxQP8oVxOM9ai3CeN6AnUxDWUTYVJ1R+a5ZQVnJyGBKkV+jLlj0PD/z
+d8PCJ/j7Wzizw3d4s9uBIR1zpLY8lVgTivsj5FM3RP6hS7ww7I47goQshoL+YFVg
+NhE9I63oZXqFF130l9jJI9axHUqza7a42WCv04J8iv8SQhgv6fY9ZQnIBMQ4hPDH
+klGusdf4HlCbUViKhxmUpfj6FJabh2jV48ymaoTZB767GJyACF4mvnNDkenEXf41
+/wIDAQAB
+-----END PUBLIC KEY-----

Modified: branches/new-help-system/base/portmgr/ReleaseProcess
===================================================================
--- branches/new-help-system/base/portmgr/ReleaseProcess	2010-07-16 23:53:45 UTC (rev 69809)
+++ branches/new-help-system/base/portmgr/ReleaseProcess	2010-07-17 00:51:07 UTC (rev 69810)
@@ -125,8 +125,8 @@
 
 Note that if you omit the "ARC=yes" flag at the start of the make call then the full archive tarballs will not be produced.
 
-All these tarballs are uploaded via svn to the http://svn.macports.org/repository/macports/downloads/MacPorts-1.6.0/
-directory.
+All these tarballs are uploaded to the http://distfiles.macports.org/MacPorts/ directory. At present, this must
+be done with the help of the MacOSForge sysadmin.
 
 Additionally, a file is created, and posted to the same location, that contains md5, sha1, and rmd160 checksums
 for each of the files:
@@ -159,8 +159,8 @@
  mv MacPorts-1.6.0.dmg MacPorts-1.6.0-10.5-Leopard.dmg
  for dmg in MacPorts-1.6.0-*.dmg; do for type in -md5 -sha1 -ripemd160; do openssl dgst $type $dmg; done >> MacPorts-1.6.0.chk.txt; done
 
-These new products, along with the new checksums, also have to be posted to the appropriate downloads
-directory of the MacPorts svn repository. Developers are required to validate the generated installer as
+These new products, along with the new checksums, also have to be posted to the appropriate
+directory of the MacPorts distfiles server. Developers are required to validate the generated installer as
 thoroughly as possible through extensive testing, which is mainly why this step of the release process
 is not automated through a Makefile target or similar. A good way of validating the installer is to first
 create the destroot of the port and examine it for:
@@ -174,8 +174,9 @@
              ${destroot}/opt/local/share/macports/Tcl/macports1.0/MacPorts.dylib
              ${destroot}/opt/local/share/macports/Tcl/pextlib1.0/Pextlib.dylib
              ${destroot}/opt/local/share/macports/Tcl/registry2.0/registry.dylib
- * Universal building: When building for Tiger and above, all the files that need linking confirmation in the
-   step above also need to be confirmed of the universal type. A way to do this is through the file(1) command:
+ * Universal building: All the files that need linking confirmation in the step above also need to be
+   confirmed to be universal (i386/ppc on 10.5 and earlier, i386/x86_64 on 10.6 and later). A way to do this
+   is with the file(1) command:
              file ${destroot}/opt/local/bin/daemondo:
                   ${destroot}/opt/local/bin/daemondo: Mach-O universal binary with 2 architectures
                   ${destroot}/opt/local/bin/daemondo (for architecture ppc):  Mach-O executable ppc
@@ -186,7 +187,7 @@
              #\
              exec /usr/bin/tclsh "$0" "$@"
    thus ensuring that the default Mac OS X bundled Tcl is used in our scripts.
- * macports1.0 Tcl package: The macports1.0 Tcl package should be sourced off its default location in /opt/local/share/macports/Tcl/macports1.0
+ * macports1.0 Tcl package: The macports1.0 Tcl package should be sourced off its location in /opt/local/share/macports/Tcl/macports1.0
    in every single one of our scripts in ${destroot}/opt/local/bin.
  * Miscellaneous: anything else that might seem out of the ordinary for a fully default-configured MacPorts
    installation.

Modified: branches/new-help-system/base/portmgr/dmg/InstallationCheck
===================================================================
--- branches/new-help-system/base/portmgr/dmg/InstallationCheck	2010-07-16 23:53:45 UTC (rev 69809)
+++ branches/new-help-system/base/portmgr/dmg/InstallationCheck	2010-07-17 00:51:07 UTC (rev 69810)
@@ -12,17 +12,22 @@
     exit 112
 fi
 
+if ! [[ -x /usr/bin/xcodebuild ]]; then
+    # message 17
+    exit 113
+fi
+
 base_version=`uname -r | sed 's/\..*//'`
 if [[ ${base_version} != __DARWINVERS__ ]]; then
-   # This maps to message 17 in InstallationCheck.strings (Apple allows
+   # This maps to message 18 in InstallationCheck.strings (Apple allows
    # 16-31 for custom messages); that message should also be customized
    # like this script
-   exit 113
+   exit 114
 fi
 
-if [[ -f /opt/local/etc/ports/dp_version ]]; then
-   # message 18 in InstallationCheck.strings
-   exit 114
+if [[ -f __PREFIX__/etc/ports/dp_version ]]; then
+   # message 19 in InstallationCheck.strings
+   exit 115
 fi
 
 exit 0

Modified: branches/new-help-system/base/portmgr/dmg/InstallationCheck.strings
===================================================================
--- branches/new-help-system/base/portmgr/dmg/InstallationCheck.strings	2010-07-16 23:53:45 UTC (rev 69809)
+++ branches/new-help-system/base/portmgr/dmg/InstallationCheck.strings	2010-07-17 00:51:07 UTC (rev 69810)
@@ -1,3 +1,4 @@
 "16" = "Either uname or sed could not be found in PATH. Your system appears to be incomplete or misconfigured.";
-"17" = "This package is meant to be installed on Mac OS X __XVERS__.";
-"18" = "Your existing MacPorts or DarwinPorts installation is too old to be upgraded by this installer. Please install MacPorts 1.7.1 first.";
+"17" = "Xcode is not installed, or was installed with UNIX Development (10.5+) or Command Line Support (10.4) deselected.";
+"18" = "This package is meant to be installed on Mac OS X __XVERS__.";
+"19" = "Your existing MacPorts or DarwinPorts installation is too old to be upgraded by this installer. Please install MacPorts 1.7.1 first.";

Modified: branches/new-help-system/base/portmgr/dmg/License.html
===================================================================
--- branches/new-help-system/base/portmgr/dmg/License.html	2010-07-16 23:53:45 UTC (rev 69809)
+++ branches/new-help-system/base/portmgr/dmg/License.html	2010-07-17 00:51:07 UTC (rev 69810)
@@ -15,7 +15,7 @@
 
     <body>
     
-        <p>Copyright (c) 2002 - 2003, Apple Computer, Inc.<br>Copyright (c) 2004 - 2009, The MacPorts Project.</p>
+        <p>Copyright (c) 2002 - 2003, Apple Computer, Inc.<br>Copyright (c) 2004 - 2010, The MacPorts Project.</p>
         <p>All rights reserved.</p>
         <p><br></p>
         

Modified: branches/new-help-system/base/portmgr/dmg/ReadMe.rtf
===================================================================
--- branches/new-help-system/base/portmgr/dmg/ReadMe.rtf	2010-07-16 23:53:45 UTC (rev 69809)
+++ branches/new-help-system/base/portmgr/dmg/ReadMe.rtf	2010-07-17 00:51:07 UTC (rev 69810)
@@ -26,7 +26,7 @@
 \pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural
 
 \f0\b0 \cf0 \
-The MacPorts installer copies MacPorts to the target directory /opt/local. If you wish to install to any path other than that, you must install MacPorts via its source code. See {\field{\*\fldinst{HYPERLINK "http://www.macports.org/install.php"}}{\fldrslt Installing MacPorts}} on the MacPorts webpage for instructions on installation alternatives.\
+The MacPorts installer copies MacPorts to the target directory __PREFIX__. If you wish to install to any path other than that, you must install MacPorts via its source code. See {\field{\*\fldinst{HYPERLINK "http://www.macports.org/install.php"}}{\fldrslt Installing MacPorts}} on the MacPorts webpage for instructions on installation alternatives.\
 \pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural
 
 \f1\b \cf0 \
@@ -35,7 +35,7 @@
 \pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural
 
 \f0\b0 \cf0 \
-Aside from a few MacPorts executable commands in /opt/local/bin, most MacPorts files are installed in /opt/local/var/macports. Within these directories you will find a "sources" directory containing the Portfiles that hold the necessary instructions to install individual ports, and also the source code for MacPorts itself. Both are kept up to date by using the 
+Aside from a few MacPorts executable commands in __PREFIX__/bin, most MacPorts files are installed in __PREFIX__/var/macports. Within these directories you will find a "sources" directory containing the Portfiles that hold the necessary instructions to install individual ports, and also the source code for MacPorts itself. Both are kept up to date by using the 
 \f2\i port selfupdate
 \f0\i0  command as shown below. Please read the port(1) man page for more information.\
 \pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural
@@ -45,7 +45,7 @@
 Shell Environment:
 \f0\b0 \
 \
-A file named ~/.profile is created for the "bash" shell (default on Mac OS X 10.3 and newer) during the MacPorts installation. It contains the necessary statements to append MacPorts' binary paths within /opt/local/ to your shell environment, so MacPorts is available to you on subsequent terminal sessions. You may have to quit and restart your terminal application for this change to take effect.\
+A file named ~/.profile is created for the "bash" shell (default on Mac OS X 10.3 and newer) during the MacPorts installation. It contains the necessary statements to append MacPorts' binary paths within __PREFIX__/ to your shell environment, so MacPorts is available to you on subsequent terminal sessions. You may have to quit and restart your terminal application for this change to take effect.\
 \
 
 \f1\b \
@@ -123,4 +123,4 @@
 \f0\b0 \cf0 If you are interested in developing your own ports for private usage, or would like to submit your ports for inclusion within the MacPorts software repository, please consult the documentation provided on our website. The MacPorts project depends on a community of active participants and we are always open to welcoming new volunteers and their contributions!\
 \
 Thank you for your interest in MacPorts!\
-}
\ No newline at end of file
+}

Modified: branches/new-help-system/base/portmgr/dmg/postflight
===================================================================
--- branches/new-help-system/base/portmgr/dmg/postflight	2010-07-16 23:53:45 UTC (rev 69809)
+++ branches/new-help-system/base/portmgr/dmg/postflight	2010-07-17 00:51:07 UTC (rev 69810)
@@ -35,10 +35,10 @@
 #set -x
 
 # Script identification ('cause more often than not the svn Id is not expanded):
-VERSION=1.8.0
+VERSION=1.9.0
 
 # Abstraction variables:
-PREFIX=/opt/local
+PREFIX=__PREFIX__
 BINPATH=${PREFIX}/bin
 SBINPATH=${PREFIX}/sbin
 CONFIGPATH=${PREFIX}/etc/macports
@@ -55,6 +55,7 @@
 function setup_configs {
     for f in macports.conf sources.conf variants.conf ; do
         if [ ! -f ${CONFIGPATH}/${f} ]; then
+            echo "Copying ${f}.default to ${f}"
             /bin/cp ${CONFIGPATH}/${f}.default ${CONFIGPATH}/${f}
             /bin/chmod 644 ${CONFIGPATH}/${f}
         fi
@@ -119,7 +120,7 @@
 # link macports1.0 into tcl package dir if possible
 function link_tcl_package {
     # delete old directory if present
-    if test -d "${TCL_PACKAGE_DIR}/macports1.0"; then
+    if ! test -L "${TCL_PACKAGE_DIR}/macports1.0" && test -d "${TCL_PACKAGE_DIR}/macports1.0"; then
         rm -vrf "${TCL_PACKAGE_DIR}/macports1.0" || true
     fi
     if ! test -e "${TCL_PACKAGE_DIR}/macports1.0" && test -w "${TCL_PACKAGE_DIR}"; then

Deleted: branches/new-help-system/base/portmgr/jobs/PortIndexRegen.sh
===================================================================
--- branches/new-help-system/base/portmgr/jobs/PortIndexRegen.sh	2010-07-16 23:53:45 UTC (rev 69809)
+++ branches/new-help-system/base/portmgr/jobs/PortIndexRegen.sh	2010-07-17 00:51:07 UTC (rev 69810)
@@ -1,121 +0,0 @@
-#!/bin/bash
-
-####
-# PortIndex regen automation script.
-# Created by Juan Manuel Palacios,
-# e-mail: jmpp at macports.org
-# Updated by Paul Guyot, <pguyot at kallisys.net>
-# Updated for svn by Daniel J. Luke <dluke at geeklair.net>
-# $Id$
-####
-
-# Configuration
-LOCKFILE=/tmp/.mp_svn_index_regen.lock
-# ROOT directory, where everything is. This needs to exist!
-ROOT=/Users/mp-user/mp_svn_index_regen
-# MP user.
-MP_USER=mp-user
-# MP group.
-MP_GROUP=mp-user
-# e-mail address to spam in case of failure.
-#SPAM_LOVERS=example at hostname.com
-
-# Other settings (probably don't need to be changed).
-SVN_CONFIG_DIR=${ROOT}/svnconfig
-REPO_BASE=http://svn.macports.org/repository/macports
-SVN="/opt/local/bin/svn -q --non-interactive --config-dir $SVN_CONFIG_DIR"
-# Where to checkout the source code. This needs to exist!
-SRCTREE=${ROOT}/source
-# Where MP will install its world. This gets created.
-PREFIX=${ROOT}/opt/local
-# Where MP installs macports1.0. This gets created.
-TCLPKG=${PREFIX}/lib/tcl
-# Path.
-PATH=${PREFIX}/bin:/bin:/usr/bin:/usr/sbin:/opt/local/bin:/usr/X11/bin
-# Log for the e-mail in case of failure.
-FAILURE_LOG=${ROOT}/failure.log
-# Commit message.
-COMMIT_MSG=${ROOT}/commit.msg
-# The date.
-DATE=$(date +'%A %Y-%m-%d at %H:%M:%S')
-
-
-# Function to spam people in charge if something goes wrong during indexing.
-bail () {
-    mail -s "PortIndex Regen failure on ${DATE}" $SPAM_LOVERS < $FAILURE_LOG
-    cleanup; exit 1
-}
-
-# Cleanup function for runtime files.
-cleanup () {
-    rm -f $COMMIT_MSG $FAILURE_LOG
-    rm -f $LOCKFILE
-}
-
-
-if [ ! -e $LOCKFILE ]; then
-    touch $LOCKFILE
-else
-    echo "PortIndex Regen lockfile found, is another regen job running?" > $FAILURE_LOG; bail
-fi
-
-# Checkout/update the ports tree
-if [ -d ${SRCTREE}/dports ]; then
-    $SVN update ${SRCTREE}/dports > $FAILURE_LOG 2>&1 \
-	|| { echo "Updating the ports tree from $REPO_BASE/trunk/dports failed." >> $FAILURE_LOG; bail ; }
-else
-    $SVN checkout ${REPO_BASE}/trunk/dports ${SRCTREE}/dports > $FAILURE_LOG 2>&1 \
-	|| { echo "Checking out the ports tree from $REPO_BASE/trunk/dports failed." >> $FAILURE_LOG ; bail ; }
-fi
-echo `date -u +%s` > ${ROOT}/PORTS-TIMESTAMP
-
-# Checkout/update HEAD
-TMPDIR=mp_trunk/base
-if [ -d ${ROOT}/${TMPDIR} ]; then
-    $SVN update ${ROOT}/${TMPDIR} > $FAILURE_LOG 2>&1 \
-	|| { echo "Updating the trunk from $REPO_BASE/trunk/base failed." >> $FAILURE_LOG; bail ; }
-else
-    $SVN checkout ${REPO_BASE}/trunk/base ${ROOT}/${TMPDIR} > $FAILURE_LOG 2>&1 \
-       || { echo "Checking out the trunk from $REPO_BASE/trunk/base failed." >> $FAILURE_LOG ; bail ; }
-fi
-
-echo `date -u +%s` > ${ROOT}/BASE-TIMESTAMP
-
-# (re)configure.
-cd ${ROOT}/${TMPDIR} && \
-    mkdir -p ${TCLPKG} && \
-    ./configure \
-    --prefix=${PREFIX} \
-    --with-tclpackage=${TCLPKG} \
-    --with-install-user=${MP_USER} \
-    --with-install-group=${MP_GROUP} > $FAILURE_LOG 2>&1 \
-    || { echo "./configure script failed." >> $FAILURE_LOG ; bail ; }
-
-# clean
-# (cleaning is useful because we don't want the indexing to fail because dependencies aren't properly computed).
-{ cd ${ROOT}/${TMPDIR} && make clean > $FAILURE_LOG 2>&1 ; } \
-    || { echo "make clean failed." >> $FAILURE_LOG ; bail ; }
-
-# (re)build
-{ cd ${ROOT}/${TMPDIR} && make > $FAILURE_LOG 2>&1 ; } \
-    || { echo "make failed." >> $FAILURE_LOG ; bail ; }
-
-# (re)install
-{ cd ${ROOT}/${TMPDIR} && make install > $FAILURE_LOG 2>&1 ; } \
-    || { echo "make install failed." >> $FAILURE_LOG ; bail ; }
-
-# (re)index
-{ cd ${SRCTREE}/dports/ && ${PREFIX}/bin/portindex > $FAILURE_LOG 2>&1 ; } \
-    || { echo "portindex failed." >> $FAILURE_LOG ; bail ; }
-
-# Commit the new index using the last 5 lines of the log for the commit message,
-tail -n 5 $FAILURE_LOG > $COMMIT_MSG
-# plus parsing failures, if any.
-echo "" >> $COMMIT_MSG
-grep Failed $FAILURE_LOG >> $COMMIT_MSG
-{ cd ${SRCTREE}/dports/ && \
-    $SVN --config-dir $SVN_CONFIG_DIR commit -F $COMMIT_MSG PortIndex PortIndex.quick > $FAILURE_LOG 2>&1 ; } \
-    || { echo "SVN commit failed." >> $FAILURE_LOG ; bail ; }
-
-# At this point the index was committed successfuly, so we cleanup before we exit.
-cleanup && exit 0

Modified: branches/new-help-system/base/portmgr/jobs/README
===================================================================
--- branches/new-help-system/base/portmgr/jobs/README	2010-07-16 23:53:45 UTC (rev 69809)
+++ branches/new-help-system/base/portmgr/jobs/README	2010-07-17 00:51:07 UTC (rev 69810)
@@ -4,13 +4,9 @@
 
  1) mprsyncup:
     Runs on Mac OS Forge servers every 30 minutes, on the hour and on the half hour, off launchd through the org.macports.mprsyncup.plist provided.
-    Repopulates the rsync modules that feed the "sync" and "selfupdate" operations for both the ports tree and MacPorts sources, freshly off the svn
-    sources.
+    Repopulates the rsync modules that feed the "sync" and "selfupdate" operations for both the ports tree and MacPorts sources, freshly off the svn sources.
+    Updates the port indexes stored on the rsync server.
 
- 2) PortIndexRegen:
-    Still running on Daniel's box, twice a day every 12 hours off cron. Scheduled for a rewrite in Tcl to employ the macports1.0 API and thus simplify
-    some of its tasks. Once that's done it'll be moved to Mac OS Forge servers. This job regenerates the ports' index employed by operations like "port search".
-
  3) PortIndex2MySQL:
     Running Mac OS Forge servers twice a day every 12 hours off launchd through the org.macports.PortIndex2MySQL.plist provided, 15 minutes after the
     PortIndexRegen job. This jobs repopulates the database that feeds the www.macports.org/ports.php page off the regenerated PortIndex.
@@ -22,3 +18,4 @@
  5) Website:
     There's actually no script for this one, as the job itself is really simple: a post-commit svn hook attached to the /trunk/www dir
     updates the copy of our website on the Mac OS Forge web server whenever a commit to that directory occurs.
+

Modified: branches/new-help-system/base/portmgr/jobs/mprsyncup
===================================================================
--- branches/new-help-system/base/portmgr/jobs/mprsyncup	2010-07-16 23:53:45 UTC (rev 69809)
+++ branches/new-help-system/base/portmgr/jobs/mprsyncup	2010-07-17 00:51:07 UTC (rev 69810)
@@ -1,6 +1,4 @@
 #!/bin/sh
-
-
 ####
 # Script to checkout/update base sources from both trunk (ToT) and the current
 # release tag (as determined by the base/config/RELEASE_URL file) and a ports
@@ -30,24 +28,39 @@
 # $Id$
 ####
 
-
 set -e
+set -x
 
 # Commands we need:
 SVN="/opt/local/bin/svn -q --non-interactive"
 CLEANUP="/opt/local/bin/svn --non-interactive cleanup"
-RSYNC="/usr/bin/rsync -q"
+RSYNC="/opt/local/bin/rsync -q"
 RM="/bin/rm"
 MKDIR="/bin/mkdir"
 LN="/bin/ln"
 
 # Paths we'll work on:
+ROOT=/var/tmp/macports
+TMPDIR=mp_trunk/base
+PREFIX=${ROOT}/opt/local
+TCLPKG=${PREFIX}/lib/tcl
 SVNROOT=/var/tmp/macports
 TBASE=${SVNROOT}/trunk/base
 RBASE=${SVNROOT}/release/base
 PORTS=${SVNROOT}/release/ports
-RSYNCROOT=/Volumes/data/rsync/macports
+RSYNCROOT=/rsync/macports
+PORTINDEX=${PREFIX}/bin/portindex
 
+PATH=${PREFIX}/bin:/bin:/usr/bin:/usr/sbin:/opt/local/bin
+
+# platforms we generate indexes for
+PLATFORMS="8_ppc 8_i386 9_ppc 9_i386 10_i386"
+# copy new index of this platform to old index location for MP v1.8 compatability
+OLD_INDEX_PLATFORM="9_i386"
+
+MP_USER=nobody
+MP_GROUP=nobody
+
 # Sources information:
 SVNURL=http://svn.macports.org/repository/macports
 RELEASE_URL_FILE=config/RELEASE_URL
@@ -64,18 +77,11 @@
     ${SVN} checkout ${SVNURL}/trunk/base ${TBASE}
 fi
 
-# Delete old exports if they exist
-if [ -d ${TBASE}-export ]; then
-    $RM -rf ${TBASE}-export;
-fi
-${SVN} export ${TBASE} ${TBASE}-export
-
 if [ ! -d ${RSYNCROOT}/trunk/base ]; then
     ${MKDIR} -p ${RSYNCROOT}/trunk
 fi
-${RSYNC} -a -I --delete ${TBASE}-export/ ${RSYNCROOT}/trunk/base && ${RM} -rf ${TBASE}-export
+${RSYNC} -aIC --delete ${TBASE}/ ${RSYNCROOT}/trunk/base
 
-
 # Read what tag we're releasing from, switch to/checkout a copy, export and rsync it to ${RSYNCROOT}/release/base:
 read RELEASE_URL < ${TBASE}/${RELEASE_URL_FILE}
 if [ ! -n ${RELEASE_URL} ]; then
@@ -88,16 +94,10 @@
     ${SVN} checkout ${RELEASE_URL} ${RBASE}
 fi
 
-# Delete old exports if they exist
-if [ -d ${RBASE}-export ]; then
-    $RM -rf ${RBASE}-export;
-fi
-${SVN} export ${RBASE} ${RBASE}-export
-
 if [ ! -d ${RSYNCROOT}/release/base ]; then
     ${MKDIR} -p ${RSYNCROOT}/release/base
 fi
-${RSYNC} -a -I --delete ${RBASE}-export/ ${RSYNCROOT}/release/base && ${RM} -rf ${RBASE}-export
+${RSYNC} -aIC --delete ${RBASE}/ ${RSYNCROOT}/release/base 
 
 # clean up the working copy if it is locked
 if [ -f ${PORTS}/.svn/lock ]; then
@@ -111,26 +111,36 @@
     ${SVN} checkout ${SVNURL}/trunk/dports ${PORTS}
 fi
 
-# Delete old exports if they exist
-if [ -d ${PORTS}-export ]; then
-    $RM -rf ${PORTS}-export;
-fi
-${SVN} export ${PORTS} ${PORTS}-export
+# generate platform-specific indexes
+pushd ${PORTS} >> /dev/null
+# build MP trunk in a private location for indexing
+pushd ${ROOT}/${TMPDIR} >> /dev/null
+mkdir -p ${TCLPKG} 
+./configure \
+    --prefix=${PREFIX} \
+    --with-tclpackage=${TCLPKG} \
+    --with-install-user=${MP_USER} \
+    --with-install-group=${MP_GROUP} 
+make clean 
+make
+make install 
+popd
 
+for PLATFORM in $PLATFORMS; do
+	$PORTINDEX -p darwin_${PLATFORM} -o PortIndex_darwin_${PLATFORM};
+done
+
+# support MP 1.8
+cp PortIndex_darwin_${OLD_INDEX_PLATFORM}/* ./
+popd
+
 if [ ! -d ${RSYNCROOT}/release/ports ]; then
     ${MKDIR} -p ${RSYNCROOT}/release/ports
 fi
-${RSYNC} -a -I --delete ${PORTS}-export/ ${RSYNCROOT}/release/ports && ${RM} -rf ${PORTS}-export
+${RSYNC} -aIC --delete ${PORTS}/ ${RSYNCROOT}/release/ports
 
-
-# Compatibility checks:
+# symlink trunk ports to release ports since we only have 1 set of ports
 cd ${RSYNCROOT}
-if [ ! -h dpupdate ]; then
-    ${RM} -rf dpupdate && ${LN} -s trunk dpupdate
-fi
-if [ ! -h dpupdate1 ]; then
-    ${RM} -rf dpupdate1 && ${LN} -s release dpupdate1
-fi
 if [ ! -h trunk/dports ]; then
     cd trunk
     ${RM} -rf dports && ${LN} -s ../release/ports dports

Deleted: branches/new-help-system/base/portmgr/jobs/org.macports.PortIndexRegen.plist
===================================================================
Modified: branches/new-help-system/base/portmgr/packaging/dpkgall.tcl
===================================================================
--- branches/new-help-system/base/portmgr/packaging/dpkgall.tcl	2010-07-16 23:53:45 UTC (rev 69809)
+++ branches/new-help-system/base/portmgr/packaging/dpkgall.tcl	2010-07-17 00:51:07 UTC (rev 69810)
@@ -690,7 +690,7 @@
 	set variations ""
 
 	foreach port [get_required_ports] {
-		if {[catch {do_portexec $port [array get options] [array get variants] install} result]} {
+		if {[catch {do_portexec $port [array get options] [array get variants] activate} result]} {
 			global errorInfo
 			ui_debug "$errorInfo"
 			ui_noisy_error "Fatal error: $result"
@@ -745,7 +745,7 @@
 		exit 1
 	}
 
-	if {[catch {set result [mportexec $workername install]} result] || $result == 1} {
+	if {[catch {set result [mportexec $workername $target]} result] || $result == 1} {
 
 		# Close the port
 		mportclose $workername

Modified: branches/new-help-system/base/portmgr/packaging/rpmall.tcl
===================================================================
--- branches/new-help-system/base/portmgr/packaging/rpmall.tcl	2010-07-16 23:53:45 UTC (rev 69809)
+++ branches/new-help-system/base/portmgr/packaging/rpmall.tcl	2010-07-17 00:51:07 UTC (rev 69810)
@@ -457,7 +457,7 @@
 				ui_error "Internal error: unable to install ${prebuild}... exiting"
 				exit 1
 			}
-			if {[catch {set result [mportexec $workername install]} result] ||
+			if {[catch {set result [mportexec $workername activate]} result] ||
 				$result == 1} {
 				global errorInfo
 				ui_debug "$errorInfo"

Modified: branches/new-help-system/base/src/cregistry/entry.c
===================================================================
--- branches/new-help-system/base/src/cregistry/entry.c	2010-07-16 23:53:45 UTC (rev 69809)
+++ branches/new-help-system/base/src/cregistry/entry.c	2010-07-17 00:51:07 UTC (rev 69810)
@@ -78,10 +78,10 @@
  * @param [in,out] dst_space number of characters `dst` can hold
  * @param [in] src           string to concatenate to `dst`
  */
-static int reg_strcat(char** dst, int* dst_len, int* dst_space, char* src) {
-    int src_len = strlen(src);
-    int result_len = *dst_len + src_len;
-    if (result_len >= *dst_space) {
+static int reg_strcat(char** dst, size_t* dst_len, size_t* dst_space, char* src) {
+    size_t src_len = strlen(src);
+    size_t result_len = *dst_len + src_len;
+    if (result_len > *dst_space) {
         char* new_dst;
         *dst_space *= 2;
         if (*dst_space < result_len) {
@@ -197,7 +197,7 @@
  */
 reg_entry* reg_entry_create(reg_registry* reg, char* name, char* version,
         char* revision, char* variants, char* epoch, reg_error* errPtr) {
-    sqlite3_stmt* stmt;
+    sqlite3_stmt* stmt = NULL;
     reg_entry* entry = NULL;
     char* query = "INSERT INTO registry.ports "
         "(name, version, revision, variants, epoch) VALUES (?, ?, ?, ?, ?)";
@@ -239,7 +239,9 @@
     } else {
         reg_sqlite_error(reg->db, errPtr, query);
     }
-    sqlite3_finalize(stmt);
+    if (stmt) {
+        sqlite3_finalize(stmt);
+    }
     return entry;
 }
 
@@ -257,7 +259,7 @@
  */
 reg_entry* reg_entry_open(reg_registry* reg, char* name, char* version,
         char* revision, char* variants, char* epoch, reg_error* errPtr) {
-    sqlite3_stmt* stmt;
+    sqlite3_stmt* stmt = NULL;
     reg_entry* entry = NULL;
     char* query = "SELECT id FROM registry.ports WHERE name=? AND version=? "
         "AND revision=? AND variants=? AND epoch=?";
@@ -296,7 +298,9 @@
     } else {
         reg_sqlite_error(reg->db, errPtr, query);
     }
-    sqlite3_finalize(stmt);
+    if (stmt) {
+        sqlite3_finalize(stmt);
+    }
     return entry;
 }
 
@@ -312,9 +316,9 @@
 int reg_entry_delete(reg_entry* entry, reg_error* errPtr) {
     reg_registry* reg = entry->reg;
     int result = 0;
-    sqlite3_stmt* ports;
-    sqlite3_stmt* files;
-    sqlite3_stmt* dependencies;
+    sqlite3_stmt* ports = NULL;
+    sqlite3_stmt* files = NULL;
+    sqlite3_stmt* dependencies = NULL;
     char* ports_query = "DELETE FROM registry.ports WHERE id=?";
     char* files_query = "DELETE FROM registry.files WHERE id=?";
     char* dependencies_query = "DELETE FROM registry.dependencies WHERE id=?";
@@ -375,9 +379,15 @@
     } else {
         reg_sqlite_error(reg->db, errPtr, NULL);
     }
-    sqlite3_finalize(ports);
-    sqlite3_finalize(files);
-    sqlite3_finalize(dependencies);
+    if (ports) {
+        sqlite3_finalize(ports);
+    }
+    if (files) {
+        sqlite3_finalize(files);
+    }
+    if (dependencies) {
+        sqlite3_finalize(dependencies);
+    }
     return result;
 }
 
@@ -417,7 +427,7 @@
     void** results = malloc(10*sizeof(void*));
     int result_count = 0;
     int result_space = 10;
-    sqlite3_stmt* stmt;
+    sqlite3_stmt* stmt = NULL;
     if (!results) {
         return -1;
     }
@@ -455,7 +465,9 @@
             }
         }
     } else {
-        sqlite3_finalize(stmt);
+        if (stmt) {
+            sqlite3_finalize(stmt);
+        }
         reg_sqlite_error(reg->db, errPtr, query);
     }
     free(results);
@@ -499,8 +511,7 @@
     int i;
     char* kwd = " WHERE ";
     char* query;
-    int query_len = 29;
-    int query_space = 29;
+    size_t query_len, query_space;
     int result;
     /* get the strategy */
     char* op = reg_strategy_op(strategy, errPtr);
@@ -512,6 +523,7 @@
     if (!query) {
         return -1;
     }
+    query_len = query_space = strlen(query);
     for (i=0; i<key_count; i++) {
         char* cond = sqlite3_mprintf(op, keys[i], vals[i]);
         if (!cond || !reg_strcat(&query, &query_len, &query_space, kwd)
@@ -523,7 +535,7 @@
         kwd = " AND ";
     }
     /* do the query */
-    result = reg_all_entries(reg, query, query_len, entries, errPtr);
+    result = reg_all_entries(reg, query, -1, entries, errPtr);
     free(query);
     return result;
 }
@@ -619,7 +631,7 @@
 int reg_entry_owner(reg_registry* reg, char* path, reg_entry** entry,
         reg_error* errPtr) {
     int result = 0;
-    sqlite3_stmt* stmt;
+    sqlite3_stmt* stmt = NULL;
     char* query = "SELECT id FROM registry.files WHERE actual_path=? AND active";
     if ((sqlite3_prepare(reg->db, query, -1, &stmt, NULL) == SQLITE_OK)
             && (sqlite3_bind_text(stmt, 1, path, -1, SQLITE_STATIC)
@@ -646,7 +658,9 @@
     } else {
         reg_sqlite_error(reg->db, errPtr, query);
     }
-    sqlite3_finalize(stmt);
+    if (stmt) {
+        sqlite3_finalize(stmt);
+    }
     return result;
 }
 
@@ -663,7 +677,7 @@
  * @return          id of owner, or 0 for none
  */
 sqlite_int64 reg_entry_owner_id(reg_registry* reg, char* path) {
-    sqlite3_stmt* stmt;
+    sqlite3_stmt* stmt = NULL;
     sqlite_int64 result = 0;
     char* query = "SELECT id FROM registry.files WHERE actual_path=? AND active";
     if ((sqlite3_prepare(reg->db, query, -1, &stmt, NULL) == SQLITE_OK)
@@ -677,7 +691,9 @@
             }
         } while (r == SQLITE_BUSY);
     }
-    sqlite3_finalize(stmt);
+    if (stmt) {
+        sqlite3_finalize(stmt);
+    }
     return result;
 }
 
@@ -696,7 +712,7 @@
         reg_error* errPtr) {
     reg_registry* reg = entry->reg;
     int result = 0;
-    sqlite3_stmt* stmt;
+    sqlite3_stmt* stmt = NULL;
     char* query;
     const char *text;
     query = sqlite3_mprintf("SELECT %q FROM registry.ports WHERE id=%lld", key,
@@ -730,7 +746,9 @@
     } else {
         reg_sqlite_error(reg->db, errPtr, query);
     }
-    sqlite3_finalize(stmt);
+    if (stmt) {
+        sqlite3_finalize(stmt);
+    }
     sqlite3_free(query);
     return result;
 }
@@ -753,7 +771,7 @@
         reg_error* errPtr) {
     reg_registry* reg = entry->reg;
     int result = 0;
-    sqlite3_stmt* stmt;
+    sqlite3_stmt* stmt = NULL;
     char* query;
     query = sqlite3_mprintf("UPDATE registry.ports SET %q = '%q' WHERE id=%lld",
             key, value, entry->id);
@@ -781,7 +799,9 @@
     } else {
         reg_sqlite_error(reg->db, errPtr, query);
     }
-    sqlite3_finalize(stmt);
+    if (stmt) {
+        sqlite3_finalize(stmt);
+    }
     sqlite3_free(query);
     return result;
 }
@@ -800,7 +820,7 @@
         reg_error* errPtr) {
     reg_registry* reg = entry->reg;
     int result = 1;
-    sqlite3_stmt* stmt;
+    sqlite3_stmt* stmt = NULL;
     char* insert = "INSERT INTO registry.files (id, path, mtime, active) "
         "VALUES (?, ?, 0, 0)";
     if ((sqlite3_prepare(reg->db, insert, -1, &stmt, NULL) == SQLITE_OK)
@@ -833,7 +853,9 @@
         reg_sqlite_error(reg->db, errPtr, insert);
         result = 0;
     }
-    sqlite3_finalize(stmt);
+    if (stmt) {
+        sqlite3_finalize(stmt);
+    }
     return result;
 }
 
@@ -851,7 +873,7 @@
         reg_error* errPtr) {
     reg_registry* reg = entry->reg;
     int result = 1;
-    sqlite3_stmt* stmt;
+    sqlite3_stmt* stmt = NULL;
     char* query = "DELETE FROM registry.files WHERE path=? AND id=?";
     if ((sqlite3_prepare(reg->db, query, -1, &stmt, NULL) == SQLITE_OK)
             && (sqlite3_bind_int64(stmt, 2, entry->id) == SQLITE_OK)) {
@@ -889,7 +911,9 @@
         reg_sqlite_error(reg->db, errPtr, query);
         result = 0;
     }
-    sqlite3_finalize(stmt);
+    if (stmt) {
+        sqlite3_finalize(stmt);
+    }
     return result;
 }
 
@@ -906,7 +930,7 @@
  */
 int reg_entry_imagefiles(reg_entry* entry, char*** files, reg_error* errPtr) {
     reg_registry* reg = entry->reg;
-    sqlite3_stmt* stmt;
+    sqlite3_stmt* stmt = NULL;
     char* query = "SELECT path FROM registry.files WHERE id=? ORDER BY path";
     if ((sqlite3_prepare(reg->db, query, -1, &stmt, NULL) == SQLITE_OK)
             && (sqlite3_bind_int64(stmt, 1, entry->id) == SQLITE_OK)) {
@@ -953,7 +977,9 @@
         }
     } else {
         reg_sqlite_error(reg->db, errPtr, query);
-        sqlite3_finalize(stmt);
+        if (stmt) {
+            sqlite3_finalize(stmt);
+        }
         return -1;
     }
 }
@@ -971,7 +997,7 @@
  */
 int reg_entry_files(reg_entry* entry, char*** files, reg_error* errPtr) {
     reg_registry* reg = entry->reg;
-    sqlite3_stmt* stmt;
+    sqlite3_stmt* stmt = NULL;
     char* query = "SELECT actual_path FROM registry.files WHERE id=? "
         "AND active ORDER BY actual_path";
     if ((sqlite3_prepare(reg->db, query, -1, &stmt, NULL) == SQLITE_OK)
@@ -1019,7 +1045,9 @@
         }
     } else {
         reg_sqlite_error(reg->db, errPtr, query);
-        sqlite3_finalize(stmt);
+        if (stmt) {
+            sqlite3_finalize(stmt);
+        }
         return -1;
     }
 }
@@ -1043,8 +1071,8 @@
     reg_registry* reg = entry->reg;
     int result = 1;
     int i;
-    sqlite3_stmt* select;
-    sqlite3_stmt* update;
+    sqlite3_stmt* select = NULL;
+    sqlite3_stmt* update = NULL;
     char* select_query = "SELECT id FROM registry.files WHERE actual_path=? "
         "AND active";
     char* update_query = "UPDATE registry.files SET actual_path=?, active=1 "
@@ -1060,7 +1088,7 @@
                 == SQLITE_OK)
                 && (sqlite3_bind_int64(update, 3, entry->id) == SQLITE_OK)) {
             for (i=0; i<file_count && result; i++) {
-                if ((sqlite3_bind_text(select, 1, files[i], -1, SQLITE_STATIC)
+                if ((sqlite3_bind_text(select, 1, as_files[i], -1, SQLITE_STATIC)
                             == SQLITE_OK)
                         && (sqlite3_bind_text(update, 1, as_files[i], -1,
                                 SQLITE_STATIC) == SQLITE_OK)
@@ -1117,12 +1145,16 @@
             reg_sqlite_error(reg->db, errPtr, update_query);
             result = 0;
         }
-        sqlite3_finalize(update);
+        if (update) {
+            sqlite3_finalize(update);
+        }
     } else {
         reg_sqlite_error(reg->db, errPtr, select_query);
         result = 0;
     }
-    sqlite3_finalize(select);
+    if (select) {
+        sqlite3_finalize(select);
+    }
     return result;
 }
 
@@ -1141,7 +1173,7 @@
     reg_registry* reg = entry->reg;
     int result = 1;
     int i;
-    sqlite3_stmt* stmt;
+    sqlite3_stmt* stmt = NULL;
     char* query = "UPDATE registry.files SET active=0 WHERE actual_path=? AND id=?";
     if ((sqlite3_prepare(reg->db, query, -1, &stmt, NULL) == SQLITE_OK)
             && (sqlite3_bind_int64(stmt, 2, entry->id) == SQLITE_OK)) {
@@ -1178,7 +1210,9 @@
         reg_sqlite_error(reg->db, errPtr, query);
         result = 0;
     }
-    sqlite3_finalize(stmt);
+    if (stmt) {
+        sqlite3_finalize(stmt);
+    }
     return result;
 }
 
@@ -1240,7 +1274,7 @@
 int reg_entry_depends(reg_entry* entry, char* name, reg_error* errPtr) {
     reg_registry* reg = entry->reg;
     int result = 0;
-    sqlite3_stmt* stmt;
+    sqlite3_stmt* stmt = NULL;
     char* query = "INSERT INTO registry.dependencies (id, name) VALUES (?,?)";
     if ((sqlite3_prepare(reg->db, query, -1, &stmt, NULL) == SQLITE_OK)
             && (sqlite3_bind_int64(stmt, 1, entry->id) == SQLITE_OK)
@@ -1263,7 +1297,9 @@
     } else {
         reg_sqlite_error(reg->db, errPtr, query);
     }
-    sqlite3_finalize(stmt);
+    if (stmt) {
+        sqlite3_finalize(stmt);
+    }
     return result;
 }
 

Modified: branches/new-help-system/base/src/cregistry/registry.c
===================================================================
--- branches/new-help-system/base/src/cregistry/registry.c	2010-07-16 23:53:45 UTC (rev 69809)
+++ branches/new-help-system/base/src/cregistry/registry.c	2010-07-17 00:51:07 UTC (rev 69810)
@@ -194,7 +194,7 @@
         }
     }
     if (initialized || can_write) {
-        sqlite3_stmt* stmt;
+        sqlite3_stmt* stmt = NULL;
         char* query = sqlite3_mprintf("ATTACH DATABASE '%q' AS registry", path);
         if (sqlite3_prepare(reg->db, query, -1, &stmt, NULL) == SQLITE_OK) {
             int r;
@@ -220,7 +220,9 @@
         } else {
             reg_sqlite_error(reg->db, errPtr, query);
         }
-        sqlite3_finalize(stmt);
+        if (stmt) {
+            sqlite3_finalize(stmt);
+        }
         sqlite3_free(query);
     } else {
         reg_throw(errPtr, REG_CANNOT_INIT, "port registry doesn't exist at "
@@ -239,7 +241,7 @@
  * @return             true if success; false if failure
  */
 int reg_detach(reg_registry* reg, reg_error* errPtr) {
-    sqlite3_stmt* stmt;
+    sqlite3_stmt* stmt = NULL;
     int result = 0;
     char* query = "DETACH DATABASE registry";
     if (!(reg->status & reg_attached)) {
@@ -279,7 +281,9 @@
     } else {
         reg_sqlite_error(reg->db, errPtr, query);
     }
-    sqlite3_finalize(stmt);
+    if (stmt) {
+        sqlite3_finalize(stmt);
+    }
     return result;
 }
 

Modified: branches/new-help-system/base/src/cregistry/sql.c
===================================================================
--- branches/new-help-system/base/src/cregistry/sql.c	2010-07-16 23:53:45 UTC (rev 69809)
+++ branches/new-help-system/base/src/cregistry/sql.c	2010-07-17 00:51:07 UTC (rev 69810)
@@ -51,11 +51,13 @@
 int do_queries(sqlite3* db, char** queries, reg_error* errPtr) {
     char** query;
     for (query = queries; *query != NULL; query++) {
-        sqlite3_stmt* stmt;
+        sqlite3_stmt* stmt = NULL;
         if ((sqlite3_prepare(db, *query, -1, &stmt, NULL) != SQLITE_OK)
                 || (sqlite3_step(stmt) != SQLITE_DONE)) {
             reg_sqlite_error(db, errPtr, *query);
-            sqlite3_finalize(stmt);
+            if (stmt) {
+                sqlite3_finalize(stmt);
+            }
             return 0;
         }
         sqlite3_finalize(stmt);
@@ -155,17 +157,18 @@
  * @return             true if success; false if failure
  */
 int init_db(sqlite3* db, reg_error* errPtr) {
+    /* no code that uses these tables is being built at this time */
     static char* queries[] = {
-        "BEGIN",
+        /*"BEGIN",*/
 
         /* items cache */
-        "CREATE TEMPORARY TABLE items (refcount, proc UNIQUE, name, url, path, "
-            "worker, options, variants)",
+        /*"CREATE TEMPORARY TABLE items (refcount, proc UNIQUE, name, url, path, "
+            "worker, options, variants)",*/
 
         /* indexes list */
-        "CREATE TEMPORARY TABLE indexes (file, name, attached)",
+        /*"CREATE TEMPORARY TABLE indexes (file, name, attached)",
 
-        "COMMIT",
+        "COMMIT",*/
         NULL
     };
 

Modified: branches/new-help-system/base/src/darwintracelib1.0/darwintrace.c
===================================================================
--- branches/new-help-system/base/src/darwintracelib1.0/darwintrace.c	2010-07-16 23:53:45 UTC (rev 69809)
+++ branches/new-help-system/base/src/darwintracelib1.0/darwintrace.c	2010-07-17 00:51:07 UTC (rev 69810)
@@ -156,7 +156,16 @@
 #endif
 #else
 #if DARWINTRACE_DEBUG_OUTPUT
-#define dprintf(format, param) fprintf(stderr, format, param)
+__attribute__ ((format (printf, 1, 2)))
+static inline
+int dprintf(const char *format, ...) {
+    int ret;
+    va_list args;
+    va_start(args, format);
+    ret = vfprintf(stderr, format, args);
+    va_end(args);
+    return ret;
+}
 #else
 #define dprintf(format, param)
 #endif
@@ -344,7 +353,8 @@
 				__darwintrace_fd=sock;
 				ask_for_filemap();
 			} else {
-				dprintf("connect failed %d :-(\n", errno);
+				dprintf("connect failed: %s\n", strerror(errno));
+				abort();
 			}
 			errno = olderrno;
 		}
@@ -549,12 +559,14 @@
 		p=strdup(path);
 	else
 	{
-		p=(char*)malloc(BUFFER_SIZE);
-		(void) getcwd(p, BUFFER_SIZE-1);
-		_=p+strlen(p)+1;
-		if(_[-1]!='/')
-			*_++='/';
-		strncpy(_, path, BUFFER_SIZE-(_-p));
+		p=(char*)malloc(MAXPATHLEN);
+		if (getcwd(p, MAXPATHLEN-1) == NULL) {
+			fprintf(stderr, "darwintrace: getcwd: %s, path was: %s\n", strerror(errno), path);
+			abort();
+		}
+		if (p[strlen(p)-1] != '/')
+			strcat(p, "/");
+		strcat(p, path);
 	}
 	__darwintrace_cleanup_path(p);
 			

Modified: branches/new-help-system/base/src/macports1.0/Makefile
===================================================================
--- branches/new-help-system/base/src/macports1.0/Makefile	2010-07-16 23:53:45 UTC (rev 69809)
+++ branches/new-help-system/base/src/macports1.0/Makefile	2010-07-17 00:51:07 UTC (rev 69810)
@@ -13,6 +13,8 @@
 	LIBS+= -framework CoreFoundation -framework SystemConfiguration
 endif
 
+pkgIndex.tcl: $(SRCS)
+
 test::
 	${TCLSH} tests/macports_dlist.tcl
 	${TCLSH} tests/macports_util.tcl
@@ -28,8 +30,13 @@
 	done
 
 	$(INSTALL) -o ${DSTUSR} -g ${DSTGRP} -m 444 pkgIndex.tcl ${INSTALLDIR}
-	
+
 	echo "${TCL_PACKAGE_DIR}" > ${DESTDIR}${prefix}/var/macports/.tclpackage
-	if test -z "${DESTDIR}" && ! test -e "${INSTALLPKGLINK}" && test -w "${TCL_PACKAGE_DIR}"; then \
-		ln -s "${INSTALLDIR}" "${INSTALLPKGLINK}" || true; \
+	if test -z "${DESTDIR}" && test "${INSTALLPKGLINK}" != "${INSTALLDIR}" && test -w "${TCL_PACKAGE_DIR}"; then \
+		if ! test -L "${INSTALLPKGLINK}" && test -d "${INSTALLPKGLINK}"; then \
+			rm -rf "${INSTALLPKGLINK}" || true; \
+		fi; \
+		if ! test -e "${INSTALLPKGLINK}"; then \
+			ln -s "${INSTALLDIR}" "${INSTALLPKGLINK}" || true; \
+		fi; \
 	fi

Modified: branches/new-help-system/base/src/macports1.0/macports.tcl
===================================================================
--- branches/new-help-system/base/src/macports1.0/macports.tcl	2010-07-16 23:53:45 UTC (rev 69809)
+++ branches/new-help-system/base/src/macports1.0/macports.tcl	2010-07-17 00:51:07 UTC (rev 69810)
@@ -45,16 +45,17 @@
         porttrace portverbose keeplogs destroot_umask variants_conf rsync_server rsync_options \
         rsync_dir startupitem_type place_worksymlink xcodeversion xcodebuildcmd \
         mp_remote_url mp_remote_submit_url configureccache configuredistcc configurepipe buildnicevalue buildmakejobs \
-        applications_dir frameworks_dir developer_dir universal_archs build_arch \
+        applications_dir frameworks_dir developer_dir universal_archs build_arch macosx_deployment_target \
         macportsuser proxy_override_env proxy_http proxy_https proxy_ftp proxy_rsync proxy_skip"
     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.installtype portarchivemode portarchivepath \
-        portarchivetype portautoclean porttrace keeplogs portverbose destroot_umask rsync_server \
-        rsync_options rsync_dir startupitem_type place_worksymlink macportsuser \
+        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 configuredistcc configurepipe buildnicevalue buildmakejobs \
-        applications_dir current_phase frameworks_dir developer_dir universal_archs build_arch $user_options"
+        applications_dir current_phase frameworks_dir developer_dir universal_archs build_arch \
+        os_arch os_endian os_version os_major os_platform macosx_version macosx_deployment_target $user_options"
 
     # deferred options are only computed when needed.
     # they are not exported to the trace thread.
@@ -63,7 +64,7 @@
 
     variable open_mports {}
 
-    variable ui_priorities "error warn msg info debug any"
+    variable ui_priorities "error warn msg notice info debug any"
     variable port_phases "any fetch checksum"
     variable current_phase "main"
 }
@@ -112,7 +113,7 @@
     global macports::channels macports::portdbpath
 
     if {[getuid] == 0 && [geteuid] != 0} {
-        seteuid 0
+        seteuid 0; setegid 0
     }
     if {[catch {macports::ch_logging $mport} err]} {
         ui_debug "Logging disabled, error opening log file: $err"
@@ -154,6 +155,9 @@
         }
     }
     if {$::logenabled} {
+        if {[getuid] == 0 && [geteuid] != 0} {
+            seteuid 0; setegid 0
+        }
         if {[catch {macports::ch_logging $mport} err]} {
             ui_debug "Logging disabled, error opening log file: $err"
             return
@@ -282,13 +286,16 @@
                 return {}
             }
         }
-        msg {
+        notice {
             if {[ui_isset ports_quiet]} {
                 return {}
             } else {
                 return {stdout}
             }
         }
+        msg {
+            return {stdout}
+        }
         warn -
         error {
             return {stderr}
@@ -355,33 +362,40 @@
 
     if {[catch {set xcodebuild [binaryInPath "xcodebuild"]}] == 0} {
         if {![info exists xcodeversion]} {
-            # Determine xcode version (<= 2.0 or 2.1)
-            if {[catch {set xcodebuildversion [exec xcodebuild -version]}] == 0} {
-                if {[regexp "DevToolsCore-(.*); DevToolsSupport-(.*)" $xcodebuildversion devtoolscore_v devtoolssupport_v] == 1} {
-                    if {$devtoolscore_v >= 620.0 && $devtoolssupport_v >= 610.0} {
-                        # for now, we don't need to distinguish 2.1 from 2.1 or higher.
+            # Determine xcode version
+            set macports::xcodeversion "2.0orlower"
+            if {[catch {set xcodebuildversion [exec -- $xcodebuild -version 2> /dev/null]}] == 0} {
+                if {[regexp {Xcode ([0-9.]+)} $xcodebuildversion - xcode_v] == 1} {
+                    set macports::xcodeversion $xcode_v
+                } elseif {[regexp "DevToolsCore-(.*);" $xcodebuildversion - devtoolscore_v] == 1} {
+                    if {$devtoolscore_v >= 921.0} {
+                        set macports::xcodeversion "3.0"
+                    } elseif {$devtoolscore_v >= 798.0} {
+                        set macports::xcodeversion "2.5"
+                    } elseif {$devtoolscore_v >= 762.0} {
+                        set macports::xcodeversion "2.4.1"
+                    } elseif {$devtoolscore_v >= 757.0} {
+                        set macports::xcodeversion "2.4"
+                    } elseif {$devtoolscore_v > 650.0} {
+                        # XXX find actual version corresponding to 2.3
+                        set macports::xcodeversion "2.3"
+                    } elseif {$devtoolscore_v >= 650.0} {
+                        set macports::xcodeversion "2.2.1"
+                    } elseif {$devtoolscore_v > 620.0} {
+                        # XXX find actual version corresponding to 2.2
+                        set macports::xcodeversion "2.2"
+                    } elseif {$devtoolscore_v >= 620.0} {
                         set macports::xcodeversion "2.1"
-                    } else {
-                        set macports::xcodeversion "2.0orlower"
                     }
-                } else {
-                    set macports::xcodeversion "2.0orlower"
                 }
             } else {
-                set macports::xcodeversion "2.0orlower"
+                ui_warn "xcodebuild exists but failed to execute"
+                set macports::xcodeversion "none"
             }
         }
-
         if {![info exists xcodebuildcmd]} {
-            set macports::xcodebuildcmd "xcodebuild"
+            set macports::xcodebuildcmd "$xcodebuild"
         }
-    } elseif {[catch {set pbxbuild [binaryInPath "pbxbuild"]}] == 0} {
-        if {![info exists xcodeversion]} {
-            set macports::xcodeversion "pb"
-        }
-        if {![info exists xcodebuildcmd]} {
-            set macports::xcodebuildcmd "pbxbuild"
-        }
     } else {
         if {![info exists xcodeversion]} {
             set macports::xcodeversion "none"
@@ -449,6 +463,14 @@
     global macports::buildmakejobs
     global macports::universal_archs
     global macports::build_arch
+    global macports::os_arch
+    global macports::os_endian
+    global macports::os_version
+    global macports::os_major
+    global macports::os_platform
+    global macports::macosx_version
+    global macports::macosx_deployment_target
+    global macports::archivefetch_pubkeys
 
     # Set the system encoding to utf-8
     encoding system utf-8
@@ -461,6 +483,21 @@
         set macports::macports_user_dir "/dev/null/NO_HOME_DIR"
     }
 
+    # set up platform info variables
+    set os_arch $tcl_platform(machine)
+    if {$os_arch == "Power Macintosh"} { set os_arch "powerpc" }
+    if {$os_arch == "i586" || $os_arch == "i686" || $os_arch == "x86_64"} { set os_arch "i386" }
+    set os_version $tcl_platform(osVersion)
+    set os_major [lindex [split $os_version .] 0]
+    set os_platform [string tolower $tcl_platform(os)]
+    # Remove trailing "Endian"
+    set os_endian [string range $tcl_platform(byteOrder) 0 end-6]
+    set macosx_version {}
+    if {$os_platform == "darwin"} {
+        # This will probably break when Apple changes versioning
+        set macosx_version [expr 10.0 + ($os_major - 4) / 10.0]
+    }
+
     # Configure the search path for configuration files
     set conf_files ""
     lappend conf_files "${macports_conf_path}/macports.conf"
@@ -572,6 +609,21 @@
     global macports::global_variations
     array set macports::global_variations [array get variations]
 
+    # pubkeys.conf
+    set macports::archivefetch_pubkeys {}
+    if {[file isfile [file join ${macports_conf_path} pubkeys.conf]]} {
+        set fd [open [file join ${macports_conf_path} pubkeys.conf] r]
+        while {[gets $fd line] >= 0} {
+            set line [string trim $line]
+            if {![regexp {^[\ \t]*#.*$|^$} $line]} {
+                lappend macports::archivefetch_pubkeys $line
+            }
+        }
+        close $fd
+    } else {
+        ui_debug "pubkeys.conf does not exist."
+    }
+
     if {![info exists portdbpath]} {
         return -code error "portdbpath must be set in ${macports_conf_path}/macports.conf or in your ${macports_user_dir}/macports.conf"
     }
@@ -595,7 +647,7 @@
             return -code error "unknown registry format '$portdbformat' set in macports.conf"
         }
     } else {
-        set registry.format receipt_flat
+        set registry.format receipt_sqlite
     }
 
     # Installation type, whether to use port "images" or install "direct"
@@ -661,19 +713,12 @@
         global macports::portarchivepath
     }
     if {$portarchivemode == "yes"} {
-        if {![file isdirectory $portarchivepath]} {
-            if {![file exists $portarchivepath]} {
-                if {![file owned $portdbpath]} {
-                    file lstat $portdbpath stat
-                    return -code error "insufficient privileges for portdbpath $portdbpath (uid $stat(uid)); cannot create portarchivepath"
-                } elseif {[catch {file mkdir $portarchivepath} result]} {
-                    return -code error "portarchivepath $portarchivepath does not exist and could not be created: $result"
-                }
-            }
+        if {![file exists $portarchivepath] && [catch {file mkdir $portarchivepath} result]} {
+            ui_warn "portarchivepath $portarchivepath does not exist and could not be created; disabling archive mode"
+            set portarchivemode no
+        } elseif {![file isdirectory $portarchivepath]} {
+            return -code error "Archive dir $portarchivepath is not a directory. Please create the directory or reconfigure portarchivepath"
         }
-        if {![file isdirectory $portarchivepath]} {
-            return -code error "$portarchivepath is not a directory. Please create the directory $portarchivepath and try again"
-        }
     }
 
     # Archive type, what type of binary archive to use (CPIO, gzipped
@@ -758,14 +803,9 @@
         set macports::macportsuser $macports::autoconf::macportsuser
     }
 
-    # Default Xcode Tools path
-    if {![info exists macports::developer_dir]} {
-        set macports::developer_dir "/Developer"
-    }
-
     # Default mp universal options
     if {![info exists macports::universal_archs]} {
-        if {[lindex [split $tcl_platform(osVersion) .] 0] >= 10} {
+        if {$os_major >= 10} {
             set macports::universal_archs {x86_64 i386}
         } else {
             set macports::universal_archs {i386 ppc}
@@ -776,15 +816,15 @@
     
     # Default arch to build for
     if {![info exists macports::build_arch]} {
-        if {$tcl_platform(os) == "Darwin"} {
-            if {[lindex [split $tcl_platform(osVersion) .] 0] >= 10} {
+        if {$os_platform == "darwin"} {
+            if {$os_major >= 10} {
                 if {[sysctl hw.cpu64bit_capable] == 1} {
                     set macports::build_arch x86_64
                 } else {
                     set macports::build_arch i386
                 }
             } else {
-                if {$tcl_platform(machine) == "Power Macintosh"} {
+                if {$os_arch == "powerpc"} {
                     set macports::build_arch ppc
                 } else {
                     set macports::build_arch i386
@@ -797,6 +837,10 @@
         set macports::build_arch [lindex $macports::build_arch 0]
     }
 
+    if {![info exists macports::macosx_deployment_target]} {
+        set macports::macosx_deployment_target $macosx_version
+    }
+
     # ENV cleanup.
     set keepenvkeys {
         DISPLAY DYLD_FALLBACK_FRAMEWORK_PATH
@@ -812,9 +856,10 @@
         set keepenvkeys [concat ${keepenvkeys} ${extra_env}]
     }
 
-    foreach envkey [array names env] {
-        if {[lsearch $keepenvkeys $envkey] == -1} {
-            array unset env $envkey
+    set env_names [array names env]
+    foreach envkey $env_names {
+        if {[lsearch -exact $keepenvkeys $envkey] == -1} {
+            unset env($envkey)
         }
     }
 
@@ -848,9 +893,11 @@
     }
 
     # unset environment an extra time, to work around bugs in Leopard Tcl
-    foreach envkey [array names env] {
-        if {[lsearch $keepenvkeys $envkey] == -1} {
-            unsetenv $envkey
+    if {$macosx_version == "10.5"} {
+        foreach envkey $env_names {
+            if {[lsearch -exact $keepenvkeys $envkey] == -1} {
+                unsetenv $envkey
+            }
         }
     }
 
@@ -917,8 +964,13 @@
         # convert any flat receipts if we just created a new db
         if {$db_exists == 0 && [file writable $db_path]} {
             ui_warn "Converting your registry to sqlite format, this might take a while..."
-            registry::convert_to_sqlite
-            ui_warn "Successfully converted your registry to sqlite!"
+            if {[catch {registry::convert_to_sqlite}]} {
+                ui_debug "$::errorInfo"
+                file delete -force $db_path
+                error "Failed to convert your registry to sqlite!"
+            } else {
+                ui_warn "Successfully converted your registry to sqlite!"
+            }
         }
     }
 }
@@ -1394,11 +1446,19 @@
 # Determine if a port is active (only for image mode)
 proc _mportactive {mport} {
     set workername [ditem_key $mport workername]
-    if {[catch {set reslist [$workername eval registry_active \${name}]}]} {
-        return 0
-    } else {
-        return [expr [llength $reslist] > 0]
+    if {![catch {set reslist [$workername eval registry_active \${name}]}] && [llength $reslist] > 0} {
+        set i [lindex $reslist 0]
+        set name [lindex $i 0]
+        set version [lindex $i 1]
+        set revision [lindex $i 2]
+        set variants [lindex $i 3]
+        array set portinfo [mportinfo $mport]
+        if {$name == $portinfo(name) && $version == $portinfo(version)
+            && $revision == $portinfo(revision) && $variants == $portinfo(canonical_active_variants)} {
+            return 1
+        }
     }
+    return 0
 }
 
 # Determine if the named port is active (only for image mode)
@@ -1477,6 +1537,7 @@
     # xxx: set the work path?
     set workername [ditem_key $mport workername]
     if {![catch {$workername eval check_variants $target} result] && $result == 0 &&
+        ![catch {$workername eval check_supported_archs} result] && $result == 0 &&
         ![catch {$workername eval eval_targets $target} result] && $result == 0} {
         # If auto-clean mode, clean-up after dependency install
         if {[string equal ${macports::portautoclean} "yes"]} {
@@ -1489,13 +1550,15 @@
             catch {cd $portpath}
             $workername eval eval_targets clean
         }
+        # XXX hack to avoid running out of fds due to sqlite temp files, ticket #24857
+        interp delete $workername
         macports::pop_log
         return 0
     } else {
         # An error occurred.
-        global ::debuglogname
-        if {[info exists ::debuglogname]} {
-            ui_msg "Log for $portname is at: $::debuglogname"
+        global ::logenabled ::debuglogname
+        if {[info exists ::logenabled] && $::logenabled && [info exists ::debuglogname]} {
+            ui_notice "Log for $portname is at: $::debuglogname"
         }
         macports::pop_log
         return 1
@@ -1519,22 +1582,24 @@
     }
 
     # Before we build the port, we must build its dependencies.
-    # XXX: need a more general way of comparing against targets
     set dlist {}
-    if {   $target == "fetch" || $target == "checksum"
-        || $target == "extract" || $target == "patch"
-        || $target == "configure" || $target == "build"
-        || $target == "test"
-        || $target == "destroot" || $target == "install"
-        || $target == "archive"
-        || $target == "dmg" || $target == "mdmg"
-        || $target == "pkg" || $target == "mpkg"
-        || $target == "rpm" || $target == "dpkg"
-        || $target == "srpm"|| $target == "portpkg" } {
+    if {[macports::_target_needs_deps $target]} {
 
-        # upgrade dependencies that are already installed
-        if {![macports::global_option_isset ports_nodeps]} {
-            macports::_upgrade_mport_deps $mport $target
+        # see if we actually need to build this port
+        if {![$workername eval registry_exists \$name \$version \$revision \$portvariants]} {
+            # possibly warn or error out depending on how old xcode is
+            if {[$workername eval _check_xcode_version] != 0} {
+                return 1
+            }
+            # error out if selected arch(s) not supported by this port
+            if {[$workername eval check_supported_archs] != 0} {
+                return 1
+            }
+    
+            # upgrade dependencies that are already installed
+            if {![macports::global_option_isset ports_nodeps]} {
+                macports::_upgrade_mport_deps $mport $target
+            }
         }
 
         ui_msg -nonewline "--->  Computing dependencies for [_mportkey $mport name]"
@@ -1570,7 +1635,7 @@
         if { [string equal ${macports::registry.installtype} "image"] } {
             set result [dlist_eval $dlist _mportactive [list _mportexec "activate"]]
         } else {
-            set result [dlist_eval $dlist _mportinstalled [list _mportexec "install"]]
+            set result [dlist_eval $dlist _mportinstalled [list _mportexec "activate"]]
         }
 
         if {$result != {}} {
@@ -1579,6 +1644,9 @@
                 append errstring " [ditem_key $ditem provides]"
             }
             ui_error $errstring
+            foreach ditem $dlist {
+                catch {mportclose $ditem}
+            }
             return 1
         }
 
@@ -1589,11 +1657,6 @@
     }
 
     set clean 0
-    if {[string equal $target "install"] && [string equal ${macports::registry.installtype} "image"]} {
-        # If we're doing image installs, then we should activate after install
-        # xxx: This isn't pretty
-        set target activate
-    }
     if {[string equal ${macports::portautoclean} "yes"] && ([string equal $target "install"] || [string equal $target "activate"])} {
         # If we're doing an install, check if we should clean after
         set clean 1
@@ -1610,10 +1673,10 @@
         $workername eval eval_targets clean
     }
     
-    global ::debuglogname
-    if {[info exists ::debuglogname]} {
-        if {$result != 0 && ![macports::ui_isset ports_quiet]} {
-            ui_msg "Log for $portname is at: $::debuglogname"
+    global ::logenabled ::debuglogname
+    if {[info exists ::logenabled] && $::logenabled && [info exists ::debuglogname]} {
+        if {$result != 0} {
+            ui_notice "Log for $portname is at: $::debuglogname"
         }
         macports::pop_log
     }
@@ -1625,7 +1688,7 @@
 proc macports::_upgrade_mport_deps {mport target} {
     set options [ditem_key $mport options]
     set workername [ditem_key $mport workername]
-    set deptypes [macports::_deptypes_for_target $target]
+    set deptypes [macports::_deptypes_for_target $target $workername]
     array set portinfo [mportinfo $mport]
     array set depscache {}
 
@@ -1681,6 +1744,7 @@
                                     # upgrade the dep with +universal
                                     lappend variants universal +
                                     lappend options ports_upgrade_enforce-variants yes
+                                    ui_debug "enforcing +universal upgrade for $dep_portname"
                                 }
                             } else {
                                 # already universal
@@ -1803,6 +1867,7 @@
             ui_debug "Skipping $source"
             continue
         }
+        set needs_portindex 0
         ui_info "Synchronizing local ports tree from $source"
         switch -regexp -- [macports::getprotocol $source] {
             {^file$} {
@@ -1832,29 +1897,45 @@
                         continue
                     }
                 }
+                set needs_portindex 1
             }
             {^mports$} {
                 macports::index::sync $macports::portdbpath $source
             }
             {^rsync$} {
                 # Where to, boss?
-                set destdir [file dirname [macports::getindex $source]]
+                set indexfile [macports::getindex $source]
+                set destdir [file dirname $indexfile]
                 file mkdir $destdir
                 # Keep rsync happy with a trailing slash
                 if {[string index $source end] != "/"} {
-                    set source "${source}/"
+                    append source "/"
                 }
+                # don't sync PortIndex yet; we grab the platform specific one afterwards
+                set exclude_option "'--exclude=/PortIndex*'"
                 # Do rsync fetch
-                set rsync_commandline "${macports::autoconf::rsync_path} ${rsync_options} ${source} ${destdir}"
+                set rsync_commandline "${macports::autoconf::rsync_path} ${rsync_options} ${exclude_option} ${source} ${destdir}"
                 ui_debug $rsync_commandline
                 if {[catch {system $rsync_commandline}]} {
                     ui_error "Synchronization of the local ports tree failed doing rsync"
                     incr numfailed
                     continue
                 }
+                # now sync the index if the local file is missing or older than a day
+                if {![file isfile $indexfile] || [expr [clock seconds] - [file mtime $indexfile]] > 86400} {
+                    set remote_indexfile "${source}PortIndex_${macports::os_platform}_${macports::os_major}_${macports::os_arch}/PortIndex"
+                    set rsync_commandline "${macports::autoconf::rsync_path} ${rsync_options} $remote_indexfile ${destdir}"
+                    ui_debug $rsync_commandline
+                    if {[catch {system $rsync_commandline}]} {
+                        ui_debug "Synchronization of the PortIndex failed doing rsync"
+                    } else {
+                        mports_generate_quickindex $indexfile
+                    }
+                }
                 if {[catch {system "chmod -R a+r \"$destdir\""}]} {
                     ui_warn "Setting world read permissions on parts of the ports tree failed, need root?"
                 }
+                set needs_portindex 1
             }
             {^https?$|^ftp$} {
                 if {[_source_is_snapshot $source filename extension]} {
@@ -1876,7 +1957,7 @@
                         continue
                     }
 
-                    file mkdir [file dirname $indexfile]
+                    file mkdir $destdir
 
                     set verboseflag {}
                     if {$macports::portverbose == "yes"} {
@@ -1910,7 +1991,14 @@
                         ui_warn "Setting world read permissions on parts of the ports tree failed, need root?"
                     }
 
+                    set platindex "PortIndex_${macports::os_platform}_${macports::os_major}_${macports::os_arch}/PortIndex"
+                    if {[file isfile ${destdir}/${platindex}] && [file isfile ${destdir}/${platindex}.quick]} {
+                        file rename -force "${destdir}/${platindex}" "${destdir}/${platindex}.quick" $destdir
+                    }
+
                     file delete $tarpath
+                    
+                    set needs_portindex 1
                 } else {
                     # sync just a PortIndex file
                     set indexfile [macports::getindex $source]
@@ -1923,6 +2011,14 @@
                 ui_warn "Unknown synchronization protocol for $source"
             }
         }
+        
+        if {$needs_portindex} {
+            global macports::prefix
+            set indexdir [file dirname [macports::getindex $source]]
+            if {[catch {system "${macports::prefix}/bin/portindex $indexdir"}]} {
+                ui_error "updating PortIndex for $source failed"
+            }
+        }
     }
 
     # refresh the quick index if necessary (batch or interactive run)
@@ -2284,7 +2380,10 @@
     if {$refcnt == 0} {
         dlist_delete macports::open_mports $mport
         set workername [ditem_key $mport workername]
-        interp delete $workername
+        # the hack in _mportexec might have already deleted the worker
+        if {[interp exists $workername]} {
+            interp delete $workername
+        }
         ditem_delete $mport
     }
 }
@@ -2327,18 +2426,22 @@
         flush stdout
     }
     
-    if {[info exists portinfo(conflicts)] && ($target == "" || $target == "install")} {
+    if {[info exists portinfo(conflicts)] && ($target == "" || $target == "install" || $target == "activate")} {
         set conflictports [_mportconflictsinstalled $mport $portinfo(conflicts)]
         if {[llength ${conflictports}] != 0} {
             if {[macports::global_option_isset ports_force]} {
                 ui_warn "Force option set; installing $portinfo(name) despite conflicts with: ${conflictports}"
             } else {
+                if {![macports::ui_isset ports_debug]} {
+                    ui_msg ""
+                }
                 return -code error "Can't install $portinfo(name) because conflicting ports are installed: ${conflictports}"
             }
         }
     }
 
-    set deptypes [macports::_deptypes_for_target $target]
+    set workername [ditem_key $mport workername]
+    set deptypes [macports::_deptypes_for_target $target $workername]
 
     set subPorts {}
     if {[llength $deptypes] > 0} {
@@ -2347,22 +2450,37 @@
         set optionsarray(ports_requested) 0
         set options [array get optionsarray]
         set variations [ditem_key $mport variations]
-        set required_archs [[ditem_key $mport workername] eval get_canonical_archs]
+        set required_archs [$workername eval get_canonical_archs]
         set depends_skip_archcheck [_mportkey $mport depends_skip_archcheck]
     }
 
     # Process the dependencies for each of the deptypes
     foreach deptype $deptypes {
         if {![info exists portinfo($deptype)]} {
-            set portinfo($deptype) ""
+            continue
         }
         foreach depspec $portinfo($deptype) {
             # Is that dependency satisfied or this port installed?
             # If we don't skip or if it is not, add it to the list.
-            if {!$skipSatisfied || ![_mportispresent $mport $depspec]} {
-                # grab the portname portion of the depspec
+            set present [_mportispresent $mport $depspec]
+
+            # get the portname that satisfies the depspec
+            set dep_portname [$workername eval _get_dep_port $depspec]
+            if {!$skipSatisfied && $dep_portname == ""} {
                 set dep_portname [lindex [split $depspec :] end]
-    
+            }
+
+            set check_archs 0
+            if {$dep_portname != "" && $deptype != "depends_fetch" && $deptype != "depends_extract" && [lsearch -exact $depends_skip_archcheck $dep_portname] == -1} {
+                set check_archs 1
+            }
+
+            # need to open the portfile even if the dep is installed if it doesn't have the right archs
+            set parse 0
+            if {!$skipSatisfied || !$present || ($check_archs && ![macports::_active_supports_archs $dep_portname $required_archs])} {
+                set parse 1
+            }
+            if {$parse} {
                 # Find the porturl
                 if {[catch {set res [mportlookup $dep_portname]} error]} {
                     global errorInfo
@@ -2370,7 +2488,7 @@
                     ui_error "Internal error: port lookup failed: $error"
                     return 1
                 }
-    
+
                 array unset dep_portinfo
                 array set dep_portinfo [lindex $res 1]
                 if {![info exists dep_portinfo(porturl)]} {
@@ -2380,48 +2498,50 @@
                     ui_error "Dependency '$dep_portname' not found."
                     return 1
                 }
-    
                 # Figure out the subport. Check the open_mports list first, since
                 # we potentially leak mport references if we mportopen each time,
                 # because mportexec only closes each open mport once.
                 set subport [dlist_search $macports::open_mports porturl $dep_portinfo(porturl)]
+                
                 if {$subport == {}} {
                     # We haven't opened this one yet.
                     set subport [mportopen $dep_portinfo(porturl) $options $variations]
-    
-                    # check archs
-                    if {$deptype != "depends_fetch" && $deptype != "depends_extract"
-                        && [lsearch -exact $depends_skip_archcheck $dep_portname] == -1
-                        && ![macports::_mport_supports_archs $subport $required_archs]} {
-                        set supported_archs [_mportkey $subport supported_archs]
-                        mportclose $subport
-                        set arch_mismatch 1
-                        set has_universal 0
-                        if {[info exists dep_portinfo(variants)] && [lsearch -exact $dep_portinfo(variants) universal] != -1} {
-                            # a universal variant is offered
-                            set has_universal 1
-                            array unset variation_array
-                            array set variation_array $variations
-                            if {![info exists variation_array(universal)] || $variation_array(universal) != "+"} {
-                                set variation_array(universal) +
-                                # try again with +universal
-                                set subport [mportopen $dep_portinfo(porturl) $options [array get variation_array]]
-                                if {[macports::_mport_supports_archs $subport $required_archs]} {
-                                    set arch_mismatch 0
-                                }
-                            }
+                }
+            }
+
+            # check archs
+            if {$parse && $check_archs
+                && ![macports::_mport_supports_archs $subport $required_archs]} {
+
+                set supported_archs [_mportkey $subport supported_archs]
+                mportclose $subport
+                set arch_mismatch 1
+                set has_universal 0
+                if {[info exists dep_portinfo(variants)] && [lsearch -exact $dep_portinfo(variants) universal] != -1} {
+                    # a universal variant is offered
+                    set has_universal 1
+                    array unset variation_array
+                    array set variation_array $variations
+                    if {![info exists variation_array(universal)] || $variation_array(universal) != "+"} {
+                        set variation_array(universal) +
+                        # try again with +universal
+                        set subport [mportopen $dep_portinfo(porturl) $options [array get variation_array]]
+                        if {[macports::_mport_supports_archs $subport $required_archs]} {
+                            set arch_mismatch 0
                         }
-                        if {$arch_mismatch} {
-                            macports::_explain_arch_mismatch [_mportkey $mport name] $dep_portname $required_archs $supported_archs $has_universal
-                            return -code error "architecture mismatch"
-                        }
                     }
-                    
-                    if {$recurseDeps} {
-                        # Add to the list we need to recurse on.
-                        lappend subPorts $subport
-                    }
                 }
+                if {$arch_mismatch} {
+                    macports::_explain_arch_mismatch [_mportkey $mport name] $dep_portname $required_archs $supported_archs $has_universal
+                    return -code error "architecture mismatch"
+                }
+            }
+
+            if {$parse} {
+                if {$recurseDeps} {
+                    # Add to the list we need to recurse on.
+                    lappend subPorts $subport
+                }
     
                 # Append the sub-port's provides to the port's requirements list.
                 ditem_append_unique $mport requires "[ditem_key $subport provides]"
@@ -2461,6 +2581,28 @@
     return 1
 }
 
+# check if the active version of a port supports the given archs
+proc macports::_active_supports_archs {portname required_archs} {
+    if {$required_archs == "noarch"} {
+        return 1
+    }
+    if {[catch {set ilist [registry::active $portname]}]} {
+        return 0
+    }
+    set i [lindex $ilist 0]
+    set regref [registry::open_entry $portname [lindex $i 1] [lindex $i 2] [lindex $i 3] [lindex $i 5]]
+    set provided_archs [registry::property_retrieve $regref archs]
+    if {$provided_archs == "noarch" || $provided_archs == "" || $provided_archs == 0} {
+        return 1
+    }
+    foreach arch $required_archs {
+        if {[lsearch -exact $provided_archs $arch] == -1} {
+            return 0
+        }
+    }
+    return 1
+}
+
 # print an error message explaining why a port's archs are not provided by a dependency
 proc macports::_explain_arch_mismatch {port dep required_archs supported_archs has_universal} {
     global macports::universal_archs
@@ -2491,32 +2633,69 @@
     ui_error "and does not have a universal variant."
 }
 
+# check if the given target needs dependencies installed first
+proc macports::_target_needs_deps {target} {
+    # XXX: need a better way than checking this hardcoded list
+    switch -- $target {
+        fetch -
+        checksum -
+        extract -
+        patch -
+        configure -
+        build -
+        test -
+        destroot -
+        install -
+        archive -
+        activate -
+        dmg -
+        mdmg -
+        pkg -
+        mpkg -
+        rpm -
+        dpkg -
+        srpm { return 1 }
+        default { return 0 }
+    }
+}
+
 # Determine dependency types required for target
-proc macports::_deptypes_for_target {target} {
+proc macports::_deptypes_for_target {target workername} {
     switch $target {
         fetch       -
-        checksum    { set deptypes "depends_fetch" }
+        checksum    { return "depends_fetch" }
         extract     -
-        patch       { set deptypes "depends_fetch depends_extract" }
+        patch       { return "depends_fetch depends_extract" }
         configure   -
-        build       { set deptypes "depends_fetch depends_extract depends_build depends_lib" }
-
+        build       { return "depends_fetch depends_extract depends_build depends_lib" }
         test        -
-        destroot    -
-        install     -
-        activate    -
+        srpm        -
+        destroot    { return "depends_fetch depends_extract depends_build depends_lib depends_run" }
         archive     -
         dmg         -
         pkg         -
-        portpkg     -
         mdmg        -
         mpkg        -
         rpm         -
-        srpm        -
-        dpkg        -
-        ""          { set deptypes "depends_fetch depends_extract depends_build depends_lib depends_run" }
+        dpkg        {
+            if {[$workername eval _archive_available]} {
+                return "depends_lib depends_run"
+            } else {
+                return "depends_fetch depends_extract depends_build depends_lib depends_run"
+            }
+        }
+        install     -
+        activate    -
+        ""          {
+            if {[$workername eval registry_exists \$name \$version \$revision \$portvariants]
+                || [$workername eval _archive_available]} {
+                return "depends_lib depends_run"
+            } else {
+                return "depends_fetch depends_extract depends_build depends_lib depends_run"
+            }
+        }
     }
-    return $deptypes
+    return ""
 }
 
 # selfupdate procedure
@@ -2612,9 +2791,16 @@
                 ui_warn "Disabling readline support due to readline in /usr/local"
             }
 
+            set cc_arg ""
+            switch -glob -- $::macports::macosx_version {
+                10.{4,5} { set cc_arg "CC=/usr/bin/gcc-4.0 " }
+                10.6     { set cc_arg "CC=/usr/bin/gcc-4.2 " }
+                10.*     { set cc_arg "CC=/usr/bin/llvm-gcc-4.2 " }
+            }
+
             # do the actual configure, build and installation of new base
             ui_msg "Installing new MacPorts release in $prefix as $owner:$group; permissions $perms; Tcl-Package in $tclpackage\n"
-            if { [catch { system "cd $mp_source_path && ./configure $configure_args && make && make install" } result] } {
+            if { [catch { system "cd $mp_source_path && ${cc_arg}./configure $configure_args && make && make install" } result] } {
                 return -code error "Error installing new MacPorts base: $result"
             }
             if {[info exists updatestatus]} {
@@ -2678,14 +2864,6 @@
     global macports::global_variations
     array set options $optionslist
 
-    # Note $variationslist is left alone and so retains the original
-    # requested variations, which should be passed to recursive calls to
-    # upgrade; while variations gets existing variants and global variations
-    # merged in later on, so it applies only to this port's upgrade
-    array set variations $variationslist
-    
-    set globalvarlist [array get macports::global_variations]
-
     if {![string match "" $depscachename]} {
         upvar $depscachename depscache
     }
@@ -2713,15 +2891,6 @@
     # set portname again since the one we were passed may not have had the correct case
     set portname $portinfo(name)
 
-    # set version_in_tree and revision_in_tree
-    if {![info exists portinfo(version)]} {
-        ui_error "Invalid port entry for $portname, missing version"
-        return 1
-    }
-    set version_in_tree "$portinfo(version)"
-    set revision_in_tree "$portinfo(revision)"
-    set epoch_in_tree "$portinfo(epoch)"
-
     set ilist {}
     if { [catch {set ilist [registry::installed $portname ""]} result] } {
         if {$result == "Registry error: $portname not registered as installed." } {
@@ -2737,12 +2906,8 @@
                 if {![info exists porturl]} {
                     set porturl file://./
                 }
-                # Merge the global variations into the specified
-                foreach { variation value } $globalvarlist {
-                    if { ![info exists variations($variation)] } {
-                        set variations($variation) $value
-                    }
-                }
+                # Grab the variations from the parent
+                upvar 2 variations variations
 
                 if {[catch {set workername [mportopen $porturl [array get options] [array get variations]]} result]} {
                     global errorInfo
@@ -2761,7 +2926,7 @@
                     return $status
                 }
                 # now install it
-                if {[catch {set result [mportexec $workername install]} result]} {
+                if {[catch {set result [mportexec $workername activate]} result]} {
                     global errorInfo
                     ui_debug "$errorInfo"
                     ui_error "Unable to exec port: $result"
@@ -2793,13 +2958,19 @@
         # we'll now take care of upgrading it, so we can add it to the cache
         set depscache(port:${portname}) 1
     }
+    
+    # set version_in_tree and revision_in_tree
+    if {![info exists portinfo(version)]} {
+        ui_error "Invalid port entry for $portname, missing version"
+        return 1
+    }
+    set version_in_tree "$portinfo(version)"
+    set revision_in_tree "$portinfo(revision)"
+    set epoch_in_tree "$portinfo(epoch)"
+
+    # find latest version installed and active version (if any)
     set anyactive no
     set version_installed {}
-    set revision_installed {}
-    set epoch_installed 0
-    set variant_installed ""
-
-    # find latest version installed and active version (if any)
     foreach i $ilist {
         set variant [lindex $i 3]
         set version [lindex $i 1]
@@ -2809,7 +2980,7 @@
                 ($epoch == $epoch_installed && [rpm-vercomp $version $version_installed] > 0)
                 || ($epoch == $epoch_installed
                     && [rpm-vercomp $version $version_installed] == 0
-                    && [rpm-vercomp $revision $revision_installed] > 0)} {
+                    && $revision > $revision_installed)} {
             set version_installed $version
             set revision_installed $revision
             set variant_installed $variant
@@ -2856,6 +3027,14 @@
         set porturl file://./
     }
 
+    # Note $variationslist is left alone and so retains the original
+    # requested variations, which should be passed to recursive calls to
+    # upgrade; while variations gets existing variants and global variations
+    # merged in later on, so it applies only to this port's upgrade
+    array set variations $variationslist
+    
+    set globalvarlist [array get macports::global_variations]
+
     set minusvariant [lrange [split $oldnegatedvariant -] 1 end]
     set plusvariant [lrange [split $oldvariant +] 1 end]
     ui_debug "Merging existing variants '${oldvariant}${oldnegatedvariant}' into variants"
@@ -2950,7 +3129,11 @@
             set build_override 1
         } 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."
+                if {[llength $variationslist] > 0} {
+                    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 "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)\"."
+                }
             } else {
                 ui_debug "No need to upgrade! $portname ${version_installed}_${revision_installed} >= $portname ${version_in_tree}_${revision_in_tree}"
             }
@@ -3052,7 +3235,8 @@
             # we have to force the uninstall in case of dependents
             set force_cur [info exists options(ports_force)]
             set options(ports_force) yes
-            set newregref [registry::open_entry $newname $version_in_tree $revision_in_tree $portinfo(canonical_active_variants) $epoch_in_tree]
+            set existing_epoch [lindex [lindex [registry::installed $newname ${version_in_tree}_${revision_in_tree}$portinfo(canonical_active_variants)] 0] 5]
+            set newregref [registry::open_entry $newname $version_in_tree $revision_in_tree $portinfo(canonical_active_variants) $existing_epoch]
             if {$is_dryrun eq "yes"} {
                 ui_msg "Skipping uninstall $newname @${version_in_tree}_${revision_in_tree}$portinfo(canonical_active_variants) (dry run)"
             } elseif {!(${registry.format} == "receipt_sqlite" && [registry::run_target $newregref uninstall [array get options]])
@@ -3071,7 +3255,28 @@
                 set anyactive no
             }
         }
-        if {[info exists options(port_uninstall_old)]} {
+        if {$anyactive && $portname != $newname} {
+            # replaced_by in effect, deactivate the old port
+            # we have to force the deactivate 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 deactivate $portname @${version_active}_${revision_active}${variant_active} (dry run)"
+            } elseif {![catch {registry::active $portname}] &&
+                      !(${registry.format} == "receipt_sqlite" && [registry::run_target $regref deactivate [array get options]])
+                      && [catch {portimage::deactivate $portname ${version_active}_${revision_active}${variant_active} [array get options]} result]} {
+                global errorInfo
+                ui_debug "$errorInfo"
+                ui_error "Deactivating $portname @${version_active}_${revision_active}${variant_active} failed: $result"
+                catch {mportclose $workername}
+                return 1
+            }
+            if {!$force_cur} {
+                unset options(ports_force)
+            }
+            set anyactive no
+        }
+        if {[info exists options(port_uninstall_old)] && $portname == $newname} {
             # uninstalling now could fail due to dependents when not forced,
             # because the new version is not installed
             set uninstall_later yes
@@ -3083,7 +3288,7 @@
             ui_msg "Skipping deactivate $portname @${version_active}_${revision_active}${variant_active} (dry run)"
         }
         ui_msg "Skipping activate $newname @${version_in_tree}_${revision_in_tree}$portinfo(canonical_active_variants) (dry run)"
-    } elseif {[catch {set result [mportexec $workername install]} result]} {
+    } elseif {[catch {set result [mportexec $workername activate]} result]} {
         global errorInfo
         ui_debug "$errorInfo"
         ui_error "Couldn't activate $newname ${version_in_tree}_${revision_in_tree}$portinfo(canonical_active_variants): $result"

Modified: branches/new-help-system/base/src/package1.0/Makefile
===================================================================
--- branches/new-help-system/base/src/package1.0/Makefile	2010-07-16 23:53:45 UTC (rev 69809)
+++ branches/new-help-system/base/src/package1.0/Makefile	2010-07-17 00:51:07 UTC (rev 69810)
@@ -8,7 +8,7 @@
 
 all:: pkgIndex.tcl
 
-pkgIndex.tcl:
+pkgIndex.tcl: $(SRCS)
 	$(SILENT) ../pkg_mkindex.sh .
 
 clean::

Modified: branches/new-help-system/base/src/package1.0/portarchive.tcl
===================================================================
--- branches/new-help-system/base/src/package1.0/portarchive.tcl	2010-07-16 23:53:45 UTC (rev 69809)
+++ branches/new-help-system/base/src/package1.0/portarchive.tcl	2010-07-17 00:51:07 UTC (rev 69810)
@@ -78,11 +78,7 @@
 
     # Define archive destination directory and target filename
     if {![string equal ${archive.destpath} ${workpath}] && ![string equal ${archive.destpath} ""]} {
-        if {[llength [get_canonical_archs]] > 1} {
-            set archive.fulldestpath [file join ${archive.destpath} [option os.platform] "universal"]
-        } else {
-            set archive.fulldestpath [file join ${archive.destpath} [option os.platform] [get_canonical_archs]]
-        }
+        set archive.fulldestpath [file join ${archive.destpath} [option archive.subdir]]
     } else {
         set archive.fulldestpath ${archive.destpath}
     }
@@ -294,14 +290,18 @@
     global archive.meta archive.metaname archive.metapath
     global os.platform
 
+    if {[getuid] == 0 && [geteuid] != 0} {
+        elevateToRoot "archive"
+    }
+
     # Create archive destination path (if needed)
     if {![file isdirectory ${archive.fulldestpath}]} {
-        system "mkdir -p ${archive.fulldestpath}"
+        file mkdir ${archive.fulldestpath}
     }
 
     # Create (if no files) destroot for archiving
     if {![file isdirectory ${destpath}]} {
-        system "mkdir -p ${destpath}"
+        file mkdir ${destpath}
     }
 
     # Copy state file into destroot for archiving

Modified: branches/new-help-system/base/src/package1.0/portarchivefetch.tcl
===================================================================
--- branches/new-help-system/base/src/package1.0/portarchivefetch.tcl	2010-07-16 23:53:45 UTC (rev 69809)
+++ branches/new-help-system/base/src/package1.0/portarchivefetch.tcl	2010-07-17 00:51:07 UTC (rev 69810)
@@ -47,7 +47,8 @@
 
 options archive_sites archivefetch.user archivefetch.password \
     archivefetch.use_epsv archivefetch.ignore_sslcert \
-    archive_sites.mirror_subdir
+    archive_sites.mirror_subdir archivefetch.pubkeys \
+    archive.subdir
 
 # user name & password
 default archivefetch.user ""
@@ -56,13 +57,24 @@
 default archivefetch.use_epsv no
 # Ignore SSL certificate
 default archivefetch.ignore_sslcert no
+default archivefetch.pubkeys {$archivefetch_pubkeys}
 
 default archive_sites macports_archives
 default archive_sites.listfile {"archive_sites.tcl"}
 default archive_sites.listpath {"port1.0/fetch"}
+default archive.subdir {[portarchivefetch::get_archive_subdir]}
 
 set_ui_prefix
 
+proc portarchivefetch::get_archive_subdir {} {
+    set archs [get_canonical_archs]
+    if {[llength $archs] > 1} {
+        return [file join [option os.platform]_[option os.major] "universal" [option name]]
+    } else {
+        return [file join [option os.platform]_[option os.major] $archs [option name]]
+    }
+}
+
 # Checks possible archive files to assemble url lists for later fetching
 proc portarchivefetch::checkarchivefiles {urls} {
     global all_archive_files archivefetch.fulldestpath \
@@ -70,11 +82,7 @@
     upvar $urls fetch_urls
 
     # Define archive directory, file, and path
-    if {[llength [get_canonical_archs]] > 1} {
-        set archivefetch.fulldestpath [file join ${portarchivepath} [option os.platform] "universal"]
-    } else {
-        set archivefetch.fulldestpath [file join ${portarchivepath} [option os.platform] [get_canonical_archs]]
-    }
+    set archivefetch.fulldestpath [file join ${portarchivepath} [option archive.subdir]]
 
     set unsupported 0
     set found 0
@@ -125,7 +133,7 @@
 # Perform a standard fetch, assembling fetch urls from
 # the listed url variable and associated archive file
 proc portarchivefetch::fetchfiles {args} {
-    global archivefetch.fulldestpath UI_PREFIX
+    global portarchivepath archivefetch.fulldestpath UI_PREFIX
     global archivefetch.user archivefetch.password archivefetch.use_epsv \
            archivefetch.ignore_sslcert
     global portverbose ports_binary_only
@@ -141,7 +149,18 @@
             }
         }
     }
+    set incoming_path [file join ${portarchivepath} incoming]
+    if {![file isdirectory $incoming_path]} {
+        if {[catch {file mkdir $incoming_path} result]} {
+            elevateToRoot "archivefetch"
+            set elevated yes
+            if {[catch {file mkdir $incoming_path} result]} {
+                return -code error [format [msgcat::mc "Unable to create archive fetch path: %s"] $result]
+            }
+        }
+    }
     chownAsRoot ${archivefetch.fulldestpath}
+    chownAsRoot $incoming_path
     if {[info exists elevated] && $elevated == yes} {
         dropPrivileges
     }
@@ -168,30 +187,64 @@
             if {![file writable ${archivefetch.fulldestpath}]} {
                 return -code error [format [msgcat::mc "%s must be writable"] ${archivefetch.fulldestpath}]
             }
+            if {![file writable $incoming_path]} {
+                return -code error [format [msgcat::mc "%s must be writable"] $incoming_path]
+            }
             if {!$sorted} {
                 portfetch::sortsites archivefetch_urls {} archive_sites
                 set sorted yes
             }
             if {![info exists urlmap($url_var)]} {
                 ui_error [format [msgcat::mc "No defined site for tag: %s, using archive_sites"] $url_var]
-                set urlmap($url_var) $archive_sites
+                set urlmap($url_var) $urlmap(archive_sites)
             }
             unset -nocomplain fetched
             foreach site $urlmap($url_var) {
-                ui_msg "$UI_PREFIX [format [msgcat::mc "Attempting to fetch %s from %s"] $archive $site]"
+                if {[string index $site end] != "/"} {
+                    append site "/[option archive.subdir]"
+                } else {
+                    append site [option archive.subdir]
+                }
+                ui_msg "$UI_PREFIX [format [msgcat::mc "Attempting to fetch %s from %s"] $archive ${site}]"
                 set file_url [portfetch::assemble_url $site $archive]
                 set effectiveURL ""
-                if {![catch {eval curl fetch --effective-url effectiveURL $fetch_options {$file_url} ${archivefetch.fulldestpath}/${archive}.TMP} result] &&
-                    ![catch {file rename -force "${archivefetch.fulldestpath}/${archive}.TMP" "${archivefetch.fulldestpath}/${archive}"} result]} {
+                if {![catch {eval curl fetch --effective-url effectiveURL $fetch_options {$file_url} {"${incoming_path}/${archive}.TMP"}} result]} {
                     # Successful fetch
                     set fetched 1
                     break
                 } else {
                     ui_debug "[msgcat::mc "Fetching archive failed:"]: $result"
-                    file delete -force "${archivefetch.fulldestpath}/${archive}.TMP"
+                    file delete -force "${incoming_path}/${archive}.TMP"
                 }
             }
             if {[info exists fetched]} {
+                # there should be an rmd160 digest of the archive signed with one of the trusted keys
+                set signature "${incoming_path}/${archive}.rmd160"
+                ui_msg "$UI_PREFIX [format [msgcat::mc "Attempting to fetch %s from %s"] ${archive}.rmd160 $site]"
+                # reusing $file_url from the last iteration of the loop above
+                if {[catch {eval curl fetch --effective-url effectiveURL $fetch_options {${file_url}.rmd160} {$signature}} result]} {
+                    ui_debug "$::errorInfo"
+                    return -code error "Failed to fetch signature for archive: $result"
+                }
+                set verified 0
+                foreach pubkey [option archivefetch.pubkeys] {
+                    set openssl [findBinary openssl $portutil::autoconf::openssl_path]
+                    if {![catch {exec $openssl dgst -ripemd160 -verify $pubkey -signature $signature "${incoming_path}/${archive}.TMP"} result]} {
+                        set verified 1
+                        break
+                    } else {
+                        ui_debug "failed verification with key $pubkey"
+                        ui_debug "openssl output: $result"
+                    }
+                }
+                if {!$verified} {
+                    return -code error "Failed to verify signature for archive!"
+                }
+                if {[catch {file rename -force "${incoming_path}/${archive}.TMP" "${archivefetch.fulldestpath}/${archive}"} result]} {
+                    ui_debug "$::errorInfo"
+                    return -code error "Failed to move downloaded archive into place: $result"
+                }
+                file delete -force $signature
                 return 0
             }
         } else {
@@ -207,19 +260,20 @@
 
 # Initialize archivefetch target and call checkfiles.
 proc portarchivefetch::archivefetch_init {args} {
-    variable archivefetch_urls
-
     if {[option portarchivemode] != "yes"} {
         return -code error "Archive mode is not enabled!"
     }
-
-    portarchivefetch::checkfiles archivefetch_urls
 }
 
 proc portarchivefetch::archivefetch_start {args} {
-    global UI_PREFIX name
-
-    ui_msg "$UI_PREFIX [format [msgcat::mc "Fetching archive for %s"] $name]"
+    variable archivefetch_urls
+    global UI_PREFIX name all_archive_files ports_source_only
+    if {![tbool ports_source_only]} {
+        portarchivefetch::checkfiles archivefetch_urls
+    }
+    if {[info exists all_archive_files] && [llength $all_archive_files] > 0} {
+        ui_msg "$UI_PREFIX [format [msgcat::mc "Fetching archive for %s"] $name]"
+    }
 }
 
 # Main archive fetch routine
@@ -229,5 +283,7 @@
     if {[info exists all_archive_files] && [llength $all_archive_files] > 0} {
         # Fetch the files
         return [portarchivefetch::fetchfiles]
+    } else {
+        return 0
     }
 }

Modified: branches/new-help-system/base/src/package1.0/portunarchive.tcl
===================================================================
--- branches/new-help-system/base/src/package1.0/portunarchive.tcl	2010-07-16 23:53:45 UTC (rev 69809)
+++ branches/new-help-system/base/src/package1.0/portunarchive.tcl	2010-07-17 00:51:07 UTC (rev 69810)
@@ -73,11 +73,7 @@
 
     # Define archive directory, file, and path
     if {![string equal ${unarchive.srcpath} ${workpath}] && ![string equal ${unarchive.srcpath} ""]} {
-        if {[llength [get_canonical_archs]] > 1} {
-            set unarchive.fullsrcpath [file join ${unarchive.srcpath} [option os.platform] "universal"]
-        } else {
-            set unarchive.fullsrcpath [file join ${unarchive.srcpath} [option os.platform] [get_canonical_archs]]
-        }
+        set unarchive.fullsrcpath [file join ${unarchive.srcpath} [option archive.subdir]]
     } else {
         set unarchive.fullsrcpath ${unarchive.srcpath}
     }
@@ -103,7 +99,7 @@
                 set archstring [join [get_canonical_archs] -]
                 set unarchive.file "${name}-${version}_${revision}${portvariants}.${archstring}.${unarchive.type}"
                 set unarchive.path "[file join ${unarchive.fullsrcpath} ${unarchive.file}]"
-                if {[file exist ${unarchive.path}]} {
+                if {[file isfile ${unarchive.path}]} {
                     set found 1
                     break
                 } else {
@@ -289,25 +285,14 @@
     global UI_PREFIX target_state_fd unarchive.file name workpath destpath
 
     # Reset state file with archive version
+    close $target_state_fd
     set statefile [file join $workpath .macports.${name}.state]
     file copy -force [file join $destpath "+STATE"] $statefile
     file mtime $statefile [clock seconds]
 
-# Hack to temporarily move com.apple.* strings in statefiles extracted from old archives
-# to the org.macports.* namespace. "temporarily" because old archives will still have a
-# +STATE file with the old strings in it, as we only update them on the unpacked statefile.
-    set fd_new_sf [open $statefile r]
-    set fd_tmp [open ${statefile}.tmp w+]
-    while {[gets $fd_new_sf line] >= 0} {
-    puts $fd_tmp "[regsub com.apple $line org.macports]"
-    }
-    close $fd_new_sf
-    close $fd_tmp
-    file rename -force ${statefile}.tmp $statefile
-
     # Update the state from unpacked archive version
     set target_state_fd [open_statefile]
-    
+
     # Cleanup all control files when finished
     set control_files [glob -nocomplain -types f [file join $destpath +*]]
     foreach file $control_files {

Modified: branches/new-help-system/base/src/pextlib1.0/Pextlib.c
===================================================================
--- branches/new-help-system/base/src/pextlib1.0/Pextlib.c	2010-07-16 23:53:45 UTC (rev 69809)
+++ branches/new-help-system/base/src/pextlib1.0/Pextlib.c	2010-07-17 00:51:07 UTC (rev 69810)
@@ -94,10 +94,10 @@
 {
 	char *d, *dest;
 	const char *s;
-	int slen, dlen;
+	size_t dlen;
 
 	s = source;
-	slen = dlen = strlen(source) * 2 + 1;
+	dlen = strlen(source) * 2 + 1;
 	d = dest = malloc(dlen);
 	if (dest == NULL) {
 		return NULL;
@@ -132,8 +132,9 @@
 {
 	const char ui_proc_start[] = "ui_info [subst -nocommands -novariables {";
 	const char ui_proc_end[] = "}]";
-	char *script, *string, *p;
-	int scriptlen, len, rval;
+	char *script, *string;
+	size_t scriptlen, len, remaining;
+	int rval;
 
 	string = ui_escape(mesg);
 	if (string == NULL)
@@ -144,14 +145,14 @@
 	script = malloc(scriptlen);
 	if (script == NULL)
 		return TCL_ERROR;
-	else
-		p = script;
 
 	memcpy(script, ui_proc_start, sizeof(ui_proc_start));
-	strcat(script, string);
-	strcat(script, ui_proc_end);
+	remaining = scriptlen - sizeof(ui_proc_start);
+	strncat(script, string, remaining);
+	remaining -= len;
+	strncat(script, ui_proc_end, remaining);
 	free(string);
-	rval = Tcl_EvalEx(interp, script, scriptlen - 1, 0);
+	rval = Tcl_EvalEx(interp, script, -1, 0);
 	free(script);
 	return rval;
 }
@@ -274,7 +275,7 @@
 {
 	Tcl_Obj *tcl_result;
 	char *tcl_mask, *p;
-	const size_t stringlen = 4; /* 3 digits & \0 */
+	const size_t stringlen = 5; /* 4 digits & \0 */
 	int i;
 	mode_t *set;
 	mode_t newmode;
@@ -296,23 +297,18 @@
 
 	oldmode = umask(newmode);
 
-	tcl_mask = malloc(stringlen); /* 3 digits & \0 */
+	tcl_mask = calloc(1, stringlen); /* 4 digits & \0 */
 	if (!tcl_mask) {
 		return TCL_ERROR;
 	}
 
 	/* Totally gross and cool */
-	p = tcl_mask + stringlen;
-	*p = '\0';
+	p = tcl_mask + stringlen - 1;
 	for (i = stringlen - 1; i > 0; i--) {
 		p--;
 		*p = (oldmode & 7) + '0';
 		oldmode >>= 3;
 	}
-	if (*p != '0') {
-		p--;
-		*p = '0';
-	}
 
 	tcl_result = Tcl_NewStringObj(p, -1);
 	free(tcl_mask);

Modified: branches/new-help-system/base/src/pextlib1.0/curl.c
===================================================================
--- branches/new-help-system/base/src/pextlib1.0/curl.c	2010-07-16 23:53:45 UTC (rev 69809)
+++ branches/new-help-system/base/src/pextlib1.0/curl.c	2010-07-17 00:51:07 UTC (rev 69810)
@@ -253,6 +253,13 @@
 			break;
 		}
 
+		/* echo any cookies received on a redirect */
+		theCurlCode = curl_easy_setopt(theHandle, CURLOPT_COOKIEJAR, "/dev/null");
+		if (theCurlCode != CURLE_OK) {
+			theResult = SetResultFromCurlErrorCode(interp, theCurlCode);
+			break;
+		}
+
 		/* -f option */
 		theCurlCode = curl_easy_setopt(theHandle, CURLOPT_FAILONERROR, 1);
 		if (theCurlCode != CURLE_OK) {
@@ -391,7 +398,7 @@
 
 		if (remotetime) {
 			theCurlCode = curl_easy_getinfo(theHandle, CURLINFO_FILETIME, &theFileTime);
-			if (theFileTime > 0) {
+			if (theCurlCode == CURLE_OK && theFileTime > 0) {
 				struct utimbuf times;
 				times.actime = (time_t)theFileTime;
 				times.modtime = (time_t)theFileTime;
@@ -499,6 +506,13 @@
 			break;
 		}
 
+		/* echo any cookies received on a redirect */
+		theCurlCode = curl_easy_setopt(theHandle, CURLOPT_COOKIEJAR, "/dev/null");
+		if (theCurlCode != CURLE_OK) {
+			theResult = SetResultFromCurlErrorCode(interp, theCurlCode);
+			break;
+		}
+
 		/* -f option */
 		theCurlCode = curl_easy_setopt(theHandle, CURLOPT_FAILONERROR, 1);
 		if (theCurlCode != CURLE_OK) {
@@ -680,6 +694,13 @@
 			break;
 		}
 
+		/* echo any cookies received on a redirect */
+		theCurlCode = curl_easy_setopt(theHandle, CURLOPT_COOKIEJAR, "/dev/null");
+		if (theCurlCode != CURLE_OK) {
+			theResult = SetResultFromCurlErrorCode(interp, theCurlCode);
+			break;
+		}
+
 		/* -f option */
 		theCurlCode = curl_easy_setopt(theHandle, CURLOPT_FAILONERROR, 1);
 		if (theCurlCode != CURLE_OK) {


Property changes on: branches/new-help-system/base/src/pextlib1.0/sha2.c
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/gsoc08-privileges/base/src/pextlib1.0/sha2.c:37343-46937
/branches/universal-sanity/base/src/pextlib1.0/sha2.c:51872-52323
/branches/variant-descs-14482/base/src/pextlib1.0/sha2.c:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
/users/perry/base-bugs_and_notes/src/pextlib1.0/sha2.c:45682-46060
/users/perry/base-select/src/pextlib1.0/sha2.c:44044-44692
   + /branches/gsoc08-privileges/base/src/pextlib1.0/sha2.c:37343-46937
/branches/universal-sanity/base/src/pextlib1.0/sha2.c:51872-52323
/branches/variant-descs-14482/base/src/pextlib1.0/sha2.c:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
/trunk/base/src/pextlib1.0/sha2.c:57889-69809
/users/perry/base-bugs_and_notes/src/pextlib1.0/sha2.c:45682-46060
/users/perry/base-select/src/pextlib1.0/sha2.c:44044-44692


Property changes on: branches/new-help-system/base/src/pextlib1.0/sha2.h
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/gsoc08-privileges/base/src/pextlib1.0/sha2.h:37343-46937
/branches/universal-sanity/base/src/pextlib1.0/sha2.h:51872-52323
/branches/variant-descs-14482/base/src/pextlib1.0/sha2.h:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
/users/perry/base-bugs_and_notes/src/pextlib1.0/sha2.h:45682-46060
/users/perry/base-select/src/pextlib1.0/sha2.h:44044-44692
   + /branches/gsoc08-privileges/base/src/pextlib1.0/sha2.h:37343-46937
/branches/universal-sanity/base/src/pextlib1.0/sha2.h:51872-52323
/branches/variant-descs-14482/base/src/pextlib1.0/sha2.h:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
/trunk/base/src/pextlib1.0/sha2.h:57889-69809
/users/perry/base-bugs_and_notes/src/pextlib1.0/sha2.h:45682-46060
/users/perry/base-select/src/pextlib1.0/sha2.h:44044-44692


Property changes on: branches/new-help-system/base/src/pextlib1.0/sha256cmd.c
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/gsoc08-privileges/base/src/pextlib1.0/rmd160cmd.c:37343-46937
/branches/gsoc09-logging/base/src/pextlib1.0/sha256cmd.c:51231-60371
/branches/universal-sanity/base/src/pextlib1.0/rmd160cmd.c:51872-52323
/branches/variant-descs-14482/base/src/pextlib1.0/rmd160cmd.c:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
/users/perry/base-bugs_and_notes/src/pextlib1.0/rmd160cmd.c:45682-46060
/users/perry/base-select/src/pextlib1.0/rmd160cmd.c:44044-44692
   + /branches/gsoc08-privileges/base/src/pextlib1.0/rmd160cmd.c:37343-46937
/branches/gsoc09-logging/base/src/pextlib1.0/sha256cmd.c:51231-60371
/branches/universal-sanity/base/src/pextlib1.0/rmd160cmd.c:51872-52323
/branches/variant-descs-14482/base/src/pextlib1.0/rmd160cmd.c:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
/trunk/base/src/pextlib1.0/sha256cmd.c:57889-69809
/users/perry/base-bugs_and_notes/src/pextlib1.0/rmd160cmd.c:45682-46060
/users/perry/base-select/src/pextlib1.0/rmd160cmd.c:44044-44692


Property changes on: branches/new-help-system/base/src/pextlib1.0/sha256cmd.h
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/gsoc08-privileges/base/src/pextlib1.0/rmd160cmd.h:37343-46937
/branches/gsoc09-logging/base/src/pextlib1.0/sha256cmd.h:51231-60371
/branches/universal-sanity/base/src/pextlib1.0/rmd160cmd.h:51872-52323
/branches/variant-descs-14482/base/src/pextlib1.0/rmd160cmd.h:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
/users/perry/base-bugs_and_notes/src/pextlib1.0/rmd160cmd.h:45682-46060
/users/perry/base-select/src/pextlib1.0/rmd160cmd.h:44044-44692
   + /branches/gsoc08-privileges/base/src/pextlib1.0/rmd160cmd.h:37343-46937
/branches/gsoc09-logging/base/src/pextlib1.0/sha256cmd.h:51231-60371
/branches/universal-sanity/base/src/pextlib1.0/rmd160cmd.h:51872-52323
/branches/variant-descs-14482/base/src/pextlib1.0/rmd160cmd.h:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
/trunk/base/src/pextlib1.0/sha256cmd.h:57889-69809
/users/perry/base-bugs_and_notes/src/pextlib1.0/rmd160cmd.h:45682-46060
/users/perry/base-select/src/pextlib1.0/rmd160cmd.h:44044-44692

Modified: branches/new-help-system/base/src/pextlib1.0/strsed.c
===================================================================
--- branches/new-help-system/base/src/pextlib1.0/strsed.c	2010-07-16 23:53:45 UTC (rev 69809)
+++ branches/new-help-system/base/src/pextlib1.0/strsed.c	2010-07-17 00:51:07 UTC (rev 69810)
@@ -592,6 +592,12 @@
      */
 
     do {
+#ifdef HS_REGEX
+	    /* XXX Not even trying to use custom memory routines */
+	    if (!(exp_regs = calloc(str_len, sizeof(regmatch_t)))) {
+		return 0;
+	    }
+#endif
 	if (match_all){
 	    /* Fake a match instead of calling re_search() or regexec(). */
 	    match = 1;
@@ -605,10 +611,6 @@
 	    match = re_search(&re_comp_buf, str, str_len, 0, str_len, &regs);
 #endif
 #ifdef HS_REGEX
-	    /* XXX Not even trying to use custom memory routines */
-	    if (!(exp_regs = calloc(str_len, sizeof(regmatch_t)))) {
-		return 0;
-	    }
 	    match = regexec(&exp, str, str_len, exp_regs, 0) ? NO_MATCH : 1;
 #endif
 	}

Modified: branches/new-help-system/base/src/pextlib1.0/tracelib.c
===================================================================
--- branches/new-help-system/base/src/pextlib1.0/tracelib.c	2010-07-16 23:53:45 UTC (rev 69809)
+++ branches/new-help-system/base/src/pextlib1.0/tracelib.c	2010-07-17 00:51:07 UTC (rev 69810)
@@ -272,13 +272,13 @@
 			append_allow("/bin", 0);
 			append_allow("/sbin", 0);
 			append_allow("/dev", 0);
-			append_allow(Tcl_GetVar(interp, "macports::prefix", TCL_GLOBAL_ONLY), 2);
+			append_allow(Tcl_GetVar(interp, "prefix", TCL_GLOBAL_ONLY), 2);
 			/* If there is no SDK we will allow everything in /usr /System/Library etc, else add binaries to allow, and redirect root to SDK. */
 			if(sdk&&*sdk)
 			{
 				char buf[260];
 				buf[0] = '\0';
-				strlcat(buf, Tcl_GetVar(interp, "macports::developer_dir", TCL_GLOBAL_ONLY), 260);
+				strlcat(buf, Tcl_GetVar(interp, "developer_dir", TCL_GLOBAL_ONLY), 260);
 				strlcat(buf, "/SDKs/", 260);
 				strlcat(buf, sdk, 260);
 			
@@ -294,7 +294,7 @@
 				append_allow("/usr", 0);
 				append_allow("/System/Library", 0);
 				append_allow("/Library", 0);
-				append_allow(Tcl_GetVar(interp, "macports::developer_dir", TCL_GLOBAL_ONLY), 0);
+				append_allow(Tcl_GetVar(interp, "developer_dir", TCL_GLOBAL_ONLY), 0);
 			}
 		}else
 			append_allow("/", 0);
@@ -394,12 +394,9 @@
 	va_end(va);
 }
 
-static int TracelibRunCmd(Tcl_Interp * in)
+static int TracelibOpenSocketCmd(Tcl_Interp * in)
 {
 	struct sockaddr_un sun;
-	fd_set fdr;
-	int i;
-	int max_fd, max_used, socks[MAX_SOCKETS];
 	struct rlimit rl;
 	
 	pthread_mutex_lock(&sock_mutex);
@@ -446,6 +443,17 @@
 		Tcl_AppendResult(interp, "listen: ", (char *) Tcl_PosixError(interp), NULL);
 		return TCL_ERROR;
 	}
+
+        return TCL_OK;
+}
+
+
+static int TracelibRunCmd(Tcl_Interp * in UNUSED)
+{
+	int max_fd, max_used, socks[MAX_SOCKETS];
+	fd_set fdr;
+	int i;
+
 	max_used=0;
 	max_fd=sock;
 	
@@ -607,10 +615,11 @@
 int TracelibCmd(ClientData clientData UNUSED, Tcl_Interp* interp, int objc, Tcl_Obj* CONST objv[])
 {
 	int result=TCL_OK;
-	static const char * options[]={"setname", "run", "clean", "setsandbox", "closesocket", "setdeps", "enablefence", 0};
+	static const char * options[]={"setname", "opensocket", "run", "clean", "setsandbox", "closesocket", "setdeps", "enablefence", 0};
 	typedef enum 
 	{
 		kSetName,
+		kOpenSocket,
 		kRun,
 		kClean,
 		kSetSandbox,
@@ -635,6 +644,9 @@
 		case kSetName:
 			result=TracelibSetNameCmd(interp, objc, objv);
 			break;
+		case kOpenSocket:
+			result=TracelibOpenSocketCmd(interp);
+			break;
 		case kRun:
 			result=TracelibRunCmd(interp);
 			break;

Modified: branches/new-help-system/base/src/pextlib1.0/xinstall.c
===================================================================
--- branches/new-help-system/base/src/pextlib1.0/xinstall.c	2010-07-16 23:53:45 UTC (rev 69809)
+++ branches/new-help-system/base/src/pextlib1.0/xinstall.c	2010-07-17 00:51:07 UTC (rev 69810)
@@ -146,7 +146,7 @@
 {
 	struct stat from_sb, to_sb;
 	mode_t *set;
-	u_long fset;
+	u_long fset = 0;
 	int no_target, rval;
 	u_int iflags;
 	char *flags, *curdir;
@@ -1026,6 +1026,7 @@
 		if (wait(&status) == -1 || status) {
 			serrno = errno;
 			(void)unlink(to_name);
+			errno = serrno;
 			return;
 		}
 	}

Modified: branches/new-help-system/base/src/port/Makefile
===================================================================
--- branches/new-help-system/base/src/port/Makefile	2010-07-16 23:53:45 UTC (rev 69809)
+++ branches/new-help-system/base/src/port/Makefile	2010-07-17 00:51:07 UTC (rev 69810)
@@ -14,15 +14,12 @@
 
 portmirror: portmirror.tcl ../../Mk/macports.autoconf.mk
 	${edit} portmirror.tcl > $@
-	chmod +x $@
 
 portindex: portindex.tcl ../../Mk/macports.autoconf.mk
 	${edit} portindex.tcl > $@
-	chmod +x $@
 
 port: port.tcl ../../Mk/macports.autoconf.mk
 	${edit} port.tcl > $@
-	chmod +x $@
 
 mkdirs:
 	cat ../../doc/prefix.mtree | $(MTREE) -U -d -e -p ${INSTALLDIR} > /dev/null

Modified: branches/new-help-system/base/src/port/port-help.tcl
===================================================================
--- branches/new-help-system/base/src/port/port-help.tcl	2010-07-16 23:53:45 UTC (rev 69809)
+++ branches/new-help-system/base/src/port/port-help.tcl	2010-07-17 00:51:07 UTC (rev 69810)
@@ -85,7 +85,13 @@
 }
 
 set porthelp(deps) {
-This action is an alias for 'info --pretty --fullname --depends'
+Display a dependency listing for the given ports
+
+--index         Do not read the Portfile, instead rely solely on the PortIndex
+                information. Note this option will prevent the dependencies
+                reported from reflecting the effects of any variants specified.
+--no-build      Exclude dependencies only required at build time, i.e.
+                depends_fetch, depends_extract, and depends_build.
 }
 
 set porthelp(rdeps) {
@@ -162,7 +168,7 @@
 }
 
 set porthelp(help) {
-Displays short help texts for the given commands
+Displays short help texts for the given actions
 }
 
 set porthelp(info) {
@@ -268,7 +274,7 @@
 specifying any version.
 
 One example is the set of python ports, where there are (among others)
-python25, python26, and python30.  The select command lets you set which
+python25, python26, and python30.  The select action lets you set which
 of these becomes the version run when you simply use 'python'.
 
 <arguments> must include the group upon which to be acted, and may include

Modified: branches/new-help-system/base/src/port/port.tcl
===================================================================
--- branches/new-help-system/base/src/port/port.tcl	2010-07-16 23:53:45 UTC (rev 69809)
+++ branches/new-help-system/base/src/port/port.tcl	2010-07-17 00:51:07 UTC (rev 69810)
@@ -34,14 +34,8 @@
 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 # POSSIBILITY OF SUCH DAMAGE.
 
-if {([file tail [pwd]] == "src" && [file exists [set dir macports1.0]/macports_fastload.tcl])
-        || ([file tail [pwd]] == "base" && [file exists [set dir src/macports1.0]/macports_fastload.tcl])} {
-    # developer mode, source packages from current directory
-    source [file join $dir macports_fastload.tcl]
-} else {
-    source [file join "@macports_tcl_dir@" macports1.0 macports_fastload.tcl]
-}
-
+catch {source \
+    [file join "@macports_tcl_dir@" macports1.0 macports_fastload.tcl]}
 package require macports
 package require Pextlib 1.0
 
@@ -84,7 +78,7 @@
         set cmds "$cmds$new"
     }
 
-    set cmdText "Supported commands
+    set cmdText "Supported actions
 ------------------
 $cmds
 "
@@ -190,9 +184,7 @@
 
 # show the URL for the ticket reporting instructions
 proc print_tickets_url {args} {
-    if {![macports::ui_isset ports_quiet]} {
-        ui_msg "To report a bug, see <http://guide.macports.org/#project.tickets>"
-    }
+    ui_notice "To report a bug, see <http://guide.macports.org/#project.tickets>"
 }
 
 # Form a composite version as is sometimes used for registry functions
@@ -267,9 +259,7 @@
     if { [llength $ilist] > 1 } {
         # set portname again since the one we were passed may not have had the correct case
         set portname [lindex [lindex $ilist 0] 0]
-        if {![macports::ui_isset ports_quiet] && [isatty stdout]} {
-            puts "The following versions of $portname are currently installed:"
-        }
+        ui_notice "The following versions of $portname are currently installed:"
         foreach i [portlist_sortint $ilist] { 
             set iname [lindex $i 0]
             set iversion [lindex $i 1]
@@ -277,9 +267,9 @@
             set ivariants [lindex $i 3]
             set iactive [lindex $i 4]
             if { $iactive == 0 } {
-                puts "  $iname ${iversion}_${irevision}${ivariants}"
+                puts "  $iname @${iversion}_${irevision}${ivariants}"
             } elseif { $iactive == 1 } {
-                puts "  $iname ${iversion}_${irevision}${ivariants} (active)"
+                puts "  $iname @${iversion}_${irevision}${ivariants} (active)"
             }
         }
         return -code error "Registry error: Please specify the full version as recorded in the port registry."
@@ -423,9 +413,12 @@
 proc portlist_compare { a b } {
     array set a_ $a
     array set b_ $b
-    set namecmp [string compare -nocase $a_(name) $b_(name)]
-    if {$namecmp != 0} {
-        return $namecmp
+    set namecmp [string equal -nocase $a_(name) $b_(name)]
+    if {$namecmp != 1} {
+        if {$a_(name) eq [lindex [lsort -dictionary [list $a_(name) $b_(name)]] 0]} {
+            return -1
+        }
+        return 1
     }
     set avr_ [split $a_(version) "_"]
     set bvr_ [split $b_(version) "_"]
@@ -731,9 +724,6 @@
     # Now process the list, keeping only those ports that are outdated
     set results {}
     if { [llength $ilist] > 0 } {
-        global tcl_platform
-        set os_platform [string tolower $tcl_platform(os)]
-        set os_major [lindex [split $tcl_platform(osVersion) .] 0]
         foreach i $ilist {
 
             # Get information about the installed port
@@ -789,7 +779,7 @@
                 set os_major_installed [registry::property_retrieve $regref os_major]
                 if {$os_platform_installed != "" && $os_platform_installed != 0
                     && $os_major_installed != "" && $os_major_installed != 0
-                    && ($os_platform_installed != $os_platform || $os_major_installed != $os_major)} {
+                    && ($os_platform_installed != ${macports::os_platform} || $os_major_installed != ${macports::os_major})} {
                     set comp_result -1
                 }
             }
@@ -801,7 +791,7 @@
         }
     }
 
-    return $results
+    return [portlist_sort $results]
 }
 
 
@@ -871,6 +861,7 @@
             fatal "port installed failed: $result"
         }
     }
+    registry::open_dep_map
     set results {}
     foreach i $ilist {
         set iname [lindex $i 0]
@@ -2111,9 +2102,7 @@
         set ref [registry::open_entry $portname $version $revision $variants $epoch]
         if { [string equal [registry::property_retrieve $ref installtype] "image"] } {
             set imagedir [registry::property_retrieve $ref imagedir]
-            if {![macports::ui_isset ports_quiet]} {
-                puts "Port $portname ${version}_${revision}${variants} is installed as an image in:"
-            }
+            ui_notice "Port $portname ${version}_${revision}${variants} is installed as an image in:"
             puts $imagedir
         } else {
             break_softcontinue "Port $portname is not installed as an image." 1 status
@@ -2181,13 +2170,13 @@
         set portname $portinfo(name)
 
         # Display the notes.
-        if {![macports::ui_isset ports_quiet]} {
-            if {$portnotes ne {}} {
-                puts "$portname has the following notes:"
-                puts [wrap $portnotes 0 "  " 1]
-            } else {
-                puts "$portname has no notes."
+        if {$portnotes ne {}} {
+            ui_notice "$portname has the following notes:"
+            foreach note $portnotes {
+                puts [wrap $note 0 "  " 1]
             }
+        } else {
+            puts "$portname has no notes."
         }
     }
     return $status
@@ -2240,7 +2229,7 @@
 
             set i [lindex $ilist 0]
             set regref [registry::entry open $portname [lindex $i 1] [lindex $i 2] [lindex $i 3] [lindex $i 5]]
-            if {[registry::run_target $regref activate [array get options]]} {
+            if {[$regref installtype] == "image" && [registry::run_target $regref activate [array get options]]} {
                 continue
             }
         }
@@ -2277,7 +2266,7 @@
             set ivariants [lindex $i 3]
             if {$composite_version == "" || $composite_version == "${iversion}_${irevision}${ivariants}"} {
                 set regref [registry::entry open $portname $iversion $irevision $ivariants [lindex $i 5]]
-                if {[registry::run_target $regref deactivate [array get options]]} {
+                if {[$regref installtype] == "image" && [registry::run_target $regref deactivate [array get options]]} {
                     continue
                 }
             }
@@ -2316,11 +2305,11 @@
                          "one argument was specified.  Defaulting to the " \
                          "'set' command..."]
     # If no command (--set, --show, --list) is specified *and* less than two
-    # argument are specified, default to the show command.
+    # argument are specified, default to the list command.
     } elseif {[llength $commands] < 1} {
-        set command show
+        set command list
         ui_debug [concat "No command was specified. Defaulting to the " \
-                         "'show' command..."]
+                         "'list' command..."]
     # Only allow one command to be specified at a time.
     } elseif {[llength $commands] > 1} {
         ui_error [concat "Multiple commands were specified. Only one " \
@@ -2350,17 +2339,13 @@
                 return 1
             }
 
-            if {![macports::ui_isset ports_quiet] && [isatty stdout]} {
-                puts "Available versions for $group:"
-            }
+            ui_notice "Available versions for $group:"
             foreach v $versions {
-                if {![macports::ui_isset ports_quiet] && [isatty stdout]} {
-                    puts -nonewline "\t"
-                }
+                ui_notice -nonewline "\t"
                 if {$selected_version == $v} {
-                    puts "$v (active)"
+                    ui_msg "$v (active)"
                 } else {
-                    puts "$v"
+                    ui_msg "$v"
                 }
             }
             return 0
@@ -2377,12 +2362,12 @@
             }
             set version [lindex $portlist 1]
 
-            puts -nonewline "Selecting '$version' for '$group' "
+            ui_msg -nonewline "Selecting '$version' for '$group' "
             if {[catch {mportselect $command $group $version} result]} {
-                puts "failed: $result"
+                ui_msg "failed: $result"
                 return 1
             }
-            puts "succeeded. '$version' is now active."
+            ui_msg "succeeded. '$version' is now active."
             return 0
         }
         show {
@@ -2425,6 +2410,7 @@
 
 
 proc action_setrequested { action portlist opts } {
+    global macports::registry.format
     set status 0
     if {[require_portlist portlist]} {
         return 1
@@ -2433,11 +2419,14 @@
     set val [string equal $action setrequested]
     foreachport $portlist {
         set composite_version [composite_version $portversion [array get variations]]
-        if {![catch {set ilist [registry::installed $portname $composite_version]}]} {
+        if {![catch {set ilist [registry::installed $portname $composite_version]} result]} {
             ui_info "Setting requested flag for $portname to $val"
             foreach i $ilist {
-                set regref [registry::entry open $portname [lindex $i 1] [lindex $i 2] [lindex $i 3] [lindex $i 5]]
+                set regref [registry::open_entry $portname [lindex $i 1] [lindex $i 2] [lindex $i 3] [lindex $i 5]]
                 registry::property_store $regref requested $val
+                if {${macports::registry.format} != "receipt_sqlite"} {
+                    registry::write_entry $regref
+                }
             }
         } else {
             global errorInfo
@@ -2481,16 +2470,7 @@
 
 
 proc action_platform { action portlist opts } {
-#   global os.platform os.major os.arch 
-    global tcl_platform
-    set os_platform [string tolower $tcl_platform(os)]
-    set os_version $tcl_platform(osVersion)
-    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" }
-    set os_major [lindex [split $tcl_platform(osVersion) .] 0]
-#   puts "Platform: ${os.platform} ${os.major} ${os.arch}"
-    puts "Platform: ${os_platform} ${os_major} ${os_arch}"
+    puts "Platform: ${macports::os_platform} ${macports::os_major} ${macports::os_arch}"
     return 0
 }
 
@@ -2556,7 +2536,7 @@
                 set portstack [list $toplist]
                 set pos_stack [list 0]
                 array unset seen
-                ui_msg "The following ports are dependent on ${portname}:"
+                ui_notice "The following ports are dependent on ${portname}:"
                 while 1 {
                     set cur_portlist [lindex $portstack end]
                     set cur_pos [lindex $pos_stack end]
@@ -2590,7 +2570,7 @@
                 foreach dep $deplist {
                     set depport [lindex $dep 2]
                     if {[macports::ui_isset ports_quiet]} {
-                        puts "$depport"
+                        ui_msg "$depport"
                     } elseif {![macports::ui_isset ports_verbose]} {
                         ui_msg "$depport depends on $portname"
                     } else {
@@ -2599,22 +2579,23 @@
                 }
             }
         } else {
-            ui_msg "$portname has no dependents."
+            ui_notice "$portname has no dependents."
         }
     }
     return $status
 }
 
 
-proc action_rdeps { action portlist opts } {
+proc action_deps { action portlist opts } {
     global global_variations
     set status 0
     if {[require_portlist portlist]} {
         return 1
     }
+    set separator ""
 
     foreachport $portlist {
-        if {[info exists options(ports_rdeps_no-build)] && [string is true -strict $options(ports_rdeps_no-build)]} {
+        if {[info exists options(ports_${action}_no-build)] && [string is true -strict $options(ports_${action}_no-build)]} {
             set deptypes {depends_lib depends_run}
         } else {
             set deptypes {depends_fetch depends_extract depends_build depends_lib depends_run}
@@ -2654,7 +2635,7 @@
             array set portinfo [lindex $result 1]
         }
 
-        if {!([info exists options(ports_rdeps_index)] && $options(ports_rdeps_index) eq "yes")} {
+        if {!([info exists options(ports_${action}_index)] && $options(ports_${action}_index) eq "yes")} {
             # Add any global_variations to the variations
             # specified for the port, so we get dependencies right
             array unset merged_variations
@@ -2672,20 +2653,56 @@
             array set portinfo [mportinfo $mport]
             mportclose $mport
         } elseif {![info exists portinfo]} {
-            ui_warn "port rdeps --index does not work with the 'current' pseudo-port"
+            ui_warn "port ${action} --index does not work with the 'current' pseudo-port"
             continue
         }
+        set portname $portinfo(name)
 
         set deplist {}
+        set deps_output {}
+        set ndeps 0
+        array set labeldict {depends_fetch Fetch depends_extract Extract depends_build Build depends_lib Library depends_run Runtime}
         # get list of direct deps
         foreach type $deptypes {
             if {[info exists portinfo($type)]} {
-                foreach dep $portinfo($type) {
-                    lappend deplist $dep
+                if {$action == "rdeps" || [macports::ui_isset ports_verbose]} {
+                    foreach dep $portinfo($type) {
+                        lappend deplist $dep
+                    }
+                } else {
+                    foreach dep $portinfo($type) {
+                        lappend deplist [lindex [split $dep :] end]
+                    }
                 }
+                if {$action == "deps"} {
+                    set label "$labeldict($type) Dependencies"
+                    lappend deps_output [wraplabel $label [join $deplist ", "] 0 [string repeat " " 22]]
+                    incr ndeps [llength $deplist]
+                    set deplist {}
+                }
             }
         }
 
+        set version $portinfo(version)
+        set revision $portinfo(revision)
+        if {[info exists portinfo(canonical_active_variants)]} {
+            set variants $portinfo(canonical_active_variants)
+        } else {
+            set variants {}
+        }
+
+        puts -nonewline $separator
+        if {$action == "deps"} {
+            if {$ndeps == 0} {
+                ui_notice "$portname @${version}_${revision}${variants} has no dependencies."
+            } else {
+                ui_notice "Full Name: $portname @${version}_${revision}${variants}"
+                puts [join $deps_output "\n"]
+            }
+            set separator "--\n"
+            continue
+        }
+
         set toplist $deplist
         # gather all the deps
         while 1 {
@@ -2708,7 +2725,7 @@
                     set porturl $portinfo(porturl)
                     
                     # open the portfile if requested
-                    if {!([info exists options(ports_rdeps_index)] && $options(ports_rdeps_index) eq "yes")} {
+                    if {!([info exists options(ports_${action}_index)] && $options(ports_${action}_index) eq "yes")} {
                         if {[catch {set mport [mportopen $porturl [array get options] [array get merged_variations]]} result]} {
                             ui_debug "$::errorInfo"
                             break_softcontinue "Unable to open port: $result" 1 status
@@ -2741,9 +2758,9 @@
         set pos_stack [list 0]
         array unset seen
         if {[llength $toplist] > 0} {
-            ui_msg "The following ports are dependencies of ${portname}:"
+            ui_notice "The following ports are dependencies of $portname @${version}_${revision}${variants}:"
         } else {
-            ui_msg "No ports are dependencies of ${portname}."
+            ui_notice "$portname @${version}_${revision}${variants} has no dependencies."
         }
         while 1 {
             set cur_portlist [lindex $portstack end]
@@ -2760,7 +2777,7 @@
             set cur_port [lindex $cur_portlist $cur_pos]
             set cur_portname [lindex [split $cur_port :] end]
             set spaces [string repeat " " [expr {[llength $pos_stack] * 2}]]
-            if {![info exists seen($cur_portname)] || ([info exists options(ports_rdeps_full)] && [string is true -strict $options(ports_rdeps_full)])} {
+            if {![info exists seen($cur_portname)] || ([info exists options(ports_${action}_full)] && [string is true -strict $options(ports_${action}_full)])} {
                 if {[macports::ui_isset ports_verbose]} {
                     puts "${spaces}${cur_port}"
                 } else {
@@ -2778,6 +2795,7 @@
             incr cur_pos
             set pos_stack [lreplace $pos_stack end end $cur_pos]
         }
+        set separator "--\n"
     }
     return $status
 }
@@ -2856,29 +2874,41 @@
         }
     }
     if { [llength $ilist] > 0 } {
-        if {![macports::ui_isset ports_quiet]} {
-            puts "The following ports are currently installed:"
-        }
+        ui_notice "The following ports are currently installed:"
         foreach i [portlist_sortint $ilist] {
             set iname [lindex $i 0]
             set iversion [lindex $i 1]
             set irevision [lindex $i 2]
             set ivariants [lindex $i 3]
             set iactive [lindex $i 4]
+            set extra ""
+            set nvariants ""
+            if {[macports::ui_isset ports_verbose]} {
+                set regref [registry::open_entry $iname $iversion $irevision $ivariants [lindex $i 5]]
+                set nvariants [registry::property_retrieve $regref negated_variants]
+                if {$nvariants == 0} {
+                    set nvariants ""
+                }
+                set os_platform [registry::property_retrieve $regref os_platform]
+                set os_major [registry::property_retrieve $regref os_major]
+                set archs [registry::property_retrieve $regref archs]
+                if {$os_platform != 0 && $os_platform != "" && $os_major != 0 && $os_major != ""} {
+                    append extra " platform='$os_platform $os_major'"
+                }
+                if {$archs != 0 && $archs != ""} {
+                    append extra " archs='$archs'"
+                }
+            }
             if { $iactive == 0 } {
-                puts "  $iname @${iversion}_${irevision}${ivariants}"
+                puts "  $iname @${iversion}_${irevision}${ivariants}${nvariants}${extra}"
             } elseif { $iactive == 1 } {
-                puts "  $iname @${iversion}_${irevision}${ivariants} (active)"
+                puts "  $iname @${iversion}_${irevision}${ivariants}${nvariants} (active)${extra}"
             }
         }
     } elseif { $restrictedList } {
-        if {![macports::ui_isset ports_quiet]} {
-            puts "None of the specified ports are installed."
-        }
+        ui_notice "None of the specified ports are installed."
     } else {
-        if {![macports::ui_isset ports_quiet]} {
-            puts "No ports are installed."
-        }
+        ui_notice "No ports are installed."
     }
 
     return $status
@@ -2921,10 +2951,7 @@
 
     set num_outdated 0
     if { [llength $ilist] > 0 } {
-        global tcl_platform
-        set os_platform [string tolower $tcl_platform(os)]
-        set os_major [lindex [split $tcl_platform(osVersion) .] 0]
-        foreach i $ilist {
+        foreach i [portlist_sortint $ilist] {
         
             # Get information about the installed port
             set portname [lindex $i 0]
@@ -2976,18 +3003,20 @@
                 set comp_result [rpm-vercomp $installed_revision $latest_revision]
             }
             set reason ""
-            if {$comp_result == 0 && $epoch_comp_result != 0} {
-                set reason { (epoch $installed_epoch $relation $latest_epoch)}
+            if {$epoch_comp_result != 0} {
+                if {($comp_result >= 0 && $epoch_comp_result < 0) || ($comp_result <= 0 && $epoch_comp_result > 0)} {
+                    set reason { (epoch $installed_epoch $relation $latest_epoch)}
+                }
                 set comp_result $epoch_comp_result
-            } elseif {$comp_result == 0 && $epoch_comp_result == 0} {
+            } elseif {$comp_result == 0} {
                 set regref [registry::open_entry $portname $installed_version $installed_revision [lindex $i 3] $installed_epoch]
                 set os_platform_installed [registry::property_retrieve $regref os_platform]
                 set os_major_installed [registry::property_retrieve $regref os_major]
                 if {$os_platform_installed != "" && $os_platform_installed != 0
                     && $os_major_installed != "" && $os_major_installed != 0
-                    && ($os_platform_installed != $os_platform || $os_major_installed != $os_major)} {
+                    && ($os_platform_installed != ${macports::os_platform} || $os_major_installed != ${macports::os_major})} {
                     set comp_result -1
-                    set reason { (platform $os_platform_installed $os_major_installed != $os_platform $os_major)}
+                    set reason { (platform $os_platform_installed $os_major_installed != ${macports::os_platform} ${macports::os_major})}
                 }
             }
             
@@ -3006,8 +3035,8 @@
                 # Emit information
                 if {$comp_result < 0 || [macports::ui_isset ports_verbose]} {
                 
-                    if { $num_outdated == 0 && ![macports::ui_isset ports_quiet]} {
-                        puts "The following installed ports are outdated:"
+                    if {$num_outdated == 0} {
+                        ui_notice "The following installed ports are outdated:"
                     }
                     incr num_outdated
 
@@ -3017,17 +3046,13 @@
             }
         }
         
-        if { $num_outdated == 0 && ![macports::ui_isset ports_quiet]} {
-            puts "No installed ports are outdated."
+        if {$num_outdated == 0} {
+            ui_notice "No installed ports are outdated."
         }
     } elseif { $restrictedList } {
-        if {![macports::ui_isset ports_quiet]} {
-            puts "None of the specified ports are outdated."
-        }
+        ui_notice "None of the specified ports are outdated."
     } else {
-        if {![macports::ui_isset ports_quiet]} {
-            puts "No ports are installed."
-        }
+        ui_notice "No ports are installed."
     }
     
     return $status
@@ -3047,21 +3072,15 @@
         set files [registry::port_registered $portname]
         if { $files != 0 } {
             if { [llength $files] > 0 } {
-                if {![macports::ui_isset ports_quiet]} {
-                    puts "Port $portname contains:"
-                }
+                ui_notice "Port $portname contains:"
                 foreach file $files {
                     puts "  $file"
                 }
             } else {
-                if {![macports::ui_isset ports_quiet]} {
-                    puts "Port $portname does not contain any files or is not active."
-                }
+                ui_notice "Port $portname does not contain any files or is not active."
             }
         } else {
-            if {![macports::ui_isset ports_quiet]} {
-                puts "Port $portname is not installed."
-            }
+            ui_notice "Port $portname is not installed."
         }
     }
     registry::close_file_map
@@ -3115,9 +3134,7 @@
 
         # if this fails the port doesn't have any variants
         if {![info exists portinfo(variants)]} {
-            if {![macports::ui_isset ports_quiet]} {
-                puts "$portname has no variants"
-            }
+            ui_notice "$portname has no variants"
         } else {
             array unset vinfo
             # Use the new format if it exists.
@@ -3129,9 +3146,7 @@
             }
 
             # print out all the variants
-            if {![macports::ui_isset ports_quiet]} {
-                puts "$portname has the variants:"
-            }
+            ui_notice "$portname has the variants:"
             foreach v [lsort $portinfo(variants)] {
                 unset -nocomplain vconflicts vdescription vrequires
                 # Retrieve variants' information from the new format.
@@ -3317,14 +3332,11 @@
             set portfound 1
         }
         if { !$portfound } {
-            if {![macports::ui_isset ports_quiet]} {
-                ui_msg "No match for $portname found"
-            }
+            ui_notice "No match for $portname found"
         } elseif {[llength $res] > 1} {
             if {(![info exists global_options(ports_search_line)]
-                    || $global_options(ports_search_line) != "yes")
-                    && ![macports::ui_isset ports_quiet]} {
-                ui_msg "\nFound [llength $res] ports."
+                    || $global_options(ports_search_line) != "yes")} {
+                ui_notice "\nFound [llength $res] ports."
             }
         }
 
@@ -3456,7 +3468,11 @@
                     # We need it to evaluate the editor, and the editor
                     # may want stuff from it as well, like TERM.
                     array unset env_save; array set env_save [array get env]
-                    array unset env *; unsetenv *; array set env [array get boot_env]
+                    array unset env *
+                    if {${macports::macosx_version} == "10.5"} {
+                        unsetenv *
+                    }
+                    array set env [array get boot_env]
                     
                     # Find an editor to edit the portfile
                     set editor ""
@@ -3482,7 +3498,11 @@
                     }
                     
                     # Restore internal MacPorts environment
-                    array unset env *; unsetenv *; array set env [array get env_save]
+                    array unset env *
+                    if {${macports::macosx_version} == "10.5"} {
+                        unsetenv *
+                    }
+                    array set env [array get env_save]
                 }
 
                 dir {
@@ -3573,7 +3593,6 @@
     if {[require_portlist portlist]} {
         return 1
     }
-    set target $action
     foreachport $portlist {
         # If we have a url, use that, since it's most specific
         # otherwise try to map the portname to a url
@@ -3618,8 +3637,12 @@
             set options(ports_version_glob) $portversion
         }
         # if installing, mark the port as explicitly requested
-        if {$target == "install"} {
+        if {$action == "install"} {
             set options(ports_requested) 1
+            # we actually activate as well
+            set target activate
+        } else {
+            set target $action
         }
         if {[catch {set workername [mportopen $porturl [array get options] [array get requested_variations]]} result]} {
             global errorInfo
@@ -3737,8 +3760,8 @@
     contents    [list action_contents       [ACTION_ARGS_PORTS]] \
     dependents  [list action_dependents     [ACTION_ARGS_PORTS]] \
     rdependents [list action_dependents     [ACTION_ARGS_PORTS]] \
-    deps        [list action_info           [ACTION_ARGS_PORTS]] \
-    rdeps       [list action_rdeps          [ACTION_ARGS_PORTS]] \
+    deps        [list action_deps           [ACTION_ARGS_PORTS]] \
+    rdeps       [list action_deps           [ACTION_ARGS_PORTS]] \
     variants    [list action_variants       [ACTION_ARGS_PORTS]] \
     \
     search      [list action_search         [ACTION_ARGS_STRINGS]] \
@@ -3766,7 +3789,6 @@
     test        [list action_target         [ACTION_ARGS_PORTS]] \
     lint        [list action_target         [ACTION_ARGS_PORTS]] \
     submit      [list action_target         [ACTION_ARGS_PORTS]] \
-    trace       [list action_target         [ACTION_ARGS_PORTS]] \
     livecheck   [list action_target         [ACTION_ARGS_PORTS]] \
     distcheck   [list action_target         [ACTION_ARGS_PORTS]] \
     mirror      [list action_target         [ACTION_ARGS_PORTS]] \
@@ -3833,6 +3855,7 @@
                  line long_description
                  maintainer maintainers name platform platforms portdir pretty
                  replaced_by revision variant variants version}
+    deps        {index no-build}
     rdeps       {index no-build full}
     rdependents {full}
     search      {case-sensitive category categories depends_fetch
@@ -3853,30 +3876,24 @@
     upgrade     {force enforce-variants no-replace}
 }
 
-global cmd_implied_options
-array set cmd_implied_options {
-    deps   {ports_info_fullname yes ports_info_depends yes ports_info_pretty yes}
-}
-                                 
-
 ##
 # Checks whether the given option is valid
 #
 # œparam action for which action
-# @param option the option to check
-# @param upoptargc reference to upvar for storing the number of arguments for
-#                  this option
-proc cmd_option_exists { action option {upoptargc ""}} {
+# @param option the prefix of the option to check
+# @return list of pairs {name argc} for all matching options
+proc cmd_option_matches {action option} {
     global cmd_opts_array
-    upvar 1 $upoptargc optargc
 
     # This could be so easy with lsearch -index,
     # but that's only available as of Tcl 8.5
 
     if {![info exists cmd_opts_array($action)]} {
-        return 0
+        return {}
     }
 
+    set result {}
+
     foreach item $cmd_opts_array($action) {
         if {[llength $item] == 1} {
             set name $item
@@ -3887,12 +3904,14 @@
         }
 
         if {$name == $option} {
-            set optargc $argc
-            return 1
+            set result [list [list $name $argc]]
+            break
+        } elseif {[string first $option $name] == 0} {
+            lappend result [list $name $argc]
         }
     }
 
-    return 0
+    return $result
 }
 
 # Parse global options
@@ -3921,10 +3940,18 @@
                 }
                 default {
                     set key [string range $arg 2 end]
-                    set kargc 0
-                    if {![cmd_option_exists $action $key kargc]} {
+                    set kopts [cmd_option_matches $action $key]
+                    if {[llength $kopts] == 0} {
                         return -code error "${action} does not accept --${key}"
+                    } elseif {[llength $kopts] > 1} {
+                        set errlst {}
+                        foreach e $kopts {
+                            lappend errlst "--[lindex $e 0]"
+                        }
+                        return -code error "${action} --${key} is ambiguous: \n  [join $errlst "\n  "]"
                     }
+                    set key   [lindex [lindex $kopts 0] 0]
+                    set kargc [lindex [lindex $kopts 0] 1]
                     if {$kargc == 0} {
                         set global_options(ports_${action}_${key}) yes
                     } else {
@@ -4026,7 +4053,6 @@
     global cmd_argc cmd_argv cmd_argn
     global global_options global_options_base private_options ui_options
     global current_portdir
-    global cmd_implied_options
     set cmd_argv $argv
     set cmd_argc [llength $argv]
     set cmd_argn 0
@@ -4056,10 +4082,6 @@
         array unset global_options
         array set global_options $global_options_base
         
-        if {[info exists cmd_implied_options($action)]} {
-            array set global_options $cmd_implied_options($action)
-        }
-
         # Find an action to execute
         set action_proc [find_action_proc $action]
         if { $action_proc == "" } {
@@ -4239,7 +4261,7 @@
 
     # Main command loop
     set exit_status 0
-    while { $exit_status == 0 || [macports::ui_isset ports_processall] } {
+    while { $exit_status == 0 || $isstdin || [macports::ui_isset ports_processall] } {
 
         # Calculate our prompt
         if { $noisy } {

Modified: branches/new-help-system/base/src/port/portindex.tcl
===================================================================
--- branches/new-help-system/base/src/port/portindex.tcl	2010-07-16 23:53:45 UTC (rev 69809)
+++ branches/new-help-system/base/src/port/portindex.tcl	2010-07-17 00:51:07 UTC (rev 69810)
@@ -7,24 +7,21 @@
 # if requested
 # $Id$
 
-if {([file tail [pwd]] == "src" && [file exists [set dir macports1.0]/macports_fastload.tcl])
-        || ([file tail [pwd]] == "base" && [file exists [set dir src/macports1.0]/macports_fastload.tcl])} {
-    # developer mode, source packages from current directory
-    source [file join $dir macports_fastload.tcl]
-} else {
-    source [file join "@macports_tcl_dir@" macports1.0 macports_fastload.tcl]
-}
-
+catch {source \
+    [file join "@macports_tcl_dir@" macports1.0 macports_fastload.tcl]}
 package require macports
 package require Pextlib
 
 # Globals
 set archive 0
+set full_reindex 0
 set stats(total) 0
 set stats(failed) 0
+set stats(skipped) 0
 array set ui_options        [list]
 array set global_options    [list]
 array set global_variations [list]
+set port_options            [list]
 
 # Pass global options into mportinit
 mportinit ui_options global_options global_variations
@@ -32,19 +29,48 @@
 # Standard procedures
 proc print_usage args {
     global argv0
-    puts "Usage: $argv0 \[-ad\] \[-o output directory\] \[directory\]"
+    puts "Usage: $argv0 \[-adf\] \[-p plat_ver_arch\] \[-o output directory\] \[directory\]"
     puts "-a:\tArchive port directories (for remote sites). Requires -o option"
     puts "-o:\tOutput all files to specified directory"
     puts "-d:\tOutput debugging information"
+    puts "-f:\tDo a full re-index instead of updating"
+    puts "-p:\tPretend to be on another platform"
 }
 
 proc pindex {portdir} {
-    global target fd directory archive outdir stats
+    global target oldfd oldmtime newest qindex fd directory archive outdir stats full_reindex \
+           ui_options port_options save_prefix keepkeys
+
+    # try to reuse the existing entry if it's still valid
+    if {$full_reindex != "1" && $archive != "1" && [info exists qindex([string tolower [file tail $portdir]])]} {
+        try {
+            set mtime [file mtime [file join $directory $portdir Portfile]]
+            if {$oldmtime >= $mtime} {
+                set offset $qindex([string tolower [file tail $portdir]])
+                seek $oldfd $offset
+                gets $oldfd line
+                set name [lindex $line 0]
+                set len [lindex $line 1]
+                set line [read $oldfd $len]
+
+                if {[info exists ui_options(ports_debug)]} {
+                    puts "Reusing existing entry for $portdir"
+                }
+
+                puts $fd [list $name $len]
+                puts -nonewline $fd $line
+
+                incr stats(skipped)
+                return
+            }
+        } catch {*} {
+            ui_warn "failed to open old entry for ${portdir}, making a new one"
+        }
+    }
+
     incr stats(total)
-    global macports::prefix
-    set save_prefix $prefix
     set prefix {\${prefix}}
-    if {[catch {set interp [mportopen file://[file join $directory $portdir]]} result]} {
+    if {[catch {set interp [mportopen file://[file join $directory $portdir] $port_options]} result]} {
         puts stderr "Failed to parse file $portdir/Portfile: $result"
         # revert the prefix.
         set prefix $save_prefix
@@ -74,9 +100,8 @@
             }
         }
 
-        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 license}
         foreach availkey [array names portinfo] {
-            if {[lsearch -exact ${keepkeys} $availkey] == -1} {
+            if {![info exists keepkeys($availkey)]} {
                 unset portinfo($availkey)
             }
         }
@@ -84,6 +109,10 @@
         set len [expr [string length $output] + 1]
         puts $fd [list $portinfo(name) $len]
         puts $fd $output
+        set mtime [file mtime [file join $directory $portdir Portfile]]
+        if {$mtime > $newest} {
+            set newest $mtime
+        }
     }
 }
 
@@ -102,7 +131,16 @@
                 set ui_options(ports_debug) yes
             } elseif {$arg == "-o"} { # Set output directory
                 incr i
-                set outdir [lindex $argv $i]
+                set outdir [file join [pwd] [lindex $argv $i]]
+            } elseif {$arg == "-p"} { # Set platform
+                incr i
+                set platlist [split [lindex $argv $i] _]
+                set os_platform [lindex $platlist 0]
+                set os_major [lindex $platlist 1]
+                set os_arch [lindex $platlist 2]
+                lappend port_options os.platform $os_platform os.major $os_major os.arch $os_arch
+            } elseif {$arg == "-f"} { # Completely rebuild index
+                set full_reindex 1
             } else {
                 puts stderr "Unknown option: $arg"
                 print_usage
@@ -110,7 +148,7 @@
             }
         }
         default {
-            set directory $arg
+            set directory [file join [pwd] $arg]
         }
     }
 }
@@ -149,13 +187,42 @@
     set outdir $directory
 }
 
-puts "Creating software index in $outdir"
+puts "Creating port index in $outdir"
+set outpath [file join $outdir PortIndex]
+# open old index for comparison
+if {[file isfile $outpath] && [file isfile ${outpath}.quick]} {
+    set oldmtime [file mtime $outpath]
+    set newest $oldmtime
+    if {![catch {set oldfd [open $outpath r]}] && ![catch {set quickfd [open ${outpath}.quick r]}]} {
+        if {![catch {set quicklist [read $quickfd]}]} {
+            foreach entry [split $quicklist "\n"] {
+                set qindex([lindex $entry 0]) [lindex $entry 1]
+            }
+        }
+        close $quickfd
+    }
+} else {
+    set newest 0
+}
+
 set tempportindex [mktemp "/tmp/mports.portindex.XXXXXXXX"]
 set fd [open $tempportindex w]
+set save_prefix ${macports::prefix}
+foreach key {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 license} {
+    set keepkeys($key) 1
+}
 mporttraverse pindex $directory
+if {[info exists oldfd]} {
+    close $oldfd
+}
 close $fd
-file rename -force $tempportindex [file join $outdir PortIndex]
-mports_generate_quickindex [file join $outdir PortIndex]
+file rename -force $tempportindex $outpath
+file mtime $outpath $newest
+mports_generate_quickindex $outpath
 puts "\nTotal number of ports parsed:\t$stats(total)\
-      \nPorts successfully parsed:\t[expr $stats(total) - $stats(failed)]\t\
-      \nPorts failed:\t\t\t$stats(failed)\n"
+      \nPorts successfully parsed:\t[expr $stats(total) - $stats(failed)]\
+      \nPorts failed:\t\t\t$stats(failed)\
+      \nUp-to-date ports skipped:\t$stats(skipped)\n"

Modified: branches/new-help-system/base/src/port/portmirror.tcl
===================================================================
--- branches/new-help-system/base/src/port/portmirror.tcl	2010-07-16 23:53:45 UTC (rev 69809)
+++ branches/new-help-system/base/src/port/portmirror.tcl	2010-07-17 00:51:07 UTC (rev 69810)
@@ -11,14 +11,8 @@
 # Updates the distfiles to current distfiles by deleting old stuff.
 # Uses the database.
 
-if {([file tail [pwd]] == "src" && [file exists [set dir macports1.0]/macports_fastload.tcl])
-        || ([file tail [pwd]] == "base" && [file exists [set dir src/macports1.0]/macports_fastload.tcl])} {
-    # developer mode, source packages from current directory
-    source [file join $dir macports_fastload.tcl]
-} else {
-    source [file join "@macports_tcl_dir@" macports1.0 macports_fastload.tcl]
-}
-
+catch {source \
+    [file join "@macports_tcl_dir@" macports1.0 macports_fastload.tcl]}
 package require macports
 package require Pextlib
 

Modified: branches/new-help-system/base/src/port1.0/Makefile
===================================================================
--- branches/new-help-system/base/src/port1.0/Makefile	2010-07-16 23:53:45 UTC (rev 69809)
+++ branches/new-help-system/base/src/port1.0/Makefile	2010-07-17 00:51:07 UTC (rev 69810)
@@ -15,7 +15,7 @@
 
 all:: pkgIndex.tcl
 
-pkgIndex.tcl:
+pkgIndex.tcl: $(SRCS)
 	$(SILENT) ../pkg_mkindex.sh . || ( rm -rf $@ && exit 1 )
 
 clean::

Modified: branches/new-help-system/base/src/port1.0/fetch_common.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/fetch_common.tcl	2010-07-16 23:53:45 UTC (rev 69809)
+++ branches/new-help-system/base/src/port1.0/fetch_common.tcl	2010-07-17 00:51:07 UTC (rev 69810)
@@ -45,14 +45,40 @@
     array set sites {}
 }
 
+# percent-encode all characters in str that are not unreserved in URIs
+proc portfetch::percent_encode {str} {
+    set outstr ""
+    while {[string length $str] > 0} {
+        set char [string index $str 0]
+        set str [string range $str 1 end]
+        switch -- $char {
+            {-} -
+            {.} -
+            {_} -
+            {~} {
+                append outstr $char
+            }
+            default {
+                if {[string is ascii -strict $char] && [string is alnum -strict $char]} {
+                    append outstr $char
+                } else {
+                    foreach {a b} [split [format %02X [scan $char %c]] {}] {
+                        append outstr "%${a}${b}"
+                    }
+                }
+            }
+        }
+    }
+    return $outstr
+}
+
 # Given a site url and the name of the distfile, assemble url and
 # return it.
 proc portfetch::assemble_url {site distfile} {
     if {[string index $site end] != "/"} {
-        return "${site}/${distfile}"
-    } else {
-        return "${site}${distfile}"
+        append site /
     }
+    return "${site}[percent_encode ${distfile}]"
 }
 
 # For a given mirror site type, e.g. "gnu" or "x11", check to see if there's a
@@ -192,7 +218,7 @@
         if {![info exists urlmap($url_var)]} {
             if {$url_var != $default_listvar} {
                 ui_error [format [msgcat::mc "No defined site for tag: %s, using $default_listvar"] $url_var]
-                set urlmap($url_var) [set $default_listvar]
+                set urlmap($url_var) $urlmap($default_listvar)
             } else {
                 set urlmap($url_var) {}
             }
@@ -206,6 +232,14 @@
             continue
         }
 
+        # can't do the ping with dropped privileges (though it works fine if we didn't start as root)
+        if {[getuid] == 0 && [geteuid] != 0} {
+            set oldeuid [geteuid]
+            set oldegid [getegid]
+            seteuid 0
+            setegid 0
+        }
+
         foreach site $urllist {
             regexp $hostregex $site -> host
 
@@ -243,6 +277,11 @@
             ui_debug "$host ping time is $pingtimes($host)"
         }
 
+        if {[info exists oldeuid]} {
+            setegid $oldegid
+            seteuid $oldeuid
+        }
+
         set pinglist {}
         foreach site $urllist {
             regexp $hostregex $site -> host
@@ -257,3 +296,23 @@
         }
     }
 }
+
+proc portfetch::get_urls {} {
+    variable fetch_urls
+    variable urlmap
+    set urls {}
+
+    portfetch::checkfiles fetch_urls
+
+    foreach {url_var distfile} $fetch_urls {
+        if {![info exists urlmap($url_var)]} {
+            ui_error [format [msgcat::mc "No defined site for tag: %s, using master_sites"] $url_var]
+            set urlmap($url_var) $urlmap(master_sites)
+        }
+        foreach site $urlmap($url_var) {
+            lappend urls $site
+        }
+    }
+
+    return $urls
+}

Modified: branches/new-help-system/base/src/port1.0/port_autoconf.tcl.in
===================================================================
--- branches/new-help-system/base/src/port1.0/port_autoconf.tcl.in	2010-07-16 23:53:45 UTC (rev 69809)
+++ branches/new-help-system/base/src/port1.0/port_autoconf.tcl.in	2010-07-17 00:51:07 UTC (rev 69810)
@@ -44,6 +44,7 @@
 	variable hg_path "@HG@"
 	variable gzip_path "@GZIP@"
 	variable lipo_path "@LIPO@"
+	variable openssl_path "@OPENSSL@"
 	variable patch_path "@PATCH@"
 	variable gnupatch_path "@GNUPATCH@"
 	variable rmdir_path "@RMDIR@"

Modified: branches/new-help-system/base/src/port1.0/portactivate.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/portactivate.tcl	2010-07-16 23:53:45 UTC (rev 69809)
+++ branches/new-help-system/base/src/port1.0/portactivate.tcl	2010-07-17 00:51:07 UTC (rev 69810)
@@ -41,9 +41,9 @@
 target_state ${org.macports.activate} no
 target_provides ${org.macports.activate} activate
 if {[option portarchivemode] == "yes"} {
-    target_requires ${org.macports.activate} main archivefetch unarchive fetch extract checksum patch configure build destroot archive install
+    target_requires ${org.macports.activate} main archivefetch unarchive fetch checksum extract patch configure build destroot archive install
 } else {
-    target_requires ${org.macports.activate} main fetch extract checksum patch configure build destroot install
+    target_requires ${org.macports.activate} main fetch checksum extract patch configure build destroot install
 }
 target_prerun ${org.macports.activate} portactivate::activate_start
 
@@ -54,47 +54,53 @@
 default activate.asroot no
 
 proc portactivate::activate_start {args} {
-    global prefix
-    if { ![file writable $prefix] } {
+    global prefix registry.installtype
+    if { ![file writable $prefix] && ${registry.installtype} == "image"} {
         # if install location is not writable, need root privileges
         elevateToRoot "activate"
     }
 }
 
 proc portactivate::activate_main {args} {
-    global env name version revision portvariants user_options portnotes
-    registry_activate $name "${version}_${revision}${portvariants}" [array get user_options]
+    global env name version revision portvariants user_options PortInfo registry.installtype
 
+    # skip the actual activation in direct mode (we still want the notes and the pre/post procs)
+    if {${registry.installtype} == "image"} {
+        registry_activate $name "${version}_${revision}${portvariants}" [array get user_options]
+    }
+
     # Display notes at the end of the activation phase.
-    if {[info exists portnotes] && $portnotes ne {}} {
-        # If env(COLUMNS) exists, limit each line's width to this width.
-        if {[info exists env(COLUMNS)]} {
-            set maxlen $env(COLUMNS)
+    if {[info exists PortInfo(notes)] && $PortInfo(notes) ne {}} {
+        ui_msg ""
+        foreach note $PortInfo(notes) {
+            # If env(COLUMNS) exists, limit each line's width to this width.
+            if {[info exists env(COLUMNS)]} {
+                set maxlen $env(COLUMNS)
 
-            ui_msg ""
-            foreach line [split $portnotes "\n"] {
-                set joiner ""
-                set lines ""
-                set newline ""
+                foreach line [split $note "\n"] {
+                    set joiner ""
+                    set lines ""
+                    set newline ""
 
-                foreach word [split $line " "] {
-                    if {[string length $newline] + [string length $word] >= $maxlen} {
+                    foreach word [split $line " "] {
+                        if {[string length $newline] + [string length $word] >= $maxlen} {
+                            lappend lines $newline
+                            set newline ""
+                            set joiner ""
+                        }
+                        append newline $joiner $word
+                        set joiner " "
+                    }
+                    if {$newline ne {}} {
                         lappend lines $newline
-                        set newline ""
-                        set joiner ""
                     }
-                    append newline $joiner $word
-                    set joiner " "
+                    ui_msg [join $lines "\n"]
                 }
-                if {$newline ne {}} {
-                    lappend lines $newline
-                }
-                ui_msg [join $lines "\n"]
+            } else {
+                ui_msg $note
             }
-            ui_msg ""
-        } else {
-            ui_msg \n$portnotes\n
         }
+        ui_msg ""
     }
 
     return 0

Modified: branches/new-help-system/base/src/port1.0/portbuild.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/portbuild.tcl	2010-07-16 23:53:45 UTC (rev 69809)
+++ branches/new-help-system/base/src/port1.0/portbuild.tcl	2010-07-17 00:51:07 UTC (rev 69810)
@@ -35,7 +35,7 @@
 
 set org.macports.build [target_new org.macports.build portbuild::build_main]
 target_provides ${org.macports.build} build
-target_requires ${org.macports.build} main fetch extract checksum patch configure
+target_requires ${org.macports.build} main fetch checksum extract patch configure
 target_prerun ${org.macports.build} portbuild::build_start
 
 namespace eval portbuild {
@@ -82,17 +82,17 @@
                 return [findBinary gmake $portutil::autoconf::gnumake_path]
             }
         }
-        pbx {
+        pbx -
+        xcode {
             if {[option os.platform] != "darwin"} {
-                return -code error "[format [msgcat::mc "This port requires 'pbxbuild/xcodebuild', which is not available on %s."] [option os.platform]]"
+                return -code error "[format [msgcat::mc "This port requires 'xcodebuild', which is not available on %s."] [option os.platform]]"
             }
 
-            if {[catch {set xcodebuild [binaryInPath xcodebuild]}] == 0} {
-                return $xcodebuild
-            } elseif {[catch {set pbxbuild [binaryInPath pbxbuild]}] == 0} {
-                return $pbxbuild
+            global xcodebuildcmd
+            if {$xcodebuildcmd != "none"} {
+                return $xcodebuildcmd
             } else {
-                return -code error "Neither pbxbuild nor xcodebuild were found on this system!"
+                return -code error "xcodebuild was not found on this system!"
             }
         }
         default {

Modified: branches/new-help-system/base/src/port1.0/portchecksum.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/portchecksum.tcl	2010-07-16 23:53:45 UTC (rev 69809)
+++ branches/new-help-system/base/src/port1.0/portchecksum.tcl	2010-07-17 00:51:07 UTC (rev 69810)
@@ -52,11 +52,14 @@
 set_ui_prefix
 
 # The list of the types of checksums we know.
-set checksum_types "md5 sha1 rmd160"
+set checksum_types "md5 sha1 rmd160 sha256"
 
 # The number of types we know.
 set checksum_types_count [llength $checksum_types]
 
+# types to recommend if none are specified in the portfile
+set default_checksum_types {sha1 rmd160}
+
 # Using global all_dist_files, parse the checksums and store them into the
 # global array checksums_array.
 #
@@ -172,6 +175,15 @@
     return [rmd160 file $file]
 }
 
+# calc_sha256
+#
+# Calculate the sha256 checksum for the given file.
+# Return the checksum.
+#
+proc portchecksum::calc_sha256 {file} {
+    return [sha256 file $file]
+}
+
 # checksum_start
 #
 # Target prerun procedure; simply prints a message about what we're doing.
@@ -188,6 +200,7 @@
 #
 proc portchecksum::checksum_main {args} {
     global UI_PREFIX all_dist_files checksum_types checksums_array portverbose checksum.skip
+    global usealtworkpath altprefix default_checksum_types
 
     # If no files have been downloaded, there is nothing to checksum.
     if {![info exists all_dist_files]} {
@@ -217,13 +230,17 @@
 
             # get the full path of the distfile.
             set fullpath [file join $distpath $distfile]
+            if {![file isfile $fullpath]} {
+                if {!$usealtworkpath && [file isfile "${altprefix}${fullpath}"]} {
+                    set fullpath "${altprefix}${fullpath}"
+                } else {
+                    return -code error "$distfile does not exist in $distpath"
+                }
+            }
 
             # check that there is at least one checksum for the distfile.
-            if {![info exists checksums_array($distfile)]} {
+            if {![info exists checksums_array($distfile)] || [llength $checksums_array($distfile)] < 1} {
                 ui_error "[format [msgcat::mc "No checksum set for %s"] $distfile]"
-                foreach type $checksum_types {
-                    ui_info "[format [msgcat::mc "Distfile checksum: %s $type %s"] $distfile [calc_$type $fullpath]]"
-                }
                 set fail yes
             } else {
                 # retrieve the list of types/values from the array.
@@ -261,9 +278,20 @@
             }
 
             set fullpath [file join $distpath $distfile]
-            foreach type $checksum_types {
-                lappend sums [format "%-8s%s" $type [calc_$type $fullpath]]
+            if {![file isfile $fullpath] && (!$usealtworkpath && [file isfile "${altprefix}${fullpath}"])} {
+                set fullpath "${altprefix}${fullpath}"
             }
+            if {![info exists checksums_array($distfile)] || [llength $checksums_array($distfile)] < 1} {
+                # no checksums specified; output the default set
+                foreach type $default_checksum_types {
+                    lappend sums [format "%-8s%s" $type [calc_$type $fullpath]]
+                }
+            } else {
+                # output just the types that were already used
+                foreach {type sum} $checksums_array($distfile) {
+                    lappend sums [format "%-8s%s" $type [calc_$type $fullpath]]
+                }
+            }
         }
         ui_info "The correct checksum line may be:"
         ui_info [format "%-20s%s" "checksums" [join $sums [format " \\\n%-20s" ""]]]

Modified: branches/new-help-system/base/src/port1.0/portclean.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/portclean.tcl	2010-07-16 23:53:45 UTC (rev 69809)
+++ branches/new-help-system/base/src/port1.0/portclean.tcl	2010-07-17 00:51:07 UTC (rev 69810)
@@ -1,4 +1,4 @@
-# et:ts=4
+# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
 # portclean.tcl
 # $Id$
 #
@@ -58,16 +58,20 @@
 proc portclean::clean_main {args} {
     global UI_PREFIX
     global ports_clean_dist ports_clean_work ports_clean_archive ports_clean_logs
-    global ports_clean_all usealtworkpath 
-    global	keeplogs
+    global ports_clean_all keeplogs usealtworkpath
 
+    if {$usealtworkpath} {
+        ui_warn "Only cleaning in ~/.macports; insufficient privileges for standard locations"
+    }
+
     if {[info exists ports_clean_all] && $ports_clean_all == "yes" || \
         [info exists ports_clean_dist] && $ports_clean_dist == "yes"} {
         ui_info "$UI_PREFIX [format [msgcat::mc "Removing distfiles for %s"] [option name]]"
         clean_dist
     }
-    if {[info exists ports_clean_all] && $ports_clean_all == "yes" || \
-        [info exists ports_clean_archive] && $ports_clean_archive == "yes"} {
+    if {([info exists ports_clean_all] && $ports_clean_all == "yes" || \
+        [info exists ports_clean_archive] && $ports_clean_archive == "yes")
+        && !$usealtworkpath} {
         ui_info "$UI_PREFIX [format [msgcat::mc "Removing archives for %s"] [option name]]"
         clean_archive
     }
@@ -77,61 +81,43 @@
          ui_info "$UI_PREFIX [format [msgcat::mc "Removing build directory for %s"] [option name]]"
          clean_work
     }
-    if {([info exists ports_clean_logs] && $ports_clean_logs == "yes") || ($keeplogs == "no")} {
+    if {(([info exists ports_clean_logs] && $ports_clean_logs == "yes") || ($keeplogs == "no"))
+        && !$usealtworkpath} {
         clean_logs
     }
 
-    # start gsoc-08 privileges
-    if {[info exists usealtworkpath] && $usealtworkpath == "yes"} {
-        ui_info "$UI_PREFIX [format [msgcat::mc "Removing alt source directory for %s"] [option name]]"
-        clean_altsource
-    }
-    # end gsoc-08 privileges
-
     return 0
 }
 
-proc portclean::clean_altsource {args} {
-    global usealtworkpath worksymlink
-
-    set sourcepath [string map {"work" ""} $worksymlink]
-
-    if {[file isdirectory $sourcepath]} {
-        ui_debug "Removing directory: ${sourcepath}"
-        if {[catch {delete $sourcepath} result]} {
-            ui_debug "$::errorInfo"
-            ui_error "$result"
-        }
-    } else {
-        ui_debug "No alt source directory found to remove."
-    }
-
-    return 0
-}
-
 #
 # Remove the directory where the distfiles reside.
 # This is crude, but works.
 #
 proc portclean::clean_dist {args} {
-    global ports_force name distpath dist_subdir distfiles
+    global ports_force name distpath dist_subdir distfiles patchfiles usealtworkpath portdbpath altprefix
 
     # remove known distfiles for sure (if they exist)
     set count 0
     foreach file $distfiles {
-        if {[info exist distpath] && [info exists dist_subdir]} {
-            set distfile [file join $distpath $dist_subdir $file]
-        } else {
-            set distfile [file join $distpath $file]
-        }
+        set distfile [getdistname $file]
+        ui_debug "Looking for $distfile"
+        set distfile [file join $distpath $distfile]
         if {[file isfile $distfile]} {
             ui_debug "Removing file: $distfile"
             if {[catch {delete $distfile} result]} {
                 ui_debug "$::errorInfo"
                 ui_error "$result"
             }
-            set count [expr $count + 1]
+            incr count
         }
+        if {!$usealtworkpath && [file isfile ${altprefix}${distfile}]} {
+            ui_debug "Removing file: ${altprefix}${distfile}"
+            if {[catch {delete ${altprefix}${distfile}} result]} {
+                ui_debug "$::errorInfo"
+                ui_error "$result"
+            }
+            incr count
+        }
     }
     if {$count > 0} {
         ui_debug "$count distfile(s) removed."
@@ -139,21 +125,47 @@
         ui_debug "No distfiles found to remove at $distpath"
     }
 
+    set count 0
+    if {![info exists patchfiles]} {
+        set patchfiles ""
+    }
+    foreach file $patchfiles {
+        set patchfile [getdistname $file]
+        ui_debug "Looking for $patchfile"
+        set patchfile [file join $distpath $patchfile]
+        if {[file isfile $patchfile]} {
+            ui_debug "Removing file: $patchfile"
+            if {[catch {delete $patchfile} result]} {
+                ui_debug "$::errorInfo"
+                ui_error "$result"
+            }
+            incr count
+        }
+        if {!$usealtworkpath && [file isfile ${altprefix}${patchfile}]} {
+            ui_debug "Removing file: ${altprefix}${patchfile}"
+            if {[catch {delete ${altprefix}${patchfile}} result]} {
+                ui_debug "$::errorInfo"
+                ui_error "$result"
+            }
+            incr count
+        }
+    }
+    if {$count > 0} {
+        ui_debug "$count patchfile(s) removed."
+    } else {
+        ui_debug "No patchfiles found to remove at $distpath"
+    }
+
     # next remove dist_subdir if only needed for this port,
     # or if user forces us to
     set dirlist [list]
-    if {($dist_subdir != $name)} {
-        if {[info exists dist_subdir]} {
-            set distfullpath [file join $distpath $dist_subdir]
-            if {!([info exists ports_force] && $ports_force == "yes")
-                && [file isdirectory $distfullpath]
-                && [llength [readdir $distfullpath]] > 0} {
-                ui_warn [format [msgcat::mc "Distfiles directory '%s' may contain distfiles needed for other ports, use the -f flag to force removal" ] [file join $distpath $dist_subdir]]
-            } else {
-                lappend dirlist $dist_subdir
-                lappend dirlist $name
-            }
+    if {$dist_subdir != $name} {
+        if {!([info exists ports_force] && $ports_force == "yes")
+            && [file isdirectory $distpath]
+            && [llength [readdir $distpath]] > 0} {
+            ui_warn [format [msgcat::mc "Distfiles directory '%s' may contain distfiles needed for other ports, use the -f flag to force removal" ] $distpath]
         } else {
+            lappend dirlist $dist_subdir
             lappend dirlist $name
         }
     } else {
@@ -162,15 +174,27 @@
     # loop through directories
     set count 0
     foreach dir $dirlist {
-        set distdir [file join $distpath $dir]
+        if {$usealtworkpath} {
+            set distdir [file join ${altprefix}${portdbpath} distfiles $dir]
+        } else {
+            set distdir [file join ${portdbpath} distfiles $dir]
+        }
         if {[file isdirectory $distdir]} {
             ui_debug "Removing directory: ${distdir}"
             if {[catch {delete $distdir} result]} {
                 ui_debug "$::errorInfo"
                 ui_error "$result"
             }
-            set count [expr $count + 1]
+            incr count
         }
+        if {!$usealtworkpath && [file isdirectory ${altprefix}${distdir}]} {
+            ui_debug "Removing directory: ${altprefix}${distdir}"
+            if {[catch {delete ${altprefix}${distdir}} result]} {
+                ui_debug "$::errorInfo"
+                ui_error "$result"
+            }
+            incr count
+        }
     }
     if {$count > 0} {
         ui_debug "$count distfile directory(s) removed."
@@ -181,7 +205,7 @@
 }
 
 proc portclean::clean_work {args} {
-    global portbuildpath worksymlink
+    global portbuildpath worksymlink usealtworkpath altprefix portpath
 
     if {[file isdirectory $portbuildpath]} {
         ui_debug "Removing directory: ${portbuildpath}"
@@ -193,11 +217,27 @@
         ui_debug "No work directory found to remove at ${portbuildpath}"
     }
 
+    if {!$usealtworkpath && [file isdirectory ${altprefix}${portbuildpath}]} {
+        ui_debug "Removing directory: ${altprefix}${portbuildpath}"
+        if {[catch {delete ${altprefix}${portbuildpath}} result]} {
+            ui_debug "$::errorInfo"
+            ui_error "$result"
+        }
+    } else {
+        ui_debug "No work directory found to remove at ${altprefix}${portbuildpath}"
+    }
+
     # Clean symlink, if necessary
     if {![catch {file type $worksymlink} result] && $result eq "link"} {
         ui_debug "Removing symlink: $worksymlink"
         delete $worksymlink
     }
+    
+    # clean port dir in alt prefix
+    if {[file exists "${altprefix}${portpath}"]} {
+        ui_debug "removing ${altprefix}${portpath}"
+        delete "${altprefix}${portpath}"
+    }
 
     return 0
 }
@@ -221,7 +261,7 @@
 
     # Define archive destination directory, target filename, regex for archive name
     if {$portarchivepath ne $workpath && $portarchivepath ne ""} {
-        set archivepath [file join $portarchivepath [option os.platform]]
+        set archivepath [file join $portarchivepath [option os.platform]_[option os.major]]
         set regexstring "^$name-\[\\-_a-zA-Z0-9\\.\]+_\[0-9\]*\[+\\-_a-zA-Z0-9\]*\[\\.\].*\[\\.\]\[a-z2\]+\$"
     }
 
@@ -242,20 +282,18 @@
 
     # Remove the archive files
     set count 0
-    if {![catch {set archivelist [glob [file join $archivepath * $fileglob]]} result]} {
+    if {![catch {set archivelist [glob [file join $archivepath * $name $fileglob]]} result]} {
         foreach path $archivelist {
             set file [file tail $path]
             # Make sure file is truly a port archive file, and not
             # an accidental match with some other file that might exist.
-            if {[regexp $regexstring $file]} {
-                if {[file isfile $path]} {
-                    ui_debug "Removing archive: $path"
-                    if {[catch {delete $path} result]} {
-                        ui_debug "$::errorInfo"
-                        ui_error "$result"
-                    }
-                    set count [expr $count + 1]
+            if {[regexp $regexstring $file] && [file isfile $path]} {
+                ui_debug "Removing archive: $path"
+                if {[catch {delete $path} result]} {
+                    ui_debug "$::errorInfo"
+                    ui_error "$result"
                 }
+                incr count
             }
         }
     }

Modified: branches/new-help-system/base/src/port1.0/portconfigure.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/portconfigure.tcl	2010-07-16 23:53:45 UTC (rev 69809)
+++ branches/new-help-system/base/src/port1.0/portconfigure.tcl	2010-07-17 00:51:07 UTC (rev 69810)
@@ -36,7 +36,7 @@
 
 set org.macports.configure [target_new org.macports.configure portconfigure::configure_main]
 target_provides ${org.macports.configure} configure
-target_requires ${org.macports.configure} main fetch extract checksum patch
+target_requires ${org.macports.configure} main fetch checksum extract patch
 target_prerun ${org.macports.configure} portconfigure::configure_start
 
 namespace eval portconfigure {
@@ -152,10 +152,10 @@
 default configure.pkg_config        {}
 default configure.pkg_config_path   {}
 
-options configure.build_arch
+options configure.build_arch configure.ld_archflags configure.sdkroot
 default configure.build_arch {[portconfigure::choose_supported_archs ${build_arch}]}
-options configure.ld_archflags
 default configure.ld_archflags {[portconfigure::configure_get_ld_archflags]}
+default configure.sdkroot {[portconfigure::configure_get_sdkroot]}
 foreach tool {cc cxx objc f77 f90 fc} {
     options configure.${tool}_archflags
     default configure.${tool}_archflags  "\[portconfigure::configure_get_archflags $tool\]"
@@ -165,7 +165,7 @@
 default configure.universal_archs       {[portconfigure::choose_supported_archs ${universal_archs}]}
 default configure.universal_args        {--disable-dependency-tracking}
 default configure.universal_cflags      {[portconfigure::configure_get_universal_cflags]}
-default configure.universal_cppflags    {[portconfigure::configure_get_universal_cppflags]}
+default configure.universal_cppflags    {}
 default configure.universal_cxxflags    {[portconfigure::configure_get_universal_cflags]}
 default configure.universal_ldflags     {[portconfigure::configure_get_universal_ldflags]}
 
@@ -226,12 +226,17 @@
     set ret {}
     foreach arch $archs {
         if {[lsearch -exact $supported_archs $arch] != -1} {
-            lappend ret $arch
-        } elseif {$arch == "x86_64" && [lsearch -exact $supported_archs "i386"] != -1 && [lsearch -exact $ret "i386"] == -1} {
-            lappend ret "i386"
-        } elseif {$arch == "ppc64" && [lsearch -exact $supported_archs "ppc"] != -1 && [lsearch -exact $ret "ppc"] == -1} {
-            lappend ret "ppc"
+            set add_arch $arch
+        } elseif {$arch == "x86_64" && [lsearch -exact $supported_archs "i386"] != -1} {
+            set add_arch "i386"
+        } elseif {$arch == "ppc64" && [lsearch -exact $supported_archs "ppc"] != -1} {
+            set add_arch "ppc"
+        } else {
+            continue
         }
+        if {[lsearch -exact $ret $add_arch] == -1} {
+            lappend ret $add_arch
+        }
     }
     return $ret
 }
@@ -269,6 +274,22 @@
     }
 }
 
+proc portconfigure::configure_get_sdkroot {} {
+    global developer_dir macosx_deployment_target macosx_version os.arch os.platform
+    if {${os.platform} == "darwin" && ($macosx_deployment_target != $macosx_version
+        || (${os.arch} == "powerpc" && $macosx_version == "10.4" && [variant_exists universal] && [variant_isset universal]))} {
+        if {$macosx_deployment_target == "10.4"} {
+            set sdk "${developer_dir}/SDKs/MacOSX10.4u.sdk"
+        } else {
+            set sdk "${developer_dir}/SDKs/MacOSX${macosx_deployment_target}.sdk"
+        }
+        if {[file exists $sdk]} {
+            return $sdk
+        }
+    }
+    return ""
+}
+
 # internal function to determine the "-arch xy" flags for the compiler
 proc portconfigure::configure_get_universal_archflags {args} {
     global configure.universal_archs
@@ -283,37 +304,14 @@
     return $flags
 }
 
-# internal function to determine the CPPFLAGS for the compiler
-proc portconfigure::configure_get_universal_cppflags {args} {
-    global os.arch os.major developer_dir
-    set flags ""
-    # include sysroot in CPPFLAGS too (twice), for the benefit of autoconf
-    if {${os.arch} == "powerpc" && ${os.major} == "8"} {
-        set flags "-isysroot ${developer_dir}/SDKs/MacOSX10.4u.sdk"
-    }
-    return $flags
-}
-
 # internal function to determine the CFLAGS for the compiler
 proc portconfigure::configure_get_universal_cflags {args} {
-    global os.arch os.major developer_dir
-    set flags [configure_get_universal_archflags]
-    # these flags should be valid for C/C++ and similar compiler frontends
-    if {${os.arch} == "powerpc" && ${os.major} == "8"} {
-        set flags "-isysroot ${developer_dir}/SDKs/MacOSX10.4u.sdk ${flags}"
-    }
-    return $flags
+    return [configure_get_universal_archflags]
 }
 
 # internal function to determine the LDFLAGS for the compiler
 proc portconfigure::configure_get_universal_ldflags {args} {
-    global os.arch os.major developer_dir
-    set flags [configure_get_universal_archflags]
-    # works around linking without using the CFLAGS, outside of automake
-    if {${os.arch} == "powerpc" && ${os.major} == "8"} {
-        set flags "-Wl,-syslibroot,${developer_dir}/SDKs/MacOSX10.4u.sdk ${flags}"
-    }
-    return $flags
+    return [configure_get_universal_archflags]
 }
 
 # internal proc to determine if the compiler supports -arch
@@ -336,12 +334,12 @@
 
 # internal function to determine the default compiler
 proc portconfigure::configure_get_default_compiler {args} {
-    global os.platform os.major
-    switch -exact "${os.platform} ${os.major}" {
-        "darwin 8"  -
-        "darwin 9"  { return gcc-4.0 }
-        "darwin 10" { return gcc-4.2 }
-        "darwin 11" { return llvm-gcc-4.2 }
+    global macosx_deployment_target
+    switch -exact ${macosx_deployment_target} {
+        "10.4"      -
+        "10.5"      { return gcc-4.0 }
+        "10.6"      { return gcc-4.2 }
+        "10.7"      { return llvm-gcc-4.2 }
         default     { return gcc }
     }
 }
@@ -506,7 +504,7 @@
     global worksrcpath use_configure use_autoreconf use_autoconf use_automake use_xmkmf
     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.cpp configure.javac configure.march configure.mtune
+    global configure.ccache configure.distcc configure.cpp configure.javac configure.march configure.mtune configure.sdkroot
     foreach tool {cc cxx objc f77 f90 fc ld} {
         global configure.${tool} configure.${tool}_archflags
     }
@@ -589,7 +587,15 @@
         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 SDK flags if cross-compiling (or universal on ppc tiger)
+        if {${configure.sdkroot} != ""} {
+            foreach flags {CPPFLAGS CFLAGS CXXFLAGS OBJCFLAGS} {
+                append_list_to_environment_value configure $flags "-isysroot ${configure.sdkroot}"
+            }
+            append_list_to_environment_value configure "LDFLAGS" "-Wl,-syslibroot,${configure.sdkroot}"
+        }
+
         # add extra flags that are conditional on whether we're building universal
         if {[variant_exists universal] && [variant_isset universal]} {
             foreach flags {CFLAGS OBJCFLAGS} {

Modified: branches/new-help-system/base/src/port1.0/portdeactivate.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/portdeactivate.tcl	2010-07-16 23:53:45 UTC (rev 69809)
+++ branches/new-help-system/base/src/port1.0/portdeactivate.tcl	2010-07-17 00:51:07 UTC (rev 69810)
@@ -49,15 +49,18 @@
 default deactivate.asroot no
 
 proc portdeactivate::deactivate_start {args} {
-    global prefix
-    if { ![file writable $prefix] } {
+    global prefix registry.installtype
+    if { ![file writable $prefix] && ${registry.installtype} == "image"} {
         # if install location is not writable, need root privileges
         elevateToRoot "deactivate"
     }
 }
 
 proc portdeactivate::deactivate_main {args} {
-    global name version revision portvariants user_options
-    registry_deactivate $name "${version}_${revision}${portvariants}" [array get user_options]
+    global name version revision portvariants user_options registry.installtype
+    # we still want to be able to run this target in direct mode for the pre/post procs
+    if {${registry.installtype} == "image"} {
+        registry_deactivate $name "${version}_${revision}${portvariants}" [array get user_options]
+    }
     return 0
 }

Modified: branches/new-help-system/base/src/port1.0/portdestroot.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/portdestroot.tcl	2010-07-16 23:53:45 UTC (rev 69809)
+++ branches/new-help-system/base/src/port1.0/portdestroot.tcl	2010-07-17 00:51:07 UTC (rev 69810)
@@ -36,7 +36,7 @@
 
 set org.macports.destroot [target_new org.macports.destroot portdestroot::destroot_main]
 target_provides ${org.macports.destroot} destroot
-target_requires ${org.macports.destroot} main fetch extract checksum patch configure build
+target_requires ${org.macports.destroot} main fetch checksum extract patch configure build
 target_prerun ${org.macports.destroot} portdestroot::destroot_start
 target_postrun ${org.macports.destroot} portdestroot::destroot_finish
 
@@ -136,7 +136,7 @@
 
 proc portdestroot::destroot_finish {args} {
     global UI_PREFIX destroot prefix name startupitem.create destroot.violate_mtree
-    global applications_dir frameworks_dir developer_dir destroot.keepdirs
+    global applications_dir frameworks_dir destroot.keepdirs
     global os.platform os.version
     variable oldmask
 
@@ -315,7 +315,7 @@
                         lpush pathsToCheck $dfile
                     } else {
                         # not a prefix of an allowed path, so it's either the path itself or a violation
-                        switch $dfile \
+                        switch -- $dfile \
                             $applications_dir - \
                             $frameworks_dir - \
                             /Library/LaunchAgents - \

Modified: branches/new-help-system/base/src/port1.0/portdistfiles.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/portdistfiles.tcl	2010-07-16 23:53:45 UTC (rev 69809)
+++ branches/new-help-system/base/src/port1.0/portdistfiles.tcl	2010-07-17 00:51:07 UTC (rev 69810)
@@ -53,7 +53,7 @@
 }
 
 proc portdistfiles::distfiles_main {args} {
-    global UI_PREFIX master_sites checksums_array
+    global UI_PREFIX master_sites checksums_array portdbpath dist_subdir
     
     # give up on ports that do not provide URLs
     if {$master_sites == "{}"} {
@@ -71,7 +71,7 @@
     foreach {url_var distfile} $fetch_urls {
         global portfetch::urlmap
 
-        ui_msg "\[$distfile\]"
+        ui_msg "\[$distfile\] [file join $portdbpath distfiles $dist_subdir $distfile]"
 
         # print checksums if available
         if {$result == "yes" && [array get checksums_array $distfile] != ""} {
@@ -82,7 +82,7 @@
 
         # determine sites to download from
         if {![info exists urlmap($url_var)]} {
-            set urlmap($url_var) $master_sites
+            set urlmap($url_var) $urlmap(master_sites)
         }
         
         # determine URLs to download

Modified: branches/new-help-system/base/src/port1.0/portextract.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/portextract.tcl	2010-07-16 23:53:45 UTC (rev 69809)
+++ branches/new-help-system/base/src/port1.0/portextract.tcl	2010-07-17 00:51:07 UTC (rev 69810)
@@ -35,7 +35,6 @@
 package require portutil 1.0
 
 set org.macports.extract [target_new org.macports.extract portextract::extract_main]
-target_init ${org.macports.extract} portextract::extract_init
 target_provides ${org.macports.extract} extract
 target_requires ${org.macports.extract} fetch checksum
 target_prerun ${org.macports.extract} portextract::extract_start
@@ -73,9 +72,11 @@
     return $val
 }
 
-proc portextract::extract_init {args} {
-    global extract.only extract.dir extract.cmd extract.pre_args extract.post_args extract.mkdir distfiles use_bzip2 use_lzma use_xz use_zip use_7z use_dmg workpath
+proc portextract::extract_start {args} {
+    global UI_PREFIX extract.dir extract.mkdir use_bzip2 use_lzma use_xz use_zip use_7z use_dmg
 
+    ui_msg "$UI_PREFIX [format [msgcat::mc "Extracting %s"] [option name]]"
+
     # should the distfiles be extracted to worksrcpath instead?
     if {[tbool extract.mkdir]} {
         global worksrcpath
@@ -83,7 +84,6 @@
         file mkdir ${worksrcpath}
         set extract.dir ${worksrcpath}
     }
-
     if {[tbool use_bzip2]} {
         option extract.cmd [findBinary bzip2 ${portutil::autoconf::bzip2_path}]
     } elseif {[tbool use_lzma]} {
@@ -93,30 +93,22 @@
     } elseif {[tbool use_zip]} {
         option extract.cmd [findBinary unzip ${portutil::autoconf::unzip_path}]
         option extract.pre_args -q
-        option extract.post_args "-d [option extract.dir]"
+        option extract.post_args "-d ${extract.dir}"
     } elseif {[tbool use_7z]} {
         option extract.cmd [binaryInPath "7za"]
         option extract.pre_args x
         option extract.post_args ""
     } elseif {[tbool use_dmg]} {
-        global worksrcdir
-        set dmg_tmp_dir [mkdtemp "/tmp/mports.XXXXXXXX"]
-        set dmg_mount ${dmg_tmp_dir}/${worksrcdir}
-        file mkdir ${dmg_mount}
+        global distname extract.cmd
+        set dmg_mount [mkdtemp "/tmp/mports.XXXXXXXX"]
         option extract.cmd [findBinary hdiutil ${portutil::autoconf::hdiutil_path}]
         option extract.pre_args attach
-        option extract.post_args "-private -readonly -nobrowse -mountpoint ${dmg_mount} && [findBinary cp  ${portutil::autoconf::cp_path}] -Rp ${dmg_mount} ${extract.dir} && ${extract.cmd} detach ${dmg_mount} && [findBinary rmdir  ${portutil::autoconf::rmdir_path}] ${dmg_mount} ${dmg_tmp_dir}"
+        option extract.post_args "-private -readonly -nobrowse -mountpoint \\\"${dmg_mount}\\\" && [findBinary cp ${portutil::autoconf::cp_path}] -Rp \\\"${dmg_mount}\\\" \\\"${extract.dir}/${distname}\\\" && ${extract.cmd} detach \\\"${dmg_mount}\\\" && [findBinary rmdir ${portutil::autoconf::rmdir_path}] \\\"${dmg_mount}\\\""
     }
 }
 
-proc portextract::extract_start {args} {
-    global UI_PREFIX
-
-    ui_msg "$UI_PREFIX [format [msgcat::mc "Extracting %s"] [option name]]"
-}
-
 proc portextract::extract_main {args} {
-    global UI_PREFIX filespath worksrcpath extract.dir
+    global UI_PREFIX filespath worksrcpath extract.dir usealtworkpath altprefix
 
     if {![exists distfiles] && ![exists extract.only]} {
         # nothing to do
@@ -126,9 +118,11 @@
     foreach distfile [option extract.only] {
         ui_info "$UI_PREFIX [format [msgcat::mc "Extracting %s"] $distfile]"
         if {[file exists $filespath/$distfile]} {
-            option extract.args "$filespath/$distfile"
+            option extract.args "'$filespath/$distfile'"
+        } elseif {![file exists "[option distpath]/$distfile"] && !$usealtworkpath && [file exists "${altprefix}[option distpath]/$distfile"]} {
+            option extract.args "'${altprefix}[option distpath]/$distfile'"
         } else {
-            option extract.args "[option distpath]/$distfile"
+            option extract.args "'[option distpath]/$distfile'"
         }
         if {[catch {command_exec extract} result]} {
             return -code error "$result"

Modified: branches/new-help-system/base/src/port1.0/portfetch.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/portfetch.tcl	2010-07-16 23:53:45 UTC (rev 69809)
+++ branches/new-help-system/base/src/port1.0/portfetch.tcl	2010-07-17 00:51:07 UTC (rev 69810)
@@ -422,7 +422,7 @@
 proc portfetch::fetchfiles {args} {
     global distpath all_dist_files UI_PREFIX
     global fetch.user fetch.password fetch.use_epsv fetch.ignore_sslcert fetch.remote_time
-    global fallback_mirror_site portverbose
+    global fallback_mirror_site portverbose usealtworkpath altprefix
     variable fetch_urls
     variable urlmap
 
@@ -460,7 +460,7 @@
     set sorted no
 
     foreach {url_var distfile} $fetch_urls {
-        if {![file isfile $distpath/$distfile]} {
+        if {![file isfile $distpath/$distfile] && ($usealtworkpath || ![file isfile ${altprefix}${distpath}/$distfile])} {
             ui_info "$UI_PREFIX [format [msgcat::mc "%s doesn't seem to exist in %s"] $distfile $distpath]"
             if {![file writable $distpath]} {
                 return -code error [format [msgcat::mc "%s must be writable"] $distpath]
@@ -471,14 +471,14 @@
             }
             if {![info exists urlmap($url_var)]} {
                 ui_error [format [msgcat::mc "No defined site for tag: %s, using master_sites"] $url_var]
-                set urlmap($url_var) $master_sites
+                set urlmap($url_var) $urlmap(master_sites)
             }
             unset -nocomplain fetched
             foreach site $urlmap($url_var) {
                 ui_msg "$UI_PREFIX [format [msgcat::mc "Attempting to fetch %s from %s"] $distfile $site]"
                 set file_url [portfetch::assemble_url $site $distfile]
                 set effectiveURL ""
-                if {![catch {eval curl fetch --effective-url effectiveURL $fetch_options {$file_url} ${distpath}/${distfile}.TMP} result] &&
+                if {![catch {eval curl fetch --effective-url effectiveURL $fetch_options {$file_url} {"${distpath}/${distfile}.TMP"}} result] &&
                     ![catch {file rename -force "${distpath}/${distfile}.TMP" "${distpath}/${distfile}"} result]} {
 
                     # Special hack to check for sourceforge mirrors, which don't return a proper error code on failure
@@ -537,13 +537,8 @@
 
 # Initialize fetch target and call checkfiles.
 proc portfetch::fetch_init {args} {
-    global distpath dist_subdir fetch_init_done
     variable fetch_urls
 
-    if {[info exists distpath] && [info exists dist_subdir] && ![info exists fetch_init_done]} {
-        set distpath ${distpath}/${dist_subdir}
-        set fetch_init_done yes
-    }
     portfetch::checkfiles fetch_urls
 }
 

Modified: branches/new-help-system/base/src/port1.0/portinstall.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/portinstall.tcl	2010-07-16 23:53:45 UTC (rev 69809)
+++ branches/new-help-system/base/src/port1.0/portinstall.tcl	2010-07-17 00:51:07 UTC (rev 69810)
@@ -39,9 +39,9 @@
 target_provides ${org.macports.install} install
 target_runtype ${org.macports.install} always
 if {[option portarchivemode] == "yes"} {
-    target_requires ${org.macports.install} main archivefetch unarchive fetch extract checksum patch configure build destroot archive
+    target_requires ${org.macports.install} main archivefetch unarchive fetch checksum extract patch configure build destroot archive
 } else {
-    target_requires ${org.macports.install} main fetch extract checksum patch configure build destroot
+    target_requires ${org.macports.install} main fetch checksum extract patch configure build destroot
 }
 target_prerun ${org.macports.install} portinstall::install_start
 
@@ -62,8 +62,10 @@
     ui_msg "$UI_PREFIX [format [msgcat::mc "Installing %s @%s_%s%s"] $name $version $revision $portvariants]"
     
     # start gsoc08-privileges
-    if { ![file writable $prefix] } {
+    if {![file writable $prefix] || ([getuid] == 0 && [geteuid] != 0)} {
         # if install location is not writable, need root privileges to install
+        # Also elevate if started as root, since 'file writable' doesn't seem
+        # to take euid into account.
         elevateToRoot "install"
     }
     # end gsoc08-privileges

Modified: branches/new-help-system/base/src/port1.0/portmain.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/portmain.tcl	2010-07-16 23:53:45 UTC (rev 69809)
+++ branches/new-help-system/base/src/port1.0/portmain.tcl	2010-07-17 00:51:07 UTC (rev 69810)
@@ -45,24 +45,28 @@
 
 # define options
 options prefix name version revision epoch categories maintainers
-options long_description description homepage license provides conflicts replaced_by
+options long_description description homepage notes license provides conflicts replaced_by
 options worksrcdir filesdir distname portdbpath libpath distpath sources_conf os.platform os.subplatform 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 supported_archs depends_skip_archcheck
 options copy_log_files
 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 replaced_by
+# Order of option_proc and option_export matters. Filter before exporting.
 
 # Assign option procedure to default_variants
 option_proc default_variants handle_default_variants
+# Handle notes special for better formatting
+option_proc notes handle_option_string
 
+# Export options via PortInfo
+options_export name version revision epoch categories maintainers platforms description long_description notes homepage license provides conflicts replaced_by
+
 default workpath {[getportworkpath_from_buildpath $portbuildpath]}
 default prefix /opt/local
 default applications_dir /Applications/MacPorts
 default frameworks_dir {${prefix}/Library/Frameworks}
-default developer_dir {/Developer}
+default developer_dir {[portmain::get_developer_dir]}
 default destdir destroot
 default destpath {${workpath}/${destdir}}
 # destroot is provided as a clearer name for the "destpath" variable
@@ -84,83 +88,82 @@
 default install.group {${portutil::autoconf::install_group}}
 
 # Platform Settings
-set os_arch $tcl_platform(machine)
-if {$os_arch == "Power Macintosh"} { set os_arch "powerpc" }
-if {$os_arch == "i586" || $os_arch == "i686" || $os_arch == "x86_64"} { set os_arch "i386" }
-set os_version $tcl_platform(osVersion)
-set os_major [lindex [split $os_version .] 0]
-set os_platform [string tolower $tcl_platform(os)]
-
 default os.platform {$os_platform}
 default os.version {$os_version}
 default os.major {$os_major}
 default os.arch {$os_arch}
-# Remove trailing "Endian"
-default os.endian {[string range $tcl_platform(byteOrder) 0 end-6]}
+default os.endian {$os_endian}
 
-set macosx_version {}
 set macosx_version_text {}
-if {$os_platform == "darwin"} {
-    # This will probably break when Apple changes versioning
-    set macosx_version [expr 10.0 + ($os_major - 4) / 10.0]
+if {[option os.platform] == "darwin"} {
     set macosx_version_text "(Mac OS X ${macosx_version}) "
 }
 ui_debug "OS [option os.platform]/[option os.version] ${macosx_version_text}arch [option os.arch]"
 
-default macosx_deployment_target {$macosx_version}
+default universal_variant {${use_configure}}
 
-default universal_variant yes
-
 # sub-platforms of darwin
 if {[option os.platform] == "darwin"} {
     if {[file isdirectory /System/Library/Frameworks/Carbon.framework]} {
         default os.subplatform macosx
+        # we're on Mac OS X and can therefore build universal
+        default os.universal_supported yes
     } else {
         default os.subplatform puredarwin
+        default os.universal_supported no
     }
-}
-
-# check if we're on Mac OS X and can therefore build universal
-if {[info exists os.subplatform] && ${os.subplatform} == "macosx"} {
-    # the universal variant itself is now created in
-    # universal_setup, which is called from mportopen
-    default os.universal_supported yes
 } else {
+    default os.subplatform {}
     default os.universal_supported no
 }
 
 default compiler.cpath {${prefix}/include}
 default compiler.library_path {${prefix}/lib}
 
+proc portmain::get_developer_dir {} {
+    if {![catch {binaryInPath xcode-select}]} {
+        return [exec xcode-select -print-path 2> /dev/null]
+    }
+    return "/Developer"
+}
+
 # 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]])) } {
+# resolve the alternate work path in ~/.macports
+proc portmain::set_altprefix {} {
+    global altprefix env euid
 
-    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)"
+    } 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 userhome [file normalize "~${username}"]
+        set username [uid_to_name [getuid]]
+        if {[catch {set userhome [file normalize "~$username"]}]} {
+            set userhome ""
+        }
     }
 
-    # set alternative prefix global variable
     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
+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
+    set usealtworkpath yes
+
     default worksymlink {[file join ${altprefix}${portpath} work]}
-    default distpath {[file join ${altprefix}${portdbpath} distfiles]}
+    default distpath {[file join ${altprefix}${portdbpath} distfiles ${dist_subdir}]}
     set portbuildpath "${altprefix}${portbuildpath}"
 
     ui_debug "Going to use alternate build prefix: $altprefix"
@@ -168,8 +171,9 @@
 } else {
     set usealtworkpath no
     default worksymlink {[file join $portpath work]}
-    default distpath {[file join $portdbpath distfiles]}
+    default distpath {[file join $portdbpath distfiles ${dist_subdir}]}
 }
+
 # end gsoc08-privileges
 
 proc portmain::main {args} {

Modified: branches/new-help-system/base/src/port1.0/portpatch.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/portpatch.tcl	2010-07-16 23:53:45 UTC (rev 69809)
+++ branches/new-help-system/base/src/port1.0/portpatch.tcl	2010-07-17 00:51:07 UTC (rev 69810)
@@ -68,7 +68,7 @@
 }
 
 proc portpatch::patch_main {args} {
-    global UI_PREFIX
+    global UI_PREFIX usealtworkpath altprefix
 
     # First make sure that patchfiles exists and isn't stubbed out.
     if {![exists patchfiles] || [option patchfiles] == ""} {
@@ -83,6 +83,8 @@
             lappend patchlist [option filespath]/$patch_file
         } elseif {[file exists [option distpath]/$patch_file]} {
             lappend patchlist [option distpath]/$patch_file
+        } elseif {!$usealtworkpath && [file exists "${altprefix}[option distpath]/$patch_file"]} {
+            lappend patchlist "${altprefix}[option distpath]/$patch_file"
         } else {
             return -code error [format [msgcat::mc "Patch file %s is missing"] $patch]
         }

Modified: branches/new-help-system/base/src/port1.0/portstartupitem.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/portstartupitem.tcl	2010-07-16 23:53:45 UTC (rev 69809)
+++ branches/new-help-system/base/src/port1.0/portstartupitem.tcl	2010-07-17 00:51:07 UTC (rev 69810)
@@ -129,7 +129,11 @@
     
     set itemname            ${startupitem.name}
     set uppername           [string toupper ${startupitem.name}]
-    set itemdir             /Library/StartupItems/${itemname}
+    if {[getuid] == 0} {
+        set itemdir         /Library/StartupItems/${itemname}
+    } else {
+        set itemdir         ${prefix}/Library/StartupItems/${itemname}
+    }
     set startupItemDir      ${destroot}${itemdir}
     set startupItemScript   ${startupItemDir}/${itemname}
     set startupItemPlist    ${startupItemDir}/StartupParameters.plist
@@ -585,9 +589,11 @@
     close ${plist}
 
     # Make a symlink to the plist file
-    file mkdir "${destroot}/Library/${daemondest}"
-    ln -sf "${itemdir}/${plistname}" "${destroot}/Library/${daemondest}"
-    
+    if {[getuid] == 0} {
+        file mkdir "${destroot}/Library/${daemondest}"
+        ln -sf "${itemdir}/${plistname}" "${destroot}/Library/${daemondest}"
+    }
+
     # If launchd is not available, warn the user
     set haveLaunchd ${portutil::autoconf::have_launchd}
     if {![tbool haveLaunchd]} {
@@ -595,7 +601,7 @@
         ui_msg "# WARNING:"
         ui_msg "# We're building a launchd startup item, but launchd wasn't"
         ui_msg "# found by configure. Are you sure you didn't mess up your"
-        ui_msg "# ports.conf settings?"
+        ui_msg "# macports.conf settings?"
         ui_msg "###########################################################"
     }
     

Modified: branches/new-help-system/base/src/port1.0/porttest.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/porttest.tcl	2010-07-16 23:53:45 UTC (rev 69809)
+++ branches/new-help-system/base/src/port1.0/porttest.tcl	2010-07-17 00:51:07 UTC (rev 69810)
@@ -7,7 +7,7 @@
 
 set org.macports.test [target_new org.macports.test porttest::test_main]
 target_provides ${org.macports.test} test
-target_requires ${org.macports.test} main fetch extract checksum patch configure build
+target_requires ${org.macports.test} main fetch checksum extract patch configure build
 target_prerun ${org.macports.test} porttest::test_start
 
 namespace eval porttest {

Modified: branches/new-help-system/base/src/port1.0/porttrace.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/porttrace.tcl	2010-07-16 23:53:45 UTC (rev 69809)
+++ branches/new-help-system/base/src/port1.0/porttrace.tcl	2010-07-17 00:51:07 UTC (rev 69810)
@@ -101,10 +101,12 @@
 # Disable the fence.
 # Unused yet.
 proc porttrace::trace_disable_fence {} {
-    global env
+    global env macosx_version
     if [info exists env(DARWINTRACE_SANDBOX_BOUNDS)] {
         unset env(DARWINTRACE_SANDBOX_BOUNDS)
-        unsetenv DARWINTRACE_SANDBOX_BOUNDS
+        if {$macosx_version == "10.5"} {
+            unsetenv DARWINTRACE_SANDBOX_BOUNDS
+        }
     }
 }
 
@@ -147,10 +149,12 @@
 proc porttrace::trace_stop {} {
     global os.platform
     if {${os.platform} == "darwin"} {
-        global env trace_fifo
+        global env trace_fifo macosx_version
         foreach var {DYLD_INSERT_LIBRARIES DYLD_FORCE_FLAT_NAMESPACE DARWINTRACE_LOG DARWINTRACE_SANDBOX_BOUNDS} {
             array unset env $var
-            unsetenv $var
+            if {$macosx_version == "10.5"} {
+                unsetenv $var
+            }
         }
 
         #kill socket
@@ -174,12 +178,15 @@
     set trace_thread [macports_create_thread]
 
     # The slave thread requires the registry package.
-    thread::send -async $trace_thread "package require registry 1.0"
+    thread::send $trace_thread "package require registry 1.0"
     # and this file as well.
-    thread::send -async $trace_thread "package require porttrace 1.0"
+    thread::send $trace_thread "package require porttrace 1.0"
 
-    # Start the slave work.
-    thread::send -async $trace_thread "porttrace::slave_start $trace_fifo $workpath"
+    # Initialize the slave
+    thread::send $trace_thread "porttrace::slave_init $trace_fifo $workpath"
+
+    # Run slave asynchronously
+    thread::send -async $trace_thread "porttrace::slave_run"
 }
 
 # Private
@@ -273,7 +280,7 @@
 
 # Private.
 # Slave init method.
-proc porttrace::slave_start {fifo p_workpath} {
+proc porttrace::slave_init {fifo p_workpath} {
     global ports_list trace_filemap sandbox_violation_list
     # Save the workpath.
     set workpath $p_workpath
@@ -282,8 +289,19 @@
     set ports_list {}
     set sandbox_violation_list {}
     tracelib setname $fifo
+
+    if [catch {tracelib opensocket} err] {
+        global errorInfo
+        ui_warn "Error in tracelib: $err"
+        ui_debug "Backtrace: $errorInfo"
+    }
+}
+
+proc porttrace::slave_run {} {
     if [catch {tracelib run} err] {
+        global errorInfo
         ui_warn "Error in tracelib: $err"
+        ui_debug "Backtrace: $errorInfo"
     }
 }
 

Modified: branches/new-help-system/base/src/port1.0/portutil.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/portutil.tcl	2010-07-16 23:53:45 UTC (rev 69809)
+++ branches/new-help-system/base/src/port1.0/portutil.tcl	2010-07-17 00:51:07 UTC (rev 69810)
@@ -328,7 +328,7 @@
 # command_prefix    additional command prefix (typically pipe command)
 # command_suffix    additional command suffix (typically redirection)
 proc command_exec {command args} {
-    global ${command}.env ${command}.env_array ${command}.nice env
+    global ${command}.env ${command}.env_array ${command}.nice env macosx_version
     set notty ""
     set command_prefix ""
     set command_suffix ""
@@ -394,7 +394,9 @@
 
     # Restore the environment.
     array unset env *
-    unsetenv *
+    if {$macosx_version == "10.5"} {
+        unsetenv *
+    }
     array set env [array get saved_env]
 
     # Return as if system had been called directly.
@@ -447,29 +449,46 @@
     }
 }
 
-# Notes are displayed at (1) the end of the activation phase and (2) when
-# action_notes is executed.
-proc notes {args} {
-    global PortInfo portnotes
+##
+# Filter options which take strings removing indent to ease Portfile writing
+proc handle_option_string {option action args} {
+    global $option
 
-    # Strip trailing empty lines
-    set notes [string trim [join $args] "\n"]
-    # Determine indent level
-    set indent ""
-    for {set i 0} {$i < [string length $notes]} {incr i} {
-        set c [string index $notes $i]
-        if {$c != " " && $c != "\t"} {
-            break
+    switch $action {
+        set {
+            set args [join $args]
+
+            set fulllist {}
+            # args is a list of strings/list
+            foreach arg $args {
+                # Strip trailing empty lines
+                if {[string index $arg 0] == "\n"} {
+                    set arg [string range $arg 1 end]
+                }
+                if {[string index $arg end] == "\n"} {
+                    set arg [string range $arg 0 end-1]
+                }
+
+                # Determine indent level
+                set indent ""
+                for {set i 0} {$i < [string length $arg]} {incr i} {
+                    set c [string index $arg $i]
+                    if {$c != " " && $c != "\t"} {
+                        break
+                    }
+                    append indent $c
+                }
+                # Remove indent on first line
+                set arg [string replace $arg 0 [expr $i - 1]]
+                # Remove indent on each other line
+                set arg [string map "\"\n$indent\" \"\n\"" $arg]
+
+                lappend fulllist $arg
+            }
+
+            set $option $fulllist
         }
-        append indent $c
     }
-    # Remove indent on first line
-    set notes [string replace $notes 0 [expr $i - 1]]
-    # Remove indent on each other line
-    set notes [string map "\"\n$indent\" \"\n\"" $notes]
-
-    set PortInfo(notes) $notes
-    set portnotes $PortInfo(notes)
 }
 
 # variant <provides> [<provides> ...] [requires <requires> [<requires>]]
@@ -566,6 +585,13 @@
     array set vinfo [list $variant_provides [array get variant]]
     set PortInfo(vinfo) [array get vinfo]
 
+    if {[variant_isset $variant_provides]} {
+        # set variants that this one requires
+        foreach req [ditem_key $ditem requires] {
+            variant_set $req
+        }
+    }
+
     # Finally append the ditem to the dlist.
     lappend all_variants $ditem
 }
@@ -700,9 +726,9 @@
 
     set match 0
     # 'os' could be a platform or an arch when it's alone
-    if {$len == 2 && ($os == ${os.platform} || ([info exists os.subplatform] && $os == ${os.subplatform}) || $os == ${os.arch})} {
+    if {$len == 2 && ($os == ${os.platform} || $os == ${os.subplatform} || $os == ${os.arch})} {
         set match 1
-    } elseif {($os == ${os.platform} || ([info exists os.subplatform] && $os == ${os.subplatform}))
+    } elseif {($os == ${os.platform} || $os == ${os.subplatform})
               && (![info exists release] || ${os.major} == $release)
               && (![info exists arch] || ${os.arch} == $arch)} {
         set match 1
@@ -836,7 +862,7 @@
         set arg [lindex $args 0]
         if {[string index $arg 0] eq "-"} {
             set args [lrange $args 1 end]
-            switch [string range $arg 1 end] {
+            switch -- [string range $arg 1 end] {
                 E {
                     set extended 1
                 }
@@ -1110,32 +1136,6 @@
     return
 }
 
-# filefindbypath
-# Provides searching of the standard path for included files
-proc filefindbypath {fname} {
-    global distpath filesdir worksrcdir portpath
-
-    if {[file readable $portpath/$fname]} {
-        return $portpath/$fname
-    } elseif {[file readable $portpath/$filesdir/$fname]} {
-        return $portpath/$filesdir/$fname
-    } elseif {[file readable $distpath/$fname]} {
-        return $distpath/$fname
-    }
-    return ""
-}
-
-# include
-# Source a file, looking for it along a standard search path.
-proc include {fname} {
-    set tgt [filefindbypath $fname]
-    if {[string length $tgt]} {
-        uplevel "source $tgt"
-    } else {
-        return -code error "Unable to find include file $fname"
-    }
-}
-
 # makeuserproc
 # This procedure re-writes the user-defined custom target to include
 # all the globals in its scope.  This is undeniably ugly, but I haven't
@@ -1466,7 +1466,11 @@
                 return 0
             } else {
                 # run the activate target but ignore its (completed) dependencies
-                return [target_run [lindex [dlist_search $dlist provides $target] 0]]
+                set result [target_run [lindex [dlist_search $dlist provides $target] 0]]
+                if {[getuid] == 0 && [geteuid] != 0} {
+                    setegid 0; seteuid 0
+                }
+                return $result
             }
         }
     }
@@ -1486,6 +1490,10 @@
 
     set dlist [dlist_eval $dlist "" target_run]
 
+    if {[getuid] == 0 && [geteuid] != 0} {
+        setegid 0; seteuid 0
+    }
+
     if {[llength $dlist] > 0} {
         # somebody broke!
         set errstring "Warning: the following items did not execute (for $name):"
@@ -1504,36 +1512,21 @@
 # open_statefile
 # open file to store name of completed targets
 proc open_statefile {args} {
-    global workpath worksymlink place_worksymlink name portpath ports_ignore_older
+    global workpath worksymlink place_worksymlink name portpath ports_ignore_older ports_dryrun
     global usealtworkpath altprefix env applications_dir portbuildpath
 
-    if {![file isdirectory $workpath]} {
-        file mkdir $workpath
-        chownAsRoot $portbuildpath
-        # 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
-        }
-    }
-    
-    if { [getuid] != 0 } {
-        ui_warn_once "privileges" "MacPorts running without privileges.\
+    if {$usealtworkpath} {
+         ui_warn_once "privileges" "MacPorts running without privileges.\
                 You may be unable to complete certain actions (e.g. install)."
-    }
+
+        set newsourcepath "${altprefix}${portpath}"
     
-    # 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] && ![tbool ports_dryrun]} {
             file mkdir $newsourcepath
             ui_debug "$newsourcepath created"
             ui_debug "Going to copy: ${portpath}/Portfile"
@@ -1545,38 +1538,56 @@
         }
     }
 
+    if {![file isdirectory $workpath] && ![tbool ports_dryrun]} {
+        file mkdir $workpath
+        chownAsRoot $portbuildpath
+        # 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 if MacPorts was started with sudo
+    dropPrivileges
+
     # flock Portfile
     set statefile [file join $workpath .macports.${name}.state]
     if {[file exists $statefile]} {
-        if {![file writable $statefile]} {
+        if {![file writable $statefile] && ![tbool ports_dryrun]} {
             return -code error "$statefile is not writable - check permission on port directory"
         }
         if {[file mtime ${portpath}/Portfile] >= [clock seconds]} {
             return -code error "Portfile is from the future - check date and time of your system"
         }
         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")} {
+            if {![tbool ports_dryrun]} {
                 ui_msg "Portfile changed since last build; discarding previous state."
+                chownAsRoot $portbuildpath
                 delete $workpath
                 file mkdir $workpath
             } else {
                 ui_msg "Portfile changed since last build but not discarding previous state (dry run)"
             }
         }
+    } elseif {[tbool ports_dryrun]} {
+        set statefile /dev/null
     }
 
     set fd [open $statefile a+]
-    if {[catch {flock $fd -exclusive -noblock} result]} {
-        if {"$result" == "EAGAIN"} {
-            ui_msg "Waiting for lock on $statefile"
-        } elseif {"$result" == "EOPNOTSUPP"} {
-            # Locking not supported, just return
-            return $fd
-        } else {
-            return -code error "$result obtaining lock on $statefile"
+    if {![tbool ports_dryrun]} {
+        if {[catch {flock $fd -exclusive -noblock} result]} {
+            if {"$result" == "EAGAIN"} {
+                ui_msg "Waiting for lock on $statefile"
+            } elseif {"$result" == "EOPNOTSUPP"} {
+                # Locking not supported, just return
+                return $fd
+            } else {
+                return -code error "$result obtaining lock on $statefile"
+            }
         }
+        flock $fd -exclusive
     }
-    flock $fd -exclusive
     return $fd
 }
 
@@ -1850,12 +1861,9 @@
     if {[variant_exists universal]} {
         ui_debug "universal variant already exists, so not adding the default one"
     } elseif {[exists universal_variant] && ![option universal_variant]} {
-        ui_debug "'universal_variant no' specified, so not adding the default universal variant"
+        ui_debug "universal_variant is false, so not adding the default universal variant"
     } elseif {[exists use_xmkmf] && [option use_xmkmf]} {
         ui_debug "using xmkmf, so not adding the default universal variant"
-    } elseif {[exists use_configure] && ![option use_configure] && ![exists xcode.project]} {
-        # Allow +universal if port uses xcode portgroup.
-        ui_debug "not using configure, so not adding the default universal variant"
     } elseif {![exists os.universal_supported] || ![option os.universal_supported]} {
         ui_debug "OS doesn't support universal builds, so not adding the default universal variant"
     } elseif {[llength [option supported_archs]] == 1} {
@@ -1864,10 +1872,6 @@
         ui_debug "adding the default universal variant"
         variant universal {}
     }
-    
-    if {[variant_isset universal] && ![variant_exists universal]} {
-        ui_warn "[option name] has no universal variant"
-    }
 }
 
 # Target class definition.
@@ -2022,6 +2026,13 @@
 
 proc adduser {name args} {
     global os.platform
+
+    if {[getuid] != 0} {
+        ui_warn "adduser only works when running as root."
+        ui_warn "The requested user '$name' was not created."
+        return
+    }
+
     set passwd {*}
     set uid [nextuid]
     set gid [existsgroup nogroup]
@@ -2049,13 +2060,20 @@
         exec $dscl . -create /Users/${name} UserShell ${shell}
     } else {
         # XXX adduser is only available for darwin, add more support here
-        ui_warn "WARNING: adduser is not implemented on ${os.platform}."
-        ui_warn "The requested user was not created."
+        ui_warn "adduser is not implemented on ${os.platform}."
+        ui_warn "The requested user '$name' was not created."
     }
 }
 
 proc addgroup {name args} {
     global os.platform
+
+    if {[getuid] != 0} {
+        ui_warn "addgroup only works when running as root."
+        ui_warn "The requested group '$name' was not created."
+        return
+    }
+
     set gid [nextgid]
     set realname ${name}
     set passwd {*}
@@ -2081,7 +2099,7 @@
         }
     } else {
         # XXX addgroup is only available for darwin, add more support here
-        ui_warn "WARNING: addgroup is not implemented on ${os.platform}."
+        ui_warn "addgroup is not implemented on ${os.platform}."
         ui_warn "The requested group was not created."
     }
 }
@@ -2328,15 +2346,17 @@
 #
 # @param path the file/directory to be chowned
 proc chownAsRoot {path} {
-    global euid macportsuser
+    global euid egid macportsuser
 
     if { [getuid] == 0 } {
         if {[geteuid] != 0} {
             # if started with sudo but have dropped the privileges
+            setegid $egid
             seteuid $euid
             ui_debug "euid changed to: [geteuid]"
             chown  ${path} ${macportsuser}
             ui_debug "chowned $path to $macportsuser"
+            setegid [uname_to_gid "$macportsuser"]
             seteuid [name_to_uid "$macportsuser"]
             ui_debug "euid changed to: [geteuid]"
         } else {
@@ -2352,14 +2372,16 @@
 # @param file the file in question
 # @param attributes the attributes for the file
 proc fileAttrsAsRoot {file attributes} {
-    global euid macportsuser
+    global euid egid macportsuser
     if {[getuid] == 0} {
         if {[geteuid] != 0} {
             # Started as root, but not root now
+            setegid $egid
             seteuid $euid
             ui_debug "euid changed to: [geteuid]"
             ui_debug "setting attributes on $file"
             eval file attributes {$file} $attributes
+            setegid [uname_to_gid "$macportsuser"]
             seteuid [name_to_uid "$macportsuser"]
             ui_debug "euid changed to: [geteuid]"
         } else {
@@ -2549,3 +2571,86 @@
         return ${os.arch}
     }
 }
+
+# check that the selected archs are supported
+proc check_supported_archs {} {
+    global supported_archs build_arch universal_archs configure.build_arch configure.universal_archs name
+    if {$supported_archs == "noarch"} {
+        return 0
+    } elseif {[variant_exists universal] && [variant_isset universal]} {
+        if {[llength ${configure.universal_archs}] > 1 || $universal_archs == ${configure.universal_archs}} {
+            return 0
+        } else {
+            ui_error "$name cannot be installed for the configured universal_archs '$universal_archs' because it only supports the arch(s) '$supported_archs'."
+            return 1
+        }
+    } elseif {$build_arch == "" || ${configure.build_arch} != ""} {
+        return 0
+    }
+    ui_error "$name cannot be installed for the configured build_arch '$build_arch' because it only supports the arch(s) '$supported_archs'."
+    return 1
+}
+
+# check if the installed xcode version is new enough
+proc _check_xcode_version {} {
+    global os.subplatform macosx_version xcodeversion
+
+    if {${os.subplatform} == "macosx"} {
+        switch $macosx_version {
+            10.4 {
+                set min 2.0
+                set ok 2.4.1
+                set rec 2.5
+            }
+            10.5 {
+                set min 3.0
+                set ok 3.1
+                set rec 3.1.4
+            }
+            default {
+                set min 3.2
+                set ok 3.2
+                set rec 3.2.2
+            }
+        }
+        if {$xcodeversion == "none"} {
+            ui_warn "Xcode does not appear to be installed; most ports will likely fail to build."
+        } elseif {[rpm-vercomp $xcodeversion $min] < 0} {
+            ui_error "The installed version of Xcode (${xcodeversion}) is too old to use on the installed OS version. Version $rec or later is recommended on Mac OS X ${macosx_version}."
+            return 1
+        } elseif {[rpm-vercomp $xcodeversion $ok] < 0} {
+            ui_warn "The installed version of Xcode (${xcodeversion}) is known to cause problems. Version $rec or later is recommended on Mac OS X ${macosx_version}."
+        }
+    }
+    return 0
+}
+
+# check if we can unarchive this port
+proc _archive_available {} {
+    global name version revision portvariants ports_source_only
+    global unarchive.srcpath workpath
+
+    if {[option portarchivemode] != "yes" || [tbool ports_source_only]} {
+        return 0
+    }
+
+    # Define archive directory, file, and path
+    if {![string equal ${unarchive.srcpath} ${workpath}] && ![string equal ${unarchive.srcpath} ""]} {
+        set unarchive.fullsrcpath [file join ${unarchive.srcpath} [option archive.subdir]]
+    } else {
+        set unarchive.fullsrcpath ${unarchive.srcpath}
+    }
+
+    set found 0
+    foreach unarchive.type [option portarchivetype] {
+        if {[catch {archiveTypeIsSupported ${unarchive.type}} errmsg] == 0} {
+            set archstring [join [get_canonical_archs] -]
+            set unarchive.file "${name}-${version}_${revision}${portvariants}.${archstring}.${unarchive.type}"
+            if {[file isfile [file join ${unarchive.fullsrcpath} ${unarchive.file}]]} {
+                set found 1
+                break
+            }
+        }
+    }
+    return $found
+}

Modified: branches/new-help-system/base/src/registry2.0/Makefile
===================================================================
--- branches/new-help-system/base/src/registry2.0/Makefile	2010-07-16 23:53:45 UTC (rev 69809)
+++ branches/new-help-system/base/src/registry2.0/Makefile	2010-07-17 00:51:07 UTC (rev 69810)
@@ -12,6 +12,8 @@
 include ../../Mk/macports.autoconf.mk
 include ../../Mk/macports.tea.mk
 
+pkgIndex.tcl: $(SRCS)
+
 CFLAGS+=	${SQLITE3_CFLAGS}
 LIBS+=	${SQLITE3_LIBS}
 

Modified: branches/new-help-system/base/src/registry2.0/portimage.tcl
===================================================================
--- branches/new-help-system/base/src/registry2.0/portimage.tcl	2010-07-16 23:53:45 UTC (rev 69809)
+++ branches/new-help-system/base/src/registry2.0/portimage.tcl	2010-07-17 00:51:07 UTC (rev 69810)
@@ -267,7 +267,7 @@
             registry::check_dependents $requested $force
         }
 
-        _deactivate_contents $requested {} $force
+        _deactivate_contents $requested [$requested files] $force
         $requested state imaged
     } else {
         set ref [registry::open_entry $name $version $revision $variants]
@@ -381,11 +381,13 @@
 ##
 ## @param [in] srcfile path to file in image
 ## @param [in] dstfile path to activate file to
+## @return 1 if file needs to be explicitly deleted if we have to roll back, 0 otherwise
 proc _activate_file {srcfile dstfile} {
     switch [file type $srcfile] {
         link {
             ui_debug "activating link: $dstfile"
             file copy -force -- $srcfile $dstfile
+            return 1
         }
         directory {
             # Don't recursively copy directories
@@ -398,6 +400,7 @@
                 # set mtime on installed element
                 file mtime $dstfile [file mtime $srcfile]
             }
+            return 0
         }
         default {
             ui_debug "activating file: $dstfile"
@@ -406,6 +409,7 @@
                 ui_debug "hardlinking $srcfile to $dstfile failed, symlinking instead"
                 file link -symbolic $dstfile $srcfile
             }
+            return 1
         }
     }
 }
@@ -483,7 +487,7 @@
                             # the registry
                             if { $owner != {} && $owner != $port } {
                                 throw registry::image-error "Image error: $file is being used by the active [$owner name] port.  Please deactivate this port first, or use 'port -f activate [$port name]' to force the activation."
-                            } elseif { $owner == {} && [file exists $file] } {
+                            } elseif { $owner == {} && ![catch {file type $file}] } {
                                 throw registry::image-error "Image error: $file already exists and does not belong to a registered port.  Unable to activate port [$port name]. Use 'port -f activate [$port name]' to force the activation."
                             }
                         }
@@ -520,14 +524,17 @@
             # directories are before their elements.
             # We don't have to do this as mentioned above, but it makes the
             # debug output of activate make more sense.
-            set theList [lsort -increasing -unique $files]
+            set files [lsort -increasing -unique $files]
+            set rollback_filelist {}
 
             registry::write {
                 # Activate it, and catch errors so we can roll-back
                 try {
                     $port activate $imagefiles
-                    foreach file $theList {
-                        _activate_file "${imagedir}${file}" $file
+                    foreach file $files {
+                        if {[_activate_file "${imagedir}${file}" $file] == 1} {
+                            lappend rollback_filelist $file
+                        }
                     }
                 } catch {*} {
                     ui_debug "Activation failed, rolling back."
@@ -539,7 +546,7 @@
         } catch {*} {
             # roll back activation of this port
             if {[info exists deactivate_this]} {
-                _deactivate_contents $port {} yes
+                _deactivate_contents $port $rollback_filelist yes yes
             }
             # if any errors occurred, move backed-up files back to their original
             # locations, then rethrow the error. Transaction rollback will take care
@@ -631,14 +638,17 @@
         # are before their elements.
         # We don't have to do this as mentioned above, but it makes the
         # debug output of activate make more sense.
-        set theList [lsort -increasing -unique $files]
+        set files [lsort -increasing -unique $files]
+        set rollback_filelist {}
 
         # Activate it, and catch errors so we can roll-back
-        if { [catch { foreach file $theList {
-                        _activate_file "${imagedir}${file}" $file
+        if { [catch { foreach file $files {
+                        if {[_activate_file "${imagedir}${file}" $file] == 1} {
+                            lappend rollback_filelist $file
+                        }
                     }} result]} {
             ui_debug "Activation failed, rolling back."
-            _deactivate_contents $name $imagefiles
+            _deactivate_contents $name $rollback_filelist yes yes
             # return backed up files to their old locations
             foreach f $backups {
                 set bakfile "${f}${baksuffix}"
@@ -680,12 +690,9 @@
     }
 }
 
-proc _deactivate_contents {port imagefiles {force 0}} {
+proc _deactivate_contents {port imagefiles {force 0} {rollback 0}} {
     variable use_reg2
     set files [list]
-    if {$use_reg2} {
-        set imagefiles [$port files]
-    }
 
     foreach file $imagefiles {
         if { [file exists $file] || (![catch {file type $file}] && [file type $file] == "link") } {
@@ -697,14 +704,14 @@
             # instead of the paths we currently have, users' registry won't
             # match and activate will say that some file exists but doesn't
             # belong to any port.
-            set theFile [file normalize $file]
-            lappend files $theFile
+            # The custom realpath proc is necessary because file normalize
+            # does not resolve symlinks on OS X < 10.6
+            set directory [realpath [file dirname $file]]
+            lappend files [file join $directory [file tail $file]]
 
-            # Split out the filename's subpaths and add them to the image list as
-            # well. The realpath call is necessary because file normalize
-            # does not resolve symlinks on OS X < 10.6
-            set directory [realpath [file dirname $theFile]]
-            while { [lsearch -exact $files $directory] == -1 } { 
+            # Split out the filename's subpaths and add them to the image list
+            # as well.
+            while { [lsearch -exact $files $directory] == -1 } {
                 lappend files $directory
                 set directory [file dirname $directory]
             }
@@ -716,18 +723,18 @@
     # Sort the list in reverse order, removing duplicates.
     # Since the list is sorted in reverse order, we're sure that directories
     # are after their elements.
-    set theList [lsort -decreasing -unique $files]
+    set files [lsort -decreasing -unique $files]
 
     # Remove all elements.
-    if {$use_reg2} {
+    if {$use_reg2 && !$rollback} {
         registry::write {
             $port deactivate $imagefiles
-            foreach file $theList {
+            foreach file $files {
                 _deactivate_file $file
             }
         }
     } else {
-        foreach file $theList {
+        foreach file $files {
             _deactivate_file $file
         }
     }

Modified: branches/new-help-system/base/src/registry2.0/portuninstall.tcl
===================================================================
--- branches/new-help-system/base/src/registry2.0/portuninstall.tcl	2010-07-16 23:53:45 UTC (rev 69809)
+++ branches/new-help-system/base/src/registry2.0/portuninstall.tcl	2010-07-17 00:51:07 UTC (rev 69810)
@@ -108,18 +108,18 @@
     } elseif { [llength $ilist] == 1 } {
         if {$use_reg2} {
             set port [lindex $ilist 0]
-            if {$v == ""} {
-                set v "[$port version]_[$port revision][$port variants]"
-            }
+            set version [$port version]
+            set revision [$port revision]
+            set variants [$port variants]
         } else {
             set version [lindex [lindex $ilist 0] 1]
             set revision [lindex [lindex $ilist 0] 2]
             set variants [lindex [lindex $ilist 0] 3]
             set active [lindex [lindex $ilist 0] 4]
-            if {$v == ""} {
-                set v "${version}_${revision}${variants}"
-            }
         }
+        if {$v == ""} {
+            set v "${version}_${revision}${variants}"
+        }
     } else {
         throw registry::invalid "Registry error: $portname not registered as installed"
     }
@@ -147,7 +147,9 @@
                 ui_msg "For $portname @${v}: skipping deactivate (dry run)"
             } else {
                 if {[info exists options(ports_uninstall_no-exec)] || ![registry::run_target $port deactivate $optionslist]} {
-                    portimage::deactivate $portname $v [array get options]
+                    if {[$port installtype] == "image"} {
+                        portimage::deactivate $portname $v [array get options]
+                    }
                 }
             }
         }
@@ -338,17 +340,17 @@
                     catch {file copy $fname "${fname}${bak_suffix}"}
                 }
             }
-            
-            set theFile [file normalize $fname]
-            if { [file exists $theFile] || (![catch {file type $theFile}] && [file type $theFile] == "link") } {
+
+            if { [file exists $fname] || (![catch {file type $fname}] && [file type $fname] == "link") } {
                 # Normalize the file path to avoid removing the intermediate
                 # symlinks (remove the empty directories instead)
-                lappend files $theFile
+                # The custom realpath proc is necessary because file normalize
+                # does not resolve symlinks on OS X < 10.6
+                set directory [realpath [file dirname $fname]]
+                lappend files [file join $directory [file tail $fname]]
     
                 # Split out the filename's subpaths and add them to the
-                # list as well. The realpath call is necessary because file normalize
-                # does not resolve symlinks on OS X < 10.6
-                set directory [realpath [file dirname $theFile]]
+                # list as well.
                 while { [lsearch -exact $files $directory] == -1 } { 
                     lappend files $directory
                     set directory [file dirname $directory]
@@ -359,10 +361,10 @@
         # Sort the list in reverse order, removing duplicates.
         # Since the list is sorted in reverse order, we're sure that directories
         # are after their elements.
-        set theList [lsort -decreasing -unique $files]
+        set files [lsort -decreasing -unique $files]
     
         # Remove all elements.
-        _uninstall_list $theList
+        _uninstall_list $files
     
         if {$use_reg2} {
             registry::entry delete $port

Modified: branches/new-help-system/base/src/registry2.0/receipt_flat.tcl
===================================================================
--- branches/new-help-system/base/src/registry2.0/receipt_flat.tcl	2010-07-16 23:53:45 UTC (rev 69809)
+++ branches/new-help-system/base/src/registry2.0/receipt_flat.tcl	2010-07-17 00:51:07 UTC (rev 69810)
@@ -764,7 +764,7 @@
 }
 
 # List all ports this one depends on
-proc list_depends {name version revision variants} {
+proc list_depends {name {version ""} {revision ""} {variants 0}} {
 	variable dep_map
 	if { [llength $dep_map] < 1 && [info exists dep_map] } {
 		open_dep_map

Modified: branches/new-help-system/base/src/registry2.0/receipt_sqlite.tcl
===================================================================
--- branches/new-help-system/base/src/registry2.0/receipt_sqlite.tcl	2010-07-16 23:53:45 UTC (rev 69809)
+++ branches/new-help-system/base/src/registry2.0/receipt_sqlite.tcl	2010-07-17 00:51:07 UTC (rev 69810)
@@ -266,7 +266,19 @@
         if {$props(installtype) == "image"} {
             $regref map $props(imagefiles)
             if {$props(state) == "installed"} {
-                $regref activate $props(imagefiles) $props(files)
+                if {[llength $props(imagefiles)] != [llength $props(files)]} {
+                    # deal with this mess, just drop the extras...
+                    set i 0
+                    set ilist {}; set flist {}
+                    while {$i < [llength $props(imagefiles)] && $i < [llength $props(files)]} {
+                        lappend ilist [lindex $props(imagefiles) $i]
+                        lappend flist [lindex $props(files) $i]
+                        incr i
+                    }
+                    $regref activate $ilist $flist
+                } else {
+                    $regref activate $props(imagefiles) $props(files)
+                }
             }
         } else {
             $regref map $props(files)


Property changes on: branches/new-help-system/base/src/registry2.0/receipt_sqlite.tcl
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/gsoc08-privileges/base/src/registry1.0/receipt_sqlite.tcl:37343-46937
/branches/gsoc09-logging/base/src/registry1.0/receipt_sqlite.tcl:51231-60371
/branches/universal-sanity/base/src/registry1.0/receipt_sqlite.tcl:51872-52323
/branches/variant-descs-14482/base/src/registry1.0/receipt_sqlite.tcl:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
/users/perry/base-bugs_and_notes/src/registry1.0/receipt_sqlite.tcl:45682-46060
/users/perry/base-select/src/registry1.0/receipt_sqlite.tcl:44044-44692
   + /branches/gsoc08-privileges/base/src/registry1.0/receipt_sqlite.tcl:37343-46937
/branches/gsoc09-logging/base/src/registry1.0/receipt_sqlite.tcl:51231-60371
/branches/universal-sanity/base/src/registry1.0/receipt_sqlite.tcl:51872-52323
/branches/variant-descs-14482/base/src/registry1.0/receipt_sqlite.tcl:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
/trunk/base/src/registry2.0/receipt_sqlite.tcl:57889-69809
/users/perry/base-bugs_and_notes/src/registry1.0/receipt_sqlite.tcl:45682-46060
/users/perry/base-select/src/registry1.0/receipt_sqlite.tcl:44044-44692

Modified: branches/new-help-system/base/src/registry2.0/registry_util.tcl
===================================================================
--- branches/new-help-system/base/src/registry2.0/registry_util.tcl	2010-07-16 23:53:45 UTC (rev 69809)
+++ branches/new-help-system/base/src/registry2.0/registry_util.tcl	2010-07-17 00:51:07 UTC (rev 69810)
@@ -83,6 +83,11 @@
 ## @return   true if successful, false otherwise
 proc run_target {port target options} {
     set portspec "[$port name] @[$port version]_[$port revision][$port variants]"
+    if {[$port portfile] == ""} {
+        ui_debug "no portfile in registry for $portspec"
+        return 0
+    }
+
     if {![catch {set mport [mportopen_installed [$port name] [$port version] [$port revision] [$port variants] $options]}]} {
         if {[catch {set result [mportexec $mport $target]} result] || $result != 0} {
             global errorInfo
@@ -107,6 +112,10 @@
                 }
             }
         } else {
+            global macports::keeplogs
+            if {(![info exists keeplogs] || !$keeplogs) && $target != "activate"} {
+                catch {mportexec $mport clean}
+            }
             mportclose_installed $mport
             return 1
         }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20100716/207cbce6/attachment-0001.html>


More information about the macports-changes mailing list