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

cal at macports.org cal at macports.org
Sun Aug 3 08:04:12 PDT 2014


Revision: 122999
          https://trac.macports.org/changeset/122999
Author:   cal at macports.org
Date:     2014-08-03 08:04:12 -0700 (Sun, 03 Aug 2014)
Log Message:
-----------
new-help-system: Merge from trunk, update for in-tree Tcl compatibility, port documentation changes

Modified Paths:
--------------
    branches/new-help-system/base/ChangeLog
    branches/new-help-system/base/Doxyfile.in
    branches/new-help-system/base/LICENSE
    branches/new-help-system/base/Makefile.in
    branches/new-help-system/base/Mk/macports.autoconf.mk.in
    branches/new-help-system/base/Mk/macports.subdir.mk
    branches/new-help-system/base/aclocal.m4
    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/macports.conf.5
    branches/new-help-system/base/doc/macports.conf.in
    branches/new-help-system/base/doc/port-activate.1
    branches/new-help-system/base/doc/port-edit.1
    branches/new-help-system/base/doc/port-fetch.1
    branches/new-help-system/base/doc/port-install.1
    branches/new-help-system/base/doc/port-uninstall.1
    branches/new-help-system/base/doc/port.1
    branches/new-help-system/base/doc/port.1.txt
    branches/new-help-system/base/doc/portfile.7
    branches/new-help-system/base/doc/portgroup.7
    branches/new-help-system/base/doc/portundocumented.7
    branches/new-help-system/base/m4/foundation.m4
    branches/new-help-system/base/m4/tcl.m4
    branches/new-help-system/base/portmgr/ReleaseProcess
    branches/new-help-system/base/portmgr/dmg/License.html
    branches/new-help-system/base/portmgr/jobs/Makefile
    branches/new-help-system/base/portmgr/jobs/PortIndex2MySQL.tcl
    branches/new-help-system/base/portmgr/jobs/port_binary_distributable.tcl
    branches/new-help-system/base/src/Makefile.in
    branches/new-help-system/base/src/config.h.in
    branches/new-help-system/base/src/cregistry/entry.c
    branches/new-help-system/base/src/cregistry/entry.h
    branches/new-help-system/base/src/cregistry/file.c
    branches/new-help-system/base/src/cregistry/registry.c
    branches/new-help-system/base/src/cregistry/registry.h
    branches/new-help-system/base/src/cregistry/sql.c
    branches/new-help-system/base/src/darwintracelib1.0/access.c
    branches/new-help-system/base/src/darwintracelib1.0/close.c
    branches/new-help-system/base/src/darwintracelib1.0/darwintrace.c
    branches/new-help-system/base/src/darwintracelib1.0/darwintrace.h
    branches/new-help-system/base/src/darwintracelib1.0/dup2.c
    branches/new-help-system/base/src/darwintracelib1.0/mkdir.c
    branches/new-help-system/base/src/darwintracelib1.0/open.c
    branches/new-help-system/base/src/darwintracelib1.0/proc.c
    branches/new-help-system/base/src/darwintracelib1.0/readdir.c
    branches/new-help-system/base/src/darwintracelib1.0/readlink.c
    branches/new-help-system/base/src/darwintracelib1.0/rename.c
    branches/new-help-system/base/src/darwintracelib1.0/rmdir.c
    branches/new-help-system/base/src/darwintracelib1.0/stat.c
    branches/new-help-system/base/src/darwintracelib1.0/unlink.c
    branches/new-help-system/base/src/machista1.0/Makefile.in
    branches/new-help-system/base/src/machista1.0/libmachista.c
    branches/new-help-system/base/src/macports1.0/get_systemconfiguration_proxies.c
    branches/new-help-system/base/src/macports1.0/macports.tcl
    branches/new-help-system/base/src/macports1.0/macports_dlist.tcl
    branches/new-help-system/base/src/macports1.0/macports_test_autoconf.tcl.in
    branches/new-help-system/base/src/macports1.0/sysctl.c
    branches/new-help-system/base/src/macports1.0/tests/Portfile
    branches/new-help-system/base/src/macports1.0/tests/macports.test
    branches/new-help-system/base/src/macports1.0/tests/macports_dlist.test
    branches/new-help-system/base/src/macports1.0/tests/macports_util.test
    branches/new-help-system/base/src/macports1.0/tests/test.tcl
    branches/new-help-system/base/src/package1.0/package_test_autoconf.tcl.in
    branches/new-help-system/base/src/package1.0/portarchivefetch.tcl
    branches/new-help-system/base/src/package1.0/portdpkg.tcl
    branches/new-help-system/base/src/package1.0/portmpkg.tcl
    branches/new-help-system/base/src/package1.0/portpkg.tcl
    branches/new-help-system/base/src/package1.0/portrpm.tcl
    branches/new-help-system/base/src/package1.0/portsrpm.tcl
    branches/new-help-system/base/src/package1.0/portunarchive.tcl
    branches/new-help-system/base/src/package1.0/tests/Portfile
    branches/new-help-system/base/src/package1.0/tests/library.tcl
    branches/new-help-system/base/src/package1.0/tests/portarchivefetch.test
    branches/new-help-system/base/src/package1.0/tests/portdmg.test
    branches/new-help-system/base/src/package1.0/tests/portdpkg.test
    branches/new-help-system/base/src/package1.0/tests/portmdmg.test
    branches/new-help-system/base/src/package1.0/tests/portmpkg.test
    branches/new-help-system/base/src/package1.0/tests/portpkg.test
    branches/new-help-system/base/src/package1.0/tests/test.tcl
    branches/new-help-system/base/src/pextlib1.0/Makefile.in
    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/filemap.c
    branches/new-help-system/base/src/pextlib1.0/flock.c
    branches/new-help-system/base/src/pextlib1.0/fs-traverse.c
    branches/new-help-system/base/src/pextlib1.0/mktemp.c
    branches/new-help-system/base/src/pextlib1.0/readline.c
    branches/new-help-system/base/src/pextlib1.0/realpath.c
    branches/new-help-system/base/src/pextlib1.0/rmd160cmd.c
    branches/new-help-system/base/src/pextlib1.0/setmode.c
    branches/new-help-system/base/src/pextlib1.0/strcasecmp.h
    branches/new-help-system/base/src/pextlib1.0/strsed.c
    branches/new-help-system/base/src/pextlib1.0/system.c
    branches/new-help-system/base/src/pextlib1.0/tracelib.c
    branches/new-help-system/base/src/pextlib1.0/tty.c
    branches/new-help-system/base/src/pextlib1.0/uid.c
    branches/new-help-system/base/src/pextlib1.0/xinstall.c
    branches/new-help-system/base/src/pkg_mkindex.sh.in
    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/fetch_common.tcl
    branches/new-help-system/base/src/port1.0/port_autoconf.tcl.in
    branches/new-help-system/base/src/port1.0/port_test_autoconf.tcl.in
    branches/new-help-system/base/src/port1.0/portactivate.tcl
    branches/new-help-system/base/src/port1.0/portconfigure.tcl
    branches/new-help-system/base/src/port1.0/portdestroot.tcl
    branches/new-help-system/base/src/port1.0/portdistcheck.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/portlint.tcl
    branches/new-help-system/base/src/port1.0/portlivecheck.tcl
    branches/new-help-system/base/src/port1.0/portload.tcl
    branches/new-help-system/base/src/port1.0/portmain.tcl
    branches/new-help-system/base/src/port1.0/porttrace.tcl
    branches/new-help-system/base/src/port1.0/portunload.tcl
    branches/new-help-system/base/src/port1.0/portutil.tcl
    branches/new-help-system/base/src/port1.0/tests/Portfile
    branches/new-help-system/base/src/port1.0/tests/portactivate.test
    branches/new-help-system/base/src/port1.0/tests/portchecksum.test
    branches/new-help-system/base/src/port1.0/tests/portclean.test
    branches/new-help-system/base/src/port1.0/tests/portdeactivate.test
    branches/new-help-system/base/src/port1.0/tests/portdepends.test
    branches/new-help-system/base/src/port1.0/tests/portdistcheck.test
    branches/new-help-system/base/src/port1.0/tests/portinstall.test
    branches/new-help-system/base/src/port1.0/tests/portload.test
    branches/new-help-system/base/src/port1.0/tests/portmain.test
    branches/new-help-system/base/src/port1.0/tests/portpatch.test
    branches/new-help-system/base/src/port1.0/tests/porttest.test
    branches/new-help-system/base/src/port1.0/tests/portuninstall.test
    branches/new-help-system/base/src/port1.0/tests/portutil.test
    branches/new-help-system/base/src/port1.0/tests/test.tcl
    branches/new-help-system/base/src/programs/Makefile.in
    branches/new-help-system/base/src/programs/daemondo/Makefile.in
    branches/new-help-system/base/src/registry2.0/entry.c
    branches/new-help-system/base/src/registry2.0/entryobj.c
    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_sqlite.tcl
    branches/new-help-system/base/src/registry2.0/registry.c
    branches/new-help-system/base/src/registry2.0/registry.h
    branches/new-help-system/base/src/registry2.0/registry_util.tcl
    branches/new-help-system/base/src/registry2.0/tests/depends.tcl
    branches/new-help-system/base/src/registry2.0/tests/entry.tcl
    branches/new-help-system/base/src/registry2.0/util.c
    branches/new-help-system/base/src/registry2.0/util.h
    branches/new-help-system/base/src/tclobjc1.0/Makefile.in
    branches/new-help-system/base/tests/test/statefile-unknown-version/test.tcl
    branches/new-help-system/base/tests/test/statefile-version1/test.tcl
    branches/new-help-system/base/tests/test/statefile-version1-outdated/test.tcl
    branches/new-help-system/base/tests/test/statefile-version2/test.tcl
    branches/new-help-system/base/tests/test/statefile-version2-invalid/test.tcl
    branches/new-help-system/base/tests/test/statefile-version2-outdated/test.tcl
    branches/new-help-system/base/tests/test/svn-and-patchsites/Portfile
    branches/new-help-system/base/tests/test/universal/test.tcl
    branches/new-help-system/base/tests/test/xcodeversion/test.tcl

Added Paths:
-----------
    branches/new-help-system/base/doc/Makefile.in
    branches/new-help-system/base/portmgr/dmg/postflight.in
    branches/new-help-system/base/src/cflib1.0/Makefile.in
    branches/new-help-system/base/src/cregistry/Makefile.in
    branches/new-help-system/base/src/cregistry/portgroup.c
    branches/new-help-system/base/src/cregistry/portgroup.h
    branches/new-help-system/base/src/darwintracelib1.0/Makefile.in
    branches/new-help-system/base/src/dedup_portfiles.tcl.in
    branches/new-help-system/base/src/images_to_archives.tcl.in
    branches/new-help-system/base/src/macports1.0/Makefile.in
    branches/new-help-system/base/src/package1.0/Makefile.in
    branches/new-help-system/base/src/port/Makefile.in
    branches/new-help-system/base/src/port1.0/Makefile.in
    branches/new-help-system/base/src/registry2.0/Makefile.in
    branches/new-help-system/base/src/registry2.0/portgroup.c
    branches/new-help-system/base/src/registry2.0/portgroup.h
    branches/new-help-system/base/src/registry2.0/portgroupobj.c
    branches/new-help-system/base/src/registry2.0/portgroupobj.h
    branches/new-help-system/base/src/upgrade_sources_conf_default.tcl.in
    branches/new-help-system/base/standard_configure.sh
    branches/new-help-system/base/tests/Makefile.in
    branches/new-help-system/base/tests/test/library.tcl.in
    branches/new-help-system/base/tests/test/trace/test.tcl.in
    branches/new-help-system/base/tests/test.tcl.in
    branches/new-help-system/base/vendor/

Removed Paths:
-------------
    branches/new-help-system/base/doc/Makefile
    branches/new-help-system/base/portmgr/dmg/postflight
    branches/new-help-system/base/src/cflib1.0/Makefile
    branches/new-help-system/base/src/cregistry/Makefile
    branches/new-help-system/base/src/darwintracelib1.0/Makefile
    branches/new-help-system/base/src/images_to_archives.tcl
    branches/new-help-system/base/src/macports1.0/Makefile
    branches/new-help-system/base/src/macports1.0/macports_fastload.tcl.in
    branches/new-help-system/base/src/package1.0/Makefile
    branches/new-help-system/base/src/port/Makefile
    branches/new-help-system/base/src/port1.0/Makefile
    branches/new-help-system/base/src/registry2.0/Makefile
    branches/new-help-system/base/src/thread2.6.diff
    branches/new-help-system/base/src/thread2.6.tar.gz
    branches/new-help-system/base/src/upgrade_sources_conf_default.tcl
    branches/new-help-system/base/tests/Makefile
    branches/new-help-system/base/tests/test/library.tcl
    branches/new-help-system/base/tests/test/trace/test.tcl
    branches/new-help-system/base/tests/test.tcl

Property Changed:
----------------
    branches/new-help-system/base/
    branches/new-help-system/base/doc/
    branches/new-help-system/base/portmgr/dmg/
    branches/new-help-system/base/src/
    branches/new-help-system/base/src/cflib1.0/
    branches/new-help-system/base/src/cregistry/
    branches/new-help-system/base/src/darwintracelib1.0/
    branches/new-help-system/base/src/macports1.0/
    branches/new-help-system/base/src/package1.0/
    branches/new-help-system/base/src/pextlib1.0/Makefile.in
    branches/new-help-system/base/src/port/
    branches/new-help-system/base/src/port1.0/
    branches/new-help-system/base/src/registry2.0/
    branches/new-help-system/base/src/registry2.0/receipt_sqlite.tcl
    branches/new-help-system/base/tests/
    branches/new-help-system/base/tests/test/
    branches/new-help-system/base/tests/test/trace/


Property changes on: branches/new-help-system/base
___________________________________________________________________
Modified: svn:ignore
   - autom4te.cache
config.log
config.status
Makefile
Doxyfile
tcldox
setupenv.bash

   + autom4te.cache
config.log
config.status
Makefile
Doxyfile
docs
setupenv.bash

Modified: svn:mergeinfo
   - /branches/gsoc08-privileges/base:37343-46937
/branches/gsoc09-logging/base:51231-60371
/branches/gsoc11-rev-upgrade/base:78828-88375
/branches/gsoc11-statistics/base:79520,79666
/branches/gsoc13-tests:106692-111324
/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-117083
/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/gsoc11-rev-upgrade/base:78828-88375
/branches/gsoc11-statistics/base:79520,79666
/branches/gsoc13-tests:106692-111324
/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-122997
/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	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/ChangeLog	2014-08-03 15:04:12 UTC (rev 122999)
@@ -3,15 +3,53 @@
 # $Id$
 ###
 
-Release 2.3 (unreleased)
+Release 2.4 (unreleased)
+    - Display notes for installed or updated ports at the end of the
+      installation to prevent them from getting lost in the scrolling output.
+      (#24507, cal in r118304, patch by snc)
+
+    - Handle SIGTERM and SIGINT (^C) in MacPorts to prevent inconsistencies in
+      the registry database when MacPorts is aborted during a critical
+      operation. (cal in r118297 and r118298)
+
+Release 2.3.1 (2014-06-26 by jmr)
+    - Added macports-clang-3.4 to compiler fallback lists
+      (#43932, jeremyhu in r118735, r119034)
+
+    - Added quoting to PATH and MANPATH variables set by the installer, to
+      accomodate paths containing spaces (#43798, jmr in r121311)
+
+    - Update for automatic dependencies for fetch.type git, needed due to the
+      git-core port being renamed to git (#44052, ciserlohn in r120928)
+
+    - Fixed failure to sync using daily tarball (#43821, cal in r120382)
+
+Release 2.3 (2014-05-24 by jmr)
+    - Use a private copy of Tcl 8.5 for MacPorts. Starting with this change
+      features introduced with Tcl 8.5 can be used in Portfiles while still
+      keeping support for Tiger and Leopard. (cal in r117621)
+
+    - Add select --summary option. (#36179, snc in r117607)
+
     - Display a progress indicator for slow downloads. (cal in r117044)
 
+    - Attempt to use HTTP pipelining when downloading. (cal in r117022)
+
     - Allow ports to select a specific version of the Mac OS X SDK
       for builds. (larryv in r116437)
 
+    - Check for Command Line Tools presence and Xcode license agreement
+      acceptance and print helpful warnings if they aren't detected. (cal in
+      r115900)
+
+    - Support using .tar.lz archives using use_lzip (mww in r114652)
+
     - Enhance the "move" Portfile builtin to support case-only renames
       on case-insensitive filesystems. (#41679, ryandesign in r114289)
 
+    - Fix a regression that caused problems with sandboxing when the MacPorts
+      prefix contained a symlink. (#39850, cal in r113704)
+
     - Disable Spotlight indexing on build directories, distfiles,
       registry, log files, archives, base source and the default ports
       tree. (cal in r113649)
@@ -20,6 +58,9 @@
       it was configured for and refer user to migration instructions.
       (raimue in r113478)
 
+    - Merge curl HTTP POST support required for MacPorts port statistics
+      developed in GSoC 2011 (jmr in r113396, original code by derek)
+
     - In debug output, sort environment variables and print one per
       line. (#40703, ryandesign in r113037)
 
@@ -29,6 +70,17 @@
     - Add "-prepend" command for Portfile options (similar to existing
       "-append" command). (#40655, ryandesign in r111990)
 
+    - Merge new test framework developed in GSoC 2013 (mariusc in r111325)
+
+    - Support clang's -stdlib option explicitly using configure.cxx_stdlib
+      rather than relying on its default value. This can be used to make
+      MacPorts use libc++ on OS X < 10.9. (larryv in r110519)
+
+    - Support syncing git-svn working copies. (jeremyhu in r109747)
+
+    - Remove support for mports:// and non-tarball HTTP/FTP port tree sources.
+      (cal in r109659)
+
 Release 2.2.1 (2013-10-26 by jmr)
     - Fixed a problem where dependency calculation could sometimes fail for
       ports that only support 32-bit architectures when the configured

Modified: branches/new-help-system/base/Doxyfile.in
===================================================================
--- branches/new-help-system/base/Doxyfile.in	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/Doxyfile.in	2014-08-03 15:04:12 UTC (rev 122999)
@@ -1,236 +1,2283 @@
-# Doxyfile 1.5.4
+# Doxyfile 1.8.5
 
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project.
+#
+# All text after a double hash (##) is considered a comment and is placed in
+# front of the TAG it is preceding.
+#
+# All text after a single hash (#) is considered a comment and will be ignored.
+# The format is:
+# TAG = value [value, ...]
+# For lists, items can also be appended using:
+# TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (\" \").
+
 #---------------------------------------------------------------------------
 # Project related configuration options
 #---------------------------------------------------------------------------
+
+# This tag specifies the encoding used for all characters in the config file
+# that follow. The default is UTF-8 which is also the encoding used for all text
+# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv
+# built into libc) for the transcoding. See http://www.gnu.org/software/libiconv
+# for the list of possible encodings.
+# The default value is: UTF-8.
+
 DOXYFILE_ENCODING      = UTF-8
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by
+# double-quotes, unless you are using Doxywizard) that should identify the
+# project for which the documentation is generated. This name is used in the
+# title of most generated pages and in a few other places.
+# The default value is: My Project.
+
 PROJECT_NAME           = @PACKAGE_NAME@
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
+# could be handy for archiving the generated documentation or if some version
+# control system is used.
+
 PROJECT_NUMBER         = @PACKAGE_VERSION@
-OUTPUT_DIRECTORY       = 
+
+# Using the PROJECT_BRIEF tag one can provide an optional one line description
+# for a project that appears at the top of each page and should give viewer a
+# quick idea about the purpose of the project. Keep the description short.
+
+PROJECT_BRIEF          =
+
+# With the PROJECT_LOGO tag one can specify an logo or icon that is included in
+# the documentation. The maximum height of the logo should not exceed 55 pixels
+# and the maximum width should not exceed 200 pixels. Doxygen will copy the logo
+# to the output directory.
+
+PROJECT_LOGO           =
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
+# into which the generated documentation will be written. If a relative path is
+# entered, it will be relative to the location where doxygen was started. If
+# left blank the current directory will be used.
+
+OUTPUT_DIRECTORY       =
+
+# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 4096 sub-
+# directories (in 2 levels) under the output directory of each output format and
+# will distribute the generated files over these directories. Enabling this
+# option can be useful when feeding doxygen a huge amount of source files, where
+# putting all generated files in the same directory would otherwise causes
+# performance problems for the file system.
+# The default value is: NO.
+
 CREATE_SUBDIRS         = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all constant output in the proper language.
+# Possible values are: Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-
+# Traditional, Croatian, Czech, Danish, Dutch, English, Esperanto, Farsi,
+# Finnish, French, German, Greek, Hungarian, Italian, Japanese, Japanese-en,
+# Korean, Korean-en, Latvian, Norwegian, Macedonian, Persian, Polish,
+# Portuguese, Romanian, Russian, Serbian, Slovak, Slovene, Spanish, Swedish,
+# Turkish, Ukrainian and Vietnamese.
+# The default value is: English.
+
 OUTPUT_LANGUAGE        = English
+
+# If the BRIEF_MEMBER_DESC tag is set to YES doxygen will include brief member
+# descriptions after the members that are listed in the file and class
+# documentation (similar to Javadoc). Set to NO to disable this.
+# The default value is: YES.
+
 BRIEF_MEMBER_DESC      = YES
+
+# If the REPEAT_BRIEF tag is set to YES doxygen will prepend the brief
+# description of a member or function before the detailed description
+#
+# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
+# brief descriptions will be completely suppressed.
+# The default value is: YES.
+
 REPEAT_BRIEF           = YES
-ABBREVIATE_BRIEF       = 
+
+# This tag implements a quasi-intelligent brief description abbreviator that is
+# used to form the text in various listings. Each string in this list, if found
+# as the leading text of the brief description, will be stripped from the text
+# and the result, after processing the whole list, is used as the annotated
+# text. Otherwise, the brief description is used as-is. If left blank, the
+# following values are used ($name is automatically replaced with the name of
+# the entity):The $name class, The $name widget, The $name file, is, provides,
+# specifies, contains, represents, a, an and the.
+
+ABBREVIATE_BRIEF       =
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
+# doxygen will generate a detailed section even if there is only a brief
+# description.
+# The default value is: NO.
+
 ALWAYS_DETAILED_SEC    = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
+# inherited members of a class in the documentation of that class as if those
+# members were ordinary class members. Constructors, destructors and assignment
+# operators of the base classes will not be shown.
+# The default value is: NO.
+
 INLINE_INHERITED_MEMB  = NO
+
+# If the FULL_PATH_NAMES tag is set to YES doxygen will prepend the full path
+# before files name in the file list and in the header files. If set to NO the
+# shortest path that makes the file name unique will be used
+# The default value is: YES.
+
 FULL_PATH_NAMES        = YES
-STRIP_FROM_PATH        = 
-STRIP_FROM_INC_PATH    = 
+
+# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path.
+# Stripping is only done if one of the specified strings matches the left-hand
+# part of the path. The tag can be used to show relative paths in the file list.
+# If left blank the directory from which doxygen is run is used as the path to
+# strip.
+#
+# Note that you can specify absolute paths here, but also relative paths, which
+# will be relative from the directory where doxygen is started.
+# This tag requires that the tag FULL_PATH_NAMES is set to YES.
+
+STRIP_FROM_PATH        =
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the
+# path mentioned in the documentation of a class, which tells the reader which
+# header file to include in order to use a class. If left blank only the name of
+# the header file containing the class definition is used. Otherwise one should
+# specify the list of include paths that are normally passed to the compiler
+# using the -I flag.
+
+STRIP_FROM_INC_PATH    =
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but
+# less readable) file names. This can be useful is your file systems doesn't
+# support long names like on DOS, Mac, or CD-ROM.
+# The default value is: NO.
+
 SHORT_NAMES            = NO
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the
+# first line (until the first dot) of a Javadoc-style comment as the brief
+# description. If set to NO, the Javadoc-style will behave just like regular Qt-
+# style comments (thus requiring an explicit @brief command for a brief
+# description.)
+# The default value is: NO.
+
 JAVADOC_AUTOBRIEF      = NO
+
+# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first
+# line (until the first dot) of a Qt-style comment as the brief description. If
+# set to NO, the Qt-style will behave just like regular Qt-style comments (thus
+# requiring an explicit \brief command for a brief description.)
+# The default value is: NO.
+
 QT_AUTOBRIEF           = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a
+# multi-line C++ special comment block (i.e. a block of //! or /// comments) as
+# a brief description. This used to be the default behavior. The new default is
+# to treat a multi-line C++ comment block as a detailed description. Set this
+# tag to YES if you prefer the old behavior instead.
+#
+# Note that setting this tag to YES also means that rational rose comments are
+# not recognized any more.
+# The default value is: NO.
+
 MULTILINE_CPP_IS_BRIEF = NO
-DETAILS_AT_TOP         = NO
+
+# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the
+# documentation from any documented member that it re-implements.
+# The default value is: YES.
+
 INHERIT_DOCS           = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce a
+# new page for each member. If set to NO, the documentation of a member will be
+# part of the file/class/namespace that contains it.
+# The default value is: NO.
+
 SEPARATE_MEMBER_PAGES  = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen
+# uses this value to replace tabs by spaces in code fragments.
+# Minimum value: 1, maximum value: 16, default value: 4.
+
 TAB_SIZE               = 8
-ALIASES                = 
+
+# This tag can be used to specify a number of aliases that act as commands in
+# the documentation. An alias has the form:
+# name=value
+# For example adding
+# "sideeffect=@par Side Effects:\n"
+# will allow you to put the command \sideeffect (or @sideeffect) in the
+# documentation, which will result in a user-defined paragraph with heading
+# "Side Effects:". You can put \n's in the value part of an alias to insert
+# newlines.
+
+ALIASES                =
+
+# This tag can be used to specify a number of word-keyword mappings (TCL only).
+# A mapping has the form "name=value". For example adding "class=itcl::class"
+# will allow you to use the command class in the itcl::class meaning.
+
+TCL_SUBST              =
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
+# only. Doxygen will then generate output that is more tailored for C. For
+# instance, some of the names that are used will be different. The list of all
+# members will be omitted, etc.
+# The default value is: NO.
+
 OPTIMIZE_OUTPUT_FOR_C  = NO
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or
+# Python sources only. Doxygen will then generate output that is more tailored
+# for that language. For instance, namespaces will be presented as packages,
+# qualified scopes will look different, etc.
+# The default value is: NO.
+
 OPTIMIZE_OUTPUT_JAVA   = NO
+
+# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
+# sources. Doxygen will then generate output that is tailored for Fortran.
+# The default value is: NO.
+
+OPTIMIZE_FOR_FORTRAN   = NO
+
+# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
+# sources. Doxygen will then generate output that is tailored for VHDL.
+# The default value is: NO.
+
+OPTIMIZE_OUTPUT_VHDL   = NO
+
+# Doxygen selects the parser to use depending on the extension of the files it
+# parses. With this tag you can assign which parser to use for a given
+# extension. Doxygen has a built-in mapping, but you can override or extend it
+# using this tag. The format is ext=language, where ext is a file extension, and
+# language is one of the parsers supported by doxygen: IDL, Java, Javascript,
+# C#, C, C++, D, PHP, Objective-C, Python, Fortran, VHDL. For instance to make
+# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C
+# (default is Fortran), use: inc=Fortran f=C.
+#
+# Note For files without extension you can use no_extension as a placeholder.
+#
+# Note that for custom extensions you also need to set FILE_PATTERNS otherwise
+# the files are not read by doxygen.
+
+EXTENSION_MAPPING      =
+
+# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments
+# according to the Markdown format, which allows for more readable
+# documentation. See http://daringfireball.net/projects/markdown/ for details.
+# The output of markdown processing is further processed by doxygen, so you can
+# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in
+# case of backward compatibilities issues.
+# The default value is: YES.
+
+MARKDOWN_SUPPORT       = YES
+
+# When enabled doxygen tries to link words that correspond to documented
+# classes, or namespaces to their corresponding documentation. Such a link can
+# be prevented in individual cases by by putting a % sign in front of the word
+# or globally by setting AUTOLINK_SUPPORT to NO.
+# The default value is: YES.
+
+AUTOLINK_SUPPORT       = YES
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
+# to include (a tag file for) the STL sources as input, then you should set this
+# tag to YES in order to let doxygen match functions declarations and
+# definitions whose arguments contain STL classes (e.g. func(std::string);
+# versus func(std::string) {}). This also make the inheritance and collaboration
+# diagrams that involve STL classes more complete and accurate.
+# The default value is: NO.
+
 BUILTIN_STL_SUPPORT    = NO
+
+# If you use Microsoft's C++/CLI language, you should set this option to YES to
+# enable parsing support.
+# The default value is: NO.
+
 CPP_CLI_SUPPORT        = NO
+
+# Set the SIP_SUPPORT tag to YES if your project consists of sip (see:
+# http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen
+# will parse them like normal C++ but will assume all classes use public instead
+# of private inheritance when no explicit protection keyword is present.
+# The default value is: NO.
+
 SIP_SUPPORT            = NO
+
+# For Microsoft's IDL there are propget and propput attributes to indicate
+# getter and setter methods for a property. Setting this option to YES will make
+# doxygen to replace the get and set methods by a property in the documentation.
+# This will only work if the methods are indeed getting or setting a simple
+# type. If this is not the case, or you want to show the methods anyway, you
+# should set this option to NO.
+# The default value is: YES.
+
+IDL_PROPERTY_SUPPORT   = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES, then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
+# all members of a group must be documented explicitly.
+# The default value is: NO.
+
 DISTRIBUTE_GROUP_DOC   = NO
+
+# Set the SUBGROUPING tag to YES to allow class member groups of the same type
+# (for instance a group of public functions) to be put as a subgroup of that
+# type (e.g. under the Public Functions section). Set it to NO to prevent
+# subgrouping. Alternatively, this can be done per class using the
+# \nosubgrouping command.
+# The default value is: YES.
+
 SUBGROUPING            = YES
+
+# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions
+# are shown inside the group in which they are included (e.g. using \ingroup)
+# instead of on a separate page (for HTML and Man pages) or section (for LaTeX
+# and RTF).
+#
+# Note that this feature does not work in combination with
+# SEPARATE_MEMBER_PAGES.
+# The default value is: NO.
+
+INLINE_GROUPED_CLASSES = NO
+
+# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions
+# with only public data fields or simple typedef fields will be shown inline in
+# the documentation of the scope in which they are defined (i.e. file,
+# namespace, or group documentation), provided this scope is documented. If set
+# to NO, structs, classes, and unions are shown on a separate page (for HTML and
+# Man pages) or section (for LaTeX and RTF).
+# The default value is: NO.
+
+INLINE_SIMPLE_STRUCTS  = NO
+
+# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or
+# enum is documented as struct, union, or enum with the name of the typedef. So
+# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
+# with name TypeT. When disabled the typedef will appear as a member of a file,
+# namespace, or class. And the struct will be named TypeS. This can typically be
+# useful for C code in case the coding convention dictates that all compound
+# types are typedef'ed and only the typedef is referenced, never the tag name.
+# The default value is: NO.
+
 TYPEDEF_HIDES_STRUCT   = NO
+
+# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This
+# cache is used to resolve symbols given their name and scope. Since this can be
+# an expensive process and often the same symbol appears multiple times in the
+# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small
+# doxygen will become slower. If the cache is too large, memory is wasted. The
+# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range
+# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536
+# symbols. At the end of a run doxygen will report the cache usage and suggest
+# the optimal cache size from a speed point of view.
+# Minimum value: 0, maximum value: 9, default value: 0.
+
+LOOKUP_CACHE_SIZE      = 0
+
 #---------------------------------------------------------------------------
 # Build related configuration options
 #---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
+# documentation are documented, even if no documentation was available. Private
+# class members and static file members will be hidden unless the
+# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES.
+# Note: This will also disable the warnings about undocumented members that are
+# normally produced when WARNINGS is set to YES.
+# The default value is: NO.
+
 EXTRACT_ALL            = YES
-EXTRACT_PRIVATE        = NO
-EXTRACT_STATIC         = NO
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class will
+# be included in the documentation.
+# The default value is: NO.
+
+EXTRACT_PRIVATE        = YES
+
+# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal
+# scope will be included in the documentation.
+# The default value is: NO.
+
+EXTRACT_PACKAGE        = YES
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file will be
+# included in the documentation.
+# The default value is: NO.
+
+EXTRACT_STATIC         = YES
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) defined
+# locally in source files will be included in the documentation. If set to NO
+# only classes defined in header files are included. Does not have any effect
+# for Java sources.
+# The default value is: YES.
+
 EXTRACT_LOCAL_CLASSES  = YES
+
+# This flag is only useful for Objective-C code. When set to YES local methods,
+# which are defined in the implementation section but not in the interface are
+# included in the documentation. If set to NO only methods in the interface are
+# included.
+# The default value is: NO.
+
 EXTRACT_LOCAL_METHODS  = NO
+
+# If this flag is set to YES, the members of anonymous namespaces will be
+# extracted and appear in the documentation as a namespace called
+# 'anonymous_namespace{file}', where file will be replaced with the base name of
+# the file that contains the anonymous namespace. By default anonymous namespace
+# are hidden.
+# The default value is: NO.
+
 EXTRACT_ANON_NSPACES   = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all
+# undocumented members inside documented classes or files. If set to NO these
+# members will be included in the various overviews, but no documentation
+# section is generated. This option has no effect if EXTRACT_ALL is enabled.
+# The default value is: NO.
+
 HIDE_UNDOC_MEMBERS     = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all
+# undocumented classes that are normally visible in the class hierarchy. If set
+# to NO these classes will be included in the various overviews. This option has
+# no effect if EXTRACT_ALL is enabled.
+# The default value is: NO.
+
 HIDE_UNDOC_CLASSES     = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend
+# (class|struct|union) declarations. If set to NO these declarations will be
+# included in the documentation.
+# The default value is: NO.
+
 HIDE_FRIEND_COMPOUNDS  = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any
+# documentation blocks found inside the body of a function. If set to NO these
+# blocks will be appended to the function's detailed documentation block.
+# The default value is: NO.
+
 HIDE_IN_BODY_DOCS      = NO
-INTERNAL_DOCS          = NO
+
+# The INTERNAL_DOCS tag determines if documentation that is typed after a
+# \internal command is included. If the tag is set to NO then the documentation
+# will be excluded. Set it to YES to include the internal documentation.
+# The default value is: NO.
+
+INTERNAL_DOCS          = YES
+
+# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file
+# names in lower-case letters. If set to YES upper-case letters are also
+# allowed. This is useful if you have classes or files whose names only differ
+# in case and if your file system supports case sensitive file names. Windows
+# and Mac users are advised to set this option to NO.
+# The default value is: system dependent.
+
 CASE_SENSE_NAMES       = NO
+
+# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with
+# their full class and namespace scopes in the documentation. If set to YES the
+# scope will be hidden.
+# The default value is: NO.
+
 HIDE_SCOPE_NAMES       = NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of
+# the files that are included by a file in the documentation of that file.
+# The default value is: YES.
+
 SHOW_INCLUDE_FILES     = YES
+
+# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include
+# files with double quotes in the documentation rather than with sharp brackets.
+# The default value is: NO.
+
+FORCE_LOCAL_INCLUDES   = NO
+
+# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the
+# documentation for inline members.
+# The default value is: YES.
+
 INLINE_INFO            = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the
+# (detailed) documentation of file and class members alphabetically by member
+# name. If set to NO the members will appear in declaration order.
+# The default value is: YES.
+
 SORT_MEMBER_DOCS       = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief
+# descriptions of file, namespace and class members alphabetically by member
+# name. If set to NO the members will appear in declaration order.
+# The default value is: NO.
+
 SORT_BRIEF_DOCS        = NO
+
+# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the
+# (brief and detailed) documentation of class members so that constructors and
+# destructors are listed first. If set to NO the constructors will appear in the
+# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS.
+# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief
+# member documentation.
+# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting
+# detailed member documentation.
+# The default value is: NO.
+
+SORT_MEMBERS_CTORS_1ST = NO
+
+# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy
+# of group names into alphabetical order. If set to NO the group names will
+# appear in their defined order.
+# The default value is: NO.
+
+SORT_GROUP_NAMES       = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by
+# fully-qualified names, including namespaces. If set to NO, the class list will
+# be sorted only by class name, not including the namespace part.
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the alphabetical
+# list.
+# The default value is: NO.
+
 SORT_BY_SCOPE_NAME     = NO
+
+# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper
+# type resolution of all parameters of a function it will reject a match between
+# the prototype and the implementation of a member function even if there is
+# only one candidate or it is obvious which candidate to choose by doing a
+# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still
+# accept a match between prototype and implementation in such cases.
+# The default value is: NO.
+
+STRICT_PROTO_MATCHING  = NO
+
+# The GENERATE_TODOLIST tag can be used to enable ( YES) or disable ( NO) the
+# todo list. This list is created by putting \todo commands in the
+# documentation.
+# The default value is: YES.
+
 GENERATE_TODOLIST      = YES
+
+# The GENERATE_TESTLIST tag can be used to enable ( YES) or disable ( NO) the
+# test list. This list is created by putting \test commands in the
+# documentation.
+# The default value is: YES.
+
 GENERATE_TESTLIST      = YES
+
+# The GENERATE_BUGLIST tag can be used to enable ( YES) or disable ( NO) the bug
+# list. This list is created by putting \bug commands in the documentation.
+# The default value is: YES.
+
 GENERATE_BUGLIST       = YES
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable ( YES) or disable ( NO)
+# the deprecated list. This list is created by putting \deprecated commands in
+# the documentation.
+# The default value is: YES.
+
 GENERATE_DEPRECATEDLIST= YES
-ENABLED_SECTIONS       = 
+
+# The ENABLED_SECTIONS tag can be used to enable conditional documentation
+# sections, marked by \if <section_label> ... \endif and \cond <section_label>
+# ... \endcond blocks.
+
+ENABLED_SECTIONS       =
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the
+# initial value of a variable or macro / define can have for it to appear in the
+# documentation. If the initializer consists of more lines than specified here
+# it will be hidden. Use a value of 0 to hide initializers completely. The
+# appearance of the value of individual variables and macros / defines can be
+# controlled using \showinitializer or \hideinitializer command in the
+# documentation regardless of this setting.
+# Minimum value: 0, maximum value: 10000, default value: 30.
+
 MAX_INITIALIZER_LINES  = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at
+# the bottom of the documentation of classes and structs. If set to YES the list
+# will mention the files that were used to generate the documentation.
+# The default value is: YES.
+
 SHOW_USED_FILES        = YES
-SHOW_DIRECTORIES       = YES
-FILE_VERSION_FILTER    = 
+
+# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This
+# will remove the Files entry from the Quick Index and from the Folder Tree View
+# (if specified).
+# The default value is: YES.
+
+SHOW_FILES             = YES
+
+# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces
+# page. This will remove the Namespaces entry from the Quick Index and from the
+# Folder Tree View (if specified).
+# The default value is: YES.
+
+SHOW_NAMESPACES        = YES
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that
+# doxygen should invoke to get the current version for each file (typically from
+# the version control system). Doxygen will invoke the program by executing (via
+# popen()) the command command input-file, where command is the value of the
+# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided
+# by doxygen. Whatever the program writes to standard output is used as the file
+# version. For an example see the documentation.
+
+FILE_VERSION_FILTER    =
+
+# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
+# by doxygen. The layout file controls the global structure of the generated
+# output files in an output format independent way. To create the layout file
+# that represents doxygen's defaults, run doxygen with the -l option. You can
+# optionally specify a file name after the option, if omitted DoxygenLayout.xml
+# will be used as the name of the layout file.
+#
+# Note that if you run doxygen from a directory containing a file called
+# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE
+# tag is left empty.
+
+LAYOUT_FILE            =
+
+# The CITE_BIB_FILES tag can be used to specify one or more bib files containing
+# the reference definitions. This must be a list of .bib files. The .bib
+# extension is automatically appended if omitted. This requires the bibtex tool
+# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info.
+# For LaTeX the style of the bibliography can be controlled using
+# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the
+# search path. Do not use file names with spaces, bibtex cannot handle them. See
+# also \cite for info how to create references.
+
+CITE_BIB_FILES         =
+
 #---------------------------------------------------------------------------
-# configuration options related to warning and progress messages
+# Configuration options related to warning and progress messages
 #---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated to
+# standard output by doxygen. If QUIET is set to YES this implies that the
+# messages are off.
+# The default value is: NO.
+
 QUIET                  = NO
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated to standard error ( stderr) by doxygen. If WARNINGS is set to YES
+# this implies that the warnings are on.
+#
+# Tip: Turn warnings on while writing the documentation.
+# The default value is: YES.
+
 WARNINGS               = YES
+
+# If the WARN_IF_UNDOCUMENTED tag is set to YES, then doxygen will generate
+# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag
+# will automatically be disabled.
+# The default value is: YES.
+
 WARN_IF_UNDOCUMENTED   = YES
+
+# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for
+# potential errors in the documentation, such as not documenting some parameters
+# in a documented function, or documenting parameters that don't exist or using
+# markup commands wrongly.
+# The default value is: YES.
+
 WARN_IF_DOC_ERROR      = YES
+
+# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that
+# are documented, but have no documentation for their parameters or return
+# value. If set to NO doxygen will only warn about wrong or incomplete parameter
+# documentation, but not about the absence of documentation.
+# The default value is: NO.
+
 WARN_NO_PARAMDOC       = NO
+
+# The WARN_FORMAT tag determines the format of the warning messages that doxygen
+# can produce. The string should contain the $file, $line, and $text tags, which
+# will be replaced by the file and line number from which the warning originated
+# and the warning text. Optionally the format may contain $version, which will
+# be replaced by the version of the file (if it could be obtained via
+# FILE_VERSION_FILTER)
+# The default value is: $file:$line: $text.
+
 WARN_FORMAT            = "$file:$line: $text "
-WARN_LOGFILE           = 
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning and error
+# messages should be written. If left blank the output is written to standard
+# error (stderr).
+
+WARN_LOGFILE           =
+
 #---------------------------------------------------------------------------
-# configuration options related to the input files
+# Configuration options related to the input files
 #---------------------------------------------------------------------------
+
+# The INPUT tag is used to specify the files and/or directories that contain
+# documented source files. You may enter file names like myfile.cpp or
+# directories like /usr/src/myproject. Separate the files or directories with
+# spaces.
+# Note: If this tag is empty the current directory is searched.
+
 INPUT                  = src
+
+# This tag can be used to specify the character encoding of the source files
+# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
+# libiconv (or the iconv built into libc) for the transcoding. See the libiconv
+# documentation (see: http://www.gnu.org/software/libiconv) for the list of
+# possible encodings.
+# The default value is: UTF-8.
+
 INPUT_ENCODING         = UTF-8
+
+# If the value of the INPUT tag contains directories, you can use the
+# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and
+# *.h) to filter out the source-files in the directories. If left blank the
+# following patterns are tested:*.c, *.cc, *.cxx, *.cpp, *.c++, *.java, *.ii,
+# *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, *.hh, *.hxx, *.hpp,
+# *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, *.m, *.markdown,
+# *.md, *.mm, *.dox, *.py, *.f90, *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf,
+# *.qsf, *.as and *.js.
+
 FILE_PATTERNS          = *.tcl \
                          *.c \
                          *.m \
                          *.h
+
+# The RECURSIVE tag can be used to specify whether or not subdirectories should
+# be searched for input files as well.
+# The default value is: NO.
+
 RECURSIVE              = YES
-EXCLUDE                = 
+
+# The EXCLUDE tag can be used to specify files and/or directories that should be
+# excluded from the INPUT source files. This way you can easily exclude a
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+#
+# Note that relative paths are relative to the directory from which doxygen is
+# run.
+
+EXCLUDE                =
+
+# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
+# directories that are symbolic links (a Unix file system feature) are excluded
+# from the input.
+# The default value is: NO.
+
 EXCLUDE_SYMLINKS       = NO
-EXCLUDE_PATTERNS       = 
-EXCLUDE_SYMBOLS        = 
-EXAMPLE_PATH           = 
-EXAMPLE_PATTERNS       = 
+
+# If the value of the INPUT tag contains directories, you can use the
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
+# certain files from those directories.
+#
+# Note that the wildcards are matched against the file with absolute path, so to
+# exclude all test directories for example use the pattern */test/*
+
+EXCLUDE_PATTERNS       =
+
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
+# (namespaces, classes, functions, etc.) that should be excluded from the
+# output. The symbol name can be a fully qualified name, a word, or if the
+# wildcard * is used, a substring. Examples: ANamespace, AClass,
+# AClass::ANamespace, ANamespace::*Test
+#
+# Note that the wildcards are matched against the file with absolute path, so to
+# exclude all test directories use the pattern */test/*
+
+EXCLUDE_SYMBOLS        =
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or directories
+# that contain example code fragments that are included (see the \include
+# command).
+
+EXAMPLE_PATH           =
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and
+# *.h) to filter out the source-files in the directories. If left blank all
+# files are included.
+
+EXAMPLE_PATTERNS       =
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
+# searched for input files to be used with the \include or \dontinclude commands
+# irrespective of the value of the RECURSIVE tag.
+# The default value is: NO.
+
 EXAMPLE_RECURSIVE      = NO
-IMAGE_PATH             = 
-INPUT_FILTER           = 
-FILTER_PATTERNS        = *.tcl=@prefix@/bin/tcl-dox
+
+# The IMAGE_PATH tag can be used to specify one or more files or directories
+# that contain images that are to be included in the documentation (see the
+# \image command).
+
+IMAGE_PATH             =
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should
+# invoke to filter for each input file. Doxygen will invoke the filter program
+# by executing (via popen()) the command:
+#
+# <filter> <input-file>
+#
+# where <filter> is the value of the INPUT_FILTER tag, and <input-file> is the
+# name of an input file. Doxygen will then use the output that the filter
+# program writes to standard output. If FILTER_PATTERNS is specified, this tag
+# will be ignored.
+#
+# Note that the filter must not add or remove lines; it is applied before the
+# code is scanned, but not when the output code is generated. If lines are added
+# or removed, the anchors will not be placed correctly.
+
+INPUT_FILTER           =
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
+# basis. Doxygen will compare the file name with each pattern and apply the
+# filter if there is a match. The filters are a list of the form: pattern=filter
+# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how
+# filters are used. If the FILTER_PATTERNS tag is empty or if none of the
+# patterns match the file name, INPUT_FILTER is applied.
+
+FILTER_PATTERNS        =
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
+# INPUT_FILTER ) will also be used to filter the input files that are used for
+# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES).
+# The default value is: NO.
+
 FILTER_SOURCE_FILES    = NO
+
+# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file
+# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and
+# it is also possible to disable source filtering for a specific pattern using
+# *.ext= (so without naming a filter).
+# This tag requires that the tag FILTER_SOURCE_FILES is set to YES.
+
+FILTER_SOURCE_PATTERNS =
+
+# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that
+# is part of the input, its contents will be placed on the main page
+# (index.html). This can be useful if you have a project on for instance GitHub
+# and want to reuse the introduction page also for the doxygen output.
+
+USE_MDFILE_AS_MAINPAGE =
+
 #---------------------------------------------------------------------------
-# configuration options related to source browsing
+# Configuration options related to source browsing
 #---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will be
+# generated. Documented entities will be cross-referenced with these sources.
+#
+# Note: To get rid of all source code in the generated output, make sure that
+# also VERBATIM_HEADERS is set to NO.
+# The default value is: NO.
+
 SOURCE_BROWSER         = YES
+
+# Setting the INLINE_SOURCES tag to YES will include the body of functions,
+# classes and enums directly into the documentation.
+# The default value is: NO.
+
 INLINE_SOURCES         = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any
+# special comment blocks from generated source code fragments. Normal C, C++ and
+# Fortran comments will always remain visible.
+# The default value is: YES.
+
 STRIP_CODE_COMMENTS    = NO
+
+# If the REFERENCED_BY_RELATION tag is set to YES then for each documented
+# function all documented functions referencing it will be listed.
+# The default value is: NO.
+
 REFERENCED_BY_RELATION = YES
+
+# If the REFERENCES_RELATION tag is set to YES then for each documented function
+# all documented entities called/used by that function will be listed.
+# The default value is: NO.
+
 REFERENCES_RELATION    = YES
+
+# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set
+# to YES, then the hyperlinks from functions in REFERENCES_RELATION and
+# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will
+# link to the documentation.
+# The default value is: YES.
+
 REFERENCES_LINK_SOURCE = YES
+
+# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the
+# source code will show a tooltip with additional information such as prototype,
+# brief description and links to the definition and documentation. Since this
+# will make the HTML file larger and loading of large files a bit slower, you
+# can opt to disable this feature.
+# The default value is: YES.
+# This tag requires that the tag SOURCE_BROWSER is set to YES.
+
+SOURCE_TOOLTIPS        = YES
+
+# If the USE_HTAGS tag is set to YES then the references to source code will
+# point to the HTML generated by the htags(1) tool instead of doxygen built-in
+# source browser. The htags tool is part of GNU's global source tagging system
+# (see http://www.gnu.org/software/global/global.html). You will need version
+# 4.8.6 or higher.
+#
+# To use it do the following:
+# - Install the latest version of global
+# - Enable SOURCE_BROWSER and USE_HTAGS in the config file
+# - Make sure the INPUT points to the root of the source tree
+# - Run doxygen as normal
+#
+# Doxygen will invoke htags (and that will in turn invoke gtags), so these
+# tools must be available from the command line (i.e. in the search path).
+#
+# The result: instead of the source browser generated by doxygen, the links to
+# source code will now point to the output of htags.
+# The default value is: NO.
+# This tag requires that the tag SOURCE_BROWSER is set to YES.
+
 USE_HTAGS              = NO
+
+# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a
+# verbatim copy of the header file for each class for which an include is
+# specified. Set to NO to disable this.
+# See also: Section \class.
+# The default value is: YES.
+
 VERBATIM_HEADERS       = YES
+
 #---------------------------------------------------------------------------
-# configuration options related to the alphabetical class index
+# Configuration options related to the alphabetical class index
 #---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all
+# compounds will be generated. Enable this if the project contains a lot of
+# classes, structs, unions or interfaces.
+# The default value is: YES.
+
 ALPHABETICAL_INDEX     = NO
+
+# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in
+# which the alphabetical index list will be split.
+# Minimum value: 1, maximum value: 20, default value: 5.
+# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
+
 COLS_IN_ALPHA_INDEX    = 5
-IGNORE_PREFIX          = 
+
+# In case all classes in a project start with a common prefix, all classes will
+# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag
+# can be used to specify a prefix (or a list of prefixes) that should be ignored
+# while generating the index headers.
+# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
+
+IGNORE_PREFIX          =
+
 #---------------------------------------------------------------------------
-# configuration options related to the HTML output
+# Configuration options related to the HTML output
 #---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES doxygen will generate HTML output
+# The default value is: YES.
+
 GENERATE_HTML          = YES
-HTML_OUTPUT            = tcldox
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: html.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_OUTPUT            = docs
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each
+# generated HTML page (for example: .htm, .php, .asp).
+# The default value is: .html.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
 HTML_FILE_EXTENSION    = .html
-HTML_HEADER            = 
-HTML_FOOTER            = 
-HTML_STYLESHEET        = 
-HTML_ALIGN_MEMBERS     = YES
+
+# The HTML_HEADER tag can be used to specify a user-defined HTML header file for
+# each generated HTML page. If the tag is left blank doxygen will generate a
+# standard header.
+#
+# To get valid HTML the header file that includes any scripts and style sheets
+# that doxygen needs, which is dependent on the configuration options used (e.g.
+# the setting GENERATE_TREEVIEW). It is highly recommended to start with a
+# default header using
+# doxygen -w html new_header.html new_footer.html new_stylesheet.css
+# YourConfigFile
+# and then modify the file new_header.html. See also section "Doxygen usage"
+# for information on how to generate the default header that doxygen normally
+# uses.
+# Note: The header is subject to change so you typically have to regenerate the
+# default header when upgrading to a newer version of doxygen. For a description
+# of the possible markers and block names see the documentation.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_HEADER            =
+
+# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each
+# generated HTML page. If the tag is left blank doxygen will generate a standard
+# footer. See HTML_HEADER for more information on how to generate a default
+# footer and what special commands can be used inside the footer. See also
+# section "Doxygen usage" for information on how to generate the default footer
+# that doxygen normally uses.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_FOOTER            =
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style
+# sheet that is used by each HTML page. It can be used to fine-tune the look of
+# the HTML output. If left blank doxygen will generate a default style sheet.
+# See also section "Doxygen usage" for information on how to generate the style
+# sheet that doxygen normally uses.
+# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as
+# it is more robust and this tag (HTML_STYLESHEET) will in the future become
+# obsolete.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_STYLESHEET        =
+
+# The HTML_EXTRA_STYLESHEET tag can be used to specify an additional user-
+# defined cascading style sheet that is included after the standard style sheets
+# created by doxygen. Using this option one can overrule certain style aspects.
+# This is preferred over using HTML_STYLESHEET since it does not replace the
+# standard style sheet and is therefor more robust against future updates.
+# Doxygen will copy the style sheet file to the output directory. For an example
+# see the documentation.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_EXTRA_STYLESHEET  =
+
+# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
+# other source files which should be copied to the HTML output directory. Note
+# that these files will be copied to the base HTML output directory. Use the
+# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these
+# files. In the HTML_STYLESHEET file, use the file name only. Also note that the
+# files will be copied as-is; there are no commands or markers available.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_EXTRA_FILES       =
+
+# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen
+# will adjust the colors in the stylesheet and background images according to
+# this color. Hue is specified as an angle on a colorwheel, see
+# http://en.wikipedia.org/wiki/Hue for more information. For instance the value
+# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300
+# purple, and 360 is red again.
+# Minimum value: 0, maximum value: 359, default value: 220.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_COLORSTYLE_HUE    = 220
+
+# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors
+# in the HTML output. For a value of 0 the output will use grayscales only. A
+# value of 255 will produce the most vivid colors.
+# Minimum value: 0, maximum value: 255, default value: 100.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_COLORSTYLE_SAT    = 100
+
+# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the
+# luminance component of the colors in the HTML output. Values below 100
+# gradually make the output lighter, whereas values above 100 make the output
+# darker. The value divided by 100 is the actual gamma applied, so 80 represents
+# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not
+# change the gamma.
+# Minimum value: 40, maximum value: 240, default value: 80.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_COLORSTYLE_GAMMA  = 80
+
+# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
+# page will contain the date and time when the page was generated. Setting this
+# to NO can help when comparing the output of multiple runs.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_TIMESTAMP         = YES
+
+# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
+# documentation will contain sections that can be hidden and shown after the
+# page has loaded.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_DYNAMIC_SECTIONS  = NO
+
+# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries
+# shown in the various tree structured indices initially; the user can expand
+# and collapse entries dynamically later on. Doxygen will expand the tree to
+# such a level that at most the specified number of entries are visible (unless
+# a fully collapsed tree already exceeds this amount). So setting the number of
+# entries 1 will produce a full collapsed tree by default. 0 is a special value
+# representing an infinite number of entries and will result in a full expanded
+# tree by default.
+# Minimum value: 0, maximum value: 9999, default value: 100.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_INDEX_NUM_ENTRIES = 100
+
+# If the GENERATE_DOCSET tag is set to YES, additional index files will be
+# generated that can be used as input for Apple's Xcode 3 integrated development
+# environment (see: http://developer.apple.com/tools/xcode/), introduced with
+# OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a
+# Makefile in the HTML output directory. Running make will produce the docset in
+# that directory and running make install will install the docset in
+# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at
+# startup. See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html
+# for more information.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_DOCSET        = NO
+
+# This tag determines the name of the docset feed. A documentation feed provides
+# an umbrella under which multiple documentation sets from a single provider
+# (such as a company or product suite) can be grouped.
+# The default value is: Doxygen generated docs.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_FEEDNAME        = "Doxygen generated docs"
+
+# This tag specifies a string that should uniquely identify the documentation
+# set bundle. This should be a reverse domain-name style string, e.g.
+# com.mycompany.MyDocSet. Doxygen will append .docset to the name.
+# The default value is: org.doxygen.Project.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_BUNDLE_ID       = org.doxygen.Project
+
+# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify
+# the documentation publisher. This should be a reverse domain-name style
+# string, e.g. com.mycompany.MyDocSet.documentation.
+# The default value is: org.doxygen.Publisher.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_PUBLISHER_ID    = org.doxygen.Publisher
+
+# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher.
+# The default value is: Publisher.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_PUBLISHER_NAME  = Publisher
+
+# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three
+# additional HTML index files: index.hhp, index.hhc, and index.hhk. The
+# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop
+# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on
+# Windows.
+#
+# The HTML Help Workshop contains a compiler that can convert all HTML output
+# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML
+# files are now used as the Windows 98 help format, and will replace the old
+# Windows help format (.hlp) on all Windows platforms in the future. Compressed
+# HTML files also contain an index, a table of contents, and you can search for
+# words in the documentation. The HTML workshop also contains a viewer for
+# compressed HTML files.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
 GENERATE_HTMLHELP      = NO
-HTML_DYNAMIC_SECTIONS  = NO
-CHM_FILE               = 
-HHC_LOCATION           = 
+
+# The CHM_FILE tag can be used to specify the file name of the resulting .chm
+# file. You can add a path in front of the file if the result should not be
+# written to the html output directory.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+CHM_FILE               =
+
+# The HHC_LOCATION tag can be used to specify the location (absolute path
+# including file name) of the HTML help compiler ( hhc.exe). If non-empty
+# doxygen will try to run the HTML help compiler on the generated index.hhp.
+# The file has to be specified with full path.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+HHC_LOCATION           =
+
+# The GENERATE_CHI flag controls if a separate .chi index file is generated (
+# YES) or that it should be included in the master .chm file ( NO).
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
 GENERATE_CHI           = NO
+
+# The CHM_INDEX_ENCODING is used to encode HtmlHelp index ( hhk), content ( hhc)
+# and project file content.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+CHM_INDEX_ENCODING     =
+
+# The BINARY_TOC flag controls whether a binary table of contents is generated (
+# YES) or a normal table of contents ( NO) in the .chm file.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
 BINARY_TOC             = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members to
+# the table of contents of the HTML help documentation and to the tree view.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
 TOC_EXPAND             = NO
+
+# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and
+# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that
+# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help
+# (.qch) of the generated HTML documentation.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_QHP           = NO
+
+# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify
+# the file name of the resulting .qch file. The path specified is relative to
+# the HTML output folder.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QCH_FILE               =
+
+# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help
+# Project output. For more information please see Qt Help Project / Namespace
+# (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace).
+# The default value is: org.doxygen.Project.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_NAMESPACE          = org.doxygen.Project
+
+# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt
+# Help Project output. For more information please see Qt Help Project / Virtual
+# Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual-
+# folders).
+# The default value is: doc.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_VIRTUAL_FOLDER     = doc
+
+# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom
+# filter to add. For more information please see Qt Help Project / Custom
+# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom-
+# filters).
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_CUST_FILTER_NAME   =
+
+# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the
+# custom filter to add. For more information please see Qt Help Project / Custom
+# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom-
+# filters).
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_CUST_FILTER_ATTRS  =
+
+# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
+# project's filter section matches. Qt Help Project / Filter Attributes (see:
+# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes).
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_SECT_FILTER_ATTRS  =
+
+# The QHG_LOCATION tag can be used to specify the location of Qt's
+# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the
+# generated .qhp file.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHG_LOCATION           =
+
+# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be
+# generated, together with the HTML files, they form an Eclipse help plugin. To
+# install this plugin and make it available under the help contents menu in
+# Eclipse, the contents of the directory containing the HTML and XML files needs
+# to be copied into the plugins directory of eclipse. The name of the directory
+# within the plugins directory should be the same as the ECLIPSE_DOC_ID value.
+# After copying Eclipse needs to be restarted before the help appears.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_ECLIPSEHELP   = NO
+
+# A unique identifier for the Eclipse help plugin. When installing the plugin
+# the directory name containing the HTML and XML files should also have this
+# name. Each documentation set should have its own identifier.
+# The default value is: org.doxygen.Project.
+# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES.
+
+ECLIPSE_DOC_ID         = org.doxygen.Project
+
+# If you want full control over the layout of the generated HTML pages it might
+# be necessary to disable the index and replace it with your own. The
+# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top
+# of each HTML page. A value of NO enables the index and the value YES disables
+# it. Since the tabs in the index contain the same information as the navigation
+# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
 DISABLE_INDEX          = NO
+
+# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
+# structure should be generated to display hierarchical information. If the tag
+# value is set to YES, a side panel will be generated containing a tree-like
+# index structure (just like the one that is generated for HTML Help). For this
+# to work a browser that supports JavaScript, DHTML, CSS and frames is required
+# (i.e. any modern browser). Windows users are probably better off using the
+# HTML help feature. Via custom stylesheets (see HTML_EXTRA_STYLESHEET) one can
+# further fine-tune the look of the index. As an example, the default style
+# sheet generated by doxygen has an example that shows how to put an image at
+# the root of the tree instead of the PROJECT_NAME. Since the tree basically has
+# the same information as the tab index, you could consider setting
+# DISABLE_INDEX to YES when enabling this option.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_TREEVIEW      = NO
+
+# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that
+# doxygen will group on one line in the generated HTML documentation.
+#
+# Note that a value of 0 will completely suppress the enum values from appearing
+# in the overview section.
+# Minimum value: 0, maximum value: 20, default value: 4.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
 ENUM_VALUES_PER_LINE   = 4
-GENERATE_TREEVIEW      = NO
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used
+# to set the initial width (in pixels) of the frame in which the tree is shown.
+# Minimum value: 0, maximum value: 1500, default value: 250.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
 TREEVIEW_WIDTH         = 250
+
+# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open links to
+# external symbols imported via tag files in a separate window.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+EXT_LINKS_IN_WINDOW    = NO
+
+# Use this tag to change the font size of LaTeX formulas included as images in
+# the HTML documentation. When you change the font size after a successful
+# doxygen run you need to manually remove any form_*.png images from the HTML
+# output directory to force them to be regenerated.
+# Minimum value: 8, maximum value: 50, default value: 10.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+FORMULA_FONTSIZE       = 10
+
+# Use the FORMULA_TRANPARENT tag to determine whether or not the images
+# generated for formulas are transparent PNGs. Transparent PNGs are not
+# supported properly for IE 6.0, but are supported on all modern browsers.
+#
+# Note that when changing this option you need to delete any form_*.png files in
+# the HTML output directory before the changes have effect.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+FORMULA_TRANSPARENT    = YES
+
+# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see
+# http://www.mathjax.org) which uses client side Javascript for the rendering
+# instead of using prerendered bitmaps. Use this if you do not have LaTeX
+# installed or if you want to formulas look prettier in the HTML output. When
+# enabled you may also need to install MathJax separately and configure the path
+# to it using the MATHJAX_RELPATH option.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+USE_MATHJAX            = NO
+
+# When MathJax is enabled you can set the default output format to be used for
+# the MathJax output. See the MathJax site (see:
+# http://docs.mathjax.org/en/latest/output.html) for more details.
+# Possible values are: HTML-CSS (which is slower, but has the best
+# compatibility), NativeMML (i.e. MathML) and SVG.
+# The default value is: HTML-CSS.
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_FORMAT         = HTML-CSS
+
+# When MathJax is enabled you need to specify the location relative to the HTML
+# output directory using the MATHJAX_RELPATH option. The destination directory
+# should contain the MathJax.js script. For instance, if the mathjax directory
+# is located at the same level as the HTML output directory, then
+# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax
+# Content Delivery Network so you can quickly see the result without installing
+# MathJax. However, it is strongly recommended to install a local copy of
+# MathJax from http://www.mathjax.org before deployment.
+# The default value is: http://cdn.mathjax.org/mathjax/latest.
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_RELPATH        = http://cdn.mathjax.org/mathjax/latest
+
+# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax
+# extension names that should be enabled during MathJax rendering. For example
+# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_EXTENSIONS     =
+
+# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces
+# of code that will be used on startup of the MathJax code. See the MathJax site
+# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an
+# example see the documentation.
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_CODEFILE       =
+
+# When the SEARCHENGINE tag is enabled doxygen will generate a search box for
+# the HTML output. The underlying search engine uses javascript and DHTML and
+# should work on any modern browser. Note that when using HTML help
+# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET)
+# there is already a search function so this one should typically be disabled.
+# For large projects the javascript based search engine can be slow, then
+# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to
+# search using the keyboard; to jump to the search box use <access key> + S
+# (what the <access key> is depends on the OS and browser, but it is typically
+# <CTRL>, <ALT>/<option>, or both). Inside the search box use the <cursor down
+# key> to jump into the search results window, the results can be navigated
+# using the <cursor keys>. Press <Enter> to select an item or <escape> to cancel
+# the search. The filter options can be selected when the cursor is inside the
+# search box by pressing <Shift>+<cursor down>. Also here use the <cursor keys>
+# to select a filter and <Enter> or <escape> to activate or cancel the filter
+# option.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+SEARCHENGINE           = NO
+
+# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
+# implemented using a web server instead of a web client using Javascript. There
+# are two flavours of web server based searching depending on the
+# EXTERNAL_SEARCH setting. When disabled, doxygen will generate a PHP script for
+# searching and an index file used by the script. When EXTERNAL_SEARCH is
+# enabled the indexing and searching needs to be provided by external tools. See
+# the section "External Indexing and Searching" for details.
+# The default value is: NO.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+SERVER_BASED_SEARCH    = NO
+
+# When EXTERNAL_SEARCH tag is enabled doxygen will no longer generate the PHP
+# script for searching. Instead the search results are written to an XML file
+# which needs to be processed by an external indexer. Doxygen will invoke an
+# external search engine pointed to by the SEARCHENGINE_URL option to obtain the
+# search results.
+#
+# Doxygen ships with an example indexer ( doxyindexer) and search engine
+# (doxysearch.cgi) which are based on the open source search engine library
+# Xapian (see: http://xapian.org/).
+#
+# See the section "External Indexing and Searching" for details.
+# The default value is: NO.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+EXTERNAL_SEARCH        = NO
+
+# The SEARCHENGINE_URL should point to a search engine hosted by a web server
+# which will return the search results when EXTERNAL_SEARCH is enabled.
+#
+# Doxygen ships with an example indexer ( doxyindexer) and search engine
+# (doxysearch.cgi) which are based on the open source search engine library
+# Xapian (see: http://xapian.org/). See the section "External Indexing and
+# Searching" for details.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+SEARCHENGINE_URL       =
+
+# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed
+# search data is written to a file for indexing by an external tool. With the
+# SEARCHDATA_FILE tag the name of this file can be specified.
+# The default file is: searchdata.xml.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+SEARCHDATA_FILE        = searchdata.xml
+
+# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the
+# EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is
+# useful in combination with EXTRA_SEARCH_MAPPINGS to search through multiple
+# projects and redirect the results back to the right project.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+EXTERNAL_SEARCH_ID     =
+
+# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen
+# projects other than the one defined by this configuration file, but that are
+# all added to the same external search index. Each project needs to have a
+# unique id set via EXTERNAL_SEARCH_ID. The search mapping then maps the id of
+# to a relative location where the documentation can be found. The format is:
+# EXTRA_SEARCH_MAPPINGS = tagname1=loc1 tagname2=loc2 ...
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+EXTRA_SEARCH_MAPPINGS  =
+
 #---------------------------------------------------------------------------
-# configuration options related to the LaTeX output
+# Configuration options related to the LaTeX output
 #---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES doxygen will generate LaTeX output.
+# The default value is: YES.
+
 GENERATE_LATEX         = NO
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: latex.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
 LATEX_OUTPUT           = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
+# invoked.
+#
+# Note that when enabling USE_PDFLATEX this option is only used for generating
+# bitmaps for formulas in the HTML output, but not in the Makefile that is
+# written to the output directory.
+# The default file is: latex.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
 LATEX_CMD_NAME         = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to generate
+# index for LaTeX.
+# The default file is: makeindex.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
 MAKEINDEX_CMD_NAME     = makeindex
+
+# If the COMPACT_LATEX tag is set to YES doxygen generates more compact LaTeX
+# documents. This may be useful for small projects and may help to save some
+# trees in general.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
 COMPACT_LATEX          = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used by the
+# printer.
+# Possible values are: a4 (210 x 297 mm), letter (8.5 x 11 inches), legal (8.5 x
+# 14 inches) and executive (7.25 x 10.5 inches).
+# The default value is: a4.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
 PAPER_TYPE             = a4wide
-EXTRA_PACKAGES         = 
-LATEX_HEADER           = 
+
+# The EXTRA_PACKAGES tag can be used to specify one or more LaTeX package names
+# that should be included in the LaTeX output. To get the times font for
+# instance you can specify
+# EXTRA_PACKAGES=times
+# If left blank no extra packages will be included.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+EXTRA_PACKAGES         =
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for the
+# generated LaTeX document. The header should contain everything until the first
+# chapter. If it is left blank doxygen will generate a standard header. See
+# section "Doxygen usage" for information on how to let doxygen write the
+# default header to a separate file.
+#
+# Note: Only use a user-defined header if you know what you are doing! The
+# following commands have a special meaning inside the header: $title,
+# $datetime, $date, $doxygenversion, $projectname, $projectnumber. Doxygen will
+# replace them by respectively the title of the page, the current date and time,
+# only the current date, the version number of doxygen, the project name (see
+# PROJECT_NAME), or the project number (see PROJECT_NUMBER).
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_HEADER           =
+
+# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for the
+# generated LaTeX document. The footer should contain everything after the last
+# chapter. If it is left blank doxygen will generate a standard footer.
+#
+# Note: Only use a user-defined footer if you know what you are doing!
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_FOOTER           =
+
+# The LATEX_EXTRA_FILES tag can be used to specify one or more extra images or
+# other source files which should be copied to the LATEX_OUTPUT output
+# directory. Note that the files will be copied as-is; there are no commands or
+# markers available.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_EXTRA_FILES      =
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated is
+# prepared for conversion to PDF (using ps2pdf or pdflatex). The PDF file will
+# contain links (just like the HTML output) instead of page references. This
+# makes the output suitable for online browsing using a PDF viewer.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
 PDF_HYPERLINKS         = NO
+
+# If the LATEX_PDFLATEX tag is set to YES, doxygen will use pdflatex to generate
+# the PDF file directly from the LaTeX files. Set this option to YES to get a
+# higher quality PDF documentation.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
 USE_PDFLATEX           = NO
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \batchmode
+# command to the generated LaTeX files. This will instruct LaTeX to keep running
+# if errors occur, instead of asking the user for help. This option is also used
+# when generating formulas in HTML.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
 LATEX_BATCHMODE        = NO
+
+# If the LATEX_HIDE_INDICES tag is set to YES then doxygen will not include the
+# index chapters (such as File Index, Compound Index, etc.) in the output.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
 LATEX_HIDE_INDICES     = NO
+
+# If the LATEX_SOURCE_CODE tag is set to YES then doxygen will include source
+# code with syntax highlighting in the LaTeX output.
+#
+# Note that which sources are shown also depends on other settings such as
+# SOURCE_BROWSER.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_SOURCE_CODE      = NO
+
+# The LATEX_BIB_STYLE tag can be used to specify the style to use for the
+# bibliography, e.g. plainnat, or ieeetr. See
+# http://en.wikipedia.org/wiki/BibTeX and \cite for more info.
+# The default value is: plain.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_BIB_STYLE        = plain
+
 #---------------------------------------------------------------------------
-# configuration options related to the RTF output
+# Configuration options related to the RTF output
 #---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES doxygen will generate RTF output. The
+# RTF output is optimized for Word 97 and may not look too pretty with other RTF
+# readers/editors.
+# The default value is: NO.
+
 GENERATE_RTF           = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: rtf.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
 RTF_OUTPUT             = rtf
+
+# If the COMPACT_RTF tag is set to YES doxygen generates more compact RTF
+# documents. This may be useful for small projects and may help to save some
+# trees in general.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
 COMPACT_RTF            = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated will
+# contain hyperlink fields. The RTF file will contain links (just like the HTML
+# output) instead of page references. This makes the output suitable for online
+# browsing using Word or some other Word compatible readers that support those
+# fields.
+#
+# Note: WordPad (write) and others do not support links.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
 RTF_HYPERLINKS         = NO
-RTF_STYLESHEET_FILE    = 
-RTF_EXTENSIONS_FILE    = 
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's config
+# file, i.e. a series of assignments. You only have to provide replacements,
+# missing definitions are set to their default value.
+#
+# See also section "Doxygen usage" for information on how to generate the
+# default style sheet that doxygen normally uses.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_STYLESHEET_FILE    =
+
+# Set optional variables used in the generation of an RTF document. Syntax is
+# similar to doxygen's config file. A template extensions file can be generated
+# using doxygen -e rtf extensionFile.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_EXTENSIONS_FILE    =
+
 #---------------------------------------------------------------------------
-# configuration options related to the man page output
+# Configuration options related to the man page output
 #---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES doxygen will generate man pages for
+# classes and files.
+# The default value is: NO.
+
 GENERATE_MAN           = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it. A directory man3 will be created inside the directory specified by
+# MAN_OUTPUT.
+# The default directory is: man.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
 MAN_OUTPUT             = man
+
+# The MAN_EXTENSION tag determines the extension that is added to the generated
+# man pages. In case the manual section does not start with a number, the number
+# 3 is prepended. The dot (.) at the beginning of the MAN_EXTENSION tag is
+# optional.
+# The default value is: .3.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
 MAN_EXTENSION          = .3
+
+# If the MAN_LINKS tag is set to YES and doxygen generates man output, then it
+# will generate one additional man file for each entity documented in the real
+# man page(s). These additional files only source the real man page, but without
+# them the man command would be unable to find the correct page.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
 MAN_LINKS              = NO
+
 #---------------------------------------------------------------------------
-# configuration options related to the XML output
+# Configuration options related to the XML output
 #---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES doxygen will generate an XML file that
+# captures the structure of the code including all documentation.
+# The default value is: NO.
+
 GENERATE_XML           = NO
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: xml.
+# This tag requires that the tag GENERATE_XML is set to YES.
+
 XML_OUTPUT             = xml
-XML_SCHEMA             = 
-XML_DTD                = 
+
+# The XML_SCHEMA tag can be used to specify a XML schema, which can be used by a
+# validating XML parser to check the syntax of the XML files.
+# This tag requires that the tag GENERATE_XML is set to YES.
+
+XML_SCHEMA             =
+
+# The XML_DTD tag can be used to specify a XML DTD, which can be used by a
+# validating XML parser to check the syntax of the XML files.
+# This tag requires that the tag GENERATE_XML is set to YES.
+
+XML_DTD                =
+
+# If the XML_PROGRAMLISTING tag is set to YES doxygen will dump the program
+# listings (including syntax highlighting and cross-referencing information) to
+# the XML output. Note that enabling this will significantly increase the size
+# of the XML output.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_XML is set to YES.
+
 XML_PROGRAMLISTING     = YES
+
 #---------------------------------------------------------------------------
-# configuration options for the AutoGen Definitions output
+# Configuration options related to the DOCBOOK output
 #---------------------------------------------------------------------------
+
+# If the GENERATE_DOCBOOK tag is set to YES doxygen will generate Docbook files
+# that can be used to generate PDF.
+# The default value is: NO.
+
+GENERATE_DOCBOOK       = NO
+
+# The DOCBOOK_OUTPUT tag is used to specify where the Docbook pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be put in
+# front of it.
+# The default directory is: docbook.
+# This tag requires that the tag GENERATE_DOCBOOK is set to YES.
+
+DOCBOOK_OUTPUT         = docbook
+
+#---------------------------------------------------------------------------
+# Configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES doxygen will generate an AutoGen
+# Definitions (see http://autogen.sf.net) file that captures the structure of
+# the code including all documentation. Note that this feature is still
+# experimental and incomplete at the moment.
+# The default value is: NO.
+
 GENERATE_AUTOGEN_DEF   = NO
+
 #---------------------------------------------------------------------------
-# configuration options related to the Perl module output
+# Configuration options related to the Perl module output
 #---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES doxygen will generate a Perl module
+# file that captures the structure of the code including all documentation.
+#
+# Note that this feature is still experimental and incomplete at the moment.
+# The default value is: NO.
+
 GENERATE_PERLMOD       = NO
+
+# If the PERLMOD_LATEX tag is set to YES doxygen will generate the necessary
+# Makefile rules, Perl scripts and LaTeX code to be able to generate PDF and DVI
+# output from the Perl module output.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_PERLMOD is set to YES.
+
 PERLMOD_LATEX          = NO
+
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be nicely
+# formatted so it can be parsed by a human reader. This is useful if you want to
+# understand what is going on. On the other hand, if this tag is set to NO the
+# size of the Perl module output will be much smaller and Perl will parse it
+# just the same.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_PERLMOD is set to YES.
+
 PERLMOD_PRETTY         = YES
-PERLMOD_MAKEVAR_PREFIX = 
+
+# The names of the make variables in the generated doxyrules.make file are
+# prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. This is useful
+# so different doxyrules.make files included by the same Makefile don't
+# overwrite each other's variables.
+# This tag requires that the tag GENERATE_PERLMOD is set to YES.
+
+PERLMOD_MAKEVAR_PREFIX =
+
 #---------------------------------------------------------------------------
-# Configuration options related to the preprocessor   
+# Configuration options related to the preprocessor
 #---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES doxygen will evaluate all
+# C-preprocessor directives found in the sources and include files.
+# The default value is: YES.
+
 ENABLE_PREPROCESSING   = YES
+
+# If the MACRO_EXPANSION tag is set to YES doxygen will expand all macro names
+# in the source code. If set to NO only conditional compilation will be
+# performed. Macro expansion can be done in a controlled way by setting
+# EXPAND_ONLY_PREDEF to YES.
+# The default value is: NO.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
 MACRO_EXPANSION        = NO
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES then
+# the macro expansion is limited to the macros specified with the PREDEFINED and
+# EXPAND_AS_DEFINED tags.
+# The default value is: NO.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
 EXPAND_ONLY_PREDEF     = NO
+
+# If the SEARCH_INCLUDES tag is set to YES the includes files in the
+# INCLUDE_PATH will be searched if a #include is found.
+# The default value is: YES.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
 SEARCH_INCLUDES        = YES
-INCLUDE_PATH           = 
-INCLUDE_FILE_PATTERNS  = 
-PREDEFINED             = 
-EXPAND_AS_DEFINED      = 
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that
+# contain include files that are not input files but should be processed by the
+# preprocessor.
+# This tag requires that the tag SEARCH_INCLUDES is set to YES.
+
+INCLUDE_PATH           =
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
+# patterns (like *.h and *.hpp) to filter out the header-files in the
+# directories. If left blank, the patterns specified with FILE_PATTERNS will be
+# used.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+INCLUDE_FILE_PATTERNS  =
+
+# The PREDEFINED tag can be used to specify one or more macro names that are
+# defined before the preprocessor is started (similar to the -D option of e.g.
+# gcc). The argument of the tag is a list of macros of the form: name or
+# name=definition (no spaces). If the definition and the "=" are omitted, "=1"
+# is assumed. To prevent a macro definition from being undefined via #undef or
+# recursively expanded use the := operator instead of the = operator.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+PREDEFINED             =
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
+# tag can be used to specify a list of macro names that should be expanded. The
+# macro definition that is found in the sources will be used. Use the PREDEFINED
+# tag if you want to use a different macro definition that overrules the
+# definition found in the source code.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+EXPAND_AS_DEFINED      =
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will
+# remove all refrences to function-like macros that are alone on a line, have an
+# all uppercase name, and do not end with a semicolon. Such function macros are
+# typically used for boiler-plate code, and will confuse the parser if not
+# removed.
+# The default value is: YES.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
 SKIP_FUNCTION_MACROS   = YES
+
 #---------------------------------------------------------------------------
-# Configuration::additions related to external references   
+# Configuration options related to external references
 #---------------------------------------------------------------------------
-TAGFILES               = 
-GENERATE_TAGFILE       = 
+
+# The TAGFILES tag can be used to specify one or more tag files. For each tag
+# file the location of the external documentation should be added. The format of
+# a tag file without this location is as follows:
+# TAGFILES = file1 file2 ...
+# Adding location for the tag files is done as follows:
+# TAGFILES = file1=loc1 "file2 = loc2" ...
+# where loc1 and loc2 can be relative or absolute paths or URLs. See the
+# section "Linking to external documentation" for more information about the use
+# of tag files.
+# Note: Each tag file must have an unique name (where the name does NOT include
+# the path). If a tag file is not located in the directory in which doxygen is
+# run, you must also specify the path to the tagfile here.
+
+TAGFILES               =
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create a
+# tag file that is based on the input files it reads. See section "Linking to
+# external documentation" for more information about the usage of tag files.
+
+GENERATE_TAGFILE       =
+
+# If the ALLEXTERNALS tag is set to YES all external class will be listed in the
+# class index. If set to NO only the inherited external classes will be listed.
+# The default value is: NO.
+
 ALLEXTERNALS           = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed in
+# the modules index. If set to NO, only the current project's groups will be
+# listed.
+# The default value is: YES.
+
 EXTERNAL_GROUPS        = YES
+
+# If the EXTERNAL_PAGES tag is set to YES all external pages will be listed in
+# the related pages index. If set to NO, only the current project's pages will
+# be listed.
+# The default value is: YES.
+
+EXTERNAL_PAGES         = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script
+# interpreter (i.e. the result of 'which perl').
+# The default file (with absolute path) is: /usr/bin/perl.
+
 PERL_PATH              = /usr/bin/perl
+
 #---------------------------------------------------------------------------
-# Configuration options related to the dot tool   
+# Configuration options related to the dot tool
 #---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES doxygen will generate a class diagram
+# (in HTML and LaTeX) for classes with base or super classes. Setting the tag to
+# NO turns the diagrams off. Note that this option also works with HAVE_DOT
+# disabled, but it is recommended to install and use dot, since it yields more
+# powerful graphs.
+# The default value is: YES.
+
 CLASS_DIAGRAMS         = YES
-MSCGEN_PATH            = 
+
+# You can define message sequence charts within doxygen comments using the \msc
+# command. Doxygen will then run the mscgen tool (see:
+# http://www.mcternan.me.uk/mscgen/)) to produce the chart and insert it in the
+# documentation. The MSCGEN_PATH tag allows you to specify the directory where
+# the mscgen tool resides. If left empty the tool is assumed to be found in the
+# default search path.
+
+MSCGEN_PATH            =
+
+# If set to YES, the inheritance and collaboration graphs will hide inheritance
+# and usage relations if the target is undocumented or is not a class.
+# The default value is: YES.
+
 HIDE_UNDOC_RELATIONS   = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
+# available from the path. This tool is part of Graphviz (see:
+# http://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent
+# Bell Labs. The other options in this section have no effect if this option is
+# set to NO
+# The default value is: NO.
+
 HAVE_DOT               = YES
+
+# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is allowed
+# to run in parallel. When set to 0 doxygen will base this on the number of
+# processors available in the system. You can set it explicitly to a value
+# larger than 0 to get control over the balance between CPU load and processing
+# speed.
+# Minimum value: 0, maximum value: 32, default value: 0.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_NUM_THREADS        = 0
+
+# When you want a differently looking font n the dot files that doxygen
+# generates you can specify the font name using DOT_FONTNAME. You need to make
+# sure dot is able to find the font, which can be done by putting it in a
+# standard location or by setting the DOTFONTPATH environment variable or by
+# setting DOT_FONTPATH to the directory containing the font.
+# The default value is: Helvetica.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_FONTNAME           = Helvetica
+
+# The DOT_FONTSIZE tag can be used to set the size (in points) of the font of
+# dot graphs.
+# Minimum value: 4, maximum value: 24, default value: 10.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_FONTSIZE           = 10
+
+# By default doxygen will tell dot to use the default font as specified with
+# DOT_FONTNAME. If you specify a different font using DOT_FONTNAME you can set
+# the path where dot can find it using this tag.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_FONTPATH           =
+
+# If the CLASS_GRAPH tag is set to YES then doxygen will generate a graph for
+# each documented class showing the direct and indirect inheritance relations.
+# Setting this tag to YES will force the CLASS_DIAGRAMS tag to NO.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
 CLASS_GRAPH            = YES
+
+# If the COLLABORATION_GRAPH tag is set to YES then doxygen will generate a
+# graph for each documented class showing the direct and indirect implementation
+# dependencies (inheritance, containment, and class references variables) of the
+# class with other documented classes.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
 COLLABORATION_GRAPH    = YES
+
+# If the GROUP_GRAPHS tag is set to YES then doxygen will generate a graph for
+# groups, showing the direct groups dependencies.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
 GROUP_GRAPHS           = YES
+
+# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
+# collaboration diagrams in a style similar to the OMG's Unified Modeling
+# Language.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
 UML_LOOK               = NO
+
+# If the UML_LOOK tag is enabled, the fields and methods are shown inside the
+# class node. If there are many fields or methods and many nodes the graph may
+# become too big to be useful. The UML_LIMIT_NUM_FIELDS threshold limits the
+# number of items for each type to make the size more manageable. Set this to 0
+# for no limit. Note that the threshold may be exceeded by 50% before the limit
+# is enforced. So when you set the threshold to 10, up to 15 fields may appear,
+# but if the number exceeds 15, the total amount of fields shown is limited to
+# 10.
+# Minimum value: 0, maximum value: 100, default value: 10.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+UML_LIMIT_NUM_FIELDS   = 10
+
+# If the TEMPLATE_RELATIONS tag is set to YES then the inheritance and
+# collaboration graphs will show the relations between templates and their
+# instances.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
 TEMPLATE_RELATIONS     = NO
+
+# If the INCLUDE_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are set to
+# YES then doxygen will generate a graph for each documented file showing the
+# direct and indirect include dependencies of the file with other documented
+# files.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
 INCLUDE_GRAPH          = YES
+
+# If the INCLUDED_BY_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are
+# set to YES then doxygen will generate a graph for each documented file showing
+# the direct and indirect include dependencies of the file with other documented
+# files.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
 INCLUDED_BY_GRAPH      = YES
+
+# If the CALL_GRAPH tag is set to YES then doxygen will generate a call
+# dependency graph for every global function or class method.
+#
+# Note that enabling this option will significantly increase the time of a run.
+# So in most cases it will be better to enable call graphs for selected
+# functions only using the \callgraph command.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
 CALL_GRAPH             = NO
+
+# If the CALLER_GRAPH tag is set to YES then doxygen will generate a caller
+# dependency graph for every global function or class method.
+#
+# Note that enabling this option will significantly increase the time of a run.
+# So in most cases it will be better to enable caller graphs for selected
+# functions only using the \callergraph command.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
 CALLER_GRAPH           = NO
+
+# If the GRAPHICAL_HIERARCHY tag is set to YES then doxygen will graphical
+# hierarchy of all classes instead of a textual one.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
 GRAPHICAL_HIERARCHY    = YES
+
+# If the DIRECTORY_GRAPH tag is set to YES then doxygen will show the
+# dependencies a directory has on other directories in a graphical way. The
+# dependency relations are determined by the #include relations between the
+# files in the directories.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
 DIRECTORY_GRAPH        = YES
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
+# generated by dot.
+# Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order
+# to make the SVG files visible in IE 9+ (other browsers do not have this
+# requirement).
+# Possible values are: png, jpg, gif and svg.
+# The default value is: png.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
 DOT_IMAGE_FORMAT       = png
+
+# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to
+# enable generation of interactive SVG images that allow zooming and panning.
+#
+# Note that this requires a modern browser other than Internet Explorer. Tested
+# and working are Firefox, Chrome, Safari, and Opera.
+# Note: For IE 9+ you need to set HTML_FILE_EXTENSION to xhtml in order to make
+# the SVG files visible. Older versions of IE do not have SVG support.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+INTERACTIVE_SVG        = NO
+
+# The DOT_PATH tag can be used to specify the path where the dot tool can be
+# found. If left blank, it is assumed the dot tool can be found in the path.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
 DOT_PATH               = @prefix@/bin/
-DOTFILE_DIRS           = 
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that
+# contain dot files that are included in the documentation (see the \dotfile
+# command).
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOTFILE_DIRS           =
+
+# The MSCFILE_DIRS tag can be used to specify one or more directories that
+# contain msc files that are included in the documentation (see the \mscfile
+# command).
+
+MSCFILE_DIRS           =
+
+# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of nodes
+# that will be shown in the graph. If the number of nodes in a graph becomes
+# larger than this value, doxygen will truncate the graph, which is visualized
+# by representing a node as a red box. Note that doxygen if the number of direct
+# children of the root node in a graph is already larger than
+# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note that
+# the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
+# Minimum value: 0, maximum value: 10000, default value: 50.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
 DOT_GRAPH_MAX_NODES    = 50
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the graphs
+# generated by dot. A depth value of 3 means that only nodes reachable from the
+# root by following a path via at most 3 edges will be shown. Nodes that lay
+# further from the root node will be omitted. Note that setting this option to 1
+# or 2 may greatly reduce the computation time needed for large code bases. Also
+# note that the size of a graph can be further restricted by
+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
+# Minimum value: 0, maximum value: 1000, default value: 0.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
 MAX_DOT_GRAPH_DEPTH    = 0
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
+# background. This is disabled by default, because dot on Windows does not seem
+# to support this out of the box.
+#
+# Warning: Depending on the platform used, enabling this option may lead to
+# badly anti-aliased labels on the edges of a graph (i.e. they become hard to
+# read).
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
 DOT_TRANSPARENT        = NO
+
+# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
+# files in one run (i.e. multiple -o and -T options on the command line). This
+# makes dot run faster, but since only newer versions of dot (>1.8.10) support
+# this, this feature is disabled by default.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
 DOT_MULTI_TARGETS      = NO
+
+# If the GENERATE_LEGEND tag is set to YES doxygen will generate a legend page
+# explaining the meaning of the various boxes and arrows in the dot generated
+# graphs.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
 GENERATE_LEGEND        = YES
+
+# If the DOT_CLEANUP tag is set to YES doxygen will remove the intermediate dot
+# files that are used to generate the various graphs.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
 DOT_CLEANUP            = YES
-#---------------------------------------------------------------------------
-# Configuration::additions related to the search engine   
-#---------------------------------------------------------------------------
-SEARCHENGINE           = NO

Modified: branches/new-help-system/base/LICENSE
===================================================================
--- branches/new-help-system/base/LICENSE	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/LICENSE	2014-08-03 15:04:12 UTC (rev 122999)
@@ -1,5 +1,5 @@
 Copyright (c) 2002 - 2003, Apple Inc.
-Copyright (c) 2004 - 2013, The MacPorts Project.
+Copyright (c) 2004 - 2014, 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	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/Makefile.in	2014-08-03 15:04:12 UTC (rev 122999)
@@ -1,7 +1,10 @@
 # $Id$
 
+srcdir      = @srcdir@
+VPATH       = @srcdir@
+
 PATH		= @PATH_CLEANED@
-SUBDIR		= doc src tests
+SUBDIR		= vendor doc src tests
 DISTDIR		= dist
 DISTVER		=
 DISTTAG		= release_${subst .,_,${DISTVER}}
@@ -16,7 +19,7 @@
 
 all:: Mk/macports.autoconf.mk
 
-Mk/macports.autoconf.mk: Mk/macports.autoconf.mk.in src/config.h.in Makefile.in config.status
+Mk/macports.autoconf.mk: Mk/macports.autoconf.mk.in src/config.h.in Makefile.in doc/Makefile.in src/cflib1.0/Makefile.in src/cregistry/Makefile.in src/darwintracelib1.0/Makefile.in src/macports1.0/Makefile.in src/package1.0/Makefile.in src/port/Makefile.in src/port1.0/Makefile.in src/registry2.0/Makefile.in tests/Makefile.in config.status
 	./config.status
 	${MAKE} clean
 
@@ -29,71 +32,72 @@
 		echo "Source tree not configured. Use ./configure" ; \
 	fi
 
-include Mk/macports.subdir.mk
+include $(srcdir)/Mk/macports.subdir.mk
 
 install::
 	[ ! -f "$(DESTDIR)${sysconfdir}/macports/mp_version" ] || rm -vf "$(DESTDIR)${sysconfdir}/macports/mp_version"
-	$(INSTALL) -d -o ${DSTUSR} -g ${DSTGRP} -m ${DSTMODE} "$(DESTDIR)${datadir}/macports/"
-	$(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/"
+	$(INSTALL) -d -o "${DSTUSR}" -g "${DSTGRP}" -m "${DSTMODE}" "$(DESTDIR)${datadir}/macports/"
+	$(INSTALL)    -o "${DSTUSR}" -g "${DSTGRP}" -m 444 setupenv.bash  "$(DESTDIR)${datadir}/macports/"
+	$(INSTALL)    -o "${DSTUSR}" -g "${DSTGRP}" -m 444 $(srcdir)/macports-pubkey.pem  "$(DESTDIR)${datadir}/macports/"
 # Only run these scripts when not building in a destroot
 ifeq ($(DESTDIR),)
 # create run user if it doesn't exist
 	@if test -n "${DSCL}" -a -n "${DSEDITGROUP}" ; then \
-        if ! ${DSCL} -q . -read /Groups/${RUNUSR} > /dev/null 2>&1 ; then \
+        if ! ${DSCL} -q . -read "/Groups/${RUNUSR}" > /dev/null 2>&1 ; then \
             if test `id -u` -eq 0; then \
                 echo "Creating group \"${RUNUSR}\"" ; \
-                ${DSEDITGROUP} -q -o create ${RUNUSR} ; \
+                ${DSEDITGROUP} -q -o create "${RUNUSR}" ; \
             else \
                 echo "Not creating group \"${RUNUSR}\" (not root)" ; \
             fi ; \
         fi ; \
-        if ! ${DSCL} -q . -list /Users/${RUNUSR} > /dev/null 2>&1 ; then \
+        if ! ${DSCL} -q . -list "/Users/${RUNUSR}" > /dev/null 2>&1 ; then \
             if test `id -u` -eq 0; then \
                 echo "Creating user \"${RUNUSR}\"" ; \
                 NEXTUID=501; \
                 while test -n "`${DSCL} -q /Search -search /Users UniqueID $$NEXTUID`"; do \
                     let "NEXTUID=NEXTUID+1"; \
                 done; \
-                ${DSCL} -q . -create /Users/${RUNUSR} UniqueID $$NEXTUID ; \
+                ${DSCL} -q . -create "/Users/${RUNUSR}" UniqueID $$NEXTUID ; \
                 \
-                ${DSCL} -q . -delete /Users/${RUNUSR} AuthenticationAuthority ; \
-                ${DSCL} -q . -delete /Users/${RUNUSR} PasswordPolicyOptions ; \
-                ${DSCL} -q . -delete /Users/${RUNUSR} dsAttrTypeNative:KerberosKeys ; \
-                ${DSCL} -q . -delete /Users/${RUNUSR} dsAttrTypeNative:ShadowHashData ; \
+                ${DSCL} -q . -delete "/Users/${RUNUSR}" AuthenticationAuthority ; \
+                ${DSCL} -q . -delete "/Users/${RUNUSR}" PasswordPolicyOptions ; \
+                ${DSCL} -q . -delete "/Users/${RUNUSR}" dsAttrTypeNative:KerberosKeys ; \
+                ${DSCL} -q . -delete "/Users/${RUNUSR}" dsAttrTypeNative:ShadowHashData ; \
                 \
-                ${DSCL} -q . -create /Users/${RUNUSR} RealName MacPorts ; \
-                ${DSCL} -q . -create /Users/${RUNUSR} Password \* ; \
-                ${DSCL} -q . -create /Users/${RUNUSR} PrimaryGroupID $$(${DSCL} -q . -read /Groups/${RUNUSR} PrimaryGroupID | /usr/bin/awk '{print $$2}') ; \
-                ${DSCL} -q . -create /Users/${RUNUSR} NFSHomeDirectory "${localstatedir}/macports/home" ; \
-                ${DSCL} -q . -create /Users/${RUNUSR} UserShell /usr/bin/false ; \
+                ${DSCL} -q . -create "/Users/${RUNUSR}" RealName MacPorts ; \
+                ${DSCL} -q . -create "/Users/${RUNUSR}" Password \* ; \
+                ${DSCL} -q . -create "/Users/${RUNUSR}" PrimaryGroupID $$(${DSCL} -q . -read "/Groups/${RUNUSR}" PrimaryGroupID | /usr/bin/awk '{print $$2}') ; \
+                ${DSCL} -q . -create "/Users/${RUNUSR}" NFSHomeDirectory "${localstatedir}/macports/home" ; \
+                ${DSCL} -q . -create "/Users/${RUNUSR}" UserShell /usr/bin/false ; \
             else \
                 echo "Not creating user \"${RUNUSR}\" (not root)" ; \
             fi ; \
         fi ; \
-        if test "$$(${DSCL} -q . -read /Users/${RUNUSR} NFSHomeDirectory)" = "NFSHomeDirectory: /var/empty" ; then \
+        if test "$$(${DSCL} -q . -read "/Users/${RUNUSR}" NFSHomeDirectory)" = "NFSHomeDirectory: /var/empty" ; then \
             if test `id -u` -eq 0; then \
                 echo "Updating home directory location for user \"${RUNUSR}\"" ; \
-                ${DSCL} -q . -create /Users/${RUNUSR} NFSHomeDirectory "${localstatedir}/macports/home" ; \
+                ${DSCL} -q . -create "/Users/${RUNUSR}" NFSHomeDirectory "${localstatedir}/macports/home" ; \
             else \
                 echo "Not updating home directory location for user \"${RUNUSR}\" (not root)" ; \
             fi ; \
         fi ; \
         if test `sw_vers -productVersion | /usr/bin/awk -F . '{print $$2}'` -eq 4 -a `id -u` -eq 0; then \
-            GID=`${DSCL} -q . -read /Groups/${RUNUSR} PrimaryGroupID | /usr/bin/awk '{print $$2}'` ; \
-            if test "`${DSCL} -q . -read /Users/${RUNUSR} PrimaryGroupID 2>/dev/null | /usr/bin/awk '{print $$2}'`" != "$$GID"; then \
+            GID=`${DSCL} -q . -read "/Groups/${RUNUSR}" PrimaryGroupID | /usr/bin/awk '{print $$2}'` ; \
+            if test "`${DSCL} -q . -read "/Users/${RUNUSR}" PrimaryGroupID 2>/dev/null | /usr/bin/awk '{print $$2}'`" != "$$GID"; then \
                 echo "Fixing PrimaryGroupID for user \"${RUNUSR}\"" ; \
-                ${DSCL} -q . -create /Users/${RUNUSR} PrimaryGroupID $$GID ; \
-                ${DSCL} -q . -create /Users/${RUNUSR} RealName MacPorts ; \
+                ${DSCL} -q . -create "/Users/${RUNUSR}" PrimaryGroupID $$GID ; \
+                ${DSCL} -q . -create "/Users/${RUNUSR}" RealName MacPorts ; \
             fi ; \
         fi ; \
     else \
         echo "Can't find ${DSCL} / ${DSEDITGROUP}, not creating user \"${RUNUSR}\"" ; \
     fi
 # Add [default] tag to the central MacPorts repository, if it isn't already
-	$(TCLSH) src/upgrade_sources_conf_default.tcl "${prefix}"
+	$(TCLSH) $(srcdir)/src/upgrade_sources_conf_default.tcl "${prefix}"
 # Convert image directories (and direct mode installs) to image archives
-	$(TCLSH) src/images_to_archives.tcl "${macports_tcl_dir}"
+	$(TCLSH) $(srcdir)/src/images_to_archives.tcl
+	$(TCLSH) $(srcdir)/src/dedup_portfiles.tcl
 endif
 ifndef SELFUPDATING
 	@echo ""; echo "Congratulations, you have successfully installed the MacPorts system. To get the Portfiles and update the system, add ${prefix}/bin to your PATH and run:"; echo ""
@@ -111,6 +115,7 @@
 
 
 clean::
+	rm -rf docs
 
 distclean::
 	rm -f config.log config.status configure.lineno
@@ -118,6 +123,7 @@
 	rm -f Makefile Mk/macports.autoconf.mk portmgr/freebsd/Makefile
 	rm -f Doxyfile
 	rm -f setupenv.bash
+	rm -f portmgr/dmg/postflight
 
 _gettag:
 	cd ${DISTDIR}; svn co ${SVNURL}/tags/${SVNTAG} ${PKGNAME}-svn
@@ -145,16 +151,11 @@
 	${MAKE} SVNTAG=${DISTARCTAG} PKGNAME=${DISTARCNAME} _dopkg
 endif
 
-tcldoc:
-	@[ -e "${prefix}/bin/tcldoc" ] \
-		|| { echo "Install tcldoc with MacPorts in ${prefix} first."; exit 1; }
-	find src -name '*.tcl' | xargs ${TCLDOC} --verbose --title "MacPorts Documentation" --force tcldoc
-
-tcldox:
-	@[ -e "${prefix}/bin/doxygen" -a -e "${prefix}/bin/tcl-dox" -a -e "${prefix}/bin/dot" ] \
-		|| { echo "Install doxygen, tcl-dox and graphviz with MacPorts in ${prefix} first."; exit 1; }
+docs:
+	@[ -e "${prefix}/bin/doxygen" -a -e "${prefix}/bin/dot" ] \
+		|| { echo "Install doxygen and graphviz with MacPorts in ${prefix} first."; exit 1; }
 	${prefix}/bin/doxygen
 
 test::
 
-.PHONY: dist _gettag _pkgdist _dopkg tcldoc tcldox
+.PHONY: dist _gettag _pkgdist _dopkg docs

Modified: branches/new-help-system/base/Mk/macports.autoconf.mk.in
===================================================================
--- branches/new-help-system/base/Mk/macports.autoconf.mk.in	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/Mk/macports.autoconf.mk.in	2014-08-03 15:04:12 UTC (rev 122999)
@@ -1,17 +1,12 @@
 # $Id$
+# vim:ts=8:noet:sts=8:sw=8
 
 SHELL			= @SHELL@
 
-
-srcdir			= @srcdir@
-VPATH			= @srcdir@
-
 CC			= @CC@
 CFLAGS			= @CFLAGS@ -std=c99 $(CFLAGS_QUICHEEATERS) $(CFLAGS_PEDANTIC) $(CFLAGS_WERROR)
 OBJCFLAGS		= @OBJCFLAGS@ $(CFLAGS_QUICHEEATERS) $(CFLAGS_PEDANTIC) $(CFLAGS_WERROR)
-CPPFLAGS		= @CPPFLAGS@ @DEFS@ @INCLUDES@ @TCL_INCLUDES@
-TCL_DEFS		= @TCL_DEFS@
-SHLIB_CFLAGS		= @SHLIB_CFLAGS@
+CPPFLAGS		= @CPPFLAGS@ @DEFS@ -I at abs_top_builddir@/src -I at abs_top_srcdir@/src -I. -I at abs_top_builddir@/@VENDOR_DESTROOT@/@TCL_PREFIX@/include
 CFLAGS_QUICHEEATERS	= @CFLAGS_QUICHEEATERS@
 CFLAGS_PEDANTIC		= @CFLAGS_PEDANTIC@
 CFLAGS_WERROR		= @CFLAGS_WERROR@
@@ -32,11 +27,11 @@
 OBJC_FOUNDATION_LDFLAGS		= @OBJC_FOUNDATION_LDFLAGS@
 OBJC_FOUNDATION_LIBS		= @OBJC_FOUNDATION_LIBS@
 
-TCL_CC			= @TCL_CC@
+LDFLAGS			= @LDFLAGS@
 SHLIB_LD		= @SHLIB_LD@
 STLIB_LD		= @STLIB_LD@
-LDFLAGS			= @LDFLAGS@
-SHLIB_LDFLAGS		= @SHLIB_LDFLAGS@ ${LDFLAGS}
+SHLIB_CFLAGS		= @SHLIB_CFLAGS@
+SHLIB_LDFLAGS		= @LDFLAGS@
 SHLIB_SUFFIX		= @SHLIB_SUFFIX@
 TCL_STUB_LIB_SPEC	= @TCL_STUB_LIB_SPEC@
 
@@ -51,9 +46,9 @@
 XCODEBUILD		= @XCODEBUILD@
 BZIP2			= @BZIP2@
 
+INTREE_TCLSH		= @INTREE_TCLSH@
 TCLSH			= @TCLSH@
-TCL_PACKAGE_DIR		= @TCL_PACKAGE_DIR@
-macports_tcl_dir	= @macports_tcl_dir@
+TCL_PACKAGE_PATH	= @TCL_PACKAGE_PATH@
 
 DSCL			= @DSCL@
 DSEDITGROUP		= @DSEDITGROUP@

Modified: branches/new-help-system/base/Mk/macports.subdir.mk
===================================================================
--- branches/new-help-system/base/Mk/macports.subdir.mk	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/Mk/macports.subdir.mk	2014-08-03 15:04:12 UTC (rev 122999)
@@ -3,6 +3,7 @@
 .PHONY : all
 .PHONY : clean distclean
 .PHONY : install
+.PHONY : test
 
 all::
 	@for subdir in $(SUBDIR); do\

Modified: branches/new-help-system/base/aclocal.m4
===================================================================
--- branches/new-help-system/base/aclocal.m4	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/aclocal.m4	2014-08-03 15:04:12 UTC (rev 122999)
@@ -3,6 +3,319 @@
 builtin(include,m4/pthread.m4)
 builtin(include,m4/foundation.m4)
 
+dnl Search for a variable in a list. Run ACTION-IF-FOUND if it is in the list,
+dnl ACTION-IF-NOT-FOUND otherwise.
+dnl
+dnl Parameters:
+dnl  - The name of the list.
+dnl  - The name of the variable that should be searched in the list.
+dnl  - An optional action to be run if found
+dnl  - An optional action to be run if not found
+dnl
+dnl _MP_LIST_CONTAINS_QUOTED([listname], [varname], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+AC_DEFUN([_MP_LIST_CONTAINS], [dnl
+	mp_list_contains_present=
+	eval "mp_list_contains_list=\"$$1\""
+	for mp_list_contains_entry in $mp_list_contains_list; do
+		test -z "$mp_list_contains_entry" && continue
+		if test "x$$2" = "x$mp_list_contains_entry"; then
+			mp_list_contains_present=1
+			break
+		fi
+	done
+	if test "x$mp_list_contains_present" = "x"; then
+		m4_ifvaln([$3], [$3], [:])dnl
+		m4_ifvaln([$4], [else $4])dnl
+	fi
+])
+
+dnl Quote a variable and prepend it to a list.
+dnl
+dnl Parameters:
+dnl  - The name of the list.
+dnl  - The name of the variable that should be quoted and prepended to the
+dnl    list.
+AC_DEFUN([_MP_LIST_PREPEND_QUOTED], [dnl
+	_MP_QUOTE([$2])
+	_MP_VAR_PREPEND([$1], ["$$2 "])
+])
+
+
+dnl Quote a variable and append it to a list.
+dnl
+dnl Parameters:
+dnl  - The name of the list.
+dnl  - The name of the variable that should be quoted and appended to the list.
+AC_DEFUN([_MP_LIST_APPEND_QUOTED], [dnl
+	_MP_QUOTE([$2])
+	AS_VAR_APPEND([$1], [" $$2"])
+])
+
+dnl Prepend the shell expansion of a value to a variable.
+dnl
+dnl Parameters:
+dnl  - The name of the variable to which the second argument should be
+dnl    prepended.
+dnl  - The value that should be expanded using the shell expansion rules and
+dnl    prepended to the variable given in the first argument.
+AC_DEFUN([_MP_VAR_PREPEND], [dnl
+	AC_REQUIRE([_MP_VAR_PREPEND_PREPARE])dnl
+	mp_fn_var_prepend $1 $2
+])
+
+dnl Define the function required for _MP_VAR_PREPEND
+AC_DEFUN([_MP_VAR_PREPEND_PREPARE], [dnl
+	mp_fn_var_prepend() {
+		eval "$[]1=\"$[]2\$$[]1\""
+	}
+])
+
+dnl Quote a variable in single quotes (escaping any existing single quotes) and
+dnl store it in itself.
+dnl
+dnl Parameters:
+dnl  - The name of the variable that should be quoted using single quotes.
+AC_DEFUN([_MP_QUOTE], [dnl
+	case $$1 in
+		*\'*)
+			$1=$(AS_ECHO(["$$1"]) | sed "s/'/'\\\\\\\\''/g")
+		;;
+	esac
+	$1="'$$1'"dnl
+])
+
+
+dnl Extract the key part of a key-value pair given as string in the form
+dnl  --key=value or
+dnl   -key=value
+dnl
+dnl Parameters:
+dnl  - The variable name to assign to
+dnl  - The (quoted, if necessary) key-value pair
+AC_DEFUN([_MP_EXTRACT_KEY], [dnl
+	$1=$(AS_ECHO([$2]) | sed -E 's/^--?([[^=]]+)=.*$/\1/')dnl
+])
+
+dnl Similar to AC_ARG_VAR, but implemented with --with-pkg=PATH for PKG.
+dnl
+dnl Parameters: Similar to AC_ARG_VAR ($2 gets some boiler plate around it)
+AC_DEFUN([MP_TOOL_PATH], [dnl
+	AC_ARG_WITH([m4_tolower($1)], [AS_HELP_STRING([--with-m4_tolower($1)=PATH],
+			[Path to alternate $2 command])], [$1=$withval],dnl
+		[])dnl
+])
+
+dnl Configure a project contained in a .tar.gz, .tgz or .tar.bz2 tarball,
+dnl extracting it previously, if necessary. Different from AC_CONFIG_SUBDIRS
+dnl (on which this macro is based), you can pass parameters to the
+dnl sub-configure script.
+dnl
+dnl Parameters:
+dnl  - The relative path to the tarball
+dnl  - The relative path to the directory that will be extracted from the
+dnl    tarball and contains the configure script to be run (can be a sub directory of the extracted directory)
+dnl  - Parameters to pass to the configure script
+dnl
+dnl MP_CONFIG_TARBALL([path-to-tarball], [dir-extracted-from-tarball-with-configure], [configure-parameters])
+AC_DEFUN([MP_CONFIG_TARBALL], [
+	AC_PATH_PROG(GZIP, [gzip], [])
+	AC_PATH_PROG(BZIP2, [bzip2], [])
+
+	mp_tarball="$1"
+	ac_dir=$2
+
+	mp_popdir=$(pwd)
+	if ! test -d "$ac_dir"; then
+		mp_tarball_vendordir="$(dirname "$mp_tarball")"
+		AS_MKDIR_P(["$mp_tarball_vendordir"])
+		AC_MSG_NOTICE([=== extracting $mp_tarball])
+		mp_tarball_extract_cmd=
+		case "$mp_tarball" in
+			*.tar.gz | *.tgz)
+				if test "x$GZIP" = "x"; then
+					AC_MSG_ERROR([gzip not found])
+				fi
+				mp_tarball_extract_cmd="$GZIP"
+				;;
+			*.tar.bz2 | *.tbz2)
+				if test "x$BZIP2" = "x"; then
+					AC_MSG_ERROR([bzip2 not found])
+				fi
+				mp_tarball_extract_cmd="$BZIP2"
+				;;
+			*)
+				AC_MSG_ERROR([Don't know how to extract tarball $mp_tarball])
+				;;
+		esac
+		(cd "$mp_tarball_vendordir"; umask 0022; "$mp_tarball_extract_cmd" -d < "$ac_abs_confdir/$mp_tarball" | tar xf - || AC_MSG_ERROR([failed to extract $mp_tarball]))
+	fi
+	if ! test -d "$ac_dir"; then
+		AC_MSG_ERROR([tarball $mp_tarball did not extract to $ac_dir])
+	fi
+
+	AS_MKDIR_P(["$ac_dir"])
+	_AC_SRCDIRS(["$ac_dir"])
+	cd "$ac_dir"
+
+	if test "$no_recursion" != yes || test ! -f "$ac_srcdir/config.status"; then
+		AC_MSG_NOTICE([=== configuring in $ac_dir ($mp_popdir/$ac_dir)])
+		if test -f "$ac_srcdir/configure"; then
+			mp_sub_configure_args=
+			mp_sub_configure_keys=
+			# Compile a list of keys that have been given to the MP_CONFIG_TARBALL
+			# macro; we want to skip copying those parameters from the original
+			# configure invocation.
+			for mp_arg in $3; do
+				case $mp_arg in
+					--*=* | -*=*)
+						_MP_EXTRACT_KEY([mp_arg_key], ["$mp_arg"])
+						_MP_LIST_APPEND_QUOTED([mp_sub_configure_keys], [mp_arg_key])
+					;;
+				esac
+				_MP_LIST_APPEND_QUOTED([mp_sub_configure_args], [mp_arg])
+			done
+			# Walk the list of arguments given to the original configure script;
+			# filter out a few common ones we likely would not want to pass along,
+			# add --disable-option-checking and filter those already given as
+			# argument to MP_CONFIG_TARBALL.
+			# Most of this code is adapted from _AC_OUTPUT_SUBDIRS in
+			# $prefix/share/autoconf/autoconf/status.m4.
+			mp_prev=
+			eval "set x $ac_configure_args"
+			shift
+			for mp_arg; do
+				if test -n "$mp_prev"; then
+					mp_prev=
+					continue
+				fi
+				case $mp_arg in
+					  -cache-file \
+					| --cache-file \
+					| --cache-fil \
+					| --cache-fi \
+					| --cache-f \
+					| --cache- \
+					| --cache \
+					| --cach \
+					| --cac \
+					| --ca \
+					| --c)
+						mp_prev=cache_file
+					;;
+					  -cache-file=* \
+					| --cache-file=* \
+					| --cache-fil=* \
+					| --cache-fi=* \
+					| --cache-f=* \
+					| --cache-=* \
+					| --cache=* \
+					| --cach=* \
+					| --cac=* \
+					| --ca=* \
+					| --c=*)
+						# ignore --cache-file
+					;;
+					  --config-cache \
+					| -C)
+						# ignore -C
+					;;
+					  -srcdir \
+					| --srcdir \
+					| -srcdi \
+					| -srcd \
+					| -src \
+					| -sr)
+						mp_prev=srcdir
+					;;
+					  -srcdir=* \
+					| --srcdir=* \
+					| --srcdi=* \
+					| --srcd=* \
+					| --src=* \
+					| --sr=*)
+						# ignore --srcdir
+					;;
+					  -prefix \
+					| --prefix \
+					| --prefi \
+					| --pref \
+					| --pre \
+					| --pr \
+					| --p)
+						mp_prev=prefix
+					;;
+					  -prefix=* \
+					| --prefix=* \
+					| --prefi=* \
+					| --pref=* \
+					| --pre=* \
+					| --pr=* \
+					| --p=*)
+						# ignore --prefix
+					;;
+					--disable-option-checking)
+						# ignore --disable-option-checking
+					;;
+					--*=* | -*=*)
+						_MP_EXTRACT_KEY([mp_arg_key], ["$mp_arg"])
+						_MP_LIST_CONTAINS([mp_sub_configure_keys], [mp_arg_key], [], [
+							_MP_LIST_APPEND_QUOTED([mp_sub_configure_args], [mp_arg])
+						])
+					;;
+					*)
+						# always pass positional arguments
+						_MP_LIST_APPEND_QUOTED([mp_sub_configure_args], [mp_arg])
+					;;
+				esac
+			done
+
+			# Now prepend some arguments that should always be present unless
+			# overriden, such as --prefix, --silent, --disable-option-checking,
+			# --cache-file, --srcdir
+			# Pass --prefix unless already given
+			mp_arg_key=prefix
+			_MP_LIST_CONTAINS([mp_sub_configure_args], [mp_arg_key], [], [
+				mp_arg="--prefix=$prefix"
+				_MP_LIST_PREPEND_QUOTED([mp_sub_configure_args], [mp_arg])
+			])
+
+			# Pass --silent
+			if test "$silent" = yes; then
+				mp_arg="--silent"
+				_MP_LIST_PREPEND_QUOTED([mp_sub_configure_args], [mp_arg])
+			fi
+
+			# Always prepend --disable-option-checking to silence warnings, since
+			# different subdirs can have different --enable and --with options.
+			mp_arg="--disable-option-checking"
+			_MP_LIST_PREPEND_QUOTED([mp_sub_configure_args], [mp_arg])
+
+			# Make the cache file name correct relative to the subdirectory.
+			case $cache_file in
+				[[\\/]]* | ?:[[\\/]]* )
+					mp_sub_cache_file=$cache_file
+				;;
+				*) # Relative name.
+					mp_sub_cache_file=$ac_top_build_prefix$cache_file
+				;;
+			esac
+			mp_arg="--cache-file=$mp_sub_cache_file"
+			_MP_LIST_PREPEND_QUOTED([mp_sub_configure_args], [mp_arg])
+
+			mp_arg="--srcdir=$ac_srcdir"
+			_MP_LIST_APPEND_QUOTED([mp_sub_configure_args], [mp_arg])
+
+			AC_MSG_NOTICE([running $SHELL $ac_srcdir/configure $mp_sub_configure_args in $ac_dir])
+			eval "\$SHELL \$ac_srcdir/configure $mp_sub_configure_args" || AC_MSG_ERROR([configure failed for $ac_dir])
+		else
+			AC_MSG_ERROR([no configure script found in $ac_dir])
+		fi
+		AC_MSG_NOTICE([=== finished configuring in $ac_dir ($mp_popdir/$ac_dir)])
+	fi
+	cd "$mp_popdir"
+])
+
+
 #------------------------------------------------------------------------
 # MP_CHECK_FRAMEWORK_COREFOUNDATION --
 #
@@ -309,18 +622,17 @@
 	dnl if with user specifies --with-no-root-privileges,
 	dnl use current user and group.
 	dnl use ~/Library/Tcl as Tcl package directory
-		AC_REQUIRE([MP_PATH_MPCONFIGDIR])
+	AC_REQUIRE([MP_PATH_MPCONFIGDIR])
 
 	AC_ARG_WITH(no-root-privileges, [AS_HELP_STRING([--with-no-root-privileges],[Specify that MacPorts should be installed in your home directory])], [ROOTPRIVS=$withval] )
 
 	if test "${ROOTPRIVS+set}" = set; then
-
 		# Set install-user to current user
 		AC_MSG_CHECKING([for install user])
 		DSTUSR=`id -un`
 		AC_MSG_RESULT([$DSTUSR])
 		AC_SUBST(DSTUSR)
-		
+
 		# Set install-group to current user
 		AC_MSG_CHECKING([for install group])
 		DSTGRP=`id -gn`
@@ -332,19 +644,6 @@
 		RUNUSR=`id -un`
 		AC_MSG_RESULT([$RUNUSR])
 		AC_SUBST(RUNUSR)
-
-		# Set Tcl package directory to ~/Library/Tcl
-	    AC_MSG_CHECKING(for Tcl package directory)
-		ac_cv_c_tclpkgd=`eval echo ~$DSTUSR/Library/Tcl`
-	    # Convert to a native path and substitute into the output files.
-	    PACKAGE_DIR_NATIVE=`${CYGPATH} ${ac_cv_c_tclpkgd}`
-	    TCL_PACKAGE_DIR=${PACKAGE_DIR_NATIVE}
-	    AC_SUBST(TCL_PACKAGE_DIR)
-		if test x"${ac_cv_c_tclpkgd}" = x ; then
-			AC_MSG_ERROR(Tcl package directory not found.  Please specify its location with --with-tclpackage)
-	    else
-			AC_MSG_RESULT(${ac_cv_c_tclpkgd})
-	    fi
 	fi
 
 ])
@@ -354,13 +653,13 @@
 AC_DEFUN([MP_CHECK_RUNUSER],[
 	dnl if with user specifies --with-macports-user,
 	dnl use it. otherwise default to platform defaults
-       AC_REQUIRE([MP_PATH_MPCONFIGDIR])
+	AC_REQUIRE([MP_PATH_MPCONFIGDIR])
 
 	AC_ARG_WITH(macports-user, [AS_HELP_STRING([--with-macports-user=USER],[Specify user to drop privileges to, if possible, during compiles etc.])], [ RUNUSR=$withval ] )
 	
 	AC_MSG_CHECKING([for macports user])
 	if test "x$RUNUSR" = "x" ; then
-	   RUNUSR=macports
+		RUNUSR=macports
 	fi
 
 	AC_MSG_RESULT([$RUNUSR])
@@ -373,13 +672,13 @@
 AC_DEFUN([MP_SHARED_DIRECTORY],[
 	dnl if with user specifies --with-shared-directory,
 	dnl use 0775 permissions for ${prefix} directories
-        AC_REQUIRE([MP_PATH_MPCONFIGDIR])
+	AC_REQUIRE([MP_PATH_MPCONFIGDIR])
 
 	AC_ARG_WITH(shared-directory, [AS_HELP_STRING([--with-shared-directory],[Use 0775 permissions for installed directories])], [ SHAREDIR=$withval ] )
 
 	if test "${SHAREDIR+set}" = set; then	
 		AC_MSG_CHECKING([whether to share the install directory with all members of the install group])
-	    DSTMODE=0775
+		DSTMODE=0775
 
 		AC_MSG_RESULT([$DSTMODE])
 		AC_SUBST(DSTMODE)
@@ -391,13 +690,13 @@
 AC_DEFUN([MP_CHECK_INSTALLUSER],[
 	dnl if with user specifies --with-install-user,
 	dnl use it. otherwise default to platform defaults
-        AC_REQUIRE([MP_PATH_MPCONFIGDIR])
+	AC_REQUIRE([MP_PATH_MPCONFIGDIR])
 
 	AC_ARG_WITH(install-user, [AS_HELP_STRING([--with-install-user=USER],[Specify user ownership of installed files])], [ DSTUSR=$withval ] )
 	
 	AC_MSG_CHECKING([for install user])
 	if test "x$DSTUSR" = "x" ; then
-	   DSTUSR=root
+		DSTUSR=root
 	fi
 
 	AC_MSG_RESULT([$DSTUSR])
@@ -409,27 +708,26 @@
 AC_DEFUN([MP_CHECK_INSTALLGROUP],[
 	dnl if with user specifies --with-install-group,
 	dnl use it. otherwise default to platform defaults
-        AC_REQUIRE([MP_CHECK_INSTALLUSER])
+	AC_REQUIRE([MP_CHECK_INSTALLUSER])
 
 	AC_ARG_WITH(install-group, [AS_HELP_STRING([--with-install-group=GROUP],[Specify group ownership of installed files])], [ DSTGRP=$withval ] )
 
 	AC_MSG_CHECKING([for install group])
 	if test "x$DSTGRP" = "x" ; then
-	   
-	   case $host_os in
-	   darwin*)
-		DSTGRP="admin"
-		;;
-	   freebsd*)
-		DSTGRP="wheel"
-		;;
-	   linux*)
-		DSTGRP="root"
-		;;
-	   *)
-		DSTGRP="wheel"
-		;;
-	   esac
+		case $host_os in
+			darwin*)
+				DSTGRP="admin"
+			;;
+			freebsd*)
+				DSTGRP="wheel"
+			;;
+			linux*)
+				DSTGRP="root"
+			;;
+			*)
+				DSTGRP="wheel"
+			;;
+		esac
 	fi
 
 	AC_MSG_RESULT([$DSTGRP])
@@ -442,13 +740,13 @@
 	dnl if with user specifies --with-directory-mode,
 	dnl use the specified permissions for ${prefix} directories
 	dnl otherwise use 0755
-        AC_REQUIRE([MP_PATH_MPCONFIGDIR])
+	AC_REQUIRE([MP_PATH_MPCONFIGDIR])
 
 	AC_ARG_WITH(directory-mode, [AS_HELP_STRING([--with-directory-mode=MODE],[Specify directory mode of installed directories])], [ DSTMODE=$withval ] )
 	
 	AC_MSG_CHECKING([what permissions to use for installation directories])
 	if test "x$DSTMODE" = "x" ; then
-	   DSTMODE=0755
+		DSTMODE=0755
 	fi
 
 	AC_MSG_RESULT([$DSTMODE])
@@ -458,87 +756,85 @@
 # MP_PATH_APPLICATIONS
 #---------------------------------------
 AC_DEFUN([MP_PATH_APPLICATIONS],[
-        AC_REQUIRE([MP_CHECK_INSTALLUSER])
+	AC_REQUIRE([MP_CHECK_INSTALLUSER])
 
-    AC_ARG_WITH(applications-dir,[AS_HELP_STRING([--with-applications-dir],[Applications installation directory.])], MPAPPLICATIONSDIR=${withval})
+	AC_ARG_WITH(applications-dir,[AS_HELP_STRING([--with-applications-dir],[Applications installation directory.])], MPAPPLICATIONSDIR=${withval})
 
-    oldprefix=$prefix
-    if test "x$prefix" = "xNONE" ; then
-	prefix=$ac_default_prefix
-    fi
-    AC_MSG_CHECKING([for Applications installation directory])
+	oldprefix=$prefix
+	if test "x$prefix" = "xNONE" ; then
+		prefix=$ac_default_prefix
+	fi
+	AC_MSG_CHECKING([for Applications installation directory])
 
 	if test "x$MPAPPLICATIONSDIR" = "x" ; then
-	    if test "$DSTUSR" = "root" ; then
-		MPAPPLICATIONSDIR="/Applications/MacPorts"
-	    else
-		MPAPPLICATIONSDIR="$(eval echo ~$DSTUSR)/Applications/MacPorts"
-	    fi
+		if test "$DSTUSR" = "root" ; then
+			MPAPPLICATIONSDIR="/Applications/MacPorts"
+		else
+			MPAPPLICATIONSDIR="$(eval echo ~$DSTUSR)/Applications/MacPorts"
+		fi
 	fi
 
 	AC_MSG_RESULT([$MPAPPLICATIONSDIR])
-    AC_SUBST(MPAPPLICATIONSDIR)
-    prefix=$oldprefix
+	AC_SUBST(MPAPPLICATIONSDIR)
+	prefix=$oldprefix
 ])
 
 # MP_PATH_FRAMEWORKS
 #---------------------------------------
 AC_DEFUN([MP_PATH_FRAMEWORKS],[
-        AC_REQUIRE([MP_CHECK_INSTALLUSER])
+	AC_REQUIRE([MP_CHECK_INSTALLUSER])
 
-    AC_ARG_WITH(frameworks-dir,[AS_HELP_STRING([--with-frameworks-dir],[Frameworks installation directory.])], MPFRAMEWORKSDIR=${withval})
+	AC_ARG_WITH(frameworks-dir,[AS_HELP_STRING([--with-frameworks-dir],[Frameworks installation directory.])], MPFRAMEWORKSDIR=${withval})
 
-    oldprefix=$prefix
-    if test "x$prefix" = "xNONE" ; then
-	prefix=$ac_default_prefix
-    fi
-    AC_MSG_CHECKING([for Frameworks installation directory])
+	oldprefix=$prefix
+	if test "x$prefix" = "xNONE" ; then
+		prefix=$ac_default_prefix
+	fi
+	AC_MSG_CHECKING([for Frameworks installation directory])
 
 	if test "x$MPFRAMEWORKSDIR" = "x" ; then
 		MPFRAMEWORKSDIR="${prefix}/Library/Frameworks"
 	fi
 
 	AC_MSG_RESULT([$MPFRAMEWORKSDIR])
-    AC_SUBST(MPFRAMEWORKSDIR)
-    prefix=$oldprefix
+	AC_SUBST(MPFRAMEWORKSDIR)
+	prefix=$oldprefix
 ])
 
-
 # MP_UNIVERSAL_OPTIONS
 #---------------------------------------
 AC_DEFUN([MP_UNIVERSAL_OPTIONS],[
-  AC_ARG_WITH(universal-archs,[AS_HELP_STRING([--with-universal-archs="CPU"],[Universal CPU architectures (space separated)])], UNIVERSAL_ARCHS=${withval})
+	AC_ARG_WITH(universal-archs,[AS_HELP_STRING([--with-universal-archs="CPU"],[Universal CPU architectures (space separated)])], UNIVERSAL_ARCHS=${withval})
 
-  if test "x$UNIVERSAL_ARCHS" = "x"; then
-    case "$MACOSX_VERSION" in
-      10.1[[0-9]]*)
-        UNIVERSAL_ARCHS="x86_64 i386"
-        ;;
-      10.[[0-5]]*)
-        UNIVERSAL_ARCHS="i386 ppc"
-        ;;
-      *)
-        UNIVERSAL_ARCHS="x86_64 i386"
-        ;;
-    esac
-  fi
+	if test "x$UNIVERSAL_ARCHS" = "x"; then
+		case "$MACOSX_VERSION" in
+			10.1[[0-9]]*)
+				UNIVERSAL_ARCHS="x86_64 i386"
+			;;
+			10.[[0-5]]*)
+				UNIVERSAL_ARCHS="i386 ppc"
+			;;
+			*)
+				UNIVERSAL_ARCHS="x86_64 i386"
+			;;
+		esac
+	fi
 
-  UNIVERSAL_ARCHFLAGS=
-  for arch in $UNIVERSAL_ARCHS; do
-    UNIVERSAL_ARCHFLAGS="$UNIVERSAL_ARCHFLAGS -arch $arch"
-  done
+	UNIVERSAL_ARCHFLAGS=
+	for arch in $UNIVERSAL_ARCHS; do
+		UNIVERSAL_ARCHFLAGS="$UNIVERSAL_ARCHFLAGS -arch $arch"
+	done
 
-  AC_MSG_CHECKING([for Universal CPU architectures])
-  AC_MSG_RESULT([$UNIVERSAL_ARCHS])
-  AC_SUBST(UNIVERSAL_ARCHS)
-  AC_SUBST(UNIVERSAL_ARCHFLAGS)
+	AC_MSG_CHECKING([for Universal CPU architectures])
+	AC_MSG_RESULT([$UNIVERSAL_ARCHS])
+	AC_SUBST(UNIVERSAL_ARCHS)
+	AC_SUBST(UNIVERSAL_ARCHFLAGS)
 ])
 
 # MP_LIB_MD5
 #---------------------------------------
 # Check for an md5 implementation
 AC_DEFUN([MP_LIB_MD5],[
-
 	# Check for libmd from FreeBSD, which is preferred
 	AC_CHECK_LIB([md], [MD5File],[
 		AC_CHECK_HEADERS([md5.h sha.h], ,[
@@ -581,181 +877,24 @@
 	AC_REQUIRE([MP_CHECK_FRAMEWORK_IOKIT])
 	AC_REQUIRE([MP_CHECK_FUNCTION_CFNOTIFICATIONCENTERGETDARWINNOTIFYCENTER])
 	
-    AC_MSG_CHECKING(for whether we will build daemondo)
-    result=no
+	AC_MSG_CHECKING(for whether we will build daemondo)
+	result=no
 	case $host_os in
-	darwin*)
-		if test "x$mp_cv_have_framework_corefoundation" == "xyes" &&
-		   test "x$mp_cv_have_framework_systemconfiguration" == "xyes" &&
-		   test "x$mp_cv_have_framework_iokit" == "xyes" &&
-		   test "x$mp_cv_have_function_cfnotificationcentergetdarwinnotifycenter" == "xyes"; then
-			result=yes
-			EXTRA_PROGS="$EXTRA_PROGS daemondo"
-			AC_CONFIG_FILES([src/programs/daemondo/Makefile])
-		fi
+		darwin*)
+			if test "x$mp_cv_have_framework_corefoundation" == "xyes" &&
+			   test "x$mp_cv_have_framework_systemconfiguration" == "xyes" &&
+			   test "x$mp_cv_have_framework_iokit" == "xyes" &&
+			   test "x$mp_cv_have_function_cfnotificationcentergetdarwinnotifycenter" == "xyes"; then
+				result=yes
+				EXTRA_PROGS="$EXTRA_PROGS daemondo"
+				AC_CONFIG_FILES([src/programs/daemondo/Makefile])
+			fi
 		;;
-	*)
+		*)
 	esac
 	AC_MSG_RESULT(${result})
 ])
 
-#------------------------------------------------------------------------
-# MP_TCL_PACKAGE_DIR --
-#
-#	Locate the correct directory for Tcl package installation
-#
-# Arguments:
-#	None.
-#
-# Requires:
-#	TCLVERSION must be set
-#	CYGPATH must be set
-#	TCLSH must be set
-#
-# Results:
-#
-#	Adds a --with-tclpackage switch to configure.
-#	Result is cached.
-#
-#	Substs the following vars:
-#		TCL_PACKAGE_DIR
-#------------------------------------------------------------------------
-
-AC_DEFUN(MP_TCL_PACKAGE_DIR, [
-	AC_REQUIRE([MP_CHECK_INSTALLUSER])
-
-    AC_MSG_CHECKING(for Tcl package directory)
-
-    AC_ARG_WITH(tclpackage, [  --with-tclpackage       Tcl package installation directory.], with_tclpackagedir=${withval})
-
-    if test x"${with_tclpackagedir}" != x ; then
-	ac_cv_c_tclpkgd=${with_tclpackagedir}
-    else
-	AC_CACHE_VAL(ac_cv_c_tclpkgd, [
-	    # Use the value from --with-tclpackage, if it was given
-
-	    if test x"${with_tclpackagedir}" != x ; then
-		echo "tclpackagedir"
-		ac_cv_c_tclpkgd=${with_tclpackagedir}
-	    else
-		# On darwin we can do some intelligent guessing
-		case $host_os in
-		    darwin*)
-		    	tcl_autopath=`echo 'puts -nonewline \$auto_path' | $TCLSH`
-			for path in $tcl_autopath; do
-			if test "$DSTUSR" = "root" ; then
-			    if test "$path" = "/Library/Tcl"; then
-				ac_cv_c_tclpkgd="$path"
-				break
-			    fi
-			    if test "$path" = "/System/Library/Tcl"; then
-				if test -d "$path"; then
-				    ac_cv_c_tclpkgd="$path"
-				    break
-			        fi
-			    fi
-			elif test "$path" = "~/Library/Tcl"; then
-			    ac_cv_c_tclpkgd=`eval echo ~$DSTUSR/Library/Tcl`
-			    break
-			fi
-			done
-		    ;;
-		esac
-    		if test x"${ac_cv_c_tclpkgd}" = x ; then
-		    # Fudge a path from the first entry in the auto_path
-		    tcl_pkgpath=`echo 'puts -nonewline [[lindex \$auto_path 0]]' | $TCLSH`
-		    if test -d "$tcl_pkgpath"; then
-			ac_cv_c_tclpkgd="$tcl_pkgpath"
-		    fi
-		    # If the first entry does not exist, do nothing
-		fi
-	    fi
-	])
-    fi
-
-    if test x"${ac_cv_c_tclpkgd}" = x ; then
-	AC_MSG_ERROR(Tcl package directory not found.  Please specify its location with --with-tclpackage)
-    else
-	AC_MSG_RESULT(${ac_cv_c_tclpkgd})
-    fi
-
-    # Convert to a native path and substitute into the output files.
-
-    PACKAGE_DIR_NATIVE=`${CYGPATH} ${ac_cv_c_tclpkgd}`
-
-    TCL_PACKAGE_DIR=${PACKAGE_DIR_NATIVE}
-
-    AC_SUBST(TCL_PACKAGE_DIR)
-])
-
-# MP_PROG_TCLSH
-#---------------------------------------
-AC_DEFUN([MP_PROG_TCLSH],[
-
-
-	case $host_os in
-		freebsd*)
-			# FreeBSD installs a dummy tclsh (annoying)
-			# Look for a real versioned tclsh with threads first
-			# Look for a real versioned tclsh without threads second
-			AC_PATH_PROG([TCLSH], [tclsh${TCL_VERSION}-threads tclsh${TCL_VERSION} tclsh])
-			;;
-		*)
-			# Otherwise, look for a non-versioned tclsh
-			AC_PATH_PROG([TCLSH], [tclsh tclsh${TCL_VERSION}])
-			;;
-	esac
-	if test "x$TCLSH" = "x" ; then
-		AC_MSG_ERROR([Could not find tclsh])
-	fi
-
-	AC_SUBST(TCLSH)
-])
-
-# MP_TCL_PACKAGE
-#	Determine if a Tcl package is present.
-#
-# Arguments:
-#	Package name (may include the version)
-#
-# Syntax:
-#   MP_TCL_PACKAGE (package, [action-if-found], [action-if-not-found])
-#
-# Requires:
-#	TCLSH must be set
-#
-# Results:
-#	Execute action-if-found or action-if-not-found
-#---------------------------------------
-AC_DEFUN([MP_TCL_PACKAGE],[
-	AC_MSG_CHECKING([for Tcl $1 package])
-	package_present=`echo 'if {[[catch {package require $1}]]} {puts -nonewline 0} else {puts -nonewline 1}' | $TCLSH`
-	AS_IF([test "$package_present" = "1"], [$2], [$3])[]
-])
-
-# MP_TCL_THREAD_SUPPORT
-#	Determine if thread support is available in tclsh.
-#
-# Arguments:
-#	None.
-#
-# Requires:
-#	TCLSH must be set
-#
-# Results:
-#   Fails if thread support isn't available.
-#---------------------------------------
-AC_DEFUN([MP_TCL_THREAD_SUPPORT],[
-	AC_MSG_CHECKING([whether tclsh was compiled with threads])
-	tcl_threadenabled=`echo 'puts -nonewline [[info exists tcl_platform(threaded)]]' | $TCLSH`
-	if test "$tcl_threadenabled" = "1" ; then
-		AC_MSG_RESULT([yes])
-	else
-		AC_MSG_RESULT([no])
-		AC_MSG_ERROR([tcl wasn't compiled with threads enabled])
-	fi
-])
-
 # MP_LIBCURL_FLAGS
 #	Sets the flags to compile with libcurl.
 #
@@ -841,42 +980,14 @@
 		LDFLAGS_SQLITE3="-L${sqlite3prefix}/lib -lsqlite3"
 	fi
 
-    # check if we have sqlite3ext.h, using the appropriate cppflags
-    CPPFLAGS_OLD="${CPPFLAGS}"
-    CPPFLAGS="${CPPFLAGS} ${CFLAGS_SQLITE3}"
-    AC_CHECK_HEADERS(sqlite3ext.h)
-    CPPFLAGS="${CPPFLAGS_OLD}"
+	# check if we have sqlite3ext.h, using the appropriate cppflags
+	CPPFLAGS_OLD="${CPPFLAGS}"
+	CPPFLAGS="${CPPFLAGS} ${CFLAGS_SQLITE3}"
+	AC_CHECK_HEADERS(sqlite3ext.h)
+	CPPFLAGS="${CPPFLAGS_OLD}"
 
 	AC_SUBST(CFLAGS_SQLITE3)
 	AC_SUBST(LDFLAGS_SQLITE3)
-
-	# now the sqlite Tcl bindings
-	AC_ARG_WITH(tcl-sqlite3,
-		AS_HELP_STRING([--with-tcl-sqlite3=DIR],
-			[directory for Tcl sqlite3 (default /usr/lib/sqlite3)]),
-		[mp_sqlite3_dir=$withval])
-
-    if test "x$mp_sqlite3_dir" = "x"; then
-        case $host_os in
-            darwin*)
-                mp_sqlite3_dir="/usr/lib/sqlite3"
-                ;;
-            freebsd*)
-                mp_sqlite3_dir="/usr/local/lib/sqlite"
-                ;;
-            *)
-                mp_sqlite3_dir="/usr/share/tcl${TCL_VERSION}/sqlite3"
-                ;;
-        esac
-    fi
-
-	AC_CACHE_CHECK([for Tcl sqlite3 location], [mp_cv_sqlite3_dir],
-		[mp_cv_sqlite3_dir=
-		test -r "${mp_sqlite3_dir}/pkgIndex.tcl" && mp_cv_sqlite3_dir=$mp_sqlite3_dir
-		])
-
-	SQLITE3_TCL_DIR=$mp_cv_sqlite3_dir
-	AC_SUBST(SQLITE3_TCL_DIR)
 ])
 
 dnl This macro tests if the compiler supports GCC's
@@ -892,6 +1003,90 @@
 	
 ])
 
+dnl This macro ensures MP installation prefix paths are NOT in CFLAGS,
+dnl CPPFLAGS, OBJCFLAGS, LDFLAGS for configure to prevent potential problems
+dnl when base/ code is updated and ports are installed that would match needed
+dnl items.
+AC_DEFUN([MP_FLAGS_SCAN],[
+	AC_ARG_ENABLE(
+		[flag-sanitization],
+		AS_HELP_STRING([--disable-flag-sanitization], [Do not sanitize CPPFLAGS, CFLAGS, OBJCFLAGS and LDFLAGS]),
+		[disable_mp_flags_scan=yes],
+		[disable_mp_flags_scan=no])
+
+	if test x"$disable_mp_flags_scan" != "xyes"; then
+		# Get a value for $prefix
+		oldprefix=$prefix
+		if test "x$prefix" = "xNONE" ; then
+			prefix=$ac_default_prefix
+		fi
+
+		mp_flags_scan_found=
+
+		# Clean CFLAGS CPPFLAGS OBJCFLAGS and LDFLAGS
+		for mp_flags_flagname in CFLAGS CPPFLAGS OBJCFLAGS LDFLAGS; do
+			mp_flags_scan_flag_cleaned=
+			eval "set x \$$mp_flags_flagname"
+			shift
+			for mp_flags_scan_val; do
+				case "$mp_flags_scan_val" in
+					-I$prefix/* | -L$prefix/*)
+						AC_MSG_NOTICE([Removing `$mp_flags_scan_val' from \$$mp_flags_flagname because it might cause a self-dependency])
+						mp_flags_scan_found=1
+						;; #(
+					*)
+						if test -z "$mp_flags_scan_flag_cleaned"; then
+							mp_flags_scan_flag_cleaned=$mp_flags_scan_val
+						else
+							AS_VAR_APPEND([mp_flags_scan_flag_cleaned], [" $mp_flags_scan_val"])
+						fi
+						;;
+				esac
+			done
+			if test -z "$mp_flags_scan_flag_cleaned"; then
+				(unset $mp_flags_flagname) >/dev/null 2>&1 && unset $mp_flags_flagname
+				(export -n $mp_flags_flagname) >/dev/null 2>&1 && export -n $mp_flags_flagname
+			else
+				eval "$mp_flags_flagname=\"$mp_flags_scan_flag_cleaned\""
+				export $mp_flags_flagname
+			fi
+			eval "ac_env_${mp_flags_flagname}_set=\${${mp_flags_flagname}+set}"
+			eval "ac_env_${mp_flags_flagname}_value=\${${mp_flags_flagname}}"
+			eval "ac_cv_env_${mp_flags_flagname}_set=\${${mp_flags_flagname}+set}"
+			eval "ac_cv_env_${mp_flags_flagname}_value=\${${mp_flags_flagname}}"
+		done
+
+		# Since those are all precious variables they have been saved into config.cache and put into $ac_configure_args
+		# We need to remove them at least from $ac_configure_args, because that's being passed to sub-configures
+		eval "set x $ac_configure_args"
+		shift
+		ac_configure_args=
+		for mp_flags_configure_arg; do
+			case "$mp_flags_configure_arg" in
+				CFLAGS=* | CPPFLAGS=* | OBJCFLAGS=* | LDFLAGS=*)
+					mp_flags_configure_arg_key=$(AS_ECHO(["$mp_flags_configure_arg"]) | sed -E 's/^([[^=]]+)=.*$/\1/')
+					eval "mp_flags_configure_arg_newval=\$$mp_flags_configure_arg_key"
+					if test -n "$mp_flags_configure_arg_newval"; then
+						AS_VAR_APPEND([ac_configure_args], [" '$mp_flags_configure_arg_key=$mp_flags_configure_arg_newval'"])
+					fi
+					;;
+				*)
+					AS_VAR_APPEND([ac_configure_args], [" '$mp_flags_configure_arg'"])
+					;;
+			esac
+		done
+
+		if ! test -z "$mp_flags_scan_found"; then
+			AC_MSG_NOTICE([See https://trac.macports.org/ticket/42756 for rationale on why this script is removing these values])
+			AC_MSG_NOTICE([Pass --disable-flag-sanitization if you're aware of the potential problems and want to risk them anyway])
+		fi
+
+		# Restore $prefix
+		prefix=$oldprefix
+	fi
+])
+
+
 dnl This macro ensures MP installation prefix paths are NOT in PATH
 dnl for configure to prevent potential problems when base/ code is updated
 dnl and ports are installed that would match needed items.
@@ -1151,7 +1346,7 @@
 ])
 
 #------------------------------------------------------------------------
-# MP_TCL_PLATFORM --
+# MP_PLATFORM --
 #
 #       Export target platform and major version
 #
@@ -1159,7 +1354,7 @@
 #       none.
 #
 # Requires:
-#       TCLSH must be set.
+#       none.
 #
 # Depends:
 #       none.
@@ -1168,10 +1363,10 @@
 #       Defines OS_PLATFORM and OS_MAJOR.
 #
 #------------------------------------------------------------------------
-AC_DEFUN([MP_TCL_PLATFORM],[
-        AC_MSG_CHECKING([for Tcl target platform])
-        OS_PLATFORM=`echo 'puts -nonewline [[string tolower \$tcl_platform(os)]]' | $TCLSH`
-        OS_MAJOR=`echo 'puts -nonewline [[lindex [split \$tcl_platform(osVersion) .] 0]]' | $TCLSH`
+AC_DEFUN([MP_PLATFORM],[
+        AC_MSG_CHECKING([for target platform])
+        OS_PLATFORM=`uname -s | tr '[[:upper:]]' '[[:lower:]]'`
+		OS_MAJOR=`uname -r | cut -d '.' -f 1`
         AC_MSG_RESULT($OS_PLATFORM $OS_MAJOR)
         AC_SUBST(OS_PLATFORM)
         AC_SUBST(OS_MAJOR)
@@ -1186,7 +1381,7 @@
 #       none.
 #
 # Requires:
-#       OS_PLATOFRM and OS_MAJOR from MP_TCL_PLATFORM.
+#       OS_PLATOFRM and OS_MAJOR from MP_PLATFORM.
 #
 # Depends:
 #       none.
@@ -1197,7 +1392,7 @@
 #
 #------------------------------------------------------------------------
 AC_DEFUN([MP_TRACEMODE_SUPPORT],[
-		AC_REQUIRE([MP_TCL_PLATFORM])
+		AC_REQUIRE([MP_PLATFORM])
 
 		AC_CHECK_FUNCS([kqueue kevent])
 

Modified: branches/new-help-system/base/config/RELEASE_URL
===================================================================
--- branches/new-help-system/base/config/RELEASE_URL	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/config/RELEASE_URL	2014-08-03 15:04:12 UTC (rev 122999)
@@ -1 +1 @@
-https://svn.macports.org/repository/macports/tags/release_2_2_1/base
+https://svn.macports.org/repository/macports/tags/release_2_3_1/base

Modified: branches/new-help-system/base/config/macports_version
===================================================================
--- branches/new-help-system/base/config/macports_version	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/config/macports_version	2014-08-03 15:04:12 UTC (rev 122999)
@@ -1 +1 @@
-2.2.99
+2.3.99

Modified: branches/new-help-system/base/configure
===================================================================
--- branches/new-help-system/base/configure	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/configure	2014-08-03 15:04:12 UTC (rev 122999)
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for MacPorts 2.2.99.
+# Generated by GNU Autoconf 2.69 for MacPorts 2.3.99.
 #
 # Report bugs to <macports-dev at lists.macosforge.org>.
 #
@@ -580,8 +580,8 @@
 # Identity of this package.
 PACKAGE_NAME='MacPorts'
 PACKAGE_TARNAME='macports'
-PACKAGE_VERSION='2.2.99'
-PACKAGE_STRING='MacPorts 2.2.99'
+PACKAGE_VERSION='2.3.99'
+PACKAGE_STRING='MacPorts 2.3.99'
 PACKAGE_BUGREPORT='macports-dev at lists.macosforge.org'
 PACKAGE_URL=''
 
@@ -623,25 +623,39 @@
 #endif"
 
 ac_default_prefix=/opt/local
-enable_option_checking=no
 ac_subst_vars='LTLIBOBJS
 LIBOBJS
-macports_tcl_dir
+INCLUDES
+INTREE_TCLSH
+TCLSH
+TCL_PACKAGE_PATH
+TCL_PREFIX
+SHLIB_SUFFIX
+SHLIB_CFLAGS
+STLIB_LD
+SHLIB_LD
+TCL_STUB_LIB_SPEC
+TCL_STUB_LIB_FLAG
+TCL_STUB_LIB_FILE
+TCL_LIB_SPEC
+TCL_LIB_FLAG
+TCL_LIB_FILE
+TCL_SRC_DIR
+TCL_BIN_DIR
+TCL_VERSION
+VENDOR_TCLLIB_INSTALL
+VENDOR_TCLLIB_SUBDIR
+VENDOR_TCLX_INSTALL
+VENDOR_TCLX_SUBDIR
+VENDOR_TCLTHREAD_INSTALL
+VENDOR_TCLTHREAD_SUBDIR
+VENDOR_DESTROOT
+VENDOR_TCL_INSTALL
+VENDOR_TCL_SUBDIR
 localstatedir_expanded
 MPCONFIGDIR_EXPANDED
 prefix_expanded
-OUR_INCLUDED_PACKAGES
-TCL_CC
-TCL_DEFS
-SHLIB_SUFFIX
-SHLIB_LDFLAGS
-SHLIB_CFLAGS
-SHLIB_LD
-STLIB_LD
-INCLUDES
-subdirs
 TRACEMODE_SUPPORT
-SQLITE3_TCL_DIR
 LDFLAGS_SQLITE3
 CFLAGS_SQLITE3
 PKG_CONFIG
@@ -650,17 +664,6 @@
 CURL_CONFIG
 OS_MAJOR
 OS_PLATFORM
-TCLSH
-TCL_INCLUDES
-TCL_STUB_LIB_SPEC
-TCL_STUB_LIB_FLAG
-TCL_STUB_LIB_FILE
-TCL_LIB_SPEC
-TCL_LIB_FLAG
-TCL_LIB_FILE
-TCL_SRC_DIR
-TCL_BIN_DIR
-TCL_VERSION
 READLINE_LIBS
 MD5_LIBS
 READLINK_IS_NOT_P1003_1A
@@ -671,7 +674,6 @@
 MPFRAMEWORKSDIR
 MPAPPLICATIONSDIR
 DSTMODE
-TCL_PACKAGE_DIR
 RUNUSR
 DSTGRP
 DSTUSR
@@ -824,6 +826,24 @@
 ac_subst_files=''
 ac_user_opts='
 enable_option_checking
+enable_flag_sanitization
+with_bsdmake
+with_bzip2
+with_cvs
+with_gnumake
+with_gnutar
+with_lzma
+with_make
+with_mtree
+with_open
+with_openssl
+with_rsync
+with_sed
+with_svn
+with_swig
+with_tar
+with_xar
+with_xz
 enable_werror
 with_objc_runtime
 with_objc_foundation
@@ -839,13 +859,8 @@
 with_frameworks_dir
 with_universal_archs
 enable_readline
-with_tcl
-with_tclinclude
-with_tclpackage
 with_curlprefix
 with_sqlite3prefix
-with_tcl_sqlite3
-with_included_tclthread
 enable_shared
 '
       ac_precious_vars='build_alias
@@ -858,28 +873,10 @@
 CPPFLAGS
 OBJC
 OBJCFLAGS
-BSDMAKE
-BZIP2
-CVS
-GNUMAKE
-GNUTAR
-LZMA
-MAKE
-MAN
-MTREE
-OPEN
-OPENSSL
-RSYNC
-SED
-SVN
-SWIG
-TAR
-XAR
-XZ
 OBJCPP
 CPP'
-ac_subdirs_all='src/thread2.6'
 
+
 # Initialize some variables set by options.
 ac_init_help=
 ac_init_version=false
@@ -1418,7 +1415,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 2.2.99 to adapt to many kinds of systems.
+\`configure' configures MacPorts 2.3.99 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1484,7 +1481,7 @@
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of MacPorts 2.2.99:";;
+     short | recursive ) echo "Configuration of MacPorts 2.3.99:";;
    esac
   cat <<\_ACEOF
 
@@ -1492,6 +1489,9 @@
   --disable-option-checking  ignore unrecognized --enable/--with options
   --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
   --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
+  --disable-flag-sanitization
+                          Do not sanitize CPPFLAGS, CFLAGS, OBJCFLAGS and
+                          LDFLAGS
   --enable-werror         Add -Werror to CFLAGS. Used for development.
   --enable-readline       Enable addition of readline support, if readline
                           present.
@@ -1500,6 +1500,23 @@
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
   --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
+  --with-bsdmake=PATH     Path to alternate bsdmake/pmake command
+  --with-bzip2=PATH       Path to alternate bzip2 command
+  --with-cvs=PATH         Path to alternate cvs command
+  --with-gnumake=PATH     Path to alternate gnumake command
+  --with-gnutar=PATH      Path to alternate gnutar command
+  --with-lzma=PATH        Path to alternate lzma command
+  --with-make=PATH        Path to alternate make command
+  --with-mtree=PATH       Path to alternate mtree command
+  --with-open=PATH        Path to alternate open command
+  --with-openssl=PATH     Path to alternate openssl command
+  --with-rsync=PATH       Path to alternate rsync command
+  --with-sed=PATH         Path to alternate sed command
+  --with-svn=PATH         Path to alternate svn command
+  --with-swig=PATH        Path to alternate swig command
+  --with-tar=PATH         Path to alternate tar command
+  --with-xar=PATH         Path to alternate xar command
+  --with-xz=PATH          Path to alternate xz command
   --with-objc-runtime     Specify either "GNU" or "apple"
   --with-objc-foundation  Specify either "GNUstep" or "apple"
   --with-unsupported-prefix
@@ -1523,14 +1540,8 @@
   --with-frameworks-dir   Frameworks installation directory.
   --with-universal-archs="CPU"
                           Universal CPU architectures (space separated)
-  --with-tcl              directory containing tcl configuration (tclConfig.sh)
-  --with-tclinclude       directory containing the public Tcl header files.
-  --with-tclpackage       Tcl package installation directory.
   --with-curlprefix       base directory for the cURL install '/usr', '/usr/local',...
   --with-sqlite3prefix       base directory for the sqlite3 install '/usr', '/usr/local',...
-  --with-tcl-sqlite3=DIR  directory for Tcl sqlite3 (default /usr/lib/sqlite3)
-  --with-included-tclthread
-                          install included Thread package.
 
 Some influential environment variables:
   CC          C compiler command
@@ -1542,24 +1553,6 @@
               you have headers in a nonstandard directory <include dir>
   OBJC        Objective C compiler command
   OBJCFLAGS   Objective C compiler flags
-  BSDMAKE     path to bsdmake/pmake command
-  BZIP2       path to bzip2 command
-  CVS         path to cvs command
-  GNUMAKE     path to gnumake command
-  GNUTAR      path to gnutar command
-  LZMA        path to lzma command
-  MAKE        path to make command
-  MAN         path to man command
-  MTREE       path to mtree command
-  OPEN        path to open command
-  OPENSSL     path to openssl command
-  RSYNC       path to rsync command
-  SED         path to sed command
-  SVN         path to svn command
-  SWIG        path to swig command
-  TAR         path to tar command
-  XAR         path to xar command
-  XZ          path to xz command
   OBJCPP      Objective C preprocessor
   CPP         C preprocessor
 
@@ -1629,7 +1622,7 @@
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-MacPorts configure 2.2.99
+MacPorts configure 2.3.99
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2298,7 +2291,7 @@
 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 2.2.99, which was
+It was created by MacPorts $as_me 2.3.99, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -2793,7 +2786,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=2.2.99
+MACPORTS_VERSION=2.3.99
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MACPORTS_VERSION" >&5
 $as_echo "$MACPORTS_VERSION" >&6; }
 
@@ -2828,6 +2821,89 @@
 	prefix=$oldprefix
 
 
+	# Check whether --enable-flag-sanitization was given.
+if test "${enable_flag_sanitization+set}" = set; then :
+  enableval=$enable_flag_sanitization; disable_mp_flags_scan=yes
+else
+  disable_mp_flags_scan=no
+fi
+
+
+	if test x"$disable_mp_flags_scan" != "xyes"; then
+		# Get a value for $prefix
+		oldprefix=$prefix
+		if test "x$prefix" = "xNONE" ; then
+			prefix=$ac_default_prefix
+		fi
+
+		mp_flags_scan_found=
+
+		# Clean CFLAGS CPPFLAGS OBJCFLAGS and LDFLAGS
+		for mp_flags_flagname in CFLAGS CPPFLAGS OBJCFLAGS LDFLAGS; do
+			mp_flags_scan_flag_cleaned=
+			eval "set x \$$mp_flags_flagname"
+			shift
+			for mp_flags_scan_val; do
+				case "$mp_flags_scan_val" in
+					-I$prefix/* | -L$prefix/*)
+						{ $as_echo "$as_me:${as_lineno-$LINENO}: Removing \`$mp_flags_scan_val' from \$$mp_flags_flagname because it might cause a self-dependency" >&5
+$as_echo "$as_me: Removing \`$mp_flags_scan_val' from \$$mp_flags_flagname because it might cause a self-dependency" >&6;}
+						mp_flags_scan_found=1
+						;; #(
+					*)
+						if test -z "$mp_flags_scan_flag_cleaned"; then
+							mp_flags_scan_flag_cleaned=$mp_flags_scan_val
+						else
+							as_fn_append mp_flags_scan_flag_cleaned " $mp_flags_scan_val"
+						fi
+						;;
+				esac
+			done
+			if test -z "$mp_flags_scan_flag_cleaned"; then
+				(unset $mp_flags_flagname) >/dev/null 2>&1 && unset $mp_flags_flagname
+				(export -n $mp_flags_flagname) >/dev/null 2>&1 && export -n $mp_flags_flagname
+			else
+				eval "$mp_flags_flagname=\"$mp_flags_scan_flag_cleaned\""
+				export $mp_flags_flagname
+			fi
+			eval "ac_env_${mp_flags_flagname}_set=\${${mp_flags_flagname}+set}"
+			eval "ac_env_${mp_flags_flagname}_value=\${${mp_flags_flagname}}"
+			eval "ac_cv_env_${mp_flags_flagname}_set=\${${mp_flags_flagname}+set}"
+			eval "ac_cv_env_${mp_flags_flagname}_value=\${${mp_flags_flagname}}"
+		done
+
+		# Since those are all precious variables they have been saved into config.cache and put into $ac_configure_args
+		# We need to remove them at least from $ac_configure_args, because that's being passed to sub-configures
+		eval "set x $ac_configure_args"
+		shift
+		ac_configure_args=
+		for mp_flags_configure_arg; do
+			case "$mp_flags_configure_arg" in
+				CFLAGS=* | CPPFLAGS=* | OBJCFLAGS=* | LDFLAGS=*)
+					mp_flags_configure_arg_key=$($as_echo "$mp_flags_configure_arg" | sed -E 's/^([^=]+)=.*$/\1/')
+					eval "mp_flags_configure_arg_newval=\$$mp_flags_configure_arg_key"
+					if test -n "$mp_flags_configure_arg_newval"; then
+						as_fn_append ac_configure_args " '$mp_flags_configure_arg_key=$mp_flags_configure_arg_newval'"
+					fi
+					;;
+				*)
+					as_fn_append ac_configure_args " '$mp_flags_configure_arg'"
+					;;
+			esac
+		done
+
+		if ! test -z "$mp_flags_scan_found"; then
+			{ $as_echo "$as_me:${as_lineno-$LINENO}: See https://trac.macports.org/ticket/42756 for rationale on why this script is removing these values" >&5
+$as_echo "$as_me: See https://trac.macports.org/ticket/42756 for rationale on why this script is removing these values" >&6;}
+			{ $as_echo "$as_me:${as_lineno-$LINENO}: Pass --disable-flag-sanitization if you're aware of the potential problems and want to risk them anyway" >&5
+$as_echo "$as_me: Pass --disable-flag-sanitization if you're aware of the potential problems and want to risk them anyway" >&6;}
+		fi
+
+		# Restore $prefix
+		prefix=$oldprefix
+	fi
+
+
 # Extract the first word of "sw_vers", so it can be a program name with args.
 set dummy sw_vers; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
@@ -4016,6 +4092,111 @@
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
+# Check for user-supplied paths before searching
+
+# Check whether --with-bsdmake was given.
+if test "${with_bsdmake+set}" = set; then :
+  withval=$with_bsdmake; BSDMAKE=$withval
+fi
+
+
+# Check whether --with-bzip2 was given.
+if test "${with_bzip2+set}" = set; then :
+  withval=$with_bzip2; BZIP2=$withval
+fi
+
+
+# Check whether --with-cvs was given.
+if test "${with_cvs+set}" = set; then :
+  withval=$with_cvs; CVS=$withval
+fi
+
+
+# Check whether --with-gnumake was given.
+if test "${with_gnumake+set}" = set; then :
+  withval=$with_gnumake; GNUMAKE=$withval
+fi
+
+
+# Check whether --with-gnutar was given.
+if test "${with_gnutar+set}" = set; then :
+  withval=$with_gnutar; GNUTAR=$withval
+fi
+
+
+# Check whether --with-lzma was given.
+if test "${with_lzma+set}" = set; then :
+  withval=$with_lzma; LZMA=$withval
+fi
+
+
+# Check whether --with-make was given.
+if test "${with_make+set}" = set; then :
+  withval=$with_make; MAKE=$withval
+fi
+
+
+# Check whether --with-mtree was given.
+if test "${with_mtree+set}" = set; then :
+  withval=$with_mtree; MTREE=$withval
+fi
+
+
+# Check whether --with-open was given.
+if test "${with_open+set}" = set; then :
+  withval=$with_open; OPEN=$withval
+fi
+
+
+# Check whether --with-openssl was given.
+if test "${with_openssl+set}" = set; then :
+  withval=$with_openssl; OPENSSL=$withval
+fi
+
+
+# Check whether --with-rsync was given.
+if test "${with_rsync+set}" = set; then :
+  withval=$with_rsync; RSYNC=$withval
+fi
+
+
+# Check whether --with-sed was given.
+if test "${with_sed+set}" = set; then :
+  withval=$with_sed; SED=$withval
+fi
+
+
+# Check whether --with-svn was given.
+if test "${with_svn+set}" = set; then :
+  withval=$with_svn; SVN=$withval
+fi
+
+
+# Check whether --with-swig was given.
+if test "${with_swig+set}" = set; then :
+  withval=$with_swig; SWIG=$withval
+fi
+
+
+# Check whether --with-tar was given.
+if test "${with_tar+set}" = set; then :
+  withval=$with_tar; TAR=$withval
+fi
+
+
+# Check whether --with-xar was given.
+if test "${with_xar+set}" = set; then :
+  withval=$with_xar; XAR=$withval
+fi
+
+
+# Check whether --with-xz was given.
+if test "${with_xz+set}" = set; then :
+  withval=$with_xz; XZ=$withval
+fi
+
+
+# Search for tool paths. Any set above (via --with-pkg=PATH) will be retained
 for ac_prog in bsdmake pmake
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
@@ -4395,7 +4576,8 @@
   ;;
   *)
   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
+as_dummy="$PATH:/usr/sbin"
+for as_dir in $as_dummy
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
@@ -4557,8 +4739,7 @@
   ;;
   *)
   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-as_dummy="$PATH:/usr/local/bin"
-for as_dir in $as_dummy
+for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
@@ -4603,8 +4784,7 @@
   ;;
   *)
   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-as_dummy="$PATH:/usr/local/bin"
-for as_dir in $as_dummy
+for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
@@ -4649,8 +4829,7 @@
   ;;
   *)
   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-as_dummy="$PATH:/usr/local/bin"
-for as_dir in $as_dummy
+for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
@@ -5160,8 +5339,10 @@
 fi
 
 
-# Extract the first word of "mtree", so it can be a program name with args.
-set dummy mtree; ac_word=$2
+for ac_prog in mtree fmtree
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
 if ${ac_cv_path_MTREE+:} false; then :
@@ -5201,6 +5382,9 @@
 fi
 
 
+  test -n "$MTREE" && break
+done
+
 # Extract the first word of "open", so it can be a program name with args.
 set dummy open; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
@@ -5574,8 +5758,7 @@
   ;;
   *)
   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-as_dummy="$PATH:/usr/local/bin"
-for as_dir in $as_dummy
+for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
@@ -5894,7 +6077,7 @@
   ac_cv_prog_HAVE_LAUNCHD="$HAVE_LAUNCHD" # Let the user override the test.
 else
 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
+for as_dir in /sbin
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
@@ -5921,26 +6104,6 @@
 
 
 
-# Define some precious variables allowing user to override PATH for some programs
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
 if test "x$MTREE" = "x"; then
     as_fn_error $? "mtree not found" "$LINENO" 5
 fi
@@ -7289,7 +7452,6 @@
 
 
 							#include <objc/objc.h>
-							#include <objc/objc-api.h>
 
 int
 main ()
@@ -7408,7 +7570,7 @@
 
 	if test x"${with_objc_foundation}" != x"no"; then
 
-	if test x"${with_objc_foundation}" == x || test x"${with_objc_foundation}" == x"apple"; then
+	if test x"${with_objc_foundation}" = x || test x"${with_objc_foundation}" = x"apple"; then
 		# '[' = '['
 		# ']' = ']'
 		{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Apple Foundation library" >&5
@@ -7471,10 +7633,10 @@
 		ac_cv_objc_foundation_apple="no"
 	fi
 
-	if test x"${with_objc_foundation}" == x || test x${with_objc_foundation} == x"GNUstep"; then
+	if test x"${with_objc_foundation}" = x || test x"${with_objc_foundation}" = x"GNUstep"; then
 		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
+		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
 			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
@@ -7556,7 +7718,7 @@
 	fi
 
 	# NeXT Foundation is prefered
-	if test x"${ac_cv_objc_foundation_apple}" == x"yes"; then
+	if test x"${ac_cv_objc_foundation_apple}" = x"yes"; then
 		OBJC_FOUNDATION="Apple"
 		OBJC_FOUNDATION_CPPFLAGS="${APPLE_FOUNDATION_CFLAGS}"
 		OBJC_FOUNDATION_LIBS="${APPLE_FOUNDATION_LIBS}"
@@ -7566,7 +7728,7 @@
 
 		{ $as_echo "$as_me:${as_lineno-$LINENO}: Using Apple Foundation library" >&5
 $as_echo "$as_me: Using Apple Foundation library" >&6;}
-	elif test x"${ac_cv_objc_foundation_gnustep}" == x"yes"; then
+	elif test x"${ac_cv_objc_foundation_gnustep}" = x"yes"; then
 		OBJC_FOUNDATION="GNUstep"
 		OBJC_FOUNDATION_CPPFLAGS="${GNUSTEP_CPPFLAGS}"
 		OBJC_FOUNDATION_LIBS="${GNUSTEP_LIBS}"
@@ -7576,7 +7738,7 @@
 
 		{ $as_echo "$as_me:${as_lineno-$LINENO}: Using GNUstep Foundation library" >&5
 $as_echo "$as_me: Using GNUstep Foundation library" >&6;}
-	elif test x"${with_objc_foundation}" = x"no"; then
+	elif test x"${with_objc_foundation}" = x"no" || test x"$MACOSX_VERSION" = x; then
 		OBJC_FOUNDATION="none"
 		{ $as_echo "$as_me:${as_lineno-$LINENO}: Not using Foundation implementation" >&5
 $as_echo "$as_me: Not using Foundation implementation" >&6;}
@@ -7842,22 +8004,22 @@
 
 
 
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for whether we will build daemondo" >&5
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for whether we will build daemondo" >&5
 $as_echo_n "checking for whether we will build daemondo... " >&6; }
-    result=no
+	result=no
 	case $host_os in
-	darwin*)
-		if test "x$mp_cv_have_framework_corefoundation" == "xyes" &&
-		   test "x$mp_cv_have_framework_systemconfiguration" == "xyes" &&
-		   test "x$mp_cv_have_framework_iokit" == "xyes" &&
-		   test "x$mp_cv_have_function_cfnotificationcentergetdarwinnotifycenter" == "xyes"; then
-			result=yes
-			EXTRA_PROGS="$EXTRA_PROGS daemondo"
-			ac_config_files="$ac_config_files src/programs/daemondo/Makefile"
+		darwin*)
+			if test "x$mp_cv_have_framework_corefoundation" == "xyes" &&
+			   test "x$mp_cv_have_framework_systemconfiguration" == "xyes" &&
+			   test "x$mp_cv_have_framework_iokit" == "xyes" &&
+			   test "x$mp_cv_have_function_cfnotificationcentergetdarwinnotifycenter" == "xyes"; then
+				result=yes
+				EXTRA_PROGS="$EXTRA_PROGS daemondo"
+				ac_config_files="$ac_config_files src/programs/daemondo/Makefile"
 
-		fi
+			fi
 		;;
-	*)
+		*)
 	esac
 	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${result}" >&5
 $as_echo "${result}" >&6; }
@@ -7947,7 +8109,6 @@
 
 
 	if test "${ROOTPRIVS+set}" = set; then
-
 		# Set install-user to current user
 		{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for install user" >&5
 $as_echo_n "checking for install user... " >&6; }
@@ -7971,21 +8132,6 @@
 		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $RUNUSR" >&5
 $as_echo "$RUNUSR" >&6; }
 
-
-		# Set Tcl package directory to ~/Library/Tcl
-	    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Tcl package directory" >&5
-$as_echo_n "checking for Tcl package directory... " >&6; }
-		ac_cv_c_tclpkgd=`eval echo ~$DSTUSR/Library/Tcl`
-	    # Convert to a native path and substitute into the output files.
-	    PACKAGE_DIR_NATIVE=`${CYGPATH} ${ac_cv_c_tclpkgd}`
-	    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
-	    else
-			{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${ac_cv_c_tclpkgd}" >&5
-$as_echo "${ac_cv_c_tclpkgd}" >&6; }
-	    fi
 	fi
 
 
@@ -8004,7 +8150,7 @@
 	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for install user" >&5
 $as_echo_n "checking for install user... " >&6; }
 	if test "x$DSTUSR" = "x" ; then
-	   DSTUSR=root
+		DSTUSR=root
 	fi
 
 	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSTUSR" >&5
@@ -8024,21 +8170,20 @@
 	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for install group" >&5
 $as_echo_n "checking for install group... " >&6; }
 	if test "x$DSTGRP" = "x" ; then
-
-	   case $host_os in
-	   darwin*)
-		DSTGRP="admin"
-		;;
-	   freebsd*)
-		DSTGRP="wheel"
-		;;
-	   linux*)
-		DSTGRP="root"
-		;;
-	   *)
-		DSTGRP="wheel"
-		;;
-	   esac
+		case $host_os in
+			darwin*)
+				DSTGRP="admin"
+			;;
+			freebsd*)
+				DSTGRP="wheel"
+			;;
+			linux*)
+				DSTGRP="root"
+			;;
+			*)
+				DSTGRP="wheel"
+			;;
+		esac
 	fi
 
 	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSTGRP" >&5
@@ -8058,7 +8203,7 @@
 	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for macports user" >&5
 $as_echo_n "checking for macports user... " >&6; }
 	if test "x$RUNUSR" = "x" ; then
-	   RUNUSR=macports
+		RUNUSR=macports
 	fi
 
 	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $RUNUSR" >&5
@@ -8078,7 +8223,7 @@
 	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking what permissions to use for installation directories" >&5
 $as_echo_n "checking what permissions to use for installation directories... " >&6; }
 	if test "x$DSTMODE" = "x" ; then
-	   DSTMODE=0755
+		DSTMODE=0755
 	fi
 
 	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSTMODE" >&5
@@ -8098,7 +8243,7 @@
 	if test "${SHAREDIR+set}" = set; then
 		{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to share the install directory with all members of the install group" >&5
 $as_echo_n "checking whether to share the install directory with all members of the install group... " >&6; }
-	    DSTMODE=0775
+		DSTMODE=0775
 
 		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSTMODE" >&5
 $as_echo "$DSTMODE" >&6; }
@@ -8117,25 +8262,25 @@
 fi
 
 
-    oldprefix=$prefix
-    if test "x$prefix" = "xNONE" ; then
-	prefix=$ac_default_prefix
-    fi
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Applications installation directory" >&5
+	oldprefix=$prefix
+	if test "x$prefix" = "xNONE" ; then
+		prefix=$ac_default_prefix
+	fi
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Applications installation directory" >&5
 $as_echo_n "checking for Applications installation directory... " >&6; }
 
 	if test "x$MPAPPLICATIONSDIR" = "x" ; then
-	    if test "$DSTUSR" = "root" ; then
-		MPAPPLICATIONSDIR="/Applications/MacPorts"
-	    else
-		MPAPPLICATIONSDIR="$(eval echo ~$DSTUSR)/Applications/MacPorts"
-	    fi
+		if test "$DSTUSR" = "root" ; then
+			MPAPPLICATIONSDIR="/Applications/MacPorts"
+		else
+			MPAPPLICATIONSDIR="$(eval echo ~$DSTUSR)/Applications/MacPorts"
+		fi
 	fi
 
 	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MPAPPLICATIONSDIR" >&5
 $as_echo "$MPAPPLICATIONSDIR" >&6; }
 
-    prefix=$oldprefix
+	prefix=$oldprefix
 
 
 
@@ -8147,11 +8292,11 @@
 fi
 
 
-    oldprefix=$prefix
-    if test "x$prefix" = "xNONE" ; then
-	prefix=$ac_default_prefix
-    fi
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Frameworks installation directory" >&5
+	oldprefix=$prefix
+	if test "x$prefix" = "xNONE" ; then
+		prefix=$ac_default_prefix
+	fi
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Frameworks installation directory" >&5
 $as_echo_n "checking for Frameworks installation directory... " >&6; }
 
 	if test "x$MPFRAMEWORKSDIR" = "x" ; then
@@ -8161,7 +8306,7 @@
 	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MPFRAMEWORKSDIR" >&5
 $as_echo "$MPFRAMEWORKSDIR" >&6; }
 
-    prefix=$oldprefix
+	prefix=$oldprefix
 
 
 # Check for universal options
@@ -8173,28 +8318,28 @@
 fi
 
 
-  if test "x$UNIVERSAL_ARCHS" = "x"; then
-    case "$MACOSX_VERSION" in
-      10.1[0-9]*)
-        UNIVERSAL_ARCHS="x86_64 i386"
-        ;;
-      10.[0-5]*)
-        UNIVERSAL_ARCHS="i386 ppc"
-        ;;
-      *)
-        UNIVERSAL_ARCHS="x86_64 i386"
-        ;;
-    esac
-  fi
+	if test "x$UNIVERSAL_ARCHS" = "x"; then
+		case "$MACOSX_VERSION" in
+			10.1[0-9]*)
+				UNIVERSAL_ARCHS="x86_64 i386"
+			;;
+			10.[0-5]*)
+				UNIVERSAL_ARCHS="i386 ppc"
+			;;
+			*)
+				UNIVERSAL_ARCHS="x86_64 i386"
+			;;
+		esac
+	fi
 
-  UNIVERSAL_ARCHFLAGS=
-  for arch in $UNIVERSAL_ARCHS; do
-    UNIVERSAL_ARCHFLAGS="$UNIVERSAL_ARCHFLAGS -arch $arch"
-  done
+	UNIVERSAL_ARCHFLAGS=
+	for arch in $UNIVERSAL_ARCHS; do
+		UNIVERSAL_ARCHFLAGS="$UNIVERSAL_ARCHFLAGS -arch $arch"
+	done
 
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Universal CPU architectures" >&5
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Universal CPU architectures" >&5
 $as_echo_n "checking for Universal CPU architectures... " >&6; }
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $UNIVERSAL_ARCHS" >&5
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $UNIVERSAL_ARCHS" >&5
 $as_echo "$UNIVERSAL_ARCHS" >&6; }
 
 
@@ -8666,11 +8811,10 @@
 done
 
 
-INCLUDES="-I.. -I. $INCLUDES"
-
 # Checks for library functions.
-for ac_func in OSAtomicCompareAndSwap32 OSAtomicCompareAndSwap64 OSAtomicCompareAndSwapPtr bzero \
-	clearenv copyfile fgetln flock fls kqueue lockf memset posix_spawn setmode strcasecmp strlcat \
+for ac_func in OSAtomicCompareAndSwap32 OSAtomicCompareAndSwap64 \
+	OSAtomicCompareAndSwapPtr __getdirentries64 bzero clearenv copyfile fgetln \
+	flock fls kqueue lockf memset posix_spawn setmode strcasecmp strlcat \
 	strlcpy strncasecmp sysctlbyname
 do :
   as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
@@ -8745,7 +8889,6 @@
 
 else
 
-
 	# Check for libmd from FreeBSD, which is preferred
 	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for MD5File in -lmd" >&5
 $as_echo_n "checking for MD5File in -lmd... " >&6; }
@@ -9095,428 +9238,18 @@
 $as_echo "#define MIN_USABLE_GID 500" >>confdefs.h
 
 
-# Load tclConfig.sh
+# Substitute platform for base compatibility check
 
-    #
-    # Ok, lets find the tcl configuration
-    # First, look for one uninstalled.
-    # the alternative search directory is invoked by --with-tcl
-    #
-
-    if test x"${no_tcl}" = x ; then
-	# we reset no_tcl in case something fails here
-	no_tcl=true
-
-# Check whether --with-tcl was given.
-if test "${with_tcl+set}" = set; then :
-  withval=$with_tcl; with_tclconfig=${withval}
-fi
-
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Tcl configuration" >&5
-$as_echo_n "checking for Tcl configuration... " >&6; }
-	if ${ac_cv_c_tclconfig+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-
-	    # First check to see if --with-tcl was specified.
-	    if test x"${with_tclconfig}" != x ; then
-		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
-		fi
-	    fi
-
-	    # then check for a private Tcl installation
-	    if test x"${ac_cv_c_tclconfig}" = x ; then
-		for i in \
-			../tcl \
-			`ls -dr ../tcl[8-9].[0-9]* 2>/dev/null` \
-			../../tcl \
-			`ls -dr ../../tcl[8-9].[0-9]* 2>/dev/null` \
-			../../../tcl \
-			`ls -dr ../../../tcl[8-9].[0-9]* 2>/dev/null` ; do
-		    if test -f "$i/unix/tclConfig.sh" ; then
-			ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
-			break
-		    fi
-		done
-	    fi
-
-	    # check in a few common install locations
-	    if test x"${ac_cv_c_tclconfig}" = x ; then
-		for i in `ls -d ${libdir} 2>/dev/null` \
-			`ls -d /usr/lib 2>/dev/null` \
-			`ls -d /usr/local/lib 2>/dev/null` \
-			`ls -d /usr/contrib/lib 2>/dev/null` \
-			`ls -d /usr/pkg/lib 2>/dev/null` \
-			`ls -d /usr/local/lib/tcl8.6 2>/dev/null` \
-			`ls -d /usr/local/lib/tcl8.5 2>/dev/null` \
-			`ls -d /usr/local/lib/tcl8.4 2>/dev/null` \
-			`ls -d /usr/lib/tcl8.6 2>/dev/null` \
-			`ls -d /usr/lib/tcl8.5 2>/dev/null` \
-			`ls -d /usr/lib/tcl8.4 2>/dev/null` \
-			; do
-		    if test -f "$i/tclConfig.sh" ; then
-			ac_cv_c_tclconfig=`(cd $i; pwd)`
-			break
-		    fi
-		done
-	    fi
-
-	    # check in a few other private locations
-	    if test x"${ac_cv_c_tclconfig}" = x ; then
-		for i in \
-			${srcdir}/../tcl \
-			`ls -dr ${srcdir}/../tcl[8-9].[0-9]* 2>/dev/null` ; do
-		    if test -f "$i/unix/tclConfig.sh" ; then
-		    ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
-		    break
-		fi
-		done
-	    fi
-
-fi
-
-
-	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
-	else
-	    no_tcl=
-	    TCL_BIN_DIR=${ac_cv_c_tclconfig}
-	    { $as_echo "$as_me:${as_lineno-$LINENO}: result: found $TCL_BIN_DIR/tclConfig.sh" >&5
-$as_echo "found $TCL_BIN_DIR/tclConfig.sh" >&6; }
-	fi
-    fi
-
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for existence of $TCL_BIN_DIR/tclConfig.sh" >&5
-$as_echo_n "checking for existence of $TCL_BIN_DIR/tclConfig.sh... " >&6; }
-
-    if test -f "$TCL_BIN_DIR/tclConfig.sh" ; then
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: loading" >&5
-$as_echo "loading" >&6; }
-	. $TCL_BIN_DIR/tclConfig.sh
-    else
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: file not found" >&5
-$as_echo "file not found" >&6; }
-    fi
-
-    #
-    # If the TCL_BIN_DIR is the build directory (not the install directory),
-    # then set the common variable name to the value of the build variables.
-    # For example, the variable TCL_LIB_SPEC will be set to the value
-    # of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC
-    # instead of TCL_BUILD_LIB_SPEC since it will work with both an
-    # installed and uninstalled version of Tcl.
-    #
-
-    if test -f $TCL_BIN_DIR/Makefile ; then
-        TCL_LIB_SPEC=${TCL_BUILD_LIB_SPEC}
-        TCL_STUB_LIB_SPEC=${TCL_BUILD_STUB_LIB_SPEC}
-        TCL_STUB_LIB_PATH=${TCL_BUILD_STUB_LIB_PATH}
-    fi
-
-    #
-    # eval is required to do the TCL_DBGX substitution
-    #
-
-    eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\""
-    eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\""
-    eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\""
-
-    eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\""
-    eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\""
-    eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\""
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-# Check for Tcl public headers
-CYGPATH=echo
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Tcl public headers" >&5
-$as_echo_n "checking for Tcl public headers... " >&6; }
-
-
-# Check whether --with-tclinclude was given.
-if test "${with_tclinclude+set}" = set; then :
-  withval=$with_tclinclude; with_tclinclude=${withval}
-fi
-
-
-    if test x"${with_tclinclude}" != x ; then
-	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
-	fi
-    else
-	if ${ac_cv_c_tclh+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-	    # Use the value from --with-tclinclude, if it was given
-
-	    if test x"${with_tclinclude}" != x ; then
-		ac_cv_c_tclh=${with_tclinclude}
-	    else
-		# Do NOT check in $includedir, we need to prevent automatic
-		# location of Tcl headers in $prefix/include unless explicitly
-		# specified with the --with-tclinclude option. But go ahead and
-		# check some other possible local system locations.
-
-		for i in \
-			/usr/include /usr/local/include /usr/local/include/tcl${TCL_VERSION} /usr/include/tcl${TCL_VERSION}; do
-		    if test -f "$i/tcl.h" ; then
-			ac_cv_c_tclh=$i
-			break
-		    fi
-		done
-	    fi
-
-fi
-
-    fi
-
-    # 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
-    else
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${ac_cv_c_tclh}" >&5
-$as_echo "${ac_cv_c_tclh}" >&6; }
-    fi
-
-    # Convert to a native path and substitute into the output files.
-
-    INCLUDE_DIR_NATIVE=`${CYGPATH} ${ac_cv_c_tclh}`
-
-    TCL_INCLUDES=-I\"${INCLUDE_DIR_NATIVE}\"
-
-
-
-
-# Check for tclsh binary
-
-
-
-	case $host_os in
-		freebsd*)
-			# FreeBSD installs a dummy tclsh (annoying)
-			# Look for a real versioned tclsh with threads first
-			# Look for a real versioned tclsh without threads second
-			# Extract the first word of "tclsh${TCL_VERSION}-threads tclsh${TCL_VERSION} tclsh", so it can be a program name with args.
-set dummy tclsh${TCL_VERSION}-threads tclsh${TCL_VERSION} tclsh; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_TCLSH+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $TCLSH in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_TCLSH="$TCLSH" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_path_TCLSH="$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
-TCLSH=$ac_cv_path_TCLSH
-if test -n "$TCLSH"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $TCLSH" >&5
-$as_echo "$TCLSH" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-			;;
-		*)
-			# Otherwise, look for a non-versioned tclsh
-			# Extract the first word of "tclsh tclsh${TCL_VERSION}", so it can be a program name with args.
-set dummy tclsh tclsh${TCL_VERSION}; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_TCLSH+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $TCLSH in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_TCLSH="$TCLSH" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_path_TCLSH="$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
-TCLSH=$ac_cv_path_TCLSH
-if test -n "$TCLSH"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $TCLSH" >&5
-$as_echo "$TCLSH" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-			;;
-	esac
-	if test "x$TCLSH" = "x" ; then
-		as_fn_error $? "Could not find tclsh" "$LINENO" 5
-	fi
-
-
-
-
-# Substitute Tcl platform for base compatibility check
-
-        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Tcl target platform" >&5
-$as_echo_n "checking for Tcl target platform... " >&6; }
-        OS_PLATFORM=`echo 'puts -nonewline [string tolower \$tcl_platform(os)]' | $TCLSH`
-        OS_MAJOR=`echo 'puts -nonewline [lindex [split \$tcl_platform(osVersion) .] 0]' | $TCLSH`
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for target platform" >&5
+$as_echo_n "checking for target platform... " >&6; }
+        OS_PLATFORM=`uname -s | tr '[:upper:]' '[:lower:]'`
+		OS_MAJOR=`uname -r | cut -d '.' -f 1`
         { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OS_PLATFORM $OS_MAJOR" >&5
 $as_echo "$OS_PLATFORM $OS_MAJOR" >&6; }
 
 
 
 
-# Check for Tcl package path
-
-
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Tcl package directory" >&5
-$as_echo_n "checking for Tcl package directory... " >&6; }
-
-
-# Check whether --with-tclpackage was given.
-if test "${with_tclpackage+set}" = set; then :
-  withval=$with_tclpackage; with_tclpackagedir=${withval}
-fi
-
-
-    if test x"${with_tclpackagedir}" != x ; then
-	ac_cv_c_tclpkgd=${with_tclpackagedir}
-    else
-	if ${ac_cv_c_tclpkgd+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-	    # Use the value from --with-tclpackage, if it was given
-
-	    if test x"${with_tclpackagedir}" != x ; then
-		echo "tclpackagedir"
-		ac_cv_c_tclpkgd=${with_tclpackagedir}
-	    else
-		# On darwin we can do some intelligent guessing
-		case $host_os in
-		    darwin*)
-		    	tcl_autopath=`echo 'puts -nonewline \$auto_path' | $TCLSH`
-			for path in $tcl_autopath; do
-			if test "$DSTUSR" = "root" ; then
-			    if test "$path" = "/Library/Tcl"; then
-				ac_cv_c_tclpkgd="$path"
-				break
-			    fi
-			    if test "$path" = "/System/Library/Tcl"; then
-				if test -d "$path"; then
-				    ac_cv_c_tclpkgd="$path"
-				    break
-			        fi
-			    fi
-			elif test "$path" = "~/Library/Tcl"; then
-			    ac_cv_c_tclpkgd=`eval echo ~$DSTUSR/Library/Tcl`
-			    break
-			fi
-			done
-		    ;;
-		esac
-    		if test x"${ac_cv_c_tclpkgd}" = x ; then
-		    # Fudge a path from the first entry in the auto_path
-		    tcl_pkgpath=`echo 'puts -nonewline [lindex \$auto_path 0]' | $TCLSH`
-		    if test -d "$tcl_pkgpath"; then
-			ac_cv_c_tclpkgd="$tcl_pkgpath"
-		    fi
-		    # If the first entry does not exist, do nothing
-		fi
-	    fi
-
-fi
-
-    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
-    else
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${ac_cv_c_tclpkgd}" >&5
-$as_echo "${ac_cv_c_tclpkgd}" >&6; }
-    fi
-
-    # Convert to a native path and substitute into the output files.
-
-    PACKAGE_DIR_NATIVE=`${CYGPATH} ${ac_cv_c_tclpkgd}`
-
-    TCL_PACKAGE_DIR=${PACKAGE_DIR_NATIVE}
-
-
-
-
-# Check if thread is enabled.
-
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether tclsh was compiled with threads" >&5
-$as_echo_n "checking whether tclsh was compiled with threads... " >&6; }
-	tcl_threadenabled=`echo 'puts -nonewline [info exists tcl_platform(threaded)]' | $TCLSH`
-	if test "$tcl_threadenabled" = "1" ; then
-		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-	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
-	fi
-
-
 ## libcurl
 
 
@@ -9708,10 +9441,10 @@
 		LDFLAGS_SQLITE3="-L${sqlite3prefix}/lib -lsqlite3"
 	fi
 
-    # check if we have sqlite3ext.h, using the appropriate cppflags
-    CPPFLAGS_OLD="${CPPFLAGS}"
-    CPPFLAGS="${CPPFLAGS} ${CFLAGS_SQLITE3}"
-    for ac_header in sqlite3ext.h
+	# check if we have sqlite3ext.h, using the appropriate cppflags
+	CPPFLAGS_OLD="${CPPFLAGS}"
+	CPPFLAGS="${CPPFLAGS} ${CFLAGS_SQLITE3}"
+	for ac_header in sqlite3ext.h
 do :
   ac_fn_c_check_header_mongrel "$LINENO" "sqlite3ext.h" "ac_cv_header_sqlite3ext_h" "$ac_includes_default"
 if test "x$ac_cv_header_sqlite3ext_h" = xyes; then :
@@ -9723,52 +9456,15 @@
 
 done
 
-    CPPFLAGS="${CPPFLAGS_OLD}"
+	CPPFLAGS="${CPPFLAGS_OLD}"
 
 
 
 
-	# now the sqlite Tcl bindings
 
-# Check whether --with-tcl-sqlite3 was given.
-if test "${with_tcl_sqlite3+set}" = set; then :
-  withval=$with_tcl_sqlite3; mp_sqlite3_dir=$withval
-fi
 
 
-    if test "x$mp_sqlite3_dir" = "x"; then
-        case $host_os in
-            darwin*)
-                mp_sqlite3_dir="/usr/lib/sqlite3"
-                ;;
-            freebsd*)
-                mp_sqlite3_dir="/usr/local/lib/sqlite"
-                ;;
-            *)
-                mp_sqlite3_dir="/usr/share/tcl${TCL_VERSION}/sqlite3"
-                ;;
-        esac
-    fi
 
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Tcl sqlite3 location" >&5
-$as_echo_n "checking for Tcl sqlite3 location... " >&6; }
-if ${mp_cv_sqlite3_dir+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  mp_cv_sqlite3_dir=
-		test -r "${mp_sqlite3_dir}/pkgIndex.tcl" && mp_cv_sqlite3_dir=$mp_sqlite3_dir
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mp_cv_sqlite3_dir" >&5
-$as_echo "$mp_cv_sqlite3_dir" >&6; }
-
-	SQLITE3_TCL_DIR=$mp_cv_sqlite3_dir
-
-
-
-
-
-
 	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for SQLite >= 3003011" >&5
 $as_echo_n "checking for SQLite >= 3003011... " >&6; }
 
@@ -9911,50 +9607,1752 @@
 
 
 
-# Determine if we need to install some bundled packages
-OUR_INCLUDED_PACKAGES=
+# misc variables that need to be expanded for substitution into tcl
+oldprefix=$prefix
+oldexec_prefix=$exec_prefix
+if test "x$prefix" = "xNONE" ; then
+   prefix=$ac_default_prefix
+fi
+if test "x$exec_prefix" = "xNONE" ; then
+	exec_prefix=$prefix
+fi
+eval "prefix_expanded=$prefix"
+eval "exec_prefix_expanded=$exec_prefix"
 
-## Thread package.
+# do this twice, since there is a nested variable of
+# ${prefix} inside of ${sysconfdir}
+eval "MPCONFIGDIR_EXPANDED=$MPCONFIGDIR"
+eval "MPCONFIGDIR_EXPANDED=$MPCONFIGDIR_EXPANDED"
 
-# Check whether --with-included-tclthread was given.
-if test "${with_included_tclthread+set}" = set; then :
-  withval=$with_included_tclthread; with_included_tclthread=$withval
+eval "localstatedir_expanded=$localstatedir"
+
+# Compute the libexec dir for the vendor packages
+eval "macports_libexec_dir=${libexecdir}/macports"
+eval "macports_libexec_dir=$macports_libexec_dir"
+prefix=$oldprefix
+exec_prefix=$oldexec_prefix
+
+## Tcl package
+tcl_version=8.5.15
+tcl_thread_version=2.7.0
+tclx_version=8.4.1
+tcllib_version=1.15
+	mp_fn_var_prepend() {
+		eval "$1=\"$2\$$1\""
+	}
+
+
+	# Extract the first word of "gzip", so it can be a program name with args.
+set dummy gzip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_GZIP+:} false; then :
+  $as_echo_n "(cached) " >&6
 else
-  with_included_tclthread="unspecified"
+  case $GZIP in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_GZIP="$GZIP" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_GZIP="$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
+GZIP=$ac_cv_path_GZIP
+if test -n "$GZIP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GZIP" >&5
+$as_echo "$GZIP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
 
 
-# Check if thread package is already installed.
-if test "x$with_included_tclthread" = "xunspecified" ; then
+	# Extract the first word of "bzip2", so it can be a program name with args.
+set dummy bzip2; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_BZIP2+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $BZIP2 in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_BZIP2="$BZIP2" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_BZIP2="$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
 
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Tcl Thread package" >&5
-$as_echo_n "checking for Tcl Thread package... " >&6; }
-	package_present=`echo 'if {[catch {package require Thread}]} {puts -nonewline 0} else {puts -nonewline 1}' | $TCLSH`
-	if test "$package_present" = "1"; then :
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }; with_included_tclthread=no
+  ;;
+esac
+fi
+BZIP2=$ac_cv_path_BZIP2
+if test -n "$BZIP2"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BZIP2" >&5
+$as_echo "$BZIP2" >&6; }
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }; with_included_tclthread=yes
+$as_echo "no" >&6; }
 fi
 
+
+
+	mp_tarball="vendor/tcl${tcl_version}-src.tar.gz"
+	ac_dir=vendor/tcl${tcl_version}/unix
+
+	mp_popdir=$(pwd)
+	if ! test -d "$ac_dir"; then
+		mp_tarball_vendordir="$(dirname "$mp_tarball")"
+		as_dir="$mp_tarball_vendordir"; as_fn_mkdir_p
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: === extracting $mp_tarball" >&5
+$as_echo "$as_me: === extracting $mp_tarball" >&6;}
+		mp_tarball_extract_cmd=
+		case "$mp_tarball" in
+			*.tar.gz | *.tgz)
+				if test "x$GZIP" = "x"; then
+					as_fn_error $? "gzip not found" "$LINENO" 5
+				fi
+				mp_tarball_extract_cmd="$GZIP"
+				;;
+			*.tar.bz2 | *.tbz2)
+				if test "x$BZIP2" = "x"; then
+					as_fn_error $? "bzip2 not found" "$LINENO" 5
+				fi
+				mp_tarball_extract_cmd="$BZIP2"
+				;;
+			*)
+				as_fn_error $? "Don't know how to extract tarball $mp_tarball" "$LINENO" 5
+				;;
+		esac
+		(cd "$mp_tarball_vendordir"; umask 0022; "$mp_tarball_extract_cmd" -d < "$ac_abs_confdir/$mp_tarball" | tar xf - || as_fn_error $? "failed to extract $mp_tarball" "$LINENO" 5)
+	fi
+	if ! test -d "$ac_dir"; then
+		as_fn_error $? "tarball $mp_tarball did not extract to $ac_dir" "$LINENO" 5
+	fi
+
+	as_dir="$ac_dir"; as_fn_mkdir_p
+	ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+  ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
+  # A ".." for each directory in $ac_dir_suffix.
+  ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
+  case $ac_top_builddir_sub in
+  "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+  *)  ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+  esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+  .)  # We are building in place.
+    ac_srcdir=.
+    ac_top_srcdir=$ac_top_builddir_sub
+    ac_abs_top_srcdir=$ac_pwd ;;
+  [\\/]* | ?:[\\/]* )  # Absolute name.
+    ac_srcdir=$srcdir$ac_dir_suffix;
+    ac_top_srcdir=$srcdir
+    ac_abs_top_srcdir=$srcdir ;;
+  *) # Relative name.
+    ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_build_prefix$srcdir
+    ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+	cd "$ac_dir"
+
+	if test "$no_recursion" != yes || test ! -f "$ac_srcdir/config.status"; then
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: === configuring in $ac_dir ($mp_popdir/$ac_dir)" >&5
+$as_echo "$as_me: === configuring in $ac_dir ($mp_popdir/$ac_dir)" >&6;}
+		if test -f "$ac_srcdir/configure"; then
+			mp_sub_configure_args=
+			mp_sub_configure_keys=
+			# Compile a list of keys that have been given to the MP_CONFIG_TARBALL
+			# macro; we want to skip copying those parameters from the original
+			# configure invocation.
+			for mp_arg in --prefix=${macports_libexec_dir} --enable-threads; do
+				case $mp_arg in
+					--*=* | -*=*)
+							mp_arg_key=$($as_echo "$mp_arg" | sed -E 's/^--?([^=]+)=.*$/\1/')
+								case $mp_arg_key in
+		*\'*)
+			mp_arg_key=$($as_echo "$mp_arg_key" | sed "s/'/'\\\\\\\\''/g")
+		;;
+	esac
+	mp_arg_key="'$mp_arg_key'"
+	as_fn_append mp_sub_configure_keys " $mp_arg_key"
+
+					;;
+				esac
+						case $mp_arg in
+		*\'*)
+			mp_arg=$($as_echo "$mp_arg" | sed "s/'/'\\\\\\\\''/g")
+		;;
+	esac
+	mp_arg="'$mp_arg'"
+	as_fn_append mp_sub_configure_args " $mp_arg"
+
+			done
+			# Walk the list of arguments given to the original configure script;
+			# filter out a few common ones we likely would not want to pass along,
+			# add --disable-option-checking and filter those already given as
+			# argument to MP_CONFIG_TARBALL.
+			# Most of this code is adapted from _AC_OUTPUT_SUBDIRS in
+			# $prefix/share/autoconf/autoconf/status.m4.
+			mp_prev=
+			eval "set x $ac_configure_args"
+			shift
+			for mp_arg; do
+				if test -n "$mp_prev"; then
+					mp_prev=
+					continue
+				fi
+				case $mp_arg in
+					  -cache-file \
+					| --cache-file \
+					| --cache-fil \
+					| --cache-fi \
+					| --cache-f \
+					| --cache- \
+					| --cache \
+					| --cach \
+					| --cac \
+					| --ca \
+					| --c)
+						mp_prev=cache_file
+					;;
+					  -cache-file=* \
+					| --cache-file=* \
+					| --cache-fil=* \
+					| --cache-fi=* \
+					| --cache-f=* \
+					| --cache-=* \
+					| --cache=* \
+					| --cach=* \
+					| --cac=* \
+					| --ca=* \
+					| --c=*)
+						# ignore --cache-file
+					;;
+					  --config-cache \
+					| -C)
+						# ignore -C
+					;;
+					  -srcdir \
+					| --srcdir \
+					| -srcdi \
+					| -srcd \
+					| -src \
+					| -sr)
+						mp_prev=srcdir
+					;;
+					  -srcdir=* \
+					| --srcdir=* \
+					| --srcdi=* \
+					| --srcd=* \
+					| --src=* \
+					| --sr=*)
+						# ignore --srcdir
+					;;
+					  -prefix \
+					| --prefix \
+					| --prefi \
+					| --pref \
+					| --pre \
+					| --pr \
+					| --p)
+						mp_prev=prefix
+					;;
+					  -prefix=* \
+					| --prefix=* \
+					| --prefi=* \
+					| --pref=* \
+					| --pre=* \
+					| --pr=* \
+					| --p=*)
+						# ignore --prefix
+					;;
+					--disable-option-checking)
+						# ignore --disable-option-checking
+					;;
+					--*=* | -*=*)
+							mp_arg_key=$($as_echo "$mp_arg" | sed -E 's/^--?([^=]+)=.*$/\1/')
+							mp_list_contains_present=
+	eval "mp_list_contains_list=\"$mp_sub_configure_keys\""
+	for mp_list_contains_entry in $mp_list_contains_list; do
+		test -z "$mp_list_contains_entry" && continue
+		if test "x$mp_arg_key" = "x$mp_list_contains_entry"; then
+			mp_list_contains_present=1
+			break
+		fi
+	done
+	if test "x$mp_list_contains_present" = "x"; then
+		:
+		else
+									case $mp_arg in
+		*\'*)
+			mp_arg=$($as_echo "$mp_arg" | sed "s/'/'\\\\\\\\''/g")
+		;;
+	esac
+	mp_arg="'$mp_arg'"
+	as_fn_append mp_sub_configure_args " $mp_arg"
+
+
+	fi
+
+					;;
+					*)
+						# always pass positional arguments
+								case $mp_arg in
+		*\'*)
+			mp_arg=$($as_echo "$mp_arg" | sed "s/'/'\\\\\\\\''/g")
+		;;
+	esac
+	mp_arg="'$mp_arg'"
+	as_fn_append mp_sub_configure_args " $mp_arg"
+
+					;;
+				esac
+			done
+
+			# Now prepend some arguments that should always be present unless
+			# overriden, such as --prefix, --silent, --disable-option-checking,
+			# --cache-file, --srcdir
+			# Pass --prefix unless already given
+			mp_arg_key=prefix
+				mp_list_contains_present=
+	eval "mp_list_contains_list=\"$mp_sub_configure_args\""
+	for mp_list_contains_entry in $mp_list_contains_list; do
+		test -z "$mp_list_contains_entry" && continue
+		if test "x$mp_arg_key" = "x$mp_list_contains_entry"; then
+			mp_list_contains_present=1
+			break
+		fi
+	done
+	if test "x$mp_list_contains_present" = "x"; then
+		:
+		else
+				mp_arg="--prefix=$prefix"
+						case $mp_arg in
+		*\'*)
+			mp_arg=$($as_echo "$mp_arg" | sed "s/'/'\\\\\\\\''/g")
+		;;
+	esac
+	mp_arg="'$mp_arg'"
+			mp_fn_var_prepend mp_sub_configure_args "$mp_arg "
+
+
+
+	fi
+
+
+			# Pass --silent
+			if test "$silent" = yes; then
+				mp_arg="--silent"
+						case $mp_arg in
+		*\'*)
+			mp_arg=$($as_echo "$mp_arg" | sed "s/'/'\\\\\\\\''/g")
+		;;
+	esac
+	mp_arg="'$mp_arg'"
+			mp_fn_var_prepend mp_sub_configure_args "$mp_arg "
+
+
+			fi
+
+			# Always prepend --disable-option-checking to silence warnings, since
+			# different subdirs can have different --enable and --with options.
+			mp_arg="--disable-option-checking"
+					case $mp_arg in
+		*\'*)
+			mp_arg=$($as_echo "$mp_arg" | sed "s/'/'\\\\\\\\''/g")
+		;;
+	esac
+	mp_arg="'$mp_arg'"
+			mp_fn_var_prepend mp_sub_configure_args "$mp_arg "
+
+
+
+			# Make the cache file name correct relative to the subdirectory.
+			case $cache_file in
+				[\\/]* | ?:[\\/]* )
+					mp_sub_cache_file=$cache_file
+				;;
+				*) # Relative name.
+					mp_sub_cache_file=$ac_top_build_prefix$cache_file
+				;;
+			esac
+			mp_arg="--cache-file=$mp_sub_cache_file"
+					case $mp_arg in
+		*\'*)
+			mp_arg=$($as_echo "$mp_arg" | sed "s/'/'\\\\\\\\''/g")
+		;;
+	esac
+	mp_arg="'$mp_arg'"
+			mp_fn_var_prepend mp_sub_configure_args "$mp_arg "
+
+
+
+			mp_arg="--srcdir=$ac_srcdir"
+					case $mp_arg in
+		*\'*)
+			mp_arg=$($as_echo "$mp_arg" | sed "s/'/'\\\\\\\\''/g")
+		;;
+	esac
+	mp_arg="'$mp_arg'"
+	as_fn_append mp_sub_configure_args " $mp_arg"
+
+
+			{ $as_echo "$as_me:${as_lineno-$LINENO}: running $SHELL $ac_srcdir/configure $mp_sub_configure_args in $ac_dir" >&5
+$as_echo "$as_me: running $SHELL $ac_srcdir/configure $mp_sub_configure_args in $ac_dir" >&6;}
+			eval "\$SHELL \$ac_srcdir/configure $mp_sub_configure_args" || as_fn_error $? "configure failed for $ac_dir" "$LINENO" 5
+		else
+			as_fn_error $? "no configure script found in $ac_dir" "$LINENO" 5
+		fi
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: === finished configuring in $ac_dir ($mp_popdir/$ac_dir)" >&5
+$as_echo "$as_me: === finished configuring in $ac_dir ($mp_popdir/$ac_dir)" >&6;}
+	fi
+	cd "$mp_popdir"
+
+VENDOR_TCL_SUBDIR=tcl${tcl_version}/unix
+VENDOR_TCL_INSTALL="install-binaries install-libraries"
+
+
+
+# Set up some variables needed by MacPorts' Tcl setup
+VENDOR_DESTROOT=vendor/vendor-destroot
+
+
+## Tcl Thread package
+# Tcl supports Threads internally, but to use threads from Tcl code we need
+# this package
+
+	# Extract the first word of "gzip", so it can be a program name with args.
+set dummy gzip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_GZIP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $GZIP in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_GZIP="$GZIP" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_GZIP="$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
+GZIP=$ac_cv_path_GZIP
+if test -n "$GZIP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GZIP" >&5
+$as_echo "$GZIP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
 
-# If thread package isn't installed, configure and install thread package.
-if test "$with_included_tclthread" = "yes"; then
-	OUR_INCLUDED_PACKAGES="$OUR_INCLUDED_PACKAGES thread2.6"
 
+	# Extract the first word of "bzip2", so it can be a program name with args.
+set dummy bzip2; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_BZIP2+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $BZIP2 in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_BZIP2="$BZIP2" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_BZIP2="$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
 
-subdirs="$subdirs src/thread2.6"
+  ;;
+esac
+fi
+BZIP2=$ac_cv_path_BZIP2
+if test -n "$BZIP2"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BZIP2" >&5
+$as_echo "$BZIP2" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
 
-	# Extract thread package
-	(cd src/; gzip -d < thread2.6.tar.gz | tar xf -)
-	# Patch thread package (so thread2.6 is the vanilla distribution directory)
-	patch -p0 < src/thread2.6.diff
+
+
+	mp_tarball="vendor/thread${tcl_thread_version}.tar.gz"
+	ac_dir=vendor/thread${tcl_thread_version}
+
+	mp_popdir=$(pwd)
+	if ! test -d "$ac_dir"; then
+		mp_tarball_vendordir="$(dirname "$mp_tarball")"
+		as_dir="$mp_tarball_vendordir"; as_fn_mkdir_p
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: === extracting $mp_tarball" >&5
+$as_echo "$as_me: === extracting $mp_tarball" >&6;}
+		mp_tarball_extract_cmd=
+		case "$mp_tarball" in
+			*.tar.gz | *.tgz)
+				if test "x$GZIP" = "x"; then
+					as_fn_error $? "gzip not found" "$LINENO" 5
+				fi
+				mp_tarball_extract_cmd="$GZIP"
+				;;
+			*.tar.bz2 | *.tbz2)
+				if test "x$BZIP2" = "x"; then
+					as_fn_error $? "bzip2 not found" "$LINENO" 5
+				fi
+				mp_tarball_extract_cmd="$BZIP2"
+				;;
+			*)
+				as_fn_error $? "Don't know how to extract tarball $mp_tarball" "$LINENO" 5
+				;;
+		esac
+		(cd "$mp_tarball_vendordir"; umask 0022; "$mp_tarball_extract_cmd" -d < "$ac_abs_confdir/$mp_tarball" | tar xf - || as_fn_error $? "failed to extract $mp_tarball" "$LINENO" 5)
+	fi
+	if ! test -d "$ac_dir"; then
+		as_fn_error $? "tarball $mp_tarball did not extract to $ac_dir" "$LINENO" 5
+	fi
+
+	as_dir="$ac_dir"; as_fn_mkdir_p
+	ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+  ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
+  # A ".." for each directory in $ac_dir_suffix.
+  ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
+  case $ac_top_builddir_sub in
+  "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+  *)  ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+  esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+  .)  # We are building in place.
+    ac_srcdir=.
+    ac_top_srcdir=$ac_top_builddir_sub
+    ac_abs_top_srcdir=$ac_pwd ;;
+  [\\/]* | ?:[\\/]* )  # Absolute name.
+    ac_srcdir=$srcdir$ac_dir_suffix;
+    ac_top_srcdir=$srcdir
+    ac_abs_top_srcdir=$srcdir ;;
+  *) # Relative name.
+    ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_build_prefix$srcdir
+    ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+	cd "$ac_dir"
+
+	if test "$no_recursion" != yes || test ! -f "$ac_srcdir/config.status"; then
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: === configuring in $ac_dir ($mp_popdir/$ac_dir)" >&5
+$as_echo "$as_me: === configuring in $ac_dir ($mp_popdir/$ac_dir)" >&6;}
+		if test -f "$ac_srcdir/configure"; then
+			mp_sub_configure_args=
+			mp_sub_configure_keys=
+			# Compile a list of keys that have been given to the MP_CONFIG_TARBALL
+			# macro; we want to skip copying those parameters from the original
+			# configure invocation.
+			for mp_arg in --prefix=${macports_libexec_dir}; do
+				case $mp_arg in
+					--*=* | -*=*)
+							mp_arg_key=$($as_echo "$mp_arg" | sed -E 's/^--?([^=]+)=.*$/\1/')
+								case $mp_arg_key in
+		*\'*)
+			mp_arg_key=$($as_echo "$mp_arg_key" | sed "s/'/'\\\\\\\\''/g")
+		;;
+	esac
+	mp_arg_key="'$mp_arg_key'"
+	as_fn_append mp_sub_configure_keys " $mp_arg_key"
+
+					;;
+				esac
+						case $mp_arg in
+		*\'*)
+			mp_arg=$($as_echo "$mp_arg" | sed "s/'/'\\\\\\\\''/g")
+		;;
+	esac
+	mp_arg="'$mp_arg'"
+	as_fn_append mp_sub_configure_args " $mp_arg"
+
+			done
+			# Walk the list of arguments given to the original configure script;
+			# filter out a few common ones we likely would not want to pass along,
+			# add --disable-option-checking and filter those already given as
+			# argument to MP_CONFIG_TARBALL.
+			# Most of this code is adapted from _AC_OUTPUT_SUBDIRS in
+			# $prefix/share/autoconf/autoconf/status.m4.
+			mp_prev=
+			eval "set x $ac_configure_args"
+			shift
+			for mp_arg; do
+				if test -n "$mp_prev"; then
+					mp_prev=
+					continue
+				fi
+				case $mp_arg in
+					  -cache-file \
+					| --cache-file \
+					| --cache-fil \
+					| --cache-fi \
+					| --cache-f \
+					| --cache- \
+					| --cache \
+					| --cach \
+					| --cac \
+					| --ca \
+					| --c)
+						mp_prev=cache_file
+					;;
+					  -cache-file=* \
+					| --cache-file=* \
+					| --cache-fil=* \
+					| --cache-fi=* \
+					| --cache-f=* \
+					| --cache-=* \
+					| --cache=* \
+					| --cach=* \
+					| --cac=* \
+					| --ca=* \
+					| --c=*)
+						# ignore --cache-file
+					;;
+					  --config-cache \
+					| -C)
+						# ignore -C
+					;;
+					  -srcdir \
+					| --srcdir \
+					| -srcdi \
+					| -srcd \
+					| -src \
+					| -sr)
+						mp_prev=srcdir
+					;;
+					  -srcdir=* \
+					| --srcdir=* \
+					| --srcdi=* \
+					| --srcd=* \
+					| --src=* \
+					| --sr=*)
+						# ignore --srcdir
+					;;
+					  -prefix \
+					| --prefix \
+					| --prefi \
+					| --pref \
+					| --pre \
+					| --pr \
+					| --p)
+						mp_prev=prefix
+					;;
+					  -prefix=* \
+					| --prefix=* \
+					| --prefi=* \
+					| --pref=* \
+					| --pre=* \
+					| --pr=* \
+					| --p=*)
+						# ignore --prefix
+					;;
+					--disable-option-checking)
+						# ignore --disable-option-checking
+					;;
+					--*=* | -*=*)
+							mp_arg_key=$($as_echo "$mp_arg" | sed -E 's/^--?([^=]+)=.*$/\1/')
+							mp_list_contains_present=
+	eval "mp_list_contains_list=\"$mp_sub_configure_keys\""
+	for mp_list_contains_entry in $mp_list_contains_list; do
+		test -z "$mp_list_contains_entry" && continue
+		if test "x$mp_arg_key" = "x$mp_list_contains_entry"; then
+			mp_list_contains_present=1
+			break
+		fi
+	done
+	if test "x$mp_list_contains_present" = "x"; then
+		:
+		else
+									case $mp_arg in
+		*\'*)
+			mp_arg=$($as_echo "$mp_arg" | sed "s/'/'\\\\\\\\''/g")
+		;;
+	esac
+	mp_arg="'$mp_arg'"
+	as_fn_append mp_sub_configure_args " $mp_arg"
+
+
+	fi
+
+					;;
+					*)
+						# always pass positional arguments
+								case $mp_arg in
+		*\'*)
+			mp_arg=$($as_echo "$mp_arg" | sed "s/'/'\\\\\\\\''/g")
+		;;
+	esac
+	mp_arg="'$mp_arg'"
+	as_fn_append mp_sub_configure_args " $mp_arg"
+
+					;;
+				esac
+			done
+
+			# Now prepend some arguments that should always be present unless
+			# overriden, such as --prefix, --silent, --disable-option-checking,
+			# --cache-file, --srcdir
+			# Pass --prefix unless already given
+			mp_arg_key=prefix
+				mp_list_contains_present=
+	eval "mp_list_contains_list=\"$mp_sub_configure_args\""
+	for mp_list_contains_entry in $mp_list_contains_list; do
+		test -z "$mp_list_contains_entry" && continue
+		if test "x$mp_arg_key" = "x$mp_list_contains_entry"; then
+			mp_list_contains_present=1
+			break
+		fi
+	done
+	if test "x$mp_list_contains_present" = "x"; then
+		:
+		else
+				mp_arg="--prefix=$prefix"
+						case $mp_arg in
+		*\'*)
+			mp_arg=$($as_echo "$mp_arg" | sed "s/'/'\\\\\\\\''/g")
+		;;
+	esac
+	mp_arg="'$mp_arg'"
+			mp_fn_var_prepend mp_sub_configure_args "$mp_arg "
+
+
+
+	fi
+
+
+			# Pass --silent
+			if test "$silent" = yes; then
+				mp_arg="--silent"
+						case $mp_arg in
+		*\'*)
+			mp_arg=$($as_echo "$mp_arg" | sed "s/'/'\\\\\\\\''/g")
+		;;
+	esac
+	mp_arg="'$mp_arg'"
+			mp_fn_var_prepend mp_sub_configure_args "$mp_arg "
+
+
+			fi
+
+			# Always prepend --disable-option-checking to silence warnings, since
+			# different subdirs can have different --enable and --with options.
+			mp_arg="--disable-option-checking"
+					case $mp_arg in
+		*\'*)
+			mp_arg=$($as_echo "$mp_arg" | sed "s/'/'\\\\\\\\''/g")
+		;;
+	esac
+	mp_arg="'$mp_arg'"
+			mp_fn_var_prepend mp_sub_configure_args "$mp_arg "
+
+
+
+			# Make the cache file name correct relative to the subdirectory.
+			case $cache_file in
+				[\\/]* | ?:[\\/]* )
+					mp_sub_cache_file=$cache_file
+				;;
+				*) # Relative name.
+					mp_sub_cache_file=$ac_top_build_prefix$cache_file
+				;;
+			esac
+			mp_arg="--cache-file=$mp_sub_cache_file"
+					case $mp_arg in
+		*\'*)
+			mp_arg=$($as_echo "$mp_arg" | sed "s/'/'\\\\\\\\''/g")
+		;;
+	esac
+	mp_arg="'$mp_arg'"
+			mp_fn_var_prepend mp_sub_configure_args "$mp_arg "
+
+
+
+			mp_arg="--srcdir=$ac_srcdir"
+					case $mp_arg in
+		*\'*)
+			mp_arg=$($as_echo "$mp_arg" | sed "s/'/'\\\\\\\\''/g")
+		;;
+	esac
+	mp_arg="'$mp_arg'"
+	as_fn_append mp_sub_configure_args " $mp_arg"
+
+
+			{ $as_echo "$as_me:${as_lineno-$LINENO}: running $SHELL $ac_srcdir/configure $mp_sub_configure_args in $ac_dir" >&5
+$as_echo "$as_me: running $SHELL $ac_srcdir/configure $mp_sub_configure_args in $ac_dir" >&6;}
+			eval "\$SHELL \$ac_srcdir/configure $mp_sub_configure_args" || as_fn_error $? "configure failed for $ac_dir" "$LINENO" 5
+		else
+			as_fn_error $? "no configure script found in $ac_dir" "$LINENO" 5
+		fi
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: === finished configuring in $ac_dir ($mp_popdir/$ac_dir)" >&5
+$as_echo "$as_me: === finished configuring in $ac_dir ($mp_popdir/$ac_dir)" >&6;}
+	fi
+	cd "$mp_popdir"
+
+VENDOR_TCLTHREAD_SUBDIR=thread${tcl_thread_version}
+VENDOR_TCLTHREAD_INSTALL="install-binaries install-libraries"
+
+
+
+## TclX package
+# TclX is required for signal handling
+
+	# Extract the first word of "gzip", so it can be a program name with args.
+set dummy gzip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_GZIP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $GZIP in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_GZIP="$GZIP" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_GZIP="$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
+GZIP=$ac_cv_path_GZIP
+if test -n "$GZIP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GZIP" >&5
+$as_echo "$GZIP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
 
-# Allows building of shared libraries
 
+	# Extract the first word of "bzip2", so it can be a program name with args.
+set dummy bzip2; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_BZIP2+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $BZIP2 in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_BZIP2="$BZIP2" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_BZIP2="$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
+BZIP2=$ac_cv_path_BZIP2
+if test -n "$BZIP2"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BZIP2" >&5
+$as_echo "$BZIP2" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+
+	mp_tarball="vendor/tclx${tclx_version}.tar.bz2"
+	ac_dir=vendor/tclx8.4
+
+	mp_popdir=$(pwd)
+	if ! test -d "$ac_dir"; then
+		mp_tarball_vendordir="$(dirname "$mp_tarball")"
+		as_dir="$mp_tarball_vendordir"; as_fn_mkdir_p
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: === extracting $mp_tarball" >&5
+$as_echo "$as_me: === extracting $mp_tarball" >&6;}
+		mp_tarball_extract_cmd=
+		case "$mp_tarball" in
+			*.tar.gz | *.tgz)
+				if test "x$GZIP" = "x"; then
+					as_fn_error $? "gzip not found" "$LINENO" 5
+				fi
+				mp_tarball_extract_cmd="$GZIP"
+				;;
+			*.tar.bz2 | *.tbz2)
+				if test "x$BZIP2" = "x"; then
+					as_fn_error $? "bzip2 not found" "$LINENO" 5
+				fi
+				mp_tarball_extract_cmd="$BZIP2"
+				;;
+			*)
+				as_fn_error $? "Don't know how to extract tarball $mp_tarball" "$LINENO" 5
+				;;
+		esac
+		(cd "$mp_tarball_vendordir"; umask 0022; "$mp_tarball_extract_cmd" -d < "$ac_abs_confdir/$mp_tarball" | tar xf - || as_fn_error $? "failed to extract $mp_tarball" "$LINENO" 5)
+	fi
+	if ! test -d "$ac_dir"; then
+		as_fn_error $? "tarball $mp_tarball did not extract to $ac_dir" "$LINENO" 5
+	fi
+
+	as_dir="$ac_dir"; as_fn_mkdir_p
+	ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+  ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
+  # A ".." for each directory in $ac_dir_suffix.
+  ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
+  case $ac_top_builddir_sub in
+  "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+  *)  ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+  esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+  .)  # We are building in place.
+    ac_srcdir=.
+    ac_top_srcdir=$ac_top_builddir_sub
+    ac_abs_top_srcdir=$ac_pwd ;;
+  [\\/]* | ?:[\\/]* )  # Absolute name.
+    ac_srcdir=$srcdir$ac_dir_suffix;
+    ac_top_srcdir=$srcdir
+    ac_abs_top_srcdir=$srcdir ;;
+  *) # Relative name.
+    ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_build_prefix$srcdir
+    ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+	cd "$ac_dir"
+
+	if test "$no_recursion" != yes || test ! -f "$ac_srcdir/config.status"; then
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: === configuring in $ac_dir ($mp_popdir/$ac_dir)" >&5
+$as_echo "$as_me: === configuring in $ac_dir ($mp_popdir/$ac_dir)" >&6;}
+		if test -f "$ac_srcdir/configure"; then
+			mp_sub_configure_args=
+			mp_sub_configure_keys=
+			# Compile a list of keys that have been given to the MP_CONFIG_TARBALL
+			# macro; we want to skip copying those parameters from the original
+			# configure invocation.
+			for mp_arg in --prefix=${macports_libexec_dir}; do
+				case $mp_arg in
+					--*=* | -*=*)
+							mp_arg_key=$($as_echo "$mp_arg" | sed -E 's/^--?([^=]+)=.*$/\1/')
+								case $mp_arg_key in
+		*\'*)
+			mp_arg_key=$($as_echo "$mp_arg_key" | sed "s/'/'\\\\\\\\''/g")
+		;;
+	esac
+	mp_arg_key="'$mp_arg_key'"
+	as_fn_append mp_sub_configure_keys " $mp_arg_key"
+
+					;;
+				esac
+						case $mp_arg in
+		*\'*)
+			mp_arg=$($as_echo "$mp_arg" | sed "s/'/'\\\\\\\\''/g")
+		;;
+	esac
+	mp_arg="'$mp_arg'"
+	as_fn_append mp_sub_configure_args " $mp_arg"
+
+			done
+			# Walk the list of arguments given to the original configure script;
+			# filter out a few common ones we likely would not want to pass along,
+			# add --disable-option-checking and filter those already given as
+			# argument to MP_CONFIG_TARBALL.
+			# Most of this code is adapted from _AC_OUTPUT_SUBDIRS in
+			# $prefix/share/autoconf/autoconf/status.m4.
+			mp_prev=
+			eval "set x $ac_configure_args"
+			shift
+			for mp_arg; do
+				if test -n "$mp_prev"; then
+					mp_prev=
+					continue
+				fi
+				case $mp_arg in
+					  -cache-file \
+					| --cache-file \
+					| --cache-fil \
+					| --cache-fi \
+					| --cache-f \
+					| --cache- \
+					| --cache \
+					| --cach \
+					| --cac \
+					| --ca \
+					| --c)
+						mp_prev=cache_file
+					;;
+					  -cache-file=* \
+					| --cache-file=* \
+					| --cache-fil=* \
+					| --cache-fi=* \
+					| --cache-f=* \
+					| --cache-=* \
+					| --cache=* \
+					| --cach=* \
+					| --cac=* \
+					| --ca=* \
+					| --c=*)
+						# ignore --cache-file
+					;;
+					  --config-cache \
+					| -C)
+						# ignore -C
+					;;
+					  -srcdir \
+					| --srcdir \
+					| -srcdi \
+					| -srcd \
+					| -src \
+					| -sr)
+						mp_prev=srcdir
+					;;
+					  -srcdir=* \
+					| --srcdir=* \
+					| --srcdi=* \
+					| --srcd=* \
+					| --src=* \
+					| --sr=*)
+						# ignore --srcdir
+					;;
+					  -prefix \
+					| --prefix \
+					| --prefi \
+					| --pref \
+					| --pre \
+					| --pr \
+					| --p)
+						mp_prev=prefix
+					;;
+					  -prefix=* \
+					| --prefix=* \
+					| --prefi=* \
+					| --pref=* \
+					| --pre=* \
+					| --pr=* \
+					| --p=*)
+						# ignore --prefix
+					;;
+					--disable-option-checking)
+						# ignore --disable-option-checking
+					;;
+					--*=* | -*=*)
+							mp_arg_key=$($as_echo "$mp_arg" | sed -E 's/^--?([^=]+)=.*$/\1/')
+							mp_list_contains_present=
+	eval "mp_list_contains_list=\"$mp_sub_configure_keys\""
+	for mp_list_contains_entry in $mp_list_contains_list; do
+		test -z "$mp_list_contains_entry" && continue
+		if test "x$mp_arg_key" = "x$mp_list_contains_entry"; then
+			mp_list_contains_present=1
+			break
+		fi
+	done
+	if test "x$mp_list_contains_present" = "x"; then
+		:
+		else
+									case $mp_arg in
+		*\'*)
+			mp_arg=$($as_echo "$mp_arg" | sed "s/'/'\\\\\\\\''/g")
+		;;
+	esac
+	mp_arg="'$mp_arg'"
+	as_fn_append mp_sub_configure_args " $mp_arg"
+
+
+	fi
+
+					;;
+					*)
+						# always pass positional arguments
+								case $mp_arg in
+		*\'*)
+			mp_arg=$($as_echo "$mp_arg" | sed "s/'/'\\\\\\\\''/g")
+		;;
+	esac
+	mp_arg="'$mp_arg'"
+	as_fn_append mp_sub_configure_args " $mp_arg"
+
+					;;
+				esac
+			done
+
+			# Now prepend some arguments that should always be present unless
+			# overriden, such as --prefix, --silent, --disable-option-checking,
+			# --cache-file, --srcdir
+			# Pass --prefix unless already given
+			mp_arg_key=prefix
+				mp_list_contains_present=
+	eval "mp_list_contains_list=\"$mp_sub_configure_args\""
+	for mp_list_contains_entry in $mp_list_contains_list; do
+		test -z "$mp_list_contains_entry" && continue
+		if test "x$mp_arg_key" = "x$mp_list_contains_entry"; then
+			mp_list_contains_present=1
+			break
+		fi
+	done
+	if test "x$mp_list_contains_present" = "x"; then
+		:
+		else
+				mp_arg="--prefix=$prefix"
+						case $mp_arg in
+		*\'*)
+			mp_arg=$($as_echo "$mp_arg" | sed "s/'/'\\\\\\\\''/g")
+		;;
+	esac
+	mp_arg="'$mp_arg'"
+			mp_fn_var_prepend mp_sub_configure_args "$mp_arg "
+
+
+
+	fi
+
+
+			# Pass --silent
+			if test "$silent" = yes; then
+				mp_arg="--silent"
+						case $mp_arg in
+		*\'*)
+			mp_arg=$($as_echo "$mp_arg" | sed "s/'/'\\\\\\\\''/g")
+		;;
+	esac
+	mp_arg="'$mp_arg'"
+			mp_fn_var_prepend mp_sub_configure_args "$mp_arg "
+
+
+			fi
+
+			# Always prepend --disable-option-checking to silence warnings, since
+			# different subdirs can have different --enable and --with options.
+			mp_arg="--disable-option-checking"
+					case $mp_arg in
+		*\'*)
+			mp_arg=$($as_echo "$mp_arg" | sed "s/'/'\\\\\\\\''/g")
+		;;
+	esac
+	mp_arg="'$mp_arg'"
+			mp_fn_var_prepend mp_sub_configure_args "$mp_arg "
+
+
+
+			# Make the cache file name correct relative to the subdirectory.
+			case $cache_file in
+				[\\/]* | ?:[\\/]* )
+					mp_sub_cache_file=$cache_file
+				;;
+				*) # Relative name.
+					mp_sub_cache_file=$ac_top_build_prefix$cache_file
+				;;
+			esac
+			mp_arg="--cache-file=$mp_sub_cache_file"
+					case $mp_arg in
+		*\'*)
+			mp_arg=$($as_echo "$mp_arg" | sed "s/'/'\\\\\\\\''/g")
+		;;
+	esac
+	mp_arg="'$mp_arg'"
+			mp_fn_var_prepend mp_sub_configure_args "$mp_arg "
+
+
+
+			mp_arg="--srcdir=$ac_srcdir"
+					case $mp_arg in
+		*\'*)
+			mp_arg=$($as_echo "$mp_arg" | sed "s/'/'\\\\\\\\''/g")
+		;;
+	esac
+	mp_arg="'$mp_arg'"
+	as_fn_append mp_sub_configure_args " $mp_arg"
+
+
+			{ $as_echo "$as_me:${as_lineno-$LINENO}: running $SHELL $ac_srcdir/configure $mp_sub_configure_args in $ac_dir" >&5
+$as_echo "$as_me: running $SHELL $ac_srcdir/configure $mp_sub_configure_args in $ac_dir" >&6;}
+			eval "\$SHELL \$ac_srcdir/configure $mp_sub_configure_args" || as_fn_error $? "configure failed for $ac_dir" "$LINENO" 5
+		else
+			as_fn_error $? "no configure script found in $ac_dir" "$LINENO" 5
+		fi
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: === finished configuring in $ac_dir ($mp_popdir/$ac_dir)" >&5
+$as_echo "$as_me: === finished configuring in $ac_dir ($mp_popdir/$ac_dir)" >&6;}
+	fi
+	cd "$mp_popdir"
+
+VENDOR_TCLX_SUBDIR=tclx8.4
+VENDOR_TCLX_INSTALL="install-binaries install-libraries"
+
+
+
+## Tcllib package
+# Note that Tcllib needs a Tcl interpreter during installation; it will *not*
+# be the one we configure above, because that one isn't built yet. That's not
+# a problem, though -- it's only used during installation.
+
+	# Extract the first word of "gzip", so it can be a program name with args.
+set dummy gzip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_GZIP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $GZIP in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_GZIP="$GZIP" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_GZIP="$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
+GZIP=$ac_cv_path_GZIP
+if test -n "$GZIP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GZIP" >&5
+$as_echo "$GZIP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+	# Extract the first word of "bzip2", so it can be a program name with args.
+set dummy bzip2; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_BZIP2+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $BZIP2 in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_BZIP2="$BZIP2" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_BZIP2="$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
+BZIP2=$ac_cv_path_BZIP2
+if test -n "$BZIP2"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BZIP2" >&5
+$as_echo "$BZIP2" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+
+	mp_tarball="vendor/tcllib-${tcllib_version}.tar.gz"
+	ac_dir=vendor/tcllib-${tcllib_version}
+
+	mp_popdir=$(pwd)
+	if ! test -d "$ac_dir"; then
+		mp_tarball_vendordir="$(dirname "$mp_tarball")"
+		as_dir="$mp_tarball_vendordir"; as_fn_mkdir_p
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: === extracting $mp_tarball" >&5
+$as_echo "$as_me: === extracting $mp_tarball" >&6;}
+		mp_tarball_extract_cmd=
+		case "$mp_tarball" in
+			*.tar.gz | *.tgz)
+				if test "x$GZIP" = "x"; then
+					as_fn_error $? "gzip not found" "$LINENO" 5
+				fi
+				mp_tarball_extract_cmd="$GZIP"
+				;;
+			*.tar.bz2 | *.tbz2)
+				if test "x$BZIP2" = "x"; then
+					as_fn_error $? "bzip2 not found" "$LINENO" 5
+				fi
+				mp_tarball_extract_cmd="$BZIP2"
+				;;
+			*)
+				as_fn_error $? "Don't know how to extract tarball $mp_tarball" "$LINENO" 5
+				;;
+		esac
+		(cd "$mp_tarball_vendordir"; umask 0022; "$mp_tarball_extract_cmd" -d < "$ac_abs_confdir/$mp_tarball" | tar xf - || as_fn_error $? "failed to extract $mp_tarball" "$LINENO" 5)
+	fi
+	if ! test -d "$ac_dir"; then
+		as_fn_error $? "tarball $mp_tarball did not extract to $ac_dir" "$LINENO" 5
+	fi
+
+	as_dir="$ac_dir"; as_fn_mkdir_p
+	ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+  ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
+  # A ".." for each directory in $ac_dir_suffix.
+  ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
+  case $ac_top_builddir_sub in
+  "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+  *)  ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+  esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+  .)  # We are building in place.
+    ac_srcdir=.
+    ac_top_srcdir=$ac_top_builddir_sub
+    ac_abs_top_srcdir=$ac_pwd ;;
+  [\\/]* | ?:[\\/]* )  # Absolute name.
+    ac_srcdir=$srcdir$ac_dir_suffix;
+    ac_top_srcdir=$srcdir
+    ac_abs_top_srcdir=$srcdir ;;
+  *) # Relative name.
+    ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_build_prefix$srcdir
+    ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+	cd "$ac_dir"
+
+	if test "$no_recursion" != yes || test ! -f "$ac_srcdir/config.status"; then
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: === configuring in $ac_dir ($mp_popdir/$ac_dir)" >&5
+$as_echo "$as_me: === configuring in $ac_dir ($mp_popdir/$ac_dir)" >&6;}
+		if test -f "$ac_srcdir/configure"; then
+			mp_sub_configure_args=
+			mp_sub_configure_keys=
+			# Compile a list of keys that have been given to the MP_CONFIG_TARBALL
+			# macro; we want to skip copying those parameters from the original
+			# configure invocation.
+			for mp_arg in --prefix=${macports_libexec_dir}; do
+				case $mp_arg in
+					--*=* | -*=*)
+							mp_arg_key=$($as_echo "$mp_arg" | sed -E 's/^--?([^=]+)=.*$/\1/')
+								case $mp_arg_key in
+		*\'*)
+			mp_arg_key=$($as_echo "$mp_arg_key" | sed "s/'/'\\\\\\\\''/g")
+		;;
+	esac
+	mp_arg_key="'$mp_arg_key'"
+	as_fn_append mp_sub_configure_keys " $mp_arg_key"
+
+					;;
+				esac
+						case $mp_arg in
+		*\'*)
+			mp_arg=$($as_echo "$mp_arg" | sed "s/'/'\\\\\\\\''/g")
+		;;
+	esac
+	mp_arg="'$mp_arg'"
+	as_fn_append mp_sub_configure_args " $mp_arg"
+
+			done
+			# Walk the list of arguments given to the original configure script;
+			# filter out a few common ones we likely would not want to pass along,
+			# add --disable-option-checking and filter those already given as
+			# argument to MP_CONFIG_TARBALL.
+			# Most of this code is adapted from _AC_OUTPUT_SUBDIRS in
+			# $prefix/share/autoconf/autoconf/status.m4.
+			mp_prev=
+			eval "set x $ac_configure_args"
+			shift
+			for mp_arg; do
+				if test -n "$mp_prev"; then
+					mp_prev=
+					continue
+				fi
+				case $mp_arg in
+					  -cache-file \
+					| --cache-file \
+					| --cache-fil \
+					| --cache-fi \
+					| --cache-f \
+					| --cache- \
+					| --cache \
+					| --cach \
+					| --cac \
+					| --ca \
+					| --c)
+						mp_prev=cache_file
+					;;
+					  -cache-file=* \
+					| --cache-file=* \
+					| --cache-fil=* \
+					| --cache-fi=* \
+					| --cache-f=* \
+					| --cache-=* \
+					| --cache=* \
+					| --cach=* \
+					| --cac=* \
+					| --ca=* \
+					| --c=*)
+						# ignore --cache-file
+					;;
+					  --config-cache \
+					| -C)
+						# ignore -C
+					;;
+					  -srcdir \
+					| --srcdir \
+					| -srcdi \
+					| -srcd \
+					| -src \
+					| -sr)
+						mp_prev=srcdir
+					;;
+					  -srcdir=* \
+					| --srcdir=* \
+					| --srcdi=* \
+					| --srcd=* \
+					| --src=* \
+					| --sr=*)
+						# ignore --srcdir
+					;;
+					  -prefix \
+					| --prefix \
+					| --prefi \
+					| --pref \
+					| --pre \
+					| --pr \
+					| --p)
+						mp_prev=prefix
+					;;
+					  -prefix=* \
+					| --prefix=* \
+					| --prefi=* \
+					| --pref=* \
+					| --pre=* \
+					| --pr=* \
+					| --p=*)
+						# ignore --prefix
+					;;
+					--disable-option-checking)
+						# ignore --disable-option-checking
+					;;
+					--*=* | -*=*)
+							mp_arg_key=$($as_echo "$mp_arg" | sed -E 's/^--?([^=]+)=.*$/\1/')
+							mp_list_contains_present=
+	eval "mp_list_contains_list=\"$mp_sub_configure_keys\""
+	for mp_list_contains_entry in $mp_list_contains_list; do
+		test -z "$mp_list_contains_entry" && continue
+		if test "x$mp_arg_key" = "x$mp_list_contains_entry"; then
+			mp_list_contains_present=1
+			break
+		fi
+	done
+	if test "x$mp_list_contains_present" = "x"; then
+		:
+		else
+									case $mp_arg in
+		*\'*)
+			mp_arg=$($as_echo "$mp_arg" | sed "s/'/'\\\\\\\\''/g")
+		;;
+	esac
+	mp_arg="'$mp_arg'"
+	as_fn_append mp_sub_configure_args " $mp_arg"
+
+
+	fi
+
+					;;
+					*)
+						# always pass positional arguments
+								case $mp_arg in
+		*\'*)
+			mp_arg=$($as_echo "$mp_arg" | sed "s/'/'\\\\\\\\''/g")
+		;;
+	esac
+	mp_arg="'$mp_arg'"
+	as_fn_append mp_sub_configure_args " $mp_arg"
+
+					;;
+				esac
+			done
+
+			# Now prepend some arguments that should always be present unless
+			# overriden, such as --prefix, --silent, --disable-option-checking,
+			# --cache-file, --srcdir
+			# Pass --prefix unless already given
+			mp_arg_key=prefix
+				mp_list_contains_present=
+	eval "mp_list_contains_list=\"$mp_sub_configure_args\""
+	for mp_list_contains_entry in $mp_list_contains_list; do
+		test -z "$mp_list_contains_entry" && continue
+		if test "x$mp_arg_key" = "x$mp_list_contains_entry"; then
+			mp_list_contains_present=1
+			break
+		fi
+	done
+	if test "x$mp_list_contains_present" = "x"; then
+		:
+		else
+				mp_arg="--prefix=$prefix"
+						case $mp_arg in
+		*\'*)
+			mp_arg=$($as_echo "$mp_arg" | sed "s/'/'\\\\\\\\''/g")
+		;;
+	esac
+	mp_arg="'$mp_arg'"
+			mp_fn_var_prepend mp_sub_configure_args "$mp_arg "
+
+
+
+	fi
+
+
+			# Pass --silent
+			if test "$silent" = yes; then
+				mp_arg="--silent"
+						case $mp_arg in
+		*\'*)
+			mp_arg=$($as_echo "$mp_arg" | sed "s/'/'\\\\\\\\''/g")
+		;;
+	esac
+	mp_arg="'$mp_arg'"
+			mp_fn_var_prepend mp_sub_configure_args "$mp_arg "
+
+
+			fi
+
+			# Always prepend --disable-option-checking to silence warnings, since
+			# different subdirs can have different --enable and --with options.
+			mp_arg="--disable-option-checking"
+					case $mp_arg in
+		*\'*)
+			mp_arg=$($as_echo "$mp_arg" | sed "s/'/'\\\\\\\\''/g")
+		;;
+	esac
+	mp_arg="'$mp_arg'"
+			mp_fn_var_prepend mp_sub_configure_args "$mp_arg "
+
+
+
+			# Make the cache file name correct relative to the subdirectory.
+			case $cache_file in
+				[\\/]* | ?:[\\/]* )
+					mp_sub_cache_file=$cache_file
+				;;
+				*) # Relative name.
+					mp_sub_cache_file=$ac_top_build_prefix$cache_file
+				;;
+			esac
+			mp_arg="--cache-file=$mp_sub_cache_file"
+					case $mp_arg in
+		*\'*)
+			mp_arg=$($as_echo "$mp_arg" | sed "s/'/'\\\\\\\\''/g")
+		;;
+	esac
+	mp_arg="'$mp_arg'"
+			mp_fn_var_prepend mp_sub_configure_args "$mp_arg "
+
+
+
+			mp_arg="--srcdir=$ac_srcdir"
+					case $mp_arg in
+		*\'*)
+			mp_arg=$($as_echo "$mp_arg" | sed "s/'/'\\\\\\\\''/g")
+		;;
+	esac
+	mp_arg="'$mp_arg'"
+	as_fn_append mp_sub_configure_args " $mp_arg"
+
+
+			{ $as_echo "$as_me:${as_lineno-$LINENO}: running $SHELL $ac_srcdir/configure $mp_sub_configure_args in $ac_dir" >&5
+$as_echo "$as_me: running $SHELL $ac_srcdir/configure $mp_sub_configure_args in $ac_dir" >&6;}
+			eval "\$SHELL \$ac_srcdir/configure $mp_sub_configure_args" || as_fn_error $? "configure failed for $ac_dir" "$LINENO" 5
+		else
+			as_fn_error $? "no configure script found in $ac_dir" "$LINENO" 5
+		fi
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: === finished configuring in $ac_dir ($mp_popdir/$ac_dir)" >&5
+$as_echo "$as_me: === finished configuring in $ac_dir ($mp_popdir/$ac_dir)" >&6;}
+	fi
+	cd "$mp_popdir"
+
+VENDOR_TCLLIB_SUBDIR=tcllib-${tcllib_version}
+VENDOR_TCLLIB_INSTALL="install-libraries"
+
+
+
+# Load tclConfig.sh from our private install of Tcl
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Tcl configuration" >&5
+$as_echo_n "checking for Tcl configuration... " >&6; }
+TCL_BIN_DIR=`(cd vendor/tcl${tcl_version}/unix; pwd)`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: found $TCL_BIN_DIR/tclConfig.sh" >&5
+$as_echo "found $TCL_BIN_DIR/tclConfig.sh" >&6; }
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for existence of $TCL_BIN_DIR/tclConfig.sh" >&5
+$as_echo_n "checking for existence of $TCL_BIN_DIR/tclConfig.sh... " >&6; }
+
+    if test -f "$TCL_BIN_DIR/tclConfig.sh" ; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: loading" >&5
+$as_echo "loading" >&6; }
+	. $TCL_BIN_DIR/tclConfig.sh
+    else
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: file not found" >&5
+$as_echo "file not found" >&6; }
+    fi
+
+    #
+    # If the TCL_BIN_DIR is the build directory (not the install directory),
+    # then set the common variable name to the value of the build variables.
+    # For example, the variable TCL_LIB_SPEC will be set to the value
+    # of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC
+    # instead of TCL_BUILD_LIB_SPEC since it will work with both an
+    # installed and uninstalled version of Tcl.
+    #
+
+    if test -f $TCL_BIN_DIR/Makefile ; then
+        TCL_LIB_SPEC=${TCL_BUILD_LIB_SPEC}
+        TCL_STUB_LIB_SPEC=${TCL_BUILD_STUB_LIB_SPEC}
+        TCL_STUB_LIB_PATH=${TCL_BUILD_STUB_LIB_PATH}
+    fi
+
+    #
+    # eval is required to do the TCL_DBGX substitution
+    #
+
+    eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\""
+    eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\""
+    eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\""
+
+    eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\""
+    eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\""
+    eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\""
+
+
+
+
+
+
+
+
+
+
+
+
+
+
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to build libraries" >&5
 $as_echo_n "checking how to build libraries... " >&6; }
     # Check whether --enable-shared was given.
@@ -9986,13 +11384,15 @@
     fi
 
 
-# Pull compiler / linker values from tclConfig.sh
-LDFLAGS_DEBUG=${TCL_LDFLAGS_DEBUG}
-LDFLAGS_OPTIMIZE=${TCL_LDFLAGS_OPTIMIZE}
+# Pull compiler/linker values from tclConfig.sh
 SHLIB_LD=${TCL_SHLIB_LD}
 STLIB_LD=${TCL_STLIB_LD}
 SHLIB_CFLAGS=${TCL_SHLIB_CFLAGS}
 SHLIB_SUFFIX=${TCL_SHLIB_SUFFIX}
+TCLSH=${TCL_EXEC_PREFIX}/bin/tclsh${TCL_VERSION}
+INTREE_TCLSH=${TCL_BIN_DIR}/tclsh
+# strip possible whitespace at the end of TCL_PACKAGE_PATH
+eval "TCL_PACKAGE_PATH=${TCL_PACKAGE_PATH}"
 
 
 
@@ -10005,13 +11405,10 @@
 
 
 
-# misc variables that need to be expanded for substitution into tcl
 
-oldprefix=$prefix
-if test "x$prefix" = "xNONE" ; then
-   prefix=$ac_default_prefix
-fi
+INCLUDES="-I.. -I. $INCLUDES"
 
+
 # Check if there's an existing DP/MP install too old to upgrade
 
 
@@ -10028,29 +11425,19 @@
 
 
 
-eval "prefix_expanded=$prefix"
+# Output
+ac_config_files="$ac_config_files Doxyfile Makefile Mk/macports.autoconf.mk doc/Makefile doc/base.mtree doc/macosx.mtree doc/macports.conf doc/prefix.mtree doc/pubkeys.conf portmgr/freebsd/Makefile portmgr/dmg/postflight setupenv.bash src/Makefile src/cregistry/Makefile src/darwintracelib1.0/Makefile src/machista1.0/Makefile src/macports1.0/Makefile src/macports1.0/macports_autoconf.tcl src/macports1.0/macports_test_autoconf.tcl src/package1.0/Makefile src/package1.0/package_test_autoconf.tcl src/pextlib1.0/Makefile src/port/Makefile src/port1.0/Makefile src/port1.0/port_autoconf.tcl src/port1.0/port_test_autoconf.tcl src/programs/Makefile src/registry2.0/Makefile src/registry2.0/registry_autoconf.tcl tests/Makefile tests/test.tcl tests/test/library.tcl tests/test/trace/test.tcl vendor/Makefile"
 
-# do this twice, since there is a nested variable of
-# ${prefix} inside of ${sysconfdir}
-eval "MPCONFIGDIR_EXPANDED=$MPCONFIGDIR"
-eval "MPCONFIGDIR_EXPANDED=$MPCONFIGDIR_EXPANDED"
 
-eval "localstatedir_expanded=$localstatedir"
+ac_config_files="$ac_config_files src/dedup_portfiles.tcl"
 
-eval "macports_tcl_dir=${datadir}/macports/Tcl"
-eval "macports_tcl_dir=$macports_tcl_dir"
+ac_config_files="$ac_config_files src/images_to_archives.tcl"
 
+ac_config_files="$ac_config_files src/pkg_mkindex.sh"
 
-prefix=$oldprefix
+ac_config_files="$ac_config_files src/upgrade_sources_conf_default.tcl"
 
 
-# Output
-ac_config_files="$ac_config_files Doxyfile Makefile Mk/macports.autoconf.mk doc/base.mtree doc/macosx.mtree doc/macports.conf doc/prefix.mtree doc/pubkeys.conf portmgr/freebsd/Makefile setupenv.bash src/Makefile src/machista1.0/Makefile src/macports1.0/macports_autoconf.tcl src/macports1.0/macports_test_autoconf.tcl src/macports1.0/macports_fastload.tcl src/package1.0/package_test_autoconf.tcl src/pextlib1.0/Makefile src/port1.0/port_autoconf.tcl src/port1.0/port_test_autoconf.tcl src/programs/Makefile src/registry2.0/registry_autoconf.tcl"
-
-
-ac_config_files="$ac_config_files src/pkg_mkindex.sh"
-
-
 cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure
 # tests run on this system so they can be shared between configure
@@ -10557,7 +11944,7 @@
 # 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 2.2.99, which was
+This file was extended by MacPorts $as_me 2.3.99, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -10619,7 +12006,7 @@
 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 2.2.99
+MacPorts config.status 2.3.99
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
@@ -10746,25 +12133,41 @@
     "Doxyfile") CONFIG_FILES="$CONFIG_FILES Doxyfile" ;;
     "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
     "Mk/macports.autoconf.mk") CONFIG_FILES="$CONFIG_FILES Mk/macports.autoconf.mk" ;;
+    "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;;
     "doc/base.mtree") CONFIG_FILES="$CONFIG_FILES doc/base.mtree" ;;
     "doc/macosx.mtree") CONFIG_FILES="$CONFIG_FILES doc/macosx.mtree" ;;
     "doc/macports.conf") CONFIG_FILES="$CONFIG_FILES doc/macports.conf" ;;
     "doc/prefix.mtree") CONFIG_FILES="$CONFIG_FILES doc/prefix.mtree" ;;
     "doc/pubkeys.conf") CONFIG_FILES="$CONFIG_FILES doc/pubkeys.conf" ;;
     "portmgr/freebsd/Makefile") CONFIG_FILES="$CONFIG_FILES portmgr/freebsd/Makefile" ;;
+    "portmgr/dmg/postflight") CONFIG_FILES="$CONFIG_FILES portmgr/dmg/postflight" ;;
     "setupenv.bash") CONFIG_FILES="$CONFIG_FILES setupenv.bash" ;;
     "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
+    "src/cregistry/Makefile") CONFIG_FILES="$CONFIG_FILES src/cregistry/Makefile" ;;
+    "src/darwintracelib1.0/Makefile") CONFIG_FILES="$CONFIG_FILES src/darwintracelib1.0/Makefile" ;;
     "src/machista1.0/Makefile") CONFIG_FILES="$CONFIG_FILES src/machista1.0/Makefile" ;;
+    "src/macports1.0/Makefile") CONFIG_FILES="$CONFIG_FILES src/macports1.0/Makefile" ;;
     "src/macports1.0/macports_autoconf.tcl") CONFIG_FILES="$CONFIG_FILES src/macports1.0/macports_autoconf.tcl" ;;
     "src/macports1.0/macports_test_autoconf.tcl") CONFIG_FILES="$CONFIG_FILES src/macports1.0/macports_test_autoconf.tcl" ;;
-    "src/macports1.0/macports_fastload.tcl") CONFIG_FILES="$CONFIG_FILES src/macports1.0/macports_fastload.tcl" ;;
+    "src/package1.0/Makefile") CONFIG_FILES="$CONFIG_FILES src/package1.0/Makefile" ;;
     "src/package1.0/package_test_autoconf.tcl") CONFIG_FILES="$CONFIG_FILES src/package1.0/package_test_autoconf.tcl" ;;
     "src/pextlib1.0/Makefile") CONFIG_FILES="$CONFIG_FILES src/pextlib1.0/Makefile" ;;
+    "src/port/Makefile") CONFIG_FILES="$CONFIG_FILES src/port/Makefile" ;;
+    "src/port1.0/Makefile") CONFIG_FILES="$CONFIG_FILES src/port1.0/Makefile" ;;
     "src/port1.0/port_autoconf.tcl") CONFIG_FILES="$CONFIG_FILES src/port1.0/port_autoconf.tcl" ;;
     "src/port1.0/port_test_autoconf.tcl") CONFIG_FILES="$CONFIG_FILES src/port1.0/port_test_autoconf.tcl" ;;
     "src/programs/Makefile") CONFIG_FILES="$CONFIG_FILES src/programs/Makefile" ;;
+    "src/registry2.0/Makefile") CONFIG_FILES="$CONFIG_FILES src/registry2.0/Makefile" ;;
     "src/registry2.0/registry_autoconf.tcl") CONFIG_FILES="$CONFIG_FILES src/registry2.0/registry_autoconf.tcl" ;;
+    "tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;;
+    "tests/test.tcl") CONFIG_FILES="$CONFIG_FILES tests/test.tcl" ;;
+    "tests/test/library.tcl") CONFIG_FILES="$CONFIG_FILES tests/test/library.tcl" ;;
+    "tests/test/trace/test.tcl") CONFIG_FILES="$CONFIG_FILES tests/test/trace/test.tcl" ;;
+    "vendor/Makefile") CONFIG_FILES="$CONFIG_FILES vendor/Makefile" ;;
+    "src/dedup_portfiles.tcl") CONFIG_FILES="$CONFIG_FILES src/dedup_portfiles.tcl" ;;
+    "src/images_to_archives.tcl") CONFIG_FILES="$CONFIG_FILES src/images_to_archives.tcl" ;;
     "src/pkg_mkindex.sh") CONFIG_FILES="$CONFIG_FILES src/pkg_mkindex.sh" ;;
+    "src/upgrade_sources_conf_default.tcl") CONFIG_FILES="$CONFIG_FILES src/upgrade_sources_conf_default.tcl" ;;
 
   *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
   esac
@@ -11317,7 +12720,10 @@
 
 
   case $ac_file$ac_mode in
+    "src/dedup_portfiles.tcl":F) chmod +x src/dedup_portfiles.tcl ;;
+    "src/images_to_archives.tcl":F) chmod +x src/images_to_archives.tcl ;;
     "src/pkg_mkindex.sh":F) chmod +x src/pkg_mkindex.sh ;;
+    "src/upgrade_sources_conf_default.tcl":F) chmod +x src/upgrade_sources_conf_default.tcl ;;
 
   esac
 done # for ac_tag
@@ -11351,151 +12757,6 @@
   # would make configure fail if this is the last instruction.
   $ac_cs_success || as_fn_exit 1
 fi
-
-#
-# CONFIG_SUBDIRS section.
-#
-if test "$no_recursion" != yes; then
-
-  # Remove --cache-file, --srcdir, and --disable-option-checking arguments
-  # so they do not pile up.
-  ac_sub_configure_args=
-  ac_prev=
-  eval "set x $ac_configure_args"
-  shift
-  for ac_arg
-  do
-    if test -n "$ac_prev"; then
-      ac_prev=
-      continue
-    fi
-    case $ac_arg in
-    -cache-file | --cache-file | --cache-fil | --cache-fi \
-    | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
-      ac_prev=cache_file ;;
-    -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
-    | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* \
-    | --c=*)
-      ;;
-    --config-cache | -C)
-      ;;
-    -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
-      ac_prev=srcdir ;;
-    -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
-      ;;
-    -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
-      ac_prev=prefix ;;
-    -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
-      ;;
-    --disable-option-checking)
-      ;;
-    *)
-      case $ac_arg in
-      *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
-      esac
-      as_fn_append ac_sub_configure_args " '$ac_arg'" ;;
-    esac
-  done
-
-  # Always prepend --prefix to ensure using the same prefix
-  # in subdir configurations.
-  ac_arg="--prefix=$prefix"
-  case $ac_arg in
-  *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
-  esac
-  ac_sub_configure_args="'$ac_arg' $ac_sub_configure_args"
-
-  # Pass --silent
-  if test "$silent" = yes; then
-    ac_sub_configure_args="--silent $ac_sub_configure_args"
-  fi
-
-  # Always prepend --disable-option-checking to silence warnings, since
-  # different subdirs can have different --enable and --with options.
-  ac_sub_configure_args="--disable-option-checking $ac_sub_configure_args"
-
-  ac_popdir=`pwd`
-  for ac_dir in : $subdirs; do test "x$ac_dir" = x: && continue
-
-    # Do not complain, so a configure script can configure whichever
-    # parts of a large source tree are present.
-    test -d "$srcdir/$ac_dir" || continue
-
-    ac_msg="=== configuring in $ac_dir (`pwd`/$ac_dir)"
-    $as_echo "$as_me:${as_lineno-$LINENO}: $ac_msg" >&5
-    $as_echo "$ac_msg" >&6
-    as_dir="$ac_dir"; as_fn_mkdir_p
-    ac_builddir=.
-
-case "$ac_dir" in
-.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
-*)
-  ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
-  # A ".." for each directory in $ac_dir_suffix.
-  ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
-  case $ac_top_builddir_sub in
-  "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
-  *)  ac_top_build_prefix=$ac_top_builddir_sub/ ;;
-  esac ;;
-esac
-ac_abs_top_builddir=$ac_pwd
-ac_abs_builddir=$ac_pwd$ac_dir_suffix
-# for backward compatibility:
-ac_top_builddir=$ac_top_build_prefix
-
-case $srcdir in
-  .)  # We are building in place.
-    ac_srcdir=.
-    ac_top_srcdir=$ac_top_builddir_sub
-    ac_abs_top_srcdir=$ac_pwd ;;
-  [\\/]* | ?:[\\/]* )  # Absolute name.
-    ac_srcdir=$srcdir$ac_dir_suffix;
-    ac_top_srcdir=$srcdir
-    ac_abs_top_srcdir=$srcdir ;;
-  *) # Relative name.
-    ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
-    ac_top_srcdir=$ac_top_build_prefix$srcdir
-    ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
-esac
-ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
-
-
-    cd "$ac_dir"
-
-    # Check for guested configure; otherwise get Cygnus style configure.
-    if test -f "$ac_srcdir/configure.gnu"; then
-      ac_sub_configure=$ac_srcdir/configure.gnu
-    elif test -f "$ac_srcdir/configure"; then
-      ac_sub_configure=$ac_srcdir/configure
-    elif test -f "$ac_srcdir/configure.in"; then
-      # This should be Cygnus configure.
-      ac_sub_configure=$ac_aux_dir/configure
-    else
-      { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: no configuration information is in $ac_dir" >&5
-$as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2;}
-      ac_sub_configure=
-    fi
-
-    # The recursion is here.
-    if test -n "$ac_sub_configure"; then
-      # Make the cache file name correct relative to the subdirectory.
-      case $cache_file in
-      [\\/]* | ?:[\\/]* ) ac_sub_cache_file=$cache_file ;;
-      *) # Relative name.
-	ac_sub_cache_file=$ac_top_build_prefix$cache_file ;;
-      esac
-
-      { $as_echo "$as_me:${as_lineno-$LINENO}: running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&5
-$as_echo "$as_me: running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&6;}
-      # 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
-    fi
-
-    cd "$ac_popdir"
-  done
-fi
 if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
   { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}

Modified: branches/new-help-system/base/configure.ac
===================================================================
--- branches/new-help-system/base/configure.ac	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/configure.ac	2014-08-03 15:04:12 UTC (rev 122999)
@@ -16,6 +16,7 @@
 
 # Check user PATH for MP paths, and remove as necessary.
 MP_PATH_SCAN
+MP_FLAGS_SCAN
 
 AC_PATH_PROG(SW_VERS, sw_vers)
 AC_PATH_PROG(DEFAULTS, defaults)
@@ -100,6 +101,26 @@
 AC_PROG_MAKE_SET
 AC_PROG_OBJC([clang cc gcc])
 
+# Check for user-supplied paths before searching
+MP_TOOL_PATH(BSDMAKE, [bsdmake/pmake])
+MP_TOOL_PATH(BZIP2, [bzip2])
+MP_TOOL_PATH(CVS, [cvs])
+MP_TOOL_PATH(GNUMAKE, [gnumake])
+MP_TOOL_PATH(GNUTAR, [gnutar])
+MP_TOOL_PATH(LZMA, [lzma])
+MP_TOOL_PATH(MAKE, [make])
+MP_TOOL_PATH(MTREE, [mtree])
+MP_TOOL_PATH(OPEN, [open])
+MP_TOOL_PATH(OPENSSL, [openssl])
+MP_TOOL_PATH(RSYNC, [rsync])
+MP_TOOL_PATH(SED, [sed])
+MP_TOOL_PATH(SVN, [svn])
+MP_TOOL_PATH(SWIG, [swig])
+MP_TOOL_PATH(TAR, [tar])
+MP_TOOL_PATH(XAR, [xar])
+MP_TOOL_PATH(XZ, [xz])
+
+# Search for tool paths. Any set above (via --with-pkg=PATH) will be retained
 AC_PATH_PROGS(BSDMAKE, [bsdmake pmake], [])
 AC_PATH_PROG(BZIP2, [bzip2], [])
 AC_PATH_PROG(BZR, [bzr], [])
@@ -109,13 +130,13 @@
 AC_PATH_PROG(CVS, [cvs], [])
 AC_PATH_PROG(DIFF, [diff], [])
 AC_PATH_PROG(DSCL, [dscl], [])
-AC_PATH_PROG(DSEDITGROUP, [dseditgroup], [])
+AC_PATH_PROG(DSEDITGROUP, [dseditgroup], [], [$PATH:/usr/sbin])
 AC_PATH_PROG(FILE, [file], [])
 AC_PATH_PROG(FIND, [find], [])
 AC_PATH_PROG(GIT, [git], [])
-AC_PATH_PROGS(GNUMAKE, [gnumake gmake], [], [$PATH:/usr/local/bin])
-AC_PATH_PROGS(GNUPATCH, [gnupatch gpatch], [], [$PATH:/usr/local/bin])
-AC_PATH_PROGS(GNUTAR, [gnutar gtar], [], [$PATH:/usr/local/bin])
+AC_PATH_PROGS(GNUMAKE, [gnumake gmake], [])
+AC_PATH_PROGS(GNUPATCH, [gnupatch gpatch], [])
+AC_PATH_PROGS(GNUTAR, [gnutar gtar], [])
 AC_PATH_PROG(GZIP, [gzip], [])
 AC_PATH_PROG(HDIUTIL, [hdiutil], [])
 AC_PATH_PROG(HG, [hg], [])
@@ -128,7 +149,7 @@
 AC_PATH_PROG(MDFIND, [mdfind], [])
 AC_PATH_PROG(MDLS, [mdls], [])
 AC_PATH_PROG(MKBOM, [mkbom], [])
-AC_PATH_PROG(MTREE, [mtree], [], [$PATH:/usr/sbin])
+AC_PATH_PROGS(MTREE, [mtree fmtree], [], [$PATH:/usr/sbin])
 AC_PATH_PROG(OPEN, [open], [])
 AC_PATH_PROG(OPENSSL, [openssl], [])
 AC_PATH_PROG(PATCH, [patch], [])
@@ -138,7 +159,7 @@
 AC_PATH_PROG(SANDBOX_EXEC, [sandbox-exec], [], [/usr/bin])
 AC_PATH_PROG(SED, [sed])
 AC_PATH_PROG(SVN, [svn], [])
-AC_PATH_PROG(SWIG, [swig], [], [$PATH:/usr/local/bin])
+AC_PATH_PROG(SWIG, [swig], [])
 AC_PATH_PROG(TAR, [tar])
 AC_PATH_PROG(UNZIP, [unzip])
 AC_PATH_PROG(XAR, [xar], [])
@@ -147,28 +168,8 @@
 AC_PATH_PROG(XZ, [xz], [])
 AC_PATH_PROG(ZIP, [zip])
 
-AC_CHECK_PROG(HAVE_LAUNCHD, [launchd], [yes], [])
+AC_CHECK_PROG(HAVE_LAUNCHD, [launchd], [yes], [], [/sbin])
 
-# Define some precious variables allowing user to override PATH for some programs
-AC_ARG_VAR(BSDMAKE, [path to bsdmake/pmake command])
-AC_ARG_VAR(BZIP2, [path to bzip2 command])
-AC_ARG_VAR(CVS, [path to cvs command])
-AC_ARG_VAR(GNUMAKE, [path to gnumake command])
-AC_ARG_VAR(GNUTAR, [path to gnutar command])
-AC_ARG_VAR(LZMA, [path to lzma command])
-AC_ARG_VAR(MAKE, [path to make command])
-AC_ARG_VAR(MAN, [path to man command])
-AC_ARG_VAR(MTREE, [path to mtree command])
-AC_ARG_VAR(OPEN, [path to open 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(SVN, [path to svn command])
-AC_ARG_VAR(SWIG, [path to swig command])
-AC_ARG_VAR(TAR, [path to tar command])
-AC_ARG_VAR(XAR, [path to xar command])
-AC_ARG_VAR(XZ, [path to xz command])
-
 if test "x$MTREE" = "x"; then
     AC_MSG_ERROR([mtree not found])
 fi
@@ -243,11 +244,10 @@
 	readline/history.h readline/readline.h spawn.h sys/cdefs.h sys/event.h sys/fcntl.h sys/file.h \
 	sys/paths.h sys/socket.h sys/sysctl.h utime.h])
 
-INCLUDES="-I.. -I. $INCLUDES"
-
 # Checks for library functions.
-AC_CHECK_FUNCS([OSAtomicCompareAndSwap32 OSAtomicCompareAndSwap64 OSAtomicCompareAndSwapPtr bzero \
-	clearenv copyfile fgetln flock fls kqueue lockf memset posix_spawn setmode strcasecmp strlcat \
+AC_CHECK_FUNCS([OSAtomicCompareAndSwap32 OSAtomicCompareAndSwap64 \
+	OSAtomicCompareAndSwapPtr __getdirentries64 bzero clearenv copyfile fgetln \
+	flock fls kqueue lockf memset posix_spawn setmode strcasecmp strlcat \
 	strlcpy strncasecmp sysctlbyname])
 AC_SUBST([ac_cv_func_strlcat])
 
@@ -277,27 +277,9 @@
 AC_DEFINE([MIN_USABLE_UID], [500], [Lowest non-system-reserved UID.])
 AC_DEFINE([MIN_USABLE_GID], [500], [Lowest non-system-reserved GID.])
 
-# Load tclConfig.sh
-SC_PATH_TCLCONFIG
-SC_LOAD_TCLCONFIG
+# Substitute platform for base compatibility check
+MP_PLATFORM
 
-# Check for Tcl public headers
-dnl XXX	 hardwire CYGPATH (CYGPATH must be set for SC_PUBLIC_TCL_HEADERS)
-CYGPATH=echo
-SC_PUBLIC_TCL_HEADERS
-
-# Check for tclsh binary
-MP_PROG_TCLSH
-
-# Substitute Tcl platform for base compatibility check
-MP_TCL_PLATFORM
-
-# Check for Tcl package path
-MP_TCL_PACKAGE_DIR
-
-# Check if thread is enabled.
-MP_TCL_THREAD_SUPPORT
-
 ## libcurl
 MP_LIBCURL_FLAGS
 
@@ -312,111 +294,149 @@
 # check whether trace mode is supported on this platform
 MP_TRACEMODE_SUPPORT
 
-# Determine if we need to install some bundled packages
-OUR_INCLUDED_PACKAGES=
+# misc variables that need to be expanded for substitution into tcl
+oldprefix=$prefix
+oldexec_prefix=$exec_prefix
+if test "x$prefix" = "xNONE" ; then
+   prefix=$ac_default_prefix
+fi
+if test "x$exec_prefix" = "xNONE" ; then
+	exec_prefix=$prefix
+fi
+eval "prefix_expanded=$prefix"
+eval "exec_prefix_expanded=$exec_prefix"
+AC_SUBST(prefix_expanded)
+# do this twice, since there is a nested variable of
+# ${prefix} inside of ${sysconfdir}
+eval "MPCONFIGDIR_EXPANDED=$MPCONFIGDIR"
+eval "MPCONFIGDIR_EXPANDED=$MPCONFIGDIR_EXPANDED"
+AC_SUBST(MPCONFIGDIR_EXPANDED)
+eval "localstatedir_expanded=$localstatedir"
+AC_SUBST(localstatedir_expanded)
+# Compute the libexec dir for the vendor packages
+eval "macports_libexec_dir=${libexecdir}/macports"
+eval "macports_libexec_dir=$macports_libexec_dir"
+prefix=$oldprefix
+exec_prefix=$oldexec_prefix
 
-## Thread package.
-AC_ARG_WITH(
-		included-tclthread,
-		AS_HELP_STRING([--with-included-tclthread],
-			[install included Thread package.]),
-		[with_included_tclthread=$withval],
-		[with_included_tclthread="unspecified"])
+## Tcl package
+tcl_version=8.5.15
+tcl_thread_version=2.7.0
+tclx_version=8.4.1
+tcllib_version=1.15
+MP_CONFIG_TARBALL([vendor/tcl${tcl_version}-src.tar.gz], [vendor/tcl${tcl_version}/unix], [--prefix=${macports_libexec_dir} --enable-threads])
+VENDOR_TCL_SUBDIR=tcl${tcl_version}/unix
+VENDOR_TCL_INSTALL="install-binaries install-libraries"
+AC_SUBST(VENDOR_TCL_SUBDIR)
+AC_SUBST(VENDOR_TCL_INSTALL)
 
-# Check if thread package is already installed.
-if test "x$with_included_tclthread" = "xunspecified" ; then
-	MP_TCL_PACKAGE(
-		[Thread],
-		[AC_MSG_RESULT([yes]); with_included_tclthread=no],
-		[AC_MSG_RESULT([no]); with_included_tclthread=yes])
-fi
+# Set up some variables needed by MacPorts' Tcl setup
+VENDOR_DESTROOT=vendor/vendor-destroot
+AC_SUBST(VENDOR_DESTROOT)
 
-# If thread package isn't installed, configure and install thread package.
-if test "$with_included_tclthread" = "yes"; then
-	OUR_INCLUDED_PACKAGES="$OUR_INCLUDED_PACKAGES thread2.6"
-	AC_CONFIG_SUBDIRS([src/thread2.6])
-	# Extract thread package
-	(cd src/; gzip -d < thread2.6.tar.gz | tar xf -)
-	# Patch thread package (so thread2.6 is the vanilla distribution directory)
-	patch -p0 < src/thread2.6.diff
-fi
+## Tcl Thread package
+# Tcl supports Threads internally, but to use threads from Tcl code we need
+# this package
+MP_CONFIG_TARBALL([vendor/thread${tcl_thread_version}.tar.gz], [vendor/thread${tcl_thread_version}], [--prefix=${macports_libexec_dir}])
+VENDOR_TCLTHREAD_SUBDIR=thread${tcl_thread_version}
+VENDOR_TCLTHREAD_INSTALL="install-binaries install-libraries"
+AC_SUBST(VENDOR_TCLTHREAD_SUBDIR)
+AC_SUBST(VENDOR_TCLTHREAD_INSTALL)
 
-# Allows building of shared libraries
+## TclX package
+# TclX is required for signal handling
+MP_CONFIG_TARBALL([vendor/tclx${tclx_version}.tar.bz2], [vendor/tclx8.4], [--prefix=${macports_libexec_dir}])
+VENDOR_TCLX_SUBDIR=tclx8.4
+VENDOR_TCLX_INSTALL="install-binaries install-libraries"
+AC_SUBST(VENDOR_TCLX_SUBDIR)
+AC_SUBST(VENDOR_TCLX_INSTALL)
+
+## Tcllib package
+# Note that Tcllib needs a Tcl interpreter during installation; it will *not*
+# be the one we configure above, because that one isn't built yet. That's not
+# a problem, though -- it's only used during installation.
+MP_CONFIG_TARBALL([vendor/tcllib-${tcllib_version}.tar.gz], [vendor/tcllib-${tcllib_version}], [--prefix=${macports_libexec_dir}])
+VENDOR_TCLLIB_SUBDIR=tcllib-${tcllib_version}
+VENDOR_TCLLIB_INSTALL="install-libraries"
+AC_SUBST(VENDOR_TCLLIB_SUBDIR)
+AC_SUBST(VENDOR_TCLLIB_INSTALL)
+
+# Load tclConfig.sh from our private install of Tcl
+AC_MSG_CHECKING([for Tcl configuration])
+TCL_BIN_DIR=`(cd vendor/tcl${tcl_version}/unix; pwd)`
+AC_MSG_RESULT([found $TCL_BIN_DIR/tclConfig.sh])
+SC_LOAD_TCLCONFIG
 SC_ENABLE_SHARED
 
-# Pull compiler / linker values from tclConfig.sh
-LDFLAGS_DEBUG=${TCL_LDFLAGS_DEBUG}
-LDFLAGS_OPTIMIZE=${TCL_LDFLAGS_OPTIMIZE}
+# Pull compiler/linker values from tclConfig.sh
 SHLIB_LD=${TCL_SHLIB_LD}
 STLIB_LD=${TCL_STLIB_LD}
 SHLIB_CFLAGS=${TCL_SHLIB_CFLAGS}
 SHLIB_SUFFIX=${TCL_SHLIB_SUFFIX}
+TCLSH=${TCL_EXEC_PREFIX}/bin/tclsh${TCL_VERSION}
+INTREE_TCLSH=${TCL_BIN_DIR}/tclsh
+# strip possible whitespace at the end of TCL_PACKAGE_PATH
+eval "TCL_PACKAGE_PATH=${TCL_PACKAGE_PATH}"
 
-AC_SUBST(INCLUDES)
+AC_SUBST(SHLIB_LD)
 AC_SUBST(STLIB_LD)
-AC_SUBST(SHLIB_LD)
 AC_SUBST(SHLIB_CFLAGS)
-AC_SUBST(SHLIB_LDFLAGS)
 AC_SUBST(SHLIB_SUFFIX)
-AC_SUBST(TCL_DEFS)
+AC_SUBST(TCL_PREFIX)
+AC_SUBST(TCL_VERSION)
+AC_SUBST(TCL_PACKAGE_PATH)
 AC_SUBST(TCL_STUB_LIB_SPEC)
-AC_SUBST(TCL_CC)
-AC_SUBST(OUR_INCLUDED_PACKAGES)
+AC_SUBST(TCL_SRC_DIR)
+AC_SUBST(TCLSH)
+AC_SUBST(INTREE_TCLSH)
 
-# misc variables that need to be expanded for substitution into tcl
+INCLUDES="-I.. -I. $INCLUDES"
+AC_SUBST(INCLUDES)
 
-oldprefix=$prefix
-if test "x$prefix" = "xNONE" ; then
-   prefix=$ac_default_prefix
-fi
-
 # Check if there's an existing DP/MP install too old to upgrade
 MP_CHECK_OLDLAYOUT
 
-eval "prefix_expanded=$prefix"
-AC_SUBST(prefix_expanded)
-# do this twice, since there is a nested variable of
-# ${prefix} inside of ${sysconfdir}
-eval "MPCONFIGDIR_EXPANDED=$MPCONFIGDIR"
-eval "MPCONFIGDIR_EXPANDED=$MPCONFIGDIR_EXPANDED"
-AC_SUBST(MPCONFIGDIR_EXPANDED)
-eval "localstatedir_expanded=$localstatedir"
-AC_SUBST(localstatedir_expanded)
-eval "macports_tcl_dir=${datadir}/macports/Tcl"
-eval "macports_tcl_dir=$macports_tcl_dir"
-AC_SUBST(macports_tcl_dir)
-
-prefix=$oldprefix
-
-dnl man page settings (compressed, links, etc)
-dnl
-dnl SC_CONFIG_MANPAGES
-
 # Output
 AC_CONFIG_FILES([
 	Doxyfile
 	Makefile
 	Mk/macports.autoconf.mk
+	doc/Makefile
 	doc/base.mtree
 	doc/macosx.mtree
 	doc/macports.conf
 	doc/prefix.mtree
 	doc/pubkeys.conf
 	portmgr/freebsd/Makefile
+	portmgr/dmg/postflight
 	setupenv.bash
 	src/Makefile
+	src/cregistry/Makefile
+	src/darwintracelib1.0/Makefile
 	src/machista1.0/Makefile
+	src/macports1.0/Makefile
 	src/macports1.0/macports_autoconf.tcl
 	src/macports1.0/macports_test_autoconf.tcl
-	src/macports1.0/macports_fastload.tcl
+	src/package1.0/Makefile
 	src/package1.0/package_test_autoconf.tcl
 	src/pextlib1.0/Makefile
+	src/port/Makefile
+	src/port1.0/Makefile
 	src/port1.0/port_autoconf.tcl
 	src/port1.0/port_test_autoconf.tcl
 	src/programs/Makefile
+	src/registry2.0/Makefile
 	src/registry2.0/registry_autoconf.tcl
+	tests/Makefile
+	tests/test.tcl
+	tests/test/library.tcl
+	tests/test/trace/test.tcl
+	vendor/Makefile
 ])
 
+AC_CONFIG_FILES([src/dedup_portfiles.tcl], [chmod +x src/dedup_portfiles.tcl])
+AC_CONFIG_FILES([src/images_to_archives.tcl], [chmod +x src/images_to_archives.tcl])
 AC_CONFIG_FILES([src/pkg_mkindex.sh], [chmod +x src/pkg_mkindex.sh])
+AC_CONFIG_FILES([src/upgrade_sources_conf_default.tcl], [chmod +x src/upgrade_sources_conf_default.tcl])
 
 AC_OUTPUT


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

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


Deleted: branches/new-help-system/base/doc/Makefile
===================================================================
--- branches/new-help-system/base/doc/Makefile	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/doc/Makefile	2014-08-03 15:04:12 UTC (rev 122999)
@@ -1,139 +0,0 @@
-# If this is a selfupdate, we never want to run any tools from the target
-# prefix (could be broken or wrong architecture), otherwise try to use the
-# tools from the target prefix for generating man pages if they exist
-ifeq ($(SELFUPDATING),1)
-ASCIIDOC=
-XSLTPROC=
-else
-ASCIIDOC=	$(wildcard ${prefix}/bin/asciidoc)
-XSLTPROC=	$(wildcard ${prefix}/bin/xsltproc)
-endif
-
-ASCIIDOCFLAGS=	-f asciidoc.conf -a manversion=${MACPORTS_VERSION}
-XSLTFLAGS=	-nonet
-
-MAN1=		port.1 \
-		port-activate.1 \
-		port-build.1 \
-		port-checksum.1 \
-		port-configure.1 \
-		port-deactivate.1 \
-		port-destroot.1 \
-		port-edit.1 \
-		port-extract.1 \
-		port-fetch.1 \
-		port-install.1 \
-		port-patch.1 \
-		port-uninstall.1
-MAN5=		macports.conf.5
-MAN7=		portfile.7 portstyle.7 porthier.7 portgroup.7 portundocumented.7
-MAN=		${MAN1} ${MAN5} ${MAN7}
-
-# Filter man pages with existing source files
-MANTXT=		$(wildcard ${MAN:%=%.txt})
-# Only those can be transformed into XML
-MANXML=		${MANTXT:.txt=.xml}
-# HTML version for all man pages
-MANHTML=	${MAN:%=%.html}
-
-CONF=       	archive_sites.conf macports.conf pubkeys.conf sources.conf variants.conf
-INSTALLDIR=	${DESTDIR}${prefix}
-TOPSRCDIR=	..
-
-ifneq ($(MAKECMDGOALS),distclean)
-include ../Mk/macports.autoconf.mk
-endif
-
-all: man
-
-# Update "include::" dependencies
-.dep: $(wildcard *.txt) asciidoc-deps.tcl
-	$(TCLSH) ./asciidoc-deps.tcl *.txt > $@
-
--include .dep
-
-.PHONY: man xml html
-
-man: ${MAN} ${MAN:%=%.gz}
-
-xml: ${MANXML}
-
-html: ${MANHTML}
-
-clean:
-	rm -f *.{1,5,7}.html
-	rm -f *.{1,5,7}.xml
-	rm -f *.{1,5,7}.gz
-	rm -f .dep
-
-test:
-
-distclean: clean
-	rm -f macports.conf base.mtree macosx.mtree prefix.mtree pubkeys.conf
-
-%.1.gz: %.1
-	gzip -c $^ > $@
-
-%.5.gz: %.5
-	gzip -c $^ > $@
-
-%.7.gz: %.7
-	gzip -c $^ > $@
-
-%: %.soelim
-	ln -f $< $@
-
-%.html: %.soelim
-	ln -sf $(shell basename $$(awk '{print $$2}' < $<)).html $@
-
-# Define these rules only if both asciidoc and xsltproc are available
-ifneq ($(ASCIIDOC)$(XSLTPROC),)
-%: %.xml manpage.xsl
-	$(XSLTPROC) $(XSLTFLAGS) manpage.xsl $<
-
-%.xml: %.txt asciidoc.conf
-	$(ASCIIDOC) $(ASCIIDOCFLAGS) -d manpage -b docbook $<
-
-%.html: %.txt asciidoc.conf
-	$(ASCIIDOC) $(ASCIIDOCFLAGS) -d manpage -b xhtml11 $<
-else
-man: ${MAN} ${MAN:%=%.gz}
-	@echo "* Warning: Using pre-generated man pages only."
-	@echo "* asciidoc and xsltproc are required to generate man pages from source."
-
-%.xml %.html: | %.txt
-	@echo "* In order to modify and generate output from these source files,"
-	@echo "* please install asciidoc and xsltproc or use"
-	@echo "*   $(MAKE) ASCIIDOC=.../bin/asciidoc XSLTPROC=../bin/xsltproc"
-	@echo "* with appropriate paths."
-	@exit 1
-endif
-
-install: all
-	$(INSTALL) -d -o ${DSTUSR} -g ${DSTGRP} -m ${DSTMODE} "${INSTALLDIR}"
-	$(INSTALL) -d -o ${DSTUSR} -g ${DSTGRP} -m ${DSTMODE} "${DESTDIR}${mpconfigdir}"
-
-	< prefix.mtree $(MTREE) -U -e -p "${INSTALLDIR}" > /dev/null
-	< base.mtree $(MTREE) -U -e -p "${INSTALLDIR}" > /dev/null
-
-	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
-	for m in ${MAN5}; do rm -f "${INSTALLDIR}/share/man/man5/$$m" ; done
-	for m in ${MAN7}; do rm -f "${INSTALLDIR}/share/man/man7/$$m" ; done
-
-	$(INSTALL) -d -o ${DSTUSR} -g ${DSTGRP} -m ${DSTMODE} ${INSTALLDIR}/share/macports/install
-	$(INSTALL) -o ${DSTUSR} -g ${DSTGRP} -m 644 base.mtree ${INSTALLDIR}/share/macports/install/
-	$(INSTALL) -o ${DSTUSR} -g ${DSTGRP} -m 644 prefix.mtree ${INSTALLDIR}/share/macports/install/
-	$(INSTALL) -o ${DSTUSR} -g ${DSTGRP} -m 644 macosx.mtree ${INSTALLDIR}/share/macports/install/
-
-	for page in ${MAN1} ${MAN5} ${MAN7}; do \
-		$(INSTALL) -o ${DSTUSR} -g ${DSTGRP} -m 444 $${page}.gz ${INSTALLDIR}/share/man/man$$(echo $$page | sed -e 's/.*\.//'); \
-	done

Copied: branches/new-help-system/base/doc/Makefile.in (from rev 122997, trunk/base/doc/Makefile.in)
===================================================================
--- branches/new-help-system/base/doc/Makefile.in	                        (rev 0)
+++ branches/new-help-system/base/doc/Makefile.in	2014-08-03 15:04:12 UTC (rev 122999)
@@ -0,0 +1,150 @@
+srcdir = @srcdir@
+VPATH  = @srcdir@
+
+# If this is a selfupdate, we never want to run any tools from the target
+# prefix (could be broken or wrong architecture), otherwise try to use the
+# tools from the target prefix for generating man pages if they exist
+ifeq ($(SELFUPDATING),1)
+ASCIIDOC=
+XSLTPROC=
+else
+ASCIIDOC=	$(wildcard ${prefix}/bin/asciidoc)
+XSLTPROC=	$(wildcard ${prefix}/bin/xsltproc)
+endif
+
+ASCIIDOCFLAGS=	-f asciidoc.conf -a manversion=${MACPORTS_VERSION}
+XSLTFLAGS=	-nonet
+
+MAN1=		port.1 \
+		port-activate.1 \
+		port-build.1 \
+		port-checksum.1 \
+		port-configure.1 \
+		port-deactivate.1 \
+		port-destroot.1 \
+		port-edit.1 \
+		port-extract.1 \
+		port-fetch.1 \
+		port-install.1 \
+		port-patch.1 \
+		port-uninstall.1
+MAN5=		macports.conf.5
+MAN7=		portfile.7 portstyle.7 porthier.7 portgroup.7 portundocumented.7
+MAN=		${MAN1} ${MAN5} ${MAN7}
+
+# Filter man pages with existing source files
+MANTXT=		$(wildcard ${MAN:%=%.txt})
+# Only those can be transformed into XML
+MANXML=		${MANTXT:.txt=.xml}
+# HTML version for all man pages
+MANHTML=	${MAN:%=%.html}
+
+CONF=       	archive_sites.conf macports.conf pubkeys.conf sources.conf variants.conf
+INSTALLDIR=	${DESTDIR}${prefix}
+TOPSRCDIR=	..
+
+ifneq ($(MAKECMDGOALS),distclean)
+include ../Mk/macports.autoconf.mk
+endif
+
+all: man
+
+# Update "include::" dependencies
+.dep: $(wildcard *.txt) asciidoc-deps.tcl
+	$(INTREE_TCLSH) ./asciidoc-deps.tcl *.txt > $@
+
+-include .dep
+
+.PHONY: man xml html
+
+man: ${MAN} ${MAN:%=%.gz}
+
+xml: ${MANXML}
+
+html: ${MANHTML}
+
+clean:
+	rm -f *.{1,5,7}.html
+	rm -f *.{1,5,7}.xml
+	rm -f *.{1,5,7}.gz
+	rm -f .dep
+
+test:
+
+distclean: clean
+	rm -f macports.conf base.mtree macosx.mtree prefix.mtree pubkeys.conf
+	rm -f Makefile
+
+%.1.gz: %.1
+	gzip -c $^ > $@
+
+%.5.gz: %.5
+	gzip -c $^ > $@
+
+%.7.gz: %.7
+	gzip -c $^ > $@
+
+%: %.soelim
+	ln -f $< $@
+
+%.html: %.soelim
+	ln -sf $(shell basename $$(awk '{print $$2}' < $<)).html $@
+
+# Define these rules only if both asciidoc and xsltproc are available
+ifneq ($(ASCIIDOC)$(XSLTPROC),)
+%: %.xml manpage.xsl
+	$(XSLTPROC) $(XSLTFLAGS) manpage.xsl $<
+
+%.xml: %.txt asciidoc.conf
+	$(ASCIIDOC) $(ASCIIDOCFLAGS) -d manpage -b docbook $<
+
+%.html: %.txt asciidoc.conf
+	$(ASCIIDOC) $(ASCIIDOCFLAGS) -d manpage -b xhtml11 $<
+else
+man: ${MAN} ${MAN:%=%.gz}
+	@echo "* Warning: Using pre-generated man pages only."
+	@echo "* asciidoc and xsltproc are required to generate man pages from source."
+
+%.xml %.html: | %.txt
+	@echo "* In order to modify and generate output from these source files,"
+	@echo "* please install asciidoc and xsltproc or use"
+	@echo "*   $(MAKE) ASCIIDOC=.../bin/asciidoc XSLTPROC=../bin/xsltproc"
+	@echo "* with appropriate paths."
+	@exit 1
+endif
+
+install: all
+	$(INSTALL) -d -o "${DSTUSR}" -g "${DSTGRP}" -m "${DSTMODE}" "${INSTALLDIR}"
+	$(INSTALL) -d -o "${DSTUSR}" -g "${DSTGRP}" -m "${DSTMODE}" "${DESTDIR}${mpconfigdir}"
+
+	< prefix.mtree $(MTREE) -U -e -p "${INSTALLDIR}" > /dev/null
+	< base.mtree $(MTREE) -U -e -p "${INSTALLDIR}" > /dev/null
+ifneq (,$(findstring darwin, at build_os@))
+ifneq (8, at OS_MAJOR@)
+# Tiger's chmod doesn't accept -h
+# mtree with umask 0077 doesn't get the permissions of the symlink right
+	chmod -h 755 "${INSTALLDIR}/man"
+endif
+endif
+
+	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
+	for m in ${MAN5}; do rm -f "${INSTALLDIR}/share/man/man5/$$m" ; done
+	for m in ${MAN7}; do rm -f "${INSTALLDIR}/share/man/man7/$$m" ; done
+
+	$(INSTALL) -d -o "${DSTUSR}" -g "${DSTGRP}" -m "${DSTMODE}" "${INSTALLDIR}/share/macports/install"
+	$(INSTALL)    -o "${DSTUSR}" -g "${DSTGRP}" -m 644 base.mtree "${INSTALLDIR}/share/macports/install/"
+	$(INSTALL)    -o "${DSTUSR}" -g "${DSTGRP}" -m 644 prefix.mtree "${INSTALLDIR}/share/macports/install/"
+	$(INSTALL)    -o "${DSTUSR}" -g "${DSTGRP}" -m 644 macosx.mtree "${INSTALLDIR}/share/macports/install/"
+
+	for page in ${MAN1} ${MAN5} ${MAN7}; do \
+		$(INSTALL) -o "${DSTUSR}" -g "${DSTGRP}" -m 444 "$${page}.gz" "${INSTALLDIR}/share/man/man$$(echo $$page | sed -e 's/.*\.//')"; \
+	done

Modified: branches/new-help-system/base/doc/macports.conf.5
===================================================================
--- branches/new-help-system/base/doc/macports.conf.5	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/doc/macports.conf.5	2014-08-03 15:04:12 UTC (rev 122999)
@@ -1,5 +1,5 @@
 '\" t
-.TH "MACPORTS\&.CONF" "5" "2013\-03\-10" "MacPorts 2\&.1\&.99" "MacPorts Manual"
+.TH "MACPORTS\&.CONF" "5" "2013\-03\-10" "MacPorts 2\&.3\&.99" "MacPorts Manual"
 .\" -----------------------------------------------------------------
 .\" * Define some portability stuff
 .\" -----------------------------------------------------------------

Modified: branches/new-help-system/base/doc/macports.conf.in
===================================================================
--- branches/new-help-system/base/doc/macports.conf.in	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/doc/macports.conf.in	2014-08-03 15:04:12 UTC (rev 122999)
@@ -60,7 +60,7 @@
 
 # Space-delimited list of CPU architectures to target when building
 # universal. Defaults to "i386 ppc" on OS X 10.5 and earlier and
-# "x64_64 i386" on OS X 10.6 and later.
+# "x86_64 i386" on OS X 10.6 and later.
 universal_archs     	@UNIVERSAL_ARCHS@
 
 # Use ccache, a compiler cache for C, C++, Objective-C, and
@@ -105,8 +105,8 @@
 #keeplogs            	no
 
 # The rsync server for fetching MacPorts base during selfupdate. This
-# setting is NOT used when downloading the ports tree; the sources for
-# the ports tree are set in sources.conf. See
+# setting is NOT used when downloading ports trees; ports trees are
+# configured using the file referenced by sources_conf. See
 # https://trac.macports.org/wiki/Mirrors#MacPortsSource for a list of
 # available servers.
 #rsync_server        	rsync.macports.org
@@ -128,11 +128,13 @@
 # - default: Create StartupItems for launchd on OS X and for rc.d on
 #   other platforms.
 # - none: Disable creation of StartupItems.
+# This setting only applies when building ports from source.
 #startupitem_type    	default
 
 # Create system-level symlinks to generated StartupItems. If set to
 # "no", symlinks will not be created; otherwise, symlinks will be placed
 # in /Library/LaunchDaemons or /Library/LaunchAgents as appropriate.
+# This setting only applies when building ports from source.
 #startupitem_install	yes
 
 # Extra environment variables to keep. MacPorts sanitizes its

Modified: branches/new-help-system/base/doc/port-activate.1
===================================================================
--- branches/new-help-system/base/doc/port-activate.1	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/doc/port-activate.1	2014-08-03 15:04:12 UTC (rev 122999)
@@ -1,5 +1,5 @@
 '\" t
-.TH "PORT\-ACTIVATE" "1" "2013\-03\-10" "MacPorts 2\&.1\&.99" "MacPorts Manual"
+.TH "PORT\-ACTIVATE" "1" "2013\-03\-10" "MacPorts 2\&.3\&.99" "MacPorts Manual"
 .\" -----------------------------------------------------------------
 .\" * Define some portability stuff
 .\" -----------------------------------------------------------------

Modified: branches/new-help-system/base/doc/port-edit.1
===================================================================
--- branches/new-help-system/base/doc/port-edit.1	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/doc/port-edit.1	2014-08-03 15:04:12 UTC (rev 122999)
@@ -1,5 +1,5 @@
 '\" t
-.TH "PORT\-EDIT" "1" "2013\-03\-10" "MacPorts 2\&.1\&.99" "MacPorts Manual"
+.TH "PORT\-EDIT" "1" "2013\-03\-10" "MacPorts 2\&.3\&.99" "MacPorts Manual"
 .\" -----------------------------------------------------------------
 .\" * Define some portability stuff
 .\" -----------------------------------------------------------------

Modified: branches/new-help-system/base/doc/port-fetch.1
===================================================================
--- branches/new-help-system/base/doc/port-fetch.1	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/doc/port-fetch.1	2014-08-03 15:04:12 UTC (rev 122999)
@@ -1,5 +1,5 @@
 '\" t
-.TH "PORT\-FETCH" "1" "2013\-03\-10" "MacPorts 2\&.1\&.99" "MacPorts Manual"
+.TH "PORT\-FETCH" "1" "2013\-03\-10" "MacPorts 2\&.3\&.99" "MacPorts Manual"
 .\" -----------------------------------------------------------------
 .\" * Define some portability stuff
 .\" -----------------------------------------------------------------

Modified: branches/new-help-system/base/doc/port-install.1
===================================================================
--- branches/new-help-system/base/doc/port-install.1	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/doc/port-install.1	2014-08-03 15:04:12 UTC (rev 122999)
@@ -1,5 +1,5 @@
 '\" t
-.TH "PORT\-INSTALL" "1" "2013\-03\-10" "MacPorts 2\&.1\&.99" "MacPorts Manual"
+.TH "PORT\-INSTALL" "1" "2013\-03\-10" "MacPorts 2\&.3\&.99" "MacPorts Manual"
 .\" -----------------------------------------------------------------
 .\" * Define some portability stuff
 .\" -----------------------------------------------------------------

Modified: branches/new-help-system/base/doc/port-uninstall.1
===================================================================
--- branches/new-help-system/base/doc/port-uninstall.1	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/doc/port-uninstall.1	2014-08-03 15:04:12 UTC (rev 122999)
@@ -1,5 +1,5 @@
 '\" t
-.TH "PORT\-INSTALL" "1" "2013\-03\-10" "MacPorts 2\&.1\&.99" "MacPorts Manual"
+.TH "PORT\-INSTALL" "1" "2013\-03\-10" "MacPorts 2\&.3\&.99" "MacPorts Manual"
 .\" -----------------------------------------------------------------
 .\" * Define some portability stuff
 .\" -----------------------------------------------------------------

Modified: branches/new-help-system/base/doc/port.1
===================================================================
--- branches/new-help-system/base/doc/port.1	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/doc/port.1	2014-08-03 15:04:12 UTC (rev 122999)
@@ -1,5 +1,5 @@
 '\" t
-.TH "PORT" "1" "2013\-09\-07" "MacPorts 2\&.2\&.99" "MacPorts Manual"
+.TH "PORT" "1" "2013\-09\-07" "MacPorts 2\&.3\&.99" "MacPorts Manual"
 .\" -----------------------------------------------------------------
 .\" * Define some portability stuff
 .\" -----------------------------------------------------------------
@@ -48,7 +48,6 @@
 .sp -1
 .IP \(bu 2.3
 .\}
-
 \fIall\fR: all the ports in each ports tree listed in
 \fIsources\&.conf\fR
 .RE
@@ -61,7 +60,6 @@
 .sp -1
 .IP \(bu 2.3
 .\}
-
 \fIcurrent\fR: the port in the current working directory
 .RE
 .sp
@@ -73,7 +71,6 @@
 .sp -1
 .IP \(bu 2.3
 .\}
-
 \fIactive\fR: set of installed and active ports
 .RE
 .sp
@@ -85,7 +82,6 @@
 .sp -1
 .IP \(bu 2.3
 .\}
-
 \fIinactive\fR: set of installed but inactive ports
 .RE
 .sp
@@ -97,7 +93,6 @@
 .sp -1
 .IP \(bu 2.3
 .\}
-
 \fIinstalled\fR: set of all installed ports
 .RE
 .sp
@@ -109,7 +104,6 @@
 .sp -1
 .IP \(bu 2.3
 .\}
-
 \fIuninstalled\fR: ports in the ports tree(s) that are not installed
 .RE
 .sp
@@ -121,7 +115,6 @@
 .sp -1
 .IP \(bu 2.3
 .\}
-
 \fIoutdated\fR: installed ports that are out of date with respect to their current version/revision in the ports tree(s)
 .RE
 .sp
@@ -133,7 +126,6 @@
 .sp -1
 .IP \(bu 2.3
 .\}
-
 \fIobsolete\fR: set of ports that are installed but no longer exist in any port tree
 .RE
 .sp
@@ -145,7 +137,6 @@
 .sp -1
 .IP \(bu 2.3
 .\}
-
 \fIrequested\fR: installed ports that were explicitly asked for
 .RE
 .sp
@@ -157,7 +148,6 @@
 .sp -1
 .IP \(bu 2.3
 .\}
-
 \fIunrequested\fR: installed ports that were installed only to satisfy dependencies
 .RE
 .sp
@@ -169,7 +159,6 @@
 .sp -1
 .IP \(bu 2.3
 .\}
-
 \fIleaves\fR: installed ports that are unrequested and have no dependents
 .RE
 .sp
@@ -185,7 +174,6 @@
 .sp -1
 .IP \(bu 2.3
 .\}
-
 \fIname\fR
 .RE
 .sp
@@ -197,7 +185,6 @@
 .sp -1
 .IP \(bu 2.3
 .\}
-
 \fIversion\fR
 .RE
 .sp
@@ -209,7 +196,6 @@
 .sp -1
 .IP \(bu 2.3
 .\}
-
 \fIrevision\fR
 .RE
 .sp
@@ -221,7 +207,6 @@
 .sp -1
 .IP \(bu 2.3
 .\}
-
 \fIepoch\fR
 .RE
 .sp
@@ -233,7 +218,6 @@
 .sp -1
 .IP \(bu 2.3
 .\}
-
 \fIvariant\fR
 .RE
 .sp
@@ -245,7 +229,6 @@
 .sp -1
 .IP \(bu 2.3
 .\}
-
 \fIvariants\fR
 .RE
 .sp
@@ -257,7 +240,6 @@
 .sp -1
 .IP \(bu 2.3
 .\}
-
 \fIcategory\fR
 .RE
 .sp
@@ -269,7 +251,6 @@
 .sp -1
 .IP \(bu 2.3
 .\}
-
 \fIcategories\fR
 .RE
 .sp
@@ -281,7 +262,6 @@
 .sp -1
 .IP \(bu 2.3
 .\}
-
 \fImaintainer\fR
 .RE
 .sp
@@ -293,7 +273,6 @@
 .sp -1
 .IP \(bu 2.3
 .\}
-
 \fImaintainers\fR
 .RE
 .sp
@@ -305,7 +284,6 @@
 .sp -1
 .IP \(bu 2.3
 .\}
-
 \fIplatform\fR
 .RE
 .sp
@@ -317,7 +295,6 @@
 .sp -1
 .IP \(bu 2.3
 .\}
-
 \fIplatforms\fR
 .RE
 .sp
@@ -329,7 +306,6 @@
 .sp -1
 .IP \(bu 2.3
 .\}
-
 \fIdescription\fR
 .RE
 .sp
@@ -341,7 +317,6 @@
 .sp -1
 .IP \(bu 2.3
 .\}
-
 \fIlong_description\fR
 .RE
 .sp
@@ -353,7 +328,6 @@
 .sp -1
 .IP \(bu 2.3
 .\}
-
 \fIhomepage\fR
 .RE
 .sp
@@ -365,7 +339,6 @@
 .sp -1
 .IP \(bu 2.3
 .\}
-
 \fIlicense\fR
 .RE
 .sp
@@ -377,7 +350,6 @@
 .sp -1
 .IP \(bu 2.3
 .\}
-
 \fIportdir\fR
 .RE
 .sp
@@ -391,7 +363,6 @@
 .sp -1
 .IP \(bu 2.3
 .\}
-
 \fIdepof\fR
 .RE
 .sp
@@ -403,7 +374,6 @@
 .sp -1
 .IP \(bu 2.3
 .\}
-
 \fIrdepof\fR
 .RE
 .sp
@@ -415,7 +385,6 @@
 .sp -1
 .IP \(bu 2.3
 .\}
-
 \fIdependentof\fR
 .RE
 .sp
@@ -427,7 +396,6 @@
 .sp -1
 .IP \(bu 2.3
 .\}
-
 \fIrdependentof\fR
 .RE
 .sp
@@ -713,7 +681,11 @@
 .PP
 select
 .RS 4
-For a given group, selects a version to be the default by creating appropriate symbolic links\&. For instance, python might be linked to python2\&.6\&. Available select groups are installed as subdirec\- tories of ${prefix}/etc/select/\&. To list the available versions in a group, use \-\-list\&. To see which version is currently selected for a group, use \-\-show\&. To change the selected version for a group, use \-\-set\&.
+For a given group, selects a version to be the default by creating appropriate symbolic links\&. For instance, python might be linked to python2\&.6\&. Available select groups are installed as subdirectories of ${prefix}/etc/select/ and can be listed using
+\fB\-\-summary\fR\&. To list the available versions in a group, use
+\fB\-\-list\fR\&. To see which version is currently selected for a group, use
+\fB\-\-show\fR\&. To change the selected version for a group, use
+\fB\-\-set\fR\&.
 .sp
 For example:
 .sp
@@ -721,9 +693,10 @@
 .RS 4
 .\}
 .nf
+port select \-\-summary
+port select \-\-show python
 port select \-\-list python
-port select \-\-show gcc
-port select \-\-set gcc mp\-gcc47
+port select \-\-set python python34
 .fi
 .if n \{\
 .RE
@@ -934,8 +907,7 @@
 .RS 4
 Clean the files used for building
 \fIportname\fR\&. To just remove the work files, use the
-\fB\-\-work\fR
-\fIactionflag\fR\&. This is the default when no flag is given\&. To remove the distribution files (fetched tarballs, patches, etc), specify
+\fB\-\-work\fR\fIactionflag\fR\&. This is the default when no flag is given\&. To remove the distribution files (fetched tarballs, patches, etc), specify
 \fB\-\-dist\fR\&. To remove any archive(s) of a port than remain in the temporary download directory, pass
 \fB\-\-archive\fR\&. (This does not remove archives from the installed location\&.) To remove log files for a port, pass
 \fB\-\-logs\fR\&. To remove the work files, distribution files, temporary archives and logs pass

Modified: branches/new-help-system/base/doc/port.1.txt
===================================================================
--- branches/new-help-system/base/doc/port.1.txt	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/doc/port.1.txt	2014-08-03 15:04:12 UTC (rev 122999)
@@ -290,17 +290,19 @@
 select::
     For a given group, selects a version to be the default by creating
     appropriate symbolic links.  For instance, python might be linked to
-    python2.6. Available select groups are installed as subdirec- tories of
-    $\{prefix\}/etc/select/.  To list the available versions in a group, use
-    --list. To see which version is currently selected for a group, use --show.
-    To change the selected version for a group, use --set.
+    python2.6. Available select groups are installed as subdirectories of
+    $\{prefix\}/etc/select/ and can be listed using *--summary*.  To list the
+    available versions in a group, use *--list*. To see which version is currently
+    selected for a group, use *--show*. To change the selected version for
+    a group, use *--set*.
 +
 For example:
 +
 --------
+port select --summary
+port select --show python
 port select --list python
-port select --show gcc
-port select --set gcc mp-gcc47
+port select --set python python34
 --------
 
 activate::

Modified: branches/new-help-system/base/doc/portfile.7
===================================================================
--- branches/new-help-system/base/doc/portfile.7	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/doc/portfile.7	2014-08-03 15:04:12 UTC (rev 122999)
@@ -1132,7 +1132,7 @@
 .Em optional
 .br
 .Sy Default:
-.Em -isystem${prefix}/include
+.Em -I${prefix}/include
 .It Ic configure.cxxflags
 Flags to put in the CXXFLAGS environment variable when invoking the configure script.
 .br

Modified: branches/new-help-system/base/doc/portgroup.7
===================================================================
--- branches/new-help-system/base/doc/portgroup.7	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/doc/portgroup.7	2014-08-03 15:04:12 UTC (rev 122999)
@@ -1,5 +1,5 @@
 '\" t
-.TH "PORTGROUP" "7" "2013\-03\-10" "MacPorts 2\&.1\&.99" "MacPorts Manual"
+.TH "PORTGROUP" "7" "2013\-03\-10" "MacPorts 2\&.3\&.99" "MacPorts Manual"
 .\" -----------------------------------------------------------------
 .\" * Define some portability stuff
 .\" -----------------------------------------------------------------
@@ -46,21 +46,18 @@
 .PP
 categories
 .RS 4
-
 \fBDefault:\fR
 aqua
 .RE
 .PP
 platforms
 .RS 4
-
 \fBDefault:\fR
 macosx
 .RE
 .PP
 use_configure
 .RS 4
-
 \fBDefault:\fR
 no
 .RE
@@ -440,84 +437,71 @@
 .PP
 categories
 .RS 4
-
 \fBDefault:\fR
 gnustep
 .RE
 .PP
 homepage
 .RS 4
-
-\fBDefault:\fR
-\m[blue]\fBhttp://www\&.gnustep\&.org/\fR\m[]
+\fBDefault:\fR\m[blue]\fBhttp://www\&.gnustep\&.org/\fR\m[]
 .RE
 .PP
 master_sites
 .RS 4
-
 \fBDefault:\fR
 gnustep:core
 .RE
 .PP
 depends_lib
 .RS 4
-
 \fBDefault:\fR
 gnustep\-core
 .RE
 .PP
 use_configure
 .RS 4
-
 \fBDefault:\fR
 no
 .RE
 .PP
 configure\&.env
 .RS 4
-
 \fBDefault:\fR
 DYLD_LIBRARY_PATH PATH
 .RE
 .PP
 configure\&.pre_args\-append
 .RS 4
-
 \fBDefault:\fR
 CC=gcc\-mp\-4\&.2 GNUSTEP_MAKEFILES
 .RE
 .PP
 build\&.type
 .RS 4
-
 \fBDefault:\fR
 gnu
 .RE
 .PP
 build\&.env
 .RS 4
-
 \fBDefault:\fR
 DYLD_LIBRARY_PATH PATH
 .RE
 .PP
 build\&.pre_args\-append
 .RS 4
-
 \fBDefault:\fR
 messages=yes
 .RE
 .PP
 destroot\&.env
 .RS 4
-
 \fBDefault:\fR
 DYLD_LIBRARY_PATH PATH
 .RE
 .PP
 destroot\&.pre_args\-append
 .RS 4
-
 \fBDefault:\fR
 messages=yes
 .RE

Modified: branches/new-help-system/base/doc/portundocumented.7
===================================================================
--- branches/new-help-system/base/doc/portundocumented.7	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/doc/portundocumented.7	2014-08-03 15:04:12 UTC (rev 122999)
@@ -1,5 +1,5 @@
 '\" t
-.TH "PORTUNDOCUMENTED" "7" "2013\-03\-10" "MacPorts 2\&.1\&.99" "MacPorts Manual"
+.TH "PORTUNDOCUMENTED" "7" "2013\-03\-10" "MacPorts 2\&.3\&.99" "MacPorts Manual"
 .\" -----------------------------------------------------------------
 .\" * Define some portability stuff
 .\" -----------------------------------------------------------------

Modified: branches/new-help-system/base/m4/foundation.m4
===================================================================
--- branches/new-help-system/base/m4/foundation.m4	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/m4/foundation.m4	2014-08-03 15:04:12 UTC (rev 122999)
@@ -208,7 +208,6 @@
 			AC_LINK_IFELSE([
 					AC_LANG_PROGRAM([
 							#include <objc/objc.h>
-							#include <objc/objc-api.h>
 						], [
 							id class = objc_lookup_class("Object");
 							id obj = @<:@class alloc@:>@;
@@ -314,7 +313,7 @@
 
 	if test x"${with_objc_foundation}" != x"no"; then
 	
-	if test x"${with_objc_foundation}" == x || test x"${with_objc_foundation}" == x"apple"; then
+	if test x"${with_objc_foundation}" = x || test x"${with_objc_foundation}" = x"apple"; then
 		# '@<:@' = '['
 		# '@:>@' = ']'
 		AC_MSG_CHECKING([for Apple Foundation library])
@@ -353,10 +352,10 @@
 		ac_cv_objc_foundation_apple="no"
 	fi
 
-	if test x"${with_objc_foundation}" == x || test x${with_objc_foundation} == x"GNUstep"; then
+	if test x"${with_objc_foundation}" = x || test x"${with_objc_foundation}" = x"GNUstep"; then
 		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
+		if test ! -x "${GNUSTEP_CONFIG}" -a x"${GNUSTEP_SYSTEM_ROOT}" = x; then
+			if test x"${with_objc_foundation}" = x"GNUstep"; then
 				AC_MSG_ERROR([GNUSTEP_SYSTEM_ROOT is not defined in your environment, preventing the use of GNUstep's Foundation library])
 			else
 				AC_MSG_WARN([GNUSTEP_SYSTEM_ROOT is not defined in your environment, preventing the use of GNUstep's Foundation library])
@@ -413,21 +412,21 @@
 	fi
 	
 	# NeXT Foundation is prefered
-	if test x"${ac_cv_objc_foundation_apple}" == x"yes"; then
+	if test x"${ac_cv_objc_foundation_apple}" = x"yes"; then
 		OBJC_FOUNDATION="Apple"
 		OBJC_FOUNDATION_CPPFLAGS="${APPLE_FOUNDATION_CFLAGS}"
 		OBJC_FOUNDATION_LIBS="${APPLE_FOUNDATION_LIBS}"
 		OBJC_FOUNDATION_LDFLAGS=""
 		AC_DEFINE([APPLE_FOUNDATION], 1, [Define if using the Apple Foundation framework]) 
 		AC_MSG_NOTICE([Using Apple Foundation library])
-	elif test x"${ac_cv_objc_foundation_gnustep}" == x"yes"; then
+	elif test x"${ac_cv_objc_foundation_gnustep}" = x"yes"; then
 		OBJC_FOUNDATION="GNUstep"
 		OBJC_FOUNDATION_CPPFLAGS="${GNUSTEP_CPPFLAGS}"
 		OBJC_FOUNDATION_LIBS="${GNUSTEP_LIBS}"
 		OBJC_FOUNDATION_LDFLAGS="${GNUSTEP_LDFLAGS}"
 		AC_DEFINE([GNUSTEP_FOUNDATION], 1, [Define if using the GNUstep Foundation library]) 
 		AC_MSG_NOTICE([Using GNUstep Foundation library])
-	elif test x"${with_objc_foundation}" = x"no"; then
+	elif test x"${with_objc_foundation}" = x"no" || test x"$MACOSX_VERSION" = x; then
 		OBJC_FOUNDATION="none"
 		AC_MSG_NOTICE([Not using Foundation implementation])
 	else

Modified: branches/new-help-system/base/m4/tcl.m4
===================================================================
--- branches/new-help-system/base/m4/tcl.m4	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/m4/tcl.m4	2014-08-03 15:04:12 UTC (rev 122999)
@@ -110,10 +110,8 @@
 			`ls -d /usr/local/lib 2>/dev/null` \
 			`ls -d /usr/contrib/lib 2>/dev/null` \
 			`ls -d /usr/pkg/lib 2>/dev/null` \
-			`ls -d /usr/local/lib/tcl8.6 2>/dev/null` \
 			`ls -d /usr/local/lib/tcl8.5 2>/dev/null` \
 			`ls -d /usr/local/lib/tcl8.4 2>/dev/null` \
-			`ls -d /usr/lib/tcl8.6 2>/dev/null` \
 			`ls -d /usr/lib/tcl8.5 2>/dev/null` \
 			`ls -d /usr/lib/tcl8.4 2>/dev/null` \
 			; do

Modified: branches/new-help-system/base/portmgr/ReleaseProcess
===================================================================
--- branches/new-help-system/base/portmgr/ReleaseProcess	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/portmgr/ReleaseProcess	2014-08-03 15:04:12 UTC (rev 122999)
@@ -103,14 +103,13 @@
 tag URL. For instance:
 
  svn co [-r<rev>] https://svn.macports.org/repository/macports/trunk release_2.0.0-archive
- cd release_2.0.0-archive/base
- svn switch https://svn.macports.org/repository/macports/tags/release_2_0_0/base
+ cd release_2.0.0-archive
+ svn rm base
+ svn cp https://svn.macports.org/repository/macports/tags/release_2_0_0/base base
 
 And finally we tag the entire directory as release_2_0_0-archive:
 
-FIXME: this doesn't seem to work any more. The base subdir in the tag ends up being from trunk.
-
- cd ../../
+ cd ..
  svn cp -m "commit-message" release_2.0.0-archive https://svn.macports.org/repository/macports/tags/release_2_0_0-archive
 
 
@@ -233,7 +232,6 @@
    appropriate in the trunk/www/includes/common.inc file.
  * The &macports-version; entity in trunk/doc-new/guide/xml/installing.xml.
  * [https://trac.macports.org/news/] The MacOSforge news section (submitter: portmgr@)
- * [http://freecode.com/projects/macports/ Freecode] (submitter: mww@)
  * [http://www.versiontracker.com/dyn/moreinfo/macosx/26679 VersionTracker] (submitter: mij@)
  * [http://sourceforge.net/projects/macports/ sourceforge] (submitted: rhwood@)
  * [http://www.macupdate.com/info.php/id/21309/macports MacUpdate] (submitter: ???)
@@ -247,5 +245,3 @@
 Using new features introduced by a release should be delayed for 14 days. This
 should allow users to upgrade their installations to the new release. This
 delay matches the warning about outdated ports tree sources.
-
-


Property changes on: branches/new-help-system/base/portmgr/dmg
___________________________________________________________________
Added: svn:ignore
   + postflight


Modified: branches/new-help-system/base/portmgr/dmg/License.html
===================================================================
--- branches/new-help-system/base/portmgr/dmg/License.html	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/portmgr/dmg/License.html	2014-08-03 15:04:12 UTC (rev 122999)
@@ -15,7 +15,7 @@
 
     <body>
     
-        <p>Copyright (c) 2002 - 2003, Apple Inc.<br>Copyright (c) 2004 - 2013, The MacPorts Project.</p>
+        <p>Copyright (c) 2002 - 2003, Apple Inc.<br>Copyright (c) 2004 - 2014, The MacPorts Project.</p>
         <p>All rights reserved.</p>
         <p><br></p>
         

Deleted: branches/new-help-system/base/portmgr/dmg/postflight
===================================================================
--- branches/new-help-system/base/portmgr/dmg/postflight	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/portmgr/dmg/postflight	2014-08-03 15:04:12 UTC (rev 122999)
@@ -1,280 +0,0 @@
-#!/bin/bash
-# -*- coding: utf-8; mode: shell-script-mode; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=sh:et:sw=4:ts=4:sts=4
-#
-# Copyright (c) 2008-2012 The MacPorts Project
-# Copyright (c) 2002-2007 Juan Manuel Palacios <jmpp at macports.org>, The MacPorts Project.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-#    notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-#    notice, this list of conditions and the following disclaimer in the
-#    documentation and/or other materials provided with the distribution.
-# 3. Neither the name of The MacPorts Project nor the
-#    names of its contributors may be used to endorse or promote products
-#    derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-# postflight
-# $Id$
-
-
-#set -x
-
-# Script identification ('cause more often than not the svn Id is not expanded):
-VERSION=2.1.0
-
-# Abstraction variables:
-PREFIX=__PREFIX__
-BINPATH=${PREFIX}/bin
-SBINPATH=${PREFIX}/sbin
-CONFIGPATH=${PREFIX}/etc/macports
-MANPAGES=${PREFIX}/share/man
-MACPORTS_TCL_DIR=${PREFIX}/share/macports/Tcl
-REG1DIR=${MACPORTS_TCL_DIR}/registry1.0
-DSCL=/usr/bin/dscl
-RUNUSR=macports
-TCLSH=/usr/bin/tclsh
-TCL_PACKAGE_DIR=/Library/Tcl
-TIMESTAMP=$(date +"%Y-%m-%d_at_%H:%M:%S")
-BACKUP_SUFFIX=macports-saved_${TIMESTAMP}
-OUR_STRING="MacPorts Installer addition on ${TIMESTAMP}"
-
-# Create config files from defaults if not present
-function setup_configs {
-    for f in archive_sites.conf macports.conf pubkeys.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
-    done
-}
-
-# Command to update the MacPorts installation through "selfupdate":
-function update_macports {
-    SCRIPT_DIR=$(dirname $0)
-    # Add [default] tag to the central MacPorts repository, if it isn't already
-    echo "Adding [default] tag to sources.conf if needed..."
-    ${TCLSH} ${SCRIPT_DIR}/upgrade_sources_conf_default.tcl ${PREFIX}
-    # Convert image directories (and direct mode installs) to image archives
-    echo "Updating port image format..."
-    ${TCLSH} ${SCRIPT_DIR}/images_to_archives.tcl ${MACPORTS_TCL_DIR}
-
-    echo "Synchronizing the MacPorts installation with the project's rsync server..."
-    if ! ${BINPATH}/port -v selfupdate; then 
-        echo "An attempt to synchronize your recent MacPorts installation with the project's rsync server failed!"
-        echo "Please run 'sudo port -d selfupdate' manually to find out the cause of the error."
-    else
-        echo "Successful!"
-    fi
-}
-
-# Through this command we write an environment variable to an appropriate shell configuration file,
-# backing up the original only if it exists and if it doesn't contain the ${OUR_STRING} identification string,
-# which hints that we've already tweaked it and therefore already backed it up.
-function write_setting () {
-    if [[ -f "${HOME}/.${CONF_FILE}" ]] && ! grep "${OUR_STRING}" "${HOME}/.${CONF_FILE}" > /dev/null; then
-        echo "Backing up your ${HOME}/.${CONF_FILE} shell confguration file as ${HOME}/.${CONF_FILE}.${BACKUP_SUFFIX} before adapting it for MacPorts."
-        /bin/cp -fp "${HOME}/.${CONF_FILE}" "${HOME}/.${CONF_FILE}.${BACKUP_SUFFIX}" || {
-            echo "An attempt to backup your original configuration file failed! Please set your MacPorts compatible environment manually."
-            update_macports
-            exit 1
-        }
-        echo -e "\n##\n# Your previous ${HOME}/.${CONF_FILE} file was backed up as ${HOME}/.${CONF_FILE}.${BACKUP_SUFFIX}\n##" >> "${HOME}/.${CONF_FILE}"
-    fi
-    echo -e "\n# ${OUR_STRING}: adding an appropriate ${1} variable for use with MacPorts." >> "${HOME}/.${CONF_FILE}"
-    echo "${ENV_COMMAND} ${1}${ASSIGN}${2}" >> "${HOME}/.${CONF_FILE}"
-    echo -e "# Finished adapting your ${1} environment variable for use with MacPorts.\n" >> "${HOME}/.${CONF_FILE}"
-    chown ${USER} "${HOME}/.${CONF_FILE}" || echo "Warning: unable to adapt permissions on your ${HOME}/.${CONF_FILE} shell configuration file!"
-    echo "An appropriate ${1} variable has been added to your shell environment by the MacPorts installer."
-}
-
-function cleanup_man () {
-    # Remove old non-compressed man pages
-    echo -e "\nRemoving old man pages..."
-    MAN1="port.1"
-    MAN5="macports.conf.5"
-    MAN7="portfile.7 portstyle.7 porthier.7 portgroup.7"
-    for m in ${MAN1}; do rm -vf ${MANPAGES}/man1/$m ; done
-    for m in ${MAN5}; do rm -vf ${MANPAGES}/man5/$m ; done
-    for m in ${MAN7}; do rm -vf ${MANPAGES}/man7/$m ; done
-    echo -e "Done.\n"
-}
-
-# Delete the old registry1.0 directory
-function delete_reg1 {
-    if [[ -d ${REG1DIR} ]]; then
-        rm -vrf ${REG1DIR}
-    fi
-}
-
-# link macports1.0 into tcl package dir if possible
-function link_tcl_package {
-    # delete old directory if present
-    if [[ ! -L "${TCL_PACKAGE_DIR}/macports1.0" ]]; then
-        if [[ ! -e "${TCL_PACKAGE_DIR}" ]]; then
-            /usr/bin/install -d "${TCL_PACKAGE_DIR}" || true
-        fi
-        if [[ -d "${TCL_PACKAGE_DIR}/macports1.0" ]]; then
-            rm -vrf "${TCL_PACKAGE_DIR}/macports1.0" || true
-        fi
-        if [[ ! -e "${TCL_PACKAGE_DIR}/macports1.0" && -d "${TCL_PACKAGE_DIR}" ]]; then
-            ln -vs "${MACPORTS_TCL_DIR}/macports1.0" "${TCL_PACKAGE_DIR}/macports1.0" || true
-        fi
-	fi
-}
-
-# create the user to use for privilege dropping
-function create_run_user {
-    DSEDITGROUP=/usr/sbin/dseditgroup
-    if ! ${DSCL} -q . -read /Groups/${RUNUSR} > /dev/null 2>&1 ; then
-        echo "Creating group \"${RUNUSR}\""
-        ${DSEDITGROUP} -q -o create ${RUNUSR}
-    fi
-    if ! ${DSCL} -q . -list /Users/${RUNUSR} > /dev/null 2>&1 ; then
-        echo "Creating user \"${RUNUSR}\""
-        NEXTUID=501
-        while [[ -n "`${DSCL} -q /Search -search /Users UniqueID $NEXTUID`" ]]; do
-            let "NEXTUID=NEXTUID+1"
-        done
-        ${DSCL} -q . -create /Users/${RUNUSR} UniqueID $NEXTUID
-
-        # These are implicitly added on Mac OSX Lion.  AuthenticationAuthority
-        # causes the user to be visible in the Users & Groups Preference Pane,
-        # and the others are just noise, so delete them.
-        # https://trac.macports.org/ticket/30168
-        ${DSCL} -q . -delete /Users/${RUNUSR} AuthenticationAuthority
-        ${DSCL} -q . -delete /Users/${RUNUSR} PasswordPolicyOptions
-        ${DSCL} -q . -delete /Users/${RUNUSR} dsAttrTypeNative:KerberosKeys
-        ${DSCL} -q . -delete /Users/${RUNUSR} dsAttrTypeNative:ShadowHashData
-
-        ${DSCL} -q . -create /Users/${RUNUSR} RealName MacPorts
-        ${DSCL} -q . -create /Users/${RUNUSR} Password \*
-        ${DSCL} -q . -create /Users/${RUNUSR} PrimaryGroupID $(${DSCL} -q . -read /Groups/${RUNUSR} PrimaryGroupID | /usr/bin/awk '{print $2}')
-        ${DSCL} -q . -create /Users/${RUNUSR} NFSHomeDirectory ${PREFIX}/var/macports/home
-        ${DSCL} -q . -create /Users/${RUNUSR} UserShell /usr/bin/false
-    fi
-    if [[ $(sw_vers -productVersion | /usr/bin/awk -F . '{print $2}') -eq 4 ]]; then
-        GID=$(${DSCL} -q . -read /Groups/${RUNUSR} PrimaryGroupID | /usr/bin/awk '{print $2}')
-        if [[ "$(${DSCL} -q . -read /Users/${RUNUSR} PrimaryGroupID 2>/dev/null | /usr/bin/awk '{print $2}')" != "$GID" ]]; then
-            echo "Fixing PrimaryGroupID for user \"${RUNUSR}\""
-            ${DSCL} -q . -create /Users/${RUNUSR} PrimaryGroupID $GID
-            ${DSCL} -q . -create /Users/${RUNUSR} RealName MacPorts
-        fi
-    fi
-    if [[ "$(${DSCL} -q . -read /Users/${RUNUSR} NFSHomeDirectory)" = "NFSHomeDirectory: /var/empty" ]]; then
-        echo "Updating home directory location for user \"${RUNUSR}\""
-        ${DSCL} -q . -create /Users/${RUNUSR} NFSHomeDirectory ${PREFIX}/var/macports/home
-    fi
-}
-
-echo "The MacPorts Project, postflight script version ${VERSION}: checking the shell environment for user \"${USER}\"."
-
-# create macports user
-create_run_user
-# Set up config files
-setup_configs
-# link macports1.0 pkg
-link_tcl_package
-
-# Remove old stuff
-cleanup_man
-delete_reg1
-
-# Determine the user's shell, in order to choose an appropriate configuration file we'll be tweaking.
-# Exit nicely if the shell is any other than bash or tcsh, as that's considered non-standard.
-USHELL=$(${DSCL} . -read /Users/${USER} shell | awk -F'/' '{print $NF}') || {
-    echo "An attempt to determine your shell name failed! Please set your MacPorts compatible environment manually."
-    update_macports
-    exit 1
-}
-case "${USHELL}" in
-    tcsh)
-        echo "Detected the tcsh shell."
-        LOGIN_FLAG=""
-        ENV_COMMAND="setenv"
-        ASSIGN=" "
-        if [[ -f "${HOME}/.tcshrc" ]]; then
-            CONF_FILE=tcshrc
-        elif [[ -f "${HOME}/.cshrc" ]]; then
-            CONF_FILE=cshrc
-        else
-            CONF_FILE=tcshrc
-        fi
-        ;;
-    bash)
-        echo "Detected the bash shell."
-        LOGIN_FLAG="-l"
-        ENV_COMMAND="export"
-        ASSIGN="="
-        if [[ -f "${HOME}/.bash_profile" ]]; then
-            CONF_FILE=bash_profile
-        elif [[ -f "${HOME}/.bash_login" ]]; then
-            CONF_FILE=bash_login
-        else
-            CONF_FILE=profile
-        fi
-        ;;
-    *)
-        echo "Unknown shell ($USHELL)! Please set your MacPorts compatible environment manually."
-        update_macports
-        exit 0
-        ;;
-esac
-
-
-# Adding our setting to the PATH variable if not already there:
-if ${SHELL} ${LOGIN_FLAG} -c "/usr/bin/printenv PATH" | grep ${PREFIX} > /dev/null; then
-    echo "Your shell already has the right PATH environment variable for use with MacPorts!"
-else
-    write_setting PATH "${BINPATH}:${SBINPATH}:\$PATH"
-fi
-
-# We gather the path into a variable of our own for faster operation:
-ORIGINAL_MANPATH="$(${SHELL} ${LOGIN_FLAG} -c "/usr/bin/printenv MANPATH")"
-# Adding our setting to the MANPATH variable only if it exists:
-if ! ${SHELL} ${LOGIN_FLAG} -c "/usr/bin/env | grep MANPATH" > /dev/null || \
-# and following that, if it's not empty:
-  [[ -z "${ORIGINAL_MANPATH}" ]] || \
-# or if it doesn't already contain our path:
-  echo "${ORIGINAL_MANPATH}" | grep ${MANPAGES} > /dev/null || \
-# or if there's no empty component somewhere in the middle of it:
-  echo "${ORIGINAL_MANPATH}" | grep :: > /dev/null || \
-# or at the start of it:
-  [[ -z "$(echo "${ORIGINAL_MANPATH}" | awk -F : '{print $1}')" ]] || \
-# or at the end of it:
-  [[ -z "$(echo "${ORIGINAL_MANPATH}" | awk -F : '{print $NF}')" ]]; then
-    echo "Your shell already has the right MANPATH environment variable for use with MacPorts!"
-else
-    write_setting MANPATH "${MANPAGES}:\$MANPATH"
-fi
-
-# Adding a DISPLAY variable only if we're running on Tiger or less and if it doesn't already exist:
-if (($(sw_vers -productVersion | awk -F . '{print $2}') >= 5)) || ${SHELL} ${LOGIN_FLAG} -c "/usr/bin/env | grep DISPLAY" > /dev/null; then
-    echo "Your shell already has the right DISPLAY environment variable for use with MacPorts!"
-else
-    write_setting DISPLAY ":0"
-fi
-
-
-# Postflight script is done with its job, update MacPorts and exit gracefully!
-update_macports
-echo "You have successfully installed the MacPorts system. Launch a terminal and try it out!"
-echo "Read the port(1) manual page and http://guide.macports.org/ for help."
-echo "See http://www.macports.org/contact.php if you need to get in touch with The MacPorts Project."
-exit 0

Copied: branches/new-help-system/base/portmgr/dmg/postflight.in (from rev 122997, trunk/base/portmgr/dmg/postflight.in)
===================================================================
--- branches/new-help-system/base/portmgr/dmg/postflight.in	                        (rev 0)
+++ branches/new-help-system/base/portmgr/dmg/postflight.in	2014-08-03 15:04:12 UTC (rev 122999)
@@ -0,0 +1,278 @@
+#!/bin/bash
+# -*- coding: utf-8; mode: shell-script-mode; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=sh:et:sw=4:ts=4:sts=4
+#
+# Copyright (c) 2008-2012 The MacPorts Project
+# Copyright (c) 2002-2007 Juan Manuel Palacios <jmpp at macports.org>, The MacPorts Project.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+# 3. Neither the name of The MacPorts Project nor the
+#    names of its contributors may be used to endorse or promote products
+#    derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# postflight
+# $Id$
+
+
+#set -x
+
+# Script identification ('cause more often than not the svn Id is not expanded):
+VERSION=2.3.1
+
+# Abstraction variables:
+PREFIX=@prefix@
+BINPATH=${PREFIX}/bin
+SBINPATH=${PREFIX}/sbin
+CONFIGPATH=${PREFIX}/etc/macports
+MANPAGES=${PREFIX}/share/man
+DSCL=/usr/bin/dscl
+RUNUSR=macports
+TCLSH=@TCLSH@
+TCL_PACKAGE_PATH=@TCL_PACKAGE_PATH@
+TIMESTAMP=$(date +"%Y-%m-%d_at_%H:%M:%S")
+BACKUP_SUFFIX=macports-saved_${TIMESTAMP}
+OUR_STRING="MacPorts Installer addition on ${TIMESTAMP}"
+
+OLD_MACPORTS_TCL_DIR=${PREFIX}/share/macports/Tcl
+OLD_TCL_PACKAGE_DIR=/Library/Tcl
+
+# Create config files from defaults if not present
+function setup_configs {
+    for f in archive_sites.conf macports.conf pubkeys.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
+    done
+}
+
+# Command to update the MacPorts installation through "selfupdate":
+function update_macports {
+    SCRIPT_DIR=$(dirname $0)
+    # Add [default] tag to the central MacPorts repository, if it isn't already
+    echo "Adding [default] tag to sources.conf if needed..."
+    ${TCLSH} ${SCRIPT_DIR}/upgrade_sources_conf_default.tcl ${PREFIX}
+    # Convert image directories (and direct mode installs) to image archives
+    echo "Updating port image format..."
+    ${TCLSH} ${SCRIPT_DIR}/images_to_archives.tcl
+    ${TCLSH} ${SCRIPT_DIR}/dedup_portfiles.tcl
+
+    echo "Synchronizing the MacPorts installation with the project's rsync server..."
+    if ! ${BINPATH}/port -v selfupdate; then 
+        echo "An attempt to synchronize your recent MacPorts installation with the project's rsync server failed!"
+        echo "Please run 'sudo port -d selfupdate' manually to find out the cause of the error."
+    else
+        echo "Successful!"
+    fi
+}
+
+# Through this command we write an environment variable to an appropriate shell configuration file,
+# backing up the original only if it exists and if it doesn't contain the ${OUR_STRING} identification string,
+# which hints that we've already tweaked it and therefore already backed it up.
+function write_setting () {
+    if [[ -f "${HOME}/.${CONF_FILE}" ]] && ! grep "${OUR_STRING}" "${HOME}/.${CONF_FILE}" > /dev/null; then
+        echo "Backing up your ${HOME}/.${CONF_FILE} shell confguration file as ${HOME}/.${CONF_FILE}.${BACKUP_SUFFIX} before adapting it for MacPorts."
+        /bin/cp -fp "${HOME}/.${CONF_FILE}" "${HOME}/.${CONF_FILE}.${BACKUP_SUFFIX}" || {
+            echo "An attempt to backup your original configuration file failed! Please set your MacPorts compatible environment manually."
+            update_macports
+            exit 1
+        }
+        echo -e "\n##\n# Your previous ${HOME}/.${CONF_FILE} file was backed up as ${HOME}/.${CONF_FILE}.${BACKUP_SUFFIX}\n##" >> "${HOME}/.${CONF_FILE}"
+    fi
+    echo -e "\n# ${OUR_STRING}: adding an appropriate ${1} variable for use with MacPorts." >> "${HOME}/.${CONF_FILE}"
+    echo "${ENV_COMMAND} ${1}${ASSIGN}${2}" >> "${HOME}/.${CONF_FILE}"
+    echo -e "# Finished adapting your ${1} environment variable for use with MacPorts.\n" >> "${HOME}/.${CONF_FILE}"
+    chown ${USER} "${HOME}/.${CONF_FILE}" || echo "Warning: unable to adapt permissions on your ${HOME}/.${CONF_FILE} shell configuration file!"
+    echo "An appropriate ${1} variable has been added to your shell environment by the MacPorts installer."
+}
+
+function cleanup_man () {
+    # Remove old non-compressed man pages
+    echo -e "\nRemoving old man pages..."
+    MAN1="port.1"
+    MAN5="macports.conf.5"
+    MAN7="portfile.7 portstyle.7 porthier.7 portgroup.7"
+    for m in ${MAN1}; do rm -vf ${MANPAGES}/man1/$m ; done
+    for m in ${MAN5}; do rm -vf ${MANPAGES}/man5/$m ; done
+    for m in ${MAN7}; do rm -vf ${MANPAGES}/man7/$m ; done
+    echo -e "Done.\n"
+}
+
+# delete macports1.0 link from old tcl package dir
+function delete_old_tcl_package_link {
+    # delete old link if present
+    if [[ -e "${OLD_TCL_PACKAGE_DIR}/macports1.0" ]]; then
+        rm -vrf "${OLD_TCL_PACKAGE_DIR}/macports1.0"
+	fi
+
+    # delete old macports1.0 link from new tcl package dir if present
+    if [[ -L "${TCL_PACKAGE_PATH}/macports1.0" ]]; then
+        rm -vrf "${TCL_PACKAGE_PATH}/macports1.0"
+    fi
+}
+
+# delete the old tcl package location in share/macports/Tcl
+function delete_old_tcl_packages {
+    if [[ -d "${OLD_MACPORTS_TCL_DIR}" ]]; then
+        rm -vrf "${OLD_MACPORTS_TCL_DIR}"
+    fi
+}
+
+# create the user to use for privilege dropping
+function create_run_user {
+    DSEDITGROUP=/usr/sbin/dseditgroup
+    if ! ${DSCL} -q . -read /Groups/${RUNUSR} > /dev/null 2>&1 ; then
+        echo "Creating group \"${RUNUSR}\""
+        ${DSEDITGROUP} -q -o create ${RUNUSR}
+    fi
+    if ! ${DSCL} -q . -list /Users/${RUNUSR} > /dev/null 2>&1 ; then
+        echo "Creating user \"${RUNUSR}\""
+        NEXTUID=501
+        while [[ -n "`${DSCL} -q /Search -search /Users UniqueID $NEXTUID`" ]]; do
+            let "NEXTUID=NEXTUID+1"
+        done
+        ${DSCL} -q . -create /Users/${RUNUSR} UniqueID $NEXTUID
+
+        # These are implicitly added on Mac OSX Lion.  AuthenticationAuthority
+        # causes the user to be visible in the Users & Groups Preference Pane,
+        # and the others are just noise, so delete them.
+        # https://trac.macports.org/ticket/30168
+        ${DSCL} -q . -delete /Users/${RUNUSR} AuthenticationAuthority
+        ${DSCL} -q . -delete /Users/${RUNUSR} PasswordPolicyOptions
+        ${DSCL} -q . -delete /Users/${RUNUSR} dsAttrTypeNative:KerberosKeys
+        ${DSCL} -q . -delete /Users/${RUNUSR} dsAttrTypeNative:ShadowHashData
+
+        ${DSCL} -q . -create /Users/${RUNUSR} RealName MacPorts
+        ${DSCL} -q . -create /Users/${RUNUSR} Password \*
+        ${DSCL} -q . -create /Users/${RUNUSR} PrimaryGroupID $(${DSCL} -q . -read /Groups/${RUNUSR} PrimaryGroupID | /usr/bin/awk '{print $2}')
+        ${DSCL} -q . -create /Users/${RUNUSR} NFSHomeDirectory ${PREFIX}/var/macports/home
+        ${DSCL} -q . -create /Users/${RUNUSR} UserShell /usr/bin/false
+    fi
+    if [[ $(sw_vers -productVersion | /usr/bin/awk -F . '{print $2}') -eq 4 ]]; then
+        GID=$(${DSCL} -q . -read /Groups/${RUNUSR} PrimaryGroupID | /usr/bin/awk '{print $2}')
+        if [[ "$(${DSCL} -q . -read /Users/${RUNUSR} PrimaryGroupID 2>/dev/null | /usr/bin/awk '{print $2}')" != "$GID" ]]; then
+            echo "Fixing PrimaryGroupID for user \"${RUNUSR}\""
+            ${DSCL} -q . -create /Users/${RUNUSR} PrimaryGroupID $GID
+            ${DSCL} -q . -create /Users/${RUNUSR} RealName MacPorts
+        fi
+    fi
+    if [[ "$(${DSCL} -q . -read /Users/${RUNUSR} NFSHomeDirectory)" = "NFSHomeDirectory: /var/empty" ]]; then
+        echo "Updating home directory location for user \"${RUNUSR}\""
+        ${DSCL} -q . -create /Users/${RUNUSR} NFSHomeDirectory ${PREFIX}/var/macports/home
+    fi
+}
+
+echo "The MacPorts Project, postflight script version ${VERSION}: checking the shell environment for user \"${USER}\"."
+
+# create macports user
+create_run_user
+# Set up config files
+setup_configs
+
+# Remove old stuff
+cleanup_man
+delete_old_tcl_package_link
+delete_old_tcl_packages
+
+# Determine the user's shell, in order to choose an appropriate configuration file we'll be tweaking.
+# Exit nicely if the shell is any other than bash or tcsh, as that's considered non-standard.
+USHELL=$(${DSCL} . -read /Users/${USER} shell | awk -F'/' '{print $NF}') || {
+    echo "An attempt to determine your shell name failed! Please set your MacPorts compatible environment manually."
+    update_macports
+    exit 1
+}
+case "${USHELL}" in
+    tcsh)
+        echo "Detected the tcsh shell."
+        LOGIN_FLAG=""
+        ENV_COMMAND="setenv"
+        ASSIGN=" "
+        if [[ -f "${HOME}/.tcshrc" ]]; then
+            CONF_FILE=tcshrc
+        elif [[ -f "${HOME}/.cshrc" ]]; then
+            CONF_FILE=cshrc
+        else
+            CONF_FILE=tcshrc
+        fi
+        ;;
+    bash)
+        echo "Detected the bash shell."
+        LOGIN_FLAG="-l"
+        ENV_COMMAND="export"
+        ASSIGN="="
+        if [[ -f "${HOME}/.bash_profile" ]]; then
+            CONF_FILE=bash_profile
+        elif [[ -f "${HOME}/.bash_login" ]]; then
+            CONF_FILE=bash_login
+        else
+            CONF_FILE=profile
+        fi
+        ;;
+    *)
+        echo "Unknown shell ($USHELL)! Please set your MacPorts compatible environment manually."
+        update_macports
+        exit 0
+        ;;
+esac
+
+
+# Adding our setting to the PATH variable if not already there:
+if ${SHELL} ${LOGIN_FLAG} -c "/usr/bin/printenv PATH" | grep ${PREFIX} > /dev/null; then
+    echo "Your shell already has the right PATH environment variable for use with MacPorts!"
+else
+    write_setting PATH "\"${BINPATH}:${SBINPATH}:\$PATH\""
+fi
+
+# We gather the path into a variable of our own for faster operation:
+ORIGINAL_MANPATH="$(${SHELL} ${LOGIN_FLAG} -c "/usr/bin/printenv MANPATH")"
+# Adding our setting to the MANPATH variable only if it exists:
+if ! ${SHELL} ${LOGIN_FLAG} -c "/usr/bin/env | grep MANPATH" > /dev/null || \
+# and following that, if it's not empty:
+  [[ -z "${ORIGINAL_MANPATH}" ]] || \
+# or if it doesn't already contain our path:
+  echo "${ORIGINAL_MANPATH}" | grep ${MANPAGES} > /dev/null || \
+# or if there's no empty component somewhere in the middle of it:
+  echo "${ORIGINAL_MANPATH}" | grep :: > /dev/null || \
+# or at the start of it:
+  [[ -z "$(echo "${ORIGINAL_MANPATH}" | awk -F : '{print $1}')" ]] || \
+# or at the end of it:
+  [[ -z "$(echo "${ORIGINAL_MANPATH}" | awk -F : '{print $NF}')" ]]; then
+    echo "Your shell already has the right MANPATH environment variable for use with MacPorts!"
+else
+    write_setting MANPATH "\"${MANPAGES}:\$MANPATH\""
+fi
+
+# Adding a DISPLAY variable only if we're running on Tiger or less and if it doesn't already exist:
+if (($(sw_vers -productVersion | awk -F . '{print $2}') >= 5)) || ${SHELL} ${LOGIN_FLAG} -c "/usr/bin/env | grep DISPLAY" > /dev/null; then
+    echo "Your shell already has the right DISPLAY environment variable for use with MacPorts!"
+else
+    write_setting DISPLAY ":0"
+fi
+
+
+# Postflight script is done with its job, update MacPorts and exit gracefully!
+update_macports
+echo "You have successfully installed the MacPorts system. Launch a terminal and try it out!"
+echo "Read the port(1) manual page and http://guide.macports.org/ for help."
+echo "See http://www.macports.org/contact.php if you need to get in touch with The MacPorts Project."
+exit 0

Modified: branches/new-help-system/base/portmgr/jobs/Makefile
===================================================================
--- branches/new-help-system/base/portmgr/jobs/Makefile	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/portmgr/jobs/Makefile	2014-08-03 15:04:12 UTC (rev 122999)
@@ -3,7 +3,7 @@
 SCRIPTS=	PortIndex2MySQL
 
 edit = sed \
-	-e 's, at macports_tcl_dir@,$(macports_tcl_dir),g'
+	-e 's, at TCLSH@,$(TCLSH),g'
 
 
 include ../../Mk/macports.autoconf.mk

Modified: branches/new-help-system/base/portmgr/jobs/PortIndex2MySQL.tcl
===================================================================
--- branches/new-help-system/base/portmgr/jobs/PortIndex2MySQL.tcl	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/portmgr/jobs/PortIndex2MySQL.tcl	2014-08-03 15:04:12 UTC (rev 122999)
@@ -1,4 +1,4 @@
-#!/opt/local/bin/tclsh
+#!/opt/local/bin/port-tclsh
 # -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4
 #
 # PortIndex2MySQL.tcl
@@ -58,18 +58,31 @@
 #####
 
 
+# Configuration variables. Fill in the blank strings.
+#
+# Email addresses that get failure notifications - e.g. "admin at macosforge.org"
+set SPAM_LOVERS ""
+# File to read the db password from - e.g. "/var/macports/script_data"
+set passwdfile ""
+# Database abstraction variables:
+# name of the mysql executable
+set mysql_exe "mysql"
+# path where the mysql executable is located (only needed if not in the default PATH)
+set mysql_exe_path ""
+set sqlfile "/tmp/portsdb.sql"
+set portsdb_host localhost
+set portsdb_name macports
+set portsdb_user macports
 
-# Runtime information log file and reciepient.
+# Runtime information log file and recipient.
 set runlog "/tmp/portsdb.log"
 set runlog_fd [open $runlog w+]
 set lockfile "/tmp/portsdb.lock"
 set mailprog "/usr/sbin/sendmail"
 set DATE [clock format [clock seconds] -format "%A %Y-%m-%d at %T"]
 
-#set SPAM_LOVERS example at hostname.com
-
 set SUBJECT "PortIndex2MySQL run failure on $DATE"
-set FROM macports-mgr at lists.macosforge.org
+set FROM noreply at macports.org
 set HEADERS "To: $SPAM_LOVERS\r\nFrom: $FROM\r\nSubject: $SUBJECT\r\n\r\n"
 
 # handle command line arguments
@@ -141,6 +154,12 @@
 
 # Procedure to catch the database password from a protected file.
 proc getpasswd {passwdfile} {
+    if {$passwdfile eq ""} {
+        global lockfile lockfile_fd
+        ui_error "passwdfile is empty, did you forget to set it?"
+        cleanup lockfile
+        terminate 1
+    }
     if {[catch {open $passwdfile r} passwdfile_fd]} {
         global lockfile lockfile_fd
         ui_error "${::errorCode}: $passwdfile_fd"
@@ -178,12 +197,6 @@
 }
 
 # Load macports1.0 so that we can use some of its procs and the portinfo array.
-if {[catch { source [file join "@macports_tcl_dir@" macports1.0 macports_fastload.tcl] } errstr]} {
-    puts $runlog_fd "${::errorInfo}"
-    puts $runlog_fd "Failed to locate the macports1.0 Tcl package file: $errstr"
-    cleanup lockfile
-    terminate 1
-}
 if {[catch { package require macports } errstr]} {
     puts $runlog_fd "${::errorInfo}"
     puts $runlog_fd "Failed to load the macports1.0 Tcl package: $errstr"
@@ -203,14 +216,8 @@
 }
 
 
-# Database abstraction variables:
-set sqlfile "/tmp/portsdb.sql"
-set portsdb_host localhost
-set portsdb_name macports
-set portsdb_user macports
-set passwdfile "/opt/local/share/macports/resources/portmgr/password_file"
 set portsdb_passwd [getpasswd $passwdfile]
-set portsdb_cmd [macports::findBinary mysql5]
+set portsdb_cmd [macports::findBinary $mysql_exe $mysql_exe_path]
 
 
 # Flat text file to which sql statements are written.

Modified: branches/new-help-system/base/portmgr/jobs/port_binary_distributable.tcl
===================================================================
--- branches/new-help-system/base/portmgr/jobs/port_binary_distributable.tcl	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/portmgr/jobs/port_binary_distributable.tcl	2014-08-03 15:04:12 UTC (rev 122999)
@@ -1,6 +1,7 @@
-#!/usr/bin/tclsh
+#!/bin/sh
 # -*- 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
-#
+# \
+if type -fp port-tclsh >/dev/null; then exec port-tclsh "$0" "$@"; else exec /usr/bin/tclsh "$0" "$@"; fi
 # $Id$
 #
 # Check that binaries of a port are distributable by looking at its license
@@ -311,7 +312,6 @@
     set ::argv [lrange $::argv 1 end]
 }
 
-source ${macportsTclPath}/macports1.0/macports_fastload.tcl
 package require macports
 mportinit
 


Property changes on: branches/new-help-system/base/src
___________________________________________________________________
Modified: svn:ignore
   - config.h
Makefile
pkg_mkindex.sh

   + config.h
Makefile
pkg_mkindex.sh
dedup_portfiles.tcl
images_to_archives.tcl
upgrade_sources_conf_default.tcl


Modified: branches/new-help-system/base/src/Makefile.in
===================================================================
--- branches/new-help-system/base/src/Makefile.in	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/Makefile.in	2014-08-03 15:04:12 UTC (rev 122999)
@@ -1,5 +1,7 @@
-TCLPKG=		@OUR_INCLUDED_PACKAGES@ \
-			cregistry \
+srcdir = @srcdir@
+VPATH  = @srcdir@
+
+TCLPKG=		cregistry \
 			registry2.0 \
 			macports1.0 \
 			port1.0 \
@@ -18,7 +20,8 @@
 	rm -f config.h
 	rm -f Makefile
 	rm -f pkg_mkindex.sh
+	rm -f dedup_portfiles.tcl images_to_archives.tcl upgrade_sources_conf_default.tcl
 
 test::
 
-include ../Mk/macports.subdir.mk
+include $(srcdir)/../Mk/macports.subdir.mk


Property changes on: branches/new-help-system/base/src/cflib1.0
___________________________________________________________________
Added: svn:ignore
   + Makefile


Deleted: branches/new-help-system/base/src/cflib1.0/Makefile
===================================================================
--- branches/new-help-system/base/src/cflib1.0/Makefile	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/cflib1.0/Makefile	2014-08-03 15:04:12 UTC (rev 122999)
@@ -1,7 +0,0 @@
-OBJS=		CFLib.o
-SHLIB_NAME=	CFLib${SHLIB_SUFFIX}
-LIBS+=		-framework CoreFoundation
-INSTALLDIR= ${DESTDIR}${datadir}/macports/Tcl/cflib1.0
-
-include ../../Mk/macports.autoconf.mk
-include ../../Mk/macports.tea.mk

Copied: branches/new-help-system/base/src/cflib1.0/Makefile.in (from rev 122997, trunk/base/src/cflib1.0/Makefile.in)
===================================================================
--- branches/new-help-system/base/src/cflib1.0/Makefile.in	                        (rev 0)
+++ branches/new-help-system/base/src/cflib1.0/Makefile.in	2014-08-03 15:04:12 UTC (rev 122999)
@@ -0,0 +1,11 @@
+srcdir = @srcdir@
+VPATH  = @srcdir@
+
+include ../../Mk/macports.autoconf.mk
+
+OBJS=		CFLib.o
+SHLIB_NAME=	CFLib${SHLIB_SUFFIX}
+LIBS+=		-framework CoreFoundation
+INSTALLDIR= ${DESTDIR}${TCL_PACKAGE_PATH}/cflib1.0
+
+include $(srcdir)/../../Mk/macports.tea.mk

Modified: branches/new-help-system/base/src/config.h.in
===================================================================
--- branches/new-help-system/base/src/config.h.in	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/config.h.in	2014-08-03 15:04:12 UTC (rev 122999)
@@ -259,6 +259,9 @@
 /* Define to 1 if you have the <utime.h> header file. */
 #undef HAVE_UTIME_H
 
+/* Define to 1 if you have the `__getdirentries64' function. */
+#undef HAVE___GETDIRENTRIES64
+
 /* Lowest non-system-reserved GID. */
 #undef MIN_USABLE_GID
 


Property changes on: branches/new-help-system/base/src/cregistry
___________________________________________________________________
Modified: svn:ignore
   - cregistry.a
macports.sqlext

   + Makefile
cregistry.a
macports.sqlext


Deleted: branches/new-help-system/base/src/cregistry/Makefile
===================================================================
--- branches/new-help-system/base/src/cregistry/Makefile	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/cregistry/Makefile	2014-08-03 15:04:12 UTC (rev 122999)
@@ -1,31 +0,0 @@
-# $Id$
-
-OBJS = registry.o entry.o sql.o vercomp.o util.o file.o
-STLIB_NAME = cregistry.a
-RANLIB = ranlib
-
-SQLEXT_NAME = macports.sqlext
-SQLEXT_OBJS = sqlext.o vercomp.o
-
-include ../../Mk/macports.autoconf.mk
-
-all:: ${STLIB_NAME} ${SQLEXT_NAME}
-
-.c.o:
-	${CC} -c -DUSE_TCL_STUBS ${CFLAGS} ${CPPFLAGS} ${SHLIB_CFLAGS} $< -o $@
-
-${STLIB_NAME}:: ${OBJS}
-	${STLIB_LD} ${STLIB_NAME} ${OBJS}
-	${RANLIB} ${STLIB_NAME}
-
-${SQLEXT_NAME}: ${SQLEXT_OBJS}
-	${SHLIB_LD} ${SQLEXT_OBJS} -o $@
-
-clean::
-	rm -f ${STLIB_NAME} ${SQLEXT_NAME} ${SQLEXT_OBJS} ${OBJS}
-
-distclean:: clean
-
-test:
-
-install:: all

Copied: branches/new-help-system/base/src/cregistry/Makefile.in (from rev 122997, trunk/base/src/cregistry/Makefile.in)
===================================================================
--- branches/new-help-system/base/src/cregistry/Makefile.in	                        (rev 0)
+++ branches/new-help-system/base/src/cregistry/Makefile.in	2014-08-03 15:04:12 UTC (rev 122999)
@@ -0,0 +1,38 @@
+# $Id$
+
+srcdir = @srcdir@
+VPATH  = @srcdir@
+
+OBJS = registry.o entry.o sql.o vercomp.o util.o file.o portgroup.o
+STLIB_NAME = cregistry.a
+RANLIB = ranlib
+
+SQLEXT_NAME = macports.sqlext
+SQLEXT_OBJS = sqlext.o vercomp.o
+
+include ../../Mk/macports.autoconf.mk
+
+# required for strdup(3) on Linux and OS X
+CPPFLAGS+=-D_XOPEN_SOURCE=600
+
+all:: ${STLIB_NAME} ${SQLEXT_NAME}
+
+.c.o:
+	${CC} -c -DUSE_TCL_STUBS ${CFLAGS} ${CPPFLAGS} ${SHLIB_CFLAGS} $< -o $@
+
+${STLIB_NAME}:: ${OBJS}
+	${STLIB_LD} ${STLIB_NAME} ${OBJS}
+	${RANLIB} ${STLIB_NAME}
+
+${SQLEXT_NAME}: ${SQLEXT_OBJS}
+	${SHLIB_LD} ${SQLEXT_OBJS} -o $@
+
+clean::
+	rm -f ${STLIB_NAME} ${SQLEXT_NAME} ${SQLEXT_OBJS} ${OBJS}
+
+distclean:: clean
+	rm -f Makefile
+
+test:
+
+install:: all

Modified: branches/new-help-system/base/src/cregistry/entry.c
===================================================================
--- branches/new-help-system/base/src/cregistry/entry.c	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/cregistry/entry.c	2014-08-03 15:04:12 UTC (rev 122999)
@@ -2,7 +2,7 @@
  * entry.c
  * $Id$
  *
- * Copyright (c) 2010-2011 The MacPorts Project
+ * Copyright (c) 2010-2011, 2014 The MacPorts Project
  * Copyright (c) 2007 Chris Pickel <sfiera at macports.org>
  * All rights reserved.
  *
@@ -31,6 +31,7 @@
 #include <config.h>
 #endif
 
+#include "portgroup.h"
 #include "entry.h"
 #include "registry.h"
 #include "sql.h"
@@ -246,9 +247,11 @@
     sqlite3_stmt* ports = NULL;
     sqlite3_stmt* files = NULL;
     sqlite3_stmt* dependencies = NULL;
+    sqlite3_stmt* portgroups = 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=?";
+    char* portgroups_query = "DELETE FROM registry.portgroups WHERE id=?";
     if ((sqlite3_prepare_v2(reg->db, ports_query, -1, &ports, NULL) == SQLITE_OK)
             && (sqlite3_bind_int64(ports, 1, entry->id) == SQLITE_OK)
             && (sqlite3_prepare_v2(reg->db, files_query, -1, &files, NULL)
@@ -256,7 +259,10 @@
             && (sqlite3_bind_int64(files, 1, entry->id) == SQLITE_OK)
             && (sqlite3_prepare_v2(reg->db, dependencies_query, -1, &dependencies,
                     NULL) == SQLITE_OK)
-            && (sqlite3_bind_int64(dependencies, 1, entry->id) == SQLITE_OK)) {
+            && (sqlite3_bind_int64(dependencies, 1, entry->id) == SQLITE_OK)
+            && (sqlite3_prepare_v2(reg->db, portgroups_query, -1, &portgroups,
+                    NULL) == SQLITE_OK)
+            && (sqlite3_bind_int64(portgroups, 1, entry->id) == SQLITE_OK)) {
         int r;
         do {
             r = sqlite3_step(ports);
@@ -271,7 +277,20 @@
                                         r = sqlite3_step(dependencies);
                                         switch (r) {
                                             case SQLITE_DONE:
-                                                result = 1;
+                                                do {
+                                                    r = sqlite3_step(portgroups);
+                                                    switch (r) {
+                                                        case SQLITE_DONE:
+                                                            result = 1;
+                                                            break;
+                                                        case SQLITE_BUSY:
+                                                            break;
+                                                        case SQLITE_ERROR:
+                                                            reg_sqlite_error(reg->db,
+                                                                    errPtr, NULL);
+                                                            break;
+                                                    }
+                                                } while (r == SQLITE_BUSY);
                                                 break;
                                             case SQLITE_BUSY:
                                                 break;
@@ -315,6 +334,9 @@
     if (dependencies) {
         sqlite3_finalize(dependencies);
     }
+    if (portgroups) {
+        sqlite3_finalize(portgroups);
+    }
     return result;
 }
 
@@ -670,6 +692,73 @@
 }
 
 /**
+ * Associates a portgroup with given port.
+ *
+ * @param [in] entry      the entry to map the portgroup to
+ * @param [in] name       the portgroup name (e.g. "muniversal")
+ * @param [in] version    the portgroup version (e.g. "1.0")
+ * @param [in] sha256     the sha256 hash of the portgroup file
+ * @param [in] size       the size of the portgroup file in bytes
+ * @param [out] errPtr    on error, a description of the error that occurred
+ * @return                true if success; false if failure
+ */
+int reg_entry_addgroup(reg_entry* entry, char* name, char *version,
+        char *sha256, sqlite_int64 size, reg_error* errPtr) {
+    reg_registry* reg = entry->reg;
+    int result = 1;
+    sqlite3_stmt* stmt = NULL;
+    char* insert = "INSERT INTO registry.portgroups (id, name, version, size, sha256) "
+        "VALUES (?, ?, ?, ?, ?)";
+    if ((sqlite3_prepare_v2(reg->db, insert, -1, &stmt, NULL) == SQLITE_OK)
+            && (sqlite3_bind_int64(stmt, 1, entry->id) == SQLITE_OK)
+            && (sqlite3_bind_text(stmt, 2, name, -1, SQLITE_STATIC) == SQLITE_OK)
+            && (sqlite3_bind_text(stmt, 3, version, -1, SQLITE_STATIC) == SQLITE_OK)
+            && (sqlite3_bind_int64(stmt, 4, size) == SQLITE_OK)
+            && (sqlite3_bind_text(stmt, 5, sha256, -1, SQLITE_STATIC) == SQLITE_OK)) {
+        int r;
+        do {
+            r = sqlite3_step(stmt);
+            switch (r) {
+                case SQLITE_DONE:
+                    sqlite3_reset(stmt);
+                    break;
+                case SQLITE_BUSY:
+                    break;
+                default:
+                    reg_sqlite_error(reg->db, errPtr, insert);
+                    result = 0;
+                    break;
+            }
+        } while (r == SQLITE_BUSY);
+    } else {
+        reg_sqlite_error(reg->db, errPtr, insert);
+        result = 0;
+    }
+    if (stmt) {
+        sqlite3_finalize(stmt);
+    }
+    return result;
+}
+
+/**
+ * Gets a list of portgroups that are used by this port.
+ *
+ * @param [in] entry       a port
+ * @param [out] portgroups a list of portgroups used by the given port
+ * @param [out] errPtr     on error, a description of the error that occurred
+ * @return                 true if success; false if failure
+ */
+int reg_entry_getgroups(reg_entry* entry, reg_portgroup*** portgroups, reg_error* errPtr) {
+    reg_registry* reg = entry->reg;
+    char* query = sqlite3_mprintf("SELECT ROWID FROM portgroups "
+            "WHERE id=%lld",
+            entry->id);
+    int result = reg_all_portgroups(reg, query, -1, portgroups, errPtr);
+    sqlite3_free(query);
+    return result;
+}
+
+/**
  * Maps files to the given port in the filemap. The list of files must not
  * contain files that are already mapped to the given port.
  *
@@ -1179,7 +1268,7 @@
     int entry_space = 10;
     Tcl_HashEntry* hash;
     Tcl_HashSearch search;
-    *entries = malloc(10*sizeof(void*));
+    *entries = malloc(entry_space * sizeof(reg_entry*));
     if (!*entries) {
         return -1;
     }

Modified: branches/new-help-system/base/src/cregistry/entry.h
===================================================================
--- branches/new-help-system/base/src/cregistry/entry.h	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/cregistry/entry.h	2014-08-03 15:04:12 UTC (rev 122999)
@@ -71,6 +71,11 @@
 int reg_entry_propset(reg_entry* entry, char* key, char* value,
         reg_error* errPtr);
 
+int reg_entry_addgroup(reg_entry* entry, char* name, char *version,
+        char *sha256, sqlite_int64 size, reg_error* errPtr);
+int reg_entry_getgroups(reg_entry* entry, reg_portgroup*** portgroups,
+        reg_error* errPtr);
+
 int reg_entry_map(reg_entry* entry, char** files, int file_count,
         reg_error* errPtr);
 int reg_entry_unmap(reg_entry* entry, char** files, int file_count,

Modified: branches/new-help-system/base/src/cregistry/file.c
===================================================================
--- branches/new-help-system/base/src/cregistry/file.c	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/cregistry/file.c	2014-08-03 15:04:12 UTC (rev 122999)
@@ -336,7 +336,7 @@
     int file_space = 10;
     Tcl_HashEntry* hash;
     Tcl_HashSearch search;
-    *files = malloc(10 * sizeof(void*));
+    *files = malloc(file_space * sizeof(reg_file*));
     if (!*files) {
         return -1;
     }

Copied: branches/new-help-system/base/src/cregistry/portgroup.c (from rev 122997, trunk/base/src/cregistry/portgroup.c)
===================================================================
--- branches/new-help-system/base/src/cregistry/portgroup.c	                        (rev 0)
+++ branches/new-help-system/base/src/cregistry/portgroup.c	2014-08-03 15:04:12 UTC (rev 122999)
@@ -0,0 +1,318 @@
+/*
+ * vim:tw=80:expandtab
+ * $Id$
+ *
+ * Copyright (c) 2014 The MacPorts Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "portgroup.h"
+#include "util.h"
+#include "registry.h"
+#include "sql.h"
+
+#include <sqlite3.h>
+#include <stdlib.h>
+#include <string.h>
+
+/**
+ * Converts a `sqlite3_stmt` into a `reg_portgroup`. The first column of the stmt's
+ * row must be the id of a portgroup; the second either `SQLITE_NULL` or the
+ * address of the entry in memory.
+ *
+ * @param [in] userdata sqlite3 database
+ * @param [out] portgroup   portgroup described by `stmt`
+ * @param [in] stmt     `sqlite3_stmt` with appropriate columns
+ * @param [out] errPtr  unused
+ * @return              true if success; false if failure
+ */
+static int reg_stmt_to_portgroup(void* userdata, void** portgroup, void* stmt,
+        void* calldata UNUSED, reg_error* errPtr UNUSED) {
+    int is_new;
+    reg_registry* reg = (reg_registry*)userdata;
+    sqlite_int64 id = sqlite3_column_int64(stmt, 0);
+    Tcl_HashEntry* hash = Tcl_CreateHashEntry(&reg->open_portgroups,
+            (const char*)&id, &is_new);
+    if (is_new) {
+        reg_portgroup* p = malloc(sizeof(reg_portgroup));
+        if (!p) {
+            return 0;
+        }
+        p->reg = reg;
+        p->id = id;
+        p->proc = NULL;
+        *portgroup = p;
+        Tcl_SetHashValue(hash, p);
+    } else {
+        *portgroup = Tcl_GetHashValue(hash);
+    }
+    return 1;
+}
+
+/**
+ * Type-safe version of `reg_all_objects` for `reg_portgroup`.
+ *
+ * @param [in] reg       registry to select entries from
+ * @param [in] query     the select query to execute
+ * @param [in] query_len length of the query (or -1 for automatic)
+ * @param [out] objects  the portgroups selected
+ * @param [out] errPtr   on error, a description of the error that occurred
+ * @return               the number of entries if success; negative if failure
+ */
+int reg_all_portgroups(reg_registry* reg, char* query, int query_len,
+        reg_portgroup*** objects, reg_error* errPtr) {
+    int lower_bound = 0;
+    return reg_all_objects(reg, query, query_len, (void***)objects,
+            reg_stmt_to_portgroup, &lower_bound, NULL, errPtr);
+}
+
+/**
+ * Searches the registry for portgroups for which each key's value is equal to the
+ * given value. To find all portgroups, pass a key_count of 0.
+ *
+ * Bad keys should cause sqlite3 errors but not permit SQL injection attacks.
+ * Pass it good keys anyway.
+ *
+ * @param [in] reg       registry to search in
+ * @param [in] keys      a list of keys to search by
+ * @param [in] vals      a list of values to search by, matching keys
+ * @param [in] strats    a list of strategies to use when searching
+ * @param [in] key_count the number of key/value pairs passed
+ * @param [out] portgroups    a list of matching portgroups
+ * @param [out] errPtr   on error, a description of the error that occurred
+ * @return               the number of entries if success; false if failure
+ */
+int reg_portgroup_search(reg_registry* reg, char** keys, char** vals, int* strats,
+        int key_count, reg_portgroup*** portgroups, reg_error* errPtr) {
+    int i;
+    char* kwd = " WHERE ";
+    char* query;
+    size_t query_len, query_space;
+    int result;
+
+    /* build the query */
+    query = strdup("SELECT ROWID FROM registry.portgroups");
+    if (!query) {
+        return -1;
+    }
+    query_len = query_space = strlen(query);
+
+    for (i = 0; i < key_count; i++) {
+        char* op;
+        char* cond;
+
+        /* get the strategy */
+        if ((op = reg_strategy_op(strats[i], errPtr)) == NULL) {
+            free(query);
+            return -1;
+        }
+
+        cond = sqlite3_mprintf(op, keys[i], vals[i]);
+        if (!cond || !reg_strcat(&query, &query_len, &query_space, kwd)
+            || !reg_strcat(&query, &query_len, &query_space, cond)) {
+            free(query);
+            return -1;
+        }
+        sqlite3_free(cond);
+        kwd = " AND ";
+    }
+
+    /* do the query */
+    result = reg_all_portgroups(reg, query, -1, portgroups, errPtr);
+    free(query);
+    return result;
+}
+
+/**
+ * Gets a named property of a portgroup. That property can be set using
+ * `reg_portgroup_propset`. The property named must be one that exists in the table
+ * and must not be one with internal meaning such as `id` or `state`.
+ *
+ * @param [in] portgroup   portgroup to get property from
+ * @param [in] key     property to get
+ * @param [out] value  the value of the property
+ * @param [out] errPtr on error, a description of the error that occurred
+ * @return             true if success; false if failure
+ */
+int reg_portgroup_propget(reg_portgroup* portgroup, char* key, char** value,
+        reg_error* errPtr) {
+    reg_registry* reg = portgroup->reg;
+    int result = 0;
+    sqlite3_stmt* stmt = NULL;
+    char* query;
+    const char *text;
+    query = sqlite3_mprintf("SELECT %q FROM registry.portgroups WHERE ROWID=%lld", key,
+            portgroup->id);
+    if (sqlite3_prepare_v2(reg->db, query, -1, &stmt, NULL) == SQLITE_OK) {
+        int r;
+        do {
+            r = sqlite3_step(stmt);
+            switch (r) {
+                case SQLITE_ROW:
+                    text = (const char*)sqlite3_column_text(stmt, 0);
+                    if (text) {
+                        *value = strdup(text);
+                        result = 1;
+                    } else {
+                        reg_sqlite_error(reg->db, errPtr, query);
+                    }
+                    break;
+                case SQLITE_DONE:
+                    errPtr->code = REG_INVALID;
+                    errPtr->description = "an invalid portgroup was passed";
+                    errPtr->free = NULL;
+                    break;
+                case SQLITE_BUSY:
+                    continue;
+                default:
+                    reg_sqlite_error(reg->db, errPtr, query);
+                    break;
+            }
+        } while (r == SQLITE_BUSY);
+    } else {
+        reg_sqlite_error(reg->db, errPtr, query);
+    }
+    if (stmt) {
+        sqlite3_finalize(stmt);
+    }
+    sqlite3_free(query);
+    return result;
+}
+
+/**
+ * Sets a named property of an portgroup. That property can be later retrieved using
+ * `reg_portgroup_propget`. The property named must be one that exists in the table
+ * and must not be one with internal meaning such as `id` or `state`. If `name`,
+ * `epoch`, `version`, `revision`, or `variants` is set, it could trigger a
+ * conflict if another port with the same combination of values for those
+ * columns exists.
+ *
+ * @param [in] portgroup   portgroup to set property for
+ * @param [in] key     property to set
+ * @param [in] value   the desired value of the property
+ * @param [out] errPtr on error, a description of the error that occurred
+ * @return             true if success; false if failure
+ */
+int reg_portgroup_propset(reg_portgroup* portgroup, char* key, char* value,
+        reg_error* errPtr) {
+    reg_registry* reg = portgroup->reg;
+    int result = 0;
+    sqlite3_stmt* stmt = NULL;
+    char* query;
+    query = sqlite3_mprintf("UPDATE registry.ports SET %q = '%q' WHERE ROWID=%lld",
+            key, value, portgroup->id);
+    if (sqlite3_prepare_v2(reg->db, query, -1, &stmt, NULL) == SQLITE_OK) {
+        int r;
+        do {
+            r = sqlite3_step(stmt);
+            switch (r) {
+                case SQLITE_DONE:
+                    result = 1;
+                    break;
+                case SQLITE_BUSY:
+                    break;
+                default:
+                    if (sqlite3_reset(stmt) == SQLITE_CONSTRAINT) {
+                        errPtr->code = REG_CONSTRAINT;
+                        errPtr->description = "a constraint was disobeyed";
+                        errPtr->free = NULL;
+                    } else {
+                        reg_sqlite_error(reg->db, errPtr, query);
+                    }
+                    break;
+            }
+        } while (r == SQLITE_BUSY);
+    } else {
+        reg_sqlite_error(reg->db, errPtr, query);
+    }
+    if (stmt) {
+        sqlite3_finalize(stmt);
+    }
+    sqlite3_free(query);
+    return result;
+}
+
+/**
+ * Opens an existing portgroup in the registry.
+ *
+ * @param [in] reg      registry to open portgroup in
+ * @param [in] id       id of entry referencing portgroup
+ * @param [in] name     name of portgroup
+ * @param [in] version  version of portgroup
+ * @param [in] size     size of portgroup
+ * @param [in] sha256   sha256 of portgroup
+ * @param [out] errPtr  on error, a description of the error that occurred
+ * @return              the portgroup if success; NULL if failure
+ */
+reg_portgroup* reg_portgroup_open(reg_registry* reg, char *id, char* name, char* version,
+        char* size, char* sha256, reg_error* errPtr) {
+    sqlite3_stmt* stmt = NULL;
+    reg_portgroup* portgroup = NULL;
+    int lower_bound = 0;
+    char* query;
+    query = "SELECT ROWID FROM registry.portgroups WHERE id=? AND name=? AND version=? "
+        "AND size=? AND sha256=?";
+    if ((sqlite3_prepare_v2(reg->db, query, -1, &stmt, NULL) == SQLITE_OK)
+            && (sqlite3_bind_text(stmt, 1, id, -1, SQLITE_STATIC)
+                == SQLITE_OK)
+            && (sqlite3_bind_text(stmt, 2, name, -1, SQLITE_STATIC)
+                == SQLITE_OK)
+            && (sqlite3_bind_text(stmt, 3, version, -1, SQLITE_STATIC)
+                == SQLITE_OK)
+            && (sqlite3_bind_text(stmt, 4, size, -1, SQLITE_STATIC)
+                == SQLITE_OK)
+            && (sqlite3_bind_text(stmt, 5, sha256, -1, SQLITE_STATIC)
+                == SQLITE_OK)) {
+        int r;
+        do {
+            r = sqlite3_step(stmt);
+            switch (r) {
+                case SQLITE_ROW:
+                    reg_stmt_to_portgroup(reg, (void**)&portgroup, stmt, &lower_bound, errPtr);
+                    break;
+                case SQLITE_DONE:
+                    errPtr->code = REG_NOT_FOUND;
+                    errPtr->description = sqlite3_mprintf("no matching portgroup found for: " \
+                            "id=%s, name=%s, version=%s, size=%s, sha256=%s", \
+                            id, name, version, size, sha256);
+                    errPtr->free = (reg_error_destructor*) sqlite3_free;
+                    break;
+                case SQLITE_BUSY:
+                    continue;
+                default:
+                    reg_sqlite_error(reg->db, errPtr, query);
+                    break;
+            }
+        } while (r == SQLITE_BUSY);
+    } else {
+        reg_sqlite_error(reg->db, errPtr, query);
+    }
+    if (stmt) {
+        sqlite3_finalize(stmt);
+    }
+    return portgroup;
+}

Copied: branches/new-help-system/base/src/cregistry/portgroup.h (from rev 122997, trunk/base/src/cregistry/portgroup.h)
===================================================================
--- branches/new-help-system/base/src/cregistry/portgroup.h	                        (rev 0)
+++ branches/new-help-system/base/src/cregistry/portgroup.h	2014-08-03 15:04:12 UTC (rev 122999)
@@ -0,0 +1,56 @@
+/*
+ * vim:tw=80:expandtab
+ * $Id$
+ *
+ * Copyright (c) 2014 The MacPorts Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef _CPORTGROUP_H
+#define _CPORTGROUP_H
+
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "registry.h"
+
+#include <sqlite3.h>
+
+typedef struct {
+    sqlite_int64 id; /* rowid in the database */
+    reg_registry* reg; /* associated registry */
+    char* proc; /* name of Tcl proc, if using Tcl */
+} reg_portgroup;
+
+int reg_portgroup_search(reg_registry* reg, char** keys, char** vals, int* strats,
+        int key_count, reg_portgroup*** portgroups, reg_error* errPtr);
+int reg_all_portgroups(reg_registry* reg, char* query, int query_len,
+        reg_portgroup*** objects, reg_error* errPtr);
+reg_portgroup* reg_portgroup_open(reg_registry* reg, char *id, char* name, char* version,
+        char* size, char* sha256, reg_error* errPtr);
+int reg_portgroup_propget(reg_portgroup* portgroup, char* key, char** value,
+        reg_error* errPtr);
+int reg_portgroup_propset(reg_portgroup* portgroup, char* key, char* value,
+        reg_error* errPtr);
+
+#endif /* _CPORTGROUP_H */

Modified: branches/new-help-system/base/src/cregistry/registry.c
===================================================================
--- branches/new-help-system/base/src/cregistry/registry.c	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/cregistry/registry.c	2014-08-03 15:04:12 UTC (rev 122999)
@@ -4,7 +4,7 @@
  * vim:expandtab:tw=80
  *
  * Copyright (c) 2007 Chris Pickel <sfiera at macports.org>
- * Copyright (c) 2012 The MacPorts Project
+ * Copyright (c) 2012, 2014 The MacPorts Project
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -32,6 +32,7 @@
 #include <config.h>
 #endif
 
+#include "portgroup.h"
 #include "entry.h"
 #include "file.h"
 #include "sql.h"
@@ -53,6 +54,21 @@
  *       alive at any given time.
  */
 
+/*
+ * Error constants. Those need to be constants and cannot be string literals
+ * because we'll use address comparisons for those and compilers don't have to
+ * guarantee string literals always have the same address (they don't have to
+ * guarantee string literals will have an address at all, so comparing the
+ * address of a string with a string literal is undefined behavior).
+ */
+char *const registry_err_not_found      = "registry::not-found";
+char *const registry_err_invalid        = "registry::invalid";
+char *const registry_err_constraint     = "registry::constraint";
+char *const registry_err_sqlite_error   = "registry::sqlite-error";
+char *const registry_err_misuse         = "registry::misuse";
+char *const registry_err_cannot_init    = "registry::cannot-init";
+char *const registry_err_already_active = "registry::already-active";
+
 /**
  * Destroys a `reg_error` object. This should be called on any reg_error when a
  * registry function returns a failure condition; depending on the function,
@@ -208,6 +224,8 @@
                                     sizeof(sqlite_int64)/sizeof(int));
                             Tcl_InitHashTable(&reg->open_files,
                                     TCL_STRING_KEYS);
+                            Tcl_InitHashTable(&reg->open_portgroups,
+                                    sizeof(sqlite_int64)/sizeof(int));
                             reg->status |= reg_attached;
                             result = 1;
                         }
@@ -456,3 +474,147 @@
     sqlite3_close(db);
     return result;
 }
+
+/**
+ * Functions for access to the metadata table
+ */
+
+/**
+ * @param [in] reg     registry to get value from
+ * @param [in] key     metadata key to get
+ * @param [out] value  the value of the metadata
+ * @param [out] errPtr on error, a description of the error that occurred
+ * @return             true if success; false if failure
+ */
+int reg_get_metadata(reg_registry* reg, const char* key, char** value,
+        reg_error* errPtr) {
+    int result = 0;
+    sqlite3_stmt* stmt = NULL;
+    char* query = "SELECT value FROM registry.metadata WHERE key=?";
+    const char *text;
+    if (sqlite3_prepare_v2(reg->db, query, -1, &stmt, NULL) == SQLITE_OK
+            && (sqlite3_bind_text(stmt, 1, key, -1, SQLITE_STATIC) == SQLITE_OK)) {
+        int r;
+        do {
+            r = sqlite3_step(stmt);
+            switch (r) {
+                case SQLITE_ROW:
+                    text = (const char*)sqlite3_column_text(stmt, 0);
+                    if (text) {
+                        *value = strdup(text);
+                        result = 1;
+                    } else {
+                        reg_sqlite_error(reg->db, errPtr, query);
+                    }
+                    break;
+                case SQLITE_DONE:
+                    errPtr->code = REG_NOT_FOUND;
+                    errPtr->description = "no such key in metadata";
+                    errPtr->free = NULL;
+                    break;
+                case SQLITE_BUSY:
+                    continue;
+                default:
+                    reg_sqlite_error(reg->db, errPtr, query);
+                    break;
+            }
+        } while (r == SQLITE_BUSY);
+    } else {
+        reg_sqlite_error(reg->db, errPtr, query);
+    }
+    if (stmt) {
+        sqlite3_finalize(stmt);
+    }
+    return result;
+}
+
+/**
+ * @param [in] reg     registry to set value in
+ * @param [in] key     metadata key to set
+ * @param [in] value   the desired value for the key
+ * @param [out] errPtr on error, a description of the error that occurred
+ * @return             true if success; false if failure
+ */
+int reg_set_metadata(reg_registry* reg, const char* key, const char* value,
+        reg_error* errPtr) {
+    int result = 0;
+    sqlite3_stmt* stmt = NULL;
+    char* query;
+    char *test_value;
+    int get_returnval = reg_get_metadata(reg, key, &test_value, errPtr);
+    if (get_returnval) {
+        free(test_value);
+        query = sqlite3_mprintf("UPDATE registry.metadata SET value = '%q' WHERE key='%q'",
+            value, key);
+    } else if (errPtr->code == REG_NOT_FOUND) {
+        query = sqlite3_mprintf("INSERT INTO registry.metadata (key, value) VALUES ('%q', '%q')",
+            key, value);
+    } else {
+        return get_returnval;
+    }
+    if (sqlite3_prepare_v2(reg->db, query, -1, &stmt, NULL) == SQLITE_OK) {
+        int r;
+        do {
+            r = sqlite3_step(stmt);
+            switch (r) {
+                case SQLITE_DONE:
+                    result = 1;
+                    break;
+                case SQLITE_BUSY:
+                    break;
+                default:
+                    reg_sqlite_error(reg->db, errPtr, query);
+                    break;
+            }
+        } while (r == SQLITE_BUSY);
+    } else {
+        reg_sqlite_error(reg->db, errPtr, query);
+    }
+    if (stmt) {
+        sqlite3_finalize(stmt);
+    }
+    sqlite3_free(query);
+    return result;
+}
+
+/**
+ * @param [in] reg        the registry to delete the metadata from
+ * @param [in] key        the metadata key to delete
+ * @param [out] errPtr    on error, a description of the error that occurred
+ * @return                true if success; false if failure
+ */
+int reg_del_metadata(reg_registry* reg, const char* key, reg_error* errPtr) {
+    int result = 1;
+    sqlite3_stmt* stmt = NULL;
+    char* query = "DELETE FROM registry.metadata WHERE key=?";
+    if ((sqlite3_prepare_v2(reg->db, query, -1, &stmt, NULL) == SQLITE_OK)
+            && (sqlite3_bind_text(stmt, 1, key, -1, SQLITE_STATIC) == SQLITE_OK)) {
+        int r;
+        do {
+            r = sqlite3_step(stmt);
+            switch (r) {
+                case SQLITE_DONE:
+                    if (sqlite3_changes(reg->db) == 0) {
+                        reg_throw(errPtr, REG_INVALID, "no such metadata key");
+                        result = 0;
+                    } else {
+                        sqlite3_reset(stmt);
+                    }
+                    break;
+                case SQLITE_BUSY:
+                    break;
+                default:
+                    reg_sqlite_error(reg->db, errPtr, query);
+                    result = 0;
+                    break;
+            }
+        } while (r == SQLITE_BUSY);
+    } else {
+        reg_sqlite_error(reg->db, errPtr, query);
+        result = 0;
+    }
+    if (stmt) {
+        sqlite3_finalize(stmt);
+    }
+    return result;
+}

Modified: branches/new-help-system/base/src/cregistry/registry.h
===================================================================
--- branches/new-help-system/base/src/cregistry/registry.h	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/cregistry/registry.h	2014-08-03 15:04:12 UTC (rev 122999)
@@ -4,7 +4,7 @@
  * $Id$
  *
  * Copyright (c) 2007 Chris Pickel <sfiera at macports.org>
- * Copyright (c) 2012 The MacPorts Project
+ * Copyright (c) 2012, 2014 The MacPorts Project
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -37,14 +37,22 @@
 #include <sqlite3.h>
 #include <tcl.h>
 
-#define REG_NOT_FOUND       "registry::not-found"
-#define REG_INVALID         "registry::invalid"
-#define REG_CONSTRAINT      "registry::constraint"
-#define REG_SQLITE_ERROR    "registry::sqlite-error"
-#define REG_MISUSE          "registry::misuse"
-#define REG_CANNOT_INIT     "registry::cannot-init"
-#define REG_ALREADY_ACTIVE  "registry::already-active"
+#define REG_NOT_FOUND       (registry_err_not_found)
+#define REG_INVALID         (registry_err_invalid)
+#define REG_CONSTRAINT      (registry_err_constraint)
+#define REG_SQLITE_ERROR    (registry_err_sqlite_error)
+#define REG_MISUSE          (registry_err_misuse)
+#define REG_CANNOT_INIT     (registry_err_cannot_init)
+#define REG_ALREADY_ACTIVE  (registry_err_already_active)
 
+extern char *const registry_err_not_found;
+extern char *const registry_err_invalid;
+extern char *const registry_err_constraint;
+extern char *const registry_err_sqlite_error;
+extern char *const registry_err_misuse;
+extern char *const registry_err_cannot_init;
+extern char *const registry_err_already_active;
+
 typedef void reg_error_destructor(const char* description);
 
 typedef struct {
@@ -73,6 +81,7 @@
     int status;
     Tcl_HashTable open_entries;
     Tcl_HashTable open_files;
+    Tcl_HashTable open_portgroups;
 } reg_registry;
 
 int reg_open(reg_registry** regPtr, reg_error* errPtr);
@@ -88,4 +97,8 @@
 
 int reg_vacuum(char* db_path);
 
+int reg_get_metadata(reg_registry* reg, const char* key, char** value, reg_error* errPtr);
+int reg_set_metadata(reg_registry* reg, const char* key, const char* value, reg_error* errPtr);
+int reg_del_metadata(reg_registry* reg, const char* key, reg_error* errPtr);
+
 #endif /* _CREG_H */

Modified: branches/new-help-system/base/src/cregistry/sql.c
===================================================================
--- branches/new-help-system/base/src/cregistry/sql.c	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/cregistry/sql.c	2014-08-03 15:04:12 UTC (rev 122999)
@@ -3,7 +3,7 @@
  * $Id$
  *
  * Copyright (c) 2007 Chris Pickel <sfiera at macports.org>
- * Copyright (c) 2012 The MacPorts Project
+ * Copyright (c) 2012, 2014 The MacPorts Project
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -129,13 +129,13 @@
 
         /* metadata table */
         "CREATE TABLE registry.metadata (key UNIQUE, value)",
-        "INSERT INTO registry.metadata (key, value) VALUES ('version', 1.100)",
+        "INSERT INTO registry.metadata (key, value) VALUES ('version', '1.200')",
         "INSERT INTO registry.metadata (key, value) VALUES ('created', strftime('%s', 'now'))",
 
         /* ports table */
         "CREATE TABLE registry.ports ("
-            "id INTEGER PRIMARY KEY AUTOINCREMENT, "
-            "name TEXT COLLATE NOCASE, portfile CLOB, url TEXT, "
+            "id INTEGER PRIMARY KEY, "
+            "name TEXT COLLATE NOCASE, portfile TEXT, url TEXT, "
             "location TEXT, epoch INTEGER, version TEXT COLLATE VERSION, "
             "revision INTEGER, variants TEXT, negated_variants TEXT, "
             "state TEXT, date DATETIME, installtype TEXT, archs TEXT, "
@@ -163,6 +163,11 @@
         "FOREIGN KEY(id) REFERENCES ports(id))",
         "CREATE INDEX registry.dep_name ON dependencies (name)",
 
+        /* portgroups table */
+        "CREATE TABLE registry.portgroups (id INTEGER, "
+            "name TEXT, version TEXT COLLATE VERSION, size INTEGER, sha256 TEXT, "
+            "FOREIGN KEY(id) REFERENCES ports(id))",
+
         "COMMIT",
         NULL
     };
@@ -259,6 +264,10 @@
 
         /* we can't call vercmp directly because it's static, but we have
          * sql_version, which is basically an alias */
+        /* There was a bug where the registry version was set as a float
+         * instead of a string on fresh installs, so some 1.100 registries
+         * will say 1.1. Fortunately, there were no other versions between
+         * 1.000 and 1.100. */
         if (sql_version(NULL, -1, version, -1, "1.1") < 0) {
             /* we need to update to 1.1, add binary field and index to files
              * table */
@@ -321,6 +330,36 @@
             continue;
         }
 
+        if (sql_version(NULL, -1, version, -1, "1.200") < 0) {
+            /* We need to add the portgroup table and move the portfiles out
+               of the db and into the filesystem. The latter is way easier to do
+               from Tcl, so here we'll just flag that it needs to be done. */
+            static char* version_1_2_queries[] = {
+                /* portgroups table */
+                "CREATE TABLE registry.portgroups (id INTEGER, "
+                    "name TEXT, version TEXT COLLATE VERSION, size INTEGER, sha256 TEXT, "
+                    "FOREIGN KEY(id) REFERENCES ports(id))",
+
+                "UPDATE registry.metadata SET value = '1.200' WHERE key = 'version'",
+
+                "INSERT INTO registry.metadata (key, value) VALUES ('portfiles_update_needed', 1)",
+
+                "COMMIT",
+                NULL
+            };
+
+            sqlite3_finalize(stmt);
+            stmt = NULL;
+
+            if (!do_queries(db, version_1_2_queries, errPtr)) {
+                rollback_db(db);
+                return 0;
+            }
+
+            did_update = 1;
+            continue;
+        }
+
         /* add new versions here, but remember to:
          *  - finalize the version query statement and set stmt to NULL
          *  - do _not_ use "BEGIN" in your query list, since a transaction has


Property changes on: branches/new-help-system/base/src/darwintracelib1.0
___________________________________________________________________
Modified: svn:ignore
   - darwintrace.dylib

   + Makefile
darwintrace.dylib


Deleted: branches/new-help-system/base/src/darwintracelib1.0/Makefile
===================================================================
--- branches/new-help-system/base/src/darwintracelib1.0/Makefile	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/darwintracelib1.0/Makefile	2014-08-03 15:04:12 UTC (rev 122999)
@@ -1,30 +0,0 @@
-# This Makefile will only be run on Darwin systems; we can safely use
-# Apple-specifics here
-SRCS=		$(wildcard *.c)
-OBJS=		$(SRCS:%.c=%.o)
-SHLIB_NAME=	darwintrace${SHLIB_SUFFIX}
-INSTALLDIR=	${DESTDIR}${datadir}/macports/Tcl/darwintrace1.0
-
-include ../../Mk/macports.autoconf.mk
-
-# Yes, we know having $ signs in identifiers is not a very good idea; in the
-# case of darwintrace we still need them, though.
-CFLAGS_PEDANTIC=
-CFLAGS+= -fPIC ${UNIVERSAL_ARCHFLAGS}
-SHLIB_LDFLAGS+=${UNIVERSAL_ARCHFLAGS}
-
-all:: ${SHLIB_NAME}
-
-$(SHLIB_NAME):: ${OBJS}
-	${SHLIB_LD} ${OBJS} -o ${SHLIB_NAME} ${SHLIB_LDFLAGS} ${LIBS}
-
-clean::
-	rm -f ${OBJS} ${SHLIB_NAME} so_locations
-
-distclean:: clean
-
-install:: all
-	$(INSTALL) -d -o ${DSTUSR} -g ${DSTGRP} -m ${DSTMODE} ${INSTALLDIR}
-	$(INSTALL) -o ${DSTUSR} -g ${DSTGRP} -m 444 ${SHLIB_NAME} ${INSTALLDIR}
-
-test::

Copied: branches/new-help-system/base/src/darwintracelib1.0/Makefile.in (from rev 122997, trunk/base/src/darwintracelib1.0/Makefile.in)
===================================================================
--- branches/new-help-system/base/src/darwintracelib1.0/Makefile.in	                        (rev 0)
+++ branches/new-help-system/base/src/darwintracelib1.0/Makefile.in	2014-08-03 15:04:12 UTC (rev 122999)
@@ -0,0 +1,34 @@
+srcdir = @srcdir@
+VPATH  = @srcdir@
+
+include ../../Mk/macports.autoconf.mk
+
+# This Makefile will only be run on Darwin systems; we can safely use
+# Apple-specifics here
+SRCS=		$(wildcard *.c)
+OBJS=		$(SRCS:%.c=%.o)
+SHLIB_NAME=	darwintrace${SHLIB_SUFFIX}
+INSTALLDIR=	${DESTDIR}${TCL_PACKAGE_PATH}/darwintrace1.0
+
+# Yes, we know having $ signs in identifiers is not a very good idea; in the
+# case of darwintrace we still need them, though.
+CFLAGS_PEDANTIC=
+CFLAGS+= -fPIC ${UNIVERSAL_ARCHFLAGS}
+SHLIB_LDFLAGS+=${UNIVERSAL_ARCHFLAGS}
+
+all:: ${SHLIB_NAME}
+
+$(SHLIB_NAME):: ${OBJS}
+	${SHLIB_LD} ${OBJS} -o ${SHLIB_NAME} ${SHLIB_LDFLAGS} ${LIBS}
+
+clean::
+	rm -f ${OBJS} ${SHLIB_NAME} so_locations
+
+distclean:: clean
+	rm -f Makefile
+
+install:: all
+	$(INSTALL) -d -o "${DSTUSR}" -g "${DSTGRP}" -m "${DSTMODE}" "${INSTALLDIR}"
+	$(INSTALL)    -o "${DSTUSR}" -g "${DSTGRP}" -m 444 "${SHLIB_NAME}" "${INSTALLDIR}"
+
+test::

Modified: branches/new-help-system/base/src/darwintracelib1.0/access.c
===================================================================
--- branches/new-help-system/base/src/darwintracelib1.0/access.c	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/darwintracelib1.0/access.c	2014-08-03 15:04:12 UTC (rev 122999)
@@ -41,7 +41,7 @@
 #include <sys/syscall.h>
 #include <unistd.h>
 
-int access(const char *path, int amode) {
+static int _dt_access(const char *path, int amode) {
 #define access(x, y) syscall(SYS_access, (x), (y))
 	__darwintrace_setup();
 
@@ -59,3 +59,5 @@
 	return result;
 #undef access
 }
+
+DARWINTRACE_INTERPOSE(_dt_access, access);

Modified: branches/new-help-system/base/src/darwintracelib1.0/close.c
===================================================================
--- branches/new-help-system/base/src/darwintracelib1.0/close.c	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/darwintracelib1.0/close.c	2014-08-03 15:04:12 UTC (rev 122999)
@@ -50,7 +50,7 @@
  * need to. This possibility is the \c __darwintrace_close_sock variable, which
  * will be set to the FD to be closed when closing should be allowed.
  */
-int close(int fd) {
+static int _dt_close(int fd) {
 #define close(x) syscall(SYS_close, (x))
 	__darwintrace_setup();
 
@@ -66,3 +66,5 @@
 	return close(fd);
 #undef close
 }
+
+DARWINTRACE_INTERPOSE(_dt_close, close);

Modified: branches/new-help-system/base/src/darwintracelib1.0/darwintrace.c
===================================================================
--- branches/new-help-system/base/src/darwintracelib1.0/darwintrace.c	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/darwintracelib1.0/darwintrace.c	2014-08-03 15:04:12 UTC (rev 122999)
@@ -154,9 +154,11 @@
 /**
  * Convenience getter function for the thread ID
  */
+/*
 static inline pthread_t __darwintrace_tid() {
 	return (pthread_t) pthread_getspecific(tid_key);
 }
+*/
 
 /**
  * Convenience setter function for the thread-local darwintrace socket

Modified: branches/new-help-system/base/src/darwintracelib1.0/darwintrace.h
===================================================================
--- branches/new-help-system/base/src/darwintracelib1.0/darwintrace.h	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/darwintracelib1.0/darwintrace.h	2014-08-03 15:04:12 UTC (rev 122999)
@@ -44,6 +44,22 @@
 #include <stdio.h>
 
 /**
+ * DARWINTRACE_INTERPOSE: provides a way to override standard library functions
+ * with your own implementations.
+ */
+#ifndef DARWINTRACE_INTERPOSE
+#define DARWINTRACE_INTERPOSE(_replacement, _replacee) \
+__attribute__((used)) static struct { \
+	const void *replacement; \
+	const void *replacee; \
+} _interpose_##_replacee \
+__attribute__((section ("__DATA,__interpose"))) = { \
+	(const void *) (unsigned long) &_replacement, \
+	(const void *) (unsigned long) &_replacee \
+}
+#endif
+
+/**
  * DARWINTRACE_DEBUG: verbose output of operations to debug darwintrace
  */
 #ifndef DARWINTRACE_DEBUG

Modified: branches/new-help-system/base/src/darwintracelib1.0/dup2.c
===================================================================
--- branches/new-help-system/base/src/darwintracelib1.0/dup2.c	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/darwintracelib1.0/dup2.c	2014-08-03 15:04:12 UTC (rev 122999)
@@ -48,7 +48,7 @@
  * attempts to overwrite it using \c dup(2). Shells tend to do that a lot when
  * FDs are numbered in ascending order.
  */
-int dup2(int filedes, int filedes2) {
+static int _dt_dup2(int filedes, int filedes2) {
 #define dup2(x, y) syscall(SYS_dup2, (x), (y))
 	__darwintrace_setup();
 
@@ -75,3 +75,5 @@
 	return dup2(filedes, filedes2);
 #undef dup2
 }
+
+DARWINTRACE_INTERPOSE(_dt_dup2, dup2);

Modified: branches/new-help-system/base/src/darwintracelib1.0/mkdir.c
===================================================================
--- branches/new-help-system/base/src/darwintracelib1.0/mkdir.c	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/darwintracelib1.0/mkdir.c	2014-08-03 15:04:12 UTC (rev 122999)
@@ -53,7 +53,7 @@
  * the sandbox. Will silently do nothing and return success for directories
  * outside the sandbox that already exist.
  */
-int mkdir(const char *path, mode_t mode) {
+static int _dt_mkdir(const char *path, mode_t mode) {
 #define mkdir(x,y) syscall(SYS_mkdir, (x), (y))
 #define lstat(x,y) syscall(LSTATSYSNUM, (x), (y))
 	__darwintrace_setup();
@@ -78,3 +78,5 @@
 #undef lstat
 #undef mkdir
 }
+
+DARWINTRACE_INTERPOSE(_dt_mkdir, mkdir);

Modified: branches/new-help-system/base/src/darwintracelib1.0/open.c
===================================================================
--- branches/new-help-system/base/src/darwintracelib1.0/open.c	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/darwintracelib1.0/open.c	2014-08-03 15:04:12 UTC (rev 122999)
@@ -48,7 +48,7 @@
  * Indicates the file does not exist on sandbox violation, or permission denied
  * when attempting to create a file, i.e., when \c O_CREAT is set.
  */
-int open(const char *path, int flags, ...) {
+static int _dt_open(const char *path, int flags, ...) {
 #define open(x,y,z) syscall(SYS_open, (x), (y), (z))
 	__darwintrace_setup();
 	int result = 0;
@@ -70,3 +70,5 @@
 	return result;
 #undef open
 }
+
+DARWINTRACE_INTERPOSE(_dt_open, open);

Modified: branches/new-help-system/base/src/darwintracelib1.0/proc.c
===================================================================
--- branches/new-help-system/base/src/darwintracelib1.0/proc.c	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/darwintracelib1.0/proc.c	2014-08-03 15:04:12 UTC (rev 122999)
@@ -254,7 +254,7 @@
  * exist, if it's outside the sandbox. Also checks for potential interpreters
  * using \c check_interpreter.
  */
-int execve(const char *path, char *const argv[], char *const envp[]) {
+static int _dt_execve(const char *path, char *const argv[], char *const envp[]) {
 #define execve(x,y,z) syscall(SYS_execve, (x), (y), (z))
 	__darwintrace_setup();
 
@@ -289,25 +289,18 @@
 #undef execve
 }
 
+DARWINTRACE_INTERPOSE(_dt_execve, execve);
+
 #if defined(HAVE_SPAWN_H) && defined(HAVE_POSIX_SPAWN)
-// Let's save some typing work...
-typedef int (*posix_spawn_t)(
-			pid_t *restrict,
-			const char *restrict,
-			const posix_spawn_file_actions_t *,
-			const posix_spawnattr_t *restrict,
-			char *const *restrict,
-			char *const *restrict);
 /**
  * Wrapper for \c posix_spawn(2). Denies access and simulates the file does not
  * exist, if it's outside the sandbox. Also checks for potential interpreters
  * using \c check_interpreter.
  */
-int posix_spawn(pid_t *restrict pid, const char *restrict path, const posix_spawn_file_actions_t *file_actions,
+static int _dt_posix_spawn(pid_t *restrict pid, const char *restrict path, const posix_spawn_file_actions_t *file_actions,
 		const posix_spawnattr_t *restrict attrp, char *const argv[restrict], char *const envp[restrict]) {
 	__darwintrace_setup();
 
-	static posix_spawn_t prev_posix_spawn = NULL;
 	int result = 0;
 
 	if (!__darwintrace_is_in_sandbox(path, DT_REPORT | DT_ALLOWDIR | DT_FOLLOWSYMS)) {
@@ -339,13 +332,9 @@
 			 * We cannot override posix_spawn and call __posix_spawn from it
 			 * either, because that will fail with an invalid argument. Thus,
 			 * we need to call the original posix_spawn from here. */
-			// retrieve the original posix_spawn function
-			if (prev_posix_spawn == NULL) {
-				prev_posix_spawn = (posix_spawn_t) dlsym(RTLD_NEXT, "posix_spawn");
-			}
 			// call the original posix_spawn function, but restore environment
 			char **newenv = restore_env(envp);
-			result = prev_posix_spawn(pid, path, file_actions, attrp, argv, newenv);
+			result = posix_spawn(pid, path, file_actions, attrp, argv, newenv);
 			free(newenv);
 		}
 	}
@@ -354,4 +343,6 @@
 
 	return result;
 }
+
+DARWINTRACE_INTERPOSE(_dt_posix_spawn, posix_spawn);
 #endif

Modified: branches/new-help-system/base/src/darwintracelib1.0/readdir.c
===================================================================
--- branches/new-help-system/base/src/darwintracelib1.0/readdir.c	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/darwintracelib1.0/readdir.c	2014-08-03 15:04:12 UTC (rev 122999)
@@ -55,7 +55,7 @@
  * thus copy both structs and decide at runtime.
  */
 
-#if defined(__DARWIN_64_BIT_INO_T)
+#if defined(__DARWIN_64_BIT_INO_T) && defined(HAVE___GETDIRENTRIES64)
 
 struct dirent64  {
 	__uint64_t  d_ino;      /* file number of entry */
@@ -66,7 +66,7 @@
 	char      d_name[__DARWIN_MAXPATHLEN]; /* entry name (up to MAXPATHLEN bytes) */
 };
 
-size_t __getdirentries64(int fd, void *buf, size_t bufsize, __darwin_off_t *basep) {
+static size_t _dt_getdirentries64(int fd, void *buf, size_t bufsize, __darwin_off_t *basep) {
 #define __getdirentries64(w,x,y,z) syscall(SYS_getdirentries64, (w), (x), (y), (z))
 	__darwintrace_setup();
 
@@ -105,8 +105,12 @@
 #undef __getdirentries64
 }
 
-#endif /* defined(__DARWIN_64_BIT_INO_T) */
+// __getdirentries64(2) is private API. There's no header for it.
+size_t __getdirentries64(int fd, void *buf, size_t bufsize, __darwin_off_t *basep);
+DARWINTRACE_INTERPOSE(_dt_getdirentries64, __getdirentries64);
 
+#endif /* defined(__DARWIN_64_BIT_INO_T) && defined(HAVE___GETDIRENTRIES64) */
+
 #pragma pack(4)
 struct dirent32 {
 	ino_t d_ino;            /* file number of entry */
@@ -117,7 +121,7 @@
 };
 #pragma pack()
 
-int getdirentries(int fd, char *buf, int nbytes, long *basep) {
+static int _dt_getdirentries(int fd, char *buf, int nbytes, long *basep) {
 #define getdirentries(w,x,y,z) syscall(SYS_getdirentries, (w), (x), (y), (z))
 	__darwintrace_setup();
 
@@ -154,3 +158,6 @@
 	return sz;
 #undef getdirentries
 }
+
+int getdirentries(int fd, char *buf, int nbytes, long *basep);
+DARWINTRACE_INTERPOSE(_dt_getdirentries, getdirentries);

Modified: branches/new-help-system/base/src/darwintracelib1.0/readlink.c
===================================================================
--- branches/new-help-system/base/src/darwintracelib1.0/readlink.c	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/darwintracelib1.0/readlink.c	2014-08-03 15:04:12 UTC (rev 122999)
@@ -46,9 +46,9 @@
  * Deny \c readlink(2) if the file is not within the sandbox bounds.
  */
 #ifdef READLINK_IS_NOT_P1003_1A
-int readlink(const char *path, char *buf, int bufsiz) {
+static int _dt_readlink(const char *path, char *buf, int bufsiz) {
 #else
-ssize_t readlink(const char *path, char *buf, size_t bufsiz) {
+static ssize_t _dt_readlink(const char *path, char *buf, size_t bufsiz) {
 #endif
 #define readlink(x,y,z) syscall(SYS_readlink, (x), (y), (z))
 	__darwintrace_setup();
@@ -69,3 +69,5 @@
 	return result;
 #undef readlink
 }
+
+DARWINTRACE_INTERPOSE(_dt_readlink, readlink);

Modified: branches/new-help-system/base/src/darwintracelib1.0/rename.c
===================================================================
--- branches/new-help-system/base/src/darwintracelib1.0/rename.c	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/darwintracelib1.0/rename.c	2014-08-03 15:04:12 UTC (rev 122999)
@@ -46,7 +46,7 @@
  * Wrapper around \c rename(2) to prevent moving a file outside, or out of the
  * sandbox.
  */
-int rename(const char *from, const char *to) {
+static int _dt_rename(const char *from, const char *to) {
 #define rename(x,y) syscall(SYS_rename, (x), (y))
 	__darwintrace_setup();
 
@@ -67,3 +67,5 @@
 	return result;
 #undef rename
 }
+
+DARWINTRACE_INTERPOSE(_dt_rename, rename);

Modified: branches/new-help-system/base/src/darwintracelib1.0/rmdir.c
===================================================================
--- branches/new-help-system/base/src/darwintracelib1.0/rmdir.c	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/darwintracelib1.0/rmdir.c	2014-08-03 15:04:12 UTC (rev 122999)
@@ -46,7 +46,7 @@
  * Wrapper around \c rmdir(2) to deny deleting directories outside of the
  * sandbox.
  */
-int rmdir(const char *path) {
+static int _dt_rmdir(const char *path) {
 #define rmdir(x) syscall(SYS_rmdir, (x))
 	__darwintrace_setup();
 
@@ -64,3 +64,5 @@
 	return result;
 #undef rmdir
 }
+
+DARWINTRACE_INTERPOSE(_dt_rmdir, rmdir);

Modified: branches/new-help-system/base/src/darwintracelib1.0/stat.c
===================================================================
--- branches/new-help-system/base/src/darwintracelib1.0/stat.c	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/darwintracelib1.0/stat.c	2014-08-03 15:04:12 UTC (rev 122999)
@@ -47,7 +47,7 @@
  * Wrapper around \c stat(2) to hide information about files outside the
  * sandbox.
  */
-int stat(const char *path, void *sb) {
+static int _dt_stat(const char *path, void *sb) {
 #define stat(path, sb) syscall(SYS_stat, path, sb)
 	__darwintrace_setup();
 
@@ -66,9 +66,14 @@
 #undef stat
 }
 
+// We don't include sys/stat.h because it would rewrite all stat function
+// calls, but we need the declaration of stat here.
+int stat(const char *path, void *sb);
+DARWINTRACE_INTERPOSE(_dt_stat, stat);
+
 // Don't provide stat64 on systems that have no stat64 syscall
 #ifdef SYS_stat64
-int stat64(const char *path, void *sb) {
+static int _dt_stat64(const char *path, void *sb) {
 #define stat64(path, sb) syscall(SYS_stat64, path, sb)
 	__darwintrace_setup();
 
@@ -86,13 +91,15 @@
 	return result;
 #undef stat64
 }
+int stat64(const char *path, void *sb);
+DARWINTRACE_INTERPOSE(_dt_stat64, stat64);
 
-int stat$INODE64(const char *path, void *sb) {
-	return stat64(path, sb);
-}
+int stat$INODE64(const char *path, void *sb);
+DARWINTRACE_INTERPOSE(_dt_stat64, stat$INODE64);
+
 #endif /* defined(SYS_stat64) */
 
-int lstat(const char *path, void *sb) {
+static int _dt_lstat(const char *path, void *sb) {
 #define lstat(path, sb) syscall(SYS_lstat, path, sb)
 	__darwintrace_setup();
 
@@ -112,9 +119,12 @@
 #undef lstat
 }
 
+int lstat(const char *path, void *sb);
+DARWINTRACE_INTERPOSE(_dt_lstat, lstat);
+
 // Don't provide lstat64 on systems that have no lstat64 syscall
 #ifdef SYS_lstat64
-int lstat64(const char *path, void *sb) {
+static int _dt_lstat64(const char *path, void *sb) {
 #define lstat64(path, sb) syscall(SYS_lstat64, path, sb)
 	__darwintrace_setup();
 
@@ -134,7 +144,10 @@
 #undef lstat64
 }
 
-int lstat$INODE64(const char *path, void *sb) {
-	return lstat64(path, sb);
-}
+int lstat64(const char *path, void *sb);
+DARWINTRACE_INTERPOSE(_dt_lstat64, lstat64);
+
+int lstat$INODE64(const char *path, void *sb);
+DARWINTRACE_INTERPOSE(_dt_lstat64, lstat$INODE64);
+
 #endif /* defined(SYS_lstat64) */

Modified: branches/new-help-system/base/src/darwintracelib1.0/unlink.c
===================================================================
--- branches/new-help-system/base/src/darwintracelib1.0/unlink.c	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/darwintracelib1.0/unlink.c	2014-08-03 15:04:12 UTC (rev 122999)
@@ -46,7 +46,7 @@
  * Wrapper around \c unlink(2) that will deny attempts to delete files outside
  * of the sandbox and simulate non-existence of the file instead.
  */
-int unlink(const char *path) {
+static int _dt_unlink(const char *path) {
 #define unlink(x) syscall(SYS_unlink, (x))
 	__darwintrace_setup();
 
@@ -64,3 +64,5 @@
 	return result;
 #undef unlink
 }
+
+DARWINTRACE_INTERPOSE(_dt_unlink, unlink);

Copied: branches/new-help-system/base/src/dedup_portfiles.tcl.in (from rev 122997, trunk/base/src/dedup_portfiles.tcl.in)
===================================================================
--- branches/new-help-system/base/src/dedup_portfiles.tcl.in	                        (rev 0)
+++ branches/new-help-system/base/src/dedup_portfiles.tcl.in	2014-08-03 15:04:12 UTC (rev 122999)
@@ -0,0 +1,46 @@
+#!@TCLSH@
+# -*- 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
+# $Id$
+
+# move portfiles from sqlite db to filesystem, while deduplicating
+# Takes one argument, which should be TCL_PACKAGE_DIR.
+
+package require macports 1.0
+package require registry2 2.0
+package require Pextlib 1.0
+
+umask 022
+
+array set ui_options {ports_verbose yes}
+
+mportinit ui_options
+
+if {[registry::metadata get portfiles_update_needed] == 1} {
+    set portfiles_dir [file join ${macports::registry.path} registry portfiles]
+
+    registry::write {
+        set installed_ports [registry::entry imaged]
+        foreach portref $installed_ports {
+            set portfile_contents [$portref portfile]
+            if {$portfile_contents ne "" && $portfile_contents ne "0"} {
+                set portfile_partial_dir [file join $portfiles_dir [$portref name]-[$portref version]_[$portref revision]]
+                file mkdir $portfile_partial_dir
+                set portfile_temp_path ${portfile_partial_dir}/Portfile
+                set fd [open $portfile_temp_path w]
+                puts $fd $portfile_contents
+                close $fd
+
+                set hash_size [sha256 file $portfile_temp_path]-[file size $portfile_temp_path]
+                set portfile_dir [file join $portfile_partial_dir $hash_size]
+                file mkdir $portfile_dir
+                file rename -force $portfile_temp_path $portfile_dir
+                file mtime ${portfile_dir}/Portfile [$portref date]
+
+                $portref portfile $hash_size
+            }
+        }
+        registry::metadata del portfiles_update_needed
+    }
+}
+
+exit 0

Deleted: branches/new-help-system/base/src/images_to_archives.tcl
===================================================================
--- branches/new-help-system/base/src/images_to_archives.tcl	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/images_to_archives.tcl	2014-08-03 15:04:12 UTC (rev 122999)
@@ -1,160 +0,0 @@
-#!/usr/bin/env tclsh
-# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4
-# $Id$
-
-# convert existing port image directories into compressed archive versions
-# Takes one argument, which should be TCL_PACKAGE_DIR.
-
-source [file join [lindex $argv 0] macports1.0 macports_fastload.tcl]
-package require macports 1.0
-package require registry 1.0
-package require registry2 2.0
-package require Pextlib 1.0
-
-umask 022
-
-array set ui_options {ports_verbose yes}
-
-mportinit ui_options
-
-# always converting to tbz2 should be fine as both these programs are
-# needed elsewhere and assumed to be available
-set tarcmd [macports::findBinary tar ${macports::autoconf::tar_path}]
-set bzip2cmd [macports::findBinary bzip2 ${macports::autoconf::bzip2_path}]
-
-if {[catch {set ilist [registry::installed]}]} {
-    # no ports installed
-    puts "No ports installed to convert."
-    exit 0
-}
-
-puts "This could take a while..."
-
-# list of ports we successfully create an archive of, to be used to update
-# the registry only after we know all creation attempts were successful.
-set archived_list {}
-set installed_len [llength $ilist]
-set counter 0
-
-foreach installed $ilist {
-    incr counter
-    set iname [lindex $installed 0]
-    set iversion [lindex $installed 1]
-    set irevision [lindex $installed 2]
-    set ivariants [lindex $installed 3]
-    set iepoch [lindex $installed 5]
-    set iref [registry::open_entry $iname $iversion $irevision $ivariants $iepoch]
-    set installtype [registry::property_retrieve $iref installtype]
-    if {$installtype eq "image"} {
-        set location [registry::property_retrieve $iref location]
-        if {$location == 0} {
-            set location [registry::property_retrieve $iref imagedir]
-        }
-    } else {
-        set location ""
-    }
-
-    if {$location eq "" || ![file isfile $location]} {
-        # no image archive present, so make one
-        set archs [registry::property_retrieve $iref archs]
-        if {$archs eq "" || $archs == 0} {
-            set archs ${macports::os_arch}
-        }
-        # look for any existing archive in the old location
-        set oldarchiverootname "${iname}-${iversion}_${irevision}${ivariants}.[join $archs -]"
-        set archivetype tbz2
-        set oldarchivedir [file join ${macports::portdbpath} packages ${macports::os_platform}_${macports::os_major}]
-        set olderarchivedir [file join ${macports::portdbpath} packages ${macports::os_platform}]
-        if {[llength $archs] == 1} {
-            set oldarchivedir [file join $oldarchivedir $archs $iname]
-            set olderarchivedir [file join $olderarchivedir $archs]
-        } else {
-            set oldarchivedir [file join $oldarchivedir universal $iname]
-            set olderarchivedir [file join $olderarchivedir universal]
-        }
-        set found 0
-        foreach adir [list $oldarchivedir $olderarchivedir] {
-            foreach type {tbz2 tbz tgz tar txz tlz xar zip cpgz cpio} {
-                set oldarchivefullpath "[file join $adir $oldarchiverootname].${type}"
-                if {[file isfile $oldarchivefullpath]} {
-                    set found 1
-                    set archivetype $type
-                    break
-                }
-            }
-            if {$found} {break}
-        }
-
-        # compute new name and location of archive
-        set archivename "${iname}-${iversion}_${irevision}${ivariants}.${macports::os_platform}_${macports::os_major}.[join $archs -].${archivetype}"
-        ui_msg "Processing ${counter} of ${installed_len}: ${archivename}"
-        if {$installtype eq "image"} {
-            set targetdir [file dirname $location]
-        } else {
-            set targetdir [file join ${macports::registry.path} software ${iname}]
-        }
-        if {$location eq "" || ![file isdirectory $location]} {
-            set contents [$iref imagefiles]
-        }
-        file mkdir $targetdir
-        set newlocation [file join $targetdir $archivename]
-
-        if {$found} {
-            file rename $oldarchivefullpath $newlocation
-        } elseif {$installtype eq "image" && [file isdirectory $location]} {
-            # create archive from image dir
-            system -W $location "$tarcmd -cjf $newlocation * > ${targetdir}/error.log 2>&1"
-            file delete -force ${targetdir}/error.log
-        } else {
-            # direct mode (or missing image dir), create archive from installed files
-            # we tell tar to read filenames from a file so as not to run afoul of command line length limits
-            set fd [open ${targetdir}/tarlist w]
-            foreach entry $contents {
-                puts $fd $entry
-            }
-            close $fd
-            system "$tarcmd -cjf $newlocation -T ${targetdir}/tarlist > ${targetdir}/error.log 2>&1"
-            file delete -force ${targetdir}/tarlist ${targetdir}/error.log
-        }
-
-        lappend archived_list [list $installtype $iref $location $newlocation]
-    }
-}
-
-set archived_len [llength $archived_list]
-set counter 0
-
-registry::write {
-    foreach archived $archived_list {
-        incr counter
-        ui_msg "Updating registry: ${counter} of ${archived_len}"
-        set installtype [lindex $archived 0]
-        set iref [lindex $archived 1]
-        set newlocation [lindex $archived 3]
-    
-        if {$installtype eq "direct"} {
-            # change receipt to image
-            $iref installtype image
-            $iref state imaged
-            $iref activate [$iref imagefiles]
-            $iref state installed
-        }
-    
-        # set the new location in the registry and delete the old dir
-        $iref location $newlocation
-    }
-}
-
-set counter 0
-foreach archived $archived_list {
-    incr counter
-    set location [lindex $archived 2]
-    ui_msg "Deleting ${counter} of ${archived_len}: ${location}"
-    if {$location ne "" && [file isdirectory $location]} {
-        if {[catch {file delete -force $location} result]} {
-            ui_warn "Failed to delete ${location}: $result"
-        }
-    }
-}
-
-exit 0

Copied: branches/new-help-system/base/src/images_to_archives.tcl.in (from rev 122997, trunk/base/src/images_to_archives.tcl.in)
===================================================================
--- branches/new-help-system/base/src/images_to_archives.tcl.in	                        (rev 0)
+++ branches/new-help-system/base/src/images_to_archives.tcl.in	2014-08-03 15:04:12 UTC (rev 122999)
@@ -0,0 +1,159 @@
+#!@TCLSH@
+# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4
+# $Id$
+
+# convert existing port image directories into compressed archive versions
+# Takes one argument, which should be TCL_PACKAGE_DIR.
+
+package require macports 1.0
+package require registry 1.0
+package require registry2 2.0
+package require Pextlib 1.0
+
+umask 022
+
+array set ui_options {ports_verbose yes}
+
+mportinit ui_options
+
+# always converting to tbz2 should be fine as both these programs are
+# needed elsewhere and assumed to be available
+set tarcmd [macports::findBinary tar ${macports::autoconf::tar_path}]
+set bzip2cmd [macports::findBinary bzip2 ${macports::autoconf::bzip2_path}]
+
+if {[catch {set ilist [registry::installed]}]} {
+    # no ports installed
+    puts "No ports installed to convert."
+    exit 0
+}
+
+puts "This could take a while..."
+
+# list of ports we successfully create an archive of, to be used to update
+# the registry only after we know all creation attempts were successful.
+set archived_list {}
+set installed_len [llength $ilist]
+set counter 0
+
+foreach installed $ilist {
+    incr counter
+    set iname [lindex $installed 0]
+    set iversion [lindex $installed 1]
+    set irevision [lindex $installed 2]
+    set ivariants [lindex $installed 3]
+    set iepoch [lindex $installed 5]
+    set iref [registry::open_entry $iname $iversion $irevision $ivariants $iepoch]
+    set installtype [registry::property_retrieve $iref installtype]
+    if {$installtype eq "image"} {
+        set location [registry::property_retrieve $iref location]
+        if {$location == 0} {
+            set location [registry::property_retrieve $iref imagedir]
+        }
+    } else {
+        set location ""
+    }
+
+    if {$location eq "" || ![file isfile $location]} {
+        # no image archive present, so make one
+        set archs [registry::property_retrieve $iref archs]
+        if {$archs eq "" || $archs == 0} {
+            set archs ${macports::os_arch}
+        }
+        # look for any existing archive in the old location
+        set oldarchiverootname "${iname}-${iversion}_${irevision}${ivariants}.[join $archs -]"
+        set archivetype tbz2
+        set oldarchivedir [file join ${macports::portdbpath} packages ${macports::os_platform}_${macports::os_major}]
+        set olderarchivedir [file join ${macports::portdbpath} packages ${macports::os_platform}]
+        if {[llength $archs] == 1} {
+            set oldarchivedir [file join $oldarchivedir $archs $iname]
+            set olderarchivedir [file join $olderarchivedir $archs]
+        } else {
+            set oldarchivedir [file join $oldarchivedir universal $iname]
+            set olderarchivedir [file join $olderarchivedir universal]
+        }
+        set found 0
+        foreach adir [list $oldarchivedir $olderarchivedir] {
+            foreach type {tbz2 tbz tgz tar txz tlz xar zip cpgz cpio} {
+                set oldarchivefullpath "[file join $adir $oldarchiverootname].${type}"
+                if {[file isfile $oldarchivefullpath]} {
+                    set found 1
+                    set archivetype $type
+                    break
+                }
+            }
+            if {$found} {break}
+        }
+
+        # compute new name and location of archive
+        set archivename "${iname}-${iversion}_${irevision}${ivariants}.${macports::os_platform}_${macports::os_major}.[join $archs -].${archivetype}"
+        ui_msg "Processing ${counter} of ${installed_len}: ${archivename}"
+        if {$installtype eq "image"} {
+            set targetdir [file dirname $location]
+        } else {
+            set targetdir [file join ${macports::registry.path} software ${iname}]
+        }
+        if {$location eq "" || ![file isdirectory $location]} {
+            set contents [$iref imagefiles]
+        }
+        file mkdir $targetdir
+        set newlocation [file join $targetdir $archivename]
+
+        if {$found} {
+            file rename $oldarchivefullpath $newlocation
+        } elseif {$installtype eq "image" && [file isdirectory $location]} {
+            # create archive from image dir
+            system -W $location "$tarcmd -cjf $newlocation * > ${targetdir}/error.log 2>&1"
+            file delete -force ${targetdir}/error.log
+        } else {
+            # direct mode (or missing image dir), create archive from installed files
+            # we tell tar to read filenames from a file so as not to run afoul of command line length limits
+            set fd [open ${targetdir}/tarlist w]
+            foreach entry $contents {
+                puts $fd $entry
+            }
+            close $fd
+            system "$tarcmd -cjf $newlocation -T ${targetdir}/tarlist > ${targetdir}/error.log 2>&1"
+            file delete -force ${targetdir}/tarlist ${targetdir}/error.log
+        }
+
+        lappend archived_list [list $installtype $iref $location $newlocation]
+    }
+}
+
+set archived_len [llength $archived_list]
+set counter 0
+
+registry::write {
+    foreach archived $archived_list {
+        incr counter
+        ui_msg "Updating registry: ${counter} of ${archived_len}"
+        set installtype [lindex $archived 0]
+        set iref [lindex $archived 1]
+        set newlocation [lindex $archived 3]
+    
+        if {$installtype eq "direct"} {
+            # change receipt to image
+            $iref installtype image
+            $iref state imaged
+            $iref activate [$iref imagefiles]
+            $iref state installed
+        }
+    
+        # set the new location in the registry and delete the old dir
+        $iref location $newlocation
+    }
+}
+
+set counter 0
+foreach archived $archived_list {
+    incr counter
+    set location [lindex $archived 2]
+    ui_msg "Deleting ${counter} of ${archived_len}: ${location}"
+    if {$location ne "" && [file isdirectory $location]} {
+        if {[catch {file delete -force $location} result]} {
+            ui_warn "Failed to delete ${location}: $result"
+        }
+    }
+}
+
+exit 0

Modified: branches/new-help-system/base/src/machista1.0/Makefile.in
===================================================================
--- branches/new-help-system/base/src/machista1.0/Makefile.in	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/machista1.0/Makefile.in	2014-08-03 15:04:12 UTC (rev 122999)
@@ -1,6 +1,11 @@
+srcdir = @srcdir@
+VPATH  = @srcdir@
+
+include ../../Mk/macports.autoconf.mk
+
 OBJS= 		libmachista.o hashmap.o machista_wrap.o
 SHLIB_NAME= machista${SHLIB_SUFFIX}
-INSTALLDIR=	${DESTDIR}${datadir}/macports/Tcl/machista1.0
+INSTALLDIR=	${DESTDIR}${TCL_PACKAGE_PATH}/machista1.0
 
 SWIG         = @SWIG@
 SWIG_FLAGS   = -tcl8 -pkgversion 1.0 -namespace
@@ -12,8 +17,7 @@
 
 TESTS = ./tests/libmachista-test
 
-include ../../Mk/macports.autoconf.mk
-include ../../Mk/macports.tea.mk
+include $(srcdir)/../../Mk/macports.tea.mk
 
 CFLAGS+= -fPIC
 

Modified: branches/new-help-system/base/src/machista1.0/libmachista.c
===================================================================
--- branches/new-help-system/base/src/machista1.0/libmachista.c	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/machista1.0/libmachista.c	2014-08-03 15:04:12 UTC (rev 122999)
@@ -30,8 +30,15 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 
+/* required for asprintf(3) on OS X */
+#define _DARWIN_C_SOURCE
+/* required for asprintf(3) on Linux */
+#define _GNU_SOURCE
+
 #include <stdbool.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -109,14 +116,15 @@
     return result;
 }
 
+#ifdef __MACH__
 const char *macho_get_arch_name (cpu_type_t cputype) {
-#ifdef __MACH__
     const NXArchInfo *archInfo = NXGetArchInfoFromCpuType(cputype, CPU_SUBTYPE_MULTIPLE);	
     if (!archInfo) {
         return NULL;
     }
     return archInfo->name;
 #else
+const char *macho_get_arch_name (cpu_type_t cputype UNUSED) {
     return NULL;
 #endif
 }
@@ -239,8 +247,8 @@
 #endif
 
 /* Parse a Mach-O header */
+#ifdef __MACH__
 static int parse_macho (macho_t *mt, macho_input_t *input) {
-#ifdef __MACH__
     /* Read the file type. */
     const uint32_t *magic = macho_read(input, input->data, sizeof(uint32_t));
     if (magic == NULL)
@@ -437,14 +445,12 @@
     }
 
     return MACHO_SUCCESS;
-#else
-    return 0;
+}
 #endif
-}
 
 /* Parse a (possible Mach-O) file. For a more detailed description, see the header */
+#ifdef __MACH__
 int macho_parse_file(macho_handle_t *handle, const char *filepath, const macho_t **res) {
-#ifdef __MACH__
     int fd;
     struct stat st;
     void *data;
@@ -505,6 +511,7 @@
 
     return ret;
 #else
+int macho_parse_file(macho_handle_t *handle UNUSED, const char *filepath UNUSED, const macho_t **res UNUSED) {
     return 0;
 #endif
 }


Property changes on: branches/new-help-system/base/src/macports1.0
___________________________________________________________________
Modified: svn:ignore
   - *.dylib
macports_autoconf.tcl
macports_test_autoconf.tcl
macports_fastload.tcl
pkgIndex.tcl

   + *.dylib
Makefile
macports_autoconf.tcl
macports_test_autoconf.tcl
pkgIndex.tcl


Deleted: branches/new-help-system/base/src/macports1.0/Makefile
===================================================================
--- branches/new-help-system/base/src/macports1.0/Makefile	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/macports1.0/Makefile	2014-08-03 15:04:12 UTC (rev 122999)
@@ -1,46 +0,0 @@
-SRCS=		macports.tcl macports_dlist.tcl macports_util.tcl \
-		macports_autoconf.tcl macports_fastload.tcl
-OBJS=		macports.o get_systemconfiguration_proxies.o sysctl.o
-SHLIB_NAME=	MacPorts${SHLIB_SUFFIX}
-
-INSTALLDIR=	${DESTDIR}${datadir}/macports/Tcl/macports1.0
-INSTALLPKGLINK=	${TCL_PACKAGE_DIR}/macports1.0
-
-include ../../Mk/macports.autoconf.mk
-include ../../Mk/macports.tea.mk
-
-ifeq ($(OBJC_RUNTIME), APPLE_RUNTIME)
-	LIBS+= -framework CoreFoundation -framework SystemConfiguration
-endif
-
-pkgIndex.tcl: $(SRCS)
-
-test::
-	$(TCLSH) ./tests/test.tcl -nocolor
-
-distclean:: clean
-	rm -f macports_autoconf.tcl macports_fastload.tcl macports_test_autoconf.tcl ${SHLIB_NAME}
-
-install:: all
-	$(INSTALL) -d -o ${DSTUSR} -g ${DSTGRP} -m ${DSTMODE} ${INSTALLDIR}
-
-	$(SILENT) set -x; for file in ${SRCS}; do \
-		$(INSTALL) -o ${DSTUSR} -g ${DSTGRP} -m 444 $$file ${INSTALLDIR}/$$file; \
-	done
-
-	$(INSTALL) -o ${DSTUSR} -g ${DSTGRP} -m 444 pkgIndex.tcl ${INSTALLDIR}
-
-	echo "${TCL_PACKAGE_DIR}" > ${DESTDIR}${prefix}/var/macports/.tclpackage
-	if test -z "${DESTDIR}" -a "${INSTALLPKGLINK}" != "${INSTALLDIR}"; then \
-		if test ! -L "${INSTALLPKGLINK}"; then \
-            if test ! -e "${TCL_PACKAGE_DIR}"; then \
-                $(INSTALL) -d -o ${DSTUSR} -g ${DSTGRP} -m ${DSTMODE} "${TCL_PACKAGE_DIR}" || true; \
-            fi; \
-            if test -d "${INSTALLPKGLINK}"; then \
-                rm -vrf "${INSTALLPKGLINK}" || true; \
-            fi; \
-            if test ! -e "${INSTALLPKGLINK}"; then \
-                ln -vs "${INSTALLDIR}" "${INSTALLPKGLINK}" || true; \
-            fi; \
-        fi; \
-	fi

Copied: branches/new-help-system/base/src/macports1.0/Makefile.in (from rev 122997, trunk/base/src/macports1.0/Makefile.in)
===================================================================
--- branches/new-help-system/base/src/macports1.0/Makefile.in	                        (rev 0)
+++ branches/new-help-system/base/src/macports1.0/Makefile.in	2014-08-03 15:04:12 UTC (rev 122999)
@@ -0,0 +1,44 @@
+srcdir = @srcdir@
+VPATH  = @srcdir@
+
+include ../../Mk/macports.autoconf.mk
+
+SRCS=		macports.tcl macports_dlist.tcl macports_util.tcl \
+		macports_autoconf.tcl
+OBJS=		macports.o get_systemconfiguration_proxies.o sysctl.o
+SHLIB_NAME=	MacPorts${SHLIB_SUFFIX}
+
+INSTALLDIR=	${DESTDIR}${TCL_PACKAGE_PATH}/macports1.0
+OLDINSTALLDIR= ${datadir}/macports/Tcl
+
+ifeq ($(OBJC_RUNTIME), APPLE_RUNTIME)
+	LIBS+= -framework CoreFoundation -framework SystemConfiguration
+endif
+
+pkgIndex.tcl: $(SRCS)
+
+test::
+	$(TCLSH) $(srcdir)/tests/test.tcl -nocolor
+
+distclean:: clean
+	rm -f macports_autoconf.tcl macports_test_autoconf.tcl ${SHLIB_NAME}
+	rm -f Makefile
+
+install:: all
+	@# Clean up old instances of the MacPorts Tcl packages
+	if test -z "${DESTDIR}"; then rm -rf "${OLDINSTALLDIR}"; fi
+
+	@# Remove the previously installed link if it still exists. Without this,
+	@# creating the directory will fail.
+	if test -L "${INSTALLDIR}"; then rm -rf "${INSTALLDIR}"; fi
+
+	$(INSTALL) -d -o "${DSTUSR}" -g "${DSTGRP}" -m "${DSTMODE}" "${INSTALLDIR}"
+
+	$(SILENT) set -x; for file in ${SRCS}; do \
+		$(INSTALL) -o "${DSTUSR}" -g "${DSTGRP}" -m 444 "$$file" "${INSTALLDIR}/$$file"; \
+	done
+
+	$(INSTALL) -o "${DSTUSR}" -g "${DSTGRP}" -m 444 pkgIndex.tcl "${INSTALLDIR}"
+
+
+include $(srcdir)/../../Mk/macports.tea.mk

Modified: branches/new-help-system/base/src/macports1.0/get_systemconfiguration_proxies.c
===================================================================
--- branches/new-help-system/base/src/macports1.0/get_systemconfiguration_proxies.c	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/macports1.0/get_systemconfiguration_proxies.c	2014-08-03 15:04:12 UTC (rev 122999)
@@ -55,7 +55,11 @@
  *
  * Synopsis: array set someArray get_systemconfiguration_proxies
  */
+#ifdef HAVE_FRAMEWORK_SYSTEMCONFIGURATION
 int GetSystemConfigurationProxiesCmd( ClientData clientData UNUSED, Tcl_Interp *interp, int objc UNUSED, Tcl_Obj *CONST objv[] UNUSED )
+#else
+int GetSystemConfigurationProxiesCmd( ClientData clientData UNUSED, Tcl_Interp *interp UNUSED, int objc UNUSED, Tcl_Obj *CONST objv[] UNUSED )
+#endif
 {
     int cmdResult = TCL_OK;
 #ifdef HAVE_FRAMEWORK_SYSTEMCONFIGURATION

Modified: branches/new-help-system/base/src/macports1.0/macports.tcl
===================================================================
--- branches/new-help-system/base/src/macports1.0/macports.tcl	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/macports1.0/macports.tcl	2014-08-03 15:04:12 UTC (rev 122999)
@@ -36,11 +36,12 @@
 package provide macports 1.0
 package require macports_dlist 1.0
 package require macports_util 1.0
+package require Tclx
 
 namespace eval macports {
     namespace export bootstrap_options user_options portinterp_options open_mports ui_priorities port_phases
     variable bootstrap_options "\
-        portdbpath libpath binpath auto_path extra_env sources_conf prefix portdbformat \
+        portdbpath binpath auto_path extra_env sources_conf prefix portdbformat \
         portarchivetype portautoclean \
         porttrace portverbose keeplogs destroot_umask variants_conf rsync_server rsync_options \
         rsync_dir startupitem_type startupitem_install place_worksymlink xcodeversion xcodebuildcmd \
@@ -59,7 +60,7 @@
         rsync_server rsync_options rsync_dir startupitem_type startupitem_install place_worksymlink macportsuser \
         configureccache ccache_dir ccache_size configuredistcc configurepipe buildnicevalue buildmakejobs \
         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_sdk_version macosx_deployment_target \
+        os_arch os_endian os_version os_major os_minor os_platform macosx_version macosx_sdk_version macosx_deployment_target \
         packagemaker_path default_compilers sandbox_enable delete_la_files cxx_stdlib \
         pkg_post_unarchive_deletions $user_options"
 
@@ -204,6 +205,24 @@
 
 proc ui_message {priority prefix phase args} {
     global macports::channels ::debuglog macports::current_phase
+
+    # 
+    # validate $args
+    #
+    switch [llength $args] {
+       0 - 1 {}
+       2 {
+           if {[lindex $args 0] ne {-nonewline}} {
+               set hint "error: when 5 arguments are given, 2nd last must be \"-newnewline\""
+               error "$hint\nusage: ui_message priority prefix phase ?-nonewline? string"
+           }
+       }
+       default {
+           set hint "error: too many arguments specified"
+           error "$hint\nusage: ui_message priority prefix phase ?-nonewline? string"
+       }
+    } 
+
     foreach chan $macports::channels($priority) {
         if {[info exists ::debuglog] && ($chan eq {debuglog})} {
             set chan $::debuglog
@@ -248,7 +267,7 @@
     }
     set phases {fetch checksum}
     try {
-        eval ::ui_init $priority $prefix $channels($priority) $args
+        ::ui_init $priority $prefix $channels($priority) {*}$args
     } catch * {
         interp alias {} ui_$priority {} ui_message $priority $prefix {}
         foreach phase $phases {
@@ -541,6 +560,10 @@
         macports::ui_init $priority
     }
 
+    package require Pextlib 1.0
+    package require registry 1.0
+    package require registry2 2.0
+    package require machista 1.0
 
     global auto_path env tcl_platform \
         macports::autoconf::macports_conf_path \
@@ -554,7 +577,6 @@
         macports::sources \
         macports::sources_default \
         macports::destroot_umask \
-        macports::libpath \
         macports::prefix \
         macports::macportsuser \
         macports::prefix_frozen \
@@ -573,6 +595,7 @@
         macports::os_endian \
         macports::os_version \
         macports::os_major \
+        macports::os_minor \
         macports::os_platform \
         macports::macosx_version \
         macports::macosx_sdk_version \
@@ -587,12 +610,18 @@
     # Set the system encoding to utf-8
     encoding system utf-8
 
+    # Set up signal handling for SIGTERM and SIGINT
+    # Specifying error here will case the program to abort where it is with
+    # a Tcl error, which can be caught, if necessary.
+    signal -restart error {TERM INT}
+
     # set up platform info variables
     set os_arch $tcl_platform(machine)
     if {$os_arch eq {Power Macintosh}} {set os_arch "powerpc"}
     if {$os_arch eq {i586} || $os_arch eq {i686} || $os_arch eq {x86_64}} {set os_arch "i386"}
     set os_version $tcl_platform(osVersion)
     set os_major [lindex [split $os_version .] 0]
+    set os_minor [lindex [split $os_version .] 1]
     set os_platform [string tolower $tcl_platform(os)]
     # Remove trailing "Endian"
     set os_endian [string range $tcl_platform(byteOrder) 0 end-6]
@@ -606,7 +635,7 @@
     }
 
     # Check that the current platform is the one we were configured for, otherwise need to do migration
-    if {($os_platform != $macports::autoconf::os_platform) || ($os_major != $macports::autoconf::os_major)} {
+    if {($os_platform ne $macports::autoconf::os_platform) || ($os_major != $macports::autoconf::os_major)} {
         ui_error "Current platform \"$os_platform $os_major\" does not match expected platform \"$macports::autoconf::os_platform $macports::autoconf::os_major\""
         ui_error "If you upgraded your OS, please follow the migration instructions: https://trac.macports.org/wiki/Migration"
         return -code error "OS platform mismatch"
@@ -869,10 +898,6 @@
         return -code error "Data files directory '$portsharepath' must exist"
     }
 
-    if {![info exists libpath]} {
-        set libpath ${prefix}/share/macports/Tcl
-    }
-
     if {![info exists binpath]} {
         set env(PATH) ${prefix}/bin:${prefix}/sbin:/bin:/sbin:/usr/bin:/usr/sbin
     } else {
@@ -1015,21 +1040,6 @@
         set keepenvkeys [concat $keepenvkeys $extra_env]
     }
 
-    if {[file isdirectory $libpath]} {
-        lappend auto_path $libpath
-        set macports::auto_path $auto_path
-
-        # XXX: not sure if this the best place, but it needs to happen
-        # early, and after auto_path has been set.  Or maybe Pextlib
-        # should ship with macports1.0 API?
-        package require Pextlib 1.0
-        package require registry 1.0
-        package require registry2 2.0
-        package require machista 1.0
-    } else {
-        return -code error "Library directory '$libpath' must exist"
-    }
-
     # set the hidden flag on $portdbpath to avoid spotlight indexing, which
     # might slow builds down considerably. You can avoid this by touching
     # $portdbpath/.nohide.
@@ -1286,6 +1296,14 @@
         $workername alias ui_progress_download $macports::ui_options(progress_download)
     }
 
+    # notifications callback
+    if {[info exists macports::ui_options(notifications_append)]} {
+        $workername alias ui_notifications_append $macports::ui_options(notifications_append)
+    } else {
+        # provide a no-op if notifications_append wasn't set. See http://wiki.tcl.tk/3044
+        $workername alias ui_notifications_append return -level 0
+    }
+
     $workername alias ui_prefix ui_prefix
     $workername alias ui_channels ui_channels
 
@@ -1461,7 +1479,7 @@
         } elseif {[info exists macports::ui_options(progress_download)]} {
             set progressflag "--progress ${macports::ui_options(progress_download)}"
         }
-        if {[catch {eval curl fetch $progressflag {$url} {[file join $fetchdir $fetchfile]}} result]} {
+        if {[catch {curl fetch {*}$progressflag $url [file join $fetchdir $fetchfile]} result]} {
             return -code error "Port remote fetch failed: $result"
         }
     }
@@ -1474,9 +1492,9 @@
     set tarcmd [findBinary tar $macports::autoconf::tar_path]
     set tarflags [get_tar_flags [file extension $fetchfile]]
     set qflag $macports::autoconf::tar_q
-    set cmdline "$tarcmd ${tarflags}${qflag}xOf \"$fetchfile\" +CONTENTS"
+    set cmdline [list $tarcmd ${tarflags}${qflag}xOf $fetchfile +CONTENTS]
     ui_debug $cmdline
-    if {![catch {set contents [eval exec $cmdline]}]} {
+    if {![catch {set contents [exec {*}$cmdline]}]} {
         # the file is probably a valid binary archive
         set binary 1
         ui_debug "getting port name from binary archive"
@@ -1502,12 +1520,12 @@
     # extract the portfile (and possibly files dir if not a binary archive)
     ui_debug "extracting port archive to [pwd]"
     if {$binary} {
-        set cmdline "$tarcmd ${tarflags}${qflag}xOf \"../$fetchfile\" +PORTFILE > Portfile"
+        set cmdline [list $tarcmd ${tarflags}${qflag}xOf ../$fetchfile +PORTFILE > Portfile]
     } else {
-        set cmdline "$tarcmd ${tarflags}xf \"$fetchfile\""
+        set cmdline [list $tarcmd ${tarflags}${qflag}xf $fetchfile]
     }
     ui_debug $cmdline
-    if {[catch {eval exec $cmdline} result]} {
+    if {[catch {exec {*}$cmdline} result]} {
         # clean up the archive, we don't need it anymore
         file delete [file join $fetchdir $fetchfile]
 
@@ -1715,12 +1733,7 @@
 proc mportopen_installed {name version revision variants options} {
     global macports::registry.path
     set regref [lindex [registry::entry imaged $name $version $revision $variants] 0]
-    set portfile_dir [file join ${registry.path} registry portfiles $name ${version}_${revision}$variants]
-    file mkdir $portfile_dir
-    set fd [open ${portfile_dir}/Portfile w]
-    puts $fd [$regref portfile]
-    close $fd
-    file mtime ${portfile_dir}/Portfile [$regref date]
+    set portfile_dir [file join ${registry.path} registry portfiles ${name}-${version}_${revision} [$regref portfile]]
 
     set variations {}
     set minusvariant [lrange [split [$regref negated_variants] -] 1 end]
@@ -1731,24 +1744,20 @@
     foreach v $minusvariant {
         lappend variations $v -
     }
-    lappend options subport $name
-    return [mportopen file://${portfile_dir}/ $options $variations]
-}
 
-# mportclose_installed
-# close mport opened with mportopen_installed and clean up associated files
-proc mportclose_installed {mport} {
-    global macports::registry.path
-    foreach key {subport version revision portvariants} {
-        set $key [_mportkey $mport $key]
+    array set options_array $options
+    set options_array(subport) $name
+
+    # find portgroups in registry
+    set pgdirlist [list]
+    foreach pg [$regref groups_used] {
+        lappend pgdirlist [file join ${registry.path} registry portgroups [$pg sha256]-[$pg size]]
     }
-    mportclose $mport
-    set portfiles_dir [file join ${registry.path} registry portfiles $subport]
-    set portfile [file join $portfiles_dir ${version}_${revision}$portvariants Portfile]
-    file delete -force $portfile [file dirname $portfile]
-    if {[llength [glob -nocomplain -directory $portfiles_dir *]] == 0} {
-        file delete -force $portfiles_dir
+    if {$pgdirlist ne {}} {
+        set options_array(_portgroup_search_dirs) [list $pgdirlist]
     }
+
+    return [mportopen file://${portfile_dir}/ [array get options_array] $variations]
 }
 
 # Traverse a directory with ports, calling a function on the path of ports
@@ -1967,10 +1976,9 @@
     } else {
         # An error occurred.
         global ::logenabled ::debuglogname
-        ui_error "Failed to install $portname"
         ui_debug $::errorInfo
         if {[info exists ::logenabled] && $::logenabled && [info exists ::debuglogname]} {
-            ui_notice "Please see the log file for port $portname for details:\n    $::debuglogname"
+            ui_error "See $::debuglogname for details."
         }
         macports::pop_log
         return 1
@@ -2054,11 +2062,16 @@
         registry::exclusive_unlock
 
         if {$result ne {}} {
-            set errstring "The following dependencies were not installed:"
-            foreach ditem $result {
-                append errstring " [ditem_key $ditem provides]"
-            }
-            ui_error $errstring
+            ##
+            # When this happens, the failing port usually already printed an
+            # error message. Omit this one to avoid cluttering the output and
+            # hiding the *real* problem.
+
+            #set errstring "The following dependencies were not installed:"
+            #foreach ditem $result {
+            #    append errstring " [ditem_key $ditem provides]"
+            #}
+            #ui_error $errstring
             foreach ditem $dlist {
                 catch {mportclose $ditem}
             }
@@ -2096,7 +2109,7 @@
     global ::logenabled ::debuglogname
     if {[info exists ::logenabled] && $::logenabled && [info exists ::debuglogname]} {
         if {$result != 0} {
-            ui_notice "Please see the log file for port $portname for details:\n    $::debuglogname"
+            ui_error "See $::debuglogname for details."
         }
         macports::pop_log
     }
@@ -2318,6 +2331,10 @@
                     } {
                         ui_debug $::errorInfo
                         ui_error "Synchronization of the local ports tree failed doing an svn update"
+                        if {[getuid] == 0} {
+                            seteuid $euid
+                            setegid $egid
+                        }
                         incr numfailed
                         continue
                     }
@@ -2348,6 +2365,10 @@
                     } {
                         ui_debug $::errorInfo
                         ui_error "Synchronization of the local ports tree failed doing a git update"
+                        if {[getuid] == 0} {
+                            seteuid $euid
+                            setegid $egid
+                        }
                         incr numfailed
                         continue
                     }
@@ -2518,12 +2539,20 @@
                 set progressflag {}
                 if {$macports::portverbose eq {yes}} {
                     set progressflag "--progress builtin"
+                    set verboseflag "-v"
                 } elseif {[info exists macports::ui_options(progress_download)]} {
                     set progressflag "--progress ${macports::ui_options(progress_download)}"
+                    set verboseflag ""
                 }
 
-                if {[catch {eval curl fetch $progressflag {$source} {$tarpath}} error]} {
-                    ui_error "Fetching $source failed ($error)"
+                try {
+                    curl fetch {*}$progressflag $source $tarpath
+                } catch {{POSIX SIG SIGINT} eCode eMessage} {
+                    throw
+                } catch {{POSIX SIG SIGTERM} eCode eMessage} {
+                    throw
+                } catch {{*} eCode eMessage} {
+                    ui_error [msgcat::mc "Fetching %s failed: %s" $source $error]
                     incr numfailed
                     continue
                 }
@@ -2660,7 +2689,7 @@
 
                     switch -- $matchstyle {
                         exact {
-                            if {$case_sensitive eq yes} {
+                            if {$case_sensitive eq "yes"} {
                                 set compres [string compare $pattern $target]
                             } else {
                                 set compres [string compare -nocase $pattern $target]
@@ -2668,14 +2697,14 @@
                             set matchres [expr {0 == $compres}]
                         }
                         glob {
-                            if {$case_sensitive eq yes} {
+                            if {$case_sensitive eq "yes"} {
                                 set matchres [string match $pattern $target]
                             } else {
                                 set matchres [string match -nocase $pattern $target]
                             }
                         }
                         regexp {
-                            if {$case_sensitive eq yes} {
+                            if {$case_sensitive eq "yes"} {
                                 set matchres [regexp -- $pattern $target]
                             } else {
                                 set matchres [regexp -nocase -- $pattern $target]
@@ -3382,10 +3411,10 @@
 
 # selfupdate procedure
 proc macports::selfupdate {{optionslist {}} {updatestatusvar {}}} {
-    global macports::prefix macports::portdbpath macports::libpath \
-           macports::rsync_server macports::rsync_dir macports::rsync_options \
-           macports::autoconf::macports_version macports::autoconf::rsync_path \
-           tcl_platform macports::autoconf::openssl_path macports::autoconf::tar_path
+    global macports::prefix macports::portdbpath macports::rsync_server macports::rsync_dir \
+           macports::rsync_options macports::autoconf::macports_version \
+           macports::autoconf::rsync_path tcl_platform macports::autoconf::openssl_path \
+           macports::autoconf::tar_path
     array set options $optionslist
 
     # variable that indicates whether we actually updated base
@@ -3510,17 +3539,7 @@
             }
             ui_debug "Permissions OK"
 
-            # where to install a link to our macports1.0 tcl package
-            set mp_tclpackage_path [file join $portdbpath .tclpackage]
-            if {[file exists $mp_tclpackage_path]} {
-                set fd [open $mp_tclpackage_path r]
-                gets $fd tclpackage
-                close $fd
-            } else {
-                set tclpackage $libpath
-            }
-
-            set configure_args "--prefix=$prefix --with-tclpackage=$tclpackage --with-install-user=$owner --with-install-group=$group --with-directory-mode=$perms"
+            set configure_args "--prefix=[macports::shellescape $prefix] --with-install-user=[macports::shellescape $owner] --with-install-group=[macports::shellescape $group] --with-directory-mode=[macports::shellescape $perms]"
             # too many users have an incompatible readline in /usr/local, see ticket #10651
             if {$tcl_platform(os) ne {Darwin} || $prefix eq {/usr/local}
                 || ([glob -nocomplain /usr/local/lib/lib{readline,history}*] eq {} && [glob -nocomplain /usr/local/include/readline/*.h] eq {})} {
@@ -3540,7 +3559,7 @@
             }
 
             # 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"
+            ui_msg "Installing new MacPorts release in $prefix as ${owner}:${group}; permissions ${perms}\n"
             if {[catch {system "cd $mp_source_path && ${cc_arg}./configure $configure_args && make SELFUPDATING=1 && make install SELFUPDATING=1"} result]} {
                 return -code error "Error installing new MacPorts base: $result"
             }
@@ -3990,7 +4009,6 @@
                 if {[info exists ::errorInfo]} {
                     ui_debug $::errorInfo
                 }
-                ui_error "Unable to upgrade port: $result"
                 catch {mportclose $mport}
                 return 1
             }
@@ -3999,7 +4017,6 @@
                 if {[info exists ::errorInfo]} {
                     ui_debug $::errorInfo
                 }
-                ui_error "Unable to upgrade port: $result"
                 catch {mportclose $mport}
                 return 1
             }
@@ -4010,7 +4027,6 @@
                 if {[info exists ::errorInfo]} {
                     ui_debug $::errorInfo
                 }
-                ui_error "Unable to upgrade port: $result"
                 catch {mportclose $mport}
                 return 1
             }
@@ -4115,7 +4131,7 @@
         }
     }
 
-    if {[info exists uninstall_later] && $uninstall_later eq yes} {
+    if {[info exists uninstall_later] && $uninstall_later eq "yes"} {
         foreach i $ilist {
             set version [lindex $i 1]
             set revision [lindex $i 2]
@@ -4203,12 +4219,12 @@
 }
 
 # mportselect
-#   * command: The only valid commands are list, set and show
+#   * command: The only valid commands are list, set, show and summary
 #   * group: This argument should correspond to a directory under
 #            ${macports::prefix}/etc/select.
 #   * version: This argument is only used by the 'set' command.
 # On error mportselect returns with the code 'error'.
-proc mportselect {command group {version {}}} {
+proc mportselect {command {group ""} {version {}}} {
     ui_debug "mportselect \[$command] \[$group] \[$version]"
 
     set conf_path ${macports::prefix}/etc/select/$group
@@ -4237,6 +4253,16 @@
             }
             return [lsort $lversions]
         }
+        summary {
+            # Return the list of portgroups in ${macports::prefix}/etc/select
+            if {[catch {set lportgroups [glob -directory $conf_path -tails *]} result]} {
+                global errorInfo
+                ui_debug "${result}: $errorInfo"
+                return -code error [concat "No ports with the select" \
+                                           "option were found."]
+            }
+            return [lsort $lportgroups]
+        }
         set {
             # Use ${conf_path}/$version to read in sources.
             if {$version eq {} || $version eq {base} || $version eq {current}
@@ -4339,16 +4365,58 @@
     return yes
 }
 
+##
+# Execute the rev-upgrade scan and attempt to rebuild all ports found to be
+# broken. Depends on the revupgrade_mode setting from macports.conf.
+#
+# @param opts
+#        A Tcl array serialized into a list using array get containing options
+#        for MacPorts. Options used exclusively by rev-upgrade are
+#        ports_rev-upgrade_id-loadcmd-check, a boolean indicating whether the
+#        ID load command of binaries should be check for sanity. This is mostly
+#        useful for maintainers.
+# @return 0 if report-only mode is enabled, no ports are broken, or the
+#         rebuilds finished successfully. 1 if an exception occured during the
+#         execution of rev-upgrade, 2 if the execution was aborted on user
+#         request.
 proc macports::revupgrade {opts} {
     set run_loop 1
     array set broken_port_counts {}
-    while {$run_loop == 1} {
-        set run_loop [revupgrade_scanandrebuild broken_port_counts $opts]
+    try {
+        while {$run_loop == 1} {
+            set run_loop [revupgrade_scanandrebuild broken_port_counts $opts]
+        }
+        return 0
+    } catch {{POSIX SIG SIGINT} eCode eMessage} {
+        ui_debug "rev-upgrade failed: $::errorInfo"
+        ui_error [msgcat::mc "rev-upgrade aborted: SIGINT received."]
+        return 2
+    } catch {{POSIX SIG SIGTERM} eCode eMessage} {
+        ui_error [msgcat::mc "rev-upgrade aborted: SIGTERM received."]
+        return 2
+    } catch {{*} eCode eMessage} {
+        ui_debug "rev-upgrade failed: $::errorInfo"
+        ui_error [msgcat::mc "rev-upgrade failed: %s" $eMessage]
+        return 1
     }
-    return 0
 }
 
-# returns 1 if ports were rebuilt and revupgrade_scanandrebuild should be called again
+##
+# Helper function for rev-upgrade. Do not consider this to be part of public
+# API. Use macports::revupgrade instead.
+#
+# @param broken_port_counts_name
+#        The name of a Tcl array that's being used to store the number of times
+#        a port has been rebuilt so far.
+# @param opts
+#        A serialized version of a Tcl array that contains options for
+#        MacPorts. Options used by this method are
+#        ports_rev-upgrade_id-loadcmd-check, a boolean indicating whether the
+#        ID loadcommand of binaries should also be checked during rev-upgrade
+#        and ports_dryrun, a boolean indicating whether no action should be
+#        taken.
+# @return 1 if ports were rebuilt and this function should be called again,
+#         0 otherwise.
 proc macports::revupgrade_scanandrebuild {broken_port_counts_name opts} {
     upvar $broken_port_counts_name broken_port_counts
     array set options $opts
@@ -4387,6 +4455,9 @@
                     }
                 }
             } catch {*} {
+                if {${fancy_output}} {
+                    $revupgrade_progress intermission
+                }
                 ui_error "Updating database of binaries failed"
                 throw
             }
@@ -4412,71 +4483,44 @@
             $revupgrade_progress start
         }
 
-        set i 1
-        foreach b $binaries {
-            if {$fancy_output} {
-                if {$binary_count < 10000 || $i % 10 == 1} {
-                    $revupgrade_progress update $i $binary_count
+        try {
+            set i 1
+            foreach b $binaries {
+                if {$fancy_output} {
+                    if {$binary_count < 10000 || $i % 10 == 1} {
+                        $revupgrade_progress update $i $binary_count
+                    }
                 }
-            }
-            set bpath [$b actual_path]
-            #ui_debug "${i}/${binary_count}: $bpath"
-            incr i
+                set bpath [$b actual_path]
+                #ui_debug "${i}/${binary_count}: $bpath"
+                incr i
 
-            set resultlist [machista::parse_file $handle $bpath]
-            set returncode [lindex $resultlist 0]
-            set result     [lindex $resultlist 1]
+                set resultlist [machista::parse_file $handle $bpath]
+                set returncode [lindex $resultlist 0]
+                set result     [lindex $resultlist 1]
 
-            if {$returncode != $machista::SUCCESS} {
-                if {$returncode == $machista::EMAGIC} {
-                    # not a Mach-O file
-                    # ignore silently, these are only static libs anyway
-                    #ui_debug "Error parsing file ${bpath}: [machista::strerror $returncode]"
-                } else {
-                    if {$fancy_output} {
-                        $revupgrade_progress intermission
+                if {$returncode != $machista::SUCCESS} {
+                    if {$returncode == $machista::EMAGIC} {
+                        # not a Mach-O file
+                        # ignore silently, these are only static libs anyway
+                        #ui_debug "Error parsing file ${bpath}: [machista::strerror $returncode]"
+                    } else {
+                        if {$fancy_output} {
+                            $revupgrade_progress intermission
+                        }
+                        ui_warn "Error parsing file ${bpath}: [machista::strerror $returncode]"
                     }
-                    ui_warn "Error parsing file ${bpath}: [machista::strerror $returncode]"
+                    continue;
                 }
-                continue;
-            }
 
-            set architecture [$result cget -mt_archs]
-            while {$architecture ne {NULL}} {
-                if {[info exists options(ports_rev-upgrade_id-loadcmd-check)] && $options(ports_rev-upgrade_id-loadcmd-check) eq {yes}} {
-                    if {[$architecture cget -mat_install_name] ne {NULL} && [$architecture cget -mat_install_name] ne {}} {
-                        # check if this lib's install name actually refers to this file itself
-                        # if this is not the case software linking against this library might have erroneous load commands
-                        if {0 == [catch {set idloadcmdpath [revupgrade_handle_special_paths $bpath [$architecture cget -mat_install_name]]}]} {
-                            if {[string index $idloadcmdpath 0] ne {/}} {
-                                set port [registry::entry owner $bpath]
-                                if {$port ne {}} {
-                                    set portname [$port name]
-                                } else {
-                                    set portname <unknown-port>
-                                }
-                                if {$fancy_output} {
-                                    $revupgrade_progress intermission
-                                }
-                                ui_warn "ID load command in ${bpath}, arch [machista::get_arch_name [$architecture cget -mat_arch]] (belonging to port $portname) contains relative path"
-                            } elseif {![file exists $idloadcmdpath]} {
-                                set port [registry::entry owner $bpath]
-                                if {$port ne {}} {
-                                    set portname [$port name]
-                                } else {
-                                    set portname <unknown-port>
-                                }
-                                if {$fancy_output} {
-                                    $revupgrade_progress intermission
-                                }
-                                ui_warn "ID load command in ${bpath}, arch [machista::get_arch_name [$architecture cget -mat_arch]] refers to non-existant file $idloadcmdpath"
-                                ui_warn "This is probably a bug in the $portname port and might cause problems in libraries linking against this file"
-                            } else {
-
-                                set hash_this [sha256 file $bpath]
-                                set hash_idloadcmd [sha256 file $idloadcmdpath]
-
-                                if {$hash_this ne $hash_idloadcmd} {
+                set architecture [$result cget -mt_archs]
+                while {$architecture ne {NULL}} {
+                    if {[info exists options(ports_rev-upgrade_id-loadcmd-check)] && $options(ports_rev-upgrade_id-loadcmd-check) eq {yes}} {
+                        if {[$architecture cget -mat_install_name] ne {NULL} && [$architecture cget -mat_install_name] ne {}} {
+                            # check if this lib's install name actually refers to this file itself
+                            # if this is not the case software linking against this library might have erroneous load commands
+                            if {0 == [catch {set idloadcmdpath [revupgrade_handle_special_paths $bpath [$architecture cget -mat_install_name]]}]} {
+                                if {[string index $idloadcmdpath 0] ne {/}} {
                                     set port [registry::entry owner $bpath]
                                     if {$port ne {}} {
                                         set portname [$port name]
@@ -4486,94 +4530,121 @@
                                     if {$fancy_output} {
                                         $revupgrade_progress intermission
                                     }
-                                    ui_warn "ID load command in ${bpath}, arch [machista::get_arch_name [$architecture cget -mat_arch]] refers to file ${idloadcmdpath}, which is a different file"
+                                    ui_warn "ID load command in ${bpath}, arch [machista::get_arch_name [$architecture cget -mat_arch]] (belonging to port $portname) contains relative path"
+                                } elseif {![file exists $idloadcmdpath]} {
+                                    set port [registry::entry owner $bpath]
+                                    if {$port ne {}} {
+                                        set portname [$port name]
+                                    } else {
+                                        set portname <unknown-port>
+                                    }
+                                    if {$fancy_output} {
+                                        $revupgrade_progress intermission
+                                    }
+                                    ui_warn "ID load command in ${bpath}, arch [machista::get_arch_name [$architecture cget -mat_arch]] refers to non-existant file $idloadcmdpath"
                                     ui_warn "This is probably a bug in the $portname port and might cause problems in libraries linking against this file"
+                                } else {
+                                    set hash_this [sha256 file $bpath]
+                                    set hash_idloadcmd [sha256 file $idloadcmdpath]
+
+                                    if {$hash_this ne $hash_idloadcmd} {
+                                        set port [registry::entry owner $bpath]
+                                        if {$port ne {}} {
+                                            set portname [$port name]
+                                        } else {
+                                            set portname <unknown-port>
+                                        }
+                                        if {$fancy_output} {
+                                            $revupgrade_progress intermission
+                                        }
+                                        ui_warn "ID load command in ${bpath}, arch [machista::get_arch_name [$architecture cget -mat_arch]] refers to file ${idloadcmdpath}, which is a different file"
+                                        ui_warn "This is probably a bug in the $portname port and might cause problems in libraries linking against this file"
+                                    }
                                 }
                             }
                         }
                     }
-                }
 
-                set archname [machista::get_arch_name [$architecture cget -mat_arch]]
-                if {![arch_runnable $archname]} {
-                    ui_debug "skipping $archname in $bpath since this system can't run it anyway"
-                    set architecture [$architecture cget -next]
-                    continue
-                }
-
-                set loadcommand [$architecture cget -mat_loadcmds]
-
-                while {$loadcommand ne {NULL}} {
-                    if {0 != [catch {set filepath [revupgrade_handle_special_paths $bpath [$loadcommand cget -mlt_install_name]]}]} {
-                        set loadcommand [$loadcommand cget -next]
-                        continue;
+                    set archname [machista::get_arch_name [$architecture cget -mat_arch]]
+                    if {![arch_runnable $archname]} {
+                        ui_debug "skipping $archname in $bpath since this system can't run it anyway"
+                        set architecture [$architecture cget -next]
+                        continue
                     }
 
-                    if {(${filepath} == "/usr/lib/libstdc++.6.dylib" && ${macports::cxx_stdlib} == "libc++") ||
-                        (${filepath} == "/usr/lib/libc++.1.dylib" && ${macports::cxx_stdlib} == "libstdc++")} {
+                    set loadcommand [$architecture cget -mat_loadcmds]
 
-                        if {$fancy_output} {
-                            $revupgrade_progress intermission
+                    while {$loadcommand ne {NULL}} {
+                        if {0 != [catch {set filepath [revupgrade_handle_special_paths $bpath [$loadcommand cget -mlt_install_name]]}]} {
+                            set loadcommand [$loadcommand cget -next]
+                            continue;
                         }
-                        ui_warn "${bpath} uses ${filepath} as C++ standard library although macports::cxx_stdlib is set to ${macports::cxx_stdlib}."
-                    }
 
-                    set libresultlist [machista::parse_file $handle $filepath]
-                    set libreturncode [lindex $libresultlist 0]
-                    set libresult     [lindex $libresultlist 1]
+                        set libresultlist [machista::parse_file $handle $filepath]
+                        set libreturncode [lindex $libresultlist 0]
+                        set libresult     [lindex $libresultlist 1]
 
-                    if {$libreturncode != $machista::SUCCESS} {
-                        if {![info exists files_warned_about($filepath)]} {
-                            if {$fancy_output} {
-                                $revupgrade_progress intermission
+                        if {$libreturncode != $machista::SUCCESS} {
+                            if {![info exists files_warned_about($filepath)]} {
+                                if {$fancy_output} {
+                                    $revupgrade_progress intermission
+                                }
+                                ui_info "Could not open ${filepath}: [machista::strerror $libreturncode] (referenced from $bpath)"
+                                if {[string first [file separator] $filepath] == -1} {
+                                    ui_info "${filepath} seems to be referenced using a relative path. This may be a problem with its canonical library name and require the use of install_name_tool(1) to fix."
+                                }
+                                set files_warned_about($filepath) yes
                             }
-                            ui_info "Could not open ${filepath}: [machista::strerror $libreturncode] (referenced from $bpath)"
-                            set files_warned_about($filepath) yes
+                            if {$libreturncode == $machista::EFILE} {
+                                ui_debug "Marking $bpath as broken"
+                                lappend broken_files $bpath
+                            }
+                            set loadcommand [$loadcommand cget -next]
+                            continue;
                         }
-                        if {$libreturncode == $machista::EFILE} {
-                            ui_debug "Marking $bpath as broken"
-                            lappend broken_files $bpath
-                        }
-                        set loadcommand [$loadcommand cget -next]
-                        continue;
-                    }
 
-                    set libarchitecture [$libresult cget -mt_archs]
-                    set libarch_found false;
-                    while {$libarchitecture ne {NULL}} {
-                        if {[$architecture cget -mat_arch] ne [$libarchitecture cget -mat_arch]} {
-                            set libarchitecture [$libarchitecture cget -next]
-                            continue;
+                        set libarchitecture [$libresult cget -mt_archs]
+                        set libarch_found false;
+                        while {$libarchitecture ne {NULL}} {
+                            if {[$architecture cget -mat_arch] ne [$libarchitecture cget -mat_arch]} {
+                                set libarchitecture [$libarchitecture cget -next]
+                                continue;
+                            }
+
+                            if {[$loadcommand cget -mlt_version] ne [$libarchitecture cget -mat_version] && [$loadcommand cget -mlt_comp_version] > [$libarchitecture cget -mat_comp_version]} {
+                                if {$fancy_output} {
+                                    $revupgrade_progress intermission
+                                }
+                                ui_info "Incompatible library version: $bpath requires version [machista::format_dylib_version [$loadcommand cget -mlt_comp_version]] or later, but $filepath provides version [machista::format_dylib_version [$libarchitecture cget -mat_comp_version]]"
+                                ui_debug "Marking $bpath as broken"
+                                lappend broken_files $bpath
+                            }
+
+                            set libarch_found true;
+                            break;
                         }
 
-                        if {[$loadcommand cget -mlt_version] ne [$libarchitecture cget -mat_version] && [$loadcommand cget -mlt_comp_version] > [$libarchitecture cget -mat_comp_version]} {
-                            if {$fancy_output} {
-                                $revupgrade_progress intermission
+                        if {$libarch_found eq "false"} {
+                            ui_debug "Missing architecture [machista::get_arch_name [$architecture cget -mat_arch]] in file $filepath"
+                            if {[path_is_in_prefix $filepath]} {
+                                ui_debug "Marking $bpath as broken"
+                                lappend broken_files $bpath
+                            } else {
+                                ui_debug "Missing architecture [machista::get_arch_name [$architecture cget -mat_arch]] in file outside prefix referenced from $bpath"
+                                # ui_debug "   How did you get that compiled anyway?"
                             }
-                            ui_info "Incompatible library version: $bpath requires version [machista::format_dylib_version [$loadcommand cget -mlt_comp_version]] or later, but $filepath provides version [machista::format_dylib_version [$libarchitecture cget -mat_comp_version]]"
-                            ui_debug "Marking $bpath as broken"
-                            lappend broken_files $bpath
                         }
-
-                        set libarch_found true;
-                        break;
+                        set loadcommand [$loadcommand cget -next]
                     }
 
-                    if {$libarch_found eq false} {
-                        ui_debug "Missing architecture [machista::get_arch_name [$architecture cget -mat_arch]] in file $filepath"
-                        if {[path_is_in_prefix $filepath]} {
-                            ui_debug "Marking $bpath as broken"
-                            lappend broken_files $bpath
-                        } else {
-                            ui_debug "Missing architecture [machista::get_arch_name [$architecture cget -mat_arch]] in file outside prefix referenced from $bpath"
-                            # ui_debug "   How did you get that compiled anyway?"
-                        }
-                    }
-                    set loadcommand [$loadcommand cget -next]
+                    set architecture [$architecture cget -next]
                 }
-
-                set architecture [$architecture cget -next]
             }
+        } catch {*} {
+            if {$fancy_output} {
+                $revupgrade_progress intermission
+            }
+            throw
         }
         if {$fancy_output} {
             $revupgrade_progress finish
@@ -4934,3 +5005,25 @@
     }
     return $archive_sites_conf_values
 }
+
+##
+# Escape a string for use in a POSIX shell, e.g., when passing it to the \c system Pextlib extension. This is necessary
+# to handle cases such as group names with backslashes correctly. See #43875 for an example of a problem caused by
+# missing quotes.
+#
+# @param arg The argument that should be escaped for use in a POSIX shell
+# @return A quoted version of the argument
+proc macports::shellescape {arg} {
+    set mapping {}
+    # Replace each backslash by a double backslash. Apparently Bash treats Backslashes in single-quoted strings
+    # differently depending on whether is was invoked as sh or bash: echo 'using \backslashes' preserves the backslash
+    # in bash mode, but interprets it in sh mode. Since the `system' command uses sh, escape backslashes.
+    lappend mapping "\\" "\\\\"
+    # Replace each single quote with a single quote (closing the currently open string), an escaped single quote \'
+    # (additional backslash needed to escape the backslash in Tcl), and another single quote (opening a new quoted
+    # string).
+    lappend mapping "'" "'\\''"
+
+    # Add a single quote at the start, escape all single quotes in the argument, and add a single quote at the end
+    return "'[string map $mapping $arg]'"
+}

Modified: branches/new-help-system/base/src/macports1.0/macports_dlist.tcl
===================================================================
--- branches/new-help-system/base/src/macports1.0/macports_dlist.tcl	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/macports1.0/macports_dlist.tcl	2014-08-03 15:04:12 UTC (rev 122999)
@@ -17,7 +17,7 @@
 # 3. Neither the name of Apple Inc. nor the names of its contributors
 #    may be used to endorse or promote products derived from this software
 #    without specific prior written permission.
-# 
+#
 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -55,21 +55,21 @@
 
 # dlist_match_multi
 # Returns all dependency entries for which the entry's value for 'key' exactly matches the given 'value'.
-#	dlist - the dependency list to search
-#	criteria - the key/value pairs to compare
+#   dlist - the dependency list to search
+#   criteria - the key/value pairs to compare
 
 proc dlist_match_multi {dlist criteria} {
 	set result {}
 	foreach ditem $dlist {
-	    set match 1
-	    foreach {key value} $criteria {
-		    if {[ditem_key $ditem $key] != $value} {
-			    set match 0
-			    break
-		    }
+		set match 1
+		foreach {key value} $criteria {
+			if {[ditem_key $ditem $key] != $value} {
+				set match 0
+				break
+			}
 		}
 		if {$match} {
-		    lappend result $ditem
+			lappend result $ditem
 		}
 	}
 	return $result
@@ -77,9 +77,9 @@
 
 # dlist_search
 # Returns all dependency entries whose 'key' contains 'value'.
-#	dlist - the dependency list to search
-#	key   - the key to compare: Requires, Provides, et al.
-#	value - the value to compare
+#   dlist - the dependency list to search
+#   key   - the key to compare: Requires, Provides, et al.
+#   value - the value to compare
 
 proc dlist_search {dlist key value} {
 	set result {}
@@ -93,22 +93,22 @@
 
 # dlist_delete
 # Deletes the specified ditem from the dlist.
-#	dlist - the list to search
-#	ditem - the item to delete
+#   dlist - the list to search
+#   ditem - the item to delete
 proc dlist_delete {dlist ditem} {
-    upvar $dlist uplist
-    set ix [lsearch -exact $uplist $ditem]
-    if {$ix >= 0} {
+	upvar $dlist uplist
+	set ix [lsearch -exact $uplist $ditem]
+	if {$ix >= 0} {
 		set uplist [lreplace $uplist $ix $ix]
-    }
+	}
 }
 
 # dlist_has_pending
 # Returns true if the dlist contains ditems
 # which will provide one of the specified names,
 # and thus are still "pending".
-#	dlist  - the dependency list to search
-#	tokens - the list of pending tokens to check for
+#   dlist  - the dependency list to search
+#   tokens - the list of pending tokens to check for
 
 proc dlist_has_pending {dlist tokens} {
 	foreach token $tokens {
@@ -153,9 +153,9 @@
 
 # ditem_key
 # Sets and returns the given key of the dependency item.
-#	ditem - the dependency item to operate on
-#	key   - the key to set
-#	value - optional value to set the key to
+#   ditem - the dependency item to operate on
+#   key   - the key to set
+#   value - optional value to set the key to
 
 proc ditem_key {ditem args} {
 	set nbargs [llength $args]
@@ -170,40 +170,40 @@
 
 # ditem_append
 # Appends the value to the given key of the dependency item.
-#	ditem - the dependency item to operate on
-#	key   - the key to append to
-#	value - the value to append to the key
+#   ditem - the dependency item to operate on
+#   key   - the key to append to
+#   value - the value to append to the key
 
 proc ditem_append {ditem key args} {
-	eval "return \[macports_dlist::ditem_append $ditem $key $args\]"
+	return [macports_dlist::ditem_append $ditem $key {*}$args]
 }
 
 # ditem_append_unique
 # Appends the value to the given key of the dependency item if
 # they were not there yet.
-#	ditem - the dependency item to operate on
-#	key   - the key to append to
-#	value - the value to append to the key
+#   ditem - the dependency item to operate on
+#   key   - the key to append to
+#   value - the value to append to the key
 
 proc ditem_append_unique {ditem key args} {
-	eval "return \[macports_dlist::ditem_append_unique $ditem $key $args\]"
+	return [macports_dlist::ditem_append_unique $ditem $key {*}$args]
 }
 
 # ditem_contains
 # Tests whether the ditem key contains the specified value;
 # or if the value is omitted, tests whether the key exists.
-#	ditem - the dependency item to test
-#	key   - the key to examine
-#	value - optional value to search for in the key
+#   ditem - the dependency item to test
+#   key   - the key to examine
+#   value - optional value to search for in the key
 proc ditem_contains {ditem key args} {
-	eval "return \[macports_dlist::ditem_contains $ditem $key $args\]"
+	return [macports_dlist::ditem_contains $ditem $key {*}$args]
 }
 
 # dlist_append_dependents
 # Returns the ditems which are dependents of the ditem specified.
-#	dlist - the dependency list to search
-#	ditem - the item which itself, and its dependents should be selected
-#	result - used for recursing, pass empty initially.
+#   dlist - the dependency list to search
+#   ditem - the item which itself, and its dependents should be selected
+#   result - used for recursing, pass empty initially.
 
 proc dlist_append_dependents {dlist ditem result} {
 	# Only append things if the root item is not in the list.
@@ -233,9 +233,9 @@
 # on unfulfilled tokens in the Uses key.  However these items
 # will eventually be returned if there are no alternatives.
 # Soft-dependencies can be implemented in this way.
-#	dlist      - the dependency list to select from
-#	statusdict - the status dictionary describing the history
-#	             of the dependency list.
+#   dlist      - the dependency list to select from
+#   statusdict - the status dictionary describing the history
+#                of the dependency list.
 
 proc dlist_get_next {dlist statusdict} {
 	upvar $statusdict upstatus
@@ -278,14 +278,14 @@
 # ditems are eligible to run (the selector returns {}) then
 # dlist_eval will exit with a list of the remaining ditems,
 # or {} if all ditems were evaluated.
-#	dlist    - the dependency list to evaluate
-#	testcond - test condition to populate the status dictionary
-#	           should return {-1, 0, 1}
-#	handler  - the handler to invoke on each ditem
-#	canfail  - If 1, then progress will not stop when a failure
-#	           occures; if 0, then dlist_eval will return on the
-#	           first failure
-#	selector - the selector for determining eligibility
+#   dlist    - the dependency list to evaluate
+#   testcond - test condition to populate the status dictionary
+#              should return {-1, 0, 1}
+#   handler  - the handler to invoke on each ditem
+#   canfail  - If 1, then progress will not stop when a failure
+#              occures; if 0, then dlist_eval will return on the
+#              first failure
+#   selector - the selector for determining eligibility
 
 proc dlist_eval {dlist testcond handler {canfail "0"} {selector "dlist_get_next"}} {
 	array set statusdict [list]
@@ -294,7 +294,7 @@
 	# can evaluate to true.
 	if {$testcond ne ""} {
 		foreach ditem $dlist {
-			if {[eval "expr \[\$testcond \$ditem\] == 1"]} {
+			if {[$testcond $ditem] == 1} {
 				foreach token [ditem_key $ditem provides] {
 					set statusdict($token) 1
 				}
@@ -308,14 +308,14 @@
 		set ditem [$selector $dlist statusdict]
 
 		if {$ditem == {}} {
-		    if {[llength $dlist] > 0} {
-		        ui_debug "dlist_eval: all entries in dependency list have unsatisfied dependencies; can't process"
-		    }
+			if {[llength $dlist] > 0} {
+				ui_debug "dlist_eval: all entries in dependency list have unsatisfied dependencies; can't process"
+			}
 			break
 		} else {
 			# $handler should return a unix status code, 0 for success.
 			# statusdict notation is 1 for success
-			if {[catch {eval "$handler $ditem"} result]} {
+			if {[catch {{*}$handler $ditem} result]} {
 				puts $result
 				return $dlist
 			}
@@ -388,7 +388,7 @@
 	variable $ditem
 	set x [lindex [array get $ditem $key] 1]
 	if {$x != {}} {
-		eval "lappend x $args"
+		lappend x {*}$args
 	} else {
 		set x $args
 	}
@@ -400,7 +400,7 @@
 	variable $ditem
 	set x [lindex [array get $ditem $key] 1]
 	if {$x != {}} {
-		eval "lappend x $args"
+		lappend x {*}$args
 		set x [lsort -unique $x]
 	} else {
 		set x $args
@@ -412,7 +412,7 @@
 proc ditem_contains {ditem key args} {
 	variable $ditem
 	if {[llength $args] == 0} {
-		eval "return \[info exists ${ditem}($key)\]"
+		return [info exists [set ditem]($key)]
 	} else {
 		set x [lindex [array get $ditem $key] 1]
 		if {[llength $x] > 0 && [lsearch -exact $x [lindex $args 0]] != -1} {
@@ -425,4 +425,3 @@
 
 # End of macports_dlist namespace
 }
-

Deleted: branches/new-help-system/base/src/macports1.0/macports_fastload.tcl.in
===================================================================
--- branches/new-help-system/base/src/macports1.0/macports_fastload.tcl.in	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/macports1.0/macports_fastload.tcl.in	2014-08-03 15:04:12 UTC (rev 122999)
@@ -1,91 +0,0 @@
-# -*- 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
-# macports_fastload.tcl.in
-# $Id$
-#
-# Copyright (c) 2005-2007, 2009-2010 The MacPorts Project
-# Copyright (c) 2004-2005 Paul Guyot, The MacPorts Project.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-#    notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-#    notice, this list of conditions and the following disclaimer in the
-#    documentation and/or other materials provided with the distribution.
-# 3. Neither the name of The MacPorts Project nor the names of its contributors
-#    may be used to endorse or promote products derived from this software
-#    without specific prior written permission.
-# 
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-#
-
-# This script is here to fast load all the MacPorts related packages.
-# This avoids the very expensive globbing of Tcl' package mechanism.
-# Please note that this is not required and base/ should work even if some
-# packages are moved as long as their new location is in Tcl's package paths.
-# However, this file also defines a workaround to avoid conflicts between a /
-# installation of MacPorts and a user installation of MacPorts (on the same box).
-# (this workaround isn't required on 10.4.2).
-#
-# The package command that's replaced in this code works somewhat differently
-# than the original version. In particular, users with multiple copies of a
-# package such as portuninstall (due to obsolete files being left from previous
-# installations) may experience problems due to different package loading
-# behavior.
-#
-if { [regexp {\d+\.\d+\.\d+} [info patchlevel]] &&
-        ([package vcompare [info patchlevel] 8.4.7] < 0) } {
-    global allpackages
-    if {![info exists allpackages]} {
-        # Only patch once.
-        array set allpackages {}
-        rename package package_native
-        proc package {args} {
-            global allpackages
-            if {([lindex $args 0] == "ifneeded") && ([llength $args] == 4)} {
-                set package_name [lindex $args 1]
-                set package_version [lindex $args 2]
-                set package_key ${package_name}::${package_version}
-                if {![info exists allpackages($package_key)]} {
-                    set allpackages($package_key) 1
-                    set result [eval package_native $args]
-                    } else {
-                        set result ""
-                    }
-            } else {
-                set result [eval package_native $args]
-            }
-            return $result
-        }
-    }
-}
-
-set sharetcldir [file normalize [file join [file dirname [info script]] ..]]
-if {[file exists $sharetcldir]} {
-    foreach dir [glob -directory $sharetcldir *] {
-        set pkgindex [file join $dir pkgIndex.tcl]
-        if [file exists $pkgindex] {
-            source $pkgindex
-        }
-    }
-}
-
-if { "@SQLITE3_TCL_DIR@" != "" } {
-    set dir "@SQLITE3_TCL_DIR@"
-    set pkgindex [file join $dir pkgIndex.tcl]
-    if [file exists $pkgindex] {
-        source $pkgindex
-    }
-}

Modified: branches/new-help-system/base/src/macports1.0/macports_test_autoconf.tcl.in
===================================================================
--- branches/new-help-system/base/src/macports1.0/macports_test_autoconf.tcl.in	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/macports1.0/macports_test_autoconf.tcl.in	2014-08-03 15:04:12 UTC (rev 122999)
@@ -32,6 +32,6 @@
 #
 
 namespace eval macports::autoconf {
-    variable macports_tcl_dir "@macports_tcl_dir@"
     variable prefix "@prefix@"
+    variable os_platform "@OS_PLATFORM@"
 }

Modified: branches/new-help-system/base/src/macports1.0/sysctl.c
===================================================================
--- branches/new-help-system/base/src/macports1.0/sysctl.c	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/macports1.0/sysctl.c	2014-08-03 15:04:12 UTC (rev 122999)
@@ -49,9 +49,13 @@
 /*
  * Read-only wrapper for sysctlbyname(3). Only works for values of type CTLTYPE_INT and CTLTYPE_QUAD.
  */
+#ifdef HAVE_SYSCTLBYNAME
 int SysctlCmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
+#else
+int SysctlCmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc UNUSED, Tcl_Obj *CONST objv[] UNUSED)
+#endif
 {
-#if HAVE_SYSCTLBYNAME
+#ifdef HAVE_SYSCTLBYNAME
     const char error_message[] = "sysctl failed: ";
     Tcl_Obj *tcl_result;
     int res;

Modified: branches/new-help-system/base/src/macports1.0/tests/Portfile
===================================================================
--- branches/new-help-system/base/src/macports1.0/tests/Portfile	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/macports1.0/tests/Portfile	2014-08-03 15:04:12 UTC (rev 122999)
@@ -1,40 +1,30 @@
-# $Id: Portfile 85472 2011-10-14 01:52:18Z dports at macports.org $
+# $Id$
 
-PortSystem              1.0
+PortSystem 1.0
 
-name                    fondu
-version                 060102
-revision                1
-platforms               darwin
-categories              print
-license                 BSD
-maintainers             nomaintainer
-homepage                http://fondu.sourceforge.net/
-master_sites            http://fondu.sourceforge.net/
+name			gcc_select
+version			0.1
+revision		4
+categories		sysutils
+platforms		darwin
+license		BSD
+maintainers		mww
+supported_archs		noarch
+description		Switch the default compiler
+long_description	gcc_select lets you switch the default compiler. \
+			It symlinks the standard compiler executables \
+			in the MacPorts prefix to the selected version.
 
-description             A set of programs to interconvert between Mac font \
-                        formats and pfb, ttf, otf and bdf files on UNIX.
+homepage		http://svn.macports.org/repository/macports/contrib/select/
+master_sites		${homepage}
+distname		select-${version}
+checksums		sha1 18e1f95c2ddd88210aa52eb696261859af2dc3a4
 
-long_description        Dealing with Mac fonts is hard on other operating \
-                        systems because Mac fonts are stored in the resource \
-                        fork, and other operating systems do not support \
-                        this concept. Fondu will extract the resource fork \
-                        from either a MacBinary file or a BinHex file. Ufond \
-                        will create a resource fork inside a MacBinary file.
+configure.args		--mandir=${prefix}/share/man --name=gcc
 
-checksums               md5 e20861beacddc1ab392bef7813641bf8
-extract.suffix          .tgz
-distfiles               ${name}_src-${version}${extract.suffix}
-
-post-patch {
-    reinplace "s|^CFLAGS = -g \$(WFLAGS)|CFLAGS = -g \$(WFLAGS) ${configure.cppflags} ${configure.cflags} ${configure.ldflags} [get_canonical_archflags]|g" ${worksrcpath}/Makefile.in
-}
-
-configure.args          --bindir=${prefix}/bin \
-                        --mandir=${prefix}/share/man
-
 post-destroot {
-    eval xinstall -m 644 [glob ${worksrcpath}/*.1] ${destroot}${prefix}/share/man/man1/
+    xinstall -d ${destroot}${prefix}/etc/select/gcc
+    touch ${destroot}${prefix}/etc/select/gcc/base
 }
 
-test.run		yes
+livecheck.type	none

Modified: branches/new-help-system/base/src/macports1.0/tests/macports.test
===================================================================
--- branches/new-help-system/base/src/macports1.0/tests/macports.test	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/macports1.0/tests/macports.test	2014-08-03 15:04:12 UTC (rev 122999)
@@ -2,12 +2,15 @@
 
 package require tcltest 2
 namespace import tcltest::*
-eval ::tcltest::configure $::argv
+::tcltest::configure {*}$::argv
 
 set pwd [file dirname [file normalize $argv0]]
 
 source ../macports_test_autoconf.tcl
-source $macports::autoconf::macports_tcl_dir/macports1.0/macports_fastload.tcl
+
+# constraint for darwin platform
+testConstraint darwin [expr {$macports::autoconf::os_platform eq "darwin"}]
+
 package require macports 1.0
 
 # clean leftovers from interrupted tests
@@ -35,20 +38,14 @@
 #set ui_options(ports_verbose) yes
 mportinit ui_options
 
-package require portutil 1.0
-package require portinstall 1.0
-package require portuninstall 1.0
 package require Thread
-source ../../registry2.0/portuninstall.tcl
-source ../../port1.0/port_autoconf.tcl
 source ./library.tcl
-macports_worker_init
 
 
 test mportclose {
     Mport close unit test.
 } -setup {
-    set mport [mportopen file://.]
+    set mport [mportopen file://${pwd}]
 } -body {
     if {[catch {mportclose $mport}] != 0} {
        return "FAIL: cannot run mportclose"
@@ -63,12 +60,13 @@
 
 
 test mportinfo {
-    Mport info uni test.
+    Mport info unit test.
 } -setup {
-    set mport [mportopen file://.]
+    set mport [mportopen file://${pwd}]
 } -body {
     set res [mportinfo $mport]
-    if {[lindex $res 2] != "canonical_active_variants"} {
+    catch {array set PortInfo $res}
+    if {![info exists PortInfo(canonical_active_variants)]} {
         return "FAIL: cannot get ::PortInfo"
     }
     return "Mport info successful."
@@ -77,101 +75,56 @@
 } -result "Mport info successful."
 
 
-test mportopen_installed {
-    Mport installed unit test.
-} -constraints {
-    root
+test worker_init {
+    Worker init unit test.
 } -setup {
-    set os.platform darwin
-    set macosx_version 10.8
-    set os.major 10
-    set os_version 11
-    set os_arch i386
-
-    set supported_archs {}
-    set configure.build_arch build_arch
-    set portarchivetype tgz
-
-    set destpath $pwd/work/destroot
-    set portdbpath $pwd/portdbpath
-    set workpath $pwd/fondu/work
-    set portpath $pwd
-
-    set subport fondu
-    set version 3.0
-    set revision 1
-    set epoch i386
-
-    file copy -force $pwd/Portfile /tmp/
-    set mport [mportopen file://.]
-
-    proc getportbuildpath {id {portname ""}} {
-        global portdbpath
-        regsub {://} $id {.} port_path
-        regsub -all {/} $port_path {_} port_path
-        return [file join $portdbpath build $port_path $portname]
+    set name [interp create]
+    set portpath $pwd/portpath
+    set porturl http://www.macports.org
+    set portbuildpath $pwd/build
+    set options {a b}
+    set variations {1 2}
+} -body {
+    macports::worker_init $name $portpath $porturl $portbuildpath $options $variations
+    if {$name ne "interp0"} {
+       return "FAIL: wrong workername"
     }
-
-    proc getportworkpath_from_buildpath {portbuildpath} {
-        return [file join $portbuildpath work]
+    if {[catch {$name eval source Portfile} result]} {
+       return "FAIL: cannot load Portfile"
     }
-
-    proc getportworkpath_from_portdir {portpath {portname ""}} {
-        return [getportworkpath_from_buildpath [getportbuildpath $portpath $portname]]
+    if {[$name eval findBinary ls] ne "/bin/ls"} {
+       return "FAIL: alias not created"
     }
-
-    source $pwd/../../port1.0/portmain.tcl
-
-    # sets up PortInfo array
-    if {[eval_variants variations] != 0} {
-        mportclose $mport
-        error "Error evaluating variants"
+    if {[$name eval return \$os_arch] ne $macports::os_arch} {
+       return "FAIL: var not set"
     }
+    return "Worker init successful."
+} -result "Worker init successful."
 
-    # set $version var
-    set workername [ditem_key $mport workername]
 
-    # run destroot
-    $workername eval eval_targets destroot
-
-    # portinstall setup
-    interp alias {} _cd {} cd
-    set macosx_deployment_target $pwd/deploy_target
-    file mkdir $pwd/$subport
-    file link -symbolic $pwd/$subport/work $pwd/work
-
-    if {[catch {portinstall::install_main}] != 0} {
-        return "FAIL: cannot install port"
-    }
-
-    set variants {}
-    set options {}
-
+test init_logging {
+    Init logging unit test.
+} -constraints {
+    root
+} -setup {
+    set mport [mportopen file://${pwd}]
 } -body {
-    set res [mportopen_installed $subport $version $revision $variants $options]
-    if {![string match "ditem_*" $res]} {
-       return "FAIL: installed port not opened"
+    if {[macports::init_logging $mport] != 0} {
+       return "FAIL: incorrect channels"
     }
-
-    if {[catch {mportclose_installed $res}] != 0} {
-       return "FAIL: cannot close port"
+    if {$macports::channels(any) != "stdout debuglog"} {
+       return "FAIL: incorrect channels(any)"
     }
-    if {[catch {mportclose_installed $res}] != 1} {
-       return "FAIL: installed port not closed"
+    if {(![info exists ui_options(ports_debug)] && $macports::channels(debug) ne "debuglog") || 
+        ([info exists ui_options(ports_debug)] && $macports::channels(debug) ne "stderr debuglog")} {
+       return "FAIL: incorrect channels(debug)"
     }
-    return "Installed port open successful."
-
+    return "Init logging successful."
 } -cleanup {
-    if {[catch {portuninstall::uninstall_main}] != 0} {
-        return "FAIL: cannot install port"
-    }
     mportclose $mport
+} -result "Init logging successful."
 
-    file delete -force $pwd/work
-    file delete -force $pwd/$subport
-} -result "Installed port open successful."
 
-
 test ui_isset {
     Ui is set unit test.
 } -body {
@@ -204,34 +157,12 @@
 } -result "Global option isset successful."
 
 
-test init_logging {
-    Init logging unit test.
-} -constraints {
-    root
-} -setup {
-    set mport [mportopen file://.]
-} -body {
-    if {[macports::init_logging $mport] != 0} {
-       return "FAIL: incorrect channels"
-    }
-    if {$macports::channels(any) != "stdout debuglog"} {
-       return "FAIL: incorrect channels(any)"
-    }
-    if {$macports::channels(debug) != "debuglog"} {
-       return "FAIL: incorrect channels(debug)"
-    }
-    return "Init logging successful."
-} -cleanup {
-    mportclose $mport
-} -result "Init logging successful."
-
-
 test ch_logging {
     Channel logging unit test. Assumes main.log filename.
 } -constraints {
     root
 } -setup {
-    set mport [mportopen file://.]
+    set mport [mportopen file://${pwd}]
 
     set portname [_mportkey $mport subport]
     set portpath [_mportkey $mport portpath]
@@ -260,7 +191,7 @@
 } -constraints {
     root
 } -setup {
-    set mport [mportopen file://.]
+    set mport [mportopen file://${pwd}]
     set ::logenabled 1
 } -body {
     if {[catch {macports::push_log $mport}] != 0} {
@@ -281,7 +212,7 @@
     set ::logenabled 1
     set ::logstack [open $pwd/logstack w+]
     set ::debuglog [open $pwd/log w+]
-    set mport [mportopen file://.]
+    set mport [mportopen file://${pwd}]
     if {[catch {macports::push_log $mport}] != 0} {
        return "FAIL: cannot push log"
     }
@@ -493,8 +424,9 @@
 
 test _is_valid_developer_dir {
     Check valid dev dir unit test.
+} -constraints {
+    darwin
 } -body {
-    set macports::set_developer /Applications/Xcode.app/Contents/Developer
     if {[macports::_is_valid_developer_dir $macports::developer_dir] != 1} {
        return "FAIL: valid dir not detected"
     }
@@ -505,6 +437,54 @@
 # test mportinit
 
 
+test mportopen_installed {
+    Mport installed unit test.
+} -constraints {
+    root
+} -setup {
+    set subport gcc_select
+    set version 0.1
+    set revision 4
+
+    set mport [mportopen file://${pwd}]
+
+    # run destroot
+    mportexec $mport destroot
+
+    if {[catch {mportexec $mport activate}] != 0} {
+        ui_debug "$::errorInfo"
+        return "FAIL: cannot install port"
+    }
+
+    set variants {}
+    set options {}
+
+} -body {
+    set res [mportopen_installed $subport $version $revision $variants $options]
+    if {![string match "ditem_*" $res]} {
+       return "FAIL: installed port not opened"
+    }
+
+    if {[catch {mportclose $res}] != 0} {
+       return "FAIL: cannot close port"
+    }
+    if {[catch {mportclose $res}] != 1} {
+       return "FAIL: installed port not closed"
+    }
+    return "Installed port open successful."
+
+} -cleanup {
+    if {[catch {mportexec $mport uninstall}] != 0} {
+        return "FAIL: cannot uninstall port"
+    }
+    mportclose $mport
+
+    file delete -force $pwd/work
+    file delete -force $pwd/$subport
+    cd $pwd
+} -result "Installed port open successful."
+
+
 test mportshutdown {
     Mport shutdown unit test.
 } -setup {
@@ -558,33 +538,6 @@
 } -result "Copy xcode plist successful."
 
 
-test worker_init {
-    Worker init unit test.
-} -setup {
-    set name [interp create]
-    set portpath $pwd/portpath
-    set porturl http://www.macports.org
-    set portbuildpath $pwd/build
-    set options {a b}
-    set variations {1 2}
-} -body {
-    macports::worker_init $name $portpath $porturl $portbuildpath $options $variations
-    if {$name != "interp0"} {
-       return "FAIL: wrong workername"
-    }
-    if {[$name eval source Portfile] != "yes"} {
-       return "FAIL: cannot load Portfile"
-    }
-    if {[$name eval findBinary ls] != "/bin/ls"} {
-       return "FAIL: alias not created"
-    }
-    if {[$name eval return \$os_arch] != "i386"} {
-       return "FAIL: var not set"
-    }
-    return "Worker init successful."
-} -result "Worker init successful."
-
-
 test create_thread {
     Create thread unit test.
 } -body {
@@ -615,9 +568,9 @@
 test fetch_port {
     Fetch port unit test.
 } -body {
-    set url http://packages.macports.org/fondu/fondu-060102_1.darwin_10.x86_64.tbz2
+    set url http://packages.macports.org/db_select/db_select-0.1_2.darwin_13.noarch.tbz2
     set res [macports::fetch_port $url]
-    if {$res != "${pwd}/portdbpath/portdirs/fondu-060102_1"} {
+    if {$res != "${pwd}/portdbpath/portdirs/db_select-0.1_2"} {
 	return "FAIL: cannot fetch port"
     }
     return "Fetch port successful."
@@ -641,9 +594,9 @@
 } -setup {
     close [open $pwd/local_file w+]
 } -body {
-    set url http://fondu.sourceforge.net/fondu_src-060102.tgz
+    set url http://packages.macports.org/db_select/db_select-0.1_2.darwin_13.noarch.tbz2
     set res [macports::getportdir $url]
-    if {$res != "${pwd}/portdbpath/portdirs/fondu_src-060102"} {
+    if {$res != "${pwd}/portdbpath/portdirs/db_select-0.1_2"} {
 	return "FAIL: invalid port directory"
     }
 
@@ -662,9 +615,9 @@
     Get port resource path. Doesn't check for 'file' protocol.
 } -body {
     set macports::portdbpath $pwd/portdbpath
-    set url "http://packages.macports.org/fondu/fondu-060102_1.darwin_12.x86_64.tbz2"
+    set url "http://packages.macports.org/db_select/db_select-0.1_2.darwin_13.noarch.tbz2"
     set default_path $pwd/portdbpath/sources/rsync.macports.org/release/tarballs/ports/_resources
-    set fallback_path $pwd/portdbpath/sources/packages.macports.org/fondu/fondu-060102_1.darwin_12.x86_64.tbz2/_resources
+    set fallback_path $pwd/portdbpath/sources/packages.macports.org/db_select/db_select-0.1_2.darwin_13.noarch.tbz2/_resources
 
     if {[macports::getportresourcepath $url "" yes] != $default_path} {
        return "FAIL: wrong resource path"
@@ -702,32 +655,30 @@
 # test mportopen
 
 
-# Covered by mportopen_installed
-# test mportclose_installed
-
-
 test mporttraverse {
-    Mport traverse unit test. Uses 3rd column of the Portfile.
+    Mport traverse unit test. Uses 3rd line of the Portfile.
 } -setup {
     file mkdir $pwd/porttree
-    file mkdir $pwd/porttree/cat1/fondu
-    file mkdir $pwd/porttree/cat2/fondu
+    file mkdir $pwd/porttree/cat1/gcc_select
+    file mkdir $pwd/porttree/cat2/gcc_select
 
-    file copy -force $pwd/Portfile $pwd/porttree/cat1/fondu/Portfile
-    file copy -force $pwd/Portfile $pwd/porttree/cat2/fondu/Portfile
+    file copy -force $pwd/Portfile $pwd/porttree/cat1/gcc_select/Portfile
+    file copy -force $pwd/Portfile $pwd/porttree/cat2/gcc_select/Portfile
 
     proc test_proc {file} {
        global pwd res
        set fd [open ${pwd}/porttree/${file}/Portfile r]
+       gets $fd
+       gets $fd
        gets $fd line
-       append res [lindex [split $line " "] 3]
+       append res [lindex [split $line " "] 1]
     }
 
     global res
     set res ""
 } -body {
     mporttraverse test_proc $pwd/porttree
-    if {$res != "8547285472"} {
+    if {$res != "1.01.0"} {
        return "FAIL: porttree not traversed"
     }
     return "Mport traverse successful."
@@ -942,9 +893,10 @@
     close $fd
 
     set macports::autoconf::macports_conf_path $pwd/archive_sites
-
+    unset -nocomplain macports::archive_sites_conf_values
 } -body {
     set res [macports::get_archive_sites_conf_values]
+    puts $res
     if {[lindex [split $res " "] 1] != "macports.org:nosubdir"} {
        return "FAIL: name not set"
     }
@@ -963,4 +915,39 @@
 } -result "Get archive sites conf values successful."
 
 
+set shellescapeTests [list \
+    "using \\backslashes" \
+    " spaces " \
+    "and	tabs" \
+    "quotes need to be \"supported\", too" \
+    "… and not only 'double-quotes'" \
+    "other meta chars such as \$dollar," \
+    "!bang, ;semicolon, :colon," \
+    "\$(subshells) and similar must be kept" \
+    ">redirects <& must be ignored as well as ampersands &"]
+test shellescaping {
+    Check whether shell escaping using macports::shellescape works correctly when passed to Pextlib's system extension.
+} -setup {
+    set outputfile "shellescapetestoutput.txt"
+    makeFile "" $outputfile
+
+} -body {
+    set first "yes"
+    foreach test $shellescapeTests {
+        if {$first eq "yes"} {
+            system "echo [macports::shellescape $test]  >$outputfile"
+            set first "no"
+        } else {
+            system "echo [macports::shellescape $test] >>$outputfile"
+        }
+    }
+
+    set fd [open $outputfile r]
+    set output [read -nonewline $fd]
+    close $fd
+    return $output
+} -cleanup {
+    removeFile $outputfile
+} -result [join $shellescapeTests "\n"]
+
 cleanupTests

Modified: branches/new-help-system/base/src/macports1.0/tests/macports_dlist.test
===================================================================
--- branches/new-help-system/base/src/macports1.0/tests/macports_dlist.test	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/macports1.0/tests/macports_dlist.test	2014-08-03 15:04:12 UTC (rev 122999)
@@ -4,7 +4,6 @@
 namespace import tcltest::*
 
 source ../macports_test_autoconf.tcl
-source $macports::autoconf::macports_tcl_dir/macports1.0/macports_fastload.tcl
 package require macports 1.0
 
 # Debug options
@@ -21,7 +20,7 @@
 } -setup {
     set mport [mportopen file://.]
     set crit {
-       provides fondu
+       provides gcc_select
        porturl file://.
     }
     set crit2 { provides fondu2 }
@@ -44,7 +43,7 @@
 } -setup {
     set mport [mportopen file://.]
 } -body {
-    if {[dlist_search $mport provides fondu] != $mport} {
+    if {[dlist_search $mport provides gcc_select] != $mport} {
        return "FAIL: matching item not found"
     }
     if {[dlist_search $mport provides fondu2] != ""} {
@@ -80,7 +79,7 @@
 } -setup {
     set mport [mportopen file://.]
 } -body {
-    if {[dlist_has_pending $mport fondu] != 1} {
+    if {[dlist_has_pending $mport gcc_select] != 1} {
        return "FAIL: not detected"
     }
     if {[dlist_has_pending $mport provides] != 0} {
@@ -140,7 +139,7 @@
     Dlist get next unit test.
 } -setup {
     set mport [mportopen file://.]
-    set dict {fondu}
+    set dict {gcc_select}
 } -body {
     if {[dlist_get_next $mport $dict] != $mport} {
        return "FAIL: wrong dlist"

Modified: branches/new-help-system/base/src/macports1.0/tests/macports_util.test
===================================================================
--- branches/new-help-system/base/src/macports1.0/tests/macports_util.test	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/macports1.0/tests/macports_util.test	2014-08-03 15:04:12 UTC (rev 122999)
@@ -4,7 +4,6 @@
 namespace import tcltest::*
 
 source ../macports_test_autoconf.tcl
-source $macports::autoconf::macports_tcl_dir/macports1.0/macports_fastload.tcl
 package require macports 1.0
 
 

Modified: branches/new-help-system/base/src/macports1.0/tests/test.tcl
===================================================================
--- branches/new-help-system/base/src/macports1.0/tests/test.tcl	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/macports1.0/tests/test.tcl	2014-08-03 15:04:12 UTC (rev 122999)
@@ -1,5 +1,5 @@
 # Global vars
-set arguments ""
+set arguments {}
 set test_name ""
 set color_out ""
 set tcl ""
@@ -17,8 +17,8 @@
 proc print_help {arg} {
     if { $arg eq "tests" } {
         puts "The list of available tests is:"
-	cd tests
-	set test_suite [glob *.test]
+        cd tests
+        set test_suite [glob *.test]
         foreach test $test_suite {
             puts [puts -nonewline "  "]$test
         }
@@ -41,7 +41,7 @@
         set index [expr {[lsearch $argv $arg] + 1}]
         set level [lindex $argv $index]
         if { $level >= 0 && $level <= 3 } {
-            append arguments "-debug " $level
+            lappend arguments -debug $level
         } else {
             puts "Invalid debug level."
             exit 1
@@ -50,29 +50,29 @@
         set index [expr {[lsearch $argv $arg] + 1}]
         set test_name [lindex $argv $index]
         set no 0
-	cd tests
-	set test_suite [glob *.test]
+        cd tests
+        set test_suite [glob *.test]
         foreach test $test_suite {
-            if { $test_name != $test } {
-                set no [expr {$no + 1}]
+            if {$test_name ne $test} {
+                incr no
             }
         }
-        if { $no == [llength $test_suite] } {
+        if {$no == [llength $test_suite]} {
             print_help tests
             exit 1
         }
-    } elseif { $arg eq "-l" } {
+    } elseif {$arg eq "-l"} {
         print_help tests
         exit 0
-    } elseif { $arg eq "-nocolor" } {
+    } elseif {$arg eq "-nocolor"} {
         set color_out "no"
     }
 }
 
 
 # Run tests
-if { $test_name ne ""} {
-    set result [eval exec $tcl $test_name $arguments 2>@stderr]
+if {$test_name ne ""} {
+    set result [exec -ignorestderr $tcl $test_name {*}$arguments]
     puts $result
 
 } else {
@@ -80,31 +80,33 @@
     set test_suite [glob *.test]
 
     foreach test $test_suite {
-        set result [eval exec $tcl $test $arguments 2>@stderr]
-	set lastline [lindex [split $result "\n"] end]
+        set result [exec -ignorestderr $tcl $test {*}$arguments]
+        set lastline [lindex [split $result "\n"] end]
 
-	if {[lrange [split $lastline "\t"] 1 1] != "Total"} {
-	    set lastline [lindex [split $result "\n"] end-2]
-	    set errmsg [lindex [split $result "\n"] end]
-	}
+        if {[lrange [split $lastline "\t"] 1 1] != "Total"} {
+            set lastline [lindex [split $result "\n"] end-2]
+            set errmsg [lindex [split $result "\n"] end]
+        }
 
-	set splitresult [split $lastline "\t"]
+        set splitresult [split $lastline "\t"]
         set total [lindex $splitresult 2]
         set pass [lindex $splitresult 4]
         set skip [lindex $splitresult 6]
         set fail [lindex $splitresult 8]
 
-	# Format output
-	if {$total < 10} { set total "0${total}"}
-	if {$pass < 10} { set pass "0${pass}"}
-	if {$skip < 10} { set skip "0${skip}"}
-	if {$fail < 10} { set fail "0${fail}"}
+        # Format output
+        if {$total < 10} { set total "0${total}"}
+        if {$pass < 10} { set pass "0${pass}"}
+        if {$skip < 10} { set skip "0${skip}"}
+        if {$fail < 10} { set fail "0${fail}"}
 
         # Check for errors.
-        if { $fail != 0 } { set err "yes" }
+        if {$fail != 0} {
+            set err "yes"
+        }
 
         set out ""
-        if { ($fail != 0 || $skip != 0) && $color_out eq "" } {
+        if {($fail != 0 || $skip != 0) && $color_out eq ""} {
             # Color failed tests.
             append out "\x1b\[1;31mTotal:" $total " Passed:" $pass " Failed:" $fail " Skipped:" $skip "  \x1b\[0m" $test
         } else {
@@ -113,19 +115,21 @@
 
         # Print results and constrints for auto-skipped tests.
         puts $out
-        if { $skip != 0 } {
+        if {$skip != 0} {
             set out "    Constraint: "
             append out [string trim $errmsg "\t {}"]
             puts $out
         }
-	if { $fail != 0 } {
-	    set end [expr {[string first $test $result 0] - 1}]
-	    puts [string range $result 0 $end]
-	}
+        if {$fail != 0} {
+            set end [expr {[string first $test $result 0] - 1}]
+            puts [string range $result 0 $end]
+        }
     }
 }
 
 # Return 1 if errors were found.
-if {$err ne ""} { exit 1 }
+if {$err ne ""} {
+    exit 1
+}
 
 return 0


Property changes on: branches/new-help-system/base/src/package1.0
___________________________________________________________________
Modified: svn:ignore
   - pkgIndex.tcl
package_test_autoconf.tcl

   + Makefile
package_test_autoconf.tcl
pkgIndex.tcl


Deleted: branches/new-help-system/base/src/package1.0/Makefile
===================================================================
--- branches/new-help-system/base/src/package1.0/Makefile	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/package1.0/Makefile	2014-08-03 15:04:12 UTC (rev 122999)
@@ -1,29 +0,0 @@
-INSTALLDIR=	${DESTDIR}${datadir}/macports/Tcl/package1.0
-
-SRCS=	package.tcl portdmg.tcl portmdmg.tcl portmpkg.tcl portpkg.tcl \
-	portrpm.tcl portsrpm.tcl portdpkg.tcl portunarchive.tcl \
-	portarchivefetch.tcl
-
-include ../../Mk/macports.autoconf.mk
-
-all:: pkgIndex.tcl
-
-pkgIndex.tcl: $(SRCS)
-	$(SILENT) ../pkg_mkindex.sh .
-
-clean::
-	rm -f pkgIndex.tcl
-
-distclean:: clean
-	rm -f package_test_autoconf.tcl
-
-test::
-	-$(prefix)/bin/port sync
-	$(TCLSH) ./tests/test.tcl -nocolor
-
-install:: all
-	$(INSTALL) -d -o ${DSTUSR} -g ${DSTGRP} -m ${DSTMODE} ${INSTALLDIR}
-	$(SILENT)set -x; for file in ${SRCS}; do \
-		$(INSTALL) -o ${DSTUSR} -g ${DSTGRP} -m 444 $$file ${INSTALLDIR}; \
-	done
-	$(INSTALL) -o ${DSTUSR} -g ${DSTGRP} -m 444 pkgIndex.tcl ${INSTALLDIR}

Copied: branches/new-help-system/base/src/package1.0/Makefile.in (from rev 122997, trunk/base/src/package1.0/Makefile.in)
===================================================================
--- branches/new-help-system/base/src/package1.0/Makefile.in	                        (rev 0)
+++ branches/new-help-system/base/src/package1.0/Makefile.in	2014-08-03 15:04:12 UTC (rev 122999)
@@ -0,0 +1,33 @@
+srcdir = @srcdir@
+VPATH  = @srcdir@
+
+include ../../Mk/macports.autoconf.mk
+
+INSTALLDIR=	${DESTDIR}${TCL_PACKAGE_PATH}/package1.0
+
+SRCS=	package.tcl portdmg.tcl portmdmg.tcl portmpkg.tcl portpkg.tcl \
+	portrpm.tcl portsrpm.tcl portdpkg.tcl portunarchive.tcl \
+	portarchivefetch.tcl
+
+all:: pkgIndex.tcl
+
+pkgIndex.tcl: $(SRCS)
+	$(SILENT) ../pkg_mkindex.sh .
+
+clean::
+	rm -f pkgIndex.tcl
+
+distclean:: clean
+	rm -f package_test_autoconf.tcl
+	rm -f Makefile
+
+test::
+	-$(prefix)/bin/port sync
+	$(TCLSH) $(srcdir)/tests/test.tcl -nocolor
+
+install:: all
+	$(INSTALL) -d -o "${DSTUSR}" -g "${DSTGRP}" -m "${DSTMODE}" "${INSTALLDIR}"
+	$(SILENT)set -x; for file in ${SRCS}; do \
+		$(INSTALL) -o "${DSTUSR}" -g "${DSTGRP}" -m 444 "$(srcdir)/$$file" "${INSTALLDIR}"; \
+	done
+	$(INSTALL) -o "${DSTUSR}" -g "${DSTGRP}" -m 444 pkgIndex.tcl "${INSTALLDIR}"

Modified: branches/new-help-system/base/src/package1.0/package_test_autoconf.tcl.in
===================================================================
--- branches/new-help-system/base/src/package1.0/package_test_autoconf.tcl.in	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/package1.0/package_test_autoconf.tcl.in	2014-08-03 15:04:12 UTC (rev 122999)
@@ -32,7 +32,6 @@
 #
 
 namespace eval macports::autoconf {
-    variable macports_tcl_dir "@macports_tcl_dir@"
     variable prefix "@prefix@"
 }
 

Modified: branches/new-help-system/base/src/package1.0/portarchivefetch.tcl
===================================================================
--- branches/new-help-system/base/src/package1.0/portarchivefetch.tcl	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/package1.0/portarchivefetch.tcl	2014-08-03 15:04:12 UTC (rev 122999)
@@ -216,6 +216,7 @@
             }
             set failed_sites 0
             unset -nocomplain fetched
+            set lastError ""
             foreach site $urlmap($url_var) {
                 if {[string index $site end] ne "/"} {
                     append site "/[option archive.subdir]"
@@ -225,13 +226,22 @@
                 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} {"${incoming_path}/${archive}.TMP"}} result]} {
-                    # Successful fetch
+                try {
+                    curl fetch --effective-url effectiveURL {*}$fetch_options $file_url "${incoming_path}/${archive}.TMP"
                     set fetched 1
                     break
-                } else {
-                    ui_debug "[msgcat::mc "Fetching archive failed:"]: $result"
+                } catch {{POSIX SIG SIGINT} eCode eMessage} {
+                    ui_debug [msgcat::mc "Aborted fetching archive due to SIGINT"]
                     file delete -force "${incoming_path}/${archive}.TMP"
+                    throw
+                } catch {{POSIX SIG SIGTERM} eCode eMessage} {
+                    ui_debug [msgcat::mc "Aborted fetching archive due to SIGTERM"]
+                    file delete -force "${incoming_path}/${archive}.TMP"
+                    throw
+                } catch {{*} eCode eMessage} {
+                    ui_debug [msgcat::mc "Fetching archive failed: %s" $eMessage]
+                    set lastError $eMessage
+                    file delete -force "${incoming_path}/${archive}.TMP"
                     incr failed_sites
                     if {$failed_sites > 2 && ![tbool ports_binary_only] && ![_archive_available]} {
                         break
@@ -243,7 +253,7 @@
                 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]} {
+                if {[catch {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"
                 }
@@ -285,7 +295,11 @@
         return 0
     }
     if {[info exists ports_binary_only] && $ports_binary_only eq "yes"} {
-        return -code error "archivefetch failed for [option subport] @[option version]_[option revision][option portvariants]"
+        if {[info exists lastError] && $lastError ne ""} {
+            error [msgcat::mc "version @[option version]_[option revision][option portvariants]: %s" $lastError]
+        } else {
+            error "version @[option version]_[option revision][option portvariants]"
+        }
     } else {
         return 0
     }
@@ -306,6 +320,8 @@
     }
     if {[info exists all_archive_files] && [llength $all_archive_files] > 0} {
         ui_msg "$UI_PREFIX [format [msgcat::mc "Fetching archive for %s"] $subport]"
+    } elseif {[tbool ports_binary_only]} {
+        error "Binary-only mode requested with no usable archive sites configured"
     }
     portfetch::check_dns
 }

Modified: branches/new-help-system/base/src/package1.0/portdpkg.tcl
===================================================================
--- branches/new-help-system/base/src/package1.0/portdpkg.tcl	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/package1.0/portdpkg.tcl	2014-08-03 15:04:12 UTC (rev 122999)
@@ -188,15 +188,15 @@
 			# xxx: only examines the portfile component of the depspec
 			set depends {}
 			if {[info exists portinfo(depends_run)]} {
-				eval "lappend depends $portinfo(depends_run)"
+				lappend depends {*}$portinfo(depends_run)
 			}
 			if {[info exists portinfo(depends_lib)]} {
-				eval "lappend depends $portinfo(depends_lib)"
+				lappend depends {*}$portinfo(depends_lib)
 			}
 
 			foreach depspec $depends {
 				set dep [lindex [split $depspec :] end]
-				eval "lappend result [make_dependency_list $dep]"
+				lappend result {*}[make_dependency_list $dep]
 			}
 		}
 				lappend result $portinfo(name)/$portinfo(version)

Modified: branches/new-help-system/base/src/package1.0/portmpkg.tcl
===================================================================
--- branches/new-help-system/base/src/package1.0/portmpkg.tcl	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/package1.0/portmpkg.tcl	2014-08-03 15:04:12 UTC (rev 122999)
@@ -92,7 +92,7 @@
     foreach depspec $depends {
         set dep [_get_dep_port $depspec]
         if {$dep ne ""} {
-            eval "lappend result [make_dependency_list $dep $destination]"
+            lappend result {*}[make_dependency_list $dep $destination]
         }
     }
 

Modified: branches/new-help-system/base/src/package1.0/portpkg.tcl
===================================================================
--- branches/new-help-system/base/src/package1.0/portpkg.tcl	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/package1.0/portpkg.tcl	2014-08-03 15:04:12 UTC (rev 122999)
@@ -134,7 +134,7 @@
         if ([file exists "${destpath}/$dir"]) {
             # certain toplevel directories really are symlinks. leaving them as directories make pax lose the symlinks. that's bad.
             file mkdir "${destpath}/private/${dir}"
-            eval file rename [glob ${destpath}/${dir}/*] "${destpath}/private/${dir}"
+            file rename {*}[glob ${destpath}/${dir}/*] "${destpath}/private/${dir}"
             delete "${destpath}/${dir}"
         }
     }

Modified: branches/new-help-system/base/src/package1.0/portrpm.tcl
===================================================================
--- branches/new-help-system/base/src/package1.0/portrpm.tcl	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/package1.0/portrpm.tcl	2014-08-03 15:04:12 UTC (rev 122999)
@@ -92,7 +92,7 @@
     foreach dir [list "${prefix}/src/macports/RPMS" "${prefix}/src/apple/RPMS" "/usr/src/apple/RPMS" "/macports/rpms/RPMS"] {
         foreach arch [list ${configure.build_arch} ${os.arch} "fat" "noarch"] {
             set rpmpath "$dir/${arch}/${portname}-${portversion}-${portrevision}.${arch}.rpm"
-	    if {[file readable $rpmpath] && ([file mtime ${rpmpath}] >= [file mtime ${portpath}/Portfile])} {
+            if {[file readable $rpmpath] && ([file mtime ${rpmpath}] >= [file mtime ${portpath}/Portfile])} {
                 ui_debug "$rpmpath"
                 ui_msg "$UI_PREFIX [format [msgcat::mc "RPM package for %s version %s is up-to-date"] ${portname} ${portversion}]"
                 return 0
@@ -125,8 +125,8 @@
         }
     }
 
-	# depend on system (virtual packages for apple stuff)
-	lappend dependencies "org.macports.${os.platform}${os.major}"
+    # depend on system (virtual packages for apple stuff)
+    lappend dependencies "org.macports.${os.platform}${os.major}"
 
     set listpath ${workpath}/${portname}.filelist
     system "rm -f '${workpath}/${portname}.filelist' && touch '${workpath}/${portname}.filelist'"
@@ -142,8 +142,8 @@
 proc portrpm::make_dependency_list {portname} {
     set result {}
     if {[catch {set res [mport_lookup $portname]} error]} {
-		global errorInfo
-		ui_debug "$errorInfo"
+        global errorInfo
+        ui_debug "$errorInfo"
         ui_error "port lookup failed: $error"
         return 1
     }
@@ -154,15 +154,19 @@
             # get the union of depends_run and depends_lib
             # xxx: only examines the portfile component of the depspec
             set depends {}
-            if {[info exists portinfo(depends_run)]} { eval "lappend depends $portinfo(depends_run)" }
-            if {[info exists portinfo(depends_lib)]} { eval "lappend depends $portinfo(depends_lib)" }
+            if {[info exists portinfo(depends_run)]} {
+                lappend depends {*}$portinfo(depends_run)
+            }
+            if {[info exists portinfo(depends_lib)]} {
+                lappend depends {*}$portinfo(depends_lib)
+            }
 
             foreach depspec $depends {
                 set dep [lindex [split $depspec :] end]
 
                 # xxx: nasty hack
-                if {$dep != "XFree86"} {
-                    eval "lappend result [make_dependency_list $dep]"
+                if {$dep ne "XFree86"} {
+                    lappend result {*}[make_dependency_list $dep]
                 }
             }
         }
@@ -181,21 +185,21 @@
     set words [split $orig]
     set numWords [llength $words]
     for {set cnt 0} {$cnt < $numWords} {incr cnt} {
-	set w [lindex $words $cnt]
-	set wLen [string length $w]
+        set w [lindex $words $cnt]
+        set wLen [string length $w]
 
-	if {($pos+$wLen < $Length)} {
-	    # append word to current line
-	    if {$pos} {append line " "; incr pos}
-	    append line $w
-	    incr pos $wLen
-	} else {
-	    # line full => write buffer and  begin a new line
-	    if {[string length $text]} {append text "\n"}
-	    append text $line
-	    set line $w
-	    set pos $wLen
-	}
+        if {($pos+$wLen < $Length)} {
+            # append word to current line
+            if {$pos} {append line " "; incr pos}
+            append line $w
+            incr pos $wLen
+        } else {
+            # line full => write buffer and  begin a new line
+            if {[string length $text]} {append text "\n"}
+            append text $line
+            set line $w
+            set pos $wLen
+        }
     }
 
     if {[string length $text]} {append text "\n"}
@@ -228,12 +232,12 @@
 BuildRoot: ${destroot}
 AutoReq: no"
     if {$epoch != 0} {
-	    puts $specfd "Epoch: ${epoch}"
+        puts $specfd "Epoch: ${epoch}"
     }
     if {[llength ${dependencies}] != 0} {
-	foreach require ${dependencies} {
-	    puts $specfd "Requires: [regsub -all -- "\-" $require "_"]"
-	}
+        foreach require ${dependencies} {
+            puts $specfd "Requires: [regsub -all -- "\-" $require "_"]"
+        }
     }
     set wrap_description [word_wrap ${long_description} 72]
     puts $specfd "

Modified: branches/new-help-system/base/src/package1.0/portsrpm.tcl
===================================================================
--- branches/new-help-system/base/src/package1.0/portsrpm.tcl	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/package1.0/portsrpm.tcl	2014-08-03 15:04:12 UTC (rev 122999)
@@ -81,7 +81,7 @@
     foreach dir [list "${prefix}/src/macports/SRPMS" "${prefix}/src/apple/SRPMS" "/usr/src/apple/SRPMS" "/macports/rpms/SRPMS"] {
         foreach arch {"src" "nosrc"} {
             set rpmpath "$dir/${portname}-${portversion}-${portrevision}.${arch}.rpm"
-	    if {[file readable $rpmpath] && ([file mtime ${rpmpath}] >= [file mtime ${portpath}/Portfile])} {
+            if {[file readable $rpmpath] && ([file mtime ${rpmpath}] >= [file mtime ${portpath}/Portfile])} {
                 ui_debug "$rpmpath"
                 ui_msg "$UI_PREFIX [format [msgcat::mc "SRPM package for %s version %s is up-to-date"] ${portname} ${portversion}]"
                 return 0
@@ -141,8 +141,8 @@
 proc portsrpm::make_dependency_list {portname} {
     set result {}
     if {[catch {set res [mport_lookup $portname]} error]} {
-		global errorInfo
-		ui_debug "$errorInfo"
+        global errorInfo
+        ui_debug "$errorInfo"
         ui_error "port lookup failed: $error"
         return 1
     }
@@ -154,17 +154,25 @@
             # get the union of depends_fetch, depends_extract, depends_build and depends_lib
             # xxx: only examines the portfile component of the depspec
             set depends {}
-            if {[info exists portinfo(depends_fetch)]} { eval "lappend depends $portinfo(depends_fetch)" }
-            if {[info exists portinfo(depends_extract)]} { eval "lappend depends $portinfo(depends_extract)" }
-            if {[info exists portinfo(depends_build)]} { eval "lappend depends $portinfo(depends_build)" }
-            if {[info exists portinfo(depends_lib)]} { eval "lappend depends $portinfo(depends_lib)" }
+            if {[info exists portinfo(depends_fetch)]} {
+                lappend depends {*}$portinfo(depends_fetch)
+            }
+            if {[info exists portinfo(depends_extract)]} {
+                lappend depends {*}$portinfo(depends_extract)
+            }
+            if {[info exists portinfo(depends_build)]} {
+                lappend depends {*}$portinfo(depends_build)
+            }
+            if {[info exists portinfo(depends_lib)]} {
+                lappend depends {*}$portinfo(depends_lib)
+            }
 
             foreach depspec $depends {
                 set dep [lindex [split $depspec :] end]
 
                 # xxx: nasty hack
                 if {$dep != "XFree86"} {
-                    eval "lappend result [make_dependency_list $dep]"
+                    lappend result {*}[make_dependency_list $dep]
                 }
             }
         }
@@ -183,21 +191,21 @@
     set words [split $orig]
     set numWords [llength $words]
     for {set cnt 0} {$cnt < $numWords} {incr cnt} {
-	set w [lindex $words $cnt]
-	set wLen [string length $w]
+        set w [lindex $words $cnt]
+        set wLen [string length $w]
 
-	if {($pos+$wLen < $Length)} {
-	    # append word to current line
-	    if {$pos} {append line " "; incr pos}
-	    append line $w
-	    incr pos $wLen
-	} else {
-	    # line full => write buffer and  begin a new line
-	    if {[string length $text]} {append text "\n"}
-	    append text $line
-	    set line $w
-	    set pos $wLen
-	}
+        if {($pos+$wLen < $Length)} {
+            # append word to current line
+            if {$pos} {append line " "; incr pos}
+            append line $w
+            incr pos $wLen
+        } else {
+            # line full => write buffer and  begin a new line
+            if {[string length $text]} {append text "\n"}
+            append text $line
+            set line $w
+            set pos $wLen
+        }
     }
 
     if {[string length $text]} {append text "\n"}
@@ -228,7 +236,7 @@
         puts $specfd "Source1: $zip"
     }
     if {$epoch != 0} {
-	    puts $specfd "Epoch: ${epoch}"
+        puts $specfd "Epoch: ${epoch}"
     }
     set first 2
     set count $first
@@ -254,9 +262,9 @@
     }
     puts $specfd "AutoReq: no"
     if {[llength ${dependencies}] != 0} {
-	foreach require ${dependencies} {
-	    puts $specfd "BuildRequires: [regsub -all -- "\-" $require "_"]"
-	}
+        foreach require ${dependencies} {
+            puts $specfd "BuildRequires: [regsub -all -- "\-" $require "_"]"
+        }
     }
     set wrap_description [word_wrap ${long_description} 72]
     if {$zip ne ""} {

Modified: branches/new-help-system/base/src/package1.0/portunarchive.tcl
===================================================================
--- branches/new-help-system/base/src/package1.0/portunarchive.tcl	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/package1.0/portunarchive.tcl	2014-08-03 15:04:12 UTC (rev 122999)
@@ -173,7 +173,13 @@
                 if {[regexp {z2?$} ${unarchive.type}]} {
                     set unarchive.args {-}
                     if {[regexp {bz2?$} ${unarchive.type}]} {
-                        set gzip "bzip2"
+                        if {![catch {binaryInPath lbzip2}]} {
+                            set gzip "lbzip2"
+                        } elseif {![catch {binaryInPath pbzip2}]} {
+                            set gzip "pbzip2"
+                        } else {
+                            set gzip "bzip2"
+                        }
                     } elseif {[regexp {lz$} ${unarchive.type}]} {
                         set gzip "lzma"
                     } elseif {[regexp {xz$} ${unarchive.type}]} {

Modified: branches/new-help-system/base/src/package1.0/tests/Portfile
===================================================================
--- branches/new-help-system/base/src/package1.0/tests/Portfile	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/package1.0/tests/Portfile	2014-08-03 15:04:12 UTC (rev 122999)
@@ -34,7 +34,7 @@
                         --mandir=${prefix}/share/man
 
 post-destroot {
-    eval xinstall -m 644 [glob ${worksrcpath}/*.1] ${destroot}${prefix}/share/man/man1/
+    xinstall -m 644 {*}[glob ${worksrcpath}/*.1] ${destroot}${prefix}/share/man/man1/
 }
 
 test.run		yes

Modified: branches/new-help-system/base/src/package1.0/tests/library.tcl
===================================================================
--- branches/new-help-system/base/src/package1.0/tests/library.tcl	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/package1.0/tests/library.tcl	2014-08-03 15:04:12 UTC (rev 122999)
@@ -104,3 +104,5 @@
     # We don't need to handle portinterp_deferred_options, they're
     # automatically handled correctly.
 }
+
+testConstraint darwin [expr {$tcl_platform(os) eq "Darwin"}]

Modified: branches/new-help-system/base/src/package1.0/tests/portarchivefetch.test
===================================================================
--- branches/new-help-system/base/src/package1.0/tests/portarchivefetch.test	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/package1.0/tests/portarchivefetch.test	2014-08-03 15:04:12 UTC (rev 122999)
@@ -6,7 +6,6 @@
 set pwd [file dirname [file normalize $argv0]]
 
 source ../package_test_autoconf.tcl
-source $macports::autoconf::macports_tcl_dir/macports1.0/macports_fastload.tcl
 package require macports 1.0
 
 array set ui_options {}
@@ -86,9 +85,9 @@
     env_init
 
     array set ::portfetch::urlmap {
-        fondu http://packages.macports.org/fondu/
+        db_select http://packages.macports.org/db_select/
     }
-    set portarchivefetch::archivefetch_urls {fondu fondu-060102_1.darwin_12.x86_64.tbz2}
+    set portarchivefetch::archivefetch_urls {db_select db_select-0.1_2.darwin_13.noarch.tbz2}
     set target_state_fd [open $pwd/target w+]
 
     set mport [mportopen file://.]
@@ -105,7 +104,7 @@
     if {[catch {portarchivefetch::fetchfiles}] != 0} {
         return "FAIL: cannot fetch archive"
     }
-    if {[file exists ${archivefetch.fulldestpath}/fondu-060102_1.darwin_12.x86_64.tbz2]} {
+    if {[file exists ${archivefetch.fulldestpath}/db_select-0.1_2.darwin_13.noarch.tbz2]} {
         return "FAIL: unverified archive not discarded"
     }
 
@@ -113,7 +112,7 @@
     if {[portarchivefetch::fetchfiles] != 0} {
         return "FAIL: cannot fetch archive"
     }
-    if {![file exists ${archivefetch.fulldestpath}/fondu-060102_1.darwin_12.x86_64.tbz2]} {
+    if {![file exists ${archivefetch.fulldestpath}/db_select-0.1_2.darwin_13.noarch.tbz2]} {
         return "FAIL: verified archive deleted"
     }
 

Modified: branches/new-help-system/base/src/package1.0/tests/portdmg.test
===================================================================
--- branches/new-help-system/base/src/package1.0/tests/portdmg.test	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/package1.0/tests/portdmg.test	2014-08-03 15:04:12 UTC (rev 122999)
@@ -6,7 +6,6 @@
 set pwd [file dirname [file normalize $argv0]]
 
 source ../package_test_autoconf.tcl
-source $macports::autoconf::macports_tcl_dir/macports1.0/macports_fastload.tcl
 package require macports 1.0
 
 array set ui_options {}
@@ -24,6 +23,8 @@
 
 test package_dmg {
     Package dmg unit test.
+} -constraints {
+    darwin
 } -setup {
     set os.major 10
     set os.arch i386

Modified: branches/new-help-system/base/src/package1.0/tests/portdpkg.test
===================================================================
--- branches/new-help-system/base/src/package1.0/tests/portdpkg.test	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/package1.0/tests/portdpkg.test	2014-08-03 15:04:12 UTC (rev 122999)
@@ -6,7 +6,6 @@
 set pwd [file dirname [file normalize $argv0]]
 
 source ../package_test_autoconf.tcl
-source $macports::autoconf::macports_tcl_dir/macports1.0/macports_fastload.tcl
 package require macports 1.0
 
 array set ui_options {}

Modified: branches/new-help-system/base/src/package1.0/tests/portmdmg.test
===================================================================
--- branches/new-help-system/base/src/package1.0/tests/portmdmg.test	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/package1.0/tests/portmdmg.test	2014-08-03 15:04:12 UTC (rev 122999)
@@ -6,7 +6,6 @@
 set pwd [file dirname [file normalize $argv0]]
 
 source ../package_test_autoconf.tcl
-source $macports::autoconf::macports_tcl_dir/macports1.0/macports_fastload.tcl
 package require macports 1.0
 
 array set ui_options {}
@@ -27,6 +26,8 @@
 
 test package_mdmg {
     Package mdmg unit test.
+} -constraints {
+    darwin
 } -setup {
     set os.major 10
     set os.arch i386

Modified: branches/new-help-system/base/src/package1.0/tests/portmpkg.test
===================================================================
--- branches/new-help-system/base/src/package1.0/tests/portmpkg.test	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/package1.0/tests/portmpkg.test	2014-08-03 15:04:12 UTC (rev 122999)
@@ -6,7 +6,6 @@
 set pwd [file dirname [file normalize $argv0]]
 
 source ../package_test_autoconf.tcl
-source $macports::autoconf::macports_tcl_dir/macports1.0/macports_fastload.tcl
 package require macports 1.0
 
 array set ui_options {}
@@ -22,6 +21,8 @@
 
 test mpkg_main {
     Port mpkg main unit test.
+} -constraints {
+    darwin
 } -setup {
     global os.platform os.major os.arch epoch destpath package.destpath configure.build_arch
     global subport version revision package.flat maintainers description categories

Modified: branches/new-help-system/base/src/package1.0/tests/portpkg.test
===================================================================
--- branches/new-help-system/base/src/package1.0/tests/portpkg.test	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/package1.0/tests/portpkg.test	2014-08-03 15:04:12 UTC (rev 122999)
@@ -6,7 +6,6 @@
 set pwd [file dirname [file normalize $argv0]]
 
 source ../package_test_autoconf.tcl
-source $macports::autoconf::macports_tcl_dir/macports1.0/macports_fastload.tcl
 package require macports 1.0
 
 array set ui_options {}
@@ -23,7 +22,7 @@
 test pkg_main {
     Port pkg main unit test.
 } -constraints {
-    root
+    root darwin
 } -setup {
     global os.platform os.major os.arch epoch destpath package.destpath configure.build_arch
     global subport version revision package.flat maintainers description categories

Modified: branches/new-help-system/base/src/package1.0/tests/test.tcl
===================================================================
--- branches/new-help-system/base/src/package1.0/tests/test.tcl	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/package1.0/tests/test.tcl	2014-08-03 15:04:12 UTC (rev 122999)
@@ -1,5 +1,5 @@
 # Global vars
-set arguments ""
+set arguments {}
 set test_name ""
 set color_out ""
 set tcl ""
@@ -17,8 +17,8 @@
 proc print_help {arg} {
     if { $arg eq "tests" } {
         puts "The list of available tests is:"
-	cd tests
-	set test_suite [glob *.test]
+        cd tests
+        set test_suite [glob *.test]
         foreach test $test_suite {
             puts [puts -nonewline "  "]$test
         }
@@ -34,82 +34,91 @@
 
 # Process args
 foreach arg $argv {
-    if { $arg eq "-h" || $arg eq "-help" } {
+    if {$arg eq "-h" || $arg eq "-help"} {
         print_help ""
         exit 0
-    } elseif { $arg eq "-debug" } {
+    } elseif {$arg eq "-debug"} {
         set index [expr {[lsearch $argv $arg] + 1}]
         set level [lindex $argv $index]
-        if { $level >= 0 && $level <= 3 } {
-            append arguments "-debug " $level
+        if {$level >= 0 && $level <= 3} {
+            lappend arguments "-debug" $level
         } else {
             puts "Invalid debug level."
             exit 1
         }
-    } elseif { $arg eq "-t" } {
+    } elseif {$arg eq "-t"} {
         set index [expr {[lsearch $argv $arg] + 1}]
         set test_name [lindex $argv $index]
         set no 0
-	cd tests
-	set test_suite [glob *.test]
+        cd tests
+        set test_suite [glob *.test]
         foreach test $test_suite {
-            if { $test_name != $test } {
+            if {$test_name ne $test} {
                 set no [expr {$no + 1}]
             }
         }
-        if { $no == [llength $test_suite] } {
+        if {$no == [llength $test_suite]} {
             print_help tests
             exit 1
         }
-    } elseif { $arg eq "-l" } {
+    } elseif {$arg eq "-l"} {
         print_help tests
         exit 0
-    } elseif { $arg eq "-nocolor" } {
+    } elseif {$arg eq "-nocolor"} {
         set color_out "no"
     }
 }
 
 
 # Run tests
-if { $test_name ne ""} {
-    set result [eval exec $tcl $test_name $arguments 2>@stderr]
+if {$test_name ne ""} {
+    set result [exec -ignorestderr $tcl $test_name {*}$arguments]
     puts $result
-
 } else {
     cd tests
     set test_suite [glob *.test]
 
     foreach test $test_suite {
-        set result [eval exec $tcl $test $arguments 2>@stderr]
-		set lastline [lindex [split $result "\n"] end]
+        set result [exec -ignorestderr $tcl $test {*}$arguments]
+        set lastline [lindex [split $result "\n"] end]
 
-	if {[lrange [split $lastline "\t"] 1 1] != "Total"} {
-		if {[lrange [split $lastline "\t"] 1 1] == ""} {
-			set lastline [lindex [split $result "\n"] 0]
-	    	set errmsg [lindex [split $result "\n"] 2]
-		} else {
-	    	set lastline [lindex [split $result "\n"] end-2]
-	    	set errmsg [lindex [split $result "\n"] end]
-		}
-	}
+        if {[lrange [split $lastline "\t"] 1 1] ne "Total"} {
+            if {[lrange [split $lastline "\t"] 1 1] eq ""} {
+                set lastline [lindex [split $result "\n"] 0]
+                set errmsg [lindex [split $result "\n"] 2]
+            } else {
+                set lastline [lindex [split $result "\n"] end-2]
+                set errmsg [lindex [split $result "\n"] end]
+            }
+        }
 
-	set splitresult [split $lastline "\t"]
+        set splitresult [split $lastline "\t"]
         set total [lindex $splitresult 2]
         set pass [lindex $splitresult 4]
         set skip [lindex $splitresult 6]
         set fail [lindex $splitresult 8]
 
-	# Format output
-	if {$total < 10} { set total "0${total}"}
-	if {$pass < 10} { set pass "0${pass}"}
-	if {$skip < 10} { set skip "0${skip}"}
-	if {$fail < 10} { set fail "0${fail}"}
+        # Format output
+        if {$total < 10} {
+            set total "0${total}"
+        }
+        if {$pass < 10} {
+            set pass "0${pass}"
+        }
+        if {$skip < 10} {
+            set skip "0${skip}"
+        }
+        if {$fail < 10} {
+            set fail "0${fail}"
+        }
 
         # Check for errors.
-        if { $fail != 0 } { set err "yes" }
+        if {$fail != 0} {
+            set err "yes"
+        }
 
         set out ""
-        if { ($fail != 0 || $skip != 0) && $color_out eq "" } {
+        if {($fail != 0 || $skip != 0) && $color_out eq ""} {
             # Color failed tests.
             append out "\x1b\[1;31mTotal:" $total " Passed:" $pass " Failed:" $fail " Skipped:" $skip "  \x1b\[0m" $test
         } else {
@@ -118,19 +127,21 @@
 
         # Print results and constrints for auto-skipped tests.
         puts $out
-        if { $skip != 0 } {
+        if {$skip != 0} {
             set out "    Constraint: "
             append out [string trim $errmsg "\t {}"]
             puts $out
         }
-	if { $fail != 0 } {
-	    set end [expr {[string first $test $result 0] - 1}]
-	    puts [string range $result 0 $end]
-	}
+        if {$fail != 0} {
+            set end [expr {[string first $test $result 0] - 1}]
+            puts [string range $result 0 $end]
+        }
     }
 }
 
 # Return 1 if errors were found.
-if {$err ne ""} { exit 1 }
+if {$err ne ""} {
+    exit 1
+}
 
 return 0

Modified: branches/new-help-system/base/src/pextlib1.0/Makefile.in
===================================================================
--- branches/new-help-system/base/src/pextlib1.0/Makefile.in	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/pextlib1.0/Makefile.in	2014-08-03 15:04:12 UTC (rev 122999)
@@ -1,3 +1,8 @@
+srcdir = @srcdir@
+VPATH  = @srcdir@
+
+include ../../Mk/macports.autoconf.mk
+
 OBJS= \
 	Pextlib.o strsed.o fgetln.o md5cmd.o setmode.o xinstall.o \
 	fs-traverse.o strcasecmp.o vercomp.o filemap.o base32cmd.o \
@@ -9,29 +14,28 @@
 endif
 
 SHLIB_NAME= Pextlib${SHLIB_SUFFIX}
-INSTALLDIR= ${DESTDIR}${datadir}/macports/Tcl/pextlib1.0
+INSTALLDIR= ${DESTDIR}${TCL_PACKAGE_PATH}/pextlib1.0
 
-include ../../Mk/macports.autoconf.mk
-include ../../Mk/macports.tea.mk
+include $(srcdir)/../../Mk/macports.tea.mk
 
 CFLAGS+= ${CURL_CFLAGS} ${MD5_CFLAGS} ${READLINE_CFLAGS}
 LIBS+= ${CURL_LIBS} ${MD5_LIBS} ${READLINE_LIBS}
 ifeq ($(shell uname), Darwin)
 LIBS+= ../registry2.0/registry${SHLIB_SUFFIX}
-SHLIB_LDFLAGS+= -install_name ${datadir}/macports/Tcl/pextlib1.0/${SHLIB_NAME}
+SHLIB_LDFLAGS+= -install_name ${TCL_PACKAGE_PATH}/pextlib1.0/${SHLIB_NAME}
 ${SHLIB_NAME}: ../registry2.0/registry${SHLIB_SUFFIX}
 endif
 
 .PHONY: test
 
 test:: ${SHLIB_NAME}
-	${TCLSH} tests/checksums.tcl ./${SHLIB_NAME}
-	${TCLSH} tests/curl.tcl ./${SHLIB_NAME}
-	${TCLSH} tests/filemap.tcl ./${SHLIB_NAME}
-	${TCLSH} tests/fs-traverse.tcl ./${SHLIB_NAME}
-	${TCLSH} tests/symlink.tcl ./${SHLIB_NAME}
-	${TCLSH} tests/unsetenv.tcl ./${SHLIB_NAME}
-	${TCLSH} tests/vercomp.tcl ./${SHLIB_NAME}
+	${TCLSH} $(srcdir)/tests/checksums.tcl ./${SHLIB_NAME}
+	${TCLSH} $(srcdir)/tests/curl.tcl ./${SHLIB_NAME}
+	${TCLSH} $(srcdir)/tests/filemap.tcl ./${SHLIB_NAME}
+	${TCLSH} $(srcdir)/tests/fs-traverse.tcl ./${SHLIB_NAME}
+	${TCLSH} $(srcdir)/tests/symlink.tcl ./${SHLIB_NAME}
+	${TCLSH} $(srcdir)/tests/unsetenv.tcl ./${SHLIB_NAME}
+	${TCLSH} $(srcdir)/tests/vercomp.tcl ./${SHLIB_NAME}
 
 distclean::
 	rm -f Makefile


Property changes on: branches/new-help-system/base/src/pextlib1.0/Makefile.in
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/gsoc08-privileges/base/src/pextlib1.0/Makefile:37343-46937
/branches/gsoc08-privileges/base/src/pextlib1.0/Makefile.in:37343-46937
/branches/gsoc09-logging/base/src/pextlib1.0/Makefile:51231-60371
/branches/gsoc09-logging/base/src/pextlib1.0/Makefile.in:51231-60371
/branches/gsoc11-rev-upgrade/base/src/pextlib1.0/Makefile:78828-88375
/branches/gsoc11-rev-upgrade/base/src/pextlib1.0/Makefile.in:78828-88375
/branches/gsoc13-tests/src/pextlib1.0/Makefile.in:106692-111324
/branches/universal-sanity/base/src/pextlib1.0/Makefile:51872-52323
/branches/universal-sanity/base/src/pextlib1.0/Makefile.in:51872-52323
/branches/variant-descs-14482/base/src/pextlib1.0/Makefile:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
/branches/variant-descs-14482/base/src/pextlib1.0/Makefile.in:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
/trunk/base/src/pextlib1.0/Makefile.in:49341-104698,108155-117083
/users/perry/base-bugs_and_notes/src/pextlib1.0/Makefile:45682-46060
/users/perry/base-bugs_and_notes/src/pextlib1.0/Makefile.in:45682-46060
/users/perry/base-select/src/pextlib1.0/Makefile:44044-44692
/users/perry/base-select/src/pextlib1.0/Makefile.in:44044-44692
   + /branches/gsoc08-privileges/base/src/pextlib1.0/Makefile:37343-46937
/branches/gsoc08-privileges/base/src/pextlib1.0/Makefile.in:37343-46937
/branches/gsoc09-logging/base/src/pextlib1.0/Makefile:51231-60371
/branches/gsoc09-logging/base/src/pextlib1.0/Makefile.in:51231-60371
/branches/gsoc11-rev-upgrade/base/src/pextlib1.0/Makefile:78828-88375
/branches/gsoc11-rev-upgrade/base/src/pextlib1.0/Makefile.in:78828-88375
/branches/gsoc13-tests/src/pextlib1.0/Makefile.in:106692-111324
/branches/universal-sanity/base/src/pextlib1.0/Makefile:51872-52323
/branches/universal-sanity/base/src/pextlib1.0/Makefile.in:51872-52323
/branches/variant-descs-14482/base/src/pextlib1.0/Makefile:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
/branches/variant-descs-14482/base/src/pextlib1.0/Makefile.in:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
/trunk/base/src/pextlib1.0/Makefile.in:49341-104698,108155-122997
/users/perry/base-bugs_and_notes/src/pextlib1.0/Makefile:45682-46060
/users/perry/base-bugs_and_notes/src/pextlib1.0/Makefile.in:45682-46060
/users/perry/base-select/src/pextlib1.0/Makefile:44044-44692
/users/perry/base-select/src/pextlib1.0/Makefile.in:44044-44692

Modified: branches/new-help-system/base/src/pextlib1.0/Pextlib.c
===================================================================
--- branches/new-help-system/base/src/pextlib1.0/Pextlib.c	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/pextlib1.0/Pextlib.c	2014-08-03 15:04:12 UTC (rev 122999)
@@ -33,10 +33,17 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-#if HAVE_CONFIG_H
+#ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
+/* required for strdup(3) on Linux and OS X */
+#define _XOPEN_SOURCE 600L
+/* required for clearenv(3)/setenv(3)/unsetenv(3) on Linux */
+#define _BSD_SOURCE
+/* required for clearenv(3)/setenv(3)/unsetenv(3) on OS X */
+#define _DARWIN_C_SOURCE
+
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/stat.h>
@@ -94,7 +101,7 @@
 extern char **environ;
 #endif
 
-#if !HAVE_SETMODE
+#ifndef HAVE_SETMODE
 #include "setmode.h"
 #endif
 
@@ -361,13 +368,6 @@
 int UnsetEnvCmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
 {
     char *name;
-    char **envp;
-    char *equals;
-    size_t len;
-    Tcl_Obj *tclList;
-    int listLength;
-    Tcl_Obj **listArray;
-    int loopCounter;
 
     if (objc != 2) {
         Tcl_WrongNumArgs(interp, 1, objv, "name");
@@ -386,18 +386,21 @@
            clearenv() but that is not yet standardized, instead use Tcl's
            list capability to easily build an array of strings for each
            env name, then loop through that list to unsetenv() each one */
-        tclList = Tcl_NewListObj( 0, NULL );
+        Tcl_Obj *tclList = Tcl_NewListObj( 0, NULL );
         Tcl_IncrRefCount( tclList );
         /* unset all current environment variables */
-        for (envp = environ; *envp != NULL; envp++) {
-            equals = strchr(*envp, '=');
+        for (char **envp = environ; *envp != NULL; envp++) {
+            char *equals = strchr(*envp, '=');
             if (equals != NULL) {
-                len = (size_t)(equals - *envp);
+				size_t len = (size_t)(equals - *envp);
                 Tcl_ListObjAppendElement(interp, tclList, Tcl_NewStringObj(*envp, len));
             }
         }
+
+		int listLength;
+		Tcl_Obj **listArray;
         Tcl_ListObjGetElements(interp, tclList, &listLength, &listArray);
-        for (loopCounter = 0; loopCounter < listLength; loopCounter++) {
+        for (int loopCounter = 0; loopCounter < listLength; loopCounter++) {
             unsetenv(Tcl_GetString(listArray[loopCounter]));
         }
         Tcl_DecrRefCount( tclList );

Modified: branches/new-help-system/base/src/pextlib1.0/curl.c
===================================================================
--- branches/new-help-system/base/src/pextlib1.0/curl.c	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/pextlib1.0/curl.c	2014-08-03 15:04:12 UTC (rev 122999)
@@ -41,6 +41,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <sys/select.h>
 #include <utime.h>
 
 #include <curl/curl.h>
@@ -61,12 +62,17 @@
 /* ========================================================================= **
  * Definitions
  * ========================================================================= */
-#pragma mark Definitions
 
 /* ------------------------------------------------------------------------- **
- * Global cURL handle
+ * Global cURL handles
  * ------------------------------------------------------------------------- */
-/* we use a single global handle rather than creating and destroying handles to
+/* If we want to use TclX' signal handling mechanism we need cURL to return
+ * control to our code from time to time so we can call Tcl_AsyncInvoke to
+ * process pending signals. To do that, we could either abuse the curl progress
+ * callback (which would mean we could no longer use the default curl progress
+ * callback, or we need to use the cURL multi API. */
+static CURLM* theMHandle = NULL;
+/* We use a single global handle rather than creating and destroying handles to
  * take advantage of HTTP pipelining, especially to the packages servers. */
 static CURL* theHandle = NULL;
 
@@ -74,6 +80,7 @@
  * Prototypes
  * ------------------------------------------------------------------------- */
 int SetResultFromCurlErrorCode(Tcl_Interp* interp, CURLcode inErrorCode);
+int SetResultFromCurlMErrorCode(Tcl_Interp* interp, CURLMcode inErrorCode);
 int CurlFetchCmd(Tcl_Interp* interp, int objc, Tcl_Obj* CONST objv[]);
 int CurlIsNewerCmd(Tcl_Interp* interp, int objc, Tcl_Obj* CONST objv[]);
 int CurlGetSizeCmd(Tcl_Interp* interp, int objc, Tcl_Obj* CONST objv[]);
@@ -93,8 +100,6 @@
 /* ========================================================================= **
  * Entry points
  * ========================================================================= */
-#pragma mark -
-#pragma mark Entry points
 
 /**
  * Set the result if a libcurl error occurred return TCL_ERROR.
@@ -120,6 +125,29 @@
 }
 
 /**
+ * Set the result if a libcurl multi error occurred return TCL_ERROR.
+ * Otherwise, set the result to "" and return TCL_OK.
+ *
+ * @param interp		pointer to the interpreter.
+ * @param inErrorCode	code of the multi error.
+ * @return TCL_OK if inErrorCode is 0, TCL_ERROR otherwise.
+ */
+int
+SetResultFromCurlMErrorCode(Tcl_Interp *interp, CURLMcode inErrorCode)
+{
+	int result = TCL_ERROR;
+
+	if (inErrorCode == CURLM_OK) {
+		Tcl_SetResult(interp, "", TCL_STATIC);
+		result = TCL_OK;
+	} else {
+		Tcl_SetResult(interp, (char *)curl_multi_strerror(inErrorCode), TCL_VOLATILE);
+	}
+
+	return result;
+}
+
+/**
  * curl fetch subcommand entry point.
  *
  * syntax: curl fetch [--disable-epsv] [--ignore-ssl-cert] [--remote-time] [-u userpass] [--effective-url lasturlvar] [--progress "builtin"|callback] url filename
@@ -132,8 +160,8 @@
 CurlFetchCmd(Tcl_Interp* interp, int objc, Tcl_Obj* CONST objv[])
 {
 	int theResult = TCL_OK;
+	bool handleAdded = false;
 	FILE* theFile = NULL;
-	bool performFailed = false;
 	char theErrorString[CURL_ERROR_SIZE];
 
 	do {
@@ -156,7 +184,10 @@
 		const char* theFilePath;
 		long theFileTime = 0;
 		CURLcode theCurlCode;
+		CURLMcode theCurlMCode;
 		struct curl_slist *headers = NULL;
+		struct CURLMsg *info = NULL;
+		int running; /* number of running transfers */
 
 		/* we might have options and then the url and the file */
 		/* let's process the options first */
@@ -260,10 +291,25 @@
 			break;
 		}
 
-		/* Create the CURL handle */
+		/* Create the CURL handles */
+		if (theMHandle == NULL) {
+			/* Re-use existing multi handle if theMHandle isn't NULL */
+			theMHandle = curl_multi_init();
+			if (theMHandle == NULL) {
+				theResult = TCL_ERROR;
+				Tcl_SetResult(interp, "error in curl_multi_init", TCL_STATIC);
+				break;
+			}
+		}
+
 		if (theHandle == NULL) {
 			/* Re-use existing handle if theHandle isn't NULL */
 			theHandle = curl_easy_init();
+			if (theHandle == NULL) {
+				theResult = TCL_ERROR;
+				Tcl_SetResult(interp, "error in curl_easy_init", TCL_STATIC);
+				break;
+			}
 		}
 		/* If we're re-using a handle, the previous call did ensure to reset it
 		 * to the default state using curl_easy_reset(3) */
@@ -432,18 +478,134 @@
 			break;
 		}
 
-		/* actually fetch the resource */
-		theCurlCode = curl_easy_perform(theHandle);
-		if (theCurlCode != CURLE_OK) {
-			performFailed = true;
+		/* add the easy handle to the multi handle */
+		theCurlMCode = curl_multi_add_handle(theMHandle, theHandle);
+		if (theCurlMCode != CURLM_OK) {
+			theResult = SetResultFromCurlMErrorCode(interp, theCurlMCode);
 			break;
 		}
+		handleAdded = true;
 
+		/* select(2) the file descriptors used by curl and interleave with
+		 * checks for TclX signals */
+		do {
+			int rc; /* select() return code */
+
+			/* arguments for select(2) */
+			int nfds;
+			fd_set readfds;
+			fd_set writefds;
+			fd_set errorfds;
+			struct timeval timeout;
+
+			long curl_timeout = -1;
+
+			/* use at most half a second as timeout */
+			timeout.tv_sec = 0;
+			timeout.tv_usec = 500 * 1000;
+
+			/* get the next timeout */
+			theCurlMCode = curl_multi_timeout(theMHandle, &curl_timeout);
+			if (theCurlMCode != CURLM_OK) {
+				theResult = SetResultFromCurlMErrorCode(interp, theCurlMCode);
+				break;
+			}
+
+			timeout.tv_sec = 1;
+			timeout.tv_usec = 0;
+			/* convert the timeout into a suitable format for select(2) and
+			 * limit the timeout to 500 msecs at most */
+			if (curl_timeout > 0) {
+				timeout.tv_sec = curl_timeout / 1000;
+				if (timeout.tv_sec > 1) {
+					timeout.tv_sec = 1;
+				}
+
+				timeout.tv_usec = (curl_timeout % 1000) * 1000;
+			}
+
+			/* get the fd sets for select(2) */
+			FD_ZERO(&readfds);
+			FD_ZERO(&writefds);
+			FD_ZERO(&errorfds);
+			theCurlMCode = curl_multi_fdset(theMHandle, &readfds, &writefds, &errorfds, &nfds);
+			if (theCurlMCode != CURLM_OK) {
+				theResult = SetResultFromCurlMErrorCode(interp, theCurlMCode);
+				break;
+			}
+
+			/* The value of nfds is guaranteed to be >= -1. Passing nfds + 1 to
+			 * select(2) makes the case of nfds == -1 a sleep. */
+			rc = select(nfds + 1, &readfds, &writefds, &errorfds, &timeout);
+			if (-1 == rc) {
+				/* check for signals first to avoid breaking our special
+				 * handling of SIGINT and SIGTERM */
+				if (Tcl_AsyncReady()) {
+					theResult = Tcl_AsyncInvoke(interp, theResult);
+					if (theResult != TCL_OK) {
+						break;
+					}
+				}
+
+				/* select error */
+				Tcl_SetResult(interp, strerror(errno), TCL_VOLATILE);
+				theResult = TCL_ERROR;
+				break;
+			}
+
+			/* timeout or activity */
+			theCurlMCode = curl_multi_perform(theMHandle, &running);
+
+			/* process signals from TclX */
+			if (Tcl_AsyncReady()) {
+				theResult = Tcl_AsyncInvoke(interp, theResult);
+				if (theResult != TCL_OK) {
+					break;
+				}
+			}
+		} while (running > 0);
+
+		/* Find out whether the transfer succeeded or failed. */
+		info = curl_multi_info_read(theMHandle, &running);
+		if (running > 0) {
+			fprintf(stderr, "Warning: curl_multi_info_read has %d more structs available\n", running);
+		}
+
+		/* free header memory */
+		curl_slist_free_all(headers);
+
 		/* signal cleanup to the progress callback */
 		if (noprogress == 0 && strcmp(progressCallback.proc, "builtin") != 0) {
 			CurlProgressCleanup(&progressCallback);
 		}
 
+		/* check for errors in the loop */
+		if (theResult != TCL_OK || theCurlMCode != CURLM_OK) {
+			break;
+		}
+
+		/* we should always get CURLMSG_DONE unless we aborted due to a Tcl
+		 * signal */
+		if (info == NULL) {
+			Tcl_SetResult(interp, "curl_multi_info_read() returned NULL", TCL_STATIC);
+			theResult = TCL_ERROR;
+			break;
+		}
+
+		if (info->msg != CURLMSG_DONE) {
+			snprintf(theErrorString, sizeof(theErrorString), "curl_multi_info_read() returned unexpected {.msg = %d, .data.result = %d}", info->msg, info->data.result);
+			Tcl_SetResult(interp, theErrorString, TCL_VOLATILE);
+			theResult = TCL_ERROR;
+			break;
+		}
+		
+		if (info->data.result != CURLE_OK) {
+			/* execution failed, use the error string */
+			Tcl_SetResult(interp, theErrorString, TCL_VOLATILE);
+			theResult = TCL_ERROR;
+			break;
+		}
+
 		/* close the file */
 		(void) fclose(theFile);
 		theFile = NULL;
@@ -497,21 +659,19 @@
 			}
 		}
 
-		/* free header memory */
-		curl_slist_free_all(headers);
-
 		/* If --effective-url option was given, set given variable name to last effective url used by curl */
 		if (effectiveURLVarName != NULL) {
 			theCurlCode = curl_easy_getinfo(theHandle, CURLINFO_EFFECTIVE_URL, &effectiveURL);
 			Tcl_SetVar(interp, effectiveURLVarName,
-				(effectiveURL == NULL || theCurlCode != CURLE_OK) ? "" : effectiveURL,
-				0);
+				(effectiveURL == NULL || theCurlCode != CURLE_OK) ? "" : effectiveURL, 0);
 		}
 	} while (0);
 
-	if (performFailed) {
-		Tcl_SetResult(interp, theErrorString, TCL_VOLATILE);
-		theResult = TCL_ERROR;
+	if (handleAdded) {
+		/* Remove the handle from the multi handle, but ignore errors to avoid
+		 * cluttering the real error info that might be somewhere further up */
+		curl_multi_remove_handle(theMHandle, theHandle);
+		handleAdded = false;
 	}
 
 	/* reset the connection */
@@ -1187,16 +1347,17 @@
 
 		/* actually perform the POST */
 		theCurlCode = curl_easy_perform(theHandle);
-		if (theCurlCode != CURLE_OK) {
-			theResult = SetResultFromCurlErrorCode(interp, theCurlCode);
-			break;
-		}
 
 		/* signal cleanup to the progress callback */
 		if (noprogress == 0 && strcmp(progressCallback.proc, "builtin") != 0) {
 			CurlProgressCleanup(&progressCallback);
 		}
 
+		if (theCurlCode != CURLE_OK) {
+			theResult = SetResultFromCurlErrorCode(interp, theCurlCode);
+			break;
+		}
+
 		/* close the file */
 		(void) fclose(theFile);
 		theFile = NULL;
@@ -1291,8 +1452,6 @@
 /* ========================================================================= **
  * Callback function
  * ========================================================================= */
-#pragma mark -
-#pragma mark Callback function
 static int CurlProgressHandler(
 		tcl_callback_t *callback,
 		double dltotal,
@@ -1409,6 +1568,7 @@
 	/*
 	 * Transfer complete, signal the progress callback
 	 */
+	Tcl_InterpState state;
 
 	/*
 	 * Command string, a space followed "finish" plus the trailing \0.
@@ -1423,5 +1583,9 @@
 		abort();
 	}
 
+	/* make sure to save and restore the interpreter state so a potential error
+	 * message doesn't get lost */
+	state = Tcl_SaveInterpState(callback->interp, 0);
 	Tcl_EvalEx(callback->interp, commandBuffer, len, TCL_EVAL_GLOBAL);
+	Tcl_RestoreInterpState(callback->interp, state);
 }

Modified: branches/new-help-system/base/src/pextlib1.0/filemap.c
===================================================================
--- branches/new-help-system/base/src/pextlib1.0/filemap.c	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/pextlib1.0/filemap.c	2014-08-03 15:04:12 UTC (rev 122999)
@@ -30,10 +30,13 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-#if HAVE_CONFIG_H
+#ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
+/* needed for NAME_MAX and PATH_MAX on Linux */
+#define _XOPEN_SOURCE
+
 #include <sys/stat.h>
 #include <errno.h>
 #include <fcntl.h>
@@ -48,7 +51,6 @@
 /* ========================================================================= **
  * Definitions
  * ========================================================================= */
-#pragma mark Definitions
 
 /* ------------------------------------------------------------------------- **
  * Internal structures
@@ -184,8 +186,6 @@
 /* ========================================================================= **
  * Tree access functions
  * ========================================================================= */
-#pragma mark -
-#pragma mark Access functions
 
 /**
  * Load the database from a file.
@@ -1118,8 +1118,6 @@
 /* ========================================================================= **
  * Tcl object functions
  * ========================================================================= */
-#pragma mark -
-#pragma mark Tcl object functions
 
 /**
  * Free the object.
@@ -1205,8 +1203,6 @@
 /* ========================================================================= **
  * Entry points
  * ========================================================================= */
-#pragma mark -
-#pragma mark Entry points
 
 /**
  * Set the result if an error occurred and return TCL_ERROR.

Modified: branches/new-help-system/base/src/pextlib1.0/flock.c
===================================================================
--- branches/new-help-system/base/src/pextlib1.0/flock.c	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/pextlib1.0/flock.c	2014-08-03 15:04:12 UTC (rev 122999)
@@ -16,7 +16,7 @@
  * 3. Neither the name of The MacPorts Project nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -34,152 +34,223 @@
 #include <config.h>
 #endif
 
+/* needed to get struct sigaction on some platforms */
+#define _XOPEN_SOURCE 500L
+/* the above hides flock on OS X without _DARWIN_C_SOURCE */
+#define _DARWIN_C_SOURCE
+
 #if HAVE_SYS_FILE_H
 #include <sys/file.h>
 #endif
 
 #include <errno.h>
 #include <inttypes.h>
+#include <signal.h>
 #include <string.h>
+#include <unistd.h>
 
 #include <tcl.h>
 
 #include "flock.h"
 
+static volatile int alarmReceived = 0;
+
+static void alarmHandler(int sig UNUSED) {
+    alarmReceived = 1;
+}
+
 int
-FlockCmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
-{
-	static const char errorstr[] = "use one of \"-shared\", \"-exclusive\", or \"-unlock\", and optionally \"-noblock\"";
-	int operation = 0, fd, i, ret;
-	int errnoval = 0;
-	int oshared = 0, oexclusive = 0, ounlock = 0, onoblock = 0;
+FlockCmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
+    static const char errorstr[] = "use one of \"-shared\", \"-exclusive\", or \"-unlock\", and optionally \"-noblock\"";
+    int operation = 0, fd, i, ret, sigret = TCL_OK;
+    int errnoval = 0;
+    int oshared = 0, oexclusive = 0, ounlock = 0, onoblock = 0, retry = 0;
 #if defined(HAVE_LOCKF) && !defined(HAVE_FLOCK)
-	off_t curpos;
+    off_t curpos;
 #endif
-	char *res;
-	Tcl_Channel channel;
-	ClientData handle;
+    char *res;
+    Tcl_Channel channel;
+    ClientData handle;
+    struct sigaction sa_oldalarm, sa_alarm;
 
-	if (objc < 3 || objc > 4) {
-		Tcl_WrongNumArgs(interp, 1, objv, "channelId switches");
-		return TCL_ERROR;
-	}
+    if (objc < 3 || objc > 4) {
+        Tcl_WrongNumArgs(interp, 1, objv, "channelId switches");
+        return TCL_ERROR;
+    }
 
-    	if ((channel = Tcl_GetChannel(interp, Tcl_GetString(objv[1]), NULL)) == NULL)
-		return TCL_ERROR;
+    if ((channel = Tcl_GetChannel(interp, Tcl_GetString(objv[1]), NULL)) == NULL) {
+        Tcl_SetResult(interp, "error getting channel, result was NULL", TCL_STATIC);
+        return TCL_ERROR;
+    }
 
-	if (Tcl_GetChannelHandle(channel, TCL_READABLE|TCL_WRITABLE, &handle) != TCL_OK) {
-		Tcl_SetResult(interp, "error getting channel handle", TCL_STATIC);
-		return TCL_ERROR;
-	}
-	fd = (int)(intptr_t)handle;
+    if (Tcl_GetChannelHandle(channel, TCL_READABLE | TCL_WRITABLE, &handle) != TCL_OK) {
+        Tcl_SetResult(interp, "error getting channel handle", TCL_STATIC);
+        return TCL_ERROR;
+    }
+    fd = (int)(intptr_t)handle;
 
-	for (i = 2; i < objc; i++) {
-		char *arg = Tcl_GetString(objv[i]);
-		if (!strcmp(arg, "-shared")) {
-		  oshared = 1;
-		} else if (!strcmp(arg, "-exclusive")) {
-		  oexclusive = 1;
-		} else if (!strcmp(arg, "-unlock")) {
-		  ounlock = 1;
-		} else if (!strcmp(arg, "-noblock")) {
-		  onoblock = 1;
-		}
-	}
+    for (i = 2; i < objc; i++) {
+        char *arg = Tcl_GetString(objv[i]);
+        if (!strcmp(arg, "-shared")) {
+            oshared = 1;
+        }
+        else if (!strcmp(arg, "-exclusive")) {
+            oexclusive = 1;
+        }
+        else if (!strcmp(arg, "-unlock")) {
+            ounlock = 1;
+        }
+        else if (!strcmp(arg, "-noblock")) {
+            onoblock = 1;
+        }
+    }
 
-	/* verify the arguments */
+    /* verify the arguments */
 
-	if((oshared + oexclusive + ounlock) != 1) {
-	  /* only one of the options should have been specified */
-	  Tcl_SetResult(interp, (void *) &errorstr, TCL_STATIC);
-	  return TCL_ERROR;
-	}
+    if ((oshared + oexclusive + ounlock) != 1) {
+        /* only one of the options should have been specified */
+        Tcl_SetResult(interp, (void *) &errorstr, TCL_STATIC);
+        return TCL_ERROR;
+    }
 
-	if(onoblock && ounlock) {
-	  /* should not be specified together */
-	  Tcl_SetResult(interp, "-noblock cannot be used with -unlock", TCL_STATIC);
-	  return TCL_ERROR;
-	}
-	  
+    if (onoblock && ounlock) {
+        /* should not be specified together */
+        Tcl_SetResult(interp, "-noblock cannot be used with -unlock", TCL_STATIC);
+        return TCL_ERROR;
+    }
+
+    /* (re-)enable SIGALRM so we can use alarm(3) to specify a timeout for the
+     * locking, do some Tcl signal processing and restart the locking to solve
+     * #43388. */
+    memset(&sa_alarm, 0, sizeof(struct sigaction));
+    sigemptyset(&sa_alarm.sa_mask);
+    sa_alarm.sa_flags = 0; /* explicitly don't specify SA_RESTART, we want the
+                              following alarm(3) to interrupt the locking. */
+    sa_alarm.sa_handler = alarmHandler;
+    sigaction(SIGALRM, &sa_alarm, &sa_oldalarm);
+
+    do {
+        /* use a delay of one second */
+        retry = 0;
+        alarmReceived = 0;
+        alarm(1);
 #if HAVE_FLOCK
-	/* prefer flock if present */
-	if(oshared) operation |= LOCK_SH;
+        /* prefer flock if present */
+        if (oshared) {
+            operation |= LOCK_SH;
+        }
 
-	if(oexclusive) operation |= LOCK_EX;
+        if (oexclusive) {
+            operation |= LOCK_EX;
+        }
 
-	if(ounlock) operation |= LOCK_UN;
+        if (ounlock) {
+            operation |= LOCK_UN;
+        }
 
-	if(onoblock) operation |= LOCK_NB;
+        if (onoblock) {
+            operation |= LOCK_NB;
+        }
 
-	ret = flock(fd, operation);
-	if(ret == -1) {
-	  errnoval = errno;
-	}
+        ret = flock(fd, operation);
+        if (ret == -1) {
+            errnoval = errno;
+        }
 #else
 #if HAVE_LOCKF
-	if(ounlock) operation = F_ULOCK;
+        if (ounlock) {
+            operation = F_ULOCK;
+        }
 
-	/* lockf semantics don't map to shared locks. */
-	if(oshared || oexclusive) {
-	  if(onoblock) {
-	    operation = F_TLOCK;
-	  } else {
-	    operation = F_LOCK;
-	  }
-	}
+        /* lockf semantics don't map to shared locks. */
+        if (oshared || oexclusive) {
+            if (onoblock) {
+                operation = F_TLOCK;
+            }
+            else {
+                operation = F_LOCK;
+            }
+        }
 
-	curpos = lseek(fd, 0, SEEK_CUR);
-	if(curpos == -1) {
-		Tcl_SetResult(interp, (void *) "Seek error", TCL_STATIC);
-		return TCL_ERROR;
-	}
+        curpos = lseek(fd, 0, SEEK_CUR);
+        if (curpos == -1) {
+            Tcl_SetResult(interp, (void *) "Seek error", TCL_STATIC);
+            return TCL_ERROR;
+        }
 
-	ret = lockf(fd, operation, 0); /* lock entire file */
+        ret = lockf(fd, operation, 0); /* lock entire file */
+        if (ret == -1) {
+            errnoval = errno;
+        }
 
-	curpos = lseek(fd, curpos, SEEK_SET);
-	if(curpos == -1) {
-		Tcl_SetResult(interp, (void *) "Seek error", TCL_STATIC);
-		return TCL_ERROR;
-	}
-
-	if(ret == -1) {
-	  errnoval = errno;
-	  if((oshared || oexclusive)) {
-	    /* map the errno val to what we would expect for flock */
-	    if(onoblock && errnoval == EAGAIN) {
-	      /* on some systems, EAGAIN=EWOULDBLOCK, but lets be safe */
-	      errnoval = EWOULDBLOCK;
-	    } else if(errnoval == EINVAL) {
-	      errnoval = EOPNOTSUPP;
-	    }
-	  }
-	}
+        curpos = lseek(fd, curpos, SEEK_SET);
+        if (curpos == -1) {
+            Tcl_SetResult(interp, (void *) "Seek error", TCL_STATIC);
+            return TCL_ERROR;
+        }
 #else
 #error no available locking implementation
 #endif /* HAVE_LOCKF */
 #endif /* HAVE_FLOCK */
+        /* disable the alarm timer */
+        alarm(0);
 
-	if (ret != 0)
-	{
-		switch(errnoval) {
-			case EAGAIN:
-				res = "EAGAIN";
-				break;
-			case EBADF:
-				res = "EBADF";
-				break;
-			case EINVAL:
-				res = "EINVAL";
-				break;
-			case EOPNOTSUPP:
-				res = "EOPNOTSUPP";
-				break;
-			default:
-				res = strerror(errno);
-				break;
-		}
-		Tcl_SetResult(interp, (void *) res, TCL_STATIC);
-		return TCL_ERROR;
-	}
-	return TCL_OK;
+        if (ret == -1) {
+            if (oshared || oexclusive) {
+                if (!onoblock && alarmReceived && errnoval == EINTR) {
+                    /* We were trying to lock, the lock was supposed to block,
+                     * it failed with EINTR and we processed a SIGALRM. This
+                     * probably means the call was interrupted by the timer.
+                     * Call Tcl signal processing functions and try again. */
+                    if (Tcl_AsyncReady()) {
+                        sigret = Tcl_AsyncInvoke(interp, TCL_OK);
+                        if (sigret != TCL_OK) {
+                            break;
+                        }
+                    }
+                    retry = 1;
+                    continue;
+                }
+
+                if (onoblock && errnoval == EAGAIN) {
+                    /* The lock wasn't supposed to block, and the lock wasn't
+                     * successful because the lock is taken. On some systems
+                     * EAGAIN == EWOULDBLOCK, but let's play it safe. */
+                    errnoval = EWOULDBLOCK;
+                }
+            }
+        }
+    } while (retry);
+
+    /* Restore the previous handler for SIGALRM */
+    sigaction(SIGALRM, &sa_oldalarm, NULL);
+
+    if (sigret != TCL_OK) {
+        /* We received a signal that raised an error. The file hasn't been
+         * locked. */
+        return sigret;
+    }
+
+    if (ret != 0) {
+        switch (errnoval) {
+            case EAGAIN:
+                res = "EAGAIN";
+                break;
+            case EBADF:
+                res = "EBADF";
+                break;
+            case EINVAL:
+                res = "EINVAL";
+                break;
+            case EOPNOTSUPP:
+                res = "EOPNOTSUPP";
+                break;
+            default:
+                res = strerror(errno);
+                break;
+        }
+        Tcl_SetResult(interp, (void *) res, TCL_STATIC);
+        return TCL_ERROR;
+    }
+    return TCL_OK;
 }

Modified: branches/new-help-system/base/src/pextlib1.0/fs-traverse.c
===================================================================
--- branches/new-help-system/base/src/pextlib1.0/fs-traverse.c	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/pextlib1.0/fs-traverse.c	2014-08-03 15:04:12 UTC (rev 122999)
@@ -38,6 +38,10 @@
 #include <config.h>
 #endif
 
+/* required for u_short in fts.h on Linux; I think this can be considered a bug
+ * in the system header, though. */
+#define _BSD_SOURCE
+
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <errno.h>

Modified: branches/new-help-system/base/src/pextlib1.0/mktemp.c
===================================================================
--- branches/new-help-system/base/src/pextlib1.0/mktemp.c	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/pextlib1.0/mktemp.c	2014-08-03 15:04:12 UTC (rev 122999)
@@ -34,6 +34,13 @@
 #include <config.h>
 #endif
 
+/* required for strdup(3)/mkdtemp(3) on Linux */
+#define _XOPEN_SOURCE 700L
+/* required for mktemp(3) if _XOPEN_SOURCE >= 600L on Linux */
+#define _BSD_SOURCE
+/* required for mkdtemp(3) on OS X */
+#define _DARWIN_C_SOURCE
+
 #include <errno.h>
 #include <stdlib.h>
 #include <string.h>

Modified: branches/new-help-system/base/src/pextlib1.0/readline.c
===================================================================
--- branches/new-help-system/base/src/pextlib1.0/readline.c	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/pextlib1.0/readline.c	2014-08-03 15:04:12 UTC (rev 122999)
@@ -8,19 +8,22 @@
  *
  */
 
-#if HAVE_CONFIG_H
+#ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
+/* required for strdup(3) on Linux and OS X */
+#define _XOPEN_SOURCE 600L
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 
-#if HAVE_READLINE_READLINE_H
+#ifdef HAVE_READLINE_READLINE_H
 #include <readline/readline.h>
 #endif
 
-#if HAVE_READLINE_HISTORY_H
+#ifdef HAVE_READLINE_HISTORY_H
 #include <readline/history.h>
 #endif
 
@@ -29,7 +32,7 @@
 #include "readline.h"
 
 /* Globals */
-#if HAVE_READLINE_READLINE_H
+#ifdef HAVE_READLINE_READLINE_H
 Tcl_Interp* completion_interp = NULL;
 Tcl_Obj* attempted_completion_word = NULL;
 Tcl_Obj* generator_word = NULL;
@@ -55,7 +58,7 @@
 #endif
 
 
-#if HAVE_LIBREADLINE
+#ifdef HAVE_LIBREADLINE
 char*
 completion_generator(const char* text, int state)
 {
@@ -156,7 +159,7 @@
 {
 	char* action;
 	Tcl_Obj *tcl_result;
-#if HAVE_LIBREADLINE
+#ifdef HAVE_LIBREADLINE
 	int argbase;
 	int argcnt;
 #endif
@@ -173,7 +176,7 @@
 	
 		int initOk = 0;
 		
-#if HAVE_LIBREADLINE
+#ifdef HAVE_LIBREADLINE
 		/* Set the name of our program, so .inputrc can be conditionalized */
 		if (objc == 3) {
 			rl_readline_name = strdup(Tcl_GetString(objv[2]));
@@ -194,7 +197,7 @@
 		tcl_result = Tcl_NewIntObj(initOk);	
 		Tcl_SetObjResult(interp, tcl_result);
 
-#if HAVE_LIBREADLINE
+#ifdef HAVE_LIBREADLINE
 	} else if (0 == strcmp("read", action)) {
 	
 		char* s;
@@ -272,7 +275,7 @@
 int RLHistoryCmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
 {
 	char* action = NULL;
-#if HAVE_LIBREADLINE
+#ifdef HAVE_LIBREADLINE
 	char* s = NULL;
 	int i = 0;
 	Tcl_Obj *tcl_result;
@@ -286,7 +289,7 @@
 
 	/* Case out on action */
 	if (0) {
-#if HAVE_LIBREADLINE
+#ifdef HAVE_LIBREADLINE
 	} else if (0 == strcmp("add", action)) {
 		if (objc != 3) {
 			Tcl_WrongNumArgs(interp, 1, objv, "add line");

Modified: branches/new-help-system/base/src/pextlib1.0/realpath.c
===================================================================
--- branches/new-help-system/base/src/pextlib1.0/realpath.c	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/pextlib1.0/realpath.c	2014-08-03 15:04:12 UTC (rev 122999)
@@ -34,6 +34,9 @@
 #include <config.h>
 #endif
 
+/* required for PATH_MAX and realpath(3) */
+#define _XOPEN_SOURCE 500
+
 #include <tcl.h>
 
 #include <errno.h>

Modified: branches/new-help-system/base/src/pextlib1.0/rmd160cmd.c
===================================================================
--- branches/new-help-system/base/src/pextlib1.0/rmd160cmd.c	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/pextlib1.0/rmd160cmd.c	2014-08-03 15:04:12 UTC (rev 122999)
@@ -35,6 +35,9 @@
 #include <config.h>
 #endif
 
+/* required for u_char on Linux */
+#define _BSD_SOURCE
+
 #include <string.h>
 #include <stdio.h>
 #include <fcntl.h>

Modified: branches/new-help-system/base/src/pextlib1.0/setmode.c
===================================================================
--- branches/new-help-system/base/src/pextlib1.0/setmode.c	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/pextlib1.0/setmode.c	2014-08-03 15:04:12 UTC (rev 122999)
@@ -36,10 +36,8 @@
 
 #include <config.h>
 
-extern int xxx_so_this_isnt_empty;
+#ifndef HAVE_SETMODE
 
-#if !HAVE_SETMODE
-
 #if defined(LIBC_SCCS) && !defined(lint)
 #if 0
 static char sccsid[] = "@(#)setmode.c	8.2 (Berkeley) 3/25/94";
@@ -48,6 +46,11 @@
 #endif
 #endif /* LIBC_SCCS and not lint */
 
+/* required for sigfillset(3)/sigemptyset(3) and S_ISVTX */
+#define _XOPEN_SOURCE 500
+/* required for u_int and u_long */
+#define _BSD_SOURCE
+
 #include <sys/types.h>
 #include <sys/stat.h>
 
@@ -192,7 +195,7 @@
 	BITCMD *set, *saveset, *endset;
 	sigset_t sigset, sigoset;
 	mode_t mask;
-	int equalopdone, permXbits, setlen;
+	int equalopdone = 0, permXbits, setlen;
 	long perml;
 
 	if (!*p)
@@ -380,7 +383,7 @@
 	case '-':
 	case 'X':
 		set->cmd = op;
-		set->bits = (who ? who : mask) & oparg;
+		set->bits = (who ? ((mode_t) who) : ((mode_t) mask)) & oparg;
 		break;
 
 	case 'u':
@@ -479,5 +482,8 @@
 		}
 	}
 }
-#endif
+#else /* !defined(HAVE_SETMODE) */
 
+extern int xxx_so_this_isnt_empty;
+
+#endif /* !defined(HAVE_SETMODE) */

Modified: branches/new-help-system/base/src/pextlib1.0/strcasecmp.h
===================================================================
--- branches/new-help-system/base/src/pextlib1.0/strcasecmp.h	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/pextlib1.0/strcasecmp.h	2014-08-03 15:04:12 UTC (rev 122999)
@@ -30,13 +30,18 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include <string.h>
+#include <strings.h>
 
-#if !HAVE_STRCASECMP
+#ifndef HAVE_STRCASECMP
 	#define strcasecmp xstrcasecmp
 #endif
 
-#if !HAVE_STRNCASECMP
+#ifndef HAVE_STRNCASECMP
 	#define strncasecmp xstrncasecmp
 #endif
 

Modified: branches/new-help-system/base/src/pextlib1.0/strsed.c
===================================================================
--- branches/new-help-system/base/src/pextlib1.0/strsed.c	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/pextlib1.0/strsed.c	2014-08-03 15:04:12 UTC (rev 122999)
@@ -131,6 +131,9 @@
 
 #include "strsed.h"
 
+/* required for strdup(3) on Linux and OS X */
+#define _XOPEN_SOURCE 600L
+
 #include <ctype.h>
 #include <string.h>
 #include <stdlib.h>

Modified: branches/new-help-system/base/src/pextlib1.0/system.c
===================================================================
--- branches/new-help-system/base/src/pextlib1.0/system.c	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/pextlib1.0/system.c	2014-08-03 15:04:12 UTC (rev 122999)
@@ -36,6 +36,11 @@
 #include <config.h>
 #endif
 
+/* required for fdopen(3)/seteuid(2), among others */
+#define _XOPEN_SOURCE 600
+/* required for fgetln(3) on OS X */
+#define _DARWIN_C_SOURCE
+
 #include <tcl.h>
 
 #if HAVE_PATHS_H
@@ -111,8 +116,8 @@
     char *args[7];
     char *cmdstring;
     int sandbox = 0;
-    char *sandbox_exec_path;
-    char *profilestr;
+    char *sandbox_exec_path = NULL;
+    char *profilestr = NULL;
     FILE *pdes;
     int fdset[2], nullfd;
     int fline, pos, ret;

Modified: branches/new-help-system/base/src/pextlib1.0/tracelib.c
===================================================================
--- branches/new-help-system/base/src/pextlib1.0/tracelib.c	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/pextlib1.0/tracelib.c	2014-08-03 15:04:12 UTC (rev 122999)
@@ -56,6 +56,7 @@
 #include <sys/un.h>
 #include <unistd.h>
 
+#include <cregistry/portgroup.h>
 #include <cregistry/entry.h>
 #include <registry2.0/registry.h>
 
@@ -847,6 +848,14 @@
 
 int TracelibCmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
     int result = TCL_OK;
+
+    /* There is no args for commands now. */
+    if (objc < 2) {
+        Tcl_WrongNumArgs(interp, 1, objv, "option");
+        return TCL_ERROR;
+    }
+
+#ifdef HAVE_TRACEMODE_SUPPORT
     static const char *options[] = {"setname", "opensocket", "run", "clean", "setsandbox", "closesocket", "setdeps", "enablefence", 0};
     typedef enum {
         kSetName,
@@ -860,13 +869,6 @@
     } EOptions;
     EOptions current_option;
 
-    /* There is no args for commands now. */
-    if (objc < 2) {
-        Tcl_WrongNumArgs(interp, 1, objv, "option");
-        return TCL_ERROR;
-    }
-
-#ifdef HAVE_TRACEMODE_SUPPORT
     result = Tcl_GetIndexFromObj(interp, objv[1], options, "option", 0, (int *)&current_option);
     if (result == TCL_OK) {
         switch (current_option) {

Modified: branches/new-help-system/base/src/pextlib1.0/tty.c
===================================================================
--- branches/new-help-system/base/src/pextlib1.0/tty.c	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/pextlib1.0/tty.c	2014-08-03 15:04:12 UTC (rev 122999)
@@ -38,6 +38,7 @@
 #include <config.h>
 #endif
 
+#include <stdint.h>
 #include <sys/ioctl.h>
 #include <unistd.h>
 

Modified: branches/new-help-system/base/src/pextlib1.0/uid.c
===================================================================
--- branches/new-help-system/base/src/pextlib1.0/uid.c	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/pextlib1.0/uid.c	2014-08-03 15:04:12 UTC (rev 122999)
@@ -12,6 +12,9 @@
 #include <config.h>
 #endif
 
+/* required for seteuid(2)/setegid(2) */
+#define _BSD_SOURCE
+
 #include <sys/types.h>
 #include <grp.h>
 #include <pwd.h>

Modified: branches/new-help-system/base/src/pextlib1.0/xinstall.c
===================================================================
--- branches/new-help-system/base/src/pextlib1.0/xinstall.c	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/pextlib1.0/xinstall.c	2014-08-03 15:04:12 UTC (rev 122999)
@@ -41,6 +41,9 @@
 #include <config.h>
 #endif
 
+/* required for u_int and u_long */
+#define _BSD_SOURCE
+
 #if HAVE_SYS_CDEFS_H
 #include <sys/cdefs.h>
 #endif
@@ -104,7 +107,7 @@
 #define ALLPERMS (S_ISUID|S_ISGID|S_ISTXT|S_IRWXU|S_IRWXG|S_IRWXO)
 #endif
 
-#if !HAVE_SETMODE
+#ifndef HAVE_SETMODE
 #include "setmode.h"
 #endif
 
@@ -148,7 +151,7 @@
 	u_long fset = 0;
 	int no_target, rval;
 	u_int iflags;
-	char *flags, *curdir;
+	char *curdir;
 	const char *group, *owner, *cp;
 	Tcl_Obj *to_name;
 	int dodir = 0;
@@ -198,7 +201,7 @@
 				Tcl_WrongNumArgs(interp, 1, objv, "-f");
 				return TCL_ERROR;
 			}
-			flags = Tcl_GetString(*(++objv));
+			char *flags = Tcl_GetString(*(++objv));
 			if (strtofflags(&flags, &fset, NULL)) {
 				Tcl_SetResult(interp, "invalid flags for -f", TCL_STATIC);
 				return TCL_ERROR;
@@ -428,7 +431,11 @@
  *	build a path name and install the file
  */
 static int
+#if defined(UF_NODUMP)
 install(Tcl_Interp *interp, const char *from_name, const char *to_name, u_long fset, u_int flags)
+#else
+install(Tcl_Interp *interp, const char *from_name, const char *to_name, u_long fset UNUSED, u_int flags)
+#endif
 {
 	struct stat from_sb, temp_sb, to_sb;
 	struct timeval tvb[2];
@@ -869,7 +876,11 @@
  *	create a new file, overwriting an existing one if necessary
  */
 static int
+#if defined(UF_IMMUTABLE) && defined(SF_IMMUTABLE)
 create_newfile(Tcl_Interp *interp, const char *path, int target, struct stat *sbp)
+#else
+create_newfile(Tcl_Interp *interp, const char *path, int target, struct stat *sbp UNUSED)
+#endif
 {
 	char backup[MAXPATHLEN];
 	int saved_errno = 0;
@@ -1105,7 +1116,11 @@
  *	return true (1) if mmap should be tried, false (0) if not.
  */
 int
+#ifdef MFSNAMELEN
 trymmap(int fd)
+#else
+trymmap(int fd UNUSED)
+#endif
 {
 /*
  * The ifdef is for bootstrapping - f_fstypename doesn't exist in

Modified: branches/new-help-system/base/src/pkg_mkindex.sh.in
===================================================================
--- branches/new-help-system/base/src/pkg_mkindex.sh.in	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/pkg_mkindex.sh.in	2014-08-03 15:04:12 UTC (rev 122999)
@@ -28,8 +28,9 @@
 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 # POSSIBILITY OF SUCH DAMAGE.
 
-TCLSH=@TCLSH@
+TCLSH=@INTREE_TCLSH@
 GREP=@GREP@
+LIB_PATH=`dirname $TCLSH`
 
 if [ $# = 0 ]; then
     echo "Usage: $0 <directory list>"
@@ -37,7 +38,8 @@
 fi
 
 for dir in $@; do
-    echo "pkg_mkIndex -verbose -- $dir *.tcl *.dylib *.so" | $TCLSH 2>&1 \
+    echo "pkg_mkIndex -verbose -- $dir *.tcl *.dylib *.so" \
+		| env DYLD_LIBRARY_PATH=$LIB_PATH LD_LIBRARY_PATH=$LIB_PATH $TCLSH 2>&1 \
         | $GREP "^warning: " && exit 1
 done
 


Property changes on: branches/new-help-system/base/src/port
___________________________________________________________________
Modified: svn:ignore
   - port
portall
portindex
portmirror

   + Makefile
port
portall
portindex
portmirror


Deleted: branches/new-help-system/base/src/port/Makefile
===================================================================
--- branches/new-help-system/base/src/port/Makefile	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/port/Makefile	2014-08-03 15:04:12 UTC (rev 122999)
@@ -1,39 +0,0 @@
-INSTALLDIR=	${DESTDIR}${prefix}
-TOPSRCDIR=	../..
-SCRIPTS=	portmirror portindex port
-
-edit = sed \
-	-e 's, at TCLSH\@,$(TCLSH),g' \
-	-e 's, at macports_tcl_dir\@,$(macports_tcl_dir),g'
-
-include ../../Mk/macports.autoconf.mk
-
-.PHONY: mkdirs
-
-all: ${SCRIPTS}
-
-portmirror: portmirror.tcl ../../Mk/macports.autoconf.mk
-	${edit} portmirror.tcl > $@
-
-portindex: portindex.tcl ../../Mk/macports.autoconf.mk
-	${edit} portindex.tcl > $@
-
-port: port.tcl ../../Mk/macports.autoconf.mk
-	${edit} port.tcl > $@
-
-mkdirs:
-	< ../../doc/prefix.mtree $(MTREE) -U -d -e -p ${INSTALLDIR} > /dev/null
-	< ../../doc/base.mtree $(MTREE) -U -d -e -p ${INSTALLDIR} > /dev/null
-
-clean:
-	rm -f ${SCRIPTS}
-
-test:
-
-distclean: clean
-
-install: all mkdirs
-	$(INSTALL) -d -o ${DSTUSR} -g ${DSTGRP} -m ${DSTMODE} ${INSTALLDIR}/bin
-	$(INSTALL) -d -o ${DSTUSR} -g ${DSTGRP} -m ${DSTMODE} ${INSTALLDIR}/var/macports
-	$(INSTALL) -o ${DSTUSR} -g ${DSTGRP} -m 555 port portindex portmirror ${INSTALLDIR}/bin/
-	cd ${INSTALLDIR}/bin && $(LN_S) -f port portf

Copied: branches/new-help-system/base/src/port/Makefile.in (from rev 122997, trunk/base/src/port/Makefile.in)
===================================================================
--- branches/new-help-system/base/src/port/Makefile.in	                        (rev 0)
+++ branches/new-help-system/base/src/port/Makefile.in	2014-08-03 15:04:12 UTC (rev 122999)
@@ -0,0 +1,47 @@
+srcdir = @srcdir@
+VPATH  = @srcdir@
+
+include ../../Mk/macports.autoconf.mk
+
+INSTALLDIR=	${DESTDIR}${prefix}
+TOPSRCDIR=	../..
+SCRIPTS=	portmirror portindex port
+
+edit = sed -e 's, at TCLSH\@,$(TCLSH),g'
+
+.PHONY: mkdirs
+
+all: ${SCRIPTS}
+
+portmirror: portmirror.tcl ../../Mk/macports.autoconf.mk
+	${edit} $(srcdir)/portmirror.tcl > $@
+
+portindex: portindex.tcl ../../Mk/macports.autoconf.mk
+	${edit} $(srcdir)/portindex.tcl > $@
+
+port: port.tcl ../../Mk/macports.autoconf.mk
+	${edit} $(srcdir)/port.tcl > $@
+
+mkdirs:
+	< ../../doc/prefix.mtree $(MTREE) -U -d -e -p ${INSTALLDIR} > /dev/null
+	< ../../doc/base.mtree $(MTREE) -U -d -e -p ${INSTALLDIR} > /dev/null
+
+clean:
+	rm -f ${SCRIPTS}
+
+test:
+
+distclean: clean
+	rm -f Makefile
+
+install: all mkdirs
+	$(INSTALL) -d -o "${DSTUSR}" -g "${DSTGRP}" -m "${DSTMODE}" "${INSTALLDIR}/bin"
+	$(INSTALL) -d -o "${DSTUSR}" -g "${DSTGRP}" -m "${DSTMODE}" "${INSTALLDIR}/var/macports"
+	$(INSTALL)    -o "${DSTUSR}" -g "${DSTGRP}" -m 555 port portindex portmirror "${INSTALLDIR}/bin/"
+	cd "${INSTALLDIR}/bin" && $(LN_S) -f port portf
+	cd "${INSTALLDIR}/bin" && $(LN_S) -f "${TCLSH}" port-tclsh
+ifneq (,$(findstring darwin, at build_os@))
+ifneq (8, at OS_MAJOR@)
+	chmod -h 555 "${INSTALLDIR}/bin/portf" "${INSTALLDIR}/bin/port-tclsh"
+endif
+endif

Modified: branches/new-help-system/base/src/port/port.tcl
===================================================================
--- branches/new-help-system/base/src/port/port.tcl	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/port/port.tcl	2014-08-03 15:04:12 UTC (rev 122999)
@@ -1,8 +1,5 @@
-#!/bin/sh
+#!@TCLSH@
 # -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4
-# Run the Tcl interpreter \
-exec @TCLSH@ "$0" "$@"
-# port.tcl
 # $Id$
 #
 # Copyright (c) 2004-2013 The MacPorts Project
@@ -34,13 +31,21 @@
 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 # POSSIBILITY OF SUCH DAMAGE.
 
-package require term::ansi::send
+# Create a namespace for some local variables
+namespace eval portclient::progress {
+    ##
+    # Indicate whether the term::ansi::send tcllib package is available and was
+    # imported. "yes", if the package is available, "no" otherwise.
+    variable hasTermAnsiSend no
+}
 
-source [file join "@macports_tcl_dir@" macports1.0 macports_fastload.tcl]
+if {![catch {package require term::ansi::send}]} {
+    set portclient::progress::hasTermAnsiSend yes
+}
+
 package require macports
 package require Pextlib 1.0
 
-
 # Standard procedures
 proc print_usage {{verbose 1}} {
     global cmdname
@@ -144,18 +149,9 @@
 # @param name variable name
 # @param value constant variable value
 proc const {name args} {
-    interp alias {} $name {} _const [expr $args]
+    proc $name {} [list return [expr $args]]
 }
 
-##
-# Helper function to define constants
-#
-# @see const
-proc _const value {
-    return $value
-}
-
-
 # Format an integer representing bytes using given units
 proc bytesize {siz {unit {}} {format {%.3f}}} {
     if {$unit == {}} {
@@ -238,8 +234,8 @@
 
 # show the URL for the ticket reporting instructions
 proc print_tickets_url {args} {
-    if {${macports::prefix} != "/usr/local" && ${macports::prefix} != "/usr"} {
-        ui_notice "To report a bug, follow the instructions in the guide:\n    http://guide.macports.org/#project.tickets"
+    if {${macports::prefix} ne "/usr/local" && ${macports::prefix} ne "/usr"} {
+        ui_error "Follow http://guide.macports.org/#project.tickets to report a bug."
     }
 }
 
@@ -454,7 +450,7 @@
 
 # Execute the enclosed block once for every element in the portlist
 # When the block is entered, the following variables will have been set:
-#	portspec, porturl, portname, portversion, options, variations, requested_variations
+#   portspec, porturl, portname, portversion, options, variations, requested_variations
 proc foreachport {portlist block} {
     set savedir [pwd]
     foreach portspec $portlist {
@@ -2518,18 +2514,23 @@
 proc action_select { action portlist opts } {
     ui_debug "action_select \[$portlist] \[$opts]..."
 
-    # Error out if no group is specified.
-    if {[llength $portlist] < 1} {
-        ui_error "port select \[--list|--set|--show] <group> \[<version>]"
+    array set opts_array $opts
+    set commands [array names opts_array ports_select_*]
+    array unset opts_array
+
+    # Error out if no group is specified or command is not --summary.
+    if {[llength $portlist] < 1 && [string map {ports_select_ ""} [lindex $commands 0]] != "summary"} {
+        ui_error "Incorrect usage. Correct synopsis is one of:"
+        ui_msg   "  port select \[--list|--show\] <group>"
+        ui_msg   "  port select \[--set\] <group> <version>"
+        ui_msg   "  port select --summary"
         return 1
     }
+
     set group [lindex $portlist 0]
-
-    array set opts_array $opts
-    set commands [array names opts_array ports_select_*]
-    array unset opts_array
-    # If no command (--set, --show, --list) is specified *but* more than one
-    # argument is specified, default to the set command.
+    
+    # If no command (--set, --show, --list, --summary) is specified *but*
+    #  more than one argument is specified, default to the set command.
     if {[llength $commands] < 1 && [llength $portlist] > 1} {
         set command set
         ui_debug [concat "Although no command was specified, more than " \
@@ -2615,6 +2616,57 @@
                          "'$selected_version'."]
             return 0
         }
+        summary {
+            if {[llength $portlist] > 0} {
+                ui_warn [concat "The 'summary' command does not expect any " \
+                                "arguments. Extra arguments will be ignored."]
+            }
+
+            if {[catch {mportselect $command} portgroups]} {
+                ui_error "The 'summary' command failed: $portgroups"
+                return 1
+            }
+
+            set w1 4
+            set w2 8
+            set formatStr "%-*s  %-*s  %s"
+
+            set groups [list]
+            foreach pg $portgroups {
+                array set groupdesc {}
+                set groupdesc(name) [string trim $pg]
+
+                if {[catch {mportselect list $pg} versions]} {
+                    ui_warn "The list of options for the select group $pg could not be obtained: $versions"
+                    continue
+                }
+                # remove "none", sort the list, append none at the end
+                set noneidx [lsearch -exact $versions "none"]
+                set versions [lsort [lreplace $versions $noneidx $noneidx]]
+                lappend versions "none"
+                set groupdesc(versions) $versions
+
+                if {[catch {mportselect show $pg} selected_version]} {
+                    ui_warn "The currently selected option for the select group $pg could not be obtained: $selected_version"
+                    continue
+                }
+                set groupdesc(selected) $selected_version
+
+                set w1 [expr {max($w1, [string length $pg])}]
+                set w2 [expr {max($w2, [string length $selected_version])}]
+
+                lappend groups [array get groupdesc]
+                array unset groupdesc
+            }
+            puts [format $formatStr $w1 "Name" $w2 "Selected" "Options"]
+            puts [format $formatStr $w1 "====" $w2 "========" "======="]
+            foreach groupdesc $groups {
+                array set groupd $groupdesc
+                puts [format $formatStr $w1 $groupd(name) $w2 $groupd(selected) [join $groupd(versions) " "]]
+                array unset groupd
+            }
+            return 0
+        }
         default {
             ui_error "An unknown command '$command' was specified."
             return 1
@@ -2707,9 +2759,12 @@
 
 proc action_revupgrade { action portlist opts } {
     set status [macports::revupgrade $opts]
-    if {$status != 0} {
-        print_tickets_url
+    switch $status {
+        1 {
+            print_tickets_url
+        }
     }
+
     return $status
 }
 
@@ -3635,7 +3690,7 @@
             # Map from friendly name
             set opt [map_friendly_field_names $opt]
 
-            if {[catch {eval set matches \[mportsearch \$searchstring $filter_case \$matchstyle $opt\]} result]} {
+            if {[catch {set matches [mportsearch $searchstring $filter_case $matchstyle $opt]} result]} {
                 global errorInfo
                 ui_debug "$errorInfo"
                 break_softcontinue "search for name $portname failed: $result" 1 status
@@ -3864,7 +3919,7 @@
                     if { $editor eq "" } { set editor "/usr/bin/vi" }
                     
                     # Invoke the editor
-                    if {[catch {eval exec >@stdout <@stdin 2>@stderr $editor {$portfile}} result]} {
+                    if {[catch {exec -ignorestderr >@stdout <@stdin {*}$editor $portfile} result]} {
                         global errorInfo
                         ui_debug "$errorInfo"
                         break_softcontinue "unable to invoke editor $editor: $result" 1 status
@@ -4067,7 +4122,7 @@
             set status [action_revupgrade $action $portlist $opts]
         }
     }
-    
+
     return $status
 }
 
@@ -4308,7 +4363,7 @@
     clean       {all archive dist work logs}
     mirror      {new}
     lint        {nitpick}
-    select      {list set show}
+    select      {list set show summary}
     log         {{phase 1} {level 1}}
     upgrade     {force enforce-variants no-replace no-rev-upgrade}
     rev-upgrade {id-loadcmd-check}
@@ -4565,6 +4620,16 @@
         # What kind of arguments does the command expect?
         set expand [action_needs_portlist $action]
 
+        # (Re-)initialize private_options(ports_no_args) to no, because it might still be yes
+        # from the last command in batch mode. If we don't do this, port will fail to
+        # distinguish arguments that expand to empty lists from no arguments at all:
+        # > installed
+        # > list outdated
+        # will then behave like
+        # > list
+        # if outdated expands to the empty list. See #44091, which was filed about this.
+        set private_options(ports_no_args) "no"
+
         # Parse action arguments, setting a special flag if there were none
         # We otherwise can't tell the difference between arguments that evaluate
         # to the empty set, and the empty set itself.
@@ -4572,7 +4637,7 @@
         switch -- [lookahead] {
             ;       -
             _EOF_ {
-                set private_options(ports_no_args) yes
+                set private_options(ports_no_args) "yes"
             }
             default {
                 if {[ACTION_ARGS_NONE] == $expand} {
@@ -4603,6 +4668,9 @@
             registry::exclusive_unlock
         }
 
+        # Print notifications of just-activated ports.
+        portclient::notifications::display
+
         # semaphore to exit
         if {$action_status == -999} break
     }
@@ -4743,7 +4811,7 @@
 
         # Calculate our prompt
         if { $noisy } {
-            set shortdir [eval file join [lrange [file split $current_portdir] end-1 end]]
+            set shortdir [file join {*}[lrange [file split $current_portdir] end-1 end]]
             set prompt "\[$shortdir\] > "
         } else {
             set prompt ""
@@ -4812,226 +4880,391 @@
     return $exit_status
 }
 
-##
-# Progress callback for generic operations executed by macports 1.0.
-#
-# @param action
-#        One of "start", "update", "intermission" or "finish", where start will
-#        be called before any number of update calls, interrupted by any number
-#        of intermission calls (called because other output is being produced),
-#        followed by one call to finish.
-# @param args
-#        A list of variadic args that differ for each action.
-#        For "start": empty.
-#        For "update": contains the arguments $cur and $total where $cur is the
-#        current number of units processed and $total is the total number of
-#        units to be processed.
-#        For "intermission": empty.
-#        For "finish": empty.
-proc port_progress_generic {action args} {
-    global _port_progress_starttime _port_progress_display_bar
-    switch -nocase -- $action {
-        start {
-            set _port_progress_starttime [clock milliseconds]
-            set _port_progress_display_bar no
+namespace eval portclient::progress {
+    ##
+    # Maximum width of the progress bar or indicator when displaying it.
+    variable maxWidth 50
+
+    ##
+    # The start time of the last progress callback as returned by [clock time].
+    # Since only one progress indicator is active at a time, this variable is
+    # shared between the different variants of progress functions.
+    variable startTime
+
+    ##
+    # Delay in milliseconds after the start of the operation before deciding
+    # that showing a progress bar makes sense.
+    variable showTimeThreshold 500
+
+    ##
+    # Percentage value between 0 and 1 that must not have been reached yet when
+    # $showTimeThreshold has passed for a progress bar to be shown. If the
+    # operation has proceeded above e.g. 75% after 500ms we won't bother
+    # displaying a progress indicator anymore -- the operation will be finished
+    # in well below a second anyway.
+    variable showPercentageThreshold 0.75
+
+    ##
+    # Boolean indication whether the progress indicator should be shown or is
+    # still hidden because the current operation didn't need enough time for
+    # a progress indicator to make sense, yet.
+    variable show no
+
+    ##
+    # Initialize the progress bar display delay; call this from the start
+    # action of the progress functions.
+    proc initDelay {} {
+        variable show
+        variable startTime
+
+        set startTime [clock milliseconds]
+        set show no
+    }
+
+    ##
+    # Determine whether a progress bar should be shown for the current
+    # operation in its current state. You must have called initDelay for the
+    # current operation before calling this method.
+    #
+    # @param cur
+    #        Current progress in abstract units.
+    # @param total
+    #        Total number of abstract units to be processed, if known. Pass
+    #        0 if unknown.
+    # @return
+    #        "yes", if the progress indicator should be shown, "no" otherwise.
+    proc showProgress {cur total} {
+        variable show
+        variable startTime
+        variable showTimeThreshold
+        variable showPercentageThreshold
+
+        if {$show eq "yes"} {
+            return yes
+        } else {
+            if {[expr {[clock milliseconds] - $startTime}] > $showTimeThreshold &&
+                ($total == 0 || [expr {double($cur) / double($total)}] < $showPercentageThreshold)} {
+                set show yes
+            }
+            return $show
         }
-        update {
-            # the for loop is a simple hack because Tcl 8.4 doesn't have
-            # lassign
-            foreach {now total} $args {
-                if {${_port_progress_display_bar} ne yes} {
-                    # check whether we should show a progress bar for this transfer
-                    if {[expr {[clock milliseconds] - ${_port_progress_starttime}}] > 500 && ($total == 0 || [expr {$now / $total}] < 0.5)} {
-                        # wait 500ms, then, if we don't know the total or we're
-                        # not past 50% yet, display a progress bar.
-                        set _port_progress_display_bar yes
+    }
+
+    ##
+    # Progress callback for generic operations executed by macports 1.0.
+    #
+    # @param action
+    #        One of "start", "update", "intermission" or "finish", where start
+    #        will be called before any number of update calls, interrupted by
+    #        any number of intermission calls (called because other output is
+    #        being produced), followed by one call to finish.
+    # @param args
+    #        A list of variadic args that differ for each action. For "start",
+    #        "intermission" and "finish", the args are empty and unused. For
+    #        "update", args contains $cur and $total, where $cur is the current
+    #        number of units processed and $total is the total number of units
+    #        to be processed. If the total is not known, it is 0.
+    proc generic {action args} {
+        global env
+        variable maxWidth
+
+        switch -nocase -- $action {
+            start {
+                initDelay
+            }
+            update {
+                # the for loop is a simple hack because Tcl 8.4 doesn't have
+                # lassign
+                foreach {now total} $args {
+                    if {[showProgress $now $total] eq "yes"} {
+                        set barPrefix "      "
+                        set barPrefixLen [string length $barPrefix]
+                        if {$total != 0} {
+                            progressbar $now $total [expr {min($maxWidth, $env(COLUMNS) - $barPrefixLen)}] $barPrefix
+                        } else {
+                            unprogressbar [expr {min($maxWidth, $env(COLUMNS) - $barPrefixLen)}] $barPrefix
+                        }
                     }
                 }
-                if {${_port_progress_display_bar} eq yes} {
-                    set barprefix "      "
-                    if {$total != 0} {
-                        progress_bar $now $total 20 $barprefix
-                    } else {
-                        unprogress_bar $now 20 $barprefix
-                    }
-                }
             }
+            intermission -
+            finish {
+                # erase to start of line
+                ::term::ansi::send::esol
+                # return cursor to start of line
+                puts -nonewline "\r"
+                flush stdout
+            }
         }
-        intermission -
-        finish {
-            # erase to start of line
-            ::term::ansi::send::esol
-            # return cursor to start of line
-            puts -nonewline "\r"
-            flush stdout
-        }
+
+        return 0
     }
 
-    return 0
-}
+    ##
+    # Progress callback for downloads executed by macports 1.0.
+    #
+    # This is essentially a cURL progress callback.
+    #
+    # @param action
+    #        One of "start", "update" or "finish", where start will be called
+    #        before any number of update calls, followed by one call to finish.
+    # @param args
+    #        A list of variadic args that differ for each action. For "start",
+    #        contains a single argument "ul" or "dl" indicating whether this is
+    #        an up- or download. For "update", contains the arguments
+    #        ("ul"|"dl") $total $now $speed where ul/dl are as for start, and
+    #        total, now and speed are doubles indicating the total transfer
+    #        size, currently transferred amount and average speed per second in
+    #        bytes. Unused for "finish".
+    proc download {action args} {
+        global env
+        variable maxWidth
 
+        switch -nocase -- $action {
+            start {
+                initDelay
+            }
+            update {
+                # the for loop is a simple hack because Tcl 8.4 doesn't have
+                # lassign
+                foreach {type total now speed} $args {
+                    if {[showProgress $now $total] eq "yes"} {
+                        set barPrefix "      "
+                        set barPrefixLen [string length $barPrefix]
+                        if {$total != 0} {
+                            set barSuffix [format "        speed: %-13s" "[bytesize $speed {} "%.1f"]/s"]
+                            set barSuffixLen [string length $barSuffix]
 
-##
-# Progress callback for downloads executed by macports 1.0.
-#
-# This is essentially a cURL progress callback.
-#
-# @param action
-#        One of "start", "update" or "finish", where start will be called
-#        before any number of update calls, followed by one call to finish.
-# @param args
-#        A list of variadic args that differ for each action.
-#        For "start": contains a single argument "ul" or "dl" indicating
-#        whether this is an up- or download.
-#        For "update": contains the arguments ("ul"|"dl") total now speed where
-#        ul/dl are as for start, and total, now and speed are doubles
-#        indicating the total transfer size, currently transferred amount and
-#        average speed per second in bytes.
-#        For "finish": empty.
-proc port_progress_download {action args} {
-    global _port_progress_starttime _port_progress_display_bar
-    switch -nocase -- $action {
-        start {
-            set _port_progress_starttime [clock milliseconds]
-            set _port_progress_display_bar no
-        }
-        update {
-            # the for loop is a simple hack because Tcl 8.4 doesn't have
-            # lassign
-            foreach {type total now speed} $args {
-                if {${_port_progress_display_bar} ne yes} {
-                    # check whether we should show a progress bar for this transfer
-                    if {[expr {[clock milliseconds] - ${_port_progress_starttime}}] > 500 && ($total == 0 || [expr {$now / $total}] < 0.5)} {
-                        # wait 500ms, then, if we don't know the total or we're
-                        # not past 50% yet, display a progress bar.
-                        set _port_progress_display_bar yes
+                            set barLen [expr {min($maxWidth, $env(COLUMNS) - $barPrefixLen - $barSuffixLen)}]
+                            progressbar $now $total $barLen $barPrefix $barSuffix
+                        } else {
+                            set barSuffix [format " %-10s     speed: %-13s" [bytesize $now {} "%6.1f"] "[bytesize $speed {} "%.1f"]/s"]
+                            set barSuffixLen [string length $barSuffix]
+
+                            set barLen [expr {min($maxWidth, $env(COLUMNS) - $barPrefixLen - $barSuffixLen)}]
+                            unprogressbar $barLen $barPrefix $barSuffix
+                        }
                     }
                 }
-                if {${_port_progress_display_bar} eq yes} {
-                    set barprefix "      "
-                    if {$total != 0} {
-                        set barsuffix [format "        speed: %-13s" "[bytesize $speed {} "%.1f"]/s"]
-                        progress_bar $now $total 20 $barprefix $barsuffix
-                    } else {
-                        set barsuffix [format " %-10s     speed: %-13s" [bytesize $now {} "%6.1f"] "[bytesize $speed {} "%.1f"]/s"]
-                        unprogress_bar $now 20 $barprefix $barsuffix
-                    }
-                }
             }
+            finish {
+                # erase to start of line
+                ::term::ansi::send::esol
+                # return cursor to start of line
+                puts -nonewline "\r"
+                flush stdout
+            }
         }
-        finish {
-            # erase to start of line
-            ::term::ansi::send::esol
-            # return cursor to start of line
-            puts -nonewline "\r"
-            flush stdout
-        }
+
+        return 0
     }
 
-    return 0
-}
+    ##
+    # Draw a progress bar using unicode block drawing characters
+    #
+    # @param current
+    #        The current progress value.
+    # @param total
+    #        The progress value representing 100%.
+    # @param width
+    #        The width in characters of the progress bar. This includes percentage
+    #        output, which takes up 8 characters.
+    # @param prefix
+    #        Prefix to be printed in front of the progress bar.
+    # @param suffix
+    #        Suffix to be printed after the progress bar.
+    proc progressbar {current total width {prefix ""} {suffix ""}} {
+        # Subtract the width of the percentage output, also subtract the two
+        # characters [ and ] bounding the progress bar.
+        set percentageWidth 8
+        set barWidth      [expr {entier($width) - $percentageWidth - 2}]
 
-##
-# Draw a progress bar using unicode block drawing characters
-#
-# @param current
-#        the current progress value
-# @param total
-#        the progress value representing 100%
-# @param halfwidth
-#        the half width in characters of the progress bar
-# @param prefix
-#        prefix to be printed in front of the progress bar
-# @param suffix
-#        suffix to be printed after the progress bar
-proc progress_bar {current total halfwidth {prefix ""} {suffix ""}} {
-    # we use 8 different states per character, so let's multiply the width by
-    # 8 and map the percentage to this range
-    set percent [expr {(double($current) * 100 / double($total))}]
-    set progress [expr {int(round(($current * $halfwidth * 8) / $total))}]
-    set fullfields [expr {int($progress / 8)}]
-    set remainder [expr {$progress % 8}]
+        # Map the range (0, $total) to (0, 4 * $width) where $width is the maximum
+        # numebr of characters to be printed for the progress bar. Multiply the
+        # upper bound with 8 because we have 8 sub-states per character.
+        set barProgress   [expr {entier(round(($current * $barWidth * 8) / $total))}]
 
-    # clear the current line
-    set progressbar ""
-    for {set i 0} {$i < $fullfields} {incr i} {
-        # U+2588 FULL BLOCK doesn't match the other blocks in some fonts :/
-        # Use two half blocks instead
-        # Since we use two chars here, make sure to remove a space for each of
-        # those used!
-        append progressbar "\u258c\u258c"
-    }
+        set barInteger    [expr {$barProgress / 8}]
+        #set barRemainder  [expr {$barProgress % 8}]
 
-    if {$remainder == 0 && $fullfields < $halfwidth} {
-        append progressbar " "
-    } elseif {$remainder == 1} {
-        # U+258F LEFT ONE EIGHTH BLOCK
-        append progressbar "\u258f"
-    } elseif {$remainder == 2} {
-        # U+258E LEFT ONE QUARTER BLOCK
-        append progressbar "\u258e"
-    } elseif {$remainder == 3} {
-        # U+258D LEFT THREE EIGHTHS BLOCK
-        append progressbar "\u258d"
-    } elseif {$remainder == 4} {
-        # U+258C LEFT HALF BLOCK
-        append progressbar "\u258c"
-    } elseif {$remainder == 5} {
-        # U+258B LEFT FIVE EIGHTHS BLOCK
-        append progressbar "\u258b"
-    } elseif {$remainder == 6} {
-        # U+258A LEFT THREE QUARTERS BLOCK
-        append progressbar "\u258a"
-    } elseif {$remainder == 7} {
-        # U+2589 LEFT SEVEN EIGHTHS BLOCK
-        append progressbar "\u2589"
+        # Finally, also provide a percentage value to print behind the progress bar
+        set percentage [expr {double($current) * 100 / double($total)}]
+
+        # clear the current line, enable reverse video
+        set progressbar "\033\[7m"
+        for {set i 0} {$i < $barInteger} {incr i} {
+            # U+2588 FULL BLOCK doesn't match the other blocks in some fonts :/
+            # Two half blocks work better in some fonts, but not in others (because
+            # they leave ugly spaces). So, one or the other choice isn't better or
+            # worse and even just using full blocks looks ugly in a few fonts.
+
+            # Use pure ASCII until somebody fixes most of the default terminal fonts :/
+            append progressbar " "
+        }
+        # back to normal output
+        append progressbar "\033\[0m"
+
+        #switch $barRemainder {
+        #    0 {
+        #        if {$barInteger < $barWidth} {
+        #            append progressbar " "
+        #        }
+        #    }
+        #    1 {
+        #        # U+258F LEFT ONE EIGHTH BLOCK
+        #        append progressbar "\u258f"
+        #    }
+        #    2 {
+        #        # U+258E LEFT ONE QUARTER BLOCK
+        #        append progressbar "\u258e"
+        #    }
+        #    3 {
+        #        # U+258D LEFT THREE EIGHTHS BLOCK
+        #        append progressbar "\u258d"
+        #    }
+        #    3 {
+        #        # U+258D LEFT THREE EIGHTHS BLOCK
+        #        append progressbar "\u258d"
+        #    }
+        #    4 {
+        #        # U+258C LEFT HALF BLOCK
+        #        append progressbar "\u258c"
+        #    }
+        #    5 {
+        #        # U+258B LEFT FIVE EIGHTHS BLOCK
+        #        append progressbar "\u258b"
+        #    }
+        #    6 {
+        #        # U+258A LEFT THREE QUARTERS BLOCK
+        #        append progressbar "\u258a"
+        #    }
+        #    7 {
+        #        # U+2589 LEFT SEVEN EIGHTHS BLOCK
+        #        append progressbar "\u2589"
+        #    }
+        #}
+
+        # Fill the progress bar with spaces
+        for {set i $barInteger} {$i < $barWidth} {incr i} {
+            append progressbar " "
+        }
+
+        # Format the percentage using the space that has been reserved for it
+        set percentagesuffix [format " %[expr {$percentageWidth - 3}].1f %%" $percentage]
+
+        puts -nonewline "\r${prefix}\[${progressbar}\]${percentagesuffix}${suffix}"
+        flush stdout
     }
 
-    for {set i [expr {[string length $progressbar]}]} {$i < [expr {2 * $halfwidth}]} {incr i} {
-        append progressbar " "
+
+    ##
+    # Internal state of the progress indicator; unless you're hacking the
+    # unprogressbar code you should never touch this.
+    variable unprogressState 0
+
+    ##
+    # Draw a progress indicator
+    #
+    # @param width
+    #        The width in characters of the progress indicator.
+    # @param prefix
+    #        Prefix to be printed in front of the progress indicator.
+    # @param suffix
+    #        Suffix to be printed after the progress indicator.
+    proc unprogressbar {width {prefix ""} {suffix ""}} {
+        variable unprogressState
+
+        # Subtract the two characters [ and ] bounding the progress indicator
+        # from the width.
+        set barWidth [expr {int($width) - 2}]
+
+        # Number of states of the progress bar, or rather: the number of
+        # characters before the sequence repeats.
+        set numStates 4
+
+        set unprogressState [expr {($unprogressState + 1) % $numStates}]
+
+        set progressbar ""
+        for {set i 0} {$i < $barWidth} {incr i} {
+            if {[expr {$i % $numStates}] == $unprogressState} {
+                # U+2022 BULLET
+                append progressbar "\u2022"
+            } else {
+                append progressbar " "
+            }
+        }
+
+        puts -nonewline "\r${prefix}\[${progressbar}\]${suffix}"
+        flush stdout
     }
-    set percentagesuffix [format " %5.1f %%" $percent]
-
-    puts -nonewline "\r${prefix}\[${progressbar}\]${percentagesuffix}${suffix}"
-    flush stdout
 }
 
-##
-# Draw a progress indicator
-#
-# @param current
-#        the number of bytes currently downloaded
-# @param halfwidth
-#        the half width in characters of the progress indicator
-# @param prefix
-#        prefix to be printed in front of the progress indicator
-# @param suffix
-#        suffix to be printed after the progress indicator
-proc unprogress_bar {current halfwidth {prefix ""} {suffix ""}} {
-    global _port_progress_unprogressbar_state
+namespace eval portclient::notifications {
+    ##
+    # Ports whose notifications to display; these were either installed
+    # or requested to be installed.
+    variable notificationsToPrint
+    array set notificationsToPrint {}
 
-    set numstates 4
+    ##
+    # Add a port to the list for printing notifications.
+    #
+    # @param name
+    #        The name of the port.
+    # @param note
+    #        A list of notes to be stored for the given port.
+    proc append {name notes} {
+        variable notificationsToPrint
 
-    if {![info exists _port_progress_unprogressbar_state]} {
-        set _port_progress_unprogressbar_state 0
-    } else {
-        set _port_progress_unprogressbar_state [expr {(${_port_progress_unprogressbar_state} + 1) % $numstates}]
+        set notificationsToPrint($name) $notes
     }
 
-    # clear the current line
-    set progressbar ""
+    ##
+    # Print port notifications.
+    #
+    proc display {} {
+        global env
+        variable notificationsToPrint
 
-    for {set i 0} {$i < [expr {2 * $halfwidth}]} {incr i} {
-        if {[expr $i % $numstates] == ${_port_progress_unprogressbar_state}} {
-            # U+2022 BULLET
-            append progressbar "\u2022"
-        } else {
-            append progressbar " "
+        # Display notes at the end of the activation phase.
+        if {[array size notificationsToPrint] > 0} {
+            ui_notice "--->  Some of the ports you installed have notes:"
+            foreach {name notes} [array get notificationsToPrint] {
+                ui_notice "  $name has the following notes:"
+
+                # If env(COLUMNS) exists, limit each line's width to this width.
+                if {[info exists env(COLUMNS)]} {
+                    set maxlen $env(COLUMNS)
+
+                    foreach note $notes {
+                        foreach line [split $note "\n"] {
+                            set joiner ""
+                            set lines ""
+                            set newline "    "
+
+                            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
+                            }
+                            ui_notice [join $lines "\n"]
+                        }
+                    }
+                } else {
+                    foreach note $notes {
+                        ui_notice $note
+                    }
+                }
+            }
         }
     }
-
-    puts -nonewline "\r${prefix}\[${progressbar}\]${suffix}"
-    flush stdout
 }
 
 
@@ -5082,11 +5315,15 @@
     exit 1
 }
 
-if {[isatty stdout] && (![info exists ui_options(ports_quiet)] || $ui_options(ports_quiet) ne "yes")} {
-    set ui_options(progress_download) port_progress_download
-    set ui_options(progress_generic)  port_progress_generic
+if {[isatty stdout]
+    && $portclient::progress::hasTermAnsiSend eq "yes"
+    && (![info exists ui_options(ports_quiet)] || $ui_options(ports_quiet) ne "yes")} {
+    set ui_options(progress_download) portclient::progress::download
+    set ui_options(progress_generic)  portclient::progress::generic
 }
 
+set ui_options(notifications_append) portclient::notifications::append
+
 # Get arguments remaining after option processing
 set remaining_args [lrange $cmd_argv $cmd_argn end]
 

Modified: branches/new-help-system/base/src/port/portindex.tcl
===================================================================
--- branches/new-help-system/base/src/port/portindex.tcl	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/port/portindex.tcl	2014-08-03 15:04:12 UTC (rev 122999)
@@ -1,13 +1,9 @@
-#!/bin/sh
+#!@TCLSH@
 # -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4
-# Run the Tcl interpreter \
-exec @TCLSH@ "$0" "$@"
-
 # Traverse through all ports, creating an index and archiving port directories
 # if requested
 # $Id$
 
-source [file join "@macports_tcl_dir@" macports1.0 macports_fastload.tcl]
 package require macports
 package require Pextlib
 

Modified: branches/new-help-system/base/src/port/portmirror.tcl
===================================================================
--- branches/new-help-system/base/src/port/portmirror.tcl	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/port/portmirror.tcl	2014-08-03 15:04:12 UTC (rev 122999)
@@ -1,8 +1,5 @@
-#!/bin/sh
+#!@TCLSH@
 # -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4
-# Run the Tcl interpreter \
-exec @TCLSH@ "$0" "$@"
-# portmirror.tcl
 # $Id$
 #
 # Copyright (c) 2002-2007 The MacPorts Project.
@@ -11,7 +8,6 @@
 # Updates the distfiles to current distfiles by deleting old stuff.
 # Uses the database.
 
-source [file join "@macports_tcl_dir@" macports1.0 macports_fastload.tcl]
 package require macports
 package require Pextlib
 


Property changes on: branches/new-help-system/base/src/port1.0
___________________________________________________________________
Modified: svn:ignore
   - port_autoconf.tcl
port_test_autoconf.tcl
pkgIndex.tcl

   + Makefile
pkgIndex.tcl
port_autoconf.tcl
port_test_autoconf.tcl


Deleted: branches/new-help-system/base/src/port1.0/Makefile
===================================================================
--- branches/new-help-system/base/src/port1.0/Makefile	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/port1.0/Makefile	2014-08-03 15:04:12 UTC (rev 122999)
@@ -1,36 +0,0 @@
-INSTALLDIR=	${DESTDIR}${datadir}/macports/Tcl/port1.0
-
-SRCS=	port.tcl portchecksum.tcl portconfigure.tcl portextract.tcl	    \
-	portfetch.tcl portmain.tcl portbuild.tcl portpatch.tcl portutil.tcl \
-	portinstall.tcl portuninstall.tcl portdepends.tcl portdestroot.tcl \
-	portlint.tcl portclean.tcl porttest.tcl portactivate.tcl \
-	portdeactivate.tcl port_autoconf.tcl portstartupitem.tcl \
-	porttrace.tcl portlivecheck.tcl portdistcheck.tcl portmirror.tcl \
-	portload.tcl portunload.tcl portdistfiles.tcl fetch_common.tcl \
-	portsandbox.tcl
-
-include ../../Mk/macports.subdir.mk
-include ../../Mk/macports.autoconf.mk
-
-.PHONY: test
-
-all:: pkgIndex.tcl
-
-pkgIndex.tcl: $(SRCS)
-	$(SILENT) ../pkg_mkindex.sh . || ( rm -rf $@ && exit 1 )
-
-clean::
-	rm -f pkgIndex.tcl
-
-distclean:: clean
-	rm -f port_autoconf.tcl port_test_autoconf.tcl
-
-install:: all
-	$(INSTALL) -d -o ${DSTUSR} -g ${DSTGRP} -m ${DSTMODE} ${INSTALLDIR}
-	$(SILENT)set -x; for file in ${SRCS}; do \
-		$(INSTALL) -o ${DSTUSR} -g ${DSTGRP} -m 444 $$file ${INSTALLDIR}; \
-	done
-	$(INSTALL) -o ${DSTUSR} -g ${DSTGRP} -m 444 pkgIndex.tcl ${INSTALLDIR}
-
-test::
-	$(TCLSH) ./tests/test.tcl -nocolor

Copied: branches/new-help-system/base/src/port1.0/Makefile.in (from rev 122997, trunk/base/src/port1.0/Makefile.in)
===================================================================
--- branches/new-help-system/base/src/port1.0/Makefile.in	                        (rev 0)
+++ branches/new-help-system/base/src/port1.0/Makefile.in	2014-08-03 15:04:12 UTC (rev 122999)
@@ -0,0 +1,44 @@
+srcdir = @srcdir@
+VPATH  = @srcdir@
+
+include ../../Mk/macports.autoconf.mk
+
+INSTALLDIR=	${DESTDIR}${TCL_PACKAGE_PATH}/port1.0
+
+SRCS_AUTOCONF= port_autoconf.tcl
+SRCS=	port.tcl portchecksum.tcl portconfigure.tcl portextract.tcl	    \
+	portfetch.tcl portmain.tcl portbuild.tcl portpatch.tcl portutil.tcl \
+	portinstall.tcl portuninstall.tcl portdepends.tcl portdestroot.tcl \
+	portlint.tcl portclean.tcl porttest.tcl portactivate.tcl \
+	portdeactivate.tcl portstartupitem.tcl porttrace.tcl portlivecheck.tcl \
+	portdistcheck.tcl portmirror.tcl portload.tcl portunload.tcl \
+	portdistfiles.tcl fetch_common.tcl portsandbox.tcl
+
+include $(srcdir)/../../Mk/macports.subdir.mk
+
+.PHONY: test
+
+all:: pkgIndex.tcl
+
+pkgIndex.tcl: $(SRCS) $(SRCS_AUTOCONF)
+	$(SILENT) ../pkg_mkindex.sh . || ( rm -rf $@ && exit 1 )
+
+clean::
+	rm -f pkgIndex.tcl
+
+distclean:: clean
+	rm -f port_autoconf.tcl port_test_autoconf.tcl
+	rm -f Makefile
+
+install:: all
+	$(INSTALL) -d -o "${DSTUSR}" -g "${DSTGRP}" -m "${DSTMODE}" "${INSTALLDIR}"
+	$(SILENT)set -x; for file in ${SRCS}; do \
+		$(INSTALL) -o "${DSTUSR}" -g "${DSTGRP}" -m 444 "$(srcdir)/$$file" "${INSTALLDIR}"; \
+	done
+	$(SILENT)set -x; for file in ${SRCS_AUTOCONF}; do \
+		$(INSTALL) -o "${DSTUSR}" -g "${DSTGRP}" -m 444 "$$file" "${INSTALLDIR}"; \
+	done
+	$(INSTALL) -o "${DSTUSR}" -g "${DSTGRP}" -m 444 pkgIndex.tcl "${INSTALLDIR}"
+
+test::
+	$(TCLSH) $(srcdir)/tests/test.tcl -nocolor

Modified: branches/new-help-system/base/src/port1.0/fetch_common.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/fetch_common.tcl	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/port1.0/fetch_common.tcl	2014-08-03 15:04:12 UTC (rev 122999)
@@ -135,13 +135,13 @@
             set thesubdir ""
         }
 
-        if {"$tag" != ""} {
-            eval append element "${thesubdir}:${tag}"
+        if {$tag ne ""} {
+            append element "${thesubdir}:${tag}"
         } else {
-            eval append element "${thesubdir}"
+            append element "${thesubdir}"
         }
 
-        eval lappend ret $element
+        lappend ret $element
     }
 
     return $ret

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	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/port1.0/port_autoconf.tcl.in	2014-08-03 15:04:12 UTC (rev 122999)
@@ -80,4 +80,5 @@
 	variable install_user "@DSTUSR@"
 	variable install_group "@DSTGRP@"
 	variable prefix "@prefix_expanded@"
+	variable tcl_package_path "@TCL_PACKAGE_PATH@"
 }

Modified: branches/new-help-system/base/src/port1.0/port_test_autoconf.tcl.in
===================================================================
--- branches/new-help-system/base/src/port1.0/port_test_autoconf.tcl.in	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/port1.0/port_test_autoconf.tcl.in	2014-08-03 15:04:12 UTC (rev 122999)
@@ -32,6 +32,5 @@
 #
 
 namespace eval macports::autoconf {
-    variable macports_tcl_dir "@macports_tcl_dir@"
     variable prefix "@prefix@"
 }

Modified: branches/new-help-system/base/src/port1.0/portactivate.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/portactivate.tcl	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/port1.0/portactivate.tcl	2014-08-03 15:04:12 UTC (rev 122999)
@@ -60,42 +60,11 @@
 }
 
 proc portactivate::activate_main {args} {
-    global env subport version revision portvariants user_options PortInfo startupitem.autostart UI_PREFIX
+    global subport version revision portvariants user_options PortInfo
 
     registry_activate $subport $version $revision $portvariants [array get user_options]
-
-    # Display notes at the end of the activation phase.
-    if {[info exists PortInfo(notes)] && $PortInfo(notes) ne {}} {
-        ui_notice ""
-        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)
-
-                foreach line [split $note "\n"] {
-                    set joiner ""
-                    set lines ""
-                    set newline ""
-
-                    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
-                    }
-                    ui_notice [join $lines "\n"]
-                }
-            } else {
-                ui_notice $note
-            }
-        }
-        ui_notice ""
+    if {[info exists PortInfo(notes)] && [llength $PortInfo(notes)] > 0} {
+        ui_notifications_append $subport $PortInfo(notes)
     }
 
     return 0

Modified: branches/new-help-system/base/src/port1.0/portconfigure.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/portconfigure.tcl	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/port1.0/portconfigure.tcl	2014-08-03 15:04:12 UTC (rev 122999)
@@ -79,7 +79,7 @@
         ([info exists option_defaults(${type}.cmd)] && [set ${type}.cmd] eq $option_defaults(${type}.cmd)) ||
         (![info exists option_defaults(${type}.cmd)] && [set ${type}.cmd] eq ${type})
         )} {
-            eval [linsert $dep 0 depends_build-append]
+            depends_build-append {*}$dep
     }
 }
 
@@ -99,14 +99,14 @@
             autoreconf.cmd  -
             automake.cmd    -
             autoconf.cmd {
-                eval [linsert $configure_map(autoconf) 0 depends_build-delete]
+                depends_build-delete {*}$configure_map(autoconf)
             }
             xmkmf.cmd {
-                eval [linsert $configure_map(xmkmf) 0 depends_build-delete]
+                depends_build-delete {*}$configure_map(xmkmf)
             }
             use_xmkmf {
                 if {[tbool args]} {
-                    eval [linsert $configure_map(xmkmf) 0 depends_build-append]
+                    depends_build-append {*}$configure_map(xmkmf)
                 }
             }
             default {
@@ -141,7 +141,7 @@
 default configure.cxxflags      {${configure.optflags}}
 default configure.objcflags     {${configure.optflags}}
 default configure.objcxxflags   {${configure.optflags}}
-default configure.cppflags      {-isystem${prefix}/include}
+default configure.cppflags      {-I${prefix}/include}
 default configure.ldflags       {"-L${prefix}/lib -Wl,-headerpad_max_install_names"}
 default configure.libs          {}
 default configure.fflags        {${configure.optflags}}
@@ -221,7 +221,7 @@
         {^gcc$}                             {System GCC}
         {^gcc-(3\.3|4\.[02])$}              {Xcode GCC %s}
         {^llvm-gcc-4\.2$}                   {Xcode LLVM-GCC 4.2}
-        {^macports-clang$}                  {MacPorts Clang (port select}
+        {^macports-clang$}                  {MacPorts Clang (port select)}
         {^macports-clang-(\d+\.\d+)$}       {MacPorts Clang %s}
         {^macports-dragonegg-(\d+\.\d+)$}   {MacPorts DragonEgg %s}
         {^macports-dragonegg-(\d+\.\d+)-gcc-(\d+\.\d+)$}
@@ -232,7 +232,7 @@
     }
     foreach {re fmt} $valid_compilers {
         if {[set matches [regexp -inline $re $compiler]] ne ""} {
-            set compiler_name [eval [linsert [lrange $matches 1 end] 0 format $fmt]]
+            set compiler_name [format $fmt {*}[lrange $matches 1 end]]
             break
         }
     }
@@ -387,7 +387,7 @@
     }
     foreach {re fmt} $valid_compiler_ports {
         if {[set matches [regexp -inline $re $compiler]] ne ""} {
-            return [eval [linsert [lrange $matches 1 end] 0 format $fmt]]
+            return [format $fmt {*}[lrange $matches 1 end]]
         }
     }
     return {}
@@ -430,20 +430,22 @@
         return $default_compilers
     } elseif {$xcodeversion eq "none" || $xcodeversion eq ""} {
         return {cc}
+    } elseif {[vercmp $xcodeversion 6.0] >= 0 && [vercmp $macosx_deployment_target 10.10] >= 0} {
+        return {clang macports-clang-3.4 macports-clang-3.3}
     } elseif {[vercmp $xcodeversion 5.0] >= 0} {
-        return {clang macports-llvm-gcc-4.2 apple-gcc-4.2 macports-clang-3.3}
-    } elseif {[vercmp $xcodeversion 4.2] >= 0} {
-        return {clang llvm-gcc-4.2 apple-gcc-4.2 macports-clang-3.3}
+        return {clang macports-clang-3.4 macports-clang-3.3 macports-llvm-gcc-4.2 apple-gcc-4.2}
+    } elseif {[vercmp $xcodeversion 4.3] >= 0} {
+        return {clang llvm-gcc-4.2 macports-clang-3.4 macports-clang-3.3 apple-gcc-4.2}
     } elseif {[vercmp $xcodeversion 4.0] >= 0} {
-        return {llvm-gcc-4.2 clang gcc-4.2 macports-clang-3.3 apple-gcc-4.2}
+        return {llvm-gcc-4.2 clang gcc-4.2 macports-clang-3.4 macports-clang-3.3 apple-gcc-4.2}
     } elseif {[vercmp $xcodeversion 3.2] >= 0} {
         if {[string match *10.4u* ${configure.sdkroot}]} {
             return {gcc-4.0}
         } else {
-            return {gcc-4.2 clang llvm-gcc-4.2 macports-clang-3.3 macports-llvm-gcc-4.2 apple-gcc-4.2 gcc-4.0}
+            return {gcc-4.2 clang llvm-gcc-4.2 macports-clang-3.4 macports-clang-3.3 macports-llvm-gcc-4.2 apple-gcc-4.2 gcc-4.0}
         }
     } elseif {[vercmp $xcodeversion 3.0] >= 0} {
-        return {gcc-4.2 apple-gcc-4.2 gcc-4.0 macports-clang-3.3}
+        return {gcc-4.2 apple-gcc-4.2 gcc-4.0 macports-clang-3.4 macports-clang-3.3}
     } else {
         return {apple-gcc-4.2 gcc-4.0 gcc-3.3 macports-clang-3.3}
     }
@@ -702,7 +704,7 @@
             PERL PYTHON RUBY INSTALL AWK BISON PKG_CONFIG PKG_CONFIG_PATH \
         } {
             set value [option configure.[string tolower $env_var]]
-            eval [linsert $value 0 append_to_environment_value configure $env_var]
+            append_to_environment_value configure $env_var {*}$value
         }
 
         # https://trac.macports.org/ticket/34221
@@ -719,16 +721,16 @@
         }
 
         # add extra flags that are conditional on whether we're building universal
-        eval [linsert [get_canonical_archflags cc] 0 append_to_environment_value configure CFLAGS]
+        append_to_environment_value configure CFLAGS {*}[get_canonical_archflags cc]
         foreach tool {cxx objc objcxx cpp f77 f90 fc ld} {
             if {[catch {get_canonical_archflags $tool} flags]} {
                 continue
             }
             set env_var [string toupper $tool]FLAGS
-            eval [linsert $flags 0 append_to_environment_value configure $env_var]
+            append_to_environment_value configure $env_var {*}$flags
         }
         if {[variant_exists universal] && [variant_isset universal]} {
-            eval [linsert ${configure.universal_args} 0 configure.pre_args-append]
+            configure.pre_args-append {*}${configure.universal_args}
         } else {
             foreach env_var {CFLAGS CXXFLAGS OBJCFLAGS OBJCXXFLAGS FFLAGS F90FLAGS FCFLAGS LDFLAGS} {
                 if {${configure.march} ne ""} {

Modified: branches/new-help-system/base/src/port1.0/portdestroot.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/portdestroot.tcl	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/port1.0/portdestroot.tcl	2014-08-03 15:04:12 UTC (rev 122999)
@@ -171,25 +171,35 @@
 
     # Prevent overlinking due to glibtool .la files: https://trac.macports.org/ticket/38010
     ui_debug "Fixing glibtool .la files in destroot for ${subport}"
+    set la_file_list [list]
     fs-traverse -depth fullpath ${destroot} {
-        if {[file extension $fullpath] eq ".la" && [file type $fullpath] eq "file"} {
+        if {[file extension $fullpath] eq ".la" && ([file type $fullpath] eq "file" || [file type $fullpath] eq "link")} {
+            if {[file type $fullpath] eq "link" && [file pathtype [file link $fullpath]] ne "relative"} {
+                # prepend $destroot to target of absolute symlinks
+                set checkpath ${destroot}[file link $fullpath]
+            } else {
+                set checkpath $fullpath
+            }
             # Make sure it is from glibtool ... "a libtool library file" will appear in the first line
-            if {![catch {set fp [open $fullpath]}]} {
+            if {![catch {set fp [open $checkpath]}]} {
                 if {[gets $fp line] > 0 && [string first "a libtool library file" $line] != -1} {
-                    if {${destroot.delete_la_files}} {
-                        ui_debug "Removing [file tail $fullpath]"
-                        file delete -force ${fullpath}
-                    } else {
-                        ui_debug "Clearing dependency_libs in [file tail $fullpath]"
-                        reinplace "/dependency_libs/ s/'.*'/''/" ${fullpath}
-                    }
+                    lappend la_file_list $fullpath
                 }
             } else {
-                ui_debug "Failed to open $fullpath"
+                ui_debug "Failed to open $checkpath"
             }
             catch {close $fp}
         }
     }
+    foreach fullpath $la_file_list {
+        if {${destroot.delete_la_files}} {
+            ui_debug "Removing [file tail $fullpath]"
+            file delete -force ${fullpath}
+        } elseif {[file type $fullpath] eq "file"} {
+            ui_debug "Clearing dependency_libs in [file tail $fullpath]"
+            reinplace "/dependency_libs/ s/'.*'/''/" ${fullpath}
+        }
+    }
 
     # Prune empty directories in ${destroot}
     foreach path ${destroot.keepdirs} {

Modified: branches/new-help-system/base/src/port1.0/portdistcheck.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/portdistcheck.tcl	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/port1.0/portdistcheck.tcl	2014-08-03 15:04:12 UTC (rev 122999)
@@ -85,13 +85,20 @@
                 foreach site $urlmap($url_var) {
                     ui_debug [format [msgcat::mc "Checking %s from %s"] $distfile $site]
                     set file_url [portfetch::assemble_url $site $distfile]
-                    if {[catch {set urlnewer [eval curl isnewer $curl_options {$file_url} $port_moddate]} error]} {
-                        ui_warn "couldn't fetch $file_url for $subport ($error)"
-                    } else {
+                    try {
+                        set urlnewer [curl isnewer {*}$curl_options $file_url $port_moddate]
                         if {$urlnewer} {
                             ui_warn "port $subport: $file_url is newer than Portfile"
                         }
                         incr count
+                    } catch {{POSIX SIG SIGINT} eCode eMessage} {
+                        ui_debug [msgcat::mc "Aborted due to SIGINT"]
+                        throw
+                    } catch {{POSIX SIG SIGTERM} eCode eMessage} {
+                        ui_debug [msgcat::mc "Aborted due to SIGTERM"]
+                        throw
+                    } catch {{*} eCode eMessage} {
+                        ui_debug [msgcat::mc "couldn't fetch %s for %s (%s)" $file_url $subport $eMessage]
                     }
                 }
                 if {$count == 0} {
@@ -102,15 +109,22 @@
                 foreach site $urlmap($url_var) {
                     ui_debug [format [msgcat::mc "Checking %s from %s"] $distfile $site]
                     set file_url [portfetch::assemble_url $site $distfile]
-                    if {[catch {set urlsize [eval curl getsize $curl_options {$file_url}]} error]} {
-                        ui_warn "couldn't fetch $file_url for $subport ($error)"
-                    } else {
+                    try {
+                        set urlsize [curl getsize {*}$curl_options $file_url]
                         incr count
                         if {$urlsize > 0} {
                             ui_info "port $subport: $distfile $urlsize bytes"
                             incr totalsize $urlsize
                             break
                         }
+                    } catch {{POSIX SIG SIGINT} eCode eMessage} {
+                        ui_debug [msgcat::mc "Aborted due to SIGINT"]
+                        throw
+                    } catch {{POSIX SIG SIGTERM} eCode eMessage} {
+                        ui_debug [msgcat::mc "Aborted due to SIGTERM"]
+                        throw
+                    } catch {{*} eCode eMessage} {
+                        ui_debug [msgcat::mc "couldn't fetch %s for %s (%s)" $file_url $subport $eMessage]
                     }
                 }
                 if {$count == 0} {

Modified: branches/new-help-system/base/src/port1.0/portextract.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/portextract.tcl	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/port1.0/portextract.tcl	2014-08-03 15:04:12 UTC (rev 122999)
@@ -90,7 +90,11 @@
         set extract.dir ${worksrcpath}
     }
     if {[tbool use_bzip2]} {
-        option extract.cmd [findBinary bzip2 ${portutil::autoconf::bzip2_path}]
+        if {![catch {findBinary lbzip2} result]} {
+            option extract.cmd $result
+        } else {
+            option extract.cmd [findBinary bzip2 ${portutil::autoconf::bzip2_path}]
+        }
     } elseif {[tbool use_lzma]} {
         option extract.cmd [findBinary lzma ${portutil::autoconf::lzma_path}]
     } elseif {[tbool use_xz]} {

Modified: branches/new-help-system/base/src/port1.0/portfetch.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/portfetch.tcl	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/port1.0/portfetch.tcl	2014-08-03 15:04:12 UTC (rev 122999)
@@ -1,8 +1,7 @@
 # -*- 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
-# portfetch.tcl
 # $Id$
 #
-# Copyright (c) 2004 - 2012 The MacPorts Project
+# Copyright (c) 2004 - 2014 The MacPorts Project
 # Copyright (c) 2002 - 2003 Apple Inc.
 # All rights reserved.
 #
@@ -188,7 +187,7 @@
                 }
             }
             git {
-                depends_fetch-append bin:git:git-core
+                depends_fetch-append bin:git:git
             }
             hg {
                 depends_fetch-append bin:hg:mercurial
@@ -533,20 +532,34 @@
                 set urlmap($url_var) $urlmap(master_sites)
             }
             unset -nocomplain fetched
+            set lastError ""
             foreach site $urlmap($url_var) {
                 ui_notice "$UI_PREFIX [format [msgcat::mc "Attempting to fetch %s from %s"] $distfile $site]"
                 set file_url [portfetch::assemble_url $site $distfile]
-                if {![catch {eval curl fetch $fetch_options {$file_url} {"${distpath}/${distfile}.TMP"}} result] &&
-                    ![catch {file rename -force "${distpath}/${distfile}.TMP" "${distpath}/${distfile}"} result]} {
+                try {
+                    curl fetch {*}$fetch_options $file_url "${distpath}/${distfile}.TMP"
+                    file rename -force "${distpath}/${distfile}.TMP" "${distpath}/${distfile}"
                     set fetched 1
                     break
-                } else {
-                    ui_debug "[msgcat::mc "Fetching distfile failed"]: $result"
+                } catch {{POSIX SIG SIGINT} eCode eMessage} {
+                    ui_debug [msgcat::mc "Aborted fetching distfile due to SIGINT"]
                     file delete -force "${distpath}/${distfile}.TMP"
+                    throw
+                } catch {{POSIX SIG SIGTERM} eCode eMessage} {
+                    ui_debug [msgcat::mc "Aborted fetching distfile due to SIGTERM"]
+                    file delete -force "${distpath}/${distfile}.TMP"
+                    throw
+                } catch {{*} eCode eMessage} {
+                    ui_debug [msgcat::mc "Fetching distfile failed: %s" $eMessage]
+                    set lastError $eMessage
                 }
             }
             if {![info exists fetched]} {
-                return -code error [msgcat::mc "fetch failed"]
+                if {$lastError ne ""} {
+                    error $lastError
+                } else {
+                    error [msgcat::mc "fetch failed"]
+                }
             }
         }
     }

Modified: branches/new-help-system/base/src/port1.0/portinstall.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/portinstall.tcl	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/port1.0/portinstall.tcl	2014-08-03 15:04:12 UTC (rev 122999)
@@ -122,7 +122,13 @@
                 set archive.pre_args {-cvf}
                 if {[regexp {z2?$} ${archive.type}]} {
                     if {[regexp {bz2?$} ${archive.type}]} {
-                        set gzip "bzip2"
+                        if {![catch {binaryInPath lbzip2}]} {
+                            set gzip "lbzip2"
+                        } elseif {![catch {binaryInPath pbzip2}]} {
+                            set gzip "pbzip2"
+                        } else {
+                            set gzip "bzip2"
+                        }
                         set level 9
                     } elseif {[regexp {lz$} ${archive.type}]} {
                         set gzip "lzma"
@@ -307,7 +313,7 @@
     homepage depends_run package-install workdir workpath \
     worksrcdir UI_PREFIX destroot revision maintainers user_options \
     portvariants negated_variants targets depends_lib PortInfo epoch license \
-    os.platform os.major portarchivetype installPlist
+    os.platform os.major portarchivetype installPlist registry.path porturl
 
     set oldpwd [pwd]
     if {$oldpwd eq ""} {
@@ -373,11 +379,40 @@
             # register files
             $regref map $installPlist
         }
-        
+
         # store portfile
-        set fd [open [file join ${portpath} Portfile]]
-        $regref portfile [read $fd]
-        close $fd
+        set portfile_path [file join $portpath Portfile]
+        set portfile_sha256 [sha256 file $portfile_path]
+        set portfile_size [file size $portfile_path]
+        set portfile_reg_dir [file join ${registry.path} registry portfiles ${subport}-${version}_${revision} ${portfile_sha256}-${portfile_size}]
+        file mkdir $portfile_reg_dir
+        set portfile_reg_path ${portfile_reg_dir}/Portfile
+        if {![file isfile $portfile_reg_path] || [file size $portfile_reg_path] != $portfile_size || [sha256 file $portfile_reg_path] ne $portfile_sha256} {
+            file copy -force $portfile_path $portfile_reg_dir
+        }
+        $regref portfile ${portfile_sha256}-${portfile_size}
+
+        # store portgroups
+        if {[info exists PortInfo(portgroups)]} {
+            foreach pg $PortInfo(portgroups) {
+                set pgname [lindex $pg 0]
+                set pgversion [lindex $pg 1]
+                set groupFile [getportresourcepath $porturl "port1.0/group/${pgname}-${pgversion}.tcl"]
+                if {[file isfile $groupFile]} {
+                    set pgsha256 [sha256 file $groupFile]
+                    set pgsize [file size $groupFile]
+                    set pg_reg_dir [file join ${registry.path} registry portgroups ${pgsha256}-${pgsize}]
+                    set pg_reg_path ${pg_reg_dir}/${pgname}-${pgversion}.tcl
+                    if {![file isfile $pg_reg_path] || [file size $pg_reg_path] != $pgsize || [sha256 file $pg_reg_path] ne $pgsha256} {
+                        file mkdir $pg_reg_dir
+                        file copy -force $groupFile $pg_reg_dir
+                    }
+                    $regref addgroup $pgname $pgversion $pgsha256 $pgsize
+                } else {
+                    ui_debug "install_main: no portgroup ${pgname}-${pgversion}.tcl found"
+                }
+            }
+        }
     }
 
     _cd $oldpwd

Modified: branches/new-help-system/base/src/port1.0/portlint.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/portlint.tcl	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/port1.0/portlint.tcl	2014-08-03 15:04:12 UTC (rev 122999)
@@ -1,6 +1,33 @@
-# et:ts=4
-# portlint.tcl
+# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4
 # $Id$
+#
+# Copyright (c) 2007 - 2014 The MacPorts Project
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+# 3. Neither the name of The MacPorts Project nor the names of its contributors
+#    may be used to endorse or promote products derived from this software
+#    without specific prior written permission.
+# 
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
 
 package provide portlint 1.0
 package require portutil 1.0
@@ -53,6 +80,7 @@
     "distname" \
     "use_automake" \
     "use_autoconf" \
+    "use_autoreconf" \
     "use_configure" \
     ]
 
@@ -261,6 +289,11 @@
             incr warnings
         }
 
+        if {[regexp {compiler\.blacklist.*\{} $line] && ![info exists portgroups(compiler_blacklist_versions)]} {
+            ui_error "Line $lineno uses compiler.blacklist in a way that requires the compiler_blacklist_versions portgroup, but this portgroup has not been included"
+            incr errors
+        }
+
         # Check for hardcoded version numbers
         if {$nitpick} {
             # Support for skipping checksums lines
@@ -458,11 +491,21 @@
     }
 
     set all_depends {}
-    if {[info exists depends_fetch]} { eval "lappend all_depends $depends_fetch" }
-    if {[info exists depends_extract]} { eval "lappend all_depends $depends_extract" }
-    if {[info exists depends_lib]} { eval "lappend all_depends $depends_lib" }
-    if {[info exists depends_build]} { eval "lappend all_depends $depends_build" }
-    if {[info exists depends_run]} { eval "lappend all_depends $depends_run" }
+    if {[info exists depends_fetch]} {
+        lappend all_depends {*}$depends_fetch
+    }
+    if {[info exists depends_extract]} {
+        lappend all_depends {*}$depends_extract
+    }
+    if {[info exists depends_lib]} {
+        lappend all_depends {*}$depends_lib
+    }
+    if {[info exists depends_build]} {
+        lappend all_depends {*}$depends_build
+    }
+    if {[info exists depends_run]} {
+        lappend all_depends {*}$depends_run
+    }
     foreach depspec $all_depends {
         set dep [lindex [split $depspec :] end]
         if {[catch {set res [mport_lookup $dep]} error]} {

Modified: branches/new-help-system/base/src/port1.0/portlivecheck.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/portlivecheck.tcl	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/port1.0/portlivecheck.tcl	2014-08-03 15:04:12 UTC (rev 122999)
@@ -146,7 +146,7 @@
         "regexm" {
             # single and multiline regex
             ui_debug "Fetching ${livecheck.url}"
-            if {[catch {eval curl fetch $curl_options {${livecheck.url}} $tempfile} error]} {
+            if {[catch {curl fetch {*}$curl_options ${livecheck.url} $tempfile} error]} {
                 ui_error "cannot check if $subport was updated ($error)"
                 set updated -1
             } else {
@@ -198,7 +198,7 @@
         }
         "md5" {
             ui_debug "Fetching ${livecheck.url}"
-            if {[catch {eval curl fetch $curl_options {${livecheck.url}} $tempfile} error]} {
+            if {[catch {curl fetch {*}$curl_options ${livecheck.url} $tempfile} error]} {
                 ui_error "cannot check if $subport was updated ($error)"
                 set updated -1
             } else {

Modified: branches/new-help-system/base/src/port1.0/portload.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/portload.tcl	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/port1.0/portload.tcl	2014-08-03 15:04:12 UTC (rev 122999)
@@ -58,7 +58,7 @@
         } elseif {![file exists $path]} {
             return -code error [format [msgcat::mc "Launchd plist %s was not found"] $path]
         } else {
-            exec $launchctl_path load -w $path 2>@stderr
+            exec -ignorestderr $launchctl_path load -w $path
         }
     }
     

Modified: branches/new-help-system/base/src/port1.0/portmain.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/portmain.tcl	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/port1.0/portmain.tcl	2014-08-03 15:04:12 UTC (rev 122999)
@@ -51,7 +51,7 @@
         long_description description homepage notes license \
         provides conflicts replaced_by \
         worksrcdir filesdir distname portdbpath libpath distpath sources_conf \
-        os.platform os.subplatform os.version os.major os.arch os.endian \
+        os.platform os.subplatform os.version os.major os.minor os.arch os.endian \
         platforms default_variants install.user install.group \
         macosx_deployment_target universal_variant os.universal_supported \
         supported_archs depends_skip_archcheck installs_libs \
@@ -116,6 +116,7 @@
 default os.platform {$os_platform}
 default os.version {$os_version}
 default os.major {$os_major}
+default os.minor {$os_minor}
 default os.arch {$os_arch}
 default os.endian {$os_endian}
 

Modified: branches/new-help-system/base/src/port1.0/porttrace.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/porttrace.tcl	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/port1.0/porttrace.tcl	2014-08-03 15:04:12 UTC (rev 122999)
@@ -49,9 +49,7 @@
             # Create a fifo.
             # path in unix socket limited to 109 chars
             # # set trace_fifo "$workpath/trace_fifo"
-            set trace_fifo "/tmp/macports/[pid]_[expr {int(rand()*1000)}]"
-            file mkdir "/tmp/macports"
-            chownAsRoot "/tmp/macports"
+            set trace_fifo "/tmp/macports_trace_[pid]-[expr {int(rand()*1000)}]"
             file delete -force $trace_fifo
 
             # Create the thread/process.
@@ -59,14 +57,13 @@
 
             # Launch darwintrace.dylib.
 
-            set tracelib_path [file join ${portutil::autoconf::prefix} share macports Tcl darwintrace1.0 darwintrace.dylib]
+            set tracelib_path [file join ${portutil::autoconf::tcl_package_path} darwintrace1.0 darwintrace.dylib]
 
             if {[info exists env(DYLD_INSERT_LIBRARIES)] && [string length "$env(DYLD_INSERT_LIBRARIES)"] > 0} {
                 set env(DYLD_INSERT_LIBRARIES) "${env(DYLD_INSERT_LIBRARIES)}:${tracelib_path}"
             } else {
                 set env(DYLD_INSERT_LIBRARIES) ${tracelib_path}
             }
-            set env(DYLD_FORCE_FLAT_NAMESPACE) 1
             set env(DARWINTRACE_LOG) "$trace_fifo"
             # The sandbox is limited to:
             # workpath
@@ -170,7 +167,7 @@
     global os.platform
     if {${os.platform} == "darwin"} {
         global env trace_fifo macosx_version
-        foreach var {DYLD_INSERT_LIBRARIES DYLD_FORCE_FLAT_NAMESPACE DARWINTRACE_LOG DARWINTRACE_SANDBOX_BOUNDS} {
+        foreach var {DYLD_INSERT_LIBRARIES DARWINTRACE_LOG} {
             array unset env $var
             if {$macosx_version eq "10.5"} {
                 unsetenv $var
@@ -338,7 +335,7 @@
 # Private.
 # Slave cleanup method.
 proc porttrace::slave_stop {} {
-    global trace_filemap trace_fifo_r_chan trace_fifo_w_chan
+    global trace_filemap
     # Close the virtual filemap.
     filemap close trace_filemap
     # Close the pipe (both ends).

Modified: branches/new-help-system/base/src/port1.0/portunload.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/portunload.tcl	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/port1.0/portunload.tcl	2014-08-03 15:04:12 UTC (rev 122999)
@@ -58,7 +58,7 @@
         } elseif {![file exists $path]} {
             return -code error [format [msgcat::mc "Launchd plist %s was not found"] $path]
         } else {
-            exec $launchctl_path unload -w $path 2>@stderr
+            exec -ignorestderr $launchctl_path unload -w $path
         }
     }
     

Modified: branches/new-help-system/base/src/port1.0/portutil.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/portutil.tcl	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/port1.0/portutil.tcl	2014-08-03 15:04:12 UTC (rev 122999)
@@ -4,7 +4,7 @@
 # Copyright (c) 2002-2003 Apple Inc.
 # Copyright (c) 2004 Robert Shaw <rshaw at opendarwin.org>
 # Copyright (c) 2006-2007 Markus W. Weissmann <mww at macports.org>
-# Copyright (c) 2004-2013 The MacPorts Project
+# Copyright (c) 2004-2014 The MacPorts Project
 # All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
@@ -180,7 +180,7 @@
         }
         set refcount [lindex $deprecated_options(${option}-replace) 1]
         lset deprecated_options(${option}-replace) 1 [expr {$refcount + 1}]
-        return [eval handle_option-strsed $option $args]
+        return [handle_option-strsed $option {*}$args]
     }
 
     if {![info exists user_options($option)] && [info exists $option]} {
@@ -451,7 +451,7 @@
     # Call the command.
     set fullcmdstring "$command_prefix $cmdstring $command_suffix"
     ui_debug "Executing command line: $fullcmdstring"
-    set code [catch {eval system $notty $nice \$fullcmdstring} result]
+    set code [catch {system {*}$notty {*}$nice $fullcmdstring} result]
     # Save variables in order to re-throw the same error code.
     set errcode $::errorCode
     set errinfo $::errorInfo
@@ -988,7 +988,8 @@
             set tmpfile [join [lrange $tmpfile 1 end]]
         }
 
-        set cmdline $portutil::autoconf::sed_command
+        set cmdline {}
+        lappend cmdline $portutil::autoconf::sed_command
         if {$extended} {
             if {$portutil::autoconf::sed_ext_flag eq "N/A"} {
                 ui_debug "sed extended regexp not available"
@@ -999,13 +1000,13 @@
         if {$suppress} {
             lappend cmdline -n
         }
-        set cmdline [concat $cmdline [list $pattern < $file >@ $tmpfd 2>@stderr]]
+        lappend cmdline $pattern "<$file" ">@$tmpfd"
         if {$locale ne ""} {
             set env(LC_CTYPE) $locale
         }
         ui_info "$UI_PREFIX [format [msgcat::mc "Patching %s: %s"] [file tail $file] $pattern]"
         ui_debug "Executing reinplace: $cmdline"
-        if {[catch {eval exec $cmdline} error]} {
+        if {[catch {exec -ignorestderr -- {*}$cmdline} error]} {
             global errorInfo
             ui_debug "$errorInfo"
             ui_error "reinplace: $error"
@@ -1068,7 +1069,7 @@
 # delete
 # Wrapper for file delete -force
 proc delete {args} {
-    eval file delete -force -- $args
+    file delete -force -- {*}$args
 }
 
 # touch
@@ -1167,7 +1168,7 @@
 # copy
 # Wrapper for file copy
 proc copy {args} {
-    eval file copy $args
+    file copy {*}$args
 }
 
 # move
@@ -1196,7 +1197,7 @@
             return
         }
     }
-    eval file rename $options -- $args
+    file rename {*}$options -- {*}$args
 }
 
 # ln
@@ -1506,7 +1507,7 @@
                 if {$result == 0} {
                     foreach pre [ditem_key $ditem pre] {
                         ui_debug "Executing $pre"
-                        set result [catch {eval $pre $targetname} errstr]
+                        set result [catch {$pre $targetname} errstr]
                         # Save variables in order to re-throw the same error code.
                         set errcode $::errorCode
                         set errinfo $::errorInfo
@@ -1516,7 +1517,7 @@
 
                 if {$result == 0} {
                     ui_debug "Executing $targetname ($portname)"
-                    set result [catch {eval $procedure $targetname} errstr]
+                    set result [catch {$procedure $targetname} errstr]
                     # Save variables in order to re-throw the same error code.
                     set errcode $::errorCode
                     set errinfo $::errorInfo
@@ -1525,7 +1526,7 @@
                 if {$result == 0} {
                     foreach post [ditem_key $ditem post] {
                         ui_debug "Executing $post"
-                        set result [catch {eval $post $targetname} errstr]
+                        set result [catch {$post $targetname} errstr]
                         # Save variables in order to re-throw the same error code.
                         set errcode $::errorCode
                         set errinfo $::errorInfo
@@ -1551,7 +1552,7 @@
                 if {[ditem_contains $ditem postrun] && $result == 0} {
                     set postrun [ditem_key $ditem postrun]
                     ui_debug "Executing $postrun"
-                    set result [catch {eval $postrun $targetname} errstr]
+                    set result [catch {$postrun $targetname} errstr]
                     # Save variables in order to re-throw the same error code.
                     set errcode $::errorCode
                     set errinfo $::errorInfo
@@ -1580,12 +1581,16 @@
             # - this step is not to always be performed
             # - this step must be written to file
             if {$skipped == 0
-          && [ditem_key $ditem runtype] ne "always"
-          && [ditem_key $ditem state] ne "no"} {
-            write_statefile target $targetname $target_state_fd
+                && [ditem_key $ditem runtype] ne "always"
+                && [ditem_key $ditem state] ne "no"} {
+                write_statefile target $targetname $target_state_fd
             }
         } else {
-            ui_error "$targetname for port $portname returned: $errstr"
+            if {$errstr ne {}} {
+                ui_error "Failed to $target $portname: $errstr"
+            } else {
+                ui_error "Failed to $target $portname."
+            }
             ui_debug "Error code: $errcode"
             ui_debug "Backtrace: $errinfo"
             set result 1
@@ -1680,11 +1685,14 @@
 
     if {[llength $dlist] > 0} {
         # somebody broke!
-        set errstring "Warning: targets not executed for $subport:"
-        foreach ditem $dlist {
-            append errstring " [ditem_key $ditem name]"
-        }
-        ui_info $errstring
+        # The phase that failed should have already printed error info; don't
+        # print useless stuff cluttering the *real* info of the error message.
+
+        #set errstring "Warning: targets not executed for $subport:"
+        #foreach ditem $dlist {
+        #    append errstring " [ditem_key $ditem name]"
+        #}
+        #ui_info $errstring
         set result 1
     } else {
         set result 0
@@ -2132,7 +2140,8 @@
 
         array set oldvariations {}
         if {[check_statefile_variants variations oldvariations $state_fd]} {
-            ui_error "Requested variants \"[canonicalize_variants [array get variations]]\" do not match original selection \"[canonicalize_variants [array get oldvariations]]\".\nPlease use the same variants again, perform 'port clean [option subport]' or specify the force option (-f)."
+            ui_error "Requested variants \"[canonicalize_variants [array get variations]]\" do not match original selection \"[canonicalize_variants [array get oldvariations]]\"."
+            ui_error "Please use the same variants again, perform 'port clean [option subport]' or specify the force option (-f)."
             set result 1
         } elseif {!([info exists ports_dryrun] && $ports_dryrun eq "yes")} {
             # Write variations out to the statefile
@@ -2232,39 +2241,39 @@
             makeuserproc userproc-post-${ident}-${target}-\${proc_index} \$args
         "
     }
-    eval ditem_append $ditem provides $args
+    ditem_append $ditem provides {*}$args
 }
 
 proc target_requires {ditem args} {
-    eval ditem_append $ditem requires $args
+    ditem_append $ditem requires {*}$args
 }
 
 proc target_uses {ditem args} {
-    eval ditem_append $ditem uses $args
+    ditem_append $ditem uses {*}$args
 }
 
 proc target_deplist {ditem args} {
-    eval ditem_append $ditem deplist $args
+    ditem_append $ditem deplist {*}$args
 }
 
 proc target_prerun {ditem args} {
-    eval ditem_append $ditem prerun $args
+    ditem_append $ditem prerun {*}$args
 }
 
 proc target_postrun {ditem args} {
-    eval ditem_append $ditem postrun $args
+    ditem_append $ditem postrun {*}$args
 }
 
 proc target_runtype {ditem args} {
-    eval ditem_append $ditem runtype $args
+    ditem_append $ditem runtype {*}$args
 }
 
 proc target_state {ditem args} {
-    eval ditem_append $ditem state $args
+    ditem_append $ditem state {*}$args
 }
 
 proc target_init {ditem args} {
-    eval ditem_append $ditem init $args
+    ditem_append $ditem init {*}$args
 }
 
 ##### variant class #####
@@ -2328,7 +2337,7 @@
         }
     }
     foreach username [array names args] {
-        eval adduser $username $args($username)
+        adduser $username {*}$args($username)
     }
 }
 
@@ -2365,22 +2374,22 @@
         set dscl [findBinary dscl $portutil::autoconf::dscl_path]
         set failed? 0
         try {
-            exec $dscl . -create /Users/${name} UniqueID ${uid} 2>@stderr
+            exec -ignorestderr $dscl . -create /Users/${name} UniqueID ${uid}
 
             # These are implicitly added on Mac OSX Lion.  AuthenticationAuthority
             # causes the user to be visible in the Users & Groups Preference Pane,
             # and the others are just noise, so delete them.
             # https://trac.macports.org/ticket/30168
-            exec $dscl . -delete /Users/${name} AuthenticationAuthority 2>@stderr
-            exec $dscl . -delete /Users/${name} PasswordPolicyOptions 2>@stderr
-            exec $dscl . -delete /Users/${name} dsAttrTypeNative:KerberosKeys 2>@stderr
-            exec $dscl . -delete /Users/${name} dsAttrTypeNative:ShadowHashData 2>@stderr
+            exec -ignorestderr $dscl . -delete /Users/${name} AuthenticationAuthority
+            exec -ignorestderr $dscl . -delete /Users/${name} PasswordPolicyOptions
+            exec -ignorestderr $dscl . -delete /Users/${name} dsAttrTypeNative:KerberosKeys
+            exec -ignorestderr $dscl . -delete /Users/${name} dsAttrTypeNative:ShadowHashData
 
-            exec $dscl . -create /Users/${name} RealName ${realname} 2>@stderr
-            exec $dscl . -create /Users/${name} Password ${passwd} 2>@stderr
-            exec $dscl . -create /Users/${name} PrimaryGroupID ${gid} 2>@stderr
-            exec $dscl . -create /Users/${name} NFSHomeDirectory ${home} 2>@stderr
-            exec $dscl . -create /Users/${name} UserShell ${shell} 2>@stderr
+            exec -ignorestderr $dscl . -create /Users/${name} RealName ${realname}
+            exec -ignorestderr $dscl . -create /Users/${name} Password ${passwd}
+            exec -ignorestderr $dscl . -create /Users/${name} PrimaryGroupID ${gid}
+            exec -ignorestderr $dscl . -create /Users/${name} NFSHomeDirectory ${home}
+            exec -ignorestderr $dscl . -create /Users/${name} UserShell ${shell}
         } catch {{CHILDKILLED *} eCode eMessage} {
             # the foreachs are a simple workaround for Tcl 8.4, which doesn't
             # seem to have lassign
@@ -2411,7 +2420,7 @@
                 # state before the error
                 ui_debug "Attempting to clean up failed creation of user $name"
                 try {
-                    exec $dscl . -delete /Users/${name} 2>@stderr
+                    exec -ignorestderr $dscl . -delete /Users/${name}
                 } catch {{CHILDKILLED *} eCode eMessage} {
                     foreach {- pid sigName msg} {
                         ui_warn "dscl($pid) was killed by $sigName: $msg while trying to clean up failed creation of user $name."
@@ -2509,7 +2518,7 @@
                 # state before the error
                 ui_debug "Attempting to clean up failed creation of group $name"
                 try {
-                    exec $dscl . -delete /Groups/${name} 2>@stderr
+                    exec -ignorestderr $dscl . -delete /Groups/${name}
                 } catch {{CHILDKILLED *} eCode eMessage} {
                     foreach {- pid sigName msg} {
                         ui_warn "dscl($pid) was killed by $sigName: $msg while trying to clean up failed creation of group $name."
@@ -2569,8 +2578,21 @@
 
 # Use a specified group/version.
 proc PortGroup {group version} {
-    global porturl
+    global porturl PortInfo _portgroup_search_dirs
 
+    lappend PortInfo(portgroups) [list $group $version]
+
+    if {[info exists _portgroup_search_dirs]} {
+        foreach dir $_portgroup_search_dirs {
+            set groupFile ${dir}/${group}-${version}.tcl
+            if {[file exists $groupFile]} {
+                uplevel "source $groupFile"
+                ui_debug "Sourcing PortGroup $group $version from $groupFile"
+                return
+            }
+        }
+    }
+
     set groupFile [getportresourcepath $porturl "port1.0/group/${group}-${version}.tcl"]
 
     if {[file exists $groupFile]} {
@@ -2802,7 +2824,7 @@
     foreach arch ${archs} {
         lappend exec-lipo -arch ${arch} ${base}/${arch}${file}
     }
-    eval exec ${exec-lipo} [list -create -output ${target}${file}]
+    exec {*}${exec-lipo} -create -output ${target}${file}
 }
 
 # private function
@@ -2957,12 +2979,12 @@
             setegid $egid
             ui_debug "euid/egid changed to: [geteuid]/[getegid]"
             ui_debug "setting attributes on $file"
-            eval file attributes {$file} $attributes
+            file attributes $file {*}$attributes
             setegid [uname_to_gid "$macportsuser"]
             seteuid [name_to_uid "$macportsuser"]
             ui_debug "euid/egid changed to: [geteuid]/[getegid]"
         } else {
-            eval file attributes {$file} $attributes
+            file attributes $file {*}$attributes
         }
     } else {
         # not root, so can't set owner/group

Modified: branches/new-help-system/base/src/port1.0/tests/Portfile
===================================================================
--- branches/new-help-system/base/src/port1.0/tests/Portfile	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/port1.0/tests/Portfile	2014-08-03 15:04:12 UTC (rev 122999)
@@ -1,36 +1,29 @@
-# $Id: Portfile 85472 2011-10-14 01:52:18Z dports at macports.org $
+# $Id$
 
-PortSystem              1.0
+PortSystem 1.0
 
-name                    fondu
-version                 060102
-revision                1
-platforms               darwin
-categories              print
-license                 BSD
-maintainers             nomaintainer
-homepage                http://fondu.sourceforge.net/
-master_sites            http://fondu.sourceforge.net/
+name			gcc_select
+version			0.1
+revision		4
+categories		sysutils
+platforms		darwin
+license		BSD
+maintainers		mww
+supported_archs		noarch
+description		Switch the default compiler
+long_description	gcc_select lets you switch the default compiler. \
+			It symlinks the standard compiler executables \
+			in the MacPorts prefix to the selected version.
 
-description             A set of programs to interconvert between Mac font \
-                        formats and pfb, ttf, otf and bdf files on UNIX.
+homepage		http://svn.macports.org/repository/macports/contrib/select/
+master_sites		${homepage}
+distname		select-${version}
+checksums		sha1 18e1f95c2ddd88210aa52eb696261859af2dc3a4
 
-long_description        Dealing with Mac fonts is hard on other operating \
-                        systems because Mac fonts are stored in the resource \
-                        fork, and other operating systems do not support \
-                        this concept. Fondu will extract the resource fork \
-                        from either a MacBinary file or a BinHex file. Ufond \
-                        will create a resource fork inside a MacBinary file.
-
-checksums               md5 e20861beacddc1ab392bef7813641bf8
-extract.suffix          .tgz
-distfiles               ${name}_src-${version}${extract.suffix}
-
 patchfiles
-
 patch {
     foreach patch $patchfiles {
-        set fd [open ${portpath}/files/${patch} r]
+        set fd [open ${filespath}/${patch} r]
         set var [gets $fd]
         close $fd
         set fd [open ${workpath}/${distname}/test_patch w+]
@@ -39,17 +32,16 @@
     }
 }
 
-post-patch {
-    reinplace "s|^CFLAGS = -g \$(WFLAGS)|CFLAGS = -g \$(WFLAGS) ${configure.cppflags} ${configure.cflags} ${configure.ldflags} [get_canonical_archflags]|g" ${worksrcpath}/Makefile.in
-}
+configure.args		--mandir=${prefix}/share/man --name=gcc
 
-configure.args          --bindir=${prefix}/bin \
-                        --mandir=${prefix}/share/man
-
 post-destroot {
-    eval xinstall -m 644 [glob ${worksrcpath}/*.1] ${destroot}${prefix}/share/man/man1/
+    xinstall -d ${destroot}${prefix}/etc/select/gcc
+    touch ${destroot}${prefix}/etc/select/gcc/base
 }
 
 test {
-    file delete -force $worksrcpath/README
+    touch ${worksrcpath}/README
+    file delete -force ${worksrcpath}/README
 }
+
+livecheck.type	none

Modified: branches/new-help-system/base/src/port1.0/tests/portactivate.test
===================================================================
--- branches/new-help-system/base/src/port1.0/tests/portactivate.test	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/port1.0/tests/portactivate.test	2014-08-03 15:04:12 UTC (rev 122999)
@@ -6,7 +6,6 @@
 set pwd [file dirname [file normalize $argv0]]
 
 source ../port_test_autoconf.tcl
-source $macports::autoconf::macports_tcl_dir/macports1.0/macports_fastload.tcl
 package require macports 1.0
 
 array set ui_options {}

Modified: branches/new-help-system/base/src/port1.0/tests/portchecksum.test
===================================================================
--- branches/new-help-system/base/src/port1.0/tests/portchecksum.test	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/port1.0/tests/portchecksum.test	2014-08-03 15:04:12 UTC (rev 122999)
@@ -6,7 +6,6 @@
 set pwd [file dirname [file normalize $argv0]]
 
 source ../port_test_autoconf.tcl
-source $macports::autoconf::macports_tcl_dir/macports1.0/macports_fastload.tcl
 package require macports 1.0
 
 array set ui_options {}

Modified: branches/new-help-system/base/src/port1.0/tests/portclean.test
===================================================================
--- branches/new-help-system/base/src/port1.0/tests/portclean.test	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/port1.0/tests/portclean.test	2014-08-03 15:04:12 UTC (rev 122999)
@@ -6,7 +6,6 @@
 set pwd [file dirname [file normalize $argv0]]
 
 source ../port_test_autoconf.tcl
-source $macports::autoconf::macports_tcl_dir/macports1.0/macports_fastload.tcl
 package require macports 1.0
 
 array set ui_options {}

Modified: branches/new-help-system/base/src/port1.0/tests/portdeactivate.test
===================================================================
--- branches/new-help-system/base/src/port1.0/tests/portdeactivate.test	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/port1.0/tests/portdeactivate.test	2014-08-03 15:04:12 UTC (rev 122999)
@@ -6,7 +6,6 @@
 set pwd [file dirname [file normalize $argv0]]
 
 source ../port_test_autoconf.tcl
-source $macports::autoconf::macports_tcl_dir/macports1.0/macports_fastload.tcl
 package require macports 1.0
 
 array set ui_options {}

Modified: branches/new-help-system/base/src/port1.0/tests/portdepends.test
===================================================================
--- branches/new-help-system/base/src/port1.0/tests/portdepends.test	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/port1.0/tests/portdepends.test	2014-08-03 15:04:12 UTC (rev 122999)
@@ -6,7 +6,6 @@
 set pwd [file dirname [file normalize $argv0]]
 
 source ../port_test_autoconf.tcl
-source $macports::autoconf::macports_tcl_dir/macports1.0/macports_fastload.tcl
 package require macports 1.0
 
 array set ui_options {}

Modified: branches/new-help-system/base/src/port1.0/tests/portdistcheck.test
===================================================================
--- branches/new-help-system/base/src/port1.0/tests/portdistcheck.test	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/port1.0/tests/portdistcheck.test	2014-08-03 15:04:12 UTC (rev 122999)
@@ -6,7 +6,6 @@
 set pwd [file dirname [file normalize $argv0]]
 
 source ../port_test_autoconf.tcl
-source $macports::autoconf::macports_tcl_dir/macports1.0/macports_fastload.tcl
 package require macports 1.0
 
 array set ui_options {}
@@ -25,12 +24,12 @@
     set portpath $pwd
     set filespath $pwd/files
 
-    set name cocot
+    set name gcc_select
     set subport $name
-    set distname cocot-20080315
-    set porturl "http://distfiles.macports.org/cocot/"
+    set distname select-0.1
+    set porturl "http://distfiles.macports.org/gcc_select/"
     set master_sites $porturl
-    set extract.suffix .tar.bz2
+    set extract.suffix .tar.gz
 
 } -body {
     set fetch.type standard

Modified: branches/new-help-system/base/src/port1.0/tests/portinstall.test
===================================================================
--- branches/new-help-system/base/src/port1.0/tests/portinstall.test	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/port1.0/tests/portinstall.test	2014-08-03 15:04:12 UTC (rev 122999)
@@ -6,7 +6,6 @@
 set pwd [file dirname [file normalize $argv0]]
 
 source ../port_test_autoconf.tcl
-source $macports::autoconf::macports_tcl_dir/macports1.0/macports_fastload.tcl
 package require macports 1.0
 
 array set ui_options {}
@@ -31,9 +30,9 @@
 set configure.build_arch build_arch
 set portarchivetype tgz
 
-set subport fondu
-set version 3.0
-set revision 2
+set subport gcc_select
+set version 0.1
+set revision 4
 
 
 test install_start {

Modified: branches/new-help-system/base/src/port1.0/tests/portload.test
===================================================================
--- branches/new-help-system/base/src/port1.0/tests/portload.test	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/port1.0/tests/portload.test	2014-08-03 15:04:12 UTC (rev 122999)
@@ -6,7 +6,6 @@
 set pwd [file dirname [file normalize $argv0]]
 
 source ../port_test_autoconf.tcl
-source $macports::autoconf::macports_tcl_dir/macports1.0/macports_fastload.tcl
 package require macports 1.0
 
 array set ui_options {}
@@ -52,7 +51,7 @@
     return "Load successful."
 
 } -cleanup {
-    exec $launchctl_path unload -w $path 2>@stderr
+    exec -ignorestderr $launchctl_path unload -w $path
     file delete -force /Library/test
 
 } -result "Load successful."

Modified: branches/new-help-system/base/src/port1.0/tests/portmain.test
===================================================================
--- branches/new-help-system/base/src/port1.0/tests/portmain.test	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/port1.0/tests/portmain.test	2014-08-03 15:04:12 UTC (rev 122999)
@@ -6,7 +6,6 @@
 set pwd [file dirname [file normalize $argv0]]
 
 source ../port_test_autoconf.tcl
-source $macports::autoconf::macports_tcl_dir/macports1.0/macports_fastload.tcl
 package require macports 1.0
 
 array set ui_options {}

Modified: branches/new-help-system/base/src/port1.0/tests/portpatch.test
===================================================================
--- branches/new-help-system/base/src/port1.0/tests/portpatch.test	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/port1.0/tests/portpatch.test	2014-08-03 15:04:12 UTC (rev 122999)
@@ -6,7 +6,6 @@
 set pwd [file dirname [file normalize $argv0]]
 
 source ../port_test_autoconf.tcl
-source $macports::autoconf::macports_tcl_dir/macports1.0/macports_fastload.tcl
 package require macports 1.0
 
 array set ui_options {}
@@ -38,7 +37,7 @@
 } -setup {
     set macosx_version 12
 
-    set subport fondu
+    set subport gcc_select
     set filespath $pwd/files
     set distpath $pwd/dist
     set usealtworkpath yes
@@ -63,7 +62,7 @@
     if {[$workername eval eval_targets patch]} {
         return "FAIL: cannot run patch"
     }
-    if {![file exists $pwd/work/fondu-060102/test_patch]} {
+    if {![file exists $pwd/work/select-0.1/test_patch]} {
         return "FAIL: missing patched file"
     }
     return "Patch successful."

Modified: branches/new-help-system/base/src/port1.0/tests/porttest.test
===================================================================
--- branches/new-help-system/base/src/port1.0/tests/porttest.test	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/port1.0/tests/porttest.test	2014-08-03 15:04:12 UTC (rev 122999)
@@ -6,7 +6,6 @@
 set pwd [file dirname [file normalize $argv0]]
 
 source ../port_test_autoconf.tcl
-source $macports::autoconf::macports_tcl_dir/macports1.0/macports_fastload.tcl
 package require macports 1.0
 
 array set ui_options {}

Modified: branches/new-help-system/base/src/port1.0/tests/portuninstall.test
===================================================================
--- branches/new-help-system/base/src/port1.0/tests/portuninstall.test	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/port1.0/tests/portuninstall.test	2014-08-03 15:04:12 UTC (rev 122999)
@@ -6,7 +6,6 @@
 set pwd [file dirname [file normalize $argv0]]
 
 source ../port_test_autoconf.tcl
-source $macports::autoconf::macports_tcl_dir/macports1.0/macports_fastload.tcl
 package require macports 1.0
 
 array set ui_options {}
@@ -20,9 +19,9 @@
 source ./library.tcl
 macports_worker_init
 
-set subport fondu
-set version 3.0
-set revision 2
+set subport gcc_select
+set version 0.1
+set revision 4
 
 
 # test uninstall_start

Modified: branches/new-help-system/base/src/port1.0/tests/portutil.test
===================================================================
--- branches/new-help-system/base/src/port1.0/tests/portutil.test	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/port1.0/tests/portutil.test	2014-08-03 15:04:12 UTC (rev 122999)
@@ -3,12 +3,10 @@
 package require tcltest 2
 namespace import tcltest::*
 
-source ../../macports1.0/macports_fastload.tcl
 
 set pwd [file dirname [file normalize $argv0]]
 
 source ../port_test_autoconf.tcl
-source $macports::autoconf::macports_tcl_dir/macports1.0/macports_fastload.tcl
 package require macports 1.0
 
 array set ui_options {}

Modified: branches/new-help-system/base/src/port1.0/tests/test.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/tests/test.tcl	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/port1.0/tests/test.tcl	2014-08-03 15:04:12 UTC (rev 122999)
@@ -1,5 +1,5 @@
 # Global vars
-set arguments ""
+set arguments {}
 set test_name ""
 set color_out ""
 set tcl ""
@@ -15,10 +15,10 @@
 }
 
 proc print_help {arg} {
-    if { $arg eq "tests" } {
+    if {$arg eq "tests"} {
         puts "The list of available tests is:"
-	cd tests
-	set test_suite [glob *.test]
+        cd tests
+        set test_suite [glob *.test]
         foreach test $test_suite {
             puts [puts -nonewline "  "]$test
         }
@@ -34,77 +34,86 @@
 
 # Process args
 foreach arg $argv {
-    if { $arg eq "-h" || $arg eq "-help" } {
+    if {$arg eq "-h" || $arg eq "-help"} {
         print_help ""
         exit 0
-    } elseif { $arg eq "-debug" } {
+    } elseif {$arg eq "-debug"} {
         set index [expr {[lsearch $argv $arg] + 1}]
         set level [lindex $argv $index]
-        if { $level >= 0 && $level <= 3 } {
-            append arguments "-debug " $level
+        if {$level >= 0 && $level <= 3} {
+            lappend arguments "-debug" $level
         } else {
             puts "Invalid debug level."
             exit 1
         }
-    } elseif { $arg eq "-t" } {
+    } elseif {$arg eq "-t"} {
         set index [expr {[lsearch $argv $arg] + 1}]
         set test_name [lindex $argv $index]
         set no 0
-	cd tests
-	set test_suite [glob *.test]
+        cd tests
+        set test_suite [glob *.test]
         foreach test $test_suite {
-            if { $test_name != $test } {
+            if {$test_name ne $test} {
                 set no [expr {$no + 1}]
             }
         }
-        if { $no == [llength $test_suite] } {
+        if {$no == [llength $test_suite]} {
             print_help tests
             exit 1
         }
-    } elseif { $arg eq "-l" } {
+    } elseif {$arg eq "-l"} {
         print_help tests
         exit 0
-    } elseif { $arg eq "-nocolor" } {
+    } elseif {$arg eq "-nocolor"} {
         set color_out "no"
     }
 }
 
 
 # Run tests
-if { $test_name ne ""} {
-    set result [eval exec $tcl $test_name $arguments 2>@stderr]
+if {$test_name ne ""} {
+    set result [exec -ignorestderr $tcl $test_name {*}$arguments]
     puts $result
-
 } else {
     cd tests
     set test_suite [glob *.test]
 
     foreach test $test_suite {
-        set result [eval exec $tcl $test $arguments 2>@stderr]
-	set lastline [lindex [split $result "\n"] end]
+        set result [exec -ignorestderr $tcl $test {*}$arguments]
+        set lastline [lindex [split $result "\n"] end]
 
-	if {[lrange [split $lastline "\t"] 1 1] != "Total"} {
-	    set lastline [lindex [split $result "\n"] end-2]
-	    set errmsg [lindex [split $result "\n"] end]
-	}
+        if {[lrange [split $lastline "\t"] 1 1] ne "Total"} {
+            set lastline [lindex [split $result "\n"] end-2]
+            set errmsg [lindex [split $result "\n"] end]
+        }
 
-	set splitresult [split $lastline "\t"]
+        set splitresult [split $lastline "\t"]
         set total [lindex $splitresult 2]
         set pass [lindex $splitresult 4]
         set skip [lindex $splitresult 6]
         set fail [lindex $splitresult 8]
 
-	# Format output
-	if {$total < 10} { set total "0${total}"}
-	if {$pass < 10} { set pass "0${pass}"}
-	if {$skip < 10} { set skip "0${skip}"}
-	if {$fail < 10} { set fail "0${fail}"}
+        # Format output
+        if {$total < 10} {
+            set total "0${total}"
+        }
+        if {$pass < 10} {
+            set pass "0${pass}"
+        }
+        if {$skip < 10} {
+            set skip "0${skip}"
+        }
+        if {$fail < 10} {
+            set fail "0${fail}"
+        }
 
         # Check for errors.
-        if { $fail != 0 } { set err "yes" }
+        if {$fail != 0} {
+            set err "yes"
+        }
 
         set out ""
-        if { ($fail != 0 || $skip != 0) && $color_out eq "" } {
+        if {($fail != 0 || $skip != 0) && $color_out eq ""} {
             # Color failed tests.
             append out "\x1b\[1;31mTotal:" $total " Passed:" $pass " Failed:" $fail " Skipped:" $skip "  \x1b\[0m" $test
         } else {
@@ -113,19 +122,21 @@
 
         # Print results and constrints for auto-skipped tests.
         puts $out
-        if { $skip != 0 } {
+        if {$skip != 0} {
             set out "    Constraint: "
             append out [string trim $errmsg "\t {}"]
             puts $out
         }
-	if { $fail != 0 } {
-	    set end [expr {[string first $test $result 0] - 1}]
-	    puts [string range $result 0 $end]
-	}
+        if {$fail != 0} {
+            set end [expr {[string first $test $result 0] - 1}]
+            puts [string range $result 0 $end]
+        }
     }
 }
 
 # Return 1 if errors were found.
-if {$err ne ""} { exit 1 }
+if {$err ne ""} {
+    exit 1
+}
 
 return 0

Modified: branches/new-help-system/base/src/programs/Makefile.in
===================================================================
--- branches/new-help-system/base/src/programs/Makefile.in	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/programs/Makefile.in	2014-08-03 15:04:12 UTC (rev 122999)
@@ -1,8 +1,11 @@
 # $Id$
 
+srcdir = @srcdir@
+VPATH  = @srcdir@
+
 SUBDIR=	@EXTRA_PROGS@
 
-include ../../Mk/macports.subdir.mk
+include $(srcdir)/../../Mk/macports.subdir.mk
 
 distclean::
 	rm -f Makefile

Modified: branches/new-help-system/base/src/programs/daemondo/Makefile.in
===================================================================
--- branches/new-help-system/base/src/programs/daemondo/Makefile.in	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/programs/daemondo/Makefile.in	2014-08-03 15:04:12 UTC (rev 122999)
@@ -1,8 +1,9 @@
 # $Id$
 
-top_srcdir = @top_srcdir@
+srcdir     = @srcdir@
+VPATH      = @srcdir@
 
-include ${top_srcdir}/Mk/macports.autoconf.mk
+include ../../../Mk/macports.autoconf.mk
 
 datarootdir=	@datarootdir@
 mandir=		@mandir@
@@ -34,6 +35,6 @@
 	rm -f Makefile
 
 install: daemondo
-	${INSTALL} -o ${DSTUSR} -g ${DSTGRP} -m 555 ${PROGRAM} ${DESTDIR}${bindir}
+	${INSTALL} -o "${DSTUSR}" -g "${DSTGRP}" -m 555 "${PROGRAM}" "${DESTDIR}${bindir}"
 
 test:


Property changes on: branches/new-help-system/base/src/registry2.0
___________________________________________________________________
Modified: svn:ignore
   - pkgIndex.tcl
registry.dylib
registry_autoconf.tcl

   + Makefile
pkgIndex.tcl
registry.dylib
registry_autoconf.tcl


Deleted: branches/new-help-system/base/src/registry2.0/Makefile
===================================================================
--- branches/new-help-system/base/src/registry2.0/Makefile	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/registry2.0/Makefile	2014-08-03 15:04:12 UTC (rev 122999)
@@ -1,41 +0,0 @@
-# $Id$
-
-SRCS = registry.tcl registry_autoconf.tcl registry_util.tcl receipt_flat.tcl receipt_sqlite.tcl portimage.tcl portuninstall.tcl
-OBJS = registry.o util.o \
-	entry.o entryobj.o \
-	file.o fileobj.o
-	#graph.o graphobj.o
-
-SHLIB_NAME= registry${SHLIB_SUFFIX}
-INSTALLDIR= ${DESTDIR}${datadir}/macports/Tcl/registry2.0
-
-include ../../Mk/macports.autoconf.mk
-include ../../Mk/macports.tea.mk
-
-pkgIndex.tcl: $(SRCS)
-
-CFLAGS+=	${SQLITE3_CFLAGS}
-LIBS+=	${SQLITE3_LIBS} ../cregistry/cregistry.a
-ifeq ($(shell uname), Darwin)
-SHLIB_LDFLAGS+= -install_name @loader_path/../registry2.0/${SHLIB_NAME}
-endif
-
-${SHLIB_NAME}: ../cregistry/cregistry.a
-
-.PHONY: test
-
-test:: ${SHLIB_NAME}
-	${TCLSH} tests/entry.tcl ./${SHLIB_NAME}
-	${TCLSH} tests/depends.tcl ./${SHLIB_NAME}
-
-distclean:: clean
-	rm -f registry_autoconf.tcl
-
-install:: all
-	[ ! -d $(DESTDIR)${datadir}/macports/Tcl/registry1.0 ] || rm -vrf $(DESTDIR)${datadir}/macports/Tcl/registry1.0
-	$(INSTALL) -d -o ${DSTUSR} -g ${DSTGRP} -m ${DSTMODE} ${INSTALLDIR}
-	$(INSTALL) -o ${DSTUSR} -g ${DSTGRP} -m 444 ${SHLIB_NAME} ${INSTALLDIR}
-	$(SILENT) set -x; for file in ${SRCS}; do \
-		$(INSTALL) -o ${DSTUSR} -g ${DSTGRP} -m 444 $$file ${INSTALLDIR}/$$file; \
-	done
-	$(INSTALL) -o ${DSTUSR} -g ${DSTGRP} -m 444 pkgIndex.tcl ${INSTALLDIR}

Copied: branches/new-help-system/base/src/registry2.0/Makefile.in (from rev 122997, trunk/base/src/registry2.0/Makefile.in)
===================================================================
--- branches/new-help-system/base/src/registry2.0/Makefile.in	                        (rev 0)
+++ branches/new-help-system/base/src/registry2.0/Makefile.in	2014-08-03 15:04:12 UTC (rev 122999)
@@ -0,0 +1,52 @@
+# $Id$
+
+srcdir = @srcdir@
+VPATH  = @srcdir@
+
+include ../../Mk/macports.autoconf.mk
+
+SRCS_AUTOCONF = registry_autoconf.tcl
+SRCS = registry.tcl registry_util.tcl receipt_flat.tcl receipt_sqlite.tcl portimage.tcl portuninstall.tcl
+OBJS = registry.o util.o \
+	entry.o entryobj.o \
+	file.o fileobj.o \
+	portgroup.o portgroupobj.o
+	#graph.o graphobj.o
+
+SHLIB_NAME= registry${SHLIB_SUFFIX}
+INSTALLDIR= ${DESTDIR}${TCL_PACKAGE_PATH}/registry2.0
+
+include $(srcdir)/../../Mk/macports.tea.mk
+
+CPPFLAGS+=-D_XOPEN_SOURCE=600
+
+pkgIndex.tcl: $(SRCS) $(SRCS_AUTOCONF)
+
+CFLAGS+=	${SQLITE3_CFLAGS}
+LIBS+=	${SQLITE3_LIBS} ../cregistry/cregistry.a
+ifeq ($(shell uname), Darwin)
+SHLIB_LDFLAGS+= -install_name @loader_path/../registry2.0/${SHLIB_NAME}
+endif
+
+${SHLIB_NAME}: ../cregistry/cregistry.a
+
+.PHONY: test
+
+test:: ${SHLIB_NAME}
+	${TCLSH} $(srcdir)/tests/entry.tcl ./${SHLIB_NAME}
+	${TCLSH} $(srcdir)/tests/depends.tcl ./${SHLIB_NAME}
+
+distclean:: clean
+	rm -f registry_autoconf.tcl
+	rm -f Makefile
+
+install:: all $(SHLIB_NAME)
+	$(INSTALL) -d -o "${DSTUSR}" -g "${DSTGRP}" -m "${DSTMODE}" "${INSTALLDIR}"
+	$(INSTALL)    -o "${DSTUSR}" -g "${DSTGRP}" -m 444 "${SHLIB_NAME}" "${INSTALLDIR}"
+	$(SILENT) set -x; for file in ${SRCS}; do \
+		$(INSTALL) -o "${DSTUSR}" -g "${DSTGRP}" -m 444 "$(srcdir)/$$file" "${INSTALLDIR}/$$file"; \
+	done
+	$(SILENT) set -x; for file in ${SRCS_AUTOCONF}; do \
+		$(INSTALL) -o "${DSTUSR}" -g "${DSTGRP}" -m 444 "$$file" "${INSTALLDIR}/$$file"; \
+	done
+	$(INSTALL) -o "${DSTUSR}" -g "${DSTGRP}" -m 444 pkgIndex.tcl "${INSTALLDIR}"

Modified: branches/new-help-system/base/src/registry2.0/entry.c
===================================================================
--- branches/new-help-system/base/src/registry2.0/entry.c	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/registry2.0/entry.c	2014-08-03 15:04:12 UTC (rev 122999)
@@ -153,7 +153,7 @@
         list_handle = Tcl_GetAssocData(interp, "registry::deleted", NULL);
         if (list_handle) {
             entry_list* list = *list_handle;
-            *list_handle = malloc(sizeof(entry_list*));
+            *list_handle = malloc(sizeof(entry_list));
             if (*list_handle) {
                 (*list_handle)->entry = entry;
                 (*list_handle)->next = list;

Modified: branches/new-help-system/base/src/registry2.0/entryobj.c
===================================================================
--- branches/new-help-system/base/src/registry2.0/entryobj.c	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/registry2.0/entryobj.c	2014-08-03 15:04:12 UTC (rev 122999)
@@ -356,6 +356,59 @@
     }
 }
 
+static int entry_obj_add_portgroup(Tcl_Interp* interp, reg_entry* entry, int objc,
+        Tcl_Obj* CONST objv[]) {
+    reg_registry* reg = registry_for(interp, reg_attached);
+    if (objc != 6) {
+        Tcl_WrongNumArgs(interp, 1, objv, "addgroup name version sha256 size");
+        return TCL_ERROR;
+    } else if (reg == NULL) {
+        return TCL_ERROR;
+    } else {
+        reg_error error;
+        char* name = Tcl_GetString(objv[2]);
+        char* version = Tcl_GetString(objv[3]);
+        char* sha256 = Tcl_GetString(objv[4]);
+        Tcl_WideInt tclsize;
+        Tcl_GetWideIntFromObj(interp, objv[5], &tclsize);
+        sqlite_int64 size = (sqlite_int64)tclsize;
+        if (reg_entry_addgroup(entry, name, version, sha256, size, &error)) {
+            return TCL_OK;
+        }
+        return registry_failed(interp, &error);
+    }
+}
+
+static int entry_obj_get_portgroups(Tcl_Interp* interp, reg_entry* entry, int objc,
+        Tcl_Obj* CONST objv[]) {
+    reg_registry* reg = registry_for(interp, reg_attached);
+    if (objc != 2) {
+        Tcl_WrongNumArgs(interp, 1, objv, "groups_used");
+        return TCL_ERROR;
+    } else if (reg == NULL) {
+        return TCL_ERROR;
+    } else {
+        reg_portgroup** portgroups;
+        reg_error error;
+        int portgroup_count = reg_entry_getgroups(entry, &portgroups, &error);
+        if (portgroup_count >= 0) {
+            Tcl_Obj** objs;
+            int retval = TCL_ERROR;
+            if (list_portgroup_to_obj(interp, &objs, portgroups, portgroup_count, &error)){
+                Tcl_Obj* result = Tcl_NewListObj(portgroup_count, objs);
+                Tcl_SetObjResult(interp, result);
+                free(objs);
+                retval = TCL_OK;
+            } else {
+                retval = registry_failed(interp, &error);
+            }
+            free(portgroups);
+            return retval;
+        }
+        return registry_failed(interp, &error);
+    }
+}
+
 typedef struct {
     char* name;
     int (*function)(Tcl_Interp* interp, reg_entry* entry, int objc,
@@ -391,6 +444,9 @@
     { "dependents", entry_obj_dependents },
     { "dependencies", entry_obj_dependencies },
     { "depends", entry_obj_depends },
+    /* portgroups */
+    { "addgroup", entry_obj_add_portgroup },
+    { "groups_used", entry_obj_get_portgroups },
     { NULL, NULL }
 };
 

Copied: branches/new-help-system/base/src/registry2.0/portgroup.c (from rev 122997, trunk/base/src/registry2.0/portgroup.c)
===================================================================
--- branches/new-help-system/base/src/registry2.0/portgroup.c	                        (rev 0)
+++ branches/new-help-system/base/src/registry2.0/portgroup.c	2014-08-03 15:04:12 UTC (rev 122999)
@@ -0,0 +1,294 @@
+/*
+ * vim:tw=80:expandtab
+ * $Id$
+ *
+ * Copyright (c) 2014 The MacPorts Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <sqlite3.h>
+#include <stdlib.h>
+#include <string.h>
+#include <tcl.h>
+
+#include <cregistry/portgroup.h>
+#include <cregistry/util.h>
+
+#include "portgroup.h"
+#include "portgroupobj.h"
+#include "registry.h"
+#include "util.h"
+
+/**
+ * Converts a command name into a `reg_portgroup`.
+ *
+ * @param [in] interp  Tcl interpreter to check within
+ * @param [in] name    name of portgroup to get
+ * @param [out] errPtr description of error if the portgroup can't be found
+ * @return             a portgroup, or NULL if one couldn't be found
+ * @see get_object
+ */
+static reg_portgroup* get_portgroup(Tcl_Interp* interp, char* name, reg_error* errPtr) {
+    return (reg_portgroup*)get_object(interp, name, "portgroup", portgroup_obj_cmd, errPtr);
+}
+
+/**
+ * Removes the portgroup from the Tcl interpreter. Doesn't actually delete it since
+ * that's the registry's job. This is written to be used as the
+ * `Tcl_CmdDeleteProc` for an portgroup object command.
+ *
+ * @param [in] clientData address of a reg_portgroup to remove
+ */
+void delete_portgroup(ClientData clientData) {
+    reg_portgroup* portgroup = (reg_portgroup*)clientData;
+    free(portgroup->proc);
+    portgroup->proc = NULL;
+}
+
+/**
+ * registry::portgroup open id name version size sha256
+ *
+ * Opens a portgroup matching the given parameters.
+ */
+static int portgroup_open(Tcl_Interp* interp, int objc, Tcl_Obj* CONST objv[]) {
+	reg_registry* reg = registry_for(interp, reg_attached);
+	if (objc != 7) {
+		Tcl_WrongNumArgs(interp, 1, objv, "open id name version size sha256");
+		return TCL_ERROR;
+	} else if (reg == NULL) {
+		return TCL_ERROR;
+	} else {
+		char* id = Tcl_GetString(objv[2]);
+		char* name = Tcl_GetString(objv[3]);
+        char* version = Tcl_GetString(objv[4]);
+        char* size = Tcl_GetString(objv[5]);
+        char* sha256 = Tcl_GetString(objv[6]);
+
+		reg_error error;
+		reg_portgroup* portgroup = reg_portgroup_open(reg, id, name, version, size, sha256, &error);
+		if (portgroup != NULL) {
+			Tcl_Obj* result;
+			if (portgroup_to_obj(interp, &result, portgroup, NULL, &error)) {
+				Tcl_SetObjResult(interp, result);
+				return TCL_OK;
+			}
+		}
+		return registry_failed(interp, &error);
+	}
+	return TCL_ERROR;
+}
+
+/**
+ * registry::portgroup close portgroup
+ *
+ * Closes a portgroup. It will remain in the registry.
+ */
+static int portgroup_close(Tcl_Interp* interp, int objc, Tcl_Obj* CONST objv[]) {
+	if (objc != 3) {
+		Tcl_WrongNumArgs(interp, 1, objv, "close portgroup");
+		return TCL_ERROR;
+	} else {
+		reg_error error;
+		char* proc = Tcl_GetString(objv[2]);
+		reg_portgroup* portgroup = get_portgroup(interp, proc, &error);
+		if (portgroup == NULL) {
+			return registry_failed(interp, &error);
+		} else {
+			Tcl_DeleteCommand(interp, proc);
+			return TCL_OK;
+		}
+	}
+}
+
+typedef struct {
+    char* name;
+    reg_strategy strategy;
+} strategy_type;
+
+static strategy_type strategies[] = {
+    { "-exact",  reg_strategy_exact },
+    { "-glob",   reg_strategy_glob },
+    { "-regexp", reg_strategy_regexp },
+    { "-null",   reg_strategy_null },
+    { "--",      reg_strategy_exact },
+    { NULL, 0 }
+};
+
+/*
+ * registry::portgroup search ?key value ...?
+ *
+ * Searches the registry for portgroups for which each key's value is equal to the
+ * given value. To find all portgroups, call `portgroup search` with no key-value pairs.
+ * For each key, can be given an option of -exact, -glob, -regexp or -null to
+ * specify the matching strategy; defaults to exact.
+ */
+static int portgroup_search(Tcl_Interp* interp, int objc, Tcl_Obj* CONST objv[]) {
+    int i, j;
+    reg_registry* reg = registry_for(interp, reg_attached);
+    if (reg == NULL) {
+        return TCL_ERROR;
+    } else {
+        char** keys;
+        char** vals;
+        int* strats;
+        int key_count = 0;
+        reg_portgroup** portgroups;
+        reg_error error;
+        int portgroup_count;
+        for (i = 2; i < objc;) {
+            int index, strat_index, val_length;
+            if (Tcl_GetIndexFromObj(interp, objv[i], portgroup_props, "search key",
+                        0, &index) != TCL_OK) {
+                return TCL_ERROR;
+            }
+
+            /* we ate the key value */
+            i++;
+
+            /* check whether there's a strategy */
+            if (Tcl_GetString(objv[i])[0] == '-'
+                    && Tcl_GetIndexFromObjStruct(interp, objv[i], strategies,
+                        sizeof(strategy_type), "option", 0, &strat_index)
+                    != TCL_ERROR) {
+                /* this key has a strategy specified, eat the strategy parameter */
+                i++;
+
+                if (strategies[strat_index].strategy != reg_strategy_null) {
+                    /* this key must also have a value */
+
+                    if (Tcl_GetStringFromObj(objv[i], &val_length) == NULL
+                            || val_length == 0) {
+                        Tcl_WrongNumArgs(interp, 2, objv,
+                                "search ?key ?options? value ...?");
+                        return TCL_ERROR;
+                    }
+
+                    i++;
+                }
+            } else {
+                /* this key must also have a value */
+
+                if (Tcl_GetStringFromObj(objv[i], &val_length) == NULL
+                        || val_length == 0) {
+                    Tcl_WrongNumArgs(interp, 2, objv,
+                            "search ?key ?options? value ...?");
+                    return TCL_ERROR;
+                }
+
+                i++;
+            }
+
+            key_count++;
+        }
+
+        keys = malloc(key_count * sizeof(char*));
+        vals = malloc(key_count * sizeof(char*));
+        strats = malloc(key_count * sizeof(int));
+        if (!keys || !vals || !strats) {
+            return TCL_ERROR;
+        }
+        for (i = 2, j = 0; i < objc && j < key_count; j++) {
+            int strat_index;
+
+            keys[j] = Tcl_GetString(objv[i++]);
+
+            /* try to get the strategy */
+            if (Tcl_GetString(objv[i])[0] == '-'
+                    && Tcl_GetIndexFromObjStruct(interp, objv[i], strategies,
+                        sizeof(strategy_type), "option", 0, &strat_index)
+                    != TCL_ERROR) {
+                /* this key has a strategy specified */
+                i++;
+
+                strats[j] = strategies[strat_index].strategy;
+            } else {
+                /* use default strategy */
+                strats[j] = reg_strategy_exact;
+            }
+
+            if (strats[j] != reg_strategy_null) {
+                vals[j] = Tcl_GetString(objv[i++]);
+            } else {
+                vals[j] = NULL;
+            }
+        }
+        portgroup_count = reg_portgroup_search(reg, keys, vals, strats, key_count,
+                &portgroups, &error);
+        free(keys);
+        free(vals);
+        free(strats);
+        if (portgroup_count >= 0) {
+            int retval;
+            Tcl_Obj* resultObj;
+            Tcl_Obj** objs;
+            if (list_portgroup_to_obj(interp, &objs, portgroups, portgroup_count, &error)){
+                resultObj = Tcl_NewListObj(portgroup_count, objs);
+                Tcl_SetObjResult(interp, resultObj);
+                free(objs);
+                retval = TCL_OK;
+            } else {
+                retval = registry_failed(interp, &error);
+            }
+            free(portgroups);
+            return retval;
+        }
+        return registry_failed(interp, &error);
+    }
+}
+
+typedef struct {
+    char* name;
+    int (*function)(Tcl_Interp* interp, int objc, Tcl_Obj* CONST objv[]);
+} portgroup_cmd_type;
+
+static portgroup_cmd_type portgroup_cmds[] = {
+    /* Global commands */
+    { "open", portgroup_open },
+    { "close", portgroup_close },
+    { "search", portgroup_search },
+    { NULL, NULL }
+};
+
+/*
+ * registry::portgroup cmd ?arg ...?
+ *
+ * Commands manipulating portgroup entries in the registry. This can be called `registry::portgroup`
+ */
+int portgroup_cmd(ClientData clientData UNUSED, Tcl_Interp* interp, int objc,
+        Tcl_Obj* CONST objv[]) {
+    int cmd_index;
+    if (objc < 2) {
+        Tcl_WrongNumArgs(interp, 1, objv, "cmd ?arg ...?");
+        return TCL_ERROR;
+    }
+    if (Tcl_GetIndexFromObjStruct(interp, objv[1], portgroup_cmds,
+                sizeof(portgroup_cmd_type), "cmd", 0, &cmd_index) == TCL_OK) {
+        portgroup_cmd_type* cmd = &portgroup_cmds[cmd_index];
+        return cmd->function(interp, objc, objv);
+    }
+    return TCL_ERROR;
+}

Copied: branches/new-help-system/base/src/registry2.0/portgroup.h (from rev 122997, trunk/base/src/registry2.0/portgroup.h)
===================================================================
--- branches/new-help-system/base/src/registry2.0/portgroup.h	                        (rev 0)
+++ branches/new-help-system/base/src/registry2.0/portgroup.h	2014-08-03 15:04:12 UTC (rev 122999)
@@ -0,0 +1,42 @@
+/*
+ * vim:tw=80:expandtab
+ * $Id$
+ *
+ * Copyright (c) 2014 The MacPorts Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef _PORTGROUP_H
+#define _PORTGROUP_H
+
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <tcl.h>
+
+void delete_portgroup(ClientData clientData);
+
+int portgroup_cmd(ClientData clientData UNUSED, Tcl_Interp* interp, int objc,
+        Tcl_Obj* CONST objv[]);
+
+#endif /* _PORTGROUP_H */

Copied: branches/new-help-system/base/src/registry2.0/portgroupobj.c (from rev 122997, trunk/base/src/registry2.0/portgroupobj.c)
===================================================================
--- branches/new-help-system/base/src/registry2.0/portgroupobj.c	                        (rev 0)
+++ branches/new-help-system/base/src/registry2.0/portgroupobj.c	2014-08-03 15:04:12 UTC (rev 122999)
@@ -0,0 +1,135 @@
+/*
+ * vim:tw=80:expandtab
+ * $Id$
+ *
+ * Copyright (c) 2014 The MacPorts Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <string.h>
+#include <stdlib.h>
+#include <tcl.h>
+#include <sqlite3.h>
+
+#include "portgroupobj.h"
+#include "registry.h"
+#include "util.h"
+
+const char* portgroup_props[] = {
+    "name",
+    "version",
+    "size",
+    "sha256",
+    NULL
+};
+
+/* ${portgroup} prop ?value? */
+static int portgroup_obj_prop(Tcl_Interp* interp, reg_portgroup* portgroup, int objc,
+        Tcl_Obj* CONST objv[]) {
+    int index;
+    if (objc > 3) {
+        Tcl_WrongNumArgs(interp, 2, objv, "?value?");
+        return TCL_ERROR;
+    }
+    if (objc == 2) {
+        /* ${portgroup} prop; return the current value */
+        reg_registry* reg = registry_for(interp, reg_attached);
+        if (reg == NULL) {
+            return TCL_ERROR;
+        }
+        if (Tcl_GetIndexFromObj(interp, objv[1], portgroup_props, "prop", 0, &index)
+                == TCL_OK) {
+            char* key = Tcl_GetString(objv[1]);
+            char* value;
+            reg_error error;
+            if (reg_portgroup_propget(portgroup, key, &value, &error)) {
+                Tcl_Obj* result = Tcl_NewStringObj(value, -1);
+                Tcl_SetObjResult(interp, result);
+                free(value);
+                return TCL_OK;
+            }
+            return registry_failed(interp, &error);
+        }
+        return TCL_ERROR;
+    } else {
+        /* ${portgroup} prop name value; set a new value */
+        reg_registry* reg = registry_for(interp, reg_attached);
+        if (reg == NULL) {
+            return TCL_ERROR;
+        }
+        if (Tcl_GetIndexFromObj(interp, objv[1], portgroup_props, "prop", 0, &index)
+                == TCL_OK) {
+            char* key = Tcl_GetString(objv[1]);
+            char* value = Tcl_GetString(objv[2]);
+            reg_error error;
+            if (reg_portgroup_propset(portgroup, key, value, &error)) {
+                return TCL_OK;
+            }
+            return registry_failed(interp, &error);
+        }
+        return TCL_ERROR;
+    }
+}
+
+typedef struct {
+    char* name;
+    int (*function)(Tcl_Interp* interp, reg_portgroup* portgroup, int objc,
+            Tcl_Obj* CONST objv[]);
+} portgroup_obj_cmd_type;
+
+static portgroup_obj_cmd_type portgroup_cmds[] = {
+    /* keys */
+    { "name", portgroup_obj_prop },
+    { "version", portgroup_obj_prop },
+    { "size", portgroup_obj_prop },
+    { "sha256", portgroup_obj_prop },
+    { NULL, NULL }
+};
+
+/* ${portgroup} cmd ?arg ...? */
+/* This function implements the command that will be called when a portgroup
+ * created by `registry::portgroup` is used as a procedure. Since all data is kept
+ * in a temporary sqlite3 database that is created for the current interpreter,
+ * none of the sqlite3 functions used have any error checking. That should be a
+ * safe assumption, since nothing outside of registry:: should ever have the
+ * chance to touch it.
+ */
+int portgroup_obj_cmd(ClientData clientData, Tcl_Interp* interp, int objc,
+        Tcl_Obj* CONST objv[]) {
+    int cmd_index;
+    if (objc < 2) {
+        Tcl_WrongNumArgs(interp, 1, objv, "cmd ?arg ...?");
+        return TCL_ERROR;
+    }
+    if (Tcl_GetIndexFromObjStruct(interp, objv[1], portgroup_cmds,
+                sizeof(portgroup_obj_cmd_type), "cmd", 0, &cmd_index) == TCL_OK) {
+        portgroup_obj_cmd_type* cmd = &portgroup_cmds[cmd_index];
+        return cmd->function(interp, (reg_portgroup*)clientData, objc, objv);
+    }
+    return TCL_ERROR;
+}
+

Copied: branches/new-help-system/base/src/registry2.0/portgroupobj.h (from rev 122997, trunk/base/src/registry2.0/portgroupobj.h)
===================================================================
--- branches/new-help-system/base/src/registry2.0/portgroupobj.h	                        (rev 0)
+++ branches/new-help-system/base/src/registry2.0/portgroupobj.h	2014-08-03 15:04:12 UTC (rev 122999)
@@ -0,0 +1,43 @@
+/*
+ * vim:tw=80:expandtab
+ * $Id$
+ *
+ * Copyright (c) 2014 The MacPorts Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef _PORTGROUP_OBJ_CMD_H
+#define _PORTGROUP_OBJ_CMD_H
+
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <tcl.h>
+#include <sqlite3.h>
+
+extern const char* portgroup_props[];
+
+int portgroup_obj_cmd(ClientData clientData, Tcl_Interp* interp, int objc,
+        Tcl_Obj* CONST objv[]);
+
+#endif /* _PORTGROUP_OBJ_CMD_H */

Modified: branches/new-help-system/base/src/registry2.0/portimage.tcl
===================================================================
--- branches/new-help-system/base/src/registry2.0/portimage.tcl	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/registry2.0/portimage.tcl	2014-08-03 15:04:12 UTC (rev 122999)
@@ -40,6 +40,8 @@
 package require macports 1.0
 package require Pextlib 1.0
 
+package require Tclx
+
 set UI_PREFIX "--> "
 
 # Port Images are installations of the destroot of a port into a compressed
@@ -132,7 +134,6 @@
     ui_msg "$UI_PREFIX [format [msgcat::mc "Activating %s @%s"] $name $specifier]"
 
     _activate_contents $requested
-    $requested state installed
 }
 
 # takes a composite version spec rather than separate version,revision,variants
@@ -199,7 +200,6 @@
     }
 
     _deactivate_contents $requested [$requested files] $force
-    $requested state imaged
 }
 
 proc _check_registry {name version revision variants} {
@@ -217,7 +217,7 @@
             append composite_spec _${revision}${variants}
         }
     }
-    set ilist [eval registry::entry imaged $searchkeys]
+    set ilist [registry::entry imaged {*}$searchkeys]
 
     if { [llength $ilist] > 1 } {
         ui_msg "$UI_PREFIX [msgcat::mc "The following versions of $name are currently installed:"]"
@@ -268,10 +268,10 @@
                 ::file mkdir $dstfile
                 # fix attributes on the directory.
                 if {[getuid] == 0} {
-                    eval ::file attributes {$dstfile} [::file attributes $srcfile]
+                    ::file attributes $dstfile {*}[::file attributes $srcfile]
                 } else {
                     # not root, so can't set owner/group
-                    eval ::file attributes {$dstfile} -permissions [::file attributes $srcfile -permissions]
+                    ::file attributes $dstfile -permissions {*}[::file attributes $srcfile -permissions]
                 }
                 # set mtime on installed element
                 ::file mtime $dstfile [::file mtime $srcfile]
@@ -344,7 +344,13 @@
                     if {[regexp {z2?$} ${unarchive.type}]} {
                         set unarchive.args {-}
                         if {[regexp {bz2?$} ${unarchive.type}]} {
-                            set gzip "bzip2"
+                            if {![catch {macports::binaryInPath lbzip2}]} {
+                                set gzip "lbzip2"
+                            } elseif {![catch {macports::binaryInPath pbzip2}]} {
+                                set gzip "pbzip2"
+                            } else {
+                                set gzip "bzip2"
+                            }
                         } elseif {[regexp {lz$} ${unarchive.type}]} {
                             set gzip "lzma"
                         } elseif {[regexp {xz$} ${unarchive.type}]} {
@@ -539,6 +545,24 @@
                         lappend rollback_filelist $file
                     }
                 }
+
+                # Recording that the port has been activated should be done
+                # here so that this information cannot be inconsistent with the
+                # state of the files on disk.
+                $port state installed
+            } catch {{POSIX SIG SIGINT} eCode eMessage} {
+                # Pressing ^C will (often?) print "^C" to the terminal; send
+                # a linebreak so our message appears after that.
+                ui_msg ""
+                ui_msg "Control-C pressed, rolling back, please wait."
+                # can't do it here since we're already inside a transaction
+                set deactivate_this yes
+                throw
+            } catch {{POSIX SIG SIGTERM} eCode eMessage} {
+                ui_msg "SIGTERM received, rolling back, please wait."
+                # can't do it here since we're already inside a transaction
+                set deactivate_this yes
+                throw
             } catch {*} {
                 ui_debug "Activation failed, rolling back."
                 # can't do it here since we're already inside a transaction
@@ -547,22 +571,41 @@
             }
         }
     } catch {*} {
-        # roll back activation of this port
-        if {[info exists deactivate_this]} {
-            _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
-        # of this in the registry.
-        foreach file $backups {
-            ::file rename -force -- "${file}${baksuffix}" $file
-        }
-        # reactivate deactivated ports
-        foreach entry [array names todeactivate] {
-            if {[$entry state] eq "imaged" && ($noexec || ![registry::run_target $entry activate ""])} {
-                activate [$entry name] [$entry version] [$entry revision] [$entry variants] [list ports_activate_no-exec $noexec]
+        # This code must run to completion, or the installation might be left
+        # in an inconsistent state. We store the old signal handling state,
+        # block the critical signals and restore to the previous state instead
+        # of unblocking.
+        # Note that this still contains a race condition: A user could press ^C
+        # fast enough so that the second error arrives before the error is
+        # caught, re-thrown and re-caught here. As far as I can see, there's no
+        # easy way around this problem.
+        set osignals [signal get {TERM INT}]
+        try {
+            # Block signals to avoid inconsistiencies.
+            signal block {TERM INT}
+
+            # roll back activation of this port
+            if {[info exists deactivate_this]} {
+                _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
+            # of this in the registry.
+            foreach file $backups {
+                ::file rename -force -- "${file}${baksuffix}" $file
+            }
+            # reactivate deactivated ports
+            foreach entry [array names todeactivate] {
+                if {[$entry state] eq "imaged" && ($noexec || ![registry::run_target $entry activate ""])} {
+                    activate [$entry name] [$entry version] [$entry revision] [$entry variants] [list ports_activate_no-exec $noexec]
+                }
+            }
+        } finally {
+            # We've completed all critical operations, re-enable the TERM and
+            # INT signals.
+            signal set $osignals
         }
+
         # remove temp image dir
         ::file delete -force $extracted_dir
         throw
@@ -636,18 +679,38 @@
     # are after their elements.
     set files [lsort -decreasing -unique $files]
 
-    # Remove all elements.
-    if {!$rollback} {
-        registry::write {
-            $port deactivate $imagefiles
+    # Avoid interruptions while removing the files and updating the database to
+    # prevent inconsistencies from forming between filesystem and database.
+    set osignals [signal get {TERM INT}]
+
+    try {
+        # Block the TERM and INT signals to avoid being interrupted. Note that
+        # they might already be block at this point because
+        # _deactivate_contents might be called during rollback of
+        # _activate_contents, but because we're storing the old signal state
+        # and returning to that instead of unblocking it doesn't matter.
+        signal block {TERM INT}
+
+        # Remove all elements.
+        if {!$rollback} {
+            registry::write {
+                $port deactivate $imagefiles
+                foreach file $files {
+                    _deactivate_file $file
+                }
+
+                # Update the port's state in the same transaction as the file
+                # delete operations.
+                $port state imaged
+            }
+        } else {
             foreach file $files {
                 _deactivate_file $file
             }
         }
-    } else {
-        foreach file $files {
-            _deactivate_file $file
-        }
+    } finally {
+        # restore the signal block state
+        signal set $osignals
     }
 }
 

Modified: branches/new-help-system/base/src/registry2.0/portuninstall.tcl
===================================================================
--- branches/new-help-system/base/src/registry2.0/portuninstall.tcl	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/registry2.0/portuninstall.tcl	2014-08-03 15:04:12 UTC (rev 122999)
@@ -53,7 +53,7 @@
 
 proc uninstall {portname {version ""} {revision ""} {variants 0} {optionslist ""}} {
     global uninstall.force uninstall.nochecksum UI_PREFIX \
-           macports::portimagefilepath
+           macports::portimagefilepath macports::registry.path
     array set options $optionslist
     if {[info exists options(subport)]} {
         # don't want this set when calling registry::run_target
@@ -85,7 +85,7 @@
             append composite_spec _${revision}${variants}
         }
     }
-    set ilist [eval registry::entry imaged $searchkeys]
+    set ilist [registry::entry imaged {*}$searchkeys]
     if { [llength $ilist] > 1 } {
         # set portname again since the one we were passed may not have had the correct case
         set portname [[lindex $ilist 0] name]
@@ -156,7 +156,7 @@
         # look up deps from the saved portfile if possible
         if {![catch {set mport [mportopen_installed [$port name] [$port version] [$port revision] [$port variants] $optionslist]}]} {
             array set depportinfo [mportinfo $mport]
-            mportclose_installed $mport
+            mportclose $mport
             foreach type $deptypes {
                 if {[info exists depportinfo($type)]} {
                     foreach dep $depportinfo($type) {
@@ -217,9 +217,37 @@
         # files so just ignore the failure
         catch {file delete [::file dirname $imagefile]}
 
+        # We want to delete the portfile if not referenced by any other ports
+        set portfile [$ref portfile]
+
+        # and likewise the portgroups
+        set portgroups [list]
+        foreach pg [$ref groups_used] {
+            lappend portgroups [list [$pg name] [$pg version] [$pg size] [$pg sha256]]
+        }
+
         registry::write {
             registry::entry delete $port
         }
+
+        set portfile_path [file join ${registry.path} registry portfiles ${portname}-${version}_${revision} $portfile]
+        if {[registry::entry search portfile $portfile] eq {}} {
+            file delete -force $portfile_path
+            catch {file delete [file dirname $portfile_path]}
+        }
+
+        set reg_portgroups_dir [file join ${registry.path} registry portgroups]
+        foreach pg $portgroups {
+            set pgname [lindex $pg 0]
+            set pgversion [lindex $pg 1]
+            set pgsize [lindex $pg 2]
+            set pgsha256 [lindex $pg 3]
+            if {[registry::portgroup search name $pgname version $pgversion size $pgsize sha256 $pgsha256] eq {}} {
+                set pg_reg_dir [file join $reg_portgroups_dir ${pgsha256}-${pgsize}]
+                file delete -force ${pg_reg_dir}/${pgname}-${pgversion}.tcl
+                catch {file delete $pg_reg_dir}
+            }
+        }
     }
     
     # uninstall dependencies if requested

Modified: branches/new-help-system/base/src/registry2.0/receipt_sqlite.tcl
===================================================================
--- branches/new-help-system/base/src/registry2.0/receipt_sqlite.tcl	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/registry2.0/receipt_sqlite.tcl	2014-08-03 15:04:12 UTC (rev 122999)
@@ -41,8 +41,16 @@
 # registry2.0 wrapper code that matches old receipt_flat interface
 ##
 namespace eval receipt_sqlite {
-
-# return list of active ports, or active version of port 'name' if specified
+##
+# Return a list of active ports, or the active version of port \a name, if
+# specified.
+#
+# @param name
+#        Empty string to return a list of all ports or the name of a port to
+#        return only the active version of a single port.
+# @return A list of matching ports where each entry is a list of (name,
+#         version, revision, variants, 1 or 0 indicating whether a port's state
+#         is "installed", epoch).
 proc active {name} {
     if {$name ne ""} {
         set ports [registry::entry installed $name]
@@ -57,59 +65,94 @@
 }
 
 ##
-# Open an existing entry and return a reference.
+# Open an existing entry in the registry uniquely identified by name, version,
+# revision, variants and epoch and return a reference.
+#
+# @param name
+#        The name of the port to be opened.
+# @param version
+#        The version of the port to be opened.
+# @param revision
+#        The revision of the port to be opened.
+# @param variants
+#        The canonical variant string of the port to be opened.
+# @param epoch
+#        The epoch of the port to be opened.
+# @return A reference to the requested port on success. Raises an error on
+#         failure (e.g. if the port isn't found or allocating the reference
+#         fails).
 proc open_entry {name version revision variants epoch} {
     return [registry::entry open $name $version $revision $variants $epoch]
 }
 
-# Check to see if an entry exists
+##
+# Check whether a registry entry exists.
+#
+# @param name
+#        The name to be searched in the registry.
+# @param version
+#        The version to be searched in the registry.
+# @param revision
+#        The revision to be searched in the registry. Defaults to 0.
+# @param variants
+#        The canonical variant string to be searched in the registry. Defaults
+#        to an empty string.
+# @return 1, if the port exists, 0 otherwise.
 proc entry_exists {name version {revision 0} {variants ""}} {
     if {![catch {set ports [registry::entry search name $name version $version revision $revision variants $variants]}] && [llength $ports] > 0} {
         return 1
     }
-	return 0
+    return 0
 }
 
-# Check to see if an entry exists
+##
+# Check whether a registry entry with the given name exists.
+#
+# @param name
+#        The name to be searched in the registry.
+# @return 1 if a port with the given name exists in the registry, 0 otherwise.
 proc entry_exists_for_name {name} {
-	if {![catch {set ports [registry::entry search name $name]}] && [llength $ports] > 0} {
-	    return 1
-	}
-	return 0
+    if {![catch {set ports [registry::entry search name $name]}] && [llength $ports] > 0} {
+        return 1
+    }
+    return 0
 }
 
 ##
-# determine if a file is registered in the file map, and if it is,
-# get its port.
+# Determine if a file is registered in the file map, and if it is, get the name
+# of the port it is registered to.
 #
-# - file	the file to test
-# returns 0 if the file is not registered, the name of the port otherwise.
-#
+# @param file
+#        The full path to the file to be tested.
+# @return 0 if the file is not registered to any port. The name of the port
+#         otherwise.
 proc file_registered {file} {
     set port [registry::entry owner $file]
-	if {$port ne ""} {
-		return [$port name]
-	} else {
-		return 0
-	}
+    if {$port ne ""} {
+        return [$port name]
+    } else {
+        return 0
+    }
 }
 
 ##
-# determine if a port is registered in the file map, and if it is,
-# get its installed (activated) files.
+# Determine if a port is registered in the file map, and if it is, get its
+# installed (activated) files.
 #
-# - port	the port to test
-# returns 0 if the port is not registered, the list of its files otherwise.
+# @param name
+#        The name of the port to be tested.
+# @return 0 if no port with the given name is active. An empty string, if no
+#         port with the given name is active, but a port with the given name is
+#         imaged (i.e. installed, but inactive). A list of files if the given
+#         port is installed and active.
 proc port_registered {name} {
-	if {![catch {set ports [registry::entry installed $name]}]
-	    && [llength $ports] > 0} {
-	    # should never return more than one port
-	    set port [lindex $ports 0]
-		return [$port files]
-	} elseif {![catch {set ports [registry::entry imaged $name]}]
-	    && [llength $ports] > 0} {
-	    return ""
-	} else {
+    if {![catch {set ports [registry::entry installed $name]}] && [llength $ports] > 0} {
+        # should never return more than one port
+        set port [lindex $ports 0]
+        return [$port files]
+    } elseif {![catch {set ports [registry::entry imaged $name]}] && [llength $ports] > 0} {
+        return ""
+    } else {
         return 0
     }
 }
@@ -117,8 +160,13 @@
 ##
 # Retrieve a property from a registry entry.
 #
-# ref			reference to the entry.
-# property		key for the property to retrieve.
+# @param ref
+#        Reference to the registry entry.
+# @param property
+#        Name of the property to retrieve.
+# @return Return value depends on the property queried. Returns 0 if an error
+#         occured while trying to access the property (but note that 0 may be
+#         a perfectly valid value for the key you're querying).
 proc property_retrieve {ref property} {
     switch $property {
         active {
@@ -137,9 +185,12 @@
 ##
 # Store a property in a registry entry.
 #
-# ref			reference to the entry.
-# property		key for the property to set.
-# value         value to set it to.
+# @param ref
+#        Reference to the registry entry.
+# @param property
+#        Name of the property to set.
+# @param value
+#        New value for the given key in the reference.
 proc property_store {ref property value} {
     switch $property {
         active {
@@ -155,56 +206,85 @@
     }
 }
 
-# Return installed ports
+##
+# Return all installed ports (active and inactive). Optionally filter by name
+# and version.
 #
-# If version is "", return all ports of that name.
-# Otherwise, return only ports that exactly match this version.
-# What we call version here is version_revision+variants.
-# The syntax for that can be ambiguous if there's an underscore and dash in
-# version for example, so we don't attempt to split up the composite version
-# into its components, we just compare the whole thing.
+# @param name
+#        The name of the port you're looking for. Defaults to an empty string,
+#        which will return all installed ports.
+# @param version
+#        A version string in either of the forms "$version_$revision$variants"
+#        or "$version". Defaults to an empty string, which will return ports
+#        regardless of version constraints.
+# @return A list of ports in the form given by #active.
 proc installed {{name ""} {version ""}} {
-	if { $name eq "" && $version eq "" } {
-	    set ports [registry::entry imaged]
-	} elseif { $name ne "" && $version eq ""} {
-	    set ports [registry::entry imaged $name]
-	} else {
-	    set ports {}
-	    set possible_ports [registry::entry imaged $name]
-	    foreach p $possible_ports {
-	        if {"[$p version]_[$p revision][$p variants]" == $version
-	            || [$p version] == $version} {
-	            lappend ports $p
-	        }
-	    }
-	}
+    # If version is "", return all ports of that name. Otherwise, return only
+    # ports that exactly match this version. What we call version here is
+    # version_revision+variants.
+    # The syntax for that can be ambiguous if there's an underscore and dash in
+    # version for example, so we don't attempt to split up the composite
+    # version into its components, we just compare the whole thing.
+    if {$name eq "" && $version eq ""} {
+        set ports [registry::entry imaged]
+    } elseif {$name ne "" && $version eq ""} {
+        set ports [registry::entry imaged $name]
+    } else {
+        set ports {}
+        set possible_ports [registry::entry imaged $name]
+        foreach p $possible_ports {
+            if {"[$p version]_[$p revision][$p variants]" == $version || [$p version] == $version} {
+                lappend ports $p
+            }
+        }
+    }
 
     set rlist [list]
     foreach port $ports {
         lappend rlist [list [$port name] [$port version] [$port revision] [$port variants] [string equal [$port state] "installed"] [$port epoch]]
     }
-	return $rlist
+    return $rlist
 }
 
+##
+# Does nothing.
 proc close_file_map {args} {
 }
 
+##
+# Does nothing.
 proc open_dep_map {args} {
 }
 
-# List all the ports that this port depends on
+##
+# List all ports that a given port (identified by the parameters) depends on.
+# Each of the parameters can be passed as an empty string to ignore them in the
+# search. You should however at least specify name.
+#
+# @param name
+#        The name of the port of interest.
+# @param version
+#        The version of the port of interest.
+# @param revision
+#        The revision of the port of interest.
+# @param variants
+#        The canonical variants string of the port of interest.
+# @return A sorted list without duplicates where each entry is of the form
+#         (dependency, "port", port), where dependency is the name of the
+#         dependency and port is the name of the port that matched the search
+#         criteria.
 proc list_depends {name version revision variants} {
-	set rlist [list]
-	set searchcmd "registry::entry search"
+    set rlist [list]
+    set searchkeys {}
     foreach key {name version revision} {
         if {[set $key] ne ""} {
-            append searchcmd " $key [set $key]"
+            lappend searchkeys $key [set $key]
         }
     }
     if {$variants != 0} {
-        append searchcmd " variants {$variants}"
+        lappend searchkeys "variants" $variants
     }
-    if {[catch {set ports [eval $searchcmd]}]} {
+    if {[catch {set ports [registry::entry search {*}$searchkeys]}]} {
         set ports [list]
     }
     foreach port $ports {
@@ -212,23 +292,41 @@
             lappend rlist [list [$dep name] port [$port name]]
         }
     }
-	
-	return [lsort -unique $rlist]
+
+    return [lsort -unique $rlist]
 }
 
 # List all the ports that depend on this port
+##
+# List all ports that depend on a given port (identified by the parameters).
+# Each of the parameters can be passed as an empty string to ignore them in the
+# search. In practice, you'll always pass at least the name parameter
+# non-empty.
+#
+# @param name
+#        The name of the port of interest.
+# @param version
+#        The version of the port of interest.
+# @param revision
+#        The revision of the port of interest.
+# @param variants
+#        The canonical variants string of the port of interest.
+# @return A sorted list without duplicates where each entry is of the form
+#         (port, "port", dependent), where dependent is the name of the
+#         dependent port and port is the name of the port that matched the
+#         search criteria.
 proc list_dependents {name version revision variants} {
-	set rlist [list]
-	set searchcmd "registry::entry search"
+    set rlist [list]
+    set searchkeys {}
     foreach key {name version revision} {
         if {[set $key] ne ""} {
-            append searchcmd " $key [set $key]"
+            lappend searchkeys $key [set $key]
         }
     }
     if {$variants != 0} {
-        append searchcmd " variants {$variants}"
+        lappend searchkeys "variants" $variants
     }
-    if {[catch {set ports [eval $searchcmd]}]} {
+    if {[catch {set ports [registry::entry search {*}$searchkeys]}]} {
         set ports [list]
     }
     foreach port $ports {
@@ -237,11 +335,36 @@
             lappend rlist [list [$port name] port [$dependent name]]
         }
     }
-	
-	return [lsort -unique $rlist]
+
+    return [lsort -unique $rlist]
 }
 
-# adds a registry entry from a list of keys and values
+##
+# Add a new registry entry from a given list of keys of values. The list should
+# at least contain the keys
+#  \li \c name The name of the port
+#  \li \c epoch The epoch of the port
+#  \li \c version The version of the port
+#  \li \c revision The revision of the port
+#  \li \c variants The canonical variants string of the port
+#  \li \c date The date of installation of this port, probably the current date
+#      and time
+#  \li \c requested 0 or 1 depending on whether this port is a requested port
+#  \li \c location The absolute path to the binary archive of the port
+#  \li \c state The current state of the port, currently either "imaged" or
+#      "installed"
+#  \li \c installtype The type of installation of this port. For new ports,
+#      always "image"
+#  \li \c imagefiles A list of files installed by this port
+#  \li \c files A list of filenames as which the imagefiles should be activated
+#      if state is "installed"
+#  \li \c negated_variants The canonical representation of the negated variants
+#  \li \c os_platform The platform on which the port was installed
+#  \li \c os_major The major version of the OS on which the port was installed
+#  \li \c archs A list of architectures of this port
+#  \li \c depends A list of ports on which the new port depends
+#  \li \c portfile The Portfile used to install this port (note: actual
+#      contents, not the path!)
 proc create_entry_l {proplist} {
     array set props $proplist
     registry::write {


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/gsoc11-rev-upgrade/base/src/registry2.0/receipt_sqlite.tcl:78828-88375
/branches/gsoc13-tests/src/registry2.0/receipt_sqlite.tcl:106692-111324
/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-117083
/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/gsoc11-rev-upgrade/base/src/registry2.0/receipt_sqlite.tcl:78828-88375
/branches/gsoc13-tests/src/registry2.0/receipt_sqlite.tcl:106692-111324
/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-122997
/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.c
===================================================================
--- branches/new-help-system/base/src/registry2.0/registry.c	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/registry2.0/registry.c	2014-08-03 15:04:12 UTC (rev 122999)
@@ -3,7 +3,7 @@
  * $Id$
  *
  * Copyright (c) 2007 Chris Pickel <sfiera at macports.org>
- * Copyright (c) 2012 The MacPorts Project
+ * Copyright (c) 2012, 2014 The MacPorts Project
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -38,6 +38,7 @@
 #include <tcl.h>
 
 #include <cregistry/registry.h>
+#include <cregistry/portgroup.h>
 #include <cregistry/entry.h>
 #include <cregistry/file.h>
 
@@ -46,6 +47,7 @@
 #include "file.h"
 #include "graph.h"
 #include "item.h"
+#include "portgroup.h"
 #include "registry.h"
 #include "util.h"
 
@@ -320,6 +322,57 @@
     }
 }
 
+/*
+ * registry::metadata cmd ?arg ...?
+ *
+ * Commands manipulating metadata in the registry. This can be called `registry::metadata`
+ */
+int metadata_cmd(ClientData clientData UNUSED, Tcl_Interp* interp, int objc,
+        Tcl_Obj* CONST objv[]) {
+    if (objc < 3) {
+        Tcl_WrongNumArgs(interp, 1, objv, "cmd key ?value?");
+        return TCL_ERROR;
+    }
+    reg_registry* reg = registry_for(interp, reg_attached);
+    if (reg == NULL) {
+        return TCL_ERROR;
+    }
+    const char *cmdstring = Tcl_GetString(objv[1]);
+    reg_error error;
+    if (strcmp(cmdstring, "get") == 0) {
+        char *data;
+        if (reg_get_metadata(reg, Tcl_GetString(objv[2]), &data, &error)) {
+            Tcl_Obj* result = Tcl_NewStringObj(data, -1);
+            Tcl_SetObjResult(interp, result);
+            free(data);
+            return TCL_OK;
+        } else if (error.code == REG_NOT_FOUND) {
+            Tcl_Obj* result = Tcl_NewIntObj(-1);
+            Tcl_SetObjResult(interp, result);
+            return TCL_OK;
+        } else {
+            return registry_failed(interp, &error);
+        }
+    } else if (strcmp(cmdstring, "set") == 0) {
+        if (objc < 4) {
+            Tcl_WrongNumArgs(interp, 1, objv, "set key value");
+            return TCL_ERROR;
+        }
+        if (reg_set_metadata(reg, Tcl_GetString(objv[2]), Tcl_GetString(objv[3]), &error)) {
+            return TCL_OK;
+        } else {
+            return registry_failed(interp, &error);
+        }
+    } else if (strcmp(cmdstring, "del") == 0) {
+        if (reg_del_metadata(reg, Tcl_GetString(objv[2]), &error)) {
+            return TCL_OK;
+        } else {
+            return registry_failed(interp, &error);
+        }
+    }
+    return TCL_ERROR;
+}
+
 /**
  * Initializer for the registry lib.
  *
@@ -338,6 +391,8 @@
     /* Tcl_CreateObjCommand(interp, "registry::item", item_cmd, NULL, NULL); */
     Tcl_CreateObjCommand(interp, "registry::entry", entry_cmd, NULL, NULL);
     Tcl_CreateObjCommand(interp, "registry::file", file_cmd, NULL, NULL);
+    Tcl_CreateObjCommand(interp, "registry::portgroup", portgroup_cmd, NULL, NULL);
+    Tcl_CreateObjCommand(interp, "registry::metadata", metadata_cmd, NULL, NULL);
     if (Tcl_PkgProvide(interp, "registry2", "2.0") != TCL_OK) {
         return TCL_ERROR;
     }

Modified: branches/new-help-system/base/src/registry2.0/registry.h
===================================================================
--- branches/new-help-system/base/src/registry2.0/registry.h	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/registry2.0/registry.h	2014-08-03 15:04:12 UTC (rev 122999)
@@ -34,6 +34,7 @@
 
 #include <tcl.h>
 #include <sqlite3.h>
+#include <cregistry/portgroup.h>
 #include <cregistry/entry.h>
 
 typedef struct _entry_list {

Modified: branches/new-help-system/base/src/registry2.0/registry_util.tcl
===================================================================
--- branches/new-help-system/base/src/registry2.0/registry_util.tcl	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/registry2.0/registry_util.tcl	2014-08-03 15:04:12 UTC (rev 122999)
@@ -103,7 +103,7 @@
         if {[catch {set result [mportexec $mport $target]} result] || $result != 0} {
             global errorInfo
             ui_debug "$errorInfo"
-            catch {mportclose_installed $mport}
+            catch {mportclose $mport}
             ui_warn "Failed to execute portfile from registry for $portspec"
             switch $target {
                 activate {
@@ -127,7 +127,7 @@
             if {(![info exists keeplogs] || !$keeplogs) && $target ne "activate"} {
                 catch {mportexec $mport clean}
             }
-            mportclose_installed $mport
+            mportclose $mport
             return 1
         }
     } else {

Modified: branches/new-help-system/base/src/registry2.0/tests/depends.tcl
===================================================================
--- branches/new-help-system/base/src/registry2.0/tests/depends.tcl	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/registry2.0/tests/depends.tcl	2014-08-03 15:04:12 UTC (rev 122999)
@@ -6,7 +6,7 @@
     load $pextlibname
 
     # totally lame that file delete won't do it
-	eval exec rm -f [glob -nocomplain test.db*]
+	exec rm -f {*}[glob -nocomplain test.db*]
 
     registry::open test.db
 

Modified: branches/new-help-system/base/src/registry2.0/tests/entry.tcl
===================================================================
--- branches/new-help-system/base/src/registry2.0/tests/entry.tcl	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/registry2.0/tests/entry.tcl	2014-08-03 15:04:12 UTC (rev 122999)
@@ -7,7 +7,7 @@
     load $pextlibname
 
     # totally lame that file delete won't do it
-    eval exec rm -f [glob -nocomplain test.db*]
+    exec rm -f {*}[glob -nocomplain test.db*]
 
     # can't create registry in some brain-dead place or in protected place
     test_throws {registry::open /some/brain/dead/place} registry::cannot-init

Modified: branches/new-help-system/base/src/registry2.0/util.c
===================================================================
--- branches/new-help-system/base/src/registry2.0/util.c	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/registry2.0/util.c	2014-08-03 15:04:12 UTC (rev 122999)
@@ -38,6 +38,7 @@
 #include "util.h"
 #include "entryobj.h"
 #include "fileobj.h"
+#include "portgroupobj.h"
 
 /**
  * Generates a unique proc name starting with prefix.
@@ -214,6 +215,29 @@
 }
 
 /**
+ * Sets a given name to be a portgroup object.
+ *
+ * @param [in] interp  Tcl interpreter to create the portgroup within
+ * @param [in] name    name to associate the given portgroup with
+ * @param [in] portgroup    portgroup to associate with the given name
+ * @param [out] errPtr description of error if it couldn't be set
+ * @return             true if success; false if failure
+ * @see set_object
+ */
+int set_portgroup(Tcl_Interp* interp, char* name, reg_portgroup* portgroup,
+        reg_error* errPtr) {
+    if (set_object(interp, name, portgroup, "portgroup", portgroup_obj_cmd, NULL,
+                errPtr)) {
+        portgroup->proc = strdup(name);
+        if (!portgroup->proc) {
+            return 0;
+        }
+        return 1;
+    }
+    return 0;
+}
+
+/**
  * Reports a sqlite3 error to Tcl.
  *
  * Queries the database for the most recent error message and sets it as the
@@ -297,6 +321,23 @@
     return 1;
 }
 
+int portgroup_to_obj(Tcl_Interp* interp, Tcl_Obj** obj, reg_portgroup* portgroup,
+        int* lower_bound, reg_error* errPtr) {
+    if (portgroup->proc == NULL) {
+        char* name = unique_name(interp, "::registry::portgroup", lower_bound);
+        if (!name) {
+            return 0;
+        }
+        if (!set_portgroup(interp, name, portgroup, errPtr)) {
+            free(name);
+            return 0;
+        }
+        free(name);
+    }
+    *obj = Tcl_NewStringObj(portgroup->proc, -1);
+    return 1;
+}
+
 int list_entry_to_obj(Tcl_Interp* interp, Tcl_Obj*** objs,
         reg_entry** entries, int entry_count, reg_error* errPtr) {
     int lower_bound = 0;
@@ -311,6 +352,13 @@
             (void***)objs, (void**)files, file_count, errPtr);
 }
 
+int list_portgroup_to_obj(Tcl_Interp* interp, Tcl_Obj*** objs,
+        reg_portgroup** portgroups, int portgroup_count, reg_error* errPtr) {
+    int lower_bound = 0;
+    return recast(interp, (cast_function*)portgroup_to_obj, &lower_bound, NULL,
+            (void***)objs, (void**)portgroups, portgroup_count, errPtr);
+}
+
 static int obj_to_string(void* userdata UNUSED, char** string, Tcl_Obj* obj,
         void* param UNUSED, reg_error* errPtr UNUSED) {
     *string = Tcl_GetString(obj);

Modified: branches/new-help-system/base/src/registry2.0/util.h
===================================================================
--- branches/new-help-system/base/src/registry2.0/util.h	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/registry2.0/util.h	2014-08-03 15:04:12 UTC (rev 122999)
@@ -37,6 +37,7 @@
 #include <sqlite3.h>
 
 #include <cregistry/registry.h>
+#include <cregistry/portgroup.h>
 #include <cregistry/entry.h>
 #include <cregistry/file.h>
 
@@ -60,6 +61,8 @@
         reg_error* errPtr);
 int set_file(Tcl_Interp* interp, char* name, reg_file* file,
         reg_error* errPtr);
+int set_portgroup(Tcl_Interp* interp, char* name, reg_portgroup* portgroup,
+        reg_error* errPtr);
 
 void set_sqlite_result(Tcl_Interp* interp, sqlite3* db, const char* query);
 
@@ -77,6 +80,10 @@
         int* lower_bound, reg_error* errPtr);
 int list_file_to_obj(Tcl_Interp* interp, Tcl_Obj*** objs,
         reg_file** files, int file_count, reg_error* errPtr);
+int portgroup_to_obj(Tcl_Interp* interp, Tcl_Obj** ibj, reg_portgroup* portgroup,
+        int* lower_bound, reg_error* errPtr);
+int list_portgroup_to_obj(Tcl_Interp* interp, Tcl_Obj*** objs,
+        reg_portgroup** portgroups, int portgroup_count, reg_error* errPtr);
 
 void free_strings(void* userdata UNUSED, char** strings, int count);
 

Modified: branches/new-help-system/base/src/tclobjc1.0/Makefile.in
===================================================================
--- branches/new-help-system/base/src/tclobjc1.0/Makefile.in	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/tclobjc1.0/Makefile.in	2014-08-03 15:04:12 UTC (rev 122999)
@@ -1,9 +1,13 @@
+srcdir = @srcdir@
+VPATH  = @srcdir@
+
+include ../../Mk/macports.autoconf.mk
+
 OBJS=		tclobjc.o tclobjc_types.o MPMethodSignatureExtensions.o objc_encoding.o
 SHLIB_NAME=	tclobjc${SHLIB_SUFFIX}
-INSTALLDIR=	${DESTDIR}${datadir}/macports/Tcl/tclobjc1.0
+INSTALLDIR=	${DESTDIR}${TCL_PACKAGE_PATH}/tclobjc1.0
 
-include ../../Mk/macports.autoconf.mk
-include ../../Mk/macports.tea.mk
+include $(srcdir)/../../Mk/macports.tea.mk
 
 LDFLAGS+=	${OBJC_FOUNDATION_LDFLAGS}
 CPPFLAGS+=	${OBJC_FOUNDATION_CPPFLAGS}

Deleted: branches/new-help-system/base/src/thread2.6.diff
===================================================================
--- branches/new-help-system/base/src/thread2.6.diff	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/thread2.6.diff	2014-08-03 15:04:12 UTC (rev 122999)
@@ -1,79 +0,0 @@
-diff -ru src/thread2.6/Makefile.in src/thread2.6.mine/Makefile.in
---- src/thread2.6/Makefile.in	Sat Dec 18 09:26:02 2004
-+++ src/thread2.6.mine/Makefile.in	Mon Apr 17 02:42:43 2006
-@@ -67,12 +67,12 @@
- 
- srcdir		= @srcdir@
- prefix		= @prefix@
--exec_prefix	= @exec_prefix@
-+exec_prefix	= @prefix@
- 
- bindir		= @bindir@
--libdir		= @libdir@
-+libdir		= @prefix@/share/macports/Tcl
- datadir		= @datadir@
--mandir		= @mandir@
-+mandir		= @prefix@/share/macports/man
- includedir	= @includedir@
- 
- DESTDIR		=
-diff -ru src/thread2.6/configure src/thread2.6.mine/configure
---- src/thread2.6/configure	Thu Dec 23 05:48:44 2004
-+++ src/thread2.6.mine/configure	Mon Apr 17 02:27:46 2006
-@@ -6374,13 +6374,11 @@
-    { (exit 1); exit 1; }; }
- 	    fi
- 	else
--	    # Check order: pkg --prefix location, Tcl's --prefix location,
-+	    # Check order:
- 	    # directory of tclConfig.sh, and Tcl source directory.
- 	    # Looking in the source dir is not ideal, but OK.
- 
--	    eval "temp_includedir=${includedir}"
--	    list="`ls -d ${temp_includedir}      2>/dev/null` \
--		`ls -d ${TCL_PREFIX}/include     2>/dev/null` \
-+	    list="`ls -d ${TCL_PREFIX}/include     2>/dev/null` \
- 		`ls -d ${TCL_BIN_DIR}/../include 2>/dev/null` \
- 		`ls -d ${TCL_SRC_DIR}/generic    2>/dev/null`"
- 	    if test "${TEA_PLATFORM}" != "windows" -o "$GCC" = "yes"; then
-diff -ru src/thread2.6/lib/ttrace.tcl src/thread2.6.mine/lib/ttrace.tcl
---- src/thread2.6/lib/ttrace.tcl	Fri Jul 30 01:37:50 2004
-+++ src/thread2.6.mine/lib/ttrace.tcl	Mon Apr 17 02:27:46 2006
-@@ -50,8 +50,8 @@
-         variable mutex ns_mutex
-         variable elock [$mutex create traceepochmutex]
-         variable store nsv_
--    } elseif {![catch {package require Thread} version]} {
--        variable tvers $version
-+    } elseif {![catch {package require Thread} thread_pkg_version]} {
-+        variable tvers $thread_pkg_version
-         variable mutex thread::mutex
-         variable elock [$mutex create]
-         variable store tsv::
-# tcl-64/tcl_ext/thread/thread.diff
---- src/thread2.6/generic/threadPoolCmd.c.orig	2003-11-27 11:54:19.000000000 -0800
-+++ src/thread2.6/generic/threadPoolCmd.c	2005-07-20 23:10:12.000000000 -0700
-@@ -1710,18 +1710,21 @@
-  *
-  *----------------------------------------------------------------------
-  */
-+#ifdef __WIN32__
-+#include <sys/timeb.h>
-+#else
-+#include <sys/time.h>
-+#endif
- static void
- GetTime(timePtr)
-     Tcl_Time *timePtr;
- {
- #ifdef __WIN32__
--#include <sys/timeb.h>
-     struct timeb tb;
-     (void)ftime(&tb);
-     timePtr->sec  = tb.time;
-     timePtr->usec = tb.millitm * 1000;
- #else
--#include <sys/time.h>
-     struct timeval tv;
-     (void)gettimeofday(&tv, NULL);
-     timePtr->sec  = tv.tv_sec;

Deleted: branches/new-help-system/base/src/thread2.6.tar.gz
===================================================================
(Binary files differ)

Deleted: branches/new-help-system/base/src/upgrade_sources_conf_default.tcl
===================================================================
--- branches/new-help-system/base/src/upgrade_sources_conf_default.tcl	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/src/upgrade_sources_conf_default.tcl	2014-08-03 15:04:12 UTC (rev 122999)
@@ -1,121 +0,0 @@
-#!/usr/bin/env tclsh
-#
-# $Id$
-#
-# Upgrade sources.conf for a given prefix (passed as the first and only
-# argument).
-#
-# For an rsync: repository, if it is the standard MacPorts one and not
-# already tagged, then make it default, if another wasn't already default.
-# For a file:// respository, if it is an svn checkout from the MacPorts
-# server, then make it default if another hasn't already been tagged.
-#
-
-if {[llength $::argv] == 0} {
-   puts "Usage: ${::argv0} <prefix>"
-   exit 1
-}
-
-set prefix [lindex $::argv 0]
-set sourcesConf ${prefix}/etc/macports/sources.conf
-if {[catch {set sourcesConfChannel [open $sourcesConf r]}]} {
-   exit 0
-}
-
-if {[file executable /usr/bin/mktemp]} {
-    set mktemp /usr/bin/mktemp
-} elseif {[file executable /bin/mktemp]} {
-    set mktemp /bin/mktemp
-} else {
-    set mktemp mktemp
-}
-
-set mktempChannel [open "|$mktemp -t macports_sources_upgrade.XXXXXXXXXX" r]
-set tempfile [read -nonewline $mktempChannel]
-close $mktempChannel
-
-set tempfileChannel [open $tempfile w]
-set defaultSeen false
-set defaultWritten false
-
-while {[gets $sourcesConfChannel line] >= 0} {
-   set addDefault false
-   if {!$defaultSeen && ![regexp {^\s*#|^$} $line]} {
-      if {[regexp {^([\w-]+://\S+)(?:\s+\[(\w+(?:,\w+)*)\])?$} $line -> url flags]} {
-         set flags [split $flags ,]
-         if {[lsearch $flags default] >= 0} {
-            set defaultSeen true
-         } elseif {[regexp {rsync://rsync\.(macports|darwinports)\.org/(release|dpupdate)/d?ports} $url]} {
-            set addDefault true
-         } elseif {[regexp {file://(/.+)} $url -> filepath]} {
-            if {[file exists [file join ${filepath} .svn]]} {
-               if {![info exists svnCmd]} {
-                  set svnCmd ""
-                  foreach path [concat [list ${prefix}/bin] [split $env(PATH) :]] {
-                     if {[file executable ${path}/svn]} {
-                        set svnCmd ${path}/svn
-                        break
-                     }
-                  }
-               }
-               if {$svnCmd eq ""} {
-                  puts "WARNING: Unable to check svn URL for '$filepath' because no svn command could be found; please manually verify $sourcesConf!"
-                  continue
-               }
-               if {![catch {set svnChannel [open "|$svnCmd info ${filepath}" r]} err]} {
-                  set svnURL {}
-                  while {[gets $svnChannel svnLine] >= 0} {
-                     regexp {^URL: (.*)} $svnLine -> svnURL
-                  }
-                  if {[catch {close $svnChannel} err]} {
-                     puts $err
-                     puts "WARNING: Unable to check svn URL for '$filepath'; please manually verify $sourcesConf!"
-                  }
-                  if {[regexp {^https?://svn\.(macports|macosforge)\.org/repository/macports/trunk/dports} $svnURL]} {
-                     set addDefault true
-                  }
-               } else {
-                  puts $err
-                  puts "WARNING: Unable to check svn URL for '$filepath'; please manually verify $sourcesConf!"
-               }
-            }
-         }
-         if {$addDefault} {
-            lappend flags default
-            set line "$url \[[join $flags ,]\]"
-            set defaultSeen true
-            set defaultWritten true
-         }
-      }
-   }
-   puts $tempfileChannel $line
-}
-close $tempfileChannel
-close $sourcesConfChannel
-
-if {$defaultWritten} {
-   set attributes [file attributes ${sourcesConf}]
-   if {[catch {file rename ${sourcesConf} "${sourcesConf}.mpsaved"}]} {
-      file rename -force ${sourcesConf} "${sourcesConf}.mpsaved_[clock seconds]"
-   }
-   file rename ${tempfile} ${sourcesConf}
-   eval file attributes ${sourcesConf} $attributes
-} else {
-   file delete ${tempfile}
-   if {!$defaultSeen} {
-      puts "[string repeat - 72]
-Warning, your source config file at:
-
-   $sourcesConf
-
-needs to have a \[default\] tag added to the primary MacPorts repository,
-however the proper entry could not be determined.  Please add the tag
-manually by either appending \[default\] to the end of the correct line,
-or if there are already tags, adding it to the list, e.g.
-\[nosync,default\].
-[string repeat - 72]"
-   }
-}
-
-exit 0
-

Copied: branches/new-help-system/base/src/upgrade_sources_conf_default.tcl.in (from rev 122997, trunk/base/src/upgrade_sources_conf_default.tcl.in)
===================================================================
--- branches/new-help-system/base/src/upgrade_sources_conf_default.tcl.in	                        (rev 0)
+++ branches/new-help-system/base/src/upgrade_sources_conf_default.tcl.in	2014-08-03 15:04:12 UTC (rev 122999)
@@ -0,0 +1,121 @@
+#!@TCLSH@
+#
+# $Id$
+#
+# Upgrade sources.conf for a given prefix (passed as the first and only
+# argument).
+#
+# For an rsync: repository, if it is the standard MacPorts one and not
+# already tagged, then make it default, if another wasn't already default.
+# For a file:// respository, if it is an svn checkout from the MacPorts
+# server, then make it default if another hasn't already been tagged.
+#
+
+if {[llength $::argv] == 0} {
+   puts "Usage: ${::argv0} <prefix>"
+   exit 1
+}
+
+set prefix [lindex $::argv 0]
+set sourcesConf ${prefix}/etc/macports/sources.conf
+if {[catch {set sourcesConfChannel [open $sourcesConf r]}]} {
+   exit 0
+}
+
+if {[file executable /usr/bin/mktemp]} {
+    set mktemp /usr/bin/mktemp
+} elseif {[file executable /bin/mktemp]} {
+    set mktemp /bin/mktemp
+} else {
+    set mktemp mktemp
+}
+
+set mktempChannel [open "|$mktemp -t macports_sources_upgrade.XXXXXXXXXX" r]
+set tempfile [read -nonewline $mktempChannel]
+close $mktempChannel
+
+set tempfileChannel [open $tempfile w]
+set defaultSeen false
+set defaultWritten false
+
+while {[gets $sourcesConfChannel line] >= 0} {
+   set addDefault false
+   if {!$defaultSeen && ![regexp {^\s*#|^$} $line]} {
+      if {[regexp {^([\w-]+://\S+)(?:\s+\[(\w+(?:,\w+)*)\])?$} $line -> url flags]} {
+         set flags [split $flags ,]
+         if {[lsearch $flags default] >= 0} {
+            set defaultSeen true
+         } elseif {[regexp {rsync://rsync\.(macports|darwinports)\.org/(release|dpupdate)/d?ports} $url]} {
+            set addDefault true
+         } elseif {[regexp {file://(/.+)} $url -> filepath]} {
+            if {[file exists [file join ${filepath} .svn]]} {
+               if {![info exists svnCmd]} {
+                  set svnCmd ""
+                  foreach path [concat [list ${prefix}/bin] [split $env(PATH) :]] {
+                     if {[file executable ${path}/svn]} {
+                        set svnCmd ${path}/svn
+                        break
+                     }
+                  }
+               }
+               if {$svnCmd eq ""} {
+                  puts "WARNING: Unable to check svn URL for '$filepath' because no svn command could be found; please manually verify $sourcesConf!"
+                  continue
+               }
+               if {![catch {set svnChannel [open "|$svnCmd info ${filepath}" r]} err]} {
+                  set svnURL {}
+                  while {[gets $svnChannel svnLine] >= 0} {
+                     regexp {^URL: (.*)} $svnLine -> svnURL
+                  }
+                  if {[catch {close $svnChannel} err]} {
+                     puts $err
+                     puts "WARNING: Unable to check svn URL for '$filepath'; please manually verify $sourcesConf!"
+                  }
+                  if {[regexp {^https?://svn\.(macports|macosforge)\.org/repository/macports/trunk/dports} $svnURL]} {
+                     set addDefault true
+                  }
+               } else {
+                  puts $err
+                  puts "WARNING: Unable to check svn URL for '$filepath'; please manually verify $sourcesConf!"
+               }
+            }
+         }
+         if {$addDefault} {
+            lappend flags default
+            set line "$url \[[join $flags ,]\]"
+            set defaultSeen true
+            set defaultWritten true
+         }
+      }
+   }
+   puts $tempfileChannel $line
+}
+close $tempfileChannel
+close $sourcesConfChannel
+
+if {$defaultWritten} {
+   set attributes [file attributes ${sourcesConf}]
+   if {[catch {file rename ${sourcesConf} "${sourcesConf}.mpsaved"}]} {
+      file rename -force ${sourcesConf} "${sourcesConf}.mpsaved_[clock seconds]"
+   }
+   file rename ${tempfile} ${sourcesConf}
+   file attributes ${sourcesConf} {*}$attributes
+} else {
+   file delete ${tempfile}
+   if {!$defaultSeen} {
+      puts "[string repeat - 72]
+Warning, your source config file at:
+
+   $sourcesConf
+
+needs to have a \[default\] tag added to the primary MacPorts repository,
+however the proper entry could not be determined.  Please add the tag
+manually by either appending \[default\] to the end of the correct line,
+or if there are already tags, adding it to the list, e.g.
+\[nosync,default\].
+[string repeat - 72]"
+   }
+}
+
+exit 0
+

Copied: branches/new-help-system/base/standard_configure.sh (from rev 122997, trunk/base/standard_configure.sh)
===================================================================
--- branches/new-help-system/base/standard_configure.sh	                        (rev 0)
+++ branches/new-help-system/base/standard_configure.sh	2014-08-03 15:04:12 UTC (rev 122999)
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+# This is how we run configure when building binary packages (more or less,
+# minus architecture selection). If you don't want a custom build, this
+# is probably how you should run it too.
+env PATH=/usr/bin:/bin:/usr/sbin:/sbin CFLAGS="-pipe -Os" ./configure --enable-readline
+
+# If you want to use a different prefix, add this to the above:
+# --prefix=/some/path --with-applications-dir=/some/path/Applications


Property changes on: branches/new-help-system/base/tests
___________________________________________________________________
Added: svn:ignore
   + Makefile
test.tcl


Deleted: branches/new-help-system/base/tests/Makefile
===================================================================
--- branches/new-help-system/base/tests/Makefile	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/tests/Makefile	2014-08-03 15:04:12 UTC (rev 122999)
@@ -1,14 +0,0 @@
-include ../Mk/macports.autoconf.mk
-
-all:: ../Mk/macports.autoconf.mk
-
-install::
-
-# Run all regression tests
-# tclsh test.tcl -h for more options.
-test::
-	$(TCLSH) test.tcl -nocolor
-
-clean::
-
-distclean:: clean

Copied: branches/new-help-system/base/tests/Makefile.in (from rev 122997, trunk/base/tests/Makefile.in)
===================================================================
--- branches/new-help-system/base/tests/Makefile.in	                        (rev 0)
+++ branches/new-help-system/base/tests/Makefile.in	2014-08-03 15:04:12 UTC (rev 122999)
@@ -0,0 +1,21 @@
+srcdir = @srcdir@
+VPATH  = @srcdir@
+
+include ../Mk/macports.autoconf.mk
+
+all:: ../Mk/macports.autoconf.mk
+
+install::
+
+# Run all regression tests
+# tclsh test.tcl -h for more options.
+test::
+	$(TCLSH) $(srcdir)/test.tcl -nocolor
+
+clean::
+
+distclean:: clean
+	rm -f Makefile
+	rm -f test.tcl
+	rm -f test/library.tcl
+	rm -f test/trace/test.tcl


Property changes on: branches/new-help-system/base/tests/test
___________________________________________________________________
Added: svn:ignore
   + library.tcl


Deleted: branches/new-help-system/base/tests/test/library.tcl
===================================================================
--- branches/new-help-system/base/tests/test/library.tcl	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/tests/test/library.tcl	2014-08-03 15:04:12 UTC (rev 122999)
@@ -1,172 +0,0 @@
-set autoconf [file dirname $argv0]/../../../Mk/macports.autoconf.mk
-eval ::tcltest::configure $::argv
-
-set output_file "output"
-set work_dir "work"
-
-# Set of procs used for testing.
-
-# Sets $bindir variable from macports.autoconf.mk
-# autogenerated file.
-proc load_variables {pwd} {
-    global autoconf bindir datadir portsrc cpwd
-
-    if { ![file exists $autoconf] } {
-        puts "ERROR: $autoconf does not exist."
-        exit 1
-    }
-
-    set cpwd [file dirname [file dirname $pwd]]
-
-    set line [get_line $autoconf "prefix*"]
-    set prefix [lrange [split $line " "] 1 1]
-
-    set line [get_line $autoconf "bindir*"]
-    set bin [lrange [split $line "/"] 1 1]
-
-    set bindir ${prefix}/${bin}
-    set datadir ${prefix}/share
-    set portsrc ${cpwd}/test-macports.conf
-
-}
-
-proc cleanup {} {
-    global cpwd
-
-    file delete -force /tmp/macports-tests
-    file delete -force ${cpwd}/PortIndex ${cpwd}/PortIndex.quick
-}
-
-# Sets initial directories
-proc set_dir {} {
-    global datadir cpwd
-
-    cleanup
-
-    file mkdir /tmp/macports-tests/ports \
-               /tmp/macports-tests/opt/local/etc/macports \
-               /tmp/macports-tests/opt/local/share \
-               /tmp/macports-tests/opt/local/var/macports/receipts \
-               /tmp/macports-tests/opt/local/var/macports/registry \
-               /tmp/macports-tests/opt/local/var/macports/build
-
-    file link -symbolic /tmp/macports-tests/opt/local/share/macports $datadir/macports
-    file link -symbolic /tmp/macports-tests/ports/test $cpwd/test
-}
-
-# Run portindex
-proc port_index {} {
-    global bindir datadir cpwd
-
-    # Move up 2 level to run portindex.
-    set path [pwd]
-    cd ../..
-    # Avoid warning about ports tree being old
-    exec sh -c {touch */*/Portfile}
-
-    exec ${bindir}/portindex 2>@1
-
-    file copy ${cpwd}/sources.conf /tmp/macports-tests/opt/local/etc/macports/
-    file copy ${cpwd}/PortIndex ${cpwd}/PortIndex.quick /tmp/macports-tests/ports/
-
-    cd $path
-}
-
-# Executes port clean.
-proc port_clean {pwd} {
-    global bindir datadir portsrc
-
-    set back [pwd]
-    cd $pwd
-
-    catch {exec env PORTSRC=${portsrc} ${bindir}/port clean 2>@1}
-    cd $back
-}
-
-# Runs the portfile.
-proc port_run {pwd} {
-    global bindir datadir portsrc
-
-    set back [pwd]
-    cd $pwd
-
-    set result [catch {exec env PORTSRC=${portsrc} ${bindir}/port -d test >&output} ]
-    cd $back
-    return $result
-}
-
-# Runs port trace.
-proc port_trace {pwd} {
-    global bindir datadir portsrc
-
-    set back [pwd]
-    cd $pwd
-
-    set result [catch {exec env PORTSRC=${portsrc} ${bindir}/port -t test >&output 2>@1} ]
-    cd $back
-    return $result
-}
-
-# Installs new portfile.
-proc port_install {} {
-    global bindir portsrc
-
-    set result [catch {exec env PORTSRC=${portsrc} ${bindir}/port install > output 2>@1} ]
-}
-
-# Run configure command.
-proc port_config {pwd} {
-    global path bindir portsrc
-
-    set result [catch {exec env PORTSRC=${portsrc} ${bindir}/port configure 2>@1} ]
-}
-
-# Run desroot command.
-proc port_desroot {pwd} {
-    global path bindir portsrc work_dir output_file
-
-    file copy -force ${path}/statefile ${work_dir}/.macports.statefile-unknown-version.state
-    if { [exec id -u] == 0 } {
-        exec chown macports ${work_dir}/.macports.statefile-unknown-version.state
-    }
-    set result [catch {exec env PORTSRC=${portsrc} ${bindir}/port destroot >$output_file 2>@1} ]
-}
-
-# Uninstalls portfile.
-proc port_uninstall {} {
-    global bindir portsrc
-
-    set result [catch {exec env PORTSRC=${portsrc} ${bindir}/port uninstall > output 2>@1} ]
-}
-
-# Returns the line containint a given string
-# from a given file, or -1 if nothing is found.
-proc get_line {filename lookup} {
-    set fp [open $filename r]
-
-    while {[gets $fp line] != -1} {
-        set line [string tolower $line]
-
-        if {[string match $lookup $line] != 0} {
-            close $fp
-            return $line
-        }
-    }
-    return -1
-}
-
-# This proc contains all the steps necesary
-# to install a port and save the output to a file.
-# Needed for the majority of regression tests.
-proc initial_setup {} {
-    global output_file work_dir path
-
-    makeFile "" $output_file
-    makeDirectory $work_dir
-
-    load_variables $path
-    set_dir
-    port_index
-    port_clean $path
-    port_run $path
-}

Copied: branches/new-help-system/base/tests/test/library.tcl.in (from rev 122997, trunk/base/tests/test/library.tcl.in)
===================================================================
--- branches/new-help-system/base/tests/test/library.tcl.in	                        (rev 0)
+++ branches/new-help-system/base/tests/test/library.tcl.in	2014-08-03 15:04:12 UTC (rev 122999)
@@ -0,0 +1,167 @@
+eval ::tcltest::configure $::argv
+
+set output_file "output"
+set work_dir "work"
+
+# constraint for tests that should only run on Darwin
+::tcltest::testConstraint darwin [expr {"@OS_PLATFORM@" eq "darwin"}]
+
+# constraint indicating whether the platform supports trace mode
+::tcltest::testConstraint tracemode_support [expr {@TRACEMODE_SUPPORT@ != 0}]
+
+# Set of procs used for testing.
+
+# Sets $bindir variable from autoconf
+proc load_variables {pwd} {
+    global bindir datadir portsrc cpwd
+
+    set cpwd [file dirname [file dirname $pwd]]
+
+    set prefix "@prefix@"
+    set exec_prefix "@exec_prefix@"
+    set bindir "@bindir@"
+    set datadir "@datarootdir@"
+    set portsrc ${cpwd}/test-macports.conf
+
+}
+
+proc cleanup {} {
+    global cpwd
+
+    file delete -force /tmp/macports-tests
+    file delete -force ${cpwd}/PortIndex ${cpwd}/PortIndex.quick
+}
+
+# Sets initial directories
+proc set_dir {} {
+    global datadir cpwd
+
+    cleanup
+
+    file mkdir /tmp/macports-tests/ports \
+               /tmp/macports-tests/opt/local/etc/macports \
+               /tmp/macports-tests/opt/local/share \
+               /tmp/macports-tests/opt/local/var/macports/receipts \
+               /tmp/macports-tests/opt/local/var/macports/registry \
+               /tmp/macports-tests/opt/local/var/macports/build
+
+    file link -symbolic /tmp/macports-tests/opt/local/share/macports $datadir/macports
+    file link -symbolic /tmp/macports-tests/ports/test $cpwd/test
+}
+
+# Run portindex
+proc port_index {} {
+    global bindir datadir cpwd
+
+    # Move up 2 level to run portindex.
+    set path [pwd]
+    cd ../..
+    # Avoid warning about ports tree being old
+    exec sh -c {touch */*/Portfile}
+
+    exec ${bindir}/portindex 2>@1
+
+    file copy ${cpwd}/sources.conf /tmp/macports-tests/opt/local/etc/macports/
+    file copy ${cpwd}/PortIndex ${cpwd}/PortIndex.quick /tmp/macports-tests/ports/
+
+    cd $path
+}
+
+# Executes port clean.
+proc port_clean {pwd} {
+    global bindir datadir portsrc
+
+    set back [pwd]
+    cd $pwd
+
+    catch {exec env PORTSRC=${portsrc} ${bindir}/port clean 2>@1}
+    cd $back
+}
+
+# Runs the portfile.
+proc port_run {pwd} {
+    global bindir datadir portsrc
+
+    set back [pwd]
+    cd $pwd
+
+    set result [catch {exec env PORTSRC=${portsrc} ${bindir}/port -d test >&output} ]
+    cd $back
+    return $result
+}
+
+# Runs port trace.
+proc port_trace {pwd} {
+    global bindir datadir portsrc
+
+    set back [pwd]
+    cd $pwd
+
+    set result [catch {exec env PORTSRC=${portsrc} ${bindir}/port -t test >&output 2>@1} ]
+    cd $back
+    return $result
+}
+
+# Installs new portfile.
+proc port_install {} {
+    global bindir portsrc
+
+    set result [catch {exec env PORTSRC=${portsrc} ${bindir}/port install > output 2>@1} ]
+}
+
+# Run configure command.
+proc port_config {pwd} {
+    global path bindir portsrc
+
+    set result [catch {exec env PORTSRC=${portsrc} ${bindir}/port configure 2>@1} ]
+}
+
+# Run destroot command.
+proc port_destroot {pwd} {
+    global path bindir portsrc work_dir output_file
+
+    file copy -force ${path}/statefile ${work_dir}/.macports.statefile-unknown-version.state
+    if { [exec id -u] == 0 } {
+        exec chown macports ${work_dir}/.macports.statefile-unknown-version.state
+    }
+    set result [catch {exec env PORTSRC=${portsrc} ${bindir}/port destroot >$output_file 2>@1} ]
+}
+
+# Uninstalls portfile.
+proc port_uninstall {} {
+    global bindir portsrc
+
+    set result [catch {exec env PORTSRC=${portsrc} ${bindir}/port uninstall > output 2>@1} ]
+}
+
+# Returns the line containint a given string
+# from a given file, or -1 if nothing is found.
+proc get_line {filename lookup} {
+    set fp [open $filename r]
+
+    while {[gets $fp line] != -1} {
+        set line [string tolower $line]
+
+        if {[string match $lookup $line] != 0} {
+            close $fp
+            return $line
+        }
+    }
+    return -1
+}
+
+# This proc contains all the steps necesary
+# to install a port and save the output to a file.
+# Needed for the majority of regression tests.
+proc initial_setup {} {
+    global output_file work_dir path
+
+    makeFile "" $output_file
+    makeDirectory $work_dir
+
+    load_variables $path
+    set_dir
+    port_index
+    port_clean $path
+    port_run $path
+}

Modified: branches/new-help-system/base/tests/test/statefile-unknown-version/test.tcl
===================================================================
--- branches/new-help-system/base/tests/test/statefile-unknown-version/test.tcl	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/tests/test/statefile-unknown-version/test.tcl	2014-08-03 15:04:12 UTC (rev 122999)
@@ -11,7 +11,7 @@
 set_dir
 port_index
 port_config $path
-port_desroot $path
+port_destroot $path
 port_clean $path
 
 proc state_unknown {warn} {

Modified: branches/new-help-system/base/tests/test/statefile-version1/test.tcl
===================================================================
--- branches/new-help-system/base/tests/test/statefile-version1/test.tcl	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/tests/test/statefile-version1/test.tcl	2014-08-03 15:04:12 UTC (rev 122999)
@@ -13,7 +13,7 @@
 set_dir
 port_index
 port_config $path
-port_desroot $path
+port_destroot $path
 port_clean $path
 
 proc statefile_v1 {warn} {

Modified: branches/new-help-system/base/tests/test/statefile-version1-outdated/test.tcl
===================================================================
--- branches/new-help-system/base/tests/test/statefile-version1-outdated/test.tcl	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/tests/test/statefile-version1-outdated/test.tcl	2014-08-03 15:04:12 UTC (rev 122999)
@@ -12,8 +12,9 @@
 port_index
 port_config $path
 file copy -force $path/statefile $work_dir/.macports.statefile-version1-outdated.state
+file attributes $work_dir/.macports.statefile-version1-outdated.state -permissions 0664
 exec touch -t 197001010000.09 $work_dir/.macports.statefile-version1-outdated.state
-port_desroot $path
+port_destroot $path
 port_clean $path
 
 proc state_v1 {warn} {

Modified: branches/new-help-system/base/tests/test/statefile-version2/test.tcl
===================================================================
--- branches/new-help-system/base/tests/test/statefile-version2/test.tcl	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/tests/test/statefile-version2/test.tcl	2014-08-03 15:04:12 UTC (rev 122999)
@@ -16,7 +16,7 @@
 file copy -force $path/statefile $work_dir/.macports.statefile-version2.state
 exec sed -i'' -E "s/@CHECKSUM@/`openssl dgst -sha256 Portfile | \
     awk '{print \$\$2}'`/" $work_dir/.macports.statefile-version2.state
-port_desroot $path
+port_destroot $path
 port_clean $path
 
 proc statefile_v2 {arg} {

Modified: branches/new-help-system/base/tests/test/statefile-version2-invalid/test.tcl
===================================================================
--- branches/new-help-system/base/tests/test/statefile-version2-invalid/test.tcl	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/tests/test/statefile-version2-invalid/test.tcl	2014-08-03 15:04:12 UTC (rev 122999)
@@ -12,7 +12,8 @@
 port_index
 port_config $path
 file copy -force $path/statefile $work_dir/.macports.statefile-version2-invalid.state
-port_desroot $path
+file attributes $work_dir/.macports.statefile-version2-invalid.state -permissions 0664
+port_destroot $path
 port_clean $path
 
 proc state_v2_invalid {warn} {

Modified: branches/new-help-system/base/tests/test/statefile-version2-outdated/test.tcl
===================================================================
--- branches/new-help-system/base/tests/test/statefile-version2-outdated/test.tcl	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/tests/test/statefile-version2-outdated/test.tcl	2014-08-03 15:04:12 UTC (rev 122999)
@@ -12,7 +12,8 @@
 port_index
 port_config $path
 file copy -force $path/statefile $work_dir/.macports.statefile-version2-outdated.state
-port_desroot $path
+file attributes $work_dir/.macports.statefile-version2-outdated.state -permissions 0664
+port_destroot $path
 port_clean $path
 
 proc state_v2_out {warn} {

Modified: branches/new-help-system/base/tests/test/svn-and-patchsites/Portfile
===================================================================
--- branches/new-help-system/base/tests/test/svn-and-patchsites/Portfile	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/tests/test/svn-and-patchsites/Portfile	2014-08-03 15:04:12 UTC (rev 122999)
@@ -1,31 +1,42 @@
+# -*- 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
 # $Id$
 
-PortSystem 1.0
+PortSystem          1.0
 
-name		svn-and-patchsites
-version		1
-categories	test
-maintainers	nomaintainer
-description	Test port for svn+distant patchfiles functionalities
-homepage	http://www.macports.org/
-platforms	darwin
+name                svn-and-patchsites
+version             2
 
-long_description ${description}
+categories          test
+maintainers         nomaintainer
+platforms           darwin
 
+homepage            http://www.macports.org/
+description         Test port for svn+distant patchfiles functionalities
+long_description    ${description}
+
+# use a MacPorts svn URL so we don't ping a remote SVN server every time the
+# tests are run
+# taken from the mpvim port
 fetch.type          svn
-svn.url             http://svn.pythonmac.org/altgraph/altgraph/tags/altgraph-0.7.0/
-worksrcdir          altgraph-0.7.0
+svn.url             https://svn.macports.org/repository/macports/contrib/mpvim
 
-patch_sites      http://home.uchicago.edu/~dgc/sw/mutt/
-patchfiles       patch-1.5.14.dgc.xlabel_ext.9
-checksums        patch-1.5.14.dgc.xlabel_ext.9 md5 c5badc733020187b6677f31b343195e8
+# use a MacPorts distfiles server to avoid hitting a remote server every time
+# the tests are run (and possibly causing failures when the server is down)
+# taken from the vim port
+patch_sites         http://distfiles.macports.org/vim/7.4
+patchfiles          7.4.001 \
+                    7.4.002 \
+                    7.4.003
+checksums           7.4.001 md5 f234692c9ab5265ba6ba6f55c0f81764 \
+                    7.4.002 md5 a03e1a5ad3722f2011751dda977641af \
+                    7.4.003 md5 e6d070f592bb6da4d8cf2f7f134425e5
 
 # Set depends_fetch to be empty to remove the dependency on svn added by base,
 # as it is not available in the test suite. Otherwise MacPorts will try to
 # verify a subversion port exists.
 depends_fetch
 
-# disable the patch phase in case the svn code gets out of sync with the patch.
+# disable the patch phase because the patches would never apply
 patch		{}
 extract		{}
 configure	{}


Property changes on: branches/new-help-system/base/tests/test/trace
___________________________________________________________________
Modified: svn:ignore
   - output

   + output
test.tcl


Deleted: branches/new-help-system/base/tests/test/trace/test.tcl
===================================================================
--- branches/new-help-system/base/tests/test/trace/test.tcl	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/tests/test/trace/test.tcl	2014-08-03 15:04:12 UTC (rev 122999)
@@ -1,57 +0,0 @@
-package require tcltest 2
-namespace import tcltest::*
-
-source [file dirname $argv0]/../library.tcl
-
-makeFile "" $output_file
-makeDirectory $work_dir
-set path [file dirname [file normalize $argv0]]
-
-load_variables $path
-
-proc test_trace {} {
-    global path autoconf output_file
-
-    set line [get_line $autoconf "runusr*"]
-    set user [lrange [split $line " "] 1 1]
-
-    set_dir
-    port_index
-    port_clean $path
-
-
-    makeDirectory ../tracetesttmp
-    file attributes ../tracetesttmp -owner $user
-    exec sudo -u $user touch  ../tracetesttmp/delete-trace
-    exec sudo -u $user touch ../tracetesttmp/rename-trace
-    exec sudo -u $user mkdir ../tracetesttmp/rmdir-trace
-    file delete -force /tmp/hello-trace
-    file attributes /usr/include/unistd.h -owner $user
-    file link -symbolic /tmp/link-trace2 /usr/include/unistd.h
-    exec chown -h $user /tmp/link-trace2
-
-    port_trace $path
-    
-    #file delete -force /tmp/link-trace2
-    file delete -force /tmp/hello-trace
-
-    set err "error*"
-    set line [get_line $path/$output_file $err]
-    if { $line == -1 } {
-        return "No errors found."
-    } else {
-        return $line
-    }
-}
-
-test trace {
-    Regression test for trace.
-} -constraints {
-    root
-} -body {
-    test_trace
-} -result "No errors found."
-
-
-cleanup
-cleanupTests

Copied: branches/new-help-system/base/tests/test/trace/test.tcl.in (from rev 122997, trunk/base/tests/test/trace/test.tcl.in)
===================================================================
--- branches/new-help-system/base/tests/test/trace/test.tcl.in	                        (rev 0)
+++ branches/new-help-system/base/tests/test/trace/test.tcl.in	2014-08-03 15:04:12 UTC (rev 122999)
@@ -0,0 +1,70 @@
+package require tcltest 2
+
+# need pextlib to drop privs
+package require Pextlib 1.0
+
+namespace import tcltest::*
+
+source [file dirname $argv0]/../library.tcl
+
+makeFile "" $output_file
+makeDirectory $work_dir
+set path [file dirname [file normalize $argv0]]
+
+load_variables $path
+
+proc test_trace {} {
+    global path output_file
+
+    set user "@RUNUSR@"
+
+    set_dir
+    port_index
+    port_clean $path
+
+    file delete -force /tmp/hello-trace
+    file delete -force /tmp/link-trace2
+    file link -symbolic /tmp/link-trace2 /usr/include/unistd.h
+
+    makeDirectory ../tracetesttmp
+    if {[getuid] == 0} {
+        file attributes ../tracetesttmp -owner $user
+        exec chown -h $user /tmp/link-trace2
+    }
+
+    if {[getuid] == 0} {
+        seteuid [name_to_uid $user]
+    }
+    exec touch  ../tracetesttmp/delete-trace
+    exec touch ../tracetesttmp/rename-trace
+    exec mkdir ../tracetesttmp/rmdir-trace
+    if {[getuid] == 0} {
+        seteuid 0
+    }
+
+    port_trace $path
+
+    file delete -force /tmp/link-trace2
+    file delete -force /tmp/hello-trace
+
+    set err "error*"
+    set line [get_line $path/$output_file $err]
+    set unsupported [get_line $path/$output_file "*tracelib not supported on this platform*"]
+    if {$unsupported != -1 || $line == -1} {
+        return "No errors found."
+    } else {
+        return $line
+    }
+}
+
+test trace {
+    Regression test for trace.
+} -constraints {
+    tracemode_support
+} -body {
+    test_trace
+} -result "No errors found."
+
+
+cleanup
+cleanupTests

Modified: branches/new-help-system/base/tests/test/universal/test.tcl
===================================================================
--- branches/new-help-system/base/tests/test/universal/test.tcl	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/tests/test/universal/test.tcl	2014-08-03 15:04:12 UTC (rev 122999)
@@ -38,6 +38,8 @@
 
 test universal {
     Regression test for universal variant.
+} -constraints {
+    darwin
 } -body {
     univ_test "yes"
 } -result "variants: universal"

Modified: branches/new-help-system/base/tests/test/xcodeversion/test.tcl
===================================================================
--- branches/new-help-system/base/tests/test/xcodeversion/test.tcl	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/tests/test/xcodeversion/test.tcl	2014-08-03 15:04:12 UTC (rev 122999)
@@ -24,12 +24,16 @@
 
 test envvariables {
     Regression test for XCode version.
+} -constraints {
+    darwin
 } -body {
     xcode_ver
 } -result "xcodeversion >= 2.1"
 
 test xcode_path {
     Regression test for XCode path.
+} -constraints {
+    darwin
 } -body {
     xcode_binpath
 } -result "xcodebuildcmd = /usr/bin/xcodebuild"

Deleted: branches/new-help-system/base/tests/test.tcl
===================================================================
--- branches/new-help-system/base/tests/test.tcl	2014-08-03 14:35:14 UTC (rev 122998)
+++ branches/new-help-system/base/tests/test.tcl	2014-08-03 15:04:12 UTC (rev 122999)
@@ -1,143 +0,0 @@
-set test_suite {
-    case-insensitive-deactivate
-    checksums-1
-    dependencies-a
-    dependencies-b
-    dependencies-c
-    dependencies-d
-    dependencies-e
-    envvariables
-    site-tags
-    statefile-unknown-version
-    statefile-version1
-    statefile-version1-outdated
-    statefile-version2
-    statefile-version2-invalid
-    statefile-version2-outdated
-    svn-and-patchsites
-    trace
-    universal
-    variants
-    xcodeversion
-}
-set arguments ""
-set test_name ""
-set color_out ""
-set tcl ""
-set err ""
-
-# Get tclsh path.
-set autoconf ../Mk/macports.autoconf.mk
-set fp [open $autoconf r]
-while {[gets $fp line] != -1} {
-    if {[string match "TCLSH*" $line] != 0} {
-        set tcl [lrange [split $line " "] 1 1]
-    }
-}
-
-proc print_help {arg} {
-    if { $arg eq "tests" } {
-        puts "The list of available tests is:"
-        foreach test $::test_suite {
-            puts [puts -nonewline "  "]$test
-        }
-    } else {
-        puts "Usage: tclsh test.tcl \[-debug level\] \[-t test\] \[-l\]\n"
-        puts "  -debug LVL : sets the level of printed debug info \[0-3\]"
-        puts "  -t TEST    : run a specific test"
-        puts "  -nocolor   : disable color output (for automatic testing)"
-        puts "  -l         : print the list of available tests"
-        puts "  -h, -help  : print this message\n"
-    }
-}
-
-# Process args
-foreach arg $argv {
-    if { $arg eq "-h" || $arg eq "-help" } {
-        print_help ""
-        exit 0
-    } elseif { $arg eq "-debug" } {
-        set index [expr {[lsearch $argv $arg] + 1}]
-        set level [lindex $argv $index]
-        if { $level >= 0 && $level <= 3 } {
-            append arguments "-debug " $level
-        } else {
-            puts "Invalid debug level."
-            exit 1
-        }
-    } elseif { $arg eq "-t" } {
-        set index [expr {[lsearch $argv $arg] + 1}]
-        set test_name [lindex $argv $index]
-        set no 0
-        foreach test $test_suite {
-            if { $test_name != $test } {
-                set no [expr {$no + 1}]
-            }
-        }
-        if { $no == [llength $test_suite] } {
-            print_help tests
-            exit 1
-        }
-    } elseif { $arg eq "-l" } {
-        print_help tests
-        exit 0
-    } elseif { $arg eq "-nocolor" } {
-        set color_out "no"
-    }
-}
-
-
-# Run tests
-if {$test_name ne ""} {
-    cd test/$test_name
-
-    set result [eval exec $tcl test.tcl $arguments 2>@stderr]
-    puts $result
-
-} else {
-    foreach test $test_suite {
-        cd test/$test
-    
-        set result [eval exec $tcl test.tcl $arguments 2>@stderr]
-        set lastline [lindex [split $result "\n"] end]
-
-        if {[lrange [split $lastline "\t"] 1 1] != "Total"} {
-            set lastline [lindex [split $result "\n"] end-2]
-            set errmsg [lindex [split $result "\n"] end]
-        }
-
-        set splitresult [split $lastline "\t"]
-        set total [lindex $splitresult 2]
-        set pass [lindex $splitresult 4]
-        set skip [lindex $splitresult 6]
-        set fail [lindex $splitresult 8]
-
-        # Check for errors.
-        if { $fail != 0 } { set err "yes" }
-
-        set out ""
-        if { ($fail != 0 || $skip != 0) && $color_out eq "" } {
-            # Color failed tests.
-            append out "\x1b\[1;31mTotal:" $total " Passed:" $pass " Failed:" $fail " Skipped:" $skip "  \x1b\[0m" $test
-        } else {
-            append out "Total:" $total " Passed:" $pass " Failed:" $fail " Skipped:" $skip "  " $test
-        }
-
-        # Print results and constrints for auto-skipped tests.
-        puts $out
-        if { $skip != 0 } {
-            set out "    Constraint: "
-            append out [string trim $errmsg "\t {}"]
-            puts $out
-        }
-    
-        cd ../..
-    }
-}
-
-# Return 1 if errors were found.
-if {$err ne ""} {
-    exit 1
-}
-
-return 0

Copied: branches/new-help-system/base/tests/test.tcl.in (from rev 122997, trunk/base/tests/test.tcl.in)
===================================================================
--- branches/new-help-system/base/tests/test.tcl.in	                        (rev 0)
+++ branches/new-help-system/base/tests/test.tcl.in	2014-08-03 15:04:12 UTC (rev 122999)
@@ -0,0 +1,138 @@
+set test_suite {
+    case-insensitive-deactivate
+    checksums-1
+    dependencies-a
+    dependencies-b
+    dependencies-c
+    dependencies-d
+    dependencies-e
+    envvariables
+    site-tags
+    statefile-unknown-version
+    statefile-version1
+    statefile-version1-outdated
+    statefile-version2
+    statefile-version2-invalid
+    statefile-version2-outdated
+    svn-and-patchsites
+    trace
+    universal
+    variants
+    xcodeversion
+}
+
+set arguments ""
+set test_name ""
+set color_out ""
+set tcl ""
+set err ""
+
+# Get tclsh path.
+set tcl "@TCLSH@"
+
+proc print_help {arg} {
+    if { $arg eq "tests" } {
+        puts "The list of available tests is:"
+        foreach test $::test_suite {
+            puts [puts -nonewline "  "]$test
+        }
+    } else {
+        puts "Usage: tclsh test.tcl \[-debug level\] \[-t test\] \[-l\]\n"
+        puts "  -debug LVL : sets the level of printed debug info \[0-3\]"
+        puts "  -t TEST    : run a specific test"
+        puts "  -nocolor   : disable color output (for automatic testing)"
+        puts "  -l         : print the list of available tests"
+        puts "  -h, -help  : print this message\n"
+    }
+}
+
+# Process args
+foreach arg $argv {
+    if { $arg eq "-h" || $arg eq "-help" } {
+        print_help ""
+        exit 0
+    } elseif { $arg eq "-debug" } {
+        set index [expr {[lsearch $argv $arg] + 1}]
+        set level [lindex $argv $index]
+        if { $level >= 0 && $level <= 3 } {
+            append arguments "-debug " $level
+        } else {
+            puts "Invalid debug level."
+            exit 1
+        }
+    } elseif { $arg eq "-t" } {
+        set index [expr {[lsearch $argv $arg] + 1}]
+        set test_name [lindex $argv $index]
+        set no 0
+        foreach test $test_suite {
+            if { $test_name != $test } {
+                set no [expr {$no + 1}]
+            }
+        }
+        if { $no == [llength $test_suite] } {
+            print_help tests
+            exit 1
+        }
+    } elseif { $arg eq "-l" } {
+        print_help tests
+        exit 0
+    } elseif { $arg eq "-nocolor" } {
+        set color_out "no"
+    }
+}
+
+
+# Run tests
+if {$test_name ne ""} {
+    cd test/$test_name
+
+    set result [eval exec $tcl test.tcl $arguments 2>@stderr]
+    puts $result
+
+} else {
+    foreach test $test_suite {
+        cd test/$test
+    
+        set result [eval exec $tcl test.tcl $arguments 2>@stderr]
+        set lastline [lindex [split $result "\n"] end]
+
+        if {[lrange [split $lastline "\t"] 1 1] != "Total"} {
+            set lastline [lindex [split $result "\n"] end-2]
+            set errmsg [lindex [split $result "\n"] end]
+        }
+
+        set splitresult [split $lastline "\t"]
+        set total [lindex $splitresult 2]
+        set pass [lindex $splitresult 4]
+        set skip [lindex $splitresult 6]
+        set fail [lindex $splitresult 8]
+
+        # Check for errors.
+        if { $fail != 0 } { set err "yes" }
+
+        set out ""
+        if { ($fail != 0 || $skip != 0) && $color_out eq "" } {
+            # Color failed tests.
+            append out "\x1b\[1;31mTotal:" $total " Passed:" $pass " Failed:" $fail " Skipped:" $skip "  \x1b\[0m" $test
+        } else {
+            append out "Total:" $total " Passed:" $pass " Failed:" $fail " Skipped:" $skip "  " $test
+        }
+
+        # Print results and constrints for auto-skipped tests.
+        puts $out
+        if { $skip != 0 } {
+            set out "    Constraint: "
+            append out [string trim $errmsg "\t {}"]
+            puts $out
+        }
+    
+        cd ../..
+    }
+}
+
+# Return 1 if errors were found.
+if {$err ne ""} {
+    exit 1
+}
+
+return 0
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20140803/6bb3c2d5/attachment-0001.html>


More information about the macports-changes mailing list