[24454] branches/dp2mp-move

source_changes at macosforge.org source_changes at macosforge.org
Tue Apr 24 10:28:17 PDT 2007


Revision: 24454
          http://trac.macosforge.org/projects/macports/changeset/24454
Author:   jmpp at macports.org
Date:     2007-04-24 10:28:16 -0700 (Tue, 24 Apr 2007)

Log Message:
-----------

Creating a branch where I plan to slowly but surely move all of our base sources from the old DarwinPorts name
(or any variation and/or incarnation of it) to our new MacPorts name, at several levels:

 * source layout (e.g. src/darwinports1.0 -> src/macports1.0);
 * build system, adapting the existing one to the new source layout;
 * code level, moving all our *darwin* and *dport* procs and functions to the *macports* and *mport* namespace, respectively;
 * host installation (e.g. ${prefix}/share/darwinports -> ${prefix}/share/macports and several other important examples inside
  and outside of ${prefix}, while also dropping the d[arwin] moniker from our ports tree everywhere);
 * distribution means, among other things moving to rsync.macports.org but also getting rid of things like
  `/opt/local/var/db/dports/sources/rsync.rsync.darwinports.org_dpupdate1` that never made much sense in the first place and
  tied us to very rigid schemes and directory hierarchies (replacing them with a new scheme that will give us enough room to
  grow as we need and allow us to offer any source and ports trees we wish at any point through sync/selfupdate);
 * Anything else (relevant to this initiative, of course) that catches my eye while I work on this branch...

Current state of the branch is: as of this commit, branch mirrors trunk/base @ r24452, all changesets merged and adapted manually and/or
via 'svn merge'; source layout mostly moved to the 'macports' namespace (some things might still escape my eye, will get to them over time).
The result configures, makes 'clean' and 'distclean', which already meant a lot of work on the Makefiles. Branch doesn't compile yet,
of course, since getting to that state is a rather slow process that goes through completing item No. 3 in my list above.

After that comes installation on a host system, item No. 4. Getting this right not only means a chance to re-think our desired
installation time filesystem layout (if any change other than darwinports -> macports is applicable), but also designing a migration
strategy for existing installations. Item No. 5 ties in with all of this, as new paths in our rsync repo and new conf file options
reflecting them will need migrating to for existing users.

Needless to say, once all that's done (migration paths written and tested locally) the hardest part it still to come: ensuring MacPorts
still Works As Expected (TM) before going live with this.

Only caveat that currently comes to mind from all of this, other than the work required to complete this branch, is the effect changing
the path to the depot location (`/opt/local/var/db/dports/{software,receipts}`) might have on installed ports. Will work to minimize
this side effect.

Motivation for this branch (or "Why I think investing some time on this initiative is well worth the effort!"):

 * The current mixture between darwinports and macports on so many levels (source layout, code namespace, installation paths, etc)
  is confusing to everyone (users, developers, contributors) at best, so sanitizing is in order;
 * Thinking through our distribution means calmly (without the pressure of releasing quick, as it was when 1.0 came about) and with
  all the experience of previous releases already with us will give us a chance to it right (or better, in any case);
 * I'm obsessive... but you all already knew that ;)

Modified Paths:
--------------
    branches/dp2mp-move/base/Makefile.in
    branches/dp2mp-move/base/aclocal.m4
    branches/dp2mp-move/base/config/Makefile
    branches/dp2mp-move/base/config/README.TXT
    branches/dp2mp-move/base/configure
    branches/dp2mp-move/base/configure.ac
    branches/dp2mp-move/base/doc/Makefile
    branches/dp2mp-move/base/portmgr/IndexRegen.sh
    branches/dp2mp-move/base/portmgr/Makefile
    branches/dp2mp-move/base/src/Makefile.in
    branches/dp2mp-move/base/src/cflib1.0/Makefile
    branches/dp2mp-move/base/src/darwintracelib1.0/Makefile
    branches/dp2mp-move/base/src/macports1.0/Makefile
    branches/dp2mp-move/base/src/package1.0/Makefile
    branches/dp2mp-move/base/src/pextlib1.0/Makefile
    branches/dp2mp-move/base/src/pextlib1.0/Pextlib.c
    branches/dp2mp-move/base/src/port/Makefile
    branches/dp2mp-move/base/src/port1.0/Makefile
    branches/dp2mp-move/base/src/port1.0/port_autoconf.tcl.in
    branches/dp2mp-move/base/src/port1.0/portdestroot.tcl
    branches/dp2mp-move/base/src/port1.0/resources/Makefile
    branches/dp2mp-move/base/src/port1.0/resources/fetch/Makefile
    branches/dp2mp-move/base/src/port1.0/resources/group/Makefile
    branches/dp2mp-move/base/src/port1.0/resources/package/Makefile
    branches/dp2mp-move/base/src/port1.0/tests/portutil.tcl
    branches/dp2mp-move/base/src/programs/Makefile.in
    branches/dp2mp-move/base/src/programs/daemondo/Makefile.in
    branches/dp2mp-move/base/src/registry1.0/Makefile
    branches/dp2mp-move/base/tests/Makefile
    branches/dp2mp-move/base/tests/sources.conf
    branches/dp2mp-move/base/tests/test/envvariables/Makefile
    branches/dp2mp-move/base/tests/test/trace/Makefile
    branches/dp2mp-move/base/tests/test/universal/Makefile
    branches/dp2mp-move/base/tests/test/universal-2/Makefile
    branches/dp2mp-move/base/tests/test-ports.conf

Added Paths:
-----------
    branches/dp2mp-move/base/
    branches/dp2mp-move/base/ChangeLog
    branches/dp2mp-move/base/Mk/macports.autoconf.mk.in
    branches/dp2mp-move/base/Mk/macports.subdir.mk
    branches/dp2mp-move/base/Mk/macports.tea.mk
    branches/dp2mp-move/base/config/mp_version
    branches/dp2mp-move/base/doc/macports.conf.5
    branches/dp2mp-move/base/doc/macports.conf.in
    branches/dp2mp-move/base/doc/portfile.7
    branches/dp2mp-move/base/src/macports1.0/
    branches/dp2mp-move/base/src/macports1.0/macports.c
    branches/dp2mp-move/base/src/macports1.0/macports.h
    branches/dp2mp-move/base/src/macports1.0/macports.tcl
    branches/dp2mp-move/base/src/macports1.0/macports_autoconf.tcl.in
    branches/dp2mp-move/base/src/macports1.0/macports_dlist.tcl
    branches/dp2mp-move/base/src/macports1.0/macports_fastload.tcl.in
    branches/dp2mp-move/base/src/macports1.0/macports_index.tcl
    branches/dp2mp-move/base/src/pextlib1.0/fs-traverse.c
    branches/dp2mp-move/base/src/pextlib1.0/tests/
    branches/dp2mp-move/base/src/port1.0/portutil.tcl
    branches/dp2mp-move/base/src/port1.0/tests/

Removed Paths:
-------------
    branches/dp2mp-move/base/ChangeLog
    branches/dp2mp-move/base/Mk/dports.autoconf.mk.in
    branches/dp2mp-move/base/Mk/dports.subdir.mk
    branches/dp2mp-move/base/Mk/dports.tea.mk
    branches/dp2mp-move/base/config/dp_version
    branches/dp2mp-move/base/doc/README.platforms
    branches/dp2mp-move/base/doc/portfile.7
    branches/dp2mp-move/base/doc/ports.conf.5
    branches/dp2mp-move/base/doc/ports.conf.in
    branches/dp2mp-move/base/portmgr/dprsyncup
    branches/dp2mp-move/base/src/darwinports1.0/
    branches/dp2mp-move/base/src/macports1.0/darwinports.c
    branches/dp2mp-move/base/src/macports1.0/darwinports.h
    branches/dp2mp-move/base/src/macports1.0/darwinports.tcl
    branches/dp2mp-move/base/src/macports1.0/darwinports_autoconf.tcl.in
    branches/dp2mp-move/base/src/macports1.0/darwinports_dlist.tcl
    branches/dp2mp-move/base/src/macports1.0/darwinports_fastload.tcl.in
    branches/dp2mp-move/base/src/macports1.0/darwinports_index.tcl
    branches/dp2mp-move/base/src/pextlib1.0/fs-traverse.c
    branches/dp2mp-move/base/src/pextlib1.0/tests/
    branches/dp2mp-move/base/src/port1.0/portutil.tcl
    branches/dp2mp-move/base/src/programs/mtree/

Copied: branches/dp2mp-move/base (from rev 24327, trunk/base)

Deleted: branches/dp2mp-move/base/ChangeLog
===================================================================
--- trunk/base/ChangeLog	2007-04-22 07:33:59 UTC (rev 24327)
+++ branches/dp2mp-move/base/ChangeLog	2007-04-24 17:28:16 UTC (rev 24454)
@@ -1,535 +0,0 @@
-#
-#   $Id$
-#
-#   This is a log of major user-visible changes in each release
-#
-
-(unreleased):
-
-    - Fixed a bug where livecheck failed on ports that do not define a homepage
-      (ticket #11818, pguyot r24319).
-
-    - Added the downloads section of our repo to the macports mirrors list (jmpp r24278).
-
-    - Fixed a bug with the archive mode introduced with r23238 change (1.4.1)
-      (pguyot r24273).
-
-    - Trace mode now take dependencies into account when executing the activate
-      phase. This fixes an unwanted warning when activating ports that depend
-      on teTeX (pguyot r24199).
-      
-    - Support for mpwa submit through "port submit".
-      This work is in progress. (jberry)
-       - Expose autoconf XAR variable as portutil::autoconf::xar_path. (r24194).
-       - Start to build portpkg.xar and meta data, hijacking Kevin's
-         portsubmit.tcl. (r24195-24196).
-
-Release 1.4.3 (17-Apr-2007):
-
-    - Fix bug in launchd support, introduced in 1.4.2. Remove remnants of
-      launchd enable flag which caused reversion to systemstarter in 1.4.2.
-      (jberry r24151).
-      
-    - add functions 'backup' and 'lipo' along with some description
-      to be used for lipo-based universal variants, tested with openssl.
-      These functions should be considered test only for the time being,
-      and should not yet be adopted widely by port authors.
-      (pipping r24148).
-
-Release 1.4.2 (16-Apr-2007):
-
-    - New logic for variants overload that basically yields to listing only
-      variant +universal on ports that redefine it (pguyot in 24100).
-
-    - Implement brand new fs-traverse command in Pextlib.
-      See portfile.7 for documentation (eridius in r24079, r24080, and r24112).
-
-    - Add per-user preferences in ~/.macports/user.conf. This will be used
-      for submitter information.
-      Simplify selection of ports.conf file:
-        - ~/.portsrc is no longer supported.
-        - Search order for ports.conf is now:
-            - PORTSRC
-            - ~/.macports/ports.conf
-            - ${prefix}/etc/ports.conf
-          Only the first file found will be parsed and used.
-       (jberry r24071, r24113, r24114)
-
-    - Improvements on livecheck: fixed a report bug, improved ruby group
-      default behavior (pguyot in r24026 and r24018)
-      
-    - Remove xar from the build. xar doesn't build on panther due to
-      a libxml2 lib too old for xar requirements. We'll find another
-      way to deal with xar, perhaps by requiring users to install the
-      xar port when they need its services. (jberry r24107:r24108)
-      
-    - Remove configure switch for building launchd support. (jberry r24107:r24108)
-    
-    - Remove compatibility upgrade for conf files from
-      darwinports 1.1 to 1.2. (jberry r24106).
-
-Release 1.4.1 (14-Apr-2007):
-
-    - Add responsive, reasonably fast http mirrors to openbsd group
-      (pipping in r23343).
-
-    - Resolved ticket #11637: livecheck incorrectly assumed that
-      master_sites was set. (pguyot in r23329).
-
-    - Add xar 1.4 into the build of MacPorts base. xar is now installed
-      into /opt/local/, which will conflict with anybody who has the xar
-      port installed. (jberry in r23687).
-
-    - Add -I${prefix}/include -L${prefix}/lib to the default configure
-      flags (pguyot in r23246 and r23291).
-
-    - New options for configure flags (C|CPP|CXX|LD)FLAGS and logic to
-      handle that and backward compatibility (pguyot in r23098, r23125,
-      r23238, r23248 and r23249).
-
-    - "port sync" now updates svn repos too (eridius in r22784).
-
-    - Default +universal variant for configure-based ports (pguyot in
-      r22313).
-
-    - Fixed use of master_site in livecheck, added support for
-      code.google.com checks, made the up to date message info (instead of
-      debug) and improved debugging output with livecheck (eridius in
-      r23888, r23889, r23890, r23894; pguyot in 23660)
-
-    - Fixed a bug where running port test would not install dependencies
-      when required. (pguyot in r23700)
-
-    - New ruby portgroup option to specify the name of the module for
-      gem-based ports. (pguyot in 23659)
-
-    - New fetch option to ignore the SSL certificate when fetching from
-      a secure site (default is to not ignore it). (pguyot in r23242)
-
-    - Bugfix #11720. Fixes for variants.conf functionality. (jberry in
-      r23967)
-
-
-Release 1.4 (26-March-2007):
-
-    - New gnupg mirrors list and general cleanups to varios other lists (pipping in r22979 through r22982,
-      r22999, r23000 & r23037).
-
-    - Python 2.4 & Python 2.5 group code now offer a "python.include" variable (mww in r22914 & r22953).
-
-    - Resolved ticket #7563: The Pextlib curl command now sends a user agent, set to
-      "MacPorts libcurl/[libcurl version]" (eridius in r22771).
-
-    - Resolved ticket #11417: No longer touch the dep map file when opening it for reading (eridius in r22769).
-
-    - Archivemode now supports both tbz2 & tbz binary archives naming variations (jmpp in r22584).
-
-    - Add new alias 'registry_active' for registry::active so portfiles can check if another port is
-      installed and activated (eridius in r22304).
-
-    - Built-in 'find' command now always expects an expression as its first argument (jkh in r22048).
-
-    - with_docs variant of GNUStep PortGroup ports now installs the latex2html port by default (yves in r22014).
-
-    - Add new 'touch' & 'ln' portfile writing commands, their usage being similar to their BSD equivalents,
-      along with 'move' and 'copy' shorthands for TCL's "file rename/copy" calls (eridius in r22007).
-
-    - Fix a dangerous bug in parsing filenames with spaces in the the 'delete' command, while reworking it
-      to no longer be a plain 'system "rm -rf <path>"' call (eridius in r22007).
-
-    - Checksum phase no longer deletes distfiles upon checksums mistmatch, eliminating "file not found"
-      errors when a second run is attempted, thus making the need for a "port clean --dist" call more
-      explicit before continuing (eridius in r21967).
-
-    - Stating an empty key value in a Portfile now correctly clears it, as expected (eridius in r21950 & r21951).
-
-    - Documentation updates to the ports.conf.5 and portfile.7 man pages (markd, jmpp and others I may
-      be forgetting, sorry 'bout that, in r21998, referencing tickets #4905, #6880 & #10840).
-
-    - /Applications/DarwinPorts --> /Applications/MacPorts migration in base for aqua ports
-      (rhwood in r21852 and r21853, but other commits to this effect were also applied to trunk/dports)
-
-    - New SourceForge mirrors redirector and a few fallback geographically distributed hardcoded ones
-      to prevent disaster from happening, as suggested by Ross Turk (jkh in r21143 & jmpp in r21768).
-
-    - GNUStep PortGroup improvements and full documentation in portgroup.7 (yves in r21764).
-
-    - Xcode GroupCode improvements to ensure builds always take place inside the work dir (eridius in r21762).
-
-    - New 'macports' mirrors list, with entries pointing to svn's /distfiles/<user> &
-      /distfiles/general directories in our repo (eridius & jmpp in r21621).
-
-    - Iterate in darwinports_fastload using glob instead of hardcoding the library names (eridius in r21585).
-
-    - New Python 2.5 GroupCode (mww in r21451).
-
-    - Set upgrade.target back to archive (from unarchive) (dluke in r21110).
-
-    - rubyforge_gem fetch method for the Ruby PortGroup & livecheck support
-      (pguyot in r20544 & r20834, respectively).
-
-    - Resolved ticket #10843 (and probably #8229): initialize the portinfo array each time to improve
-      'port deps' and 'port variats' output (jberry in r19992).
-
-    - Resolved ticket #10766: improve error when no current port is available (jberry in r19665).
-
-    - Resolved ticket #8723: better messages for port outdated (jberry in r19664).
-
-
-Release 1.3.2 (9-Aug-2006):
-
-    - Fixed a bug that prevented operation of port ed with some editors.
-      The env wasn't being properly restored for the editor. (jberry)
-
-    - Fixed a bug in the creation of the portf symlink. (jmpp)
-
-    - Fixed a bug where port upgrade -uf fails because of the dirty upgrade
-      code. (pguyot)
-
-    - Port no longer warns when a shared distfile directory is emptied by a
-      clean --dist or clean --all, it now prunes the directory instead. (pguyot)
-
-    - Gem method of ruby portgroup now destroots from the worksrcdir, thus
-      avoiding an unnecessary warning with -t. (pguyot)
-
-    - Tell ld to look into /usr/local/lib when building port. This solves a
-      problem occurring when a newer version of readline is installed in
-      /usr/local. (pguyot)
-
-    - Added gnustep portgroup support. (Bugzilla #8139) (yves)
-
-    - Avoid sending Pragma: no cache when fetching files. (Bugzilla #8669)
-      (josh_root, blb)
-
-    - Changed Makefile logic to reconfigure/regenerate files when templates
-      are modified. (pguyot)
-    
-    - Trace now forbids renaming files and directories as well as removing
-      directories outside the sandbox. (pguyot)
-
-    - Allow additional inserted libraries by keeping DYLD_INSERT_LIBRARIES
-      variable. (pguyot)
-      
-    - Change some UI strings and documentation to read MacPorts, rather than
-      DarwinPorts. The project is adopting the new name "MacPorts", and will
-      be using the macports.org domain in the future.
-
-Release 1.3.1 (31-Jul-2006):
-
-    - Fixed a bug in livecheck sourceforge guess algorithm. (pguyot)
-
-    - Fixed an incompatibility of darwintrace.c with MacOS X 10.3. Darwintrace.c
-      now also compiles on Linux. (pguyot)
-
-    - Fixed a bug introduced by a patch to the fetch code. Now, fetch target
-      can really deal with patch files even if the main fetch method is CVS or
-      SVN. (pguyot)
-
-    - Fixed a bug, introduced in 1.3, that prevented -f selfupdate from forcing
-      a build of the fetched sources. (jberry)
-      
-    - Fixed a bug, introduced in 1.3, that prevented -u uninstall from working.
-      (jberry)
-
-    - Fixed a bug in xcode portgroup. One variable used by the group conflicted
-      with global variables in port base code. (pguyot)
-
-    - Added a new test case for a cvs+remote patch file bug. (pguyot)
-    
-    - Added ruby gems support for ruby group. (rcavanaugh & pguyot)
-
-    - Trace now forbids creation of directories outside the sandbox. (pguyot)
-    
-    - Additions to man page for port(1): (jberry)
-       * new port options -F, -i, -x, -p
-       * mention interactive and batch modes
-       * document extensions to info command.
-    
-    - Archive mode is now disabled by default. (landonf)
-
-    - The upgrade target now properly detects and uses a matching binary
-      archive if found, an uninstall && install combination needed up till
-      now to pick it up. (jmpp)
-    
-Release 1.3 (27-Jul-2006):
-
-    - Fixed a bug where only the first word of configuration settings (in
-      ports.conf) was processed. This bug affected the use of extra_env.
-      (Bugzilla #9948) (pguyot)
-
-    - Fixed a bug where environment variables governing proxy were not
-      capitalized properly. (blb & jberry)
-
-    - Fixed a bug where port outdated and port ugprade didn't work in direct
-      mode. (Bugzilla 7719, 7721) (dluke & jberry)
-
-    - Fixed several problems with iteration on ports. (jberry)
-    
-    - Fixed a bug where curl LDFLAGS weren't properly propagated. (landonf)
-    
-    - Fixed a bug where location update routine invoked when installing DP did
-      not take the DESTDIR variable into account. (jmpp)
-
-    - Fixed a bug where patchfiles specifications could not have suffixes to
-      indicate the master site. (pguyot)
-    
-    - Fixed spelling in port(1) man page. (Bugzilla 8103) (pjenvey & jberry)
-    
-    - Fixed a typo and another problem in messages generated by port command.
-      (Bugzilla 6706 & 6712) (deric & jmpp)
-    
-    - Fixed a typo in ports.conf. (matt & jmpp)
-    
-    - Fixed several problems with launchd support (Bugzilla 8372 & 10041)
-      (jberry)
-
-    - Fixed a bug preventing the use of libmd for checksums and added an
-      informative compilation error if libcrypto and libmd cannot be found.
-      (landonf)
-    
-    - Fixed a bug where thread2.6 Tcl library wasn't installed where DP is
-      installed. (jmpp)
-
-    - Fixed a bug in xcode PortGroup which prevented the use of a custom
-      project path. (pguyot)
-    
-    - Fixed a bug in xcode PortGroup which made destroot to fail when there
-      were spaces in the install path. (pguyot)
-
-    - Fixed a bug in portfetch.tcl which failed to fetch patches when using
-      CVS or SVN. (Bugzilla 5269) (yeled)
-    
-    - Added new command 'delete' for use in Portfiles instead of
-      'file delete' and 'system "rm.."' (mww)
-
-    - Added more information to porthier(7) about ${prefix}/var/db/dports.
-      (olegb)
-    
-    - Updated Gnome, KDE and SourceForge mirror lists. (Bugzilla 8045, 9152)
-      (rwhood, blb, olegb & pguyot)
-
-    - Check earlier if there is no Portfile in a directory (especially when
-      iterating). (jberry)
-
-    - Split livecheck into distcheck and livecheck. Added two regular expression
-      modes (one line, full file), set the default to check against freshmeat
-      and defined the default for perl5 group. (pguyot)
-
-    - Discover path to rsync at autoconf time. (jberry)
-    
-    - Mark CVS, TAR, GNUTAR, and RSYNC as additional precious variables that can
-      be overridden in configure environment at time of configure to customize
-      the location of these tools. Note that these tools are not found in the dp
-      prefix, as PATH is sanitized of references to prefix. But you could
-      override the precious variables to acheive that if you really want to
-      shoot yourself. (jberry)
-
-    - Set timeouts for curl transfers.  Some connections to sketchy mirror sites
-      can hang forever otherwise. (jkh)
-    
-    - Shortened the time to upgrade with archive mode on by using archive as the
-      target. (Bugzilla #7891) (dluke & jberry)
-
-    - Added support for sqlite 3. (jberry)
-
-    - Major update of the trace (-t) option (pguyot):
-      * backported changes from darwinbuild's version of darwintrace, including
-        several bug fixes.
-      * cleaned up the code.
-      * writing/creating and also unlinking a file outside allowed bounds are
-        now blocked instead of being simply reported (previous version only
-        reported creations).
-      * fixed a bug where -t failed with X11 ports because ${prefix} got
-        overwritten.
-
-    - Added new native commands to handle privileges chores. (jberry)
-    
-    - Add batch/interactive mode. In interactive mode, use readline when it's available.
-      Command and portname completion is available in interactive mode, as is readline
-      history. (jberry) 2005-11-07,08
-    
-        * Add new option -F <filename> which specifies a command file to be
-          read and processed. Multiple such options may be given to provide
-          multiple command files. If filename is "-", then stdin is read.
-      
-        * Option -i is equivilant to -F -, which forces processing of standard
-          input following any commands given as arguments.
-          
-        * If port is invoked as portf, an -F is assumed as an implicit first
-          argument (so the real first argument is taken as a command file to
-          be processed). This should allow the use of a shebang line such as:
-            #!/usr/bin/env portf
-            
-        * Commands starting with # are treated as comments.
-        
-        * Install a symbolic link /opt/local/bin/portf --> /opt/local/bin/port.
-        
-        * New command "cd" is useful to change to a new directory/port while in
-          interactive/batch mode.
-          
-        * Multiple commands on a single line may be separated by a ';'
-        
-        * Global command options may now be specified following a particular
-          command; they will apply only to that command rather than to all
-          command invocations. This is important for batch/interactive mode.
-        
-    - Add new option -p, which ignores errors while processing within a command.
-      (this subsumes some of the work that -f was previously overloaded to do).
-      (jberry).
-    
-    - Add new option -x, which exits immediately on errors while in batch mode (
-      otherwise we don't exit on errors in batch mode). (jberry)
-    
-    - Refactoring of port(1) to cast actions into distinct action procs. Adds
-      the new action_array which is used for action dispatch, and also to generate
-      the list of possible commands for help and command completion. (jberry)
-    
-    - Initial version of portmirror binary to build a mirror of distfiles.
-      (pguyot)
-
-    - Improvements and fixes to the tests. (pguyot)
-    
-    - Added a new option (checksum.skip=yes) to bypass the checksum phase. This
-      option is mostly useful on the command line to test older distfiles.
-      (jberry)
-
-    - Added dependencies for rpm on virtual packages representing releases of
-      MacOS X. (mww)
-      
-    - Add to port the ability to query for specific meta-data fields.
-      For instance: port info --maintainer --name category:java
-      When specific fields are given, the legacy generalized info is not presented, and vis-versa.
-      By default, the fields for each port are listed one-per-line, with a field label
-      in front of each. (The field label is omitted if the global -q option is given).
-      If the --line option is given, the fields are presented on one line, tab separated,
-      and with no field label: port info --name --maintainer --line tomcat5 apache2
-      Field names are those from the PortIndex, plus some convenience versions of
-      those: (such as allowing category instead of categories).
-      Fields which are actually lists (such as depends_lib) are displayed comma-separated.
-      (jberry) 2006-02-16
-      
-Release 1.2.1 (10-Apr-2006):
-
-    - Changes to darwinports build infrastructure to allow for build of
-      the darwinports infrastructure as a multiarchitecture binary.
-      This allows darwinports to be built as fat, but does nothing to
-      allow ports themselves to be built as fat. To build darwinports
-      fat, configure as follows:
-        ./configure CFLAGS='-arch ppc -arch i386' SHLIB_LDFLAGS='-arch ppc -arch i386'
-                                        backported from HEAD (jberry)
-                                        
-    - Add a hack in order attempt to detect when a sourceforge mirror
-      is actually returning an error page. If this is detected, proceed
-      to the next mirror.               backported from HEAD (jberry)
-
-Release 1.2 (14-Dec-2005):
-
-    - Syntax change to disambiguate uses of the port's version on the command
-      line, when coupled with new changes to accept multiple ports.
-      The port version must now always be prefixed with an @. Example:
-        port uninstall vim @1.0
-      This probably only affects uninstall and activate, both of which
-      require a version if there are multiple versions installed.
-
-    - gzip-compress manpages that are in the share/man/cat? directories during
-      destroot, too. (mww)
-
-    - Enhance port command such that targets that require a port to be
-      specified will now all default to a port in current directory. (jberry)
-      
-    - Enhance port command to allow multiple ports per invocation.
-      Where previously one said "port install porta; port install portb", 
-      one can now say "port install porta portb". (jberry)
-      
-    - Enhance port command to allow use of shell-like glob patterns for
-      port selection. When a glob pattern is found, the group of ports
-      matching the glob pattern is substituted. (jberry)
-      
-    - Enhance port command to allow use of "pseudo" portnames to specify
-      groups of ports.
-      When one of these pseudo portnames is specified on the command line,
-      the corresponding group of ports is substituted.
-
-      Currently defined pseudo portnames are:
-        current, all, installed, uninstalled, active, inactive, outdated.
-      
-      Additional pseudo portnames can be used to select ports based on a
-      regex pattern match against certain criteria. Each port selector is
-      a name, followed by a colon, followed by the desired regex pattern.
-      The selectors are:
-      variants:, variant:, description:, portdir:, homepage:, epoch:,
-      platforms:, platform:, name:, long_description:, maintainers:, maintainer:,
-      categories:, category:, version:, and revision: (jberry)
-      
-    - Enhance port command to allow use of set expressions to combine
-      ports or groups of ports.
-      Supported operators are "and", "or", "not", "!", "(", ")". (jberry)
-      
-    - Enhance port command to allow a port to be specified through a file:
-      url instead of via portname. This function was previously available
-      though the -D and -u options, which make less sense now that multiple
-      ports can be specified to a target. (jberry)
-      
-    - Under Tiger, startupitems are now by default generated for launchd
-      rather than systemstarter. (jberry)
-      
-    - Add new startupitem keys startupitem.executable, startupitem.logfile,
-      startupitem.logevents, startupitem.pidfile, supported for both
-      systemstarter and launchd. (jberry)
-      
-    - New Test framework. Running make test from base/tests/ will test
-      several features of port(1) including syntax of Portfiles. New tests
-      can easily be added by simply creating new directories in base/tests/
-      with a Portfile and a master file containing the output of port test
-      in this directory. Some tests are actually more complex. These tests
-      require the port binary to be installed in ${prefix}. (pguyot)
-
-    - svn fetching support, parallel to cvs fetching. Note that
-      this is a bit skanky as svn is not installed on the platform by default.
-      This code will error-out if svn is not installed. (jberry)
-
-    - Removal of old "fetch.args" parameter now that all Portfiles have been
-      properly moved to leverage Paul's libcurl work (yeled)
-
-    - DP now sets its own env variables instead of filtering user declared
-      ones considered harmful (blb)
-
-    - "Canonicalization" of expanded path:${prefix}/foo:bar dependencies
-      when including them in the PortIndex for better abstraction (jberry/pguyot)
-
-    - Addition of the IndexRegen.sh script that takes care of the automated
-      index thingie... (pguyot and jmpp)
-
-    - Miscellaneous cleanups:
-        - DP base is assured to respect a temporary DESTDIR installation and
-          other Makefile cleanups (toby, jmpp)
-        - s/--with-tclpackagedir/--with-tclpackage/g in autoconf error
-          reports (pguyot)
-        - fixes for the buildall.sh script (jkh)
-
-    - Some other fixes for lurking bugs, untapped by the various developments
-      that have taken place since 1.1 ("bunch of developers ;-);
-
-    - Snazzy new ChangeLog file
-    
-    - Add new actions for port(1): help (get help about port),
-      echo (the expanded arguments),
-      cat (the contents of the Portfiles from the specified ports),
-      edit (also alias "ed", the contents of the Portfiles, using EDITOR or VISUAL),
-      dir (emit path to the port's directory),
-      file (emit path to the port's Portfile)
-      (jberry)
-      
-    - On make install, upgrade ports.conf and sources.conf to change rsync.opendarwin.org
-      to rsync.darwinports.org. This is now our preferred rsync hostname.
-      Likewise, rename the rsync destination directories in ${prefix}/var/db/dports/sources
-      in a similar fashion (jberry)
-
-
-Release 1.1:
-
-    (information not here).
-    
-Release 1.0:
-    
-    (information not here).

Copied: branches/dp2mp-move/base/ChangeLog (from rev 24448, trunk/base/ChangeLog)
===================================================================
--- branches/dp2mp-move/base/ChangeLog	                        (rev 0)
+++ branches/dp2mp-move/base/ChangeLog	2007-04-24 17:28:16 UTC (rev 24454)
@@ -0,0 +1,556 @@
+#
+#   $Id$
+#
+#   This is a log of major user-visible changes in each release
+#
+
+(unreleased):
+
+    - ln now accepts combined flags (ex. ln -sf foo bar) (eridius r24452)
+
+    - default_variants now handles multiple values correctly (ticket #11828, eridius r24450).
+
+    - ln uses new symlink command so it can create symlinks that point to
+      files that don't actually exist (eridius r24444).
+
+    - New bare-bones Pextlib command `symlink source target` (ticket #11840, eridius r24444).
+
+    - delete reimplemented using fs-traverse (eridius r24435).
+
+    - fs-traverse now uses the fts(3) family of functions instead of readdir/opendir.
+      This fixes a couple behavioral oddities, and makes deleting during traversal work on 10.3
+      (ticket #11839, eridius r24423).
+
+    - fs-traverse now takes a list of targets rather than a variable number of arguments
+      (ticket #11836, eridius r24410).
+
+    - Fixed a potential crasher in fs-traverse when showing error message
+      (ticket #11827, eridius r24396, thanks sfiera).
+    
+    - Fixed a bug where livecheck failed on ports that do not define a homepage
+      (ticket #11818, pguyot r24319).
+
+    - Added the downloads section of our repo to the macports mirrors list (jmpp r24278).
+
+    - Fixed a bug with the archive mode introduced with r23238 change (1.4.1)
+      (pguyot r24273).
+
+    - Trace mode now take dependencies into account when executing the activate
+      phase. This fixes an unwanted warning when activating ports that depend
+      on teTeX (pguyot r24199).
+      
+    - Support for mpwa submit through "port submit".
+      This work is in progress. (jberry)
+       - Expose autoconf XAR variable as portutil::autoconf::xar_path. (r24194).
+       - Start to build portpkg.xar and meta data, hijacking Kevin's
+         portsubmit.tcl. (r24195-24196).
+
+Release 1.4.3 (17-Apr-2007):
+
+    - Fix bug in launchd support, introduced in 1.4.2. Remove remnants of
+      launchd enable flag which caused reversion to systemstarter in 1.4.2.
+      (jberry r24151).
+      
+    - add functions 'backup' and 'lipo' along with some description
+      to be used for lipo-based universal variants, tested with openssl.
+      These functions should be considered test only for the time being,
+      and should not yet be adopted widely by port authors.
+      (pipping r24148).
+
+Release 1.4.2 (16-Apr-2007):
+
+    - New logic for variants overload that basically yields to listing only
+      variant +universal on ports that redefine it (pguyot in 24100).
+
+    - Implement brand new fs-traverse command in Pextlib.
+      See portfile.7 for documentation (eridius in r24079, r24080, and r24112).
+
+    - Add per-user preferences in ~/.macports/user.conf. This will be used
+      for submitter information.
+      Simplify selection of ports.conf file:
+        - ~/.portsrc is no longer supported.
+        - Search order for ports.conf is now:
+            - PORTSRC
+            - ~/.macports/ports.conf
+            - ${prefix}/etc/ports.conf
+          Only the first file found will be parsed and used.
+       (jberry r24071, r24113, r24114)
+
+    - Improvements on livecheck: fixed a report bug, improved ruby group
+      default behavior (pguyot in r24026 and r24018)
+      
+    - Remove xar from the build. xar doesn't build on panther due to
+      a libxml2 lib too old for xar requirements. We'll find another
+      way to deal with xar, perhaps by requiring users to install the
+      xar port when they need its services. (jberry r24107:r24108)
+      
+    - Remove configure switch for building launchd support. (jberry r24107:r24108)
+    
+    - Remove compatibility upgrade for conf files from
+      darwinports 1.1 to 1.2. (jberry r24106).
+
+Release 1.4.1 (14-Apr-2007):
+
+    - Add responsive, reasonably fast http mirrors to openbsd group
+      (pipping in r23343).
+
+    - Resolved ticket #11637: livecheck incorrectly assumed that
+      master_sites was set. (pguyot in r23329).
+
+    - Add xar 1.4 into the build of MacPorts base. xar is now installed
+      into /opt/local/, which will conflict with anybody who has the xar
+      port installed. (jberry in r23687).
+
+    - Add -I${prefix}/include -L${prefix}/lib to the default configure
+      flags (pguyot in r23246 and r23291).
+
+    - New options for configure flags (C|CPP|CXX|LD)FLAGS and logic to
+      handle that and backward compatibility (pguyot in r23098, r23125,
+      r23238, r23248 and r23249).
+
+    - "port sync" now updates svn repos too (eridius in r22784).
+
+    - Default +universal variant for configure-based ports (pguyot in
+      r22313).
+
+    - Fixed use of master_site in livecheck, added support for
+      code.google.com checks, made the up to date message info (instead of
+      debug) and improved debugging output with livecheck (eridius in
+      r23888, r23889, r23890, r23894; pguyot in 23660)
+
+    - Fixed a bug where running port test would not install dependencies
+      when required. (pguyot in r23700)
+
+    - New ruby portgroup option to specify the name of the module for
+      gem-based ports. (pguyot in 23659)
+
+    - New fetch option to ignore the SSL certificate when fetching from
+      a secure site (default is to not ignore it). (pguyot in r23242)
+
+    - Bugfix #11720. Fixes for variants.conf functionality. (jberry in
+      r23967)
+
+
+Release 1.4 (26-March-2007):
+
+    - New gnupg mirrors list and general cleanups to varios other lists (pipping in r22979 through r22982,
+      r22999, r23000 & r23037).
+
+    - Python 2.4 & Python 2.5 group code now offer a "python.include" variable (mww in r22914 & r22953).
+
+    - Resolved ticket #7563: The Pextlib curl command now sends a user agent, set to
+      "MacPorts libcurl/[libcurl version]" (eridius in r22771).
+
+    - Resolved ticket #11417: No longer touch the dep map file when opening it for reading (eridius in r22769).
+
+    - Archivemode now supports both tbz2 & tbz binary archives naming variations (jmpp in r22584).
+
+    - Add new alias 'registry_active' for registry::active so portfiles can check if another port is
+      installed and activated (eridius in r22304).
+
+    - Built-in 'find' command now always expects an expression as its first argument (jkh in r22048).
+
+    - with_docs variant of GNUStep PortGroup ports now installs the latex2html port by default (yves in r22014).
+
+    - Add new 'touch' & 'ln' portfile writing commands, their usage being similar to their BSD equivalents,
+      along with 'move' and 'copy' shorthands for TCL's "file rename/copy" calls (eridius in r22007).
+
+    - Fix a dangerous bug in parsing filenames with spaces in the the 'delete' command, while reworking it
+      to no longer be a plain 'system "rm -rf <path>"' call (eridius in r22007).
+
+    - Checksum phase no longer deletes distfiles upon checksums mistmatch, eliminating "file not found"
+      errors when a second run is attempted, thus making the need for a "port clean --dist" call more
+      explicit before continuing (eridius in r21967).
+
+    - Stating an empty key value in a Portfile now correctly clears it, as expected (eridius in r21950 & r21951).
+
+    - Documentation updates to the ports.conf.5 and portfile.7 man pages (markd, jmpp and others I may
+      be forgetting, sorry 'bout that, in r21998, referencing tickets #4905, #6880 & #10840).
+
+    - /Applications/DarwinPorts --> /Applications/MacPorts migration in base for aqua ports
+      (rhwood in r21852 and r21853, but other commits to this effect were also applied to trunk/dports)
+
+    - New SourceForge mirrors redirector and a few fallback geographically distributed hardcoded ones
+      to prevent disaster from happening, as suggested by Ross Turk (jkh in r21143 & jmpp in r21768).
+
+    - GNUStep PortGroup improvements and full documentation in portgroup.7 (yves in r21764).
+
+    - Xcode GroupCode improvements to ensure builds always take place inside the work dir (eridius in r21762).
+
+    - New 'macports' mirrors list, with entries pointing to svn's /distfiles/<user> &
+      /distfiles/general directories in our repo (eridius & jmpp in r21621).
+
+    - Iterate in darwinports_fastload using glob instead of hardcoding the library names (eridius in r21585).
+
+    - New Python 2.5 GroupCode (mww in r21451).
+
+    - Set upgrade.target back to archive (from unarchive) (dluke in r21110).
+
+    - rubyforge_gem fetch method for the Ruby PortGroup & livecheck support
+      (pguyot in r20544 & r20834, respectively).
+
+    - Resolved ticket #10843 (and probably #8229): initialize the portinfo array each time to improve
+      'port deps' and 'port variats' output (jberry in r19992).
+
+    - Resolved ticket #10766: improve error when no current port is available (jberry in r19665).
+
+    - Resolved ticket #8723: better messages for port outdated (jberry in r19664).
+
+
+Release 1.3.2 (9-Aug-2006):
+
+    - Fixed a bug that prevented operation of port ed with some editors.
+      The env wasn't being properly restored for the editor. (jberry)
+
+    - Fixed a bug in the creation of the portf symlink. (jmpp)
+
+    - Fixed a bug where port upgrade -uf fails because of the dirty upgrade
+      code. (pguyot)
+
+    - Port no longer warns when a shared distfile directory is emptied by a
+      clean --dist or clean --all, it now prunes the directory instead. (pguyot)
+
+    - Gem method of ruby portgroup now destroots from the worksrcdir, thus
+      avoiding an unnecessary warning with -t. (pguyot)
+
+    - Tell ld to look into /usr/local/lib when building port. This solves a
+      problem occurring when a newer version of readline is installed in
+      /usr/local. (pguyot)
+
+    - Added gnustep portgroup support. (Bugzilla #8139) (yves)
+
+    - Avoid sending Pragma: no cache when fetching files. (Bugzilla #8669)
+      (josh_root, blb)
+
+    - Changed Makefile logic to reconfigure/regenerate files when templates
+      are modified. (pguyot)
+    
+    - Trace now forbids renaming files and directories as well as removing
+      directories outside the sandbox. (pguyot)
+
+    - Allow additional inserted libraries by keeping DYLD_INSERT_LIBRARIES
+      variable. (pguyot)
+      
+    - Change some UI strings and documentation to read MacPorts, rather than
+      DarwinPorts. The project is adopting the new name "MacPorts", and will
+      be using the macports.org domain in the future.
+
+Release 1.3.1 (31-Jul-2006):
+
+    - Fixed a bug in livecheck sourceforge guess algorithm. (pguyot)
+
+    - Fixed an incompatibility of darwintrace.c with MacOS X 10.3. Darwintrace.c
+      now also compiles on Linux. (pguyot)
+
+    - Fixed a bug introduced by a patch to the fetch code. Now, fetch target
+      can really deal with patch files even if the main fetch method is CVS or
+      SVN. (pguyot)
+
+    - Fixed a bug, introduced in 1.3, that prevented -f selfupdate from forcing
+      a build of the fetched sources. (jberry)
+      
+    - Fixed a bug, introduced in 1.3, that prevented -u uninstall from working.
+      (jberry)
+
+    - Fixed a bug in xcode portgroup. One variable used by the group conflicted
+      with global variables in port base code. (pguyot)
+
+    - Added a new test case for a cvs+remote patch file bug. (pguyot)
+    
+    - Added ruby gems support for ruby group. (rcavanaugh & pguyot)
+
+    - Trace now forbids creation of directories outside the sandbox. (pguyot)
+    
+    - Additions to man page for port(1): (jberry)
+       * new port options -F, -i, -x, -p
+       * mention interactive and batch modes
+       * document extensions to info command.
+    
+    - Archive mode is now disabled by default. (landonf)
+
+    - The upgrade target now properly detects and uses a matching binary
+      archive if found, an uninstall && install combination needed up till
+      now to pick it up. (jmpp)
+    
+Release 1.3 (27-Jul-2006):
+
+    - Fixed a bug where only the first word of configuration settings (in
+      ports.conf) was processed. This bug affected the use of extra_env.
+      (Bugzilla #9948) (pguyot)
+
+    - Fixed a bug where environment variables governing proxy were not
+      capitalized properly. (blb & jberry)
+
+    - Fixed a bug where port outdated and port ugprade didn't work in direct
+      mode. (Bugzilla 7719, 7721) (dluke & jberry)
+
+    - Fixed several problems with iteration on ports. (jberry)
+    
+    - Fixed a bug where curl LDFLAGS weren't properly propagated. (landonf)
+    
+    - Fixed a bug where location update routine invoked when installing DP did
+      not take the DESTDIR variable into account. (jmpp)
+
+    - Fixed a bug where patchfiles specifications could not have suffixes to
+      indicate the master site. (pguyot)
+    
+    - Fixed spelling in port(1) man page. (Bugzilla 8103) (pjenvey & jberry)
+    
+    - Fixed a typo and another problem in messages generated by port command.
+      (Bugzilla 6706 & 6712) (deric & jmpp)
+    
+    - Fixed a typo in ports.conf. (matt & jmpp)
+    
+    - Fixed several problems with launchd support (Bugzilla 8372 & 10041)
+      (jberry)
+
+    - Fixed a bug preventing the use of libmd for checksums and added an
+      informative compilation error if libcrypto and libmd cannot be found.
+      (landonf)
+    
+    - Fixed a bug where thread2.6 Tcl library wasn't installed where DP is
+      installed. (jmpp)
+
+    - Fixed a bug in xcode PortGroup which prevented the use of a custom
+      project path. (pguyot)
+    
+    - Fixed a bug in xcode PortGroup which made destroot to fail when there
+      were spaces in the install path. (pguyot)
+
+    - Fixed a bug in portfetch.tcl which failed to fetch patches when using
+      CVS or SVN. (Bugzilla 5269) (yeled)
+    
+    - Added new command 'delete' for use in Portfiles instead of
+      'file delete' and 'system "rm.."' (mww)
+
+    - Added more information to porthier(7) about ${prefix}/var/db/dports.
+      (olegb)
+    
+    - Updated Gnome, KDE and SourceForge mirror lists. (Bugzilla 8045, 9152)
+      (rwhood, blb, olegb & pguyot)
+
+    - Check earlier if there is no Portfile in a directory (especially when
+      iterating). (jberry)
+
+    - Split livecheck into distcheck and livecheck. Added two regular expression
+      modes (one line, full file), set the default to check against freshmeat
+      and defined the default for perl5 group. (pguyot)
+
+    - Discover path to rsync at autoconf time. (jberry)
+    
+    - Mark CVS, TAR, GNUTAR, and RSYNC as additional precious variables that can
+      be overridden in configure environment at time of configure to customize
+      the location of these tools. Note that these tools are not found in the dp
+      prefix, as PATH is sanitized of references to prefix. But you could
+      override the precious variables to acheive that if you really want to
+      shoot yourself. (jberry)
+
+    - Set timeouts for curl transfers.  Some connections to sketchy mirror sites
+      can hang forever otherwise. (jkh)
+    
+    - Shortened the time to upgrade with archive mode on by using archive as the
+      target. (Bugzilla #7891) (dluke & jberry)
+
+    - Added support for sqlite 3. (jberry)
+
+    - Major update of the trace (-t) option (pguyot):
+      * backported changes from darwinbuild's version of darwintrace, including
+        several bug fixes.
+      * cleaned up the code.
+      * writing/creating and also unlinking a file outside allowed bounds are
+        now blocked instead of being simply reported (previous version only
+        reported creations).
+      * fixed a bug where -t failed with X11 ports because ${prefix} got
+        overwritten.
+
+    - Added new native commands to handle privileges chores. (jberry)
+    
+    - Add batch/interactive mode. In interactive mode, use readline when it's available.
+      Command and portname completion is available in interactive mode, as is readline
+      history. (jberry) 2005-11-07,08
+    
+        * Add new option -F <filename> which specifies a command file to be
+          read and processed. Multiple such options may be given to provide
+          multiple command files. If filename is "-", then stdin is read.
+      
+        * Option -i is equivilant to -F -, which forces processing of standard
+          input following any commands given as arguments.
+          
+        * If port is invoked as portf, an -F is assumed as an implicit first
+          argument (so the real first argument is taken as a command file to
+          be processed). This should allow the use of a shebang line such as:
+            #!/usr/bin/env portf
+            
+        * Commands starting with # are treated as comments.
+        
+        * Install a symbolic link /opt/local/bin/portf --> /opt/local/bin/port.
+        
+        * New command "cd" is useful to change to a new directory/port while in
+          interactive/batch mode.
+          
+        * Multiple commands on a single line may be separated by a ';'
+        
+        * Global command options may now be specified following a particular
+          command; they will apply only to that command rather than to all
+          command invocations. This is important for batch/interactive mode.
+        
+    - Add new option -p, which ignores errors while processing within a command.
+      (this subsumes some of the work that -f was previously overloaded to do).
+      (jberry).
+    
+    - Add new option -x, which exits immediately on errors while in batch mode (
+      otherwise we don't exit on errors in batch mode). (jberry)
+    
+    - Refactoring of port(1) to cast actions into distinct action procs. Adds
+      the new action_array which is used for action dispatch, and also to generate
+      the list of possible commands for help and command completion. (jberry)
+    
+    - Initial version of portmirror binary to build a mirror of distfiles.
+      (pguyot)
+
+    - Improvements and fixes to the tests. (pguyot)
+    
+    - Added a new option (checksum.skip=yes) to bypass the checksum phase. This
+      option is mostly useful on the command line to test older distfiles.
+      (jberry)
+
+    - Added dependencies for rpm on virtual packages representing releases of
+      MacOS X. (mww)
+      
+    - Add to port the ability to query for specific meta-data fields.
+      For instance: port info --maintainer --name category:java
+      When specific fields are given, the legacy generalized info is not presented, and vis-versa.
+      By default, the fields for each port are listed one-per-line, with a field label
+      in front of each. (The field label is omitted if the global -q option is given).
+      If the --line option is given, the fields are presented on one line, tab separated,
+      and with no field label: port info --name --maintainer --line tomcat5 apache2
+      Field names are those from the PortIndex, plus some convenience versions of
+      those: (such as allowing category instead of categories).
+      Fields which are actually lists (such as depends_lib) are displayed comma-separated.
+      (jberry) 2006-02-16
+      
+Release 1.2.1 (10-Apr-2006):
+
+    - Changes to darwinports build infrastructure to allow for build of
+      the darwinports infrastructure as a multiarchitecture binary.
+      This allows darwinports to be built as fat, but does nothing to
+      allow ports themselves to be built as fat. To build darwinports
+      fat, configure as follows:
+        ./configure CFLAGS='-arch ppc -arch i386' SHLIB_LDFLAGS='-arch ppc -arch i386'
+                                        backported from HEAD (jberry)
+                                        
+    - Add a hack in order attempt to detect when a sourceforge mirror
+      is actually returning an error page. If this is detected, proceed
+      to the next mirror.               backported from HEAD (jberry)
+
+Release 1.2 (14-Dec-2005):
+
+    - Syntax change to disambiguate uses of the port's version on the command
+      line, when coupled with new changes to accept multiple ports.
+      The port version must now always be prefixed with an @. Example:
+        port uninstall vim @1.0
+      This probably only affects uninstall and activate, both of which
+      require a version if there are multiple versions installed.
+
+    - gzip-compress manpages that are in the share/man/cat? directories during
+      destroot, too. (mww)
+
+    - Enhance port command such that targets that require a port to be
+      specified will now all default to a port in current directory. (jberry)
+      
+    - Enhance port command to allow multiple ports per invocation.
+      Where previously one said "port install porta; port install portb", 
+      one can now say "port install porta portb". (jberry)
+      
+    - Enhance port command to allow use of shell-like glob patterns for
+      port selection. When a glob pattern is found, the group of ports
+      matching the glob pattern is substituted. (jberry)
+      
+    - Enhance port command to allow use of "pseudo" portnames to specify
+      groups of ports.
+      When one of these pseudo portnames is specified on the command line,
+      the corresponding group of ports is substituted.
+
+      Currently defined pseudo portnames are:
+        current, all, installed, uninstalled, active, inactive, outdated.
+      
+      Additional pseudo portnames can be used to select ports based on a
+      regex pattern match against certain criteria. Each port selector is
+      a name, followed by a colon, followed by the desired regex pattern.
+      The selectors are:
+      variants:, variant:, description:, portdir:, homepage:, epoch:,
+      platforms:, platform:, name:, long_description:, maintainers:, maintainer:,
+      categories:, category:, version:, and revision: (jberry)
+      
+    - Enhance port command to allow use of set expressions to combine
+      ports or groups of ports.
+      Supported operators are "and", "or", "not", "!", "(", ")". (jberry)
+      
+    - Enhance port command to allow a port to be specified through a file:
+      url instead of via portname. This function was previously available
+      though the -D and -u options, which make less sense now that multiple
+      ports can be specified to a target. (jberry)
+      
+    - Under Tiger, startupitems are now by default generated for launchd
+      rather than systemstarter. (jberry)
+      
+    - Add new startupitem keys startupitem.executable, startupitem.logfile,
+      startupitem.logevents, startupitem.pidfile, supported for both
+      systemstarter and launchd. (jberry)
+      
+    - New Test framework. Running make test from base/tests/ will test
+      several features of port(1) including syntax of Portfiles. New tests
+      can easily be added by simply creating new directories in base/tests/
+      with a Portfile and a master file containing the output of port test
+      in this directory. Some tests are actually more complex. These tests
+      require the port binary to be installed in ${prefix}. (pguyot)
+
+    - svn fetching support, parallel to cvs fetching. Note that
+      this is a bit skanky as svn is not installed on the platform by default.
+      This code will error-out if svn is not installed. (jberry)
+
+    - Removal of old "fetch.args" parameter now that all Portfiles have been
+      properly moved to leverage Paul's libcurl work (yeled)
+
+    - DP now sets its own env variables instead of filtering user declared
+      ones considered harmful (blb)
+
+    - "Canonicalization" of expanded path:${prefix}/foo:bar dependencies
+      when including them in the PortIndex for better abstraction (jberry/pguyot)
+
+    - Addition of the IndexRegen.sh script that takes care of the automated
+      index thingie... (pguyot and jmpp)
+
+    - Miscellaneous cleanups:
+        - DP base is assured to respect a temporary DESTDIR installation and
+          other Makefile cleanups (toby, jmpp)
+        - s/--with-tclpackagedir/--with-tclpackage/g in autoconf error
+          reports (pguyot)
+        - fixes for the buildall.sh script (jkh)
+
+    - Some other fixes for lurking bugs, untapped by the various developments
+      that have taken place since 1.1 ("bunch of developers ;-);
+
+    - Snazzy new ChangeLog file
+    
+    - Add new actions for port(1): help (get help about port),
+      echo (the expanded arguments),
+      cat (the contents of the Portfiles from the specified ports),
+      edit (also alias "ed", the contents of the Portfiles, using EDITOR or VISUAL),
+      dir (emit path to the port's directory),
+      file (emit path to the port's Portfile)
+      (jberry)
+      
+    - On make install, upgrade ports.conf and sources.conf to change rsync.opendarwin.org
+      to rsync.darwinports.org. This is now our preferred rsync hostname.
+      Likewise, rename the rsync destination directories in ${prefix}/var/db/dports/sources
+      in a similar fashion (jberry)
+
+
+Release 1.1:
+
+    (information not here).
+    
+Release 1.0:
+    
+    (information not here).

Modified: branches/dp2mp-move/base/Makefile.in
===================================================================
--- trunk/base/Makefile.in	2007-04-22 07:33:59 UTC (rev 24327)
+++ branches/dp2mp-move/base/Makefile.in	2007-04-24 17:28:16 UTC (rev 24454)
@@ -7,11 +7,11 @@
 DISTARCNAME	= ${DISTNAME}-archive
 SVNURL		= http://svn.macports.org/repository/macports
 
-include Mk/dports.autoconf.mk
+include Mk/macports.autoconf.mk
 
-all:: Mk/dports.autoconf.mk
+all:: Mk/macports.autoconf.mk
 
-Mk/dports.autoconf.mk: Mk/dports.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 config.status
 	./config.status
 	make clean
 
@@ -24,7 +24,7 @@
 		echo "Source tree not configured. Use ./configure" ; \
 	fi
 
-include Mk/dports.subdir.mk
+include Mk/macports.subdir.mk
 
 install::
 	@echo ""
@@ -40,7 +40,7 @@
 distclean::
 	rm -f config.log config.status configure.lineno
 	rm -rf autom4te.cache ${DISTDIR}
-	rm -f Makefile Mk/dports.autoconf.mk
+	rm -f Makefile Mk/macports.autoconf.mk
 
 _gettag:
 	cd ${DISTDIR}; svn co ${SVNURL}/tags/${SVNTAG} ${PKGNAME}-svn

Deleted: branches/dp2mp-move/base/Mk/dports.autoconf.mk.in
===================================================================
--- trunk/base/Mk/dports.autoconf.mk.in	2007-04-22 07:33:59 UTC (rev 24327)
+++ branches/dp2mp-move/base/Mk/dports.autoconf.mk.in	2007-04-24 17:28:16 UTC (rev 24454)
@@ -1,52 +0,0 @@
-SHELL			= @SHELL@
-
-
-srcdir			= @srcdir@
-VPATH			= @srcdir@
-
-CC			= @CC@
-CFLAGS			= @CFLAGS@ $(CFLAGS_QUICHEEATERS) $(CFLAGS_DEBUG) $(CFLAGS_OPTIMIZE) $(CPPFLAGS) $(CFLAGS_LIBCURL)
-CPPFLAGS		= @CPPFLAGS@ @DEFS@ @INCLUDES@ @TCL_INCLUDES@
-TCL_DEFS		= @TCL_DEFS@
-SHLIB_CFLAGS		= @SHLIB_CFLAGS@
-CFLAGS_DEBUG		= @CFLAGS_DEBUG@
-CFLAGS_OPTIMIZE		= @CFLAGS_OPTIMIZE@
-CFLAGS_QUICHEEATERS	= @CFLAGS_QUICHEEATERS@
-CFLAGS_LIBCURL		= @CFLAGS_LIBCURL@
-
-TCL_CC			= @TCL_CC@
-SHLIB_LD		= @SHLIB_LD@
-LDFLAGS_LIBCURL		= @LDFLAGS_LIBCURL@
-LDFLAGS			=  -L/usr/local/lib @LDFLAGS@ $(LDFLAGS_LIBCURL)
-SHLIB_LDFLAGS		= @SHLIB_LDFLAGS@ ${LDFLAGS}
-SHLIB_SUFFIX		= @SHLIB_SUFFIX@
-TCL_STUB_LIB_SPEC	= @TCL_STUB_LIB_SPEC@
-
-LIBS			= @LIBS@
-MD5_LIBS		= @MD5_LIBS@
-INSTALL			= @INSTALL@
-MTREE			= @MTREE@
-LN_S			= @LN_S@
-XCODEBUILD		= @XCODEBUILD@
-
-TCLSH			= @TCLSH@
-TCL_PACKAGE_DIR		= @TCL_PACKAGE_DIR@
-
-DSTUSR			= @DSTUSR@
-DSTGRP			= @DSTGRP@
-DSTMODE			= @DSTMODE@
-
-
-prefix			= @prefix@
-sysconfdir		= @sysconfdir@
-exec_prefix		= @exec_prefix@
-bindir			= @bindir@
-datadir			= @datadir@
-libdir			= @libdir@
-localstatedir		= @localstatedir@
-infodir			= @infodir@
-
-portconfigdir		= @PORTCONFIGDIR@
-dportsdir		= @DPORTSDIR@
-
-SILENT			= @

Deleted: branches/dp2mp-move/base/Mk/dports.subdir.mk
===================================================================
--- trunk/base/Mk/dports.subdir.mk	2007-04-22 07:33:59 UTC (rev 24327)
+++ branches/dp2mp-move/base/Mk/dports.subdir.mk	2007-04-24 17:28:16 UTC (rev 24454)
@@ -1,27 +0,0 @@
-.PHONY : all
-.PHONY : clean distclean
-.PHONY : install
-
-all::
-	@for subdir in $(SUBDIR); do\
-		echo ===\> making $@ in ${DIRPRFX}$$subdir; \
-		( cd $$subdir && $(MAKE) DIRPRFX=${DIRPRFX}$$subdir/ $@) || exit 1; \
-	done
-
-clean distclean::
-	@for subdir in $(SUBDIR); do\
-		echo ===\> making $@ in ${DIRPRFX}$$subdir; \
-		( cd $$subdir && $(MAKE) DIRPRFX=${DIRPRFX}$$subdir/ $@) || exit 1; \
-	done
-
-test::
-	@for subdir in $(SUBDIR); do\
-		echo ===\> making $@ in ${DIRPRFX}$$subdir; \
-		( cd $$subdir && $(MAKE) DIRPRFX=${DIRPRFX}$$subdir/ $@) || exit 1; \
-	done
-
-install::
-	@for subdir in $(SUBDIR); do\
-		echo ===\> making $@ in ${DIRPRFX}$$subdir; \
-		( cd $$subdir && $(MAKE) DIRPRFX=${DIRPRFX}$$subdir/ $@) || exit 1; \
-	done

Deleted: branches/dp2mp-move/base/Mk/dports.tea.mk
===================================================================
--- trunk/base/Mk/dports.tea.mk	2007-04-22 07:33:59 UTC (rev 24327)
+++ branches/dp2mp-move/base/Mk/dports.tea.mk	2007-04-24 17:28:16 UTC (rev 24454)
@@ -1,17 +0,0 @@
-.c.o:
-	${CC} -c -DUSE_TCL_STUBS ${CFLAGS} ${TCL_DEFS} ${SHLIB_CFLAGS} $< -o $@
-
-$(SHLIB_NAME):: ${OBJS}
-	${SHLIB_LD} ${OBJS} -o ${SHLIB_NAME} ${TCL_STUB_LIB_SPEC} ${SHLIB_LDFLAGS} ${LIBS} ${MD5_LIBS}
-
-all:: ${SHLIB_NAME}
-
-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}
-	$(SILENT) $(TCLSH) ../pkg_mkindex.tcl ${INSTALLDIR}

Copied: branches/dp2mp-move/base/Mk/macports.autoconf.mk.in (from rev 24327, trunk/base/Mk/dports.autoconf.mk.in)
===================================================================
--- branches/dp2mp-move/base/Mk/macports.autoconf.mk.in	                        (rev 0)
+++ branches/dp2mp-move/base/Mk/macports.autoconf.mk.in	2007-04-24 17:28:16 UTC (rev 24454)
@@ -0,0 +1,52 @@
+SHELL			= @SHELL@
+
+
+srcdir			= @srcdir@
+VPATH			= @srcdir@
+
+CC			= @CC@
+CFLAGS			= @CFLAGS@ $(CFLAGS_QUICHEEATERS) $(CFLAGS_DEBUG) $(CFLAGS_OPTIMIZE) $(CPPFLAGS) $(CFLAGS_LIBCURL)
+CPPFLAGS		= @CPPFLAGS@ @DEFS@ @INCLUDES@ @TCL_INCLUDES@
+TCL_DEFS		= @TCL_DEFS@
+SHLIB_CFLAGS		= @SHLIB_CFLAGS@
+CFLAGS_DEBUG		= @CFLAGS_DEBUG@
+CFLAGS_OPTIMIZE		= @CFLAGS_OPTIMIZE@
+CFLAGS_QUICHEEATERS	= @CFLAGS_QUICHEEATERS@
+CFLAGS_LIBCURL		= @CFLAGS_LIBCURL@
+
+TCL_CC			= @TCL_CC@
+SHLIB_LD		= @SHLIB_LD@
+LDFLAGS_LIBCURL		= @LDFLAGS_LIBCURL@
+LDFLAGS			=  -L/usr/local/lib @LDFLAGS@ $(LDFLAGS_LIBCURL)
+SHLIB_LDFLAGS		= @SHLIB_LDFLAGS@ ${LDFLAGS}
+SHLIB_SUFFIX		= @SHLIB_SUFFIX@
+TCL_STUB_LIB_SPEC	= @TCL_STUB_LIB_SPEC@
+
+LIBS			= @LIBS@
+MD5_LIBS		= @MD5_LIBS@
+INSTALL			= @INSTALL@
+MTREE			= @MTREE@
+LN_S			= @LN_S@
+XCODEBUILD		= @XCODEBUILD@
+
+TCLSH			= @TCLSH@
+TCL_PACKAGE_DIR		= @TCL_PACKAGE_DIR@
+
+DSTUSR			= @DSTUSR@
+DSTGRP			= @DSTGRP@
+DSTMODE			= @DSTMODE@
+
+
+prefix			= @prefix@
+sysconfdir		= @sysconfdir@
+exec_prefix		= @exec_prefix@
+bindir			= @bindir@
+datadir			= @datadir@
+libdir			= @libdir@
+localstatedir		= @localstatedir@
+infodir			= @infodir@
+
+mpportconfigdir		= @MPCONFIGDIR@
+portsdir		= @PORTSDIR@
+
+SILENT			= @

Copied: branches/dp2mp-move/base/Mk/macports.subdir.mk (from rev 24327, trunk/base/Mk/dports.subdir.mk)
===================================================================
--- branches/dp2mp-move/base/Mk/macports.subdir.mk	                        (rev 0)
+++ branches/dp2mp-move/base/Mk/macports.subdir.mk	2007-04-24 17:28:16 UTC (rev 24454)
@@ -0,0 +1,27 @@
+.PHONY : all
+.PHONY : clean distclean
+.PHONY : install
+
+all::
+	@for subdir in $(SUBDIR); do\
+		echo ===\> making $@ in ${DIRPRFX}$$subdir; \
+		( cd $$subdir && $(MAKE) DIRPRFX=${DIRPRFX}$$subdir/ $@) || exit 1; \
+	done
+
+clean distclean::
+	@for subdir in $(SUBDIR); do\
+		echo ===\> making $@ in ${DIRPRFX}$$subdir; \
+		( cd $$subdir && $(MAKE) DIRPRFX=${DIRPRFX}$$subdir/ $@) || exit 1; \
+	done
+
+test::
+	@for subdir in $(SUBDIR); do\
+		echo ===\> making $@ in ${DIRPRFX}$$subdir; \
+		( cd $$subdir && $(MAKE) DIRPRFX=${DIRPRFX}$$subdir/ $@) || exit 1; \
+	done
+
+install::
+	@for subdir in $(SUBDIR); do\
+		echo ===\> making $@ in ${DIRPRFX}$$subdir; \
+		( cd $$subdir && $(MAKE) DIRPRFX=${DIRPRFX}$$subdir/ $@) || exit 1; \
+	done

Copied: branches/dp2mp-move/base/Mk/macports.tea.mk (from rev 24327, trunk/base/Mk/dports.tea.mk)
===================================================================
--- branches/dp2mp-move/base/Mk/macports.tea.mk	                        (rev 0)
+++ branches/dp2mp-move/base/Mk/macports.tea.mk	2007-04-24 17:28:16 UTC (rev 24454)
@@ -0,0 +1,17 @@
+.c.o:
+	${CC} -c -DUSE_TCL_STUBS ${CFLAGS} ${TCL_DEFS} ${SHLIB_CFLAGS} $< -o $@
+
+$(SHLIB_NAME):: ${OBJS}
+	${SHLIB_LD} ${OBJS} -o ${SHLIB_NAME} ${TCL_STUB_LIB_SPEC} ${SHLIB_LDFLAGS} ${LIBS} ${MD5_LIBS}
+
+all:: ${SHLIB_NAME}
+
+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}
+	$(SILENT) $(TCLSH) ../pkg_mkindex.tcl ${INSTALLDIR}

Modified: branches/dp2mp-move/base/aclocal.m4
===================================================================
--- trunk/base/aclocal.m4	2007-04-22 07:33:59 UTC (rev 24327)
+++ branches/dp2mp-move/base/aclocal.m4	2007-04-24 17:28:16 UTC (rev 24454)
@@ -1,7 +1,7 @@
 builtin(include,tcl.m4)
 
 #------------------------------------------------------------------------
-# OD_CHECK_FRAMEWORK_COREFOUNDATION --
+# MP_CHECK_FRAMEWORK_COREFOUNDATION --
 #
 #	Check if CoreFoundation framework is available, define HAVE_FRAMEWORK_COREFOUNDATION if so.
 #
@@ -21,12 +21,12 @@
 #		HAVE_FRAMEWORK_COREFOUNDATION
 #
 #------------------------------------------------------------------------
-AC_DEFUN(OD_CHECK_FRAMEWORK_COREFOUNDATION, [
+AC_DEFUN(MP_CHECK_FRAMEWORK_COREFOUNDATION, [
 	FRAMEWORK_LIBS="-framework CoreFoundation"
 
 	AC_MSG_CHECKING([for CoreFoundation framework])
 
-	AC_CACHE_VAL(od_cv_have_framework_corefoundation, [
+	AC_CACHE_VAL(mp_cv_have_framework_corefoundation, [
 		ac_save_LIBS="$LIBS"
 		LIBS="$FRAMEWORK_LIBS $LIBS"
 		
@@ -38,18 +38,18 @@
 					CFArrayRef bundles = CFBundleCreateBundlesFromDirectory(NULL, url, CFSTR("pkg"));
 			])
 			], [
-				od_cv_have_framework_corefoundation="yes"
+				mp_cv_have_framework_corefoundation="yes"
 			], [
-				od_cv_have_framework_corefoundation="no"
+				mp_cv_have_framework_corefoundation="no"
 			]
 		)
 
 		LIBS="$ac_save_LIBS"
 	])
 
-	AC_MSG_RESULT(${od_cv_have_framework_corefoundation})
+	AC_MSG_RESULT(${mp_cv_have_framework_corefoundation})
 
-	if test x"${od_cv_have_framework_corefoundation}" = "xyes"; then
+	if test x"${mp_cv_have_framework_corefoundation}" = "xyes"; then
 		AC_DEFINE([HAVE_FRAMEWORK_COREFOUNDATION], [], [Define if CoreFoundation framework is available])
 	fi
 
@@ -58,7 +58,7 @@
 
 
 #------------------------------------------------------------------------
-# OD_CHECK_FUNCTION_CFNOTIFICATIONCENTERGETDARWINNOTIFYCENTER --
+# MP_CHECK_FUNCTION_CFNOTIFICATIONCENTERGETDARWINNOTIFYCENTER --
 #
 #	Check if if the routine CFNOTIFICATIONCENTERGETDARWINNOTIFYCENTER
 #	is available in CoreFoundation.
@@ -79,12 +79,12 @@
 #		HAVE_FUNCTION_CFNOTIFICATIONCENTERGETDARWINNOTIFYCENTER
 #
 #------------------------------------------------------------------------
-AC_DEFUN(OD_CHECK_FUNCTION_CFNOTIFICATIONCENTERGETDARWINNOTIFYCENTER, [
+AC_DEFUN(MP_CHECK_FUNCTION_CFNOTIFICATIONCENTERGETDARWINNOTIFYCENTER, [
 	FRAMEWORK_LIBS="-framework CoreFoundation"
 
 	AC_MSG_CHECKING([for CFNotificationCenterGetDarwinNotifyCenter])
 
-	AC_CACHE_VAL(od_cv_have_function_cfnotificationcentergetdarwinnotifycenter, [
+	AC_CACHE_VAL(mp_cv_have_function_cfnotificationcentergetdarwinnotifycenter, [
 		ac_save_LIBS="$LIBS"
 		LIBS="$FRAMEWORK_LIBS $LIBS"
 		
@@ -95,18 +95,18 @@
 					CFNotificationCenterRef ref = CFNotificationCenterGetDarwinNotifyCenter();
 			])
 			], [
-				od_cv_have_function_cfnotificationcentergetdarwinnotifycenter="yes"
+				mp_cv_have_function_cfnotificationcentergetdarwinnotifycenter="yes"
 			], [
-				od_cv_have_function_cfnotificationcentergetdarwinnotifycenter="no"
+				mp_cv_have_function_cfnotificationcentergetdarwinnotifycenter="no"
 			]
 		)
 
 		LIBS="$ac_save_LIBS"
 	])
 
-	AC_MSG_RESULT(${od_cv_have_function_cfnotificationcentergetdarwinnotifycenter})
+	AC_MSG_RESULT(${mp_cv_have_function_cfnotificationcentergetdarwinnotifycenter})
 
-	if test x"${od_cv_have_function_cfnotificationcentergetdarwinnotifycenter}" = "xyes"; then
+	if test x"${mp_cv_have_function_cfnotificationcentergetdarwinnotifycenter}" = "xyes"; then
 		AC_DEFINE([HAVE_FUNCTION_CFNOTIFICATIONCENTERGETDARWINNOTIFYCENTER], [], [Define if function CFNotificationCenterGetDarwinNotifyCenter in CoreFoundation framework])
 	fi
 
@@ -115,7 +115,7 @@
 
 
 #------------------------------------------------------------------------
-# OD_CHECK_FRAMEWORK_SYSTEMCONFIGURATION --
+# MP_CHECK_FRAMEWORK_SYSTEMCONFIGURATION --
 #
 #	Check if SystemConfiguration framework is available, define HAVE_FRAMEWORK_SYSTEMCONFIGURATION if so.
 #
@@ -135,12 +135,12 @@
 #		HAVE_FRAMEWORK_SYSTEMCONFIGURATION
 #
 #------------------------------------------------------------------------
-AC_DEFUN(OD_CHECK_FRAMEWORK_SYSTEMCONFIGURATION, [
+AC_DEFUN(MP_CHECK_FRAMEWORK_SYSTEMCONFIGURATION, [
 	FRAMEWORK_LIBS="-framework SystemConfiguration"
 
 	AC_MSG_CHECKING([for SystemConfiguration framework])
 
-	AC_CACHE_VAL(od_cv_have_framework_systemconfiguration, [
+	AC_CACHE_VAL(mp_cv_have_framework_systemconfiguration, [
 		ac_save_LIBS="$LIBS"
 		LIBS="$FRAMEWORK_LIBS $LIBS"
 		
@@ -152,18 +152,18 @@
 					SCDynamicStoreRef dsRef = SCDynamicStoreCreate(NULL, NULL, NULL, NULL);
 			])
 			], [
-				od_cv_have_framework_systemconfiguration="yes"
+				mp_cv_have_framework_systemconfiguration="yes"
 			], [
-				od_cv_have_framework_systemconfiguration="no"
+				mp_cv_have_framework_systemconfiguration="no"
 			]
 		)
 
 		LIBS="$ac_save_LIBS"
 	])
 
-	AC_MSG_RESULT(${od_cv_have_framework_systemconfiguration})
+	AC_MSG_RESULT(${mp_cv_have_framework_systemconfiguration})
 
-	if test x"${od_cv_have_framework_systemconfiguration}" = "xyes"; then
+	if test x"${mp_cv_have_framework_systemconfiguration}" = "xyes"; then
 		AC_DEFINE([HAVE_FRAMEWORK_SYSTEMCONFIGURATION], [], [Define if SystemConfiguration framework is available])
 	fi
 
@@ -172,7 +172,7 @@
 
 
 #------------------------------------------------------------------------
-# OD_CHECK_FRAMEWORK_IOKIT --
+# MP_CHECK_FRAMEWORK_IOKIT --
 #
 #	Check if IOKit framework is available, define HAVE_FRAMEWORK_IOKIT if so.
 #
@@ -192,12 +192,12 @@
 #		HAVE_FRAMEWORK_IOKIT
 #
 #------------------------------------------------------------------------
-AC_DEFUN(OD_CHECK_FRAMEWORK_IOKIT, [
+AC_DEFUN(MP_CHECK_FRAMEWORK_IOKIT, [
 	FRAMEWORK_LIBS="-framework IOKit"
 
 	AC_MSG_CHECKING([for IOKit framework])
 
-	AC_CACHE_VAL(od_cv_have_framework_iokit, [
+	AC_CACHE_VAL(mp_cv_have_framework_iokit, [
 		ac_save_LIBS="$LIBS"
 		LIBS="$FRAMEWORK_LIBS $LIBS"
 		
@@ -209,18 +209,18 @@
 					IORegisterForSystemPower(0, NULL, NULL, NULL);
 			])
 			], [
-				od_cv_have_framework_iokit="yes"
+				mp_cv_have_framework_iokit="yes"
 			], [
-				od_cv_have_framework_iokit="no"
+				mp_cv_have_framework_iokit="no"
 			]
 		)
 
 		LIBS="$ac_save_LIBS"
 	])
 
-	AC_MSG_RESULT(${od_cv_have_framework_iokit})
+	AC_MSG_RESULT(${mp_cv_have_framework_iokit})
 
-	if test x"${od_cv_have_framework_iokit}" = "xyes"; then
+	if test x"${mp_cv_have_framework_iokit}" = "xyes"; then
 		AC_DEFINE([HAVE_FRAMEWORK_IOKIT], [], [Define if IOKit framework is available])
 	fi
 
@@ -228,68 +228,68 @@
 ])
 
 
-dnl This macro checks if the user specified a dports tree
+dnl This macro checks if the user specified a ports tree
 dnl explicitly. If not, search for it
 
-# OD_PATH_DPORTSDIR(DEFAULT_DPORTSDIR)
+# MP_PATH_PORTSDIR(DEFAULT_PORTSDIR)
 #---------------------------------------
- AC_DEFUN([OD_PATH_DPORTSDIR],[
+ AC_DEFUN([MP_PATH_PORTSDIR],[
  	dnl For ease of reading, run after gcc has been found/configured
  	AC_REQUIRE([AC_PROG_CC])
 
- 	AC_ARG_WITH(dports-dir, [AC_HELP_STRING([--with-dports-dir=DIR], [Specify alternate dports directory])], [ dportsdir="$withval" ] )
+ 	AC_ARG_WITH(ports-dir, [AC_HELP_STRING([--with-ports-dir=DIR], [Specify alternate ports directory])], [ portsdir="$withval" ] )
 
 
- 	AC_MSG_CHECKING([for dports tree])
- 	if test "x$dportsdir" != "x" ; then
- 	  if test -d "$dportsdir" -a -e "$dportsdir/PortIndex" ; then
+ 	AC_MSG_CHECKING([for ports tree])
+ 	if test "x$portsdir" != "x" ; then
+ 	  if test -d "$portsdir" -a -e "$portsdir/PortIndex" ; then
  		:
  	  else
- 		AC_MSG_ERROR([$dportsdir not a valid dports tree])
+ 		AC_MSG_ERROR([$portsdir not a valid ports tree])
  	  fi
  	else
  		dnl If the user didn't give a path, look for default
  		if test "x$1" != "x" ; then
  		  if test -d "$1" -a -e "$1/PortIndex" ; then
- 			dportsdir=$1
+ 			portsdir=$1
  		  fi
  		fi
  	fi
 
- 	if test "x$dportsdir" != "x" ; then
- 		AC_MSG_RESULT($dportsdir)
- 		DPORTSDIR="$dportsdir"
- 		AC_SUBST(DPORTSDIR)
+ 	if test "x$portsdir" != "x" ; then
+ 		AC_MSG_RESULT($portsdir)
+ 		PORTSDIR="$portsdir"
+ 		AC_SUBST(PORTSDIR)
  	else
- 		AC_MSG_WARN([No dports tree found])
+ 		AC_MSG_WARN([No ports tree found])
  	fi
 
          ])
 
 
-# OD_PATH_PORTCONFIGDIR
+# MP_PATH_MPCONFIGDIR
 #---------------------------------------
-AC_DEFUN([OD_PATH_PORTCONFIGDIR],[
+AC_DEFUN([MP_PATH_MPCONFIGDIR],[
 	dnl if the user actually specified --prefix, shift
-	dnl portconfigdir to $prefix/etc/ports
-	dnl 	AC_REQUIRE([OD_PATH_DPORTSDIR])
+	dnl mpconfigdir to $prefix/etc/macports
+	dnl 	AC_REQUIRE([MP_PATH_PORTSDIR])
 	
-        AC_MSG_CHECKING([for ports config directory])
+        AC_MSG_CHECKING([for MacPorts config directory])
 
-	portconfigdir='${sysconfdir}/ports'
+	mpconfigdir='${sysconfdir}/macports'
 
-	AC_MSG_RESULT([$portconfigdir])
-	PORTCONFIGDIR="$portconfigdir"
-        AC_SUBST(PORTCONFIGDIR)
+	AC_MSG_RESULT([$mpconfigdir])
+	MPCONFIGDIR="$mpconfigdir"
+        AC_SUBST(MPCONFIGDIR)
 
 	])
 
-# OD_CHECK_INSTALLUSER
+# MP_CHECK_INSTALLUSER
 #-------------------------------------------------
-AC_DEFUN([OD_CHECK_INSTALLUSER],[
+AC_DEFUN([MP_CHECK_INSTALLUSER],[
 	dnl if with user specifies --with-install-user,
 	dnl use it. otherwise default to platform defaults
-        AC_REQUIRE([OD_PATH_PORTCONFIGDIR])
+        AC_REQUIRE([MP_PATH_MPCONFIGDIR])
 
 	AC_ARG_WITH(install-user, [AC_HELP_STRING([--with-install-user=USER], [Specify user ownership of installed files])], [ DSTUSR=$withval ] )
 	
@@ -302,12 +302,12 @@
 	AC_SUBST(DSTUSR)
 ])
 
-# OD_CHECK_INSTALLGROUP
+# MP_CHECK_INSTALLGROUP
 #-------------------------------------------------
-AC_DEFUN([OD_CHECK_INSTALLGROUP],[
+AC_DEFUN([MP_CHECK_INSTALLGROUP],[
 	dnl if with user specifies --with-install-group,
 	dnl use it. otherwise default to platform defaults
-        AC_REQUIRE([OD_CHECK_INSTALLUSER])
+        AC_REQUIRE([MP_CHECK_INSTALLUSER])
 
 	AC_ARG_WITH(install-group, [AC_HELP_STRING([--with-install-group=GROUP], [Specify group ownership of installed files])], [ DSTGRP=$withval ] )
 
@@ -328,13 +328,13 @@
 	AC_SUBST(DSTGRP)
 ])
 
-# OD_DIRECTORY_MODE
+# MP_DIRECTORY_MODE
 #-------------------------------------------------
-AC_DEFUN([OD_DIRECTORY_MODE],[
+AC_DEFUN([MP_DIRECTORY_MODE],[
 	dnl if with user specifies --with-directory-mode,
 	dnl use the specified permissions for ${prefix} directories
 	dnl otherwise use 0775
-        AC_REQUIRE([OD_PATH_PORTCONFIGDIR])
+        AC_REQUIRE([MP_PATH_MPCONFIGDIR])
 
 	AC_ARG_WITH(directory-mode, [AC_HELP_STRING([--with-directory-mode=MODE], [Specify directory mode of installed directories])], [ DSTMODE=$withval ] )
 	
@@ -347,10 +347,10 @@
 	AC_SUBST(DSTMODE)
 ])
 
-# OD_LIB_MD5
+# MP_LIB_MD5
 #---------------------------------------
 # Check for an md5 implementation
-AC_DEFUN([OD_LIB_MD5],[
+AC_DEFUN([MP_LIB_MD5],[
 
 	# Check for libmd, which is prefered
 	AC_CHECK_LIB([md], [MD5Update],[
@@ -398,9 +398,9 @@
 dnl present, so must the headers be. If nothing is present,
 dnl print a warning
 
-# OD_CHECK_X11
+# MP_CHECK_X11
 # ---------------------
-AC_DEFUN([OD_CHECK_X11], [
+AC_DEFUN([MP_CHECK_X11], [
 
 	AC_PATH_XTRA
 
@@ -426,7 +426,7 @@
 		"__no__yes__")
 		# either the user said --without-x, or it was not found
 		# at all (runtime or headers)
-			AC_MSG_WARN([X11 not available. You will not be able to use dports that use X11])
+			AC_MSG_WARN([X11 not available. You will not be able to use ports that use X11])
 			state=0
 			;;
 		"__yes__yes__")
@@ -482,25 +482,10 @@
 
 ])
 
-# OD_PROG_MTREE
+# MP_PROG_XAR
 #---------------------------------------
-AC_DEFUN([OD_PROG_MTREE],[
+AC_DEFUN([MP_PROG_XAR],[
 
-	AC_PATH_PROG([MTREE], [mtree], ,  [/usr/bin:/usr/sbin:/bin:/sbin])
-
-	if test "x$MTREE" = "x" ; then
-		AC_CONFIG_SUBDIRS([src/programs/mtree])
-		MTREE='$(TOPSRCDIR)/src/programs/mtree/mtree'
-		REPLACEMENT_PROGS="$REPLACEMENT_PROGS mtree"
-	fi
-
-	AC_SUBST(MTREE)
-])
-
-# OD_PROG_XAR
-#---------------------------------------
-AC_DEFUN([OD_PROG_XAR],[
-
 	AC_PATH_PROG([XAR], [xar], ,  [/usr/bin:/usr/sbin:/bin:/sbin])
 
 	if test "x$XAR" = "x" ; then
@@ -512,22 +497,22 @@
 	AC_SUBST(XAR)
 ])
 
-# OD_PROG_DAEMONDO
+# MP_PROG_DAEMONDO
 #---------------------------------------
-AC_DEFUN([OD_PROG_DAEMONDO],[
-	AC_REQUIRE([OD_CHECK_FRAMEWORK_COREFOUNDATION])
-	AC_REQUIRE([OD_CHECK_FRAMEWORK_SYSTEMCONFIGURATION])
-	AC_REQUIRE([OD_CHECK_FRAMEWORK_IOKIT])
-	AC_REQUIRE([OD_CHECK_FUNCTION_CFNOTIFICATIONCENTERGETDARWINNOTIFYCENTER])
+AC_DEFUN([MP_PROG_DAEMONDO],[
+	AC_REQUIRE([MP_CHECK_FRAMEWORK_COREFOUNDATION])
+	AC_REQUIRE([MP_CHECK_FRAMEWORK_SYSTEMCONFIGURATION])
+	AC_REQUIRE([MP_CHECK_FRAMEWORK_IOKIT])
+	AC_REQUIRE([MP_CHECK_FUNCTION_CFNOTIFICATIONCENTERGETDARWINNOTIFYCENTER])
 	
     AC_MSG_CHECKING(for whether we will build daemondo)
     result=no
 	case $host_os in
 	darwin*)
-		if test "x$od_cv_have_framework_corefoundation" == "xyes" &&
-		   test "x$od_cv_have_framework_systemconfiguration" == "xyes" &&
-		   test "x$od_cv_have_framework_iokit" == "xyes" &&
-		   test "x$od_cv_have_function_cfnotificationcentergetdarwinnotifycenter" == "xyes"; then
+		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])
@@ -539,7 +524,7 @@
 ])
 
 #------------------------------------------------------------------------
-# OD_TCL_PACKAGE_DIR --
+# MP_TCL_PACKAGE_DIR --
 #
 #	Locate the correct directory for Tcl package installation
 #
@@ -560,7 +545,7 @@
 #		TCL_PACKAGE_DIR
 #------------------------------------------------------------------------
 
-AC_DEFUN(OD_TCL_PACKAGE_DIR, [
+AC_DEFUN(MP_TCL_PACKAGE_DIR, [
     AC_MSG_CHECKING(for Tcl package directory)
 
     AC_ARG_WITH(tclpackage, [  --with-tclpackage       Tcl package installation directory.], with_tclpackagedir=${withval})
@@ -620,17 +605,12 @@
     AC_SUBST(TCL_PACKAGE_DIR)
 ])
 
-# OD_PROG_TCLSH
+# MP_PROG_TCLSH
 #---------------------------------------
-AC_DEFUN([OD_PROG_TCLSH],[
+AC_DEFUN([MP_PROG_TCLSH],[
 
 
 	case $host_os in
-		freebsd*)
-			# FreeBSD installs a dummy tclsh (annoying)
-			# Look for a real versioned tclsh first
-			AC_PATH_PROG([TCLSH], [tclsh${TCL_VERSION} tclsh])
-			;;
 		*)
 			# Otherwise, look for a non-versioned tclsh
 			AC_PATH_PROG([TCLSH], [tclsh tclsh${TCL_VERSION}])
@@ -643,14 +623,14 @@
 	AC_SUBST(TCLSH)
 ])
 
-# OD_TCL_PACKAGE
+# MP_TCL_PACKAGE
 #	Determine if a Tcl package is present.
 #
 # Arguments:
 #	Package name (may include the version)
 #
 # Syntax:
-#   OD_TCL_PACKAGE (package, [action-if-found], [action-if-not-found])
+#   MP_TCL_PACKAGE (package, [action-if-found], [action-if-not-found])
 #
 # Requires:
 #	TCLSH must be set
@@ -658,13 +638,13 @@
 # Results:
 #	Execute action-if-found or action-if-not-found
 #---------------------------------------
-AC_DEFUN([OD_TCL_PACKAGE],[
+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])[]
 ])
 
-# OD_TCL_THREAD_SUPPORT
+# MP_TCL_THREAD_SUPPORT
 #	Determine if thread support is available in tclsh.
 #
 # Arguments:
@@ -676,7 +656,7 @@
 # Results:
 #   Fails if thread support isn't available.
 #---------------------------------------
-AC_DEFUN([OD_TCL_THREAD_SUPPORT],[
+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
@@ -687,7 +667,7 @@
 	fi
 ])
 
-# OD_LIBCURL_FLAGS
+# MP_LIBCURL_FLAGS
 #	Sets the flags to compile with libcurl.
 #
 # Arguments:
@@ -700,7 +680,7 @@
 #   defines some help strings.
 #   sets CFLAGS_LIBCURL and LDFLAGS_LIBCURL
 #---------------------------------------
-AC_DEFUN([OD_LIBCURL_FLAGS],[
+AC_DEFUN([MP_LIBCURL_FLAGS],[
 	AC_ARG_WITH(curlprefix,
 		   [  --with-curlprefix       base directory for the cURL install '/usr', '/usr/local',...],
 		   [  curlprefix=$withval ])
@@ -724,7 +704,7 @@
 	AC_SUBST(LDFLAGS_LIBCURL)
 ])
 
-# OD_LIBCURL_VERSION
+# MP_LIBCURL_VERSION
 #	Determine the version of libcurl.
 #
 # Arguments:
@@ -736,7 +716,7 @@
 # Results:
 #   sets libcurl_version to "0" or some number
 #---------------------------------------
-AC_DEFUN([OD_LIBCURL_VERSION],[
+AC_DEFUN([MP_LIBCURL_VERSION],[
 	if test "x$CURL" = "x"; then
 		libcurl_version="0"
 	else
@@ -747,7 +727,7 @@
 ])
 
 
-# OD_PATH_SQLITE3
+# MP_PATH_SQLITE3
 #	Specify sqlite3 location
 #
 # Arguments:
@@ -759,25 +739,25 @@
 # Results:
 #   Sets SQLITE3_DIR to the directory where sqlite3 tcl pkgIndex.tcl is
 #---------------------------------------
-AC_DEFUN([OD_PATH_SQLITE3],[
+AC_DEFUN([MP_PATH_SQLITE3],[
 
 	AC_ARG_WITH([sqlite],
 		AS_HELP_STRING([--with-sqlite3=DIR],
 			[directory for sqlite3 (default /usr/lib/sqlite3)]),		
-		[od_sqlite3_dir=$withval], [od_sqlite3_dir=/usr/lib/sqlite3])
+		[mp_sqlite3_dir=$withval], [mp_sqlite3_dir=/usr/lib/sqlite3])
 		
-	AC_CACHE_CHECK([for sqlite3 location], [od_cv_sqlite3_dir],
-		[od_cv_sqlite3_dir=
-		test -r "${od_sqlite3_dir}/pkgIndex.tcl" && od_cv_sqlite3_dir=$od_sqlite3_dir
+	AC_CACHE_CHECK([for 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_DIR=$od_cv_sqlite3_dir
+	SQLITE3_DIR=$mp_cv_sqlite3_dir
 	AC_SUBST(SQLITE3_DIR)
 ])
 
 dnl This macro tests if the compiler supports GCC's
 dnl __attribute__ syntax for unused variables/parameters
-AC_DEFUN([OD_COMPILER_ATTRIBUTE_UNUSED], [
+AC_DEFUN([MP_COMPILER_ATTRIBUTE_UNUSED], [
 	AC_MSG_CHECKING([how to mark unused variables])
 	AC_COMPILE_IFELSE(
 		[AC_LANG_SOURCE([[int a __attribute__ ((unused));]])],
@@ -788,10 +768,10 @@
 	
 ])
 
-dnl This macro ensures DP installation prefix bin/sbin paths are NOT in PATH
+dnl This macro ensures MP installation prefix bin/sbin 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.
-AC_DEFUN([OD_PATH_SCAN],[
+AC_DEFUN([MP_PATH_SCAN],[
 	oldprefix=$prefix
 	if test "x$prefix" = "xNONE" ; then
 		prefix=$ac_default_prefix
@@ -816,7 +796,7 @@
 ])
 
 dnl This macro tests for tar support of --no-same-owner
-AC_DEFUN([OD_TAR_NO_SAME_OWNER],[
+AC_DEFUN([MP_TAR_NO_SAME_OWNER],[
 	AC_PATH_PROG(TAR, [tar])
 	AC_PATH_PROG(GNUTAR, [gnutar])
 	
@@ -836,7 +816,7 @@
 ])
 
 #------------------------------------------------------------------------
-# DP_CHECK_READLINK_IS_P1003_1A --
+# MP_CHECK_READLINK_IS_P1003_1A --
 #
 #	Check if readlink conforms to POSIX 1003.1a standard, define
 #	READLINK_IS_NOT_P1003_1A if it doesn't.
@@ -857,10 +837,10 @@
 #		READLINK_IS_NOT_P1003_1A
 #
 #------------------------------------------------------------------------
-AC_DEFUN(DP_CHECK_READLINK_IS_P1003_1A, [
+AC_DEFUN(MP_CHECK_READLINK_IS_P1003_1A, [
 	AC_MSG_CHECKING([if readlink conforms to POSIX 1003.1a])
 
-	AC_CACHE_VAL(dp_cv_readlink_is_posix_1003_1a, [
+	AC_CACHE_VAL(mp_cv_readlink_is_posix_1003_1a, [
 		AC_COMPILE_IFELSE([
 			AC_LANG_PROGRAM([
 					#include <unistd.h>
@@ -868,16 +848,16 @@
 				], [
 			])
 			], [
-				dp_cv_readlink_is_posix_1003_1a="yes"
+				mp_cv_readlink_is_posix_1003_1a="yes"
 			], [
-				dp_cv_readlink_is_posix_1003_1a="no"
+				mp_cv_readlink_is_posix_1003_1a="no"
 			]
 		)
 	])
 
-	AC_MSG_RESULT(${dp_cv_readlink_is_posix_1003_1a})
+	AC_MSG_RESULT(${mp_cv_readlink_is_posix_1003_1a})
 
-	if test x"${dp_cv_readlink_is_posix_1003_1a}" = "xno"; then
+	if test x"${mp_cv_readlink_is_posix_1003_1a}" = "xno"; then
 		AC_DEFINE([READLINK_IS_NOT_P1003_1A], [], [Define to 1 if readlink does not conform with POSIX 1003.1a (where third argument is a size_t and return value is a ssize_t)])
 	fi
 

Modified: branches/dp2mp-move/base/config/Makefile
===================================================================
--- trunk/base/config/Makefile	2007-04-22 07:33:59 UTC (rev 24327)
+++ branches/dp2mp-move/base/config/Makefile	2007-04-24 17:28:16 UTC (rev 24454)
@@ -1,4 +1,4 @@
-include ../Mk/dports.autoconf.mk
+include ../Mk/macports.autoconf.mk
 
 all:
 
@@ -10,4 +10,4 @@
 
 install::
 	$(INSTALL) -d -o ${DSTUSR} -g ${DSTGRP} -m ${DSTMODE} ${DESTDIR}${portconfigdir}
-	$(INSTALL) -o ${DSTUSR} -g ${DSTGRP} -m 644 dp_version ${DESTDIR}${portconfigdir}
+	$(INSTALL) -o ${DSTUSR} -g ${DSTGRP} -m 644 mp_version ${DESTDIR}${portconfigdir}

Modified: branches/dp2mp-move/base/config/README.TXT
===================================================================
--- trunk/base/config/README.TXT	2007-04-22 07:33:59 UTC (rev 24327)
+++ branches/dp2mp-move/base/config/README.TXT	2007-04-24 17:28:16 UTC (rev 24454)
@@ -1,7 +1,7 @@
 The file RELEASE_URL in this directory is used by the rsync infrastructure
-at macports to control the tag from which "released" code is provided,
-ultimately, at rsync://rsync.darwinports.org/dpupdate1/base.
+at the MacPorts server to control the tag from which "released" code is provided,
+ultimately, at rsync://rsync.macports.org/release/base.
 
 The script handling that operation checks out from svn the code tagged by the
 contents of the RELEASE_URL file, and makes that code available via rsync.
-The script is at /base/portmgr/mprsyncup.
+The script is svn at base/portmgr/mprsyncup.

Deleted: branches/dp2mp-move/base/config/dp_version
===================================================================
--- trunk/base/config/dp_version	2007-04-22 07:33:59 UTC (rev 24327)
+++ branches/dp2mp-move/base/config/dp_version	2007-04-24 17:28:16 UTC (rev 24454)
@@ -1 +0,0 @@
-1.500

Copied: branches/dp2mp-move/base/config/mp_version (from rev 24327, trunk/base/config/dp_version)
===================================================================
--- branches/dp2mp-move/base/config/mp_version	                        (rev 0)
+++ branches/dp2mp-move/base/config/mp_version	2007-04-24 17:28:16 UTC (rev 24454)
@@ -0,0 +1 @@
+1.500

Modified: branches/dp2mp-move/base/configure
===================================================================
--- trunk/base/configure	2007-04-22 07:33:59 UTC (rev 24327)
+++ branches/dp2mp-move/base/configure	2007-04-24 17:28:16 UTC (rev 24454)
@@ -677,6 +677,7 @@
 INSTALL_DATA
 SET_MAKE
 LN_S
+MTREE
 CVS
 RSYNC
 HAVE_LAUNCHD
@@ -688,16 +689,14 @@
 GNUTAR
 TAR_CMD
 CFLAGS_QUICHEEATERS
-MTREE
-subdirs
 HAVE_FRAMEWORK_COREFOUNDATION
 HAVE_FRAMEWORK_SYSTEMCONFIGURATION
 HAVE_FRAMEWORK_IOKIT
 HAVE_FUNCTION_CFNOTIFICATIONCENTERGETDARWINNOTIFYCENTER
 REPLACEMENT_PROGS
 EXTRA_PROGS
-DPORTSDIR
-PORTCONFIGDIR
+PORTSDIR
+MPCONFIGDIR
 SQLITE3_DIR
 DSTUSR
 DSTGRP
@@ -727,6 +726,7 @@
 CURL_CONFIG
 CFLAGS_LIBCURL
 LDFLAGS_LIBCURL
+subdirs
 OUR_INCLUDED_PACKAGES
 INCLUDES
 CFLAGS_DEBUG
@@ -739,7 +739,7 @@
 SHLIB_SUFFIX
 TCL_CC
 prefix_expanded
-PORTCONFIGDIR_EXPANDED
+MPCONFIGDIR_EXPANDED
 localstatedir_expanded
 LIBOBJS
 LTLIBOBJS'
@@ -752,6 +752,7 @@
 LDFLAGS
 LIBS
 CPPFLAGS
+MTREE
 CVS
 RSYNC
 TAR
@@ -760,8 +761,7 @@
 XAR
 CPP
 XMKMF'
-ac_subdirs_all='src/programs/mtree
-src/thread2.6'
+ac_subdirs_all='src/thread2.6'
 
 # Initialize some variables set by options.
 ac_init_help=
@@ -1345,7 +1345,7 @@
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
   --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
-  --with-dports-dir=DIR   Specify alternate dports directory
+  --with-ports-dir=DIR    Specify alternate ports directory
   --with-sqlite3=DIR      directory for sqlite3 (default /usr/lib/sqlite3)
   --with-install-user=USER
                           Specify user ownership of installed files
@@ -1368,6 +1368,7 @@
   LIBS        libraries to pass to the linker, e.g. -l<library>
   CPPFLAGS    C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
               you have headers in a nonstandard directory <include dir>
+  MTREE       path to mtree command
   CVS         path to cvs command
   RSYNC       path to rsync command
   TAR         path to tar command
@@ -1969,7 +1970,7 @@
     NONENONEs,x,x, &&
   program_prefix=${target_alias}-
 
-# Check user PATH for DP paths, and remove as necessary.
+# Check user PATH for MP paths, and remove as necessary.
 
 	oldprefix=$prefix
 	if test "x$prefix" = "xNONE" ; then
@@ -3035,6 +3036,46 @@
 echo "${ECHO_T}no, using $LN_S" >&6; }
 fi
 
+# Extract the first word of "mtree", so it can be a program name with args.
+set dummy mtree; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_path_MTREE+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $MTREE in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_MTREE="$MTREE" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_MTREE="$as_dir/$ac_word$ac_exec_ext"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+MTREE=$ac_cv_path_MTREE
+if test -n "$MTREE"; then
+  { echo "$as_me:$LINENO: result: $MTREE" >&5
+echo "${ECHO_T}$MTREE" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
 # Extract the first word of "cvs", so it can be a program name with args.
 set dummy cvs; ac_word=$2
 { echo "$as_me:$LINENO: checking for $ac_word" >&5
@@ -3322,6 +3363,7 @@
 
 
 
+
 	# Extract the first word of "tar", so it can be a program name with args.
 set dummy tar; ac_word=$2
 { echo "$as_me:$LINENO: checking for $ac_word" >&5
@@ -3486,66 +3528,12 @@
 
 
 
-
-	# Extract the first word of "mtree", so it can be a program name with args.
-set dummy mtree; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_path_MTREE+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  case $MTREE in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_MTREE="$MTREE" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-as_dummy="/usr/bin:/usr/sbin:/bin:/sbin"
-for as_dir in $as_dummy
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_path_MTREE="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
-
-  ;;
-esac
-fi
-MTREE=$ac_cv_path_MTREE
-if test -n "$MTREE"; then
-  { echo "$as_me:$LINENO: result: $MTREE" >&5
-echo "${ECHO_T}$MTREE" >&6; }
-else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
-fi
-
-
-
-	if test "x$MTREE" = "x" ; then
-		subdirs="$subdirs src/programs/mtree"
-
-		MTREE='$(TOPSRCDIR)/src/programs/mtree/mtree'
-		REPLACEMENT_PROGS="$REPLACEMENT_PROGS mtree"
-	fi
-
-
-
-#OD_PROG_XAR
-
 	FRAMEWORK_LIBS="-framework CoreFoundation"
 
 	{ echo "$as_me:$LINENO: checking for CoreFoundation framework" >&5
 echo $ECHO_N "checking for CoreFoundation framework... $ECHO_C" >&6; }
 
-	if test "${od_cv_have_framework_corefoundation+set}" = set; then
+	if test "${mp_cv_have_framework_corefoundation+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
 
@@ -3593,14 +3581,14 @@
        } && test -s conftest$ac_exeext &&
        $as_test_x conftest$ac_exeext; then
 
-				od_cv_have_framework_corefoundation="yes"
+				mp_cv_have_framework_corefoundation="yes"
 
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 
-				od_cv_have_framework_corefoundation="no"
+				mp_cv_have_framework_corefoundation="no"
 
 
 fi
@@ -3613,10 +3601,10 @@
 fi
 
 
-	{ echo "$as_me:$LINENO: result: ${od_cv_have_framework_corefoundation}" >&5
-echo "${ECHO_T}${od_cv_have_framework_corefoundation}" >&6; }
+	{ echo "$as_me:$LINENO: result: ${mp_cv_have_framework_corefoundation}" >&5
+echo "${ECHO_T}${mp_cv_have_framework_corefoundation}" >&6; }
 
-	if test x"${od_cv_have_framework_corefoundation}" = "xyes"; then
+	if test x"${mp_cv_have_framework_corefoundation}" = "xyes"; then
 
 cat >>confdefs.h <<\_ACEOF
 #define HAVE_FRAMEWORK_COREFOUNDATION
@@ -3632,7 +3620,7 @@
 	{ echo "$as_me:$LINENO: checking for SystemConfiguration framework" >&5
 echo $ECHO_N "checking for SystemConfiguration framework... $ECHO_C" >&6; }
 
-	if test "${od_cv_have_framework_systemconfiguration+set}" = set; then
+	if test "${mp_cv_have_framework_systemconfiguration+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
 
@@ -3680,14 +3668,14 @@
        } && test -s conftest$ac_exeext &&
        $as_test_x conftest$ac_exeext; then
 
-				od_cv_have_framework_systemconfiguration="yes"
+				mp_cv_have_framework_systemconfiguration="yes"
 
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 
-				od_cv_have_framework_systemconfiguration="no"
+				mp_cv_have_framework_systemconfiguration="no"
 
 
 fi
@@ -3700,10 +3688,10 @@
 fi
 
 
-	{ echo "$as_me:$LINENO: result: ${od_cv_have_framework_systemconfiguration}" >&5
-echo "${ECHO_T}${od_cv_have_framework_systemconfiguration}" >&6; }
+	{ echo "$as_me:$LINENO: result: ${mp_cv_have_framework_systemconfiguration}" >&5
+echo "${ECHO_T}${mp_cv_have_framework_systemconfiguration}" >&6; }
 
-	if test x"${od_cv_have_framework_systemconfiguration}" = "xyes"; then
+	if test x"${mp_cv_have_framework_systemconfiguration}" = "xyes"; then
 
 cat >>confdefs.h <<\_ACEOF
 #define HAVE_FRAMEWORK_SYSTEMCONFIGURATION
@@ -3719,7 +3707,7 @@
 	{ echo "$as_me:$LINENO: checking for IOKit framework" >&5
 echo $ECHO_N "checking for IOKit framework... $ECHO_C" >&6; }
 
-	if test "${od_cv_have_framework_iokit+set}" = set; then
+	if test "${mp_cv_have_framework_iokit+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
 
@@ -3767,14 +3755,14 @@
        } && test -s conftest$ac_exeext &&
        $as_test_x conftest$ac_exeext; then
 
-				od_cv_have_framework_iokit="yes"
+				mp_cv_have_framework_iokit="yes"
 
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 
-				od_cv_have_framework_iokit="no"
+				mp_cv_have_framework_iokit="no"
 
 
 fi
@@ -3787,10 +3775,10 @@
 fi
 
 
-	{ echo "$as_me:$LINENO: result: ${od_cv_have_framework_iokit}" >&5
-echo "${ECHO_T}${od_cv_have_framework_iokit}" >&6; }
+	{ echo "$as_me:$LINENO: result: ${mp_cv_have_framework_iokit}" >&5
+echo "${ECHO_T}${mp_cv_have_framework_iokit}" >&6; }
 
-	if test x"${od_cv_have_framework_iokit}" = "xyes"; then
+	if test x"${mp_cv_have_framework_iokit}" = "xyes"; then
 
 cat >>confdefs.h <<\_ACEOF
 #define HAVE_FRAMEWORK_IOKIT
@@ -3806,7 +3794,7 @@
 	{ echo "$as_me:$LINENO: checking for CFNotificationCenterGetDarwinNotifyCenter" >&5
 echo $ECHO_N "checking for CFNotificationCenterGetDarwinNotifyCenter... $ECHO_C" >&6; }
 
-	if test "${od_cv_have_function_cfnotificationcentergetdarwinnotifycenter+set}" = set; then
+	if test "${mp_cv_have_function_cfnotificationcentergetdarwinnotifycenter+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
 
@@ -3853,14 +3841,14 @@
        } && test -s conftest$ac_exeext &&
        $as_test_x conftest$ac_exeext; then
 
-				od_cv_have_function_cfnotificationcentergetdarwinnotifycenter="yes"
+				mp_cv_have_function_cfnotificationcentergetdarwinnotifycenter="yes"
 
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 
-				od_cv_have_function_cfnotificationcentergetdarwinnotifycenter="no"
+				mp_cv_have_function_cfnotificationcentergetdarwinnotifycenter="no"
 
 
 fi
@@ -3873,10 +3861,10 @@
 fi
 
 
-	{ echo "$as_me:$LINENO: result: ${od_cv_have_function_cfnotificationcentergetdarwinnotifycenter}" >&5
-echo "${ECHO_T}${od_cv_have_function_cfnotificationcentergetdarwinnotifycenter}" >&6; }
+	{ echo "$as_me:$LINENO: result: ${mp_cv_have_function_cfnotificationcentergetdarwinnotifycenter}" >&5
+echo "${ECHO_T}${mp_cv_have_function_cfnotificationcentergetdarwinnotifycenter}" >&6; }
 
-	if test x"${od_cv_have_function_cfnotificationcentergetdarwinnotifycenter}" = "xyes"; then
+	if test x"${mp_cv_have_function_cfnotificationcentergetdarwinnotifycenter}" = "xyes"; then
 
 cat >>confdefs.h <<\_ACEOF
 #define HAVE_FUNCTION_CFNOTIFICATIONCENTERGETDARWINNOTIFYCENTER
@@ -3897,10 +3885,10 @@
     result=no
 	case $host_os in
 	darwin*)
-		if test "x$od_cv_have_framework_corefoundation" == "xyes" &&
-		   test "x$od_cv_have_framework_systemconfiguration" == "xyes" &&
-		   test "x$od_cv_have_framework_iokit" == "xyes" &&
-		   test "x$od_cv_have_function_cfnotificationcentergetdarwinnotifycenter" == "xyes"; then
+		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"
@@ -3912,12 +3900,13 @@
 	{ echo "$as_me:$LINENO: result: ${result}" >&5
 echo "${ECHO_T}${result}" >&6; }
 
+#MP_PROG_XAR
 
 
 
 
-# set default dports-directory
-DPORTS_DIR_DEFAULT=`pwd | sed -e "s/base/dports/"`
+# set default ports-directory
+PORTS_DIR_DEFAULT=`pwd | sed -e "s/base/ports/"`
 
 # Check for paths
 
@@ -3925,52 +3914,52 @@
 
 
 
-# Check whether --with-dports-dir was given.
-if test "${with_dports_dir+set}" = set; then
-  withval=$with_dports_dir;  dportsdir="$withval"
+# Check whether --with-ports-dir was given.
+if test "${with_ports_dir+set}" = set; then
+  withval=$with_ports_dir;  portsdir="$withval"
 fi
 
 
 
- 	{ echo "$as_me:$LINENO: checking for dports tree" >&5
-echo $ECHO_N "checking for dports tree... $ECHO_C" >&6; }
- 	if test "x$dportsdir" != "x" ; then
- 	  if test -d "$dportsdir" -a -e "$dportsdir/PortIndex" ; then
+ 	{ echo "$as_me:$LINENO: checking for ports tree" >&5
+echo $ECHO_N "checking for ports tree... $ECHO_C" >&6; }
+ 	if test "x$portsdir" != "x" ; then
+ 	  if test -d "$portsdir" -a -e "$portsdir/PortIndex" ; then
  		:
  	  else
- 		{ { echo "$as_me:$LINENO: error: $dportsdir not a valid dports tree" >&5
-echo "$as_me: error: $dportsdir not a valid dports tree" >&2;}
+ 		{ { echo "$as_me:$LINENO: error: $portsdir not a valid ports tree" >&5
+echo "$as_me: error: $portsdir not a valid ports tree" >&2;}
    { (exit 1); exit 1; }; }
  	  fi
  	else
- 		 		if test "x$DPORTS_DIR_DEFAULT" != "x" ; then
- 		  if test -d "$DPORTS_DIR_DEFAULT" -a -e "$DPORTS_DIR_DEFAULT/PortIndex" ; then
- 			dportsdir=$DPORTS_DIR_DEFAULT
+ 		 		if test "x$PORTS_DIR_DEFAULT" != "x" ; then
+ 		  if test -d "$PORTS_DIR_DEFAULT" -a -e "$PORTS_DIR_DEFAULT/PortIndex" ; then
+ 			portsdir=$PORTS_DIR_DEFAULT
  		  fi
  		fi
  	fi
 
- 	if test "x$dportsdir" != "x" ; then
- 		{ echo "$as_me:$LINENO: result: $dportsdir" >&5
-echo "${ECHO_T}$dportsdir" >&6; }
- 		DPORTSDIR="$dportsdir"
+ 	if test "x$portsdir" != "x" ; then
+ 		{ echo "$as_me:$LINENO: result: $portsdir" >&5
+echo "${ECHO_T}$portsdir" >&6; }
+ 		PORTSDIR="$portsdir"
 
  	else
- 		{ echo "$as_me:$LINENO: WARNING: No dports tree found" >&5
-echo "$as_me: WARNING: No dports tree found" >&2;}
+ 		{ echo "$as_me:$LINENO: WARNING: No ports tree found" >&5
+echo "$as_me: WARNING: No ports tree found" >&2;}
  	fi
 
 
 
 
-        { echo "$as_me:$LINENO: checking for ports config directory" >&5
-echo $ECHO_N "checking for ports config directory... $ECHO_C" >&6; }
+        { echo "$as_me:$LINENO: checking for MacPorts config directory" >&5
+echo $ECHO_N "checking for MacPorts config directory... $ECHO_C" >&6; }
 
-	portconfigdir='${sysconfdir}/ports'
+	mpconfigdir='${sysconfdir}/macports'
 
-	{ echo "$as_me:$LINENO: result: $portconfigdir" >&5
-echo "${ECHO_T}$portconfigdir" >&6; }
-	PORTCONFIGDIR="$portconfigdir"
+	{ echo "$as_me:$LINENO: result: $mpconfigdir" >&5
+echo "${ECHO_T}$mpconfigdir" >&6; }
+	MPCONFIGDIR="$mpconfigdir"
 
 
 
@@ -3979,25 +3968,25 @@
 
 # Check whether --with-sqlite was given.
 if test "${with_sqlite+set}" = set; then
-  withval=$with_sqlite; od_sqlite3_dir=$withval
+  withval=$with_sqlite; mp_sqlite3_dir=$withval
 else
-  od_sqlite3_dir=/usr/lib/sqlite3
+  mp_sqlite3_dir=/usr/lib/sqlite3
 fi
 
 
 	{ echo "$as_me:$LINENO: checking for sqlite3 location" >&5
 echo $ECHO_N "checking for sqlite3 location... $ECHO_C" >&6; }
-if test "${od_cv_sqlite3_dir+set}" = set; then
+if test "${mp_cv_sqlite3_dir+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  od_cv_sqlite3_dir=
-		test -r "${od_sqlite3_dir}/pkgIndex.tcl" && od_cv_sqlite3_dir=$od_sqlite3_dir
+  mp_cv_sqlite3_dir=
+		test -r "${mp_sqlite3_dir}/pkgIndex.tcl" && mp_cv_sqlite3_dir=$mp_sqlite3_dir
 
 fi
-{ echo "$as_me:$LINENO: result: $od_cv_sqlite3_dir" >&5
-echo "${ECHO_T}$od_cv_sqlite3_dir" >&6; }
+{ echo "$as_me:$LINENO: result: $mp_cv_sqlite3_dir" >&5
+echo "${ECHO_T}$mp_cv_sqlite3_dir" >&6; }
 
-	SQLITE3_DIR=$od_cv_sqlite3_dir
+	SQLITE3_DIR=$mp_cv_sqlite3_dir
 
 
 
@@ -6273,7 +6262,7 @@
 	{ echo "$as_me:$LINENO: checking if readlink conforms to POSIX 1003.1a" >&5
 echo $ECHO_N "checking if readlink conforms to POSIX 1003.1a... $ECHO_C" >&6; }
 
-	if test "${dp_cv_readlink_is_posix_1003_1a+set}" = set; then
+	if test "${mp_cv_readlink_is_posix_1003_1a+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
 
@@ -6316,14 +6305,14 @@
 	 test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
 
-				dp_cv_readlink_is_posix_1003_1a="yes"
+				mp_cv_readlink_is_posix_1003_1a="yes"
 
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 
-				dp_cv_readlink_is_posix_1003_1a="no"
+				mp_cv_readlink_is_posix_1003_1a="no"
 
 
 fi
@@ -6333,10 +6322,10 @@
 fi
 
 
-	{ echo "$as_me:$LINENO: result: ${dp_cv_readlink_is_posix_1003_1a}" >&5
-echo "${ECHO_T}${dp_cv_readlink_is_posix_1003_1a}" >&6; }
+	{ echo "$as_me:$LINENO: result: ${mp_cv_readlink_is_posix_1003_1a}" >&5
+echo "${ECHO_T}${mp_cv_readlink_is_posix_1003_1a}" >&6; }
 
-	if test x"${dp_cv_readlink_is_posix_1003_1a}" = "xno"; then
+	if test x"${mp_cv_readlink_is_posix_1003_1a}" = "xno"; then
 
 cat >>confdefs.h <<\_ACEOF
 #define READLINK_IS_NOT_P1003_1A
@@ -8239,8 +8228,8 @@
 		"__no__yes__")
 		# either the user said --without-x, or it was not found
 		# at all (runtime or headers)
-			{ echo "$as_me:$LINENO: WARNING: X11 not available. You will not be able to use dports that use X11" >&5
-echo "$as_me: WARNING: X11 not available. You will not be able to use dports that use X11" >&2;}
+			{ echo "$as_me:$LINENO: WARNING: X11 not available. You will not be able to use ports that use X11" >&5
+echo "$as_me: WARNING: X11 not available. You will not be able to use ports that use X11" >&2;}
 			state=0
 			;;
 		"__yes__yes__")
@@ -9049,50 +9038,6 @@
 
 
 	case $host_os in
-		freebsd*)
-			# FreeBSD installs a dummy tclsh (annoying)
-			# Look for a real versioned tclsh first
-			# Extract the first word of "tclsh${TCL_VERSION} tclsh", so it can be a program name with args.
-set dummy tclsh${TCL_VERSION} tclsh; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_path_TCLSH+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_path_TCLSH="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$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
-  { echo "$as_me:$LINENO: result: $TCLSH" >&5
-echo "${ECHO_T}$TCLSH" >&6; }
-else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}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.
@@ -9518,7 +9463,7 @@
 
 
 
-#misc variables that need to be expanded for substitution into tcl
+# misc variables that need to be expanded for substitution into tcl
 
 oldprefix=$prefix
 if test "x$prefix" = "xNONE" ; then
@@ -9529,8 +9474,8 @@
 
 # do this twice, since there is a nested variable of
 # ${prefix} inside of ${sysconfdir}
-eval "PORTCONFIGDIR_EXPANDED=$PORTCONFIGDIR"
-eval "PORTCONFIGDIR_EXPANDED=$PORTCONFIGDIR_EXPANDED"
+eval "MPCONFIGDIR_EXPANDED=$MPCONFIGDIR"
+eval "MPCONFIGDIR_EXPANDED=$MPCONFIGDIR_EXPANDED"
 
 eval "localstatedir_expanded=$localstatedir"
 
@@ -9539,10 +9484,9 @@
 
 
 # Output
+ac_config_files="$ac_config_files Makefile Mk/macports.autoconf.mk doc/prefix.mtree doc/macosx.mtree doc/macports.conf src/Makefile src/macports1.0/macports_autoconf.tcl src/port1.0/port_autoconf.tcl src/registry1.0/registry_autoconf.tcl src/programs/Makefile src/macports1.0/macports_fastload.tcl"
 
-ac_config_files="$ac_config_files Makefile Mk/dports.autoconf.mk doc/prefix.mtree doc/macosx.mtree doc/ports.conf src/Makefile src/darwinports1.0/darwinports_autoconf.tcl src/port1.0/port_autoconf.tcl src/registry1.0/registry_autoconf.tcl src/programs/Makefile src/darwinports1.0/darwinports_fastload.tcl"
 
-
 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
@@ -10099,16 +10043,16 @@
     "src/config.h") CONFIG_HEADERS="$CONFIG_HEADERS src/config.h" ;;
     "src/programs/daemondo/Makefile") CONFIG_FILES="$CONFIG_FILES src/programs/daemondo/Makefile" ;;
     "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
-    "Mk/dports.autoconf.mk") CONFIG_FILES="$CONFIG_FILES Mk/dports.autoconf.mk" ;;
+    "Mk/macports.autoconf.mk") CONFIG_FILES="$CONFIG_FILES Mk/macports.autoconf.mk" ;;
     "doc/prefix.mtree") CONFIG_FILES="$CONFIG_FILES doc/prefix.mtree" ;;
     "doc/macosx.mtree") CONFIG_FILES="$CONFIG_FILES doc/macosx.mtree" ;;
-    "doc/ports.conf") CONFIG_FILES="$CONFIG_FILES doc/ports.conf" ;;
+    "doc/macports.conf") CONFIG_FILES="$CONFIG_FILES doc/macports.conf" ;;
     "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
-    "src/darwinports1.0/darwinports_autoconf.tcl") CONFIG_FILES="$CONFIG_FILES src/darwinports1.0/darwinports_autoconf.tcl" ;;
+    "src/macports1.0/macports_autoconf.tcl") CONFIG_FILES="$CONFIG_FILES src/macports1.0/macports_autoconf.tcl" ;;
     "src/port1.0/port_autoconf.tcl") CONFIG_FILES="$CONFIG_FILES src/port1.0/port_autoconf.tcl" ;;
     "src/registry1.0/registry_autoconf.tcl") CONFIG_FILES="$CONFIG_FILES src/registry1.0/registry_autoconf.tcl" ;;
     "src/programs/Makefile") CONFIG_FILES="$CONFIG_FILES src/programs/Makefile" ;;
-    "src/darwinports1.0/darwinports_fastload.tcl") CONFIG_FILES="$CONFIG_FILES src/darwinports1.0/darwinports_fastload.tcl" ;;
+    "src/macports1.0/macports_fastload.tcl") CONFIG_FILES="$CONFIG_FILES src/macports1.0/macports_fastload.tcl" ;;
 
   *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
 echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
@@ -10231,6 +10175,7 @@
 INSTALL_DATA!$INSTALL_DATA$ac_delim
 SET_MAKE!$SET_MAKE$ac_delim
 LN_S!$LN_S$ac_delim
+MTREE!$MTREE$ac_delim
 CVS!$CVS$ac_delim
 RSYNC!$RSYNC$ac_delim
 HAVE_LAUNCHD!$HAVE_LAUNCHD$ac_delim
@@ -10242,16 +10187,14 @@
 GNUTAR!$GNUTAR$ac_delim
 TAR_CMD!$TAR_CMD$ac_delim
 CFLAGS_QUICHEEATERS!$CFLAGS_QUICHEEATERS$ac_delim
-MTREE!$MTREE$ac_delim
-subdirs!$subdirs$ac_delim
 HAVE_FRAMEWORK_COREFOUNDATION!$HAVE_FRAMEWORK_COREFOUNDATION$ac_delim
 HAVE_FRAMEWORK_SYSTEMCONFIGURATION!$HAVE_FRAMEWORK_SYSTEMCONFIGURATION$ac_delim
 HAVE_FRAMEWORK_IOKIT!$HAVE_FRAMEWORK_IOKIT$ac_delim
 HAVE_FUNCTION_CFNOTIFICATIONCENTERGETDARWINNOTIFYCENTER!$HAVE_FUNCTION_CFNOTIFICATIONCENTERGETDARWINNOTIFYCENTER$ac_delim
 REPLACEMENT_PROGS!$REPLACEMENT_PROGS$ac_delim
 EXTRA_PROGS!$EXTRA_PROGS$ac_delim
-DPORTSDIR!$DPORTSDIR$ac_delim
-PORTCONFIGDIR!$PORTCONFIGDIR$ac_delim
+PORTSDIR!$PORTSDIR$ac_delim
+MPCONFIGDIR!$MPCONFIGDIR$ac_delim
 SQLITE3_DIR!$SQLITE3_DIR$ac_delim
 DSTUSR!$DSTUSR$ac_delim
 DSTGRP!$DSTGRP$ac_delim
@@ -10267,6 +10210,7 @@
 X_LIBS!$X_LIBS$ac_delim
 X_EXTRA_LIBS!$X_EXTRA_LIBS$ac_delim
 TCL_VERSION!$TCL_VERSION$ac_delim
+TCL_BIN_DIR!$TCL_BIN_DIR$ac_delim
 _ACEOF
 
   if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
@@ -10308,7 +10252,6 @@
 ac_delim='%!_!# '
 for ac_last_try in false false false false false :; do
   cat >conf$$subs.sed <<_ACEOF
-TCL_BIN_DIR!$TCL_BIN_DIR$ac_delim
 TCL_SRC_DIR!$TCL_SRC_DIR$ac_delim
 TCL_LIB_FILE!$TCL_LIB_FILE$ac_delim
 TCL_LIB_FLAG!$TCL_LIB_FLAG$ac_delim
@@ -10322,6 +10265,7 @@
 CURL_CONFIG!$CURL_CONFIG$ac_delim
 CFLAGS_LIBCURL!$CFLAGS_LIBCURL$ac_delim
 LDFLAGS_LIBCURL!$LDFLAGS_LIBCURL$ac_delim
+subdirs!$subdirs$ac_delim
 OUR_INCLUDED_PACKAGES!$OUR_INCLUDED_PACKAGES$ac_delim
 INCLUDES!$INCLUDES$ac_delim
 CFLAGS_DEBUG!$CFLAGS_DEBUG$ac_delim
@@ -10334,7 +10278,7 @@
 SHLIB_SUFFIX!$SHLIB_SUFFIX$ac_delim
 TCL_CC!$TCL_CC$ac_delim
 prefix_expanded!$prefix_expanded$ac_delim
-PORTCONFIGDIR_EXPANDED!$PORTCONFIGDIR_EXPANDED$ac_delim
+MPCONFIGDIR_EXPANDED!$MPCONFIGDIR_EXPANDED$ac_delim
 localstatedir_expanded!$localstatedir_expanded$ac_delim
 LIBOBJS!$LIBOBJS$ac_delim
 LTLIBOBJS!$LTLIBOBJS$ac_delim

Modified: branches/dp2mp-move/base/configure.ac
===================================================================
--- trunk/base/configure.ac	2007-04-22 07:33:59 UTC (rev 24327)
+++ branches/dp2mp-move/base/configure.ac	2007-04-24 17:28:16 UTC (rev 24454)
@@ -5,14 +5,15 @@
 AC_CONFIG_HEADERS([src/config.h])
 AC_CANONICAL_SYSTEM
 
-# Check user PATH for DP paths, and remove as necessary.
-OD_PATH_SCAN
+# Check user PATH for MP paths, and remove as necessary.
+MP_PATH_SCAN
 
 # Checks for programs.
 AC_PROG_CC
 AC_PROG_INSTALL
 AC_PROG_MAKE_SET
 AC_PROG_LN_S
+AC_PATH_PROG(MTREE, [mtree], [])
 AC_PATH_PROG(CVS, [cvs], [])
 AC_PATH_PROG(RSYNC, [rsync], [])
 AC_CHECK_PROG(HAVE_LAUNCHD, [launchd], [yes], [])
@@ -22,6 +23,7 @@
 AC_PATH_PROG(XAR, [xar], [])
 
 # Define some precious variables allowing user to override PATH for some programs
+AC_ARG_VAR(MTREE, [path to mtree command])
 AC_ARG_VAR(CVS, [path to cvs command])
 AC_ARG_VAR(RSYNC, [path to rsync command])
 AC_ARG_VAR(TAR, [path to tar command])
@@ -29,7 +31,7 @@
 AC_ARG_VAR(BZIP2, [path to bzip2 command])
 AC_ARG_VAR(XAR, [path to xar command])
 
-OD_TAR_NO_SAME_OWNER
+MP_TAR_NO_SAME_OWNER
 
 # Quiche eaters options.
 if test x$GCC = xyes; then
@@ -37,28 +39,27 @@
 fi
 AC_SUBST(CFLAGS_QUICHEEATERS)
 
-OD_COMPILER_ATTRIBUTE_UNUSED
+MP_COMPILER_ATTRIBUTE_UNUSED
 
-OD_PROG_MTREE
-#OD_PROG_XAR
-OD_PROG_DAEMONDO
+MP_PROG_DAEMONDO
+#MP_PROG_XAR
 
 AC_SUBST(REPLACEMENT_PROGS)
 AC_SUBST(EXTRA_PROGS)
 
-# set default dports-directory
-DPORTS_DIR_DEFAULT=`pwd | sed -e "s/base/dports/"`
+# set default ports-directory
+PORTS_DIR_DEFAULT=`pwd | sed -e "s/base/ports/"`
 
 # Check for paths
 AC_PREFIX_DEFAULT(/opt/local)
-OD_PATH_DPORTSDIR([$DPORTS_DIR_DEFAULT])
-OD_PATH_PORTCONFIGDIR
-OD_PATH_SQLITE3
+MP_PATH_PORTSDIR([$PORTS_DIR_DEFAULT])
+MP_PATH_MPCONFIGDIR
+MP_PATH_SQLITE3
 
 # Check for install ownership
-OD_CHECK_INSTALLUSER
-OD_CHECK_INSTALLGROUP
-OD_DIRECTORY_MODE
+MP_CHECK_INSTALLUSER
+MP_CHECK_INSTALLGROUP
+MP_DIRECTORY_MODE
 
 # Check for standard header files.
 AC_HEADER_STDC
@@ -75,12 +76,12 @@
 AC_FUNC_FORK
 AC_FUNC_STRERROR_R
 AC_CHECK_FUNCS([bzero memset dup2 regcomp strdup strerror strtol fgetln lockf flock setmode strcasecmp strncasecmp strlcpy copyfile])
-DP_CHECK_READLINK_IS_P1003_1A
+MP_CHECK_READLINK_IS_P1003_1A
 
 # Check for md5 implementation
-OD_LIB_MD5
+MP_LIB_MD5
 # Check for X11 and paraphernalia
-OD_CHECK_X11
+MP_CHECK_X11
 
 # Check for readline
 AC_CHECK_LIB([readline], [readline])
@@ -106,16 +107,16 @@
 SC_PUBLIC_TCL_HEADERS
 
 # Check for tclsh binary
-OD_PROG_TCLSH
+MP_PROG_TCLSH
 
 # Check for Tcl package path
-OD_TCL_PACKAGE_DIR
+MP_TCL_PACKAGE_DIR
 
 # Check if thread is enabled.
-OD_TCL_THREAD_SUPPORT
+MP_TCL_THREAD_SUPPORT
 
 ## libcurl
-OD_LIBCURL_FLAGS
+MP_LIBCURL_FLAGS
 
 # Do we have curl_easy_strerror?
 AH_TEMPLATE([HAVE_CURL_EASY_STRERROR],
@@ -136,7 +137,7 @@
 
 # Check if thread package is already installed.
 if test "x$with_included_tclthread" = "xunspecified" ; then
-	OD_TCL_PACKAGE(
+	MP_TCL_PACKAGE(
 		[Thread],
 		[AC_MSG_RESULT([yes]); with_included_tclthread=no],
 		[AC_MSG_RESULT([no]); with_included_tclthread=yes])
@@ -179,7 +180,7 @@
 AC_SUBST(TCL_STUB_LIB_SPEC)
 AC_SUBST(TCL_CC)
 
-#misc variables that need to be expanded for substitution into tcl
+# misc variables that need to be expanded for substitution into tcl
 
 oldprefix=$prefix
 if test "x$prefix" = "xNONE" ; then
@@ -190,9 +191,9 @@
 AC_SUBST(prefix_expanded)
 # do this twice, since there is a nested variable of
 # ${prefix} inside of ${sysconfdir}
-eval "PORTCONFIGDIR_EXPANDED=$PORTCONFIGDIR"
-eval "PORTCONFIGDIR_EXPANDED=$PORTCONFIGDIR_EXPANDED"
-AC_SUBST(PORTCONFIGDIR_EXPANDED)
+eval "MPCONFIGDIR_EXPANDED=$MPCONFIGDIR"
+eval "MPCONFIGDIR_EXPANDED=$MPCONFIGDIR_EXPANDED"
+AC_SUBST(MPCONFIGDIR_EXPANDED)
 eval "localstatedir_expanded=$localstatedir"
 AC_SUBST(localstatedir_expanded)
 
@@ -203,19 +204,18 @@
 dnl SC_CONFIG_MANPAGES
 
 # Output
-
 AC_CONFIG_FILES([
 	Makefile
-	Mk/dports.autoconf.mk
+	Mk/macports.autoconf.mk
 	doc/prefix.mtree
 	doc/macosx.mtree
-	doc/ports.conf
+	doc/macports.conf
 	src/Makefile
-	src/darwinports1.0/darwinports_autoconf.tcl
+	src/macports1.0/macports_autoconf.tcl
 	src/port1.0/port_autoconf.tcl
 	src/registry1.0/registry_autoconf.tcl
 	src/programs/Makefile
-	src/darwinports1.0/darwinports_fastload.tcl
+	src/macports1.0/macports_fastload.tcl
 ])
 
 AC_OUTPUT

Modified: branches/dp2mp-move/base/doc/Makefile
===================================================================
--- trunk/base/doc/Makefile	2007-04-22 07:33:59 UTC (rev 24327)
+++ branches/dp2mp-move/base/doc/Makefile	2007-04-24 17:28:16 UTC (rev 24454)
@@ -1,10 +1,10 @@
-MAN5=		ports.conf.5
+MAN5=		macports.conf.5
 MAN7=		portfile.7 portstyle.7 porthier.7 portgroup.7
 INSTALLDIR=	${DESTDIR}${prefix}
 TOPSRCDIR=	..
 
 ifneq ($(MAKECMDGOALS),distclean)
-include ../Mk/dports.autoconf.mk
+include ../Mk/macports.autoconf.mk
 endif
 
 all:
@@ -14,7 +14,7 @@
 test:
 
 distclean: clean
-	rm -f prefix.mtree ports.conf macosx.mtree
+	rm -f prefix.mtree macports.conf macosx.mtree
 
 install:
 	$(INSTALL) -d -o ${DSTUSR} -g ${DSTGRP} -m ${DSTMODE} ${INSTALLDIR}
@@ -24,18 +24,18 @@
 	if test -L "${INSTALLDIR}/man" ; then \
 		rm -f "${INSTALLDIR}/man"; \
 	fi
-	
+
 	if test ! -e "${INSTALLDIR}/man" ; then \
 		$(LN_S) share/man ${INSTALLDIR}/man; \
 	fi
-	
-	# Install the ports.conf file. If it's already installed, upgrade it
-	if test ! -e ${DESTDIR}/${portconfigdir}/ports.conf ; then \
+
+	# Install the macports.conf file. If it's already installed, upgrade it
+	if test ! -e ${DESTDIR}/${portconfigdir}/macports.conf ; then \
 		set -x; \
-		$(INSTALL) -o ${DSTUSR} -g ${DSTGRP} -m 644 ports.conf ${DESTDIR}${portconfigdir}; \
+		$(INSTALL) -o ${DSTUSR} -g ${DSTGRP} -m 644 macports.conf ${DESTDIR}${portconfigdir}; \
 	else \
-		sed -e s/rsync.opendarwin.org/rsync.darwinports.org/ ${DESTDIR}${portconfigdir}/ports.conf > ${DESTDIR}${portconfigdir}/ports.conf.tmp && \
-			mv ${DESTDIR}${portconfigdir}/ports.conf.tmp ${DESTDIR}${portconfigdir}/ports.conf; \
+		sed -e s/rsync.darwinports.org/rsync.macports.org/ ${DESTDIR}${portconfigdir}/macports.conf > ${DESTDIR}${portconfigdir}/macports.conf.tmp && \
+			mv ${DESTDIR}${portconfigdir}/macports.conf.tmp ${DESTDIR}${portconfigdir}mac/macports.conf; \
 	fi
 
 	# Install the sources.conf file. If it's already installed, upgrade it
@@ -43,19 +43,19 @@
 		set -x; \
 		$(INSTALL) -o ${DSTUSR} -g ${DSTGRP} -m 644 sources.conf ${DESTDIR}${portconfigdir}; \
 	else \
-		sed -e s/rsync.opendarwin.org/rsync.darwinports.org/ ${DESTDIR}${portconfigdir}/sources.conf > ${DESTDIR}${portconfigdir}/sources.conf.tmp && \
+		sed -e s/rsync.darwinports.org/rsync.macports.org/ ${DESTDIR}${portconfigdir}/sources.conf > ${DESTDIR}${portconfigdir}/sources.conf.tmp && \
 			mv ${DESTDIR}${portconfigdir}/sources.conf.tmp ${DESTDIR}${portconfigdir}/sources.conf; \
 	fi
-	
+
 	$(SILENT)if test ! -e ${DESTDIR}${portconfigdir}/variants.conf ; then \
 		set -x; \
 		$(INSTALL) -o ${DSTUSR} -g ${DSTGRP} -m 644 variants.conf ${DESTDIR}${portconfigdir}; \
 	fi
 	$(INSTALL) -o ${DSTUSR} -g ${DSTGRP} -m 644 prefix.mtree ${DESTDIR}${portconfigdir}
-	$(INSTALL) -d -o ${DSTUSR} -g ${DSTGRP} -m ${DSTMODE} ${INSTALLDIR}/share/darwinports/resources/port1.0/install
-	$(INSTALL) -o ${DSTUSR} -g ${DSTGRP} -m 644 prefix.mtree ${INSTALLDIR}/share/darwinports/resources/port1.0/install/
-	$(INSTALL) -o ${DSTUSR} -g ${DSTGRP} -m 644 macosx.mtree ${INSTALLDIR}/share/darwinports/resources/port1.0/install/
-	$(INSTALL) -o ${DSTUSR} -g ${DSTGRP} -m 444 ports.conf.5 ${INSTALLDIR}/share/man/man5
+	$(INSTALL) -d -o ${DSTUSR} -g ${DSTGRP} -m ${DSTMODE} ${INSTALLDIR}/share/macports/resources/port1.0/install
+	$(INSTALL) -o ${DSTUSR} -g ${DSTGRP} -m 644 prefix.mtree ${INSTALLDIR}/share/macports/resources/port1.0/install/
+	$(INSTALL) -o ${DSTUSR} -g ${DSTGRP} -m 644 macosx.mtree ${INSTALLDIR}/share/macports/resources/port1.0/install/
+	$(INSTALL) -o ${DSTUSR} -g ${DSTGRP} -m 444 macports.conf.5 ${INSTALLDIR}/share/man/man5
 	$(INSTALL) -o ${DSTUSR} -g ${DSTGRP} -m 444 portfile.7 ${INSTALLDIR}/share/man/man7
 	$(INSTALL) -o ${DSTUSR} -g ${DSTGRP} -m 444 portstyle.7 ${INSTALLDIR}/share/man/man7
 	$(INSTALL) -o ${DSTUSR} -g ${DSTGRP} -m 444 porthier.7 ${INSTALLDIR}/share/man/man7

Deleted: branches/dp2mp-move/base/doc/README.platforms
===================================================================
--- trunk/base/doc/README.platforms	2007-04-22 07:33:59 UTC (rev 24327)
+++ branches/dp2mp-move/base/doc/README.platforms	2007-04-24 17:28:16 UTC (rev 24454)
@@ -1,62 +0,0 @@
-DarwinPorts can be used on platforms other than Mac OS X 10.2 and 10.3,
-but requires bootstrapping of various requirements.
-
-Currently, DarwinPorts has been verified to work on the following
-platforms:
-
-Solaris (Sparc) 8 & 9 (tcl, curl, openssl, bzip2 need to be installed manually)
-FreeBSD >= 4.8 (tcl and curl need to be installed manually)
-OpenBSD >= 3.3 (tcl, curl and bzip2 need to be installed manually)
-
-We will be assuming that you are installing into PREFIX=/opt/local,
-although any path can be used. Further, we are assuming a sh-based shell
-
-The following compilers have been tested:
-
-Solaris:
-Sunsoft Forte Developer 7 C 5.4
-
-0)
-PREFIX=/opt/local
-export PREFIX
-
-INSTALL REQUIREMENTS
-1) Tcl. Use the Portfile as a template
-gzip -c -d tcl8.4.6-src.tar.gz | tar xf -
-cd tcl8.4.6
-cd unix
-./configure --prefix=$PREFIX --mandir=$PREFIX/share/man
-make
-make install
-cd $PREFIX/bin
-ln -s tclsh8.4 tclsh
-$ echo puts foo | tclsh
-foo
-
-2) OpenSSL
-gzip -c -d openssl-0.9.7d.tar.gz | tar xf -
-cd openssl-0.9.7d
-./config --prefix=$PREFIX --openssldir=$PREFIX/etc/openssl no-asm no-krb5 shared
-make
-make install
-export LD_LIBRARY_PATH=$PREFIX/lib
-
-3) Curl
-gzip -c -d curl-7.11.1.tar.gz | tar xf -
-cd curl-7.11.1
-./configure --prefix=$PREFIX --mandir=$PREFIX/share/man --with-ssl=$PREFIX
-make
-make install
-curl --version
-
-4) GNU coreutils
-gzip -c -d coreutils-5.2.1.tar.gz | tar xf -
-cd coreutils-5.2.1
-./configure --prefix=$PREFIX --mandir=$PREFIX/share/man
-make
-make install
-
-5) darwinports
-./configure --prefix=$PREFIX --with-install-user=ssen --with-install-group=mit --with-tcl=$PREFIX/lib --with-tclinclude=$PREFIX/include CPPFLAGS="-I$PREFIX/include" LDFLAGS="-L$PREFIX/lib"
-make
-make install

Copied: branches/dp2mp-move/base/doc/macports.conf.5 (from rev 24327, trunk/base/doc/ports.conf.5)
===================================================================
--- branches/dp2mp-move/base/doc/macports.conf.5	                        (rev 0)
+++ branches/dp2mp-move/base/doc/macports.conf.5	2007-04-24 17:28:16 UTC (rev 24454)
@@ -0,0 +1,185 @@
+.\" Copyright (c) 2005 Matt Anton <matt at opendarwin.org>
+.\" 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 Eric Melville 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 REGENTS 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.
+.\"
+.Dd August 31, 2005
+.Dt PORTS.CONF 5 "MacPorts.org"
+.Os 
+.Sh NAME
+ports.conf
+.Nd Configuration file of the MacPorts system
+.Sh DESCRIPTION
+.Nm ports.conf
+is the configuration file used to bootstrap the MacPorts system. This file is read by the
+.Nm port
+command and determines how it behaves. Lines beginning with '#' are comments, empty lines are ignored.
+The format is that of a simple key/value space or tab separated pair.
+.Pp
+The file contains entries of the form:
+.Pp
+.Dl Va "<key> <value>"
+.Pp
+The value of any given key can be referred to by the '${<keyname>}' abstraction, where <keyname> expands
+to the key in question.
+.Pp
+.Sh KEYS
+The following keys are used by
+.Nm port
+itself:
+.Pp
+.Bl -tag -width lc
+.It Va prefix
+Sets the directory where ports are installed. Any path may be used but those with spaces and/or non ascii
+characters should be avoided, as this can broke some ports. This key is often referred to as '${prefix}'.
+.br
+.Ic Default:
+/opt/local
+.It Va x11prefix
+Path containing an X11 installation on your system.
+.br
+.Ic Default:
+/usr/X11R6
+.It Va portdbpath
+Directory where MacPorts keeps working data as downloaded sources, installed ports receipts
+and the main registry. Same path restrictions apply as for '${prefix}'.
+.br
+.Ic Default:
+${prefix}/var/db/dports
+.It Va portdbformat
+Storage type to use for the MacPorts registry. Currently the only supportted format is "flat".
+.br
+.Ic Default:
+flat
+.It Va portinstalltype
+Sets the mode in which ports are installed by MacPorts. Supported values are 'direct' or 'image'.
+The 'direct' mode is often used on systems that do not support 'image' due to limitations in their
+installed version of TCL. In 'direct' more ports are installed directly into '${prefix}' and only
+one flavor of a port can be installed at any given time. In 'image' mode multiple flavors of a port
+(i.e., different versions and/or any possible combination of its variants) can be installed concurrently
+into '${portdbpath}/software/${portname}' and only one can be "activated" onto '${prefix}' via soft or
+hard links from the former to the latter.
+.br
+.Ic Default:
+image
+.\" I think Paul wrote code to suppot image on Jaguar, so the following comment may no longer be needed.
+.\" is this the case?
+.Pp
+NOTE. Mac OS X 10.2 and Darwin 6.x users should switch to 'direct' mode to have MacPorts working properly
+on their systems.
+.It Va sources_conf
+Location of the sources file. This file enables rsync synchronization of the default dports tree with the
+MacPorts rsync server (through the "sync" target of the
+.Nm port
+commnand) and any other local tree(s) you might have.
+.br
+.Ic Default:
+${prefix}/etc/ports/sources.conf
+.It Va variants_conf
+Location of the optional global variants definition file, listing those that should be used in all installed
+ports if available.
+.br
+.Ic Default:
+${prefix}/etc/ports/variants.conf
+.It Va portarchivemode
+Key governing the creation of binary archives of installed ports for installation/reinstallation ease.
+.br
+.Ic Default:
+yes
+.It Va portarchivepath
+Location where to store/retrieve ports binary archive files from when archive mode is active.
+.br
+.Ic Default:
+${prefix}/var/db/dports/packages
+.It Va portarchivetype
+Colon or comma separated, space free list of supported formats of archives to create or read from when
+\&'${archivemode}' is set to 'yes'. Use of multiple types will cause archive creation to build all the
+specified types in one step. Unarchive uses multiple types as a search list to locate any existing archive,
+with the first found match being used.
+.br
+Supported types are: tgz, tar, tbz, tbz2, xar, zip, cpgz, cpio
+.br
+.Ic Default:
+tgz
+.It Va portautoclean
+Automatic cleaning of the build directory of a given port after it has been installed.
+.br
+.Ic Default:
+yes
+.It Va startupitem_type
+Set the default type of startupitems to be generated, overridable by Portfiles that explicitly state a
+startupitem.type key. If set to "default", then a type will be selected that's appropriate to the OS.
+Supported types are: SystemStarter, launchd, default, rcNG.
+.br
+.Ic Default:
+default
+.It va destroot_umask
+Umask value to use during the destrooting or a port.
+.br
+.Ic Default:
+022
+.It Va rsync_server
+Default rsync server to connect to when running "selfupdate" through the
+.Nm port
+command to update your entire MacPorts
+installation (spanning both the MacPorts infrastucture and the dports tree).
+.br
+.Ic Default:
+rsync.darwinports.org
+.It Va rsync_dir
+Rsync directory from which to pull the base/ component (infrastructure) of the MacPorts system off
+of the default rsync server.
+.br
+.Ic Default:
+dpupdate1/base/ (to pull in the sources from the shipping "release1" branch off of the MacPorts rsync
+server)
+.It Va rsync_options
+Default rsync options to use when connecting to the rsync server.
+.br
+.Ic Default:
+-rtzv --delete --delete-after
+.It Va binpath
+Sets the directory search path for locating system executables used by MacPorts. This variable should contain
+the paths for locating utilities such as rsync, tar, cvs and others.
+.br
+.Ic Default:
+${prefix}/bin:${prefix}/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin
+.It Va extra_env
+List of extra environment variables MacPorts should keep in the user's environment when sanitizing it.
+.El
+.Sh FILES
+.Bl -tag -width
+.It Va ${prefix}/etc/ports/ports.conf
+Standard system-wide MacPorts configuration file.
+.It Va ~/.macports/ports.conf
+User-specific configuration override. This file, if found, will be used instead of the default file at
+${prefix}/etc/port/ports.conf.
+.El
+.Sh SEE ALSO
+.Xr port 1 ,
+.Xr portfile 7 ,
+.Xr portgroup 7 ,
+.Xr portstyle 7
+.Xr porthier 7 ,
+.Sh AUTHORS
+.An "Juan Manuel Palacios" Aq jmpp at macports.org
+.An "Matt Anton" Aq matt at opendarwin.org

Copied: branches/dp2mp-move/base/doc/macports.conf.in (from rev 24327, trunk/base/doc/ports.conf.in)
===================================================================
--- branches/dp2mp-move/base/doc/macports.conf.in	                        (rev 0)
+++ branches/dp2mp-move/base/doc/macports.conf.in	2007-04-24 17:28:16 UTC (rev 24454)
@@ -0,0 +1,62 @@
+# Set the directory in which to install ports
+prefix			@prefix_expanded@
+
+# Where to store MacPorts working data
+portdbpath		@localstatedir_expanded@/db/dports
+
+# Type of storage to use for the port registry information, "flat" or "sqlite"
+# NOTE: sqlite not yet supported.
+portdbformat		flat
+
+# Type of installation to do for ports, "direct" or "image".  See ports.conf(5) and online documentation.
+portinstalltype		image
+
+# Directory containing the X11 installation.
+x11prefix		/usr/X11R6
+
+# Where to find the sources list.
+sources_conf		@PORTCONFIGDIR_EXPANDED@/sources.conf
+
+# Where to find global variants definition file (optional)
+variants_conf		@PORTCONFIGDIR_EXPANDED@/variants.conf
+
+# Create and use binary archive packages for installation/reinstallation ease
+portarchivemode		no
+
+# Where to store/retrieve ports binary archive files
+portarchivepath		@localstatedir_expanded@/db/dports/packages
+
+# Type of binary archive packages to create when using archive mode
+#
+# Note: Multiple types ARE allowed and must be a colon or comma
+# separated list of choices (NO spaces). Use of multiple types will
+# cause archive creation to build all the specified types in one step.
+# Unarchive uses multiple types as a search list to locate the archive,
+# first archive to match one of the specified types in order is used.
+#
+# Supported types: tgz (default), tar, tbz, tbz2, xar, zip, cpgz, cpio
+portarchivetype		tgz
+
+# Set whether to automatically execute "clean" after "install" of ports
+portautoclean		yes
+
+# Rsync server to use
+rsync_server		rsync.darwinports.org
+
+# Rsync directory from which to pull the base/ component (infrastructure) of DP
+rsync_dir			dpupdate1/base/
+
+# Rsync options
+rsync_options		-rtzv --delete --delete-after
+
+# Options for generated startup items
+# startupitem_type may be "default", "systemstarter", or "launchd";
+# if the option is empty or "default" then a startupitem type appropriate
+# to the platform will be chosen. Tiger will default to launchd, while
+# older Mac OS X systems will default to systemstarter.
+startupitem_type	default
+
+# Extra environment variables to keep. Any variables listed here are added
+# to the list of variables that are not removed from the environment used
+# while processing ports
+# extra_env			KEEP_THIS THIS_TOO

Deleted: branches/dp2mp-move/base/doc/portfile.7
===================================================================
--- trunk/base/doc/portfile.7	2007-04-22 07:33:59 UTC (rev 24327)
+++ branches/dp2mp-move/base/doc/portfile.7	2007-04-24 17:28:16 UTC (rev 24454)
@@ -1,1697 +0,0 @@
-.\" portfile.7
-.\"
-.\" Copyright (c) 2002 Apple Computer, Inc.
-.\" 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 Apple Computer, 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
-.\" 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.
-.\"
-.Dd February 13, 2007
-.Dt PORTFILE 7 "Apple Computer, Inc."
-.Os
-.Sh NAME
-.Nm Portfile
-.Nd MacPorts description file reference
-.Sh DESCRIPTION
-A complete reference of all available
-.Nm
-variables and example syntax.
-.Nm Portfiles
-consist of valid TCL, allowing for simple key/value pair syntax as well
-as utilization of TCL's extensive functionality.
-.Nm Portfiles
-are encoded in UTF-8.
-.Pp
-The
-.Nm Macports System
-uses a target dependency system based on a
-depends/provides model, allowing for targets to be registered and
-executed in the correct order based on their individual requirements.
-.Pp
-A
-.Nm
-author needs to be aware of the various standard targets, the options
-that they require and the variables that both the targets and the port
-system provide.
-.Sh PORTSYSTEM
-Portfiles must begin with a PortSystem line that defines which version of the
-Portfile interpreter should be used.
-.br
-.Sy Synopsis:
-.Dl PortSystem 1.0
-.Sh MAIN VARIABLES
-All ports are required to set certain variables.
-.Bl -tag -width lc
-.It Ic name
-Full name of port.
-.br
-.Sy Type:
-.Em required
-.br
-.Sy Example:
-.Dl name XFree86
-.It Ic version
-Upstream version of software.
-.br
-.Sy Type:
-.Em required
-.br
-.Sy Example:
-.Dl version 4.2.1
-.It Ic epoch
-If a port's version numbering changes such that a newer version looks
-older than the previous version, the
-.Ic epoch
-should be increased. Often the
-.Ic epoch
-is formatted like a date.
-.br
-.Sy Type:
-.Em optional
-.br
-.Sy Default:
-.Em 0
-.br
-.Sy Example:
-.Dl epoch 20041231
-.It Ic description
-One line description of the software and what it does.
-.br
-.Sy Type:
-.Em required
-.br
-.Sy Example:
-.Dl description Dictionary Server Protocol (RFC2229) client
-.It Ic long_description
-A verbose description of the software and what it does.
-.br
-.Sy Type:
-.Em required
-.br
-.Sy Example:
-.Bd -literal -offset indent -compact
-long_description The GNU Image Manipulation Program \e\
-
-    (GIMP) is a powerful tool for the preparation and \e\
-
-    manipulation of digital images. The GIMP provides \e\
-
-    the user with a wide variety of image manipulation, \e\
-
-    painting, processing, and rendering tools.
-.Ed
-.It Ic revision
-Local revision number of
-.Nm .
-Increment for port revisions which would change its installation in any way.
-.br
-.Sy Type:
-.Em optional
-.br
-.Sy Default:
-.Em 0
-.br
-.Sy Example:
-.Dl revision 1
-.It Ic categories
-Categories to which this port belongs.
-.br
-.Sy Type:
-.Em required
-.br
-.Sy Example:
-.Dl categories spelling textproc
-.It Ic maintainers
-E-mail address(es) of port maintainer(s).
-.br
-.Sy Type:
-.Em required
-.br
-.Sy Example:
-.Dl maintainers landonf at opendarwin.org kevin at opendarwin.org
-.It Ic platforms
-Declares which platforms are supported by the port.
-.br
-.Sy Type:
-.Em required
-.br
-.Sy Values:
-.Em darwin freebsd
-.br
-.Sy Example:
-.Dl platforms darwin
-.It Ic homepage
-Project homepage for the port.
-.br
-.Sy Type:
-.Em required
-.br
-.Sy Example:
-.Dl http://wireshark.org
-.It Ic master_sites
-List of sites to fetch
-.Ic distfiles
-from or a predefined mirror site
-list. If set to a predefined mirror site, without a subdirectory being
-defined, the portname is used as the name of the subdirectory.
-.br
-.Sy Type:
-.Em required
-.br
-.Sy Example:
-.Bd -literal -offset indent -compact
-master_sites ftp://ftp.cdrom.com/pub/magic \e\
-
-    sourceforge
-.Ed
-.It Ic worksrcdir
-Path to source directory relative to
-.Ic workpath .
-.br
-.Sy Type:
-.Em optional
-.br
-.Sy Default:
-.Em ${distname}
-.br
-.Sy Example:
-.Dl worksrcdir ${distname}-src-${version}
-.It Ic distname
-Name of distribution file, without the
-.Cm extract.suffix .
-.br
-.Sy Type:
-.Em optional
-.br
-.Sy Default:
-.Em ${name}-${version}
-.br
-.Sy Example:
-.Dl distname ${name}-${version}-src
-.It Xo
-.Ic checksums Ar filename Ar type Ar checksum
-.Op Ar filename Ar type checksum ...
-.Xc
-List of checksums for the
-.Ic distfiles .
-The checksum
-.Ar type
-can currently be md5, rmd160 or sha1. The
-.Ar filename
-can be omitted if there is only one distfile.
-.br
-.Sy Type:
-.Em required
-.br
-.Sy Example:
-.Bd -literal -offset indent -compact
-checksums dictd-1.7.1.tar.gz md5 81317b86ea0a5df0163900ad2e6bb12c \e\ 
-	magic-words-1.7.1.tar.gz md5 897a005182928613eadd30c267ce9c5b
-.Ed
-.br
-.Sy Example (ledit 1.11):
-.Bd -literal -offset indent -compact
-checksums md5 a2d38ba641682509c1e964ad699a9dd2 \e\ 
-	sha1 1fb6443b5fdf3c83787953f06282d256477c1288
-.Ed
-.br
-.Sy Example (ssldump 0.9b3):
-.Bd -literal -offset indent -compact
-checksums md5 ac8c28fe87508d6bfb06344ec496b1dd \e\ 
-	sha1 a633a9a811a138eac5ed440d583473b644135ef5 \e\ 
-	rmd160 941cf8f2ef8459ec4f9ce65772e134505d46566
-.Ed
-.It Ic use_automake
-If set to yes, run the
-.Cm automake
-target to build any
-.Pa Makefile.in
-files for use by
-.Pa configure .
-.br
-.Sy Type:
-.Em optional
-.br
-.Sy Default:
-.Em no
-.br
-.Sy Example:
-.Dl use_automake yes
-.It Ic use_autoconf
-If set to yes, run the
-.Cm autoconf
-target to build any
-.Pa configure
-script required.
-.br
-.Sy Type:
-.Em optional
-.br
-.Sy Default:
-.Em no
-.br
-.Sy Example:
-.Dl use_autoconf yes
-.It Ic use_configure
-If set to yes, run the
-.Cm configure
-target to configure the build.
-.br
-.Sy Type:
-.Em optional
-.br
-.Sy Default:
-.Em yes
-.br
-.Sy Example:
-.Dl use_configure no
-.El
-.Sh TARGET HOOKS
-A number of hooks are available for customizing many of the standard
-targets that
-.Xr port 1
-executes. The targets supporting these hooks are
-.Cm fetch ,
-.Cm automake ,
-.Cm autoconf ,
-.Cm configure ,
-.Cm build ,
-.Cm destroot ,
-and
-.Cm test .
-The hooks are:
-.Bl -tag -width lc
-.It Va target Ns Ic .dir
-Directory in which to run the
-.Va target .
-.br
-.Sy Example:
-.Dl automake.dir src
-.It Va target Ns Ic .env
-Change the environment the
-.Va target
-is run in. This is often overridden on a per
-.Nm
-basis.
-.br
-.Sy Example:
-.Dl configure.env CPP=/usr/bin/cpp-4.0
-.It Va target Ns Ic .pre_args
-Additional arguments passed before the main arguments.
-.br
-.Sy Example:
-.Dl extract.pre_args -cd
-.It Va target Ns Ic .args
-Main arguments to pass to the
-.Va target .
-This is often overridden on a per
-.Nm
-basis.
-.br
-.Sy Example:
-.Dl configure.args --enable-fooble
-.It Va target Ns Ic .post_args
-Additional arguments passed after the main arguments.
-.br
-.Sy Example:
-.Dl extract.post_args | tar xf -
-.El
-.Sh RUNTIME VARIABLES
-Read-only access to the MacPorts configuration is provided.
-.Bl -tag -width lc
-.It Ic prefix
-Install prefix
-.br
-.Sy Type:
-.Em optional
-.br
-.Sy Default:
-.Em /opt/local
-.It Ic libpath
-Location of ports-specific TCL libraries.
-.br
-.Sy Type:
-.Em read-only
-.It Ic portpath
-Full path to the Portfile location.
-.br
-.Sy Type:
-.Em read-only
-.It Ic workdir
-Path to work directory relative to
-.Ic portpath .
-Where possible use
-.Ic workpath
-instead.
-.br
-.Sy Type:
-.Em read-only
-.br
-.Sy Default:
-.Em work
-.It Ic workpath
-Full path to work directory.
-.br
-.Sy Type:
-.Em read-only
-.br
-.Sy Default:
-.Em ${portpath}/${workdir}
-.It Ic worksrcpath
-Full path to working sources (where port has unpacked itself).
-.br
-.Sy Type:
-.Em read-only
-.br
-.Sy Default:
-.Em ${workpath}/${worksrcdir}
-.It Ic filesdir
-Path to port files relative to
-.Ic portpath .
-.br
-.Sy Type:
-.Em read-only
-.br
-.Sy Default:
-.Em files
-.It Ic distpath
-Location to store downloaded distfiles.
-.br
-.Sy Type:
-.Em read-only
-.br
-.Sy Default:
-.Em ${sysportpath}/distfiles/${dist_subdir}/
-.It Ic os.arch
-Identifies hardware type (eg "powerpc").
-.br
-.Sy Type:
-.Em read-only
-.It Ic os.version
-Version number of operating system (eg "7.0").
-.br
-.Sy Type:
-.Em read-only
-.It Ic os.endian
-Endianness of the processor (eg "bigEndian").
-.br
-.Sy Type:
-.Em read-only
-.It Ic os.platform
-Operating system name (eg "darwin").
-.br
-.Sy Type:
-.Em read-only
-.It Ic install.user
-User for MacPorts installation (eg
-.Pa root )
-.br
-.Sy Type:
-.Em read-only
-.It Ic install.group
-Group for MacPorts installation (eg
-.Pa wheel )
-.br
-.Sy Type:
-.Em read-only
-.It Ic x11prefix
-Absolute path to X11 (eg
-.Pa /usr/X11R6 )
-.br
-.Sy Type:
-.Em read-only
-.El
-.Sh DEPENDENCY OPTIONS
-Port dependencies should refer to other MacPort ports
-whenever possible, therefore each dependency should be
-expressed in the format:
-.Bl -tag -width ls
-.It port: Ns Ao port Ac
-.El
-.Pp
-Where 
-.Ao port Ac represents the name of an existing MacPorts
-.Nm port .
-If satisfying a dependency with a MacPorts port is not
-practical and it is likely that a dependency must be met
-by an Apple optional install, then the alternative dependency
-format:
-.Bl -tag -width lc
-.It Ar type Ns : Ns Ao filename Ac Ns : Ns Ao port Ac
-.El
-.Pp
-may be used. Where
-.Ar type
-is "bin" if
-.Ao filename Ac
-is a program, "lib" if it is a library, or "path" if it is a path to an
-installed file.
-.br
-.Sy Example:
-.Dl lib:libX11.6:XFree86
-.Bl -tag -width lc
-.It Ic depends_build
-List of dependencies to check before
-.Cm build ,
-.Cm destroot ,
-.Cm install ,
-and
-.Cm package
-targets.
-.br
-.Sy Type:
-.Em optional
-.br
-.Sy Example:
-.Dl depends_build port:autoconf
-.It Ic depends_run
-List of dependencies to check before
-.Cm destroot ,
-.Cm install
-and
-.Cm package
-targets.
-.br
-.Sy Type:
-.Em optional
-.br
-.Sy Example:
-.Dl depends_run port:bash
-.It Ic depends_lib
-List of dependencies to check before
-.Cm configure ,
-.Cm build ,
-.Cm destroot ,
-.Cm install ,
-and
-.Cm package
-targets.
-.br
-.Sy Type:
-.Em optional
-.br
-.Sy Example:
-.Dl depends_lib port:libfetch
-.El
-.Sh FETCH OPTIONS
-Fetch all distribution files and patches.
-.Bl -tag -width lc
-.It Ic master_sites.mirror_subdir
-Subdirectory to append to all mirror sites for any list specified in
-master_sites.
-.br
-.Sy Type:
-.Em optional
-.br
-.Sy Default:
-.Em ${name}
-.br
-.Sy Example:
-.Dl master_sites.mirror_subdir      magic
-.It Ic patch_sites
-List of sites to fetch
-.Ic patchfiles
-from or a predefined mirror site list.
-.br
-.Sy Type:
-.Em optional
-.br
-.Sy Default:
-.Em ${master_sites}
-.br
-.Sy Example:
-.Dl patch_sites ftp://ftp.patchcityrepo.com/pub/magic/patches
-.It Ic patch_sites.mirror_subdir
-Subdirectory to append to all mirror sites for any list specified in
-.Ic patch_sites .
-.br
-.Sy Type:
-.Em optional
-.br
-.Sy Default:
-.Em ${name}
-.br
-.Sy Example:
-.Dl patch_sites.mirror_subdir       magic
-.It Ic extract.suffix
-Suffix to append to
-.Ic distname .
-.br
-.Sy Type:
-.Em optional
-.br
-.Sy Default:
-.Em .tar.gz
-.br
-.Sy Example:
-.Dl extract.suffix .tgz
-.It Ic distfiles
-List of distribution files to fetch from
-.Ic master_sites .
-.br
-.Sy Type:
-.Em optional
-.br
-.Sy Default:
-.Em [suffix ${distname}]
-.br
-.Sy Example:
-.Dl distfiles magicsource.tar.gz cluebat.tar.bz2
-.It Ic patchfiles
-List of patches to fetch and apply.
-.br
-.Sy Type:
-.Em optional
-.br
-.Sy Example:
-.Dl patchfiles japanese-widechar-fix.diff japanese-localization.diff
-.It Ic use_zip
-Use zip.
-.br
-Sets extract.suffix to: .zip
-.br
-Sets extract.cmd to: unzip
-.br
-Sets extract.pre_args to: -q
-.br
-Sets extract.post_args to: "-d ${portpath}/${workdir}"
-.br
-.Sy Type:
-.Em optional
-.br
-.Sy Example:
-.Dl use_zip yes
-.It Ic use_bzip2
-Use bzip2.
-.br
-Sets extract.suffix to: .bzip2
-.br
-Sets extract.cmd to: bzip2
-.br
-.Sy Type:
-.Em optional
-.br
-.Sy Example:
-.Dl use_bzip2 yes
-.It Ic dist_subdir
-Create a sub-directory in
-.Ic distpath
-to store all fetched files.
-.br
-.Sy Type:
-.Em optional
-.br
-.Sy Default:
-.Em ${name}
-.br
-.Sy Example:
-.Dl dist_subdir vim${version}
-.El
-.Ss ADVANCED FETCH OPTIONS
-Some mirrors require special options for a resource to be properly
-fetched.
-.Bl -tag -width lc
-.It Ic fetch.user
-HTTP or FTP user to fetch the resource.
-.br
-.Sy Type:
-.Em optional
-.It Ic fetch.password
-HTTP or FTP password to fetch the resource.
-.br
-.Sy Type:
-.Em optional
-.It Ic fetch.use_epsv
-Whether to use EPSV command for FTP transfers.
-.br
-.Sy Type:
-.Em optional
-.br
-.Sy Default:
-.Em yes
-.br
-.It Ic fetch.ignore_sslcrt
-Whether to ignore the host SSL certificate (for HTTPS).
-.br
-.Sy Type:
-.Em optional
-.br
-.Sy Default:
-.Em no
-.br
-.El
-.Ss FETCHING FROM CVS
-As an alternative to fetching distribution files, pulling the sources
-from a CVS repository is supported. Use of CVS can give rise to
-non-reproducible builds, so it is strongly discouraged.
-.Bl -tag -width lc
-.It Ic cvs.root
-Specify the address to a CVS repository from which to checkout files.
-.br
-.Sy Type:
-.Em optional
-.br
-.Sy Default:
-.Em none
-.br
-.Sy Example:
-.Dl cvs.root :pserver:anonymous cvs.sv.gnu.org:/sources/emacs
-.It Ic cvs.tag
-Specify a CVS tag identifying the code to checkout.
-.br
-.Sy Type:
-.Em optional
-.br
-.Sy Default
-.Em none
-.br
-.Sy Example:
-.Dl cvs.tag HEAD
-.It Ic cvs.date
-A date that identifies the CVS code set to checkout.
-.br
-.Sy Type:
-.Em optional
-.br
-.Sy Default
-.Em none
-.br
-.Sy Example:
-.Dl cvs.date \*q12-April-2005\*q
-.It Ic cvs.module
-A CVS module from which to check out the code.
-.br
-.Sy Type:
-.Em optional
-.br
-.Sy Default
-.Em none
-.br
-.Sy Example:
-.Dl cvs.module Sources
-.El
-.Ss FETCHING FROM SUBVERSION
-As an alternative to fetching distribution files, pulling the sources
-from a subversion repository is supported. Use of subversion can give
-rise to non-reproducible builds, so it is strongly discouraged.
-.Bl -tag -width lc
-.It Ic svn.url
-Specify the url from which to fetch files.
-.br
-.Sy Type:
-.Em required
-.br
-.Sy Default:
-.Em none
-.br
-.Sy Example:
-.Dl svn.url http://www.domain.com/svn-repo/mydirectory
-      svn.url svn://www.domain.com/svn-repo/mydirectory
-.It Ic svn.tag
-Specify the a tag from which svn should fetch files. This
-corresponds to the -r option to the svn cli.
-.br
-.Sy Type:
-.Em optional
-.br
-.Sy Default:
-.Em none
-.br
-.Sy Example:
-.Dl svn.url http://www.domain.com/svn-repo/mydirectory
-      svn.url svn://www.domain.com/svn-repo/mydirectory
-.El
-.Sh EXTRACT OPTIONS
-Extract all compressed/archived files.
-.Bl -tag -width lc
-.It Ic extract.only
-List of files to extract into
-.Ic workpath .
-.br
-.Sy Type:
-.Em optional
-.br
-.Sy Default:
-.Em ${distfiles}
-.br
-.Sy Example:
-.Dl extract.only worksrc-1.4.4.tar.gz
-.It Ic extract.cmd
-Command to perform the extraction.
-.br
-.Sy Type:
-.Em optional
-.br
-.Sy Default:
-.Em gzip
-.br
-.Sy Example:
-.Dl extract.cmd bzip2
-.El
-.Sh CONFIGURE OPTIONS
-MacPorts provide special support for configure flags (CFLAGS, LDFLAGS, CPPFLAGS, CXXFLAGS). Please note that the previous way to alter these flags (using configure.env) may become deprecated at some point. The following options are defined:
-.Bl -tag -width lc
-.It Ic configure.cflags
-Flags to put in the CFLAGS environment variable when invoking the configure script.
-.br
-.Sy Type:
-.Em optional
-.br
-.Sy Default:
-.Em -O2
-.br
-.Sy Example:
-.Dl configure.cflags-append -DHAS_LRINTF
-.It Ic configure.cppflags
-Flags to put in the CPPFLAGS environment variable when invoking the configure script.
-.br
-.Sy Type:
-.Em optional
-.br
-.Sy Default:
-.Em -I${prefix}/include
-.It Ic configure.cxxflags
-Flags to put in the CXXFLAGS environment variable when invoking the configure script.
-.br
-.Sy Type:
-.Em optional
-.br
-.Sy Default:
-.Em -O2
-.It Ic configure.ldflags
-Flags to put in the LDFLAGS environment variable when invoking the configure script.
-.br
-.Sy Type:
-.Em optional
-.br
-.Sy Default:
-.Em -L${prefix}/lib
-.El
-.Ss UNIVERSAL TARGET HOOKS
-For universal builds of configure-based ports, we also define specific target hooks. These can be overridden for specific ports. Please note that these hooks are used by the default universal variant and redefining the variant will make them useless.
-.Bl -tag -width lc
-.It Ic configure.universal_args
-Arguments appended to the configure script to build the port universal.
-.br
-.Sy Type:
-.Em optional
-.br
-.Sy Default:
-.Em --disable-dependency-tracking
-.It Ic configure.universal_cflags
-Additional flags to put in the CFLAGS environment variable when invoking the configure script.
-.br
-.Sy Type:
-.Em optional
-.br
-.Sy Default:
-.Em -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc
-.It Ic configure.universal_cppflags
-Additional flags to put in the CPPFLAGS environment variable when invoking the configure script.
-.br
-.Sy Type:
-.Em optional
-.It Ic configure.universal_cxxflags
-Additional flags to put in the CXXFLAGS environment variable when invoking the configure script.
-.br
-.Sy Type:
-.Em optional
-.br
-.Sy Default:
-.Em -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc
-.It Ic configure.universal_ldflags
-Additional flags to put in the LDFLAGS environment variable when invoking the configure script.
-.br
-.Sy Type:
-.Em optional
-.br
-.Sy Default:
-.Em -arch i386 -arch ppc
-.El
-.Sh BUILD OPTIONS
-Execute necessary build commands.
-.Bl -tag -width lc
-.It Ic build.cmd
-Make command to run relative to
-.Ic worksrcdir .
-.br
-.Sy Type:
-.Em optional
-.br
-.Sy Default:
-.Em make
-.br
-.Sy Example:
-.Dl build.cmd pbxbuild
-.It Ic build.type
-Defines which 'make' is required, either 'gnu' or 'bsd'.
-Sets
-.Ic build.cmd
-to either
-.Pa gnumake
-or
-.Pa bsdmake
-accordingly.
-.br
-.Sy Type:
-.Em optional
-.br
-.Sy Default:
-.Em gnu
-.br
-.Sy Example:
-.Dl build.type bsd
-.It Ic build.target
-Target passed to
-.Ic build.cmd .
-.br
-.Sy Type:
-.Em optional
-.br
-.Sy Default:
-.Em all
-.br
-.Sy Example:
-.Dl build.target all-src
-.El
-.Sh DESTROOT OPTIONS
-Execute necessary commands to install into a temporary destination root
-("destroot") staging area.
-.Bl -tag -width lc
-.It Ic destroot.cmd
-Install command to run relative to
-.Ic worksrcdir .
-.br
-.Sy Type:
-.Em optional
-.br
-.Sy Default:
-.Em ${build.cmd}
-.br
-.Sy Example:
-.Dl destroot.cmd pbxbuild
-.It Ic destroot.type
-Defines which 'make' is required, either 'gnu' or 'bsd'.
-Sets
-.Ic destroot.cmd
-to either
-.Pa gnumake
-or
-.Pa bsdmake
-accordingly.
-.br
-.Sy Type:
-.Em optional
-.br
-.Sy Default:
-.Em ${build.type}
-.br
-.Sy Example:
-.Dl destroot.type gnu
-.It Ic destroot.destdir
-Arguments passed to
-.Ic destroot.cmd
-in order to install correctly
-into the destroot.
-.br
-.Sy Type:
-.Em optional
-.br
-.Sy Default:
-.Em DESTDIR=${destroot}
-.br
-.Sy Example:
-.Dl destroot.destdir prefix=${destroot}${prefix}
-.It Ic destroot.target
-Install target to pass to
-.Ic destroot.cmd .
-.br
-.Sy Type:
-.Em optional
-.br
-.Sy Default:
-.Em install
-.br
-.Sy Example:
-.Dl destroot.target install-src
-.It Ic destroot.umask
-Umask to use during destroot.
-.br
-.Sy Type:
-.Em optional
-.br
-.Sy Default:
-.Em 022
-.br
-.Sy Example:
-.Dl destroot.umask 002
-.It Ic destroot.keepdirs
-List of directories that should not be pruned if empty upon
-.Cm destroot
-completion.
-.br
-.Sy Type:
-.Em optional
-.br
-.Sy Example:
-.Dl destroot.keepdirs ${destroot}${prefix}/var/log/mysql
-.El
-.Sh TEST OPTIONS
-Execute commands to run test suites bundled with a port.
-.Bl -tag -width lc
-.It Ic test.run
-Enable running test suites bundled with a port.
-.br
-.Sy Type:
-.Em optional
-.br
-.Sy Example:
-.Dl test.run     yes
-.It Ic test.cmd
-Test command to run relative to
-.Ic worksrcdir .
-.br
-.Sy Type:
-.Em optional
-.br
-.Sy Default:
-.Em ${build.cmd}
-.br
-.Sy Example:
-.Dl test.cmd checks.sh
-.It Ic test.target
-Test target to pass to
-.Ic test.cmd .
-.br
-.Sy Type:
-.Em optional
-.br
-.Sy Default:
-.Em test
-.br
-.Sy Example:
-.Dl test.target checks
-.El
-.Sh STARTUPITEM OPTIONS
-If a port needs to run on system startup, it can use MacPorts
-startupitem keywords to install native OS X startup scripts.
-Startup scripts require user interaction after port installation
-to activate them and instructions are given during port installs.
-.Bl -tag -width lc
-.It Ic startupitem.create
-Choose whether or not to generate a startup item.
-.br
-.Sy Type:
-.Em optional
-.br
-.Sy Default:
-.Em no
-.br
-.Sy Values:
-.Em yes no
-.br
-.Sy Example:
-.Dl startupitem.create yes
-.It Ic startupitem.type
-Select the type of startupitem to generate. By default, a startupitem
-will be generated that is of the appropriate type for the OS. For
-instance, launchd is used on system 10.4, while SystemStarter is used
-on prior Mac OS X systems. A global default may be specified with the startupitem_type preference in ports.conf.
-.br
-.Sy Type:
-.Em optional
-.br
-.Sy Default:
-.Em default
-.br
-.Sy Values:
-.Em SystemStarter launchd default rcNG
-.br
-.Sy Example
-.Dl startupitem.type launchd
-.It Ic startupitem.name
-Displayed name of the startup item.
-.br
-.Sy Type:
-.Em required
-.br
-.Sy Example:
-.Dl startupitem.name OpenSSH
-.It Ic startupitem.executable
-The name of the daemon to be run in the background. This is
-the preferred type of startup item rather than any of
-startupitem.init, startupitem.start, startupitem.stop, or
-startupitem.restart, and may not be used together with any
-of these options.  This option may contain multiple
-arguments, but they must be appropriate for a call to exec; they
-may not contain arbitrary shell code.
-.br
-.Sy Type:
-.Em optional
-.br
-.Sy Values:
-.Em /path/to/executable <args>
-.br
-.Sy Example:
-.Dl startupitem.executable ${prefix}/bin/wonka
-.It Ic startupitem.init
-Shell code that will be executed prior to any of the options
-startupitem.start, startupitem.stop and startupitem.restart.
-.br
-.Sy Type:
-.Em optional
-.br
-.Sy Values:
-.Em sh code
-.br
-.Sy Example:
-.Dl startupitem.init FOO=start
-.It Ic startupitem.start
-Shell code executed to start the daemon.
-.br
-.Sy Type:
-.Em optional
-.br
-.Sy Values:
-.Em sh code
-.br
-.Sy Example:
-.Dl startupitem.start ${prefix}/share/mysql/mysql.server start
-.It Ic startupitem.stop
-Shell code executed to stop the daemon.
-.br
-.Sy Type:
-.Em optional
-.br
-.Sy Values:
-.Em sh code
-.br
-.Sy Example:
-.Dl startupitem.stop ${prefix}/share/mysql/mysql.server stop
-.It Ic startupitem.restart
-Shell code executed to restart the daemon. In the absence
-of this key, the daemon will be restarted by taking the
-stop action, followed by taking the start action.
-.br
-.Sy Type:
-.Em optional
-.br
-.Sy Values:
-.Em sh code
-.br
-.Sy Example:
-.Dl startupitem.restart ${prefix}/share/mysql/mysql.server restart
-.It Ic startupitem.pidfile
-Specification for pidfile handling. This is particularly useful
-in conjunction with the startupitem.executable key, because it is
-important that the startupitem know how to track the executable.
-This specifies whether the daemon generates its own pidfile (auto),
-whether it generates its own but forgets to delete it, so that the
-startupitem should delete it (clean), or whether it never generates
-one, in which case the startupitem should manage the pidfile on its
-own (manual), or whether no pidfile should be used at all (none).
-.br
-.Sy Type:
-.Em optional
-.br
-.Sy Default:
-.Em none "${prefix}/var/run/${name}.pid"
-.br
-.Sy Values:
-.Em none|auto|manual|clean [/path/to/pidfile]
-.br
-.Sy Example:
-.Dl startupitem.pidfile auto ${prefix}/var/run/${name}.pidfile
-.It Ic startupitem.logfile
-Path to a logfile for logging events about the lifetime of the
-startupitem. Depending on the type of startupitem, and the manner
-in which it is started, standard output from the daemon may also be
-directed to the logfile.
-.br
-.Sy Type:
-.Em optional
-.br
-.Sy Default:
-.Em /dev/null
-.br
-.Sy Values:
-.Em path
-.br
-.Sy Example:
-.Dl startupitem.logfile ${prefix}/var/log/mydaemon.log
-.It Ic startupitem.logevents
-Control whether or not to log events to the log file. If logevents
-is set, events with timestamps are logged to the logfile.
-.br
-.Sy Type:
-.Em optional
-.br
-.Sy Default:
-.Em no
-.br
-.Sy Values:
-.Em yes|no
-.br
-.Sy Example:
-.Dl startupitem.logevents yes
-.El
-.Sh DISTCHECK AND LIVECHECK OPTIONS
-MacPorts can automatically check if the software has been updated
-since the Portfile was modified and if some external changes require
-an update to the Portfile. This helps maintainers have up-to-date
-and working Portfiles.
-.br
-Two checks are available. With distcheck, MacPorts can check that the
-distfile(s) are still downloadable and did not change since the portfile
-was modified.
-With livecheck, MacPorts can query a resource to determine if a newer
-version of the software is available.
-.Bl -tag -width lc
-.It Ic distcheck.check
-This option can be used to disable distcheck. It specifies what kind
-of check should be performed on distfiles:
-.Em moddate
-(check if the Portfile is older than the distfile) or
-.Em none
-(no check).
-.br
-.Sy Type:
-.Em optional
-.br
-.Sy Default:
-.Em moddate
-.br
-.Sy Values:
-.Em moddate none
-.It Ic livecheck.check
-What kind of check to perform to figure out if the software has been updated.
-Can be
-.Em freshmeat
-(uses the date_updated tag of the freshmeat XML file),
-.Em sourceforge
-(uses the version of the latest file release of the project),
-.Em googlecode
-(uses the version of the latest file release of the project),
-.Em moddate
-(uses the modification date of some URL resource),
-.Em regex
-(retrieve the version by applying a regex to some URL resource),
-.Em regexm
-(retrieve the version by applying a multi-line regex to some URL resource),
-.Em md5
-(compares the md5 sum of some URL resource) or
-.Em none
-(no check).
-.br
-.Sy Type:
-.Em optional
-.br
-.Sy Default:
-.Em sourceforge
-or
-.Em googlecode
-if the master_sites is one of these, else
-.Em freshmeat
-.br
-.Sy Values:
-.Em freshmeat sourceforge googlecode moddate regex regexm md5 none
-.It Ic livecheck.name
-Name of the project for live checks (used for freshmeat, sourceforge, and googlecode checks).
-.br
-.Sy Type:
-.Em optional
-.br
-.Sy Default:
-.Em ${name}
-or the sourceforge/freshmeat/googlecode project name if it can be guessed by looking at the master_sites.
-.It Ic livecheck.distname
-Name of the file release (used for sourceforge and googlecode checks).
-For sourceforge releases use the name of the package release.
-For googlecode releases use the name of the file download, including extension.
-Replace the version part of the name with "(.*)".
-.br
-.Sy Type:
-.Em optional
-.br
-.Sy Default:
-.Em ${livecheck.name}
-for sourceforge projects or the first entry in
-.Em ${distfiles}
-for googlecode projects
-.It Ic livecheck.version
-Version of the project for live checks (used for regex-based checks).
-.br
-.Sy Type:
-.Em optional
-.br
-.Sy Default:
-.Em ${version}
-.It Ic livecheck.url
-URL to query for the check.
-.br
-.Sy Type:
-.Em optional
-.br
-.Sy Default:
-.Em ${homepage}
-or
-.Em http://freshmeat.net/projects-xml/${livecheck.name}/${livecheck.name}.xml
-or
-.Em http://sourceforge.net/export/rss2_projfiles.php?project=${livecheck.name}
-or
-.Em http://code.google.com/p/${livecheck.name}/downloads/list
-.It Ic livecheck.regex
-Regular expression to parse the resource for regex checks.
-Be sure to use a regular expression grouping around the version component.
-.br
-.Sy Type:
-.Em optional
-.It Ic livecheck.md5
-md5 sum to use for md5 comparison.
-.br
-.Sy Type:
-.Em optional
-.El
-.Sh VARIANT OPTIONS
-MacPorts allows for conditional modification to be specified in a
-.Nm ,
-allowing for user-customization of a software's build-time settings.
-.Bl -tag -width lc
-.It Xo
-.Ic variant
-.Op Cm requires Ar variant
-.Op Cm conflicts Ar variant
-.Xc
-The value is usually a TCL script which modifies other port's
-.Nm
-variables. Dependencies and conflicts with other variants in the same
-port can be expressed with
-.Cm requires
-and
-.Cm conflicts .
-The example adds a "gnome" variant to a port.
-.br
-.Sy Type:
-.Em optional
-.br
-.Sy Example:
-.Bd -literal -offset indent -compact
-variant gnome requires glib { configure.args-append --with-gnome \e\
-
-    depends_lib-append lib:gnome-session:gnome-session }
-.Ed
-.It Ic default_variants
-If variants are defined, then the
-.Ic default_variants
-value lists which variants are enabled by default.
-.br
-.Sy Type:
-.Em optional
-.br
-.Sy Example:
-.Dl default_variants +ssl +tcpd
-.It Ic universal_variant
-When using MacPorts on MacOS X, a universal variant is defined and
-the default behavior is to configure ports with universal flags
-(see the
-.Ic UNIVERSAL TARGET HOOKS
-section above). The variant can be
-overridden if the default code does not work. It can also be
-suppressed if having a universal variant for the port does not make
-sense. To suppress it, use the
-.Ic universal_variant
-option.
-.br
-.Sy Type:
-.Em optional
-.br
-.Sy Default:
-.Em yes
-.br
-.Sy Example:
-.Dl universal_variant no
-.El
-.Sh PLATFORM OPTIONS
-MacPorts allows for platform-specific conditional modification to be
-specified in a
-.Nm ,
-much like variants, for handling differences between platforms and
-versions of the same platform.
-.Bl -tag -width lc
-.It Xo
-.Ic platform
-.Ar platform
-.Op Ar version
-.Op Ar arch
-.Xc
-The platform key is used to begin the darwin platform definitions as
-shown in the examples from the databases/db4 and devel/libidl1
-.Nm Portfiles
-respectively.
-.br
-.Sy Type:
-.Em optional
-.br
-.Sy Example:
-.Bd -literal -offset indent -compact
-platform darwin 6 { configure.args-append   --enable-tcl \e\
-
-        --with-tcl=/System/Library/Tcl/8.3 }
-.Ed
-.br
-.Sy Example:
-.Bd -literal -offset indent -compact
-platform darwin powerpc { configure.args-append \e\
-
-        --host=${os.arch}-apple-rhapsody${os.version} }
-platform darwin i386 { configure.args-append \e\
-
-        --host=i386-gnu-rhapsody${os.version} }
-.Ed
-.El
-.Sh PORTGROUP
-To factorize the work with similar ports, MacPorts provides the notion of
-.Nm PortGroup
-that can be used to load definitions for a given class or group of ports. See
-.Xr portgroup 7
-for more details on the various PortGroup classes.
-.Sh TCL EXTENSIONS
-A number of TCL extensions are available for use in
-.Nm Portfiles .
-.Pp
-.Bl -tag -width lc
-.Bl -tag -width lc -compact
-.It Xo
-.Ic xinstall
-.Op Fl c
-.Op Fl B Ar suffix
-.Op Fl b
-.Op Fl C
-.Op Fl f Ar flags
-.Op Fl g Ar group
-.Op Fl M
-.Op Fl m Ar mode
-.Op Fl o Ar owner
-.Op Fl p
-.Op Fl S
-.Op Fl s
-.Op Fl W Ar dir
-.Op Ar
-.Ar destination
-.Xc
-.It Xo
-.Ic xinstall
-.Fl d
-.Op Fl B Ar suffix
-.Op Fl b
-.Op Fl C
-.Op Fl f Ar flags
-.Op Fl g Ar group
-.Op Fl M
-.Op Fl m Ar mode
-.Op Fl o Ar owner
-.Op Fl p
-.Op Fl S
-.Op Fl s
-.Op Fl W Ar dir
-.Ar directory
-.Xc
-Install file(s) to a target file or directory. The options are
-intended to be compatible with
-.Xr install 1 :
-.Bl -tag -width indent
-.It Fl b
-Backup any existing files with an
-.Pa .old
-extension.
-.It Fl B
-Specify a different backup suffix for the
-.Fl b
-flag.
-.It Fl c
-Install files (this is the default).
-.It Fl C
-Only copy a file if it is different.
-.It Fl d
-Create directories, including (if necessary) parent directories.
-.It Fl f
-Specify target flags, see
-.Xr chflags 1
-for details.
-.It Fl g
-Specify the group.
-.It Fl M
-Disable use of
-.Xr mmap 2 .
-.It Fl m
-Specify an alternate mode. The default is 0755. See
-.Xr chmod 1
-for defails.
-.It Fl p
-Preserve the modification time.
-.It Fl S
-Copy safely, using a temporary file.
-.It Fl s
-Strip binaries using
-.Xr strip 1 .
-.It Fl W
-Change to
-.Ar dir
-before working.
-.El
-.El
-.It Xo
-.Ic fs-traverse
-.Op Fl depth
-.Op Fl ignoreErrors
-.Ar varname
-.Ar target
-.Op Ar target ...
-.Ar body
-.Xc
-Traverse the filesystem hierarchy rooted in each
-.Ar target
-and execute
-.Ar body
-for each found file/directory. Sets
-.Ar varname
-to the path of the file/directory. If
-.Nm break
-is called during execution, the filesystem traversal is stopped. If
-.Nm continue
-is called during execution, the current file and any children are skipped
-and traversal continues with the next file/directory.
-.Bl -tag -width indent
-.It Fl depth
-Equivalent to the
-.Fl d
-switch to
-.Xr find 1 .
-Please note that using
-.Fl depth
-means you cannot prune a directory with
-.Nm continue
-as it will be processed after its children.
-.It Fl ignoreErrors
-Causes
-.Nm fs-traverse
-to ignore any permissions/read errors encountered during processing.
-.El
-.It Xo
-.Ic curl fetch
-.Ar url
-.Ar file
-.Xc
-Fetch a resource at
-.Ar url
-and save it to
-.Ar file .
-.It Xo
-.Ic curl isnewer
-.Ar url
-.Ar date
-.Xc
-Determine if resource at
-.Ar url
-is newer than
-.Ar date
-(expressed in seconds since epoch).
-.It Xo
-.Ic adduser
-.Ar username
-.Op Cm uid Ns = Ns uid
-.Op Cm gid Ns = Ns gid
-.Op Cm passwd Ns = Ns passwd
-.Op Cm realname Ns = Ns realname
-.Op Cm home Ns = Ns home
-.Op Cm shell Ns = Ns shell
-.Xc
-Add a new local user to the system with the specified uid, gid,
-password, real name, home directory and login shell.
-.It Ic existsuser Ar username
-Check if a local user exists.
-.It Ic nextuid
-Returns the highest used uid plus one.
-.It Xo
-.Ic addgroup
-.Ar group
-.Op Cm gid Ns = Ns gid
-.Op Cm passwd Ns = Ns passwd
-.Op Cm users Ns = Ns users
-.Xc
-Add a new local group to the system, with the specified gid, password
-and with a list users as members.
-.It Ic existsgroup Ar group
-Check if a local group exists and return the corresponding gid. This can be used
-with adduser:
-.Dl addgroup foo 
-.Dl adduser foo gid=[existsgroup foo]
-.It Ic nextgid
-Returns the highest used gid plus one.
-.It Ic reinplace Ar regex Ar filename
-Provide in-place sed like editing of a file.
-.br
-.Sy Example:
-.Dl reinplace \*qs|/usr/local|${prefix}|g\*q doc/manpage.1
-.It Ic file
-Standard TCL command to manipulate file names and attributes, recommended if you wish to preserve Mac OS
-resource forks when destrooting ports on Mac OS X 10.3.x and Mac OS X 10.4.x . Use
-.Nm xinstall
-to also preserve Extended Attributes (i.e. Access Control Lists). See
-.Xr file n
-for more information on this command.
-.It Ic copy
-Built-in shorthand alternative to "file -copy".
-.It Ic move
-Built-in shorthand alternative to "file -rename".
-.It Ic delete
-Built-in shorthand alternative to "file -delete". Required over the latter for Portfiles that perform deleting
-operations on directories while building the port on Mac OS X 10.3 and earlier, due to a Tcl anomaly on those systems
-that causes "file -delete" to fail.
-.It Ic touch
-Built-in command mimicking the BSD touch command.
-.It Ic ln
-.br
-Built-in command mimicking the BSD ln command.
-.It Ic system Ar commandline
-Execute a program. See
-.Xr system 3 .
-For calls to
-.Xr install 1
-please use
-.Nm xinstall .
-For calls to 
-.Xr mv 1 ,
-.Xr cp 1 ,
-.Xr rm 1
-or similar, please use the built-in commands or
-.Nm file
-if they don't meet your requirements.
-.It Ic variant_isset Ar variant
-Checks if the given
-.Ar variant
-is being built.
-.It Ic variant_set Ar variant
-Set the given
-.Ar variant .
-.It Ic variant_unset Ar variant
-Unset the given
-.Ar variant .
-.It Va variable Ns - Ns Ic append Ar item
-Append
-.Ar item
-to the
-.Va variable .
-.br
-.Sy Example:
-.Dl configure.args-append --with-gnomedb
-.It Va variable Ns - Ns Ic delete Ar item
-Delete
-.Ar item
-from the
-.Va variable .
-.br
-.Sy Example:
-.Dl configure.args-delete --with-gnomedb
-.It Ic readdir Ar directory
-Return the list of elements in a
-.Ar directory ,
-excluding
-.Pa \&.
-and
-.Pa \&.. .
-.It Ic strsed Ar string Ar pattern
-Perform
-.Xr ed 1 Ns / Ns
-.Xr tr 1 Ns -like
-search, replace, and transliteration on a string.
-.It Ic mktemp Ar template
-Create a temporary file using a
-.Ar template .
-See
-.Xr mktemp 3 .
-.It Ic mkstemp Ar template
-Create a temporary file securely using a
-.Ar template .
-See
-.Xr mkstemp 3 .
-.It Ic md5 Ar
-Compute the MD5 hashes of the file(s).
-.It Ic rpm-vercomp Ar versionA Ar versionB
-Compare two RPM-format versions for equality.
-.It Ic sudo Ar password Ar command Ar \&...
-Execute
-.Ar command
-using
-.Cm sudo
-with the provided password.
-.El
-.Pp
-.Bl -tag -width lc -compact
-.It Ic ui_debug Ar message
-.It Ic ui_error Ar message
-.It Ic ui_info Ar message
-.It Ic ui_msg Ar message
-.It Ic ui_warn Ar message
-Display a
-.Ar message
-to the user, at various different levels.
-.br
-.Sy Example:
-.Dl ui_msg \*qAdd each user to the system using the clamav command\*q
-.El
-.Sh SEE ALSO
-.Xr port 1 ,
-.Xr ports.conf 5 ,
-.Xr portgroup 7 ,
-.Xr portstyle 7 ,
-.Xr porthier 7 ,
-.Xr file n
-.Sh AUTHORS
-.An "Landon Fuller" Aq landonf at macports.org
-.An "Juan Manuel Palacios" Aq jmpp at macports.org
-.An "Mark Duling" Aq markd at macports.org
-.An "Kevin Van Vechten" Aq kevin at opendarwin.org
-.An "Jordan K. Hubbard" Aq jkh at opendarwin.org
-.An "Chris Ridd" Aq cjr at opendarwin.org

Copied: branches/dp2mp-move/base/doc/portfile.7 (from rev 24448, trunk/base/doc/portfile.7)
===================================================================
--- branches/dp2mp-move/base/doc/portfile.7	                        (rev 0)
+++ branches/dp2mp-move/base/doc/portfile.7	2007-04-24 17:28:16 UTC (rev 24454)
@@ -0,0 +1,1712 @@
+.\" portfile.7
+.\"
+.\" Copyright (c) 2002 Apple Computer, Inc.
+.\" 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 Apple Computer, 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
+.\" 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.
+.\"
+.Dd February 13, 2007
+.Dt PORTFILE 7 "Apple Inc."
+.Os Darwin
+.Sh NAME
+.Nm Portfile
+.Nd MacPorts description file reference
+.Sh DESCRIPTION
+A complete reference of all available
+.Nm
+variables and example syntax.
+.Nm Portfiles
+consist of valid TCL, allowing for simple key/value pair syntax as well
+as utilization of TCL's extensive functionality.
+.Nm Portfiles
+are encoded in UTF-8.
+.Pp
+The
+.Nm Macports System
+uses a target dependency system based on a
+depends/provides model, allowing for targets to be registered and
+executed in the correct order based on their individual requirements.
+.Pp
+A
+.Nm
+author needs to be aware of the various standard targets, the options
+that they require and the variables that both the targets and the port
+system provide.
+.Sh PORTSYSTEM
+Portfiles must begin with a PortSystem line that defines which version of the
+Portfile interpreter should be used.
+.br
+.Sy Synopsis:
+.Dl PortSystem 1.0
+.Sh MAIN VARIABLES
+All ports are required to set certain variables.
+.Bl -tag -width lc
+.It Ic name
+Full name of port.
+.br
+.Sy Type:
+.Em required
+.br
+.Sy Example:
+.Dl name XFree86
+.It Ic version
+Upstream version of software.
+.br
+.Sy Type:
+.Em required
+.br
+.Sy Example:
+.Dl version 4.2.1
+.It Ic epoch
+If a port's version numbering changes such that a newer version looks
+older than the previous version, the
+.Ic epoch
+should be increased. Often the
+.Ic epoch
+is formatted like a date.
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Default:
+.Em 0
+.br
+.Sy Example:
+.Dl epoch 20041231
+.It Ic description
+One line description of the software and what it does.
+.br
+.Sy Type:
+.Em required
+.br
+.Sy Example:
+.Dl description Dictionary Server Protocol (RFC2229) client
+.It Ic long_description
+A verbose description of the software and what it does.
+.br
+.Sy Type:
+.Em required
+.br
+.Sy Example:
+.Bd -literal -offset indent -compact
+long_description The GNU Image Manipulation Program \e\
+
+    (GIMP) is a powerful tool for the preparation and \e\
+
+    manipulation of digital images. The GIMP provides \e\
+
+    the user with a wide variety of image manipulation, \e\
+
+    painting, processing, and rendering tools.
+.Ed
+.It Ic revision
+Local revision number of
+.Nm .
+Increment for port revisions which would change its installation in any way.
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Default:
+.Em 0
+.br
+.Sy Example:
+.Dl revision 1
+.It Ic categories
+Categories to which this port belongs.
+.br
+.Sy Type:
+.Em required
+.br
+.Sy Example:
+.Dl categories spelling textproc
+.It Ic maintainers
+E-mail address(es) of port maintainer(s).
+.br
+.Sy Type:
+.Em required
+.br
+.Sy Example:
+.Dl maintainers landonf at opendarwin.org kevin at opendarwin.org
+.It Ic platforms
+Declares which platforms are supported by the port.
+.br
+.Sy Type:
+.Em required
+.br
+.Sy Values:
+.Em darwin freebsd
+.br
+.Sy Example:
+.Dl platforms darwin
+.It Ic homepage
+Project homepage for the port.
+.br
+.Sy Type:
+.Em required
+.br
+.Sy Example:
+.Dl http://wireshark.org
+.It Ic master_sites
+List of sites to fetch
+.Ic distfiles
+from or a predefined mirror site
+list. If set to a predefined mirror site, without a subdirectory being
+defined, the portname is used as the name of the subdirectory.
+.br
+.Sy Type:
+.Em required
+.br
+.Sy Example:
+.Bd -literal -offset indent -compact
+master_sites ftp://ftp.cdrom.com/pub/magic \e\
+
+    sourceforge
+.Ed
+.It Ic worksrcdir
+Path to source directory relative to
+.Ic workpath .
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Default:
+.Em ${distname}
+.br
+.Sy Example:
+.Dl worksrcdir ${distname}-src-${version}
+.It Ic distname
+Name of distribution file, without the
+.Cm extract.suffix .
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Default:
+.Em ${name}-${version}
+.br
+.Sy Example:
+.Dl distname ${name}-${version}-src
+.It Xo
+.Ic checksums Ar filename Ar type Ar checksum
+.Op Ar filename Ar type checksum ...
+.Xc
+List of checksums for the
+.Ic distfiles .
+The checksum
+.Ar type
+can currently be md5, rmd160 or sha1. The
+.Ar filename
+can be omitted if there is only one distfile.
+.br
+.Sy Type:
+.Em required
+.br
+.Sy Example:
+.Bd -literal -offset indent -compact
+checksums dictd-1.7.1.tar.gz md5 81317b86ea0a5df0163900ad2e6bb12c \e\ 
+	magic-words-1.7.1.tar.gz md5 897a005182928613eadd30c267ce9c5b
+.Ed
+.br
+.Sy Example (ledit 1.11):
+.Bd -literal -offset indent -compact
+checksums md5 a2d38ba641682509c1e964ad699a9dd2 \e\ 
+	sha1 1fb6443b5fdf3c83787953f06282d256477c1288
+.Ed
+.br
+.Sy Example (ssldump 0.9b3):
+.Bd -literal -offset indent -compact
+checksums md5 ac8c28fe87508d6bfb06344ec496b1dd \e\ 
+	sha1 a633a9a811a138eac5ed440d583473b644135ef5 \e\ 
+	rmd160 941cf8f2ef8459ec4f9ce65772e134505d46566
+.Ed
+.It Ic use_automake
+If set to yes, run the
+.Cm automake
+target to build any
+.Pa Makefile.in
+files for use by
+.Pa configure .
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Default:
+.Em no
+.br
+.Sy Example:
+.Dl use_automake yes
+.It Ic use_autoconf
+If set to yes, run the
+.Cm autoconf
+target to build any
+.Pa configure
+script required.
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Default:
+.Em no
+.br
+.Sy Example:
+.Dl use_autoconf yes
+.It Ic use_configure
+If set to yes, run the
+.Cm configure
+target to configure the build.
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Default:
+.Em yes
+.br
+.Sy Example:
+.Dl use_configure no
+.El
+.Sh TARGET HOOKS
+A number of hooks are available for customizing many of the standard
+targets that
+.Xr port 1
+executes. The targets supporting these hooks are
+.Cm fetch ,
+.Cm automake ,
+.Cm autoconf ,
+.Cm configure ,
+.Cm build ,
+.Cm destroot ,
+and
+.Cm test .
+The hooks are:
+.Bl -tag -width lc
+.It Va target Ns Ic .dir
+Directory in which to run the
+.Va target .
+.br
+.Sy Example:
+.Dl automake.dir src
+.It Va target Ns Ic .env
+Change the environment the
+.Va target
+is run in. This is often overridden on a per
+.Nm
+basis.
+.br
+.Sy Example:
+.Dl configure.env CPP=/usr/bin/cpp-4.0
+.It Va target Ns Ic .pre_args
+Additional arguments passed before the main arguments.
+.br
+.Sy Example:
+.Dl extract.pre_args -cd
+.It Va target Ns Ic .args
+Main arguments to pass to the
+.Va target .
+This is often overridden on a per
+.Nm
+basis.
+.br
+.Sy Example:
+.Dl configure.args --enable-fooble
+.It Va target Ns Ic .post_args
+Additional arguments passed after the main arguments.
+.br
+.Sy Example:
+.Dl extract.post_args | tar xf -
+.El
+.Sh RUNTIME VARIABLES
+Read-only access to the MacPorts configuration is provided.
+.Bl -tag -width lc
+.It Ic prefix
+Install prefix
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Default:
+.Em /opt/local
+.It Ic libpath
+Location of ports-specific TCL libraries.
+.br
+.Sy Type:
+.Em read-only
+.It Ic portpath
+Full path to the Portfile location.
+.br
+.Sy Type:
+.Em read-only
+.It Ic workdir
+Path to work directory relative to
+.Ic portpath .
+Where possible use
+.Ic workpath
+instead.
+.br
+.Sy Type:
+.Em read-only
+.br
+.Sy Default:
+.Em work
+.It Ic workpath
+Full path to work directory.
+.br
+.Sy Type:
+.Em read-only
+.br
+.Sy Default:
+.Em ${portpath}/${workdir}
+.It Ic worksrcpath
+Full path to working sources (where port has unpacked itself).
+.br
+.Sy Type:
+.Em read-only
+.br
+.Sy Default:
+.Em ${workpath}/${worksrcdir}
+.It Ic filesdir
+Path to port files relative to
+.Ic portpath .
+.br
+.Sy Type:
+.Em read-only
+.br
+.Sy Default:
+.Em files
+.It Ic distpath
+Location to store downloaded distfiles.
+.br
+.Sy Type:
+.Em read-only
+.br
+.Sy Default:
+.Em ${sysportpath}/distfiles/${dist_subdir}/
+.It Ic os.arch
+Identifies hardware type (eg "powerpc").
+.br
+.Sy Type:
+.Em read-only
+.It Ic os.version
+Version number of operating system (eg "7.0").
+.br
+.Sy Type:
+.Em read-only
+.It Ic os.endian
+Endianness of the processor (eg "bigEndian").
+.br
+.Sy Type:
+.Em read-only
+.It Ic os.platform
+Operating system name (eg "darwin").
+.br
+.Sy Type:
+.Em read-only
+.It Ic install.user
+User for MacPorts installation (eg
+.Pa root )
+.br
+.Sy Type:
+.Em read-only
+.It Ic install.group
+Group for MacPorts installation (eg
+.Pa wheel )
+.br
+.Sy Type:
+.Em read-only
+.It Ic x11prefix
+Absolute path to X11 (eg
+.Pa /usr/X11R6 )
+.br
+.Sy Type:
+.Em read-only
+.El
+.Sh DEPENDENCY OPTIONS
+Port dependencies should refer to other MacPort ports
+whenever possible, therefore each dependency should be
+expressed in the format:
+.Bl -tag -width ls
+.It port: Ns Ao port Ac
+.El
+.Pp
+Where 
+.Ao port Ac represents the name of an existing MacPorts
+.Nm port .
+If satisfying a dependency with a MacPorts port is not
+practical and it is likely that a dependency must be met
+by an Apple optional install, then the alternative dependency
+format:
+.Bl -tag -width lc
+.It Ar type Ns : Ns Ao filename Ac Ns : Ns Ao port Ac
+.El
+.Pp
+may be used. Where
+.Ar type
+is "bin" if
+.Ao filename Ac
+is a program, "lib" if it is a library, or "path" if it is a path to an
+installed file.
+.br
+.Sy Example:
+.Dl lib:libX11.6:XFree86
+.Bl -tag -width lc
+.It Ic depends_build
+List of dependencies to check before
+.Cm build ,
+.Cm destroot ,
+.Cm install ,
+and
+.Cm package
+targets.
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Example:
+.Dl depends_build port:autoconf
+.It Ic depends_run
+List of dependencies to check before
+.Cm destroot ,
+.Cm install
+and
+.Cm package
+targets.
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Example:
+.Dl depends_run port:bash
+.It Ic depends_lib
+List of dependencies to check before
+.Cm configure ,
+.Cm build ,
+.Cm destroot ,
+.Cm install ,
+and
+.Cm package
+targets.
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Example:
+.Dl depends_lib port:libfetch
+.El
+.Sh FETCH OPTIONS
+Fetch all distribution files and patches.
+.Bl -tag -width lc
+.It Ic master_sites.mirror_subdir
+Subdirectory to append to all mirror sites for any list specified in
+master_sites.
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Default:
+.Em ${name}
+.br
+.Sy Example:
+.Dl master_sites.mirror_subdir      magic
+.It Ic patch_sites
+List of sites to fetch
+.Ic patchfiles
+from or a predefined mirror site list.
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Default:
+.Em ${master_sites}
+.br
+.Sy Example:
+.Dl patch_sites ftp://ftp.patchcityrepo.com/pub/magic/patches
+.It Ic patch_sites.mirror_subdir
+Subdirectory to append to all mirror sites for any list specified in
+.Ic patch_sites .
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Default:
+.Em ${name}
+.br
+.Sy Example:
+.Dl patch_sites.mirror_subdir       magic
+.It Ic extract.suffix
+Suffix to append to
+.Ic distname .
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Default:
+.Em .tar.gz
+.br
+.Sy Example:
+.Dl extract.suffix .tgz
+.It Ic distfiles
+List of distribution files to fetch from
+.Ic master_sites .
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Default:
+.Em [suffix ${distname}]
+.br
+.Sy Example:
+.Dl distfiles magicsource.tar.gz cluebat.tar.bz2
+.It Ic patchfiles
+List of patches to fetch and apply.
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Example:
+.Dl patchfiles japanese-widechar-fix.diff japanese-localization.diff
+.It Ic use_zip
+Use zip.
+.br
+Sets extract.suffix to: .zip
+.br
+Sets extract.cmd to: unzip
+.br
+Sets extract.pre_args to: -q
+.br
+Sets extract.post_args to: "-d ${portpath}/${workdir}"
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Example:
+.Dl use_zip yes
+.It Ic use_bzip2
+Use bzip2.
+.br
+Sets extract.suffix to: .bzip2
+.br
+Sets extract.cmd to: bzip2
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Example:
+.Dl use_bzip2 yes
+.It Ic dist_subdir
+Create a sub-directory in
+.Ic distpath
+to store all fetched files.
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Default:
+.Em ${name}
+.br
+.Sy Example:
+.Dl dist_subdir vim${version}
+.El
+.Ss ADVANCED FETCH OPTIONS
+Some mirrors require special options for a resource to be properly
+fetched.
+.Bl -tag -width lc
+.It Ic fetch.user
+HTTP or FTP user to fetch the resource.
+.br
+.Sy Type:
+.Em optional
+.It Ic fetch.password
+HTTP or FTP password to fetch the resource.
+.br
+.Sy Type:
+.Em optional
+.It Ic fetch.use_epsv
+Whether to use EPSV command for FTP transfers.
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Default:
+.Em yes
+.br
+.It Ic fetch.ignore_sslcrt
+Whether to ignore the host SSL certificate (for HTTPS).
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Default:
+.Em no
+.br
+.El
+.Ss FETCHING FROM CVS
+As an alternative to fetching distribution files, pulling the sources
+from a CVS repository is supported. Use of CVS can give rise to
+non-reproducible builds, so it is strongly discouraged.
+.Bl -tag -width lc
+.It Ic cvs.root
+Specify the address to a CVS repository from which to checkout files.
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Default:
+.Em none
+.br
+.Sy Example:
+.Dl cvs.root :pserver:anonymous cvs.sv.gnu.org:/sources/emacs
+.It Ic cvs.tag
+Specify a CVS tag identifying the code to checkout.
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Default
+.Em none
+.br
+.Sy Example:
+.Dl cvs.tag HEAD
+.It Ic cvs.date
+A date that identifies the CVS code set to checkout.
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Default
+.Em none
+.br
+.Sy Example:
+.Dl cvs.date \*q12-April-2005\*q
+.It Ic cvs.module
+A CVS module from which to check out the code.
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Default
+.Em none
+.br
+.Sy Example:
+.Dl cvs.module Sources
+.El
+.Ss FETCHING FROM SUBVERSION
+As an alternative to fetching distribution files, pulling the sources
+from a subversion repository is supported. Use of subversion can give
+rise to non-reproducible builds, so it is strongly discouraged.
+.Bl -tag -width lc
+.It Ic svn.url
+Specify the url from which to fetch files.
+.br
+.Sy Type:
+.Em required
+.br
+.Sy Default:
+.Em none
+.br
+.Sy Example:
+.Dl svn.url http://www.domain.com/svn-repo/mydirectory
+      svn.url svn://www.domain.com/svn-repo/mydirectory
+.It Ic svn.tag
+Specify the a tag from which svn should fetch files. This
+corresponds to the -r option to the svn cli.
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Default:
+.Em none
+.br
+.Sy Example:
+.Dl svn.url http://www.domain.com/svn-repo/mydirectory
+      svn.url svn://www.domain.com/svn-repo/mydirectory
+.El
+.Sh EXTRACT OPTIONS
+Extract all compressed/archived files.
+.Bl -tag -width lc
+.It Ic extract.only
+List of files to extract into
+.Ic workpath .
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Default:
+.Em ${distfiles}
+.br
+.Sy Example:
+.Dl extract.only worksrc-1.4.4.tar.gz
+.It Ic extract.cmd
+Command to perform the extraction.
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Default:
+.Em gzip
+.br
+.Sy Example:
+.Dl extract.cmd bzip2
+.El
+.Sh CONFIGURE OPTIONS
+MacPorts provide special support for configure flags (CFLAGS, LDFLAGS, CPPFLAGS, CXXFLAGS). Please note that the previous way to alter these flags (using configure.env) may become deprecated at some point. The following options are defined:
+.Bl -tag -width lc
+.It Ic configure.cflags
+Flags to put in the CFLAGS environment variable when invoking the configure script.
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Default:
+.Em -O2
+.br
+.Sy Example:
+.Dl configure.cflags-append -DHAS_LRINTF
+.It Ic configure.cppflags
+Flags to put in the CPPFLAGS environment variable when invoking the configure script.
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Default:
+.Em -I${prefix}/include
+.It Ic configure.cxxflags
+Flags to put in the CXXFLAGS environment variable when invoking the configure script.
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Default:
+.Em -O2
+.It Ic configure.ldflags
+Flags to put in the LDFLAGS environment variable when invoking the configure script.
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Default:
+.Em -L${prefix}/lib
+.El
+.Ss UNIVERSAL TARGET HOOKS
+For universal builds of configure-based ports, we also define specific target hooks. These can be overridden for specific ports. Please note that these hooks are used by the default universal variant and redefining the variant will make them useless.
+.Bl -tag -width lc
+.It Ic configure.universal_args
+Arguments appended to the configure script to build the port universal.
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Default:
+.Em --disable-dependency-tracking
+.It Ic configure.universal_cflags
+Additional flags to put in the CFLAGS environment variable when invoking the configure script.
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Default:
+.Em -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc
+.It Ic configure.universal_cppflags
+Additional flags to put in the CPPFLAGS environment variable when invoking the configure script.
+.br
+.Sy Type:
+.Em optional
+.It Ic configure.universal_cxxflags
+Additional flags to put in the CXXFLAGS environment variable when invoking the configure script.
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Default:
+.Em -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc
+.It Ic configure.universal_ldflags
+Additional flags to put in the LDFLAGS environment variable when invoking the configure script.
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Default:
+.Em -arch i386 -arch ppc
+.El
+.Sh BUILD OPTIONS
+Execute necessary build commands.
+.Bl -tag -width lc
+.It Ic build.cmd
+Make command to run relative to
+.Ic worksrcdir .
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Default:
+.Em make
+.br
+.Sy Example:
+.Dl build.cmd pbxbuild
+.It Ic build.type
+Defines which 'make' is required, either 'gnu' or 'bsd'.
+Sets
+.Ic build.cmd
+to either
+.Pa gnumake
+or
+.Pa bsdmake
+accordingly.
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Default:
+.Em gnu
+.br
+.Sy Example:
+.Dl build.type bsd
+.It Ic build.target
+Target passed to
+.Ic build.cmd .
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Default:
+.Em all
+.br
+.Sy Example:
+.Dl build.target all-src
+.El
+.Sh DESTROOT OPTIONS
+Execute necessary commands to install into a temporary destination root
+("destroot") staging area.
+.Bl -tag -width lc
+.It Ic destroot.cmd
+Install command to run relative to
+.Ic worksrcdir .
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Default:
+.Em ${build.cmd}
+.br
+.Sy Example:
+.Dl destroot.cmd pbxbuild
+.It Ic destroot.type
+Defines which 'make' is required, either 'gnu' or 'bsd'.
+Sets
+.Ic destroot.cmd
+to either
+.Pa gnumake
+or
+.Pa bsdmake
+accordingly.
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Default:
+.Em ${build.type}
+.br
+.Sy Example:
+.Dl destroot.type gnu
+.It Ic destroot.destdir
+Arguments passed to
+.Ic destroot.cmd
+in order to install correctly
+into the destroot.
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Default:
+.Em DESTDIR=${destroot}
+.br
+.Sy Example:
+.Dl destroot.destdir prefix=${destroot}${prefix}
+.It Ic destroot.target
+Install target to pass to
+.Ic destroot.cmd .
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Default:
+.Em install
+.br
+.Sy Example:
+.Dl destroot.target install-src
+.It Ic destroot.umask
+Umask to use during destroot.
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Default:
+.Em 022
+.br
+.Sy Example:
+.Dl destroot.umask 002
+.It Ic destroot.keepdirs
+List of directories that should not be pruned if empty upon
+.Cm destroot
+completion.
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Example:
+.Dl destroot.keepdirs ${destroot}${prefix}/var/log/mysql
+.El
+.Sh TEST OPTIONS
+Execute commands to run test suites bundled with a port.
+.Bl -tag -width lc
+.It Ic test.run
+Enable running test suites bundled with a port.
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Example:
+.Dl test.run     yes
+.It Ic test.cmd
+Test command to run relative to
+.Ic worksrcdir .
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Default:
+.Em ${build.cmd}
+.br
+.Sy Example:
+.Dl test.cmd checks.sh
+.It Ic test.target
+Test target to pass to
+.Ic test.cmd .
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Default:
+.Em test
+.br
+.Sy Example:
+.Dl test.target checks
+.El
+.Sh STARTUPITEM OPTIONS
+If a port needs to run on system startup, it can use MacPorts
+startupitem keywords to install native OS X startup scripts.
+Startup scripts require user interaction after port installation
+to activate them and instructions are given during port installs.
+.Bl -tag -width lc
+.It Ic startupitem.create
+Choose whether or not to generate a startup item.
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Default:
+.Em no
+.br
+.Sy Values:
+.Em yes no
+.br
+.Sy Example:
+.Dl startupitem.create yes
+.It Ic startupitem.type
+Select the type of startupitem to generate. By default, a startupitem
+will be generated that is of the appropriate type for the OS. For
+instance, launchd is used on system 10.4, while SystemStarter is used
+on prior Mac OS X systems. A global default may be specified with the startupitem_type preference in ports.conf.
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Default:
+.Em default
+.br
+.Sy Values:
+.Em SystemStarter launchd default rcNG
+.br
+.Sy Example
+.Dl startupitem.type launchd
+.It Ic startupitem.name
+Displayed name of the startup item.
+.br
+.Sy Type:
+.Em required
+.br
+.Sy Example:
+.Dl startupitem.name OpenSSH
+.It Ic startupitem.executable
+The name of the daemon to be run in the background. This is
+the preferred type of startup item rather than any of
+startupitem.init, startupitem.start, startupitem.stop, or
+startupitem.restart, and may not be used together with any
+of these options.  This option may contain multiple
+arguments, but they must be appropriate for a call to exec; they
+may not contain arbitrary shell code.
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Values:
+.Em /path/to/executable <args>
+.br
+.Sy Example:
+.Dl startupitem.executable ${prefix}/bin/wonka
+.It Ic startupitem.init
+Shell code that will be executed prior to any of the options
+startupitem.start, startupitem.stop and startupitem.restart.
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Values:
+.Em sh code
+.br
+.Sy Example:
+.Dl startupitem.init FOO=start
+.It Ic startupitem.start
+Shell code executed to start the daemon.
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Values:
+.Em sh code
+.br
+.Sy Example:
+.Dl startupitem.start ${prefix}/share/mysql/mysql.server start
+.It Ic startupitem.stop
+Shell code executed to stop the daemon.
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Values:
+.Em sh code
+.br
+.Sy Example:
+.Dl startupitem.stop ${prefix}/share/mysql/mysql.server stop
+.It Ic startupitem.restart
+Shell code executed to restart the daemon. In the absence
+of this key, the daemon will be restarted by taking the
+stop action, followed by taking the start action.
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Values:
+.Em sh code
+.br
+.Sy Example:
+.Dl startupitem.restart ${prefix}/share/mysql/mysql.server restart
+.It Ic startupitem.pidfile
+Specification for pidfile handling. This is particularly useful
+in conjunction with the startupitem.executable key, because it is
+important that the startupitem know how to track the executable.
+This specifies whether the daemon generates its own pidfile (auto),
+whether it generates its own but forgets to delete it, so that the
+startupitem should delete it (clean), or whether it never generates
+one, in which case the startupitem should manage the pidfile on its
+own (manual), or whether no pidfile should be used at all (none).
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Default:
+.Em none "${prefix}/var/run/${name}.pid"
+.br
+.Sy Values:
+.Em none|auto|manual|clean [/path/to/pidfile]
+.br
+.Sy Example:
+.Dl startupitem.pidfile auto ${prefix}/var/run/${name}.pidfile
+.It Ic startupitem.logfile
+Path to a logfile for logging events about the lifetime of the
+startupitem. Depending on the type of startupitem, and the manner
+in which it is started, standard output from the daemon may also be
+directed to the logfile.
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Default:
+.Em /dev/null
+.br
+.Sy Values:
+.Em path
+.br
+.Sy Example:
+.Dl startupitem.logfile ${prefix}/var/log/mydaemon.log
+.It Ic startupitem.logevents
+Control whether or not to log events to the log file. If logevents
+is set, events with timestamps are logged to the logfile.
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Default:
+.Em no
+.br
+.Sy Values:
+.Em yes|no
+.br
+.Sy Example:
+.Dl startupitem.logevents yes
+.El
+.Sh DISTCHECK AND LIVECHECK OPTIONS
+MacPorts can automatically check if the software has been updated
+since the Portfile was modified and if some external changes require
+an update to the Portfile. This helps maintainers have up-to-date
+and working Portfiles.
+.br
+Two checks are available. With distcheck, MacPorts can check that the
+distfile(s) are still downloadable and did not change since the portfile
+was modified.
+With livecheck, MacPorts can query a resource to determine if a newer
+version of the software is available.
+.Bl -tag -width lc
+.It Ic distcheck.check
+This option can be used to disable distcheck. It specifies what kind
+of check should be performed on distfiles:
+.Em moddate
+(check if the Portfile is older than the distfile) or
+.Em none
+(no check).
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Default:
+.Em moddate
+.br
+.Sy Values:
+.Em moddate none
+.It Ic livecheck.check
+What kind of check to perform to figure out if the software has been updated.
+Can be
+.Em freshmeat
+(uses the date_updated tag of the freshmeat XML file),
+.Em sourceforge
+(uses the version of the latest file release of the project),
+.Em googlecode
+(uses the version of the latest file release of the project),
+.Em moddate
+(uses the modification date of some URL resource),
+.Em regex
+(retrieve the version by applying a regex to some URL resource),
+.Em regexm
+(retrieve the version by applying a multi-line regex to some URL resource),
+.Em md5
+(compares the md5 sum of some URL resource) or
+.Em none
+(no check).
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Default:
+.Em sourceforge
+or
+.Em googlecode
+if the master_sites is one of these, else
+.Em freshmeat
+.br
+.Sy Values:
+.Em freshmeat sourceforge googlecode moddate regex regexm md5 none
+.It Ic livecheck.name
+Name of the project for live checks (used for freshmeat, sourceforge, and googlecode checks).
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Default:
+.Em ${name}
+or the sourceforge/freshmeat/googlecode project name if it can be guessed by looking at the master_sites.
+.It Ic livecheck.distname
+Name of the file release (used for sourceforge and googlecode checks).
+For sourceforge releases use the name of the package release.
+For googlecode releases use the name of the file download, including extension.
+Replace the version part of the name with "(.*)".
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Default:
+.Em ${livecheck.name}
+for sourceforge projects or the first entry in
+.Em ${distfiles}
+for googlecode projects
+.It Ic livecheck.version
+Version of the project for live checks (used for regex-based checks).
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Default:
+.Em ${version}
+.It Ic livecheck.url
+URL to query for the check.
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Default:
+.Em ${homepage}
+or
+.Em http://freshmeat.net/projects-xml/${livecheck.name}/${livecheck.name}.xml
+or
+.Em http://sourceforge.net/export/rss2_projfiles.php?project=${livecheck.name}
+or
+.Em http://code.google.com/p/${livecheck.name}/downloads/list
+.It Ic livecheck.regex
+Regular expression to parse the resource for regex checks.
+Be sure to use a regular expression grouping around the version component.
+.br
+.Sy Type:
+.Em optional
+.It Ic livecheck.md5
+md5 sum to use for md5 comparison.
+.br
+.Sy Type:
+.Em optional
+.El
+.Sh VARIANT OPTIONS
+MacPorts allows for conditional modification to be specified in a
+.Nm ,
+allowing for user-customization of a software's build-time settings.
+.Bl -tag -width lc
+.It Xo
+.Ic variant
+.Op Cm requires Ar variant
+.Op Cm conflicts Ar variant
+.Xc
+The value is usually a TCL script which modifies other port's
+.Nm
+variables. Dependencies and conflicts with other variants in the same
+port can be expressed with
+.Cm requires
+and
+.Cm conflicts .
+The example adds a "gnome" variant to a port.
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Example:
+.Bd -literal -offset indent -compact
+variant gnome requires glib { configure.args-append --with-gnome \e\
+
+    depends_lib-append lib:gnome-session:gnome-session }
+.Ed
+.It Ic default_variants
+If variants are defined, then the
+.Ic default_variants
+value lists which variants are enabled by default.
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Example:
+.Dl default_variants +ssl +tcpd
+.It Ic universal_variant
+When using MacPorts on MacOS X, a universal variant is defined and
+the default behavior is to configure ports with universal flags
+(see the
+.Ic UNIVERSAL TARGET HOOKS
+section above). The variant can be
+overridden if the default code does not work. It can also be
+suppressed if having a universal variant for the port does not make
+sense. To suppress it, use the
+.Ic universal_variant
+option.
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Default:
+.Em yes
+.br
+.Sy Example:
+.Dl universal_variant no
+.El
+.Sh PLATFORM OPTIONS
+MacPorts allows for platform-specific conditional modification to be
+specified in a
+.Nm ,
+much like variants, for handling differences between platforms and
+versions of the same platform.
+.Bl -tag -width lc
+.It Xo
+.Ic platform
+.Ar platform
+.Op Ar version
+.Op Ar arch
+.Xc
+The platform key is used to begin the darwin platform definitions as
+shown in the examples from the databases/db4 and devel/libidl1
+.Nm Portfiles
+respectively.
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Example:
+.Bd -literal -offset indent -compact
+platform darwin 6 { configure.args-append   --enable-tcl \e\
+
+        --with-tcl=/System/Library/Tcl/8.3 }
+.Ed
+.br
+.Sy Example:
+.Bd -literal -offset indent -compact
+platform darwin powerpc { configure.args-append \e\
+
+        --host=${os.arch}-apple-rhapsody${os.version} }
+platform darwin i386 { configure.args-append \e\
+
+        --host=i386-gnu-rhapsody${os.version} }
+.Ed
+.El
+.Sh PORTGROUP
+To factorize the work with similar ports, MacPorts provides the notion of
+.Nm PortGroup
+that can be used to load definitions for a given class or group of ports. See
+.Xr portgroup 7
+for more details on the various PortGroup classes.
+.Sh TCL EXTENSIONS
+A number of TCL extensions are available for use in
+.Nm Portfiles .
+.Pp
+.Bl -tag -width lc
+.Bl -tag -width lc -compact
+.It Xo
+.Ic xinstall
+.Op Fl c
+.Op Fl B Ar suffix
+.Op Fl b
+.Op Fl C
+.Op Fl f Ar flags
+.Op Fl g Ar group
+.Op Fl M
+.Op Fl m Ar mode
+.Op Fl o Ar owner
+.Op Fl p
+.Op Fl S
+.Op Fl s
+.Op Fl W Ar dir
+.Op Ar
+.Ar destination
+.Xc
+.It Xo
+.Ic xinstall
+.Fl d
+.Op Fl B Ar suffix
+.Op Fl b
+.Op Fl C
+.Op Fl f Ar flags
+.Op Fl g Ar group
+.Op Fl M
+.Op Fl m Ar mode
+.Op Fl o Ar owner
+.Op Fl p
+.Op Fl S
+.Op Fl s
+.Op Fl W Ar dir
+.Ar directory
+.Xc
+Install file(s) to a target file or directory. The options are
+intended to be compatible with
+.Xr install 1 :
+.Bl -tag -width indent
+.It Fl b
+Backup any existing files with an
+.Pa .old
+extension.
+.It Fl B
+Specify a different backup suffix for the
+.Fl b
+flag.
+.It Fl c
+Install files (this is the default).
+.It Fl C
+Only copy a file if it is different.
+.It Fl d
+Create directories, including (if necessary) parent directories.
+.It Fl f
+Specify target flags, see
+.Xr chflags 1
+for details.
+.It Fl g
+Specify the group.
+.It Fl M
+Disable use of
+.Xr mmap 2 .
+.It Fl m
+Specify an alternate mode. The default is 0755. See
+.Xr chmod 1
+for defails.
+.It Fl p
+Preserve the modification time.
+.It Fl S
+Copy safely, using a temporary file.
+.It Fl s
+Strip binaries using
+.Xr strip 1 .
+.It Fl W
+Change to
+.Ar dir
+before working.
+.El
+.El
+.It Xo
+.Ic fs-traverse
+.Op Fl depth
+.Op Fl ignoreErrors
+.Ar varname
+.Ar target-list
+.Ar body
+.Xc
+Traverse the filesystem hierarchy rooted in each element of
+.Ar target-list
+and execute
+.Ar body
+for each found file/directory.
+.Va varname
+is set to the path of the file/directory. If
+.Ic break
+is called during execution, the filesystem traversal is stopped. If
+.Ic continue
+is called during execution, the current file and any children are skipped
+and traversal continues with the next file/directory.
+.Bl -tag -width indent
+.It Fl depth
+Equivalent to the
+.Fl d
+switch to
+.Xr find 1 .
+Please note that using
+.Fl depth
+means you cannot prune a directory with
+.Ic continue
+as it will be processed after its children.
+.It Fl ignoreErrors
+Causes
+.Ic fs-traverse
+to ignore any permissions/read errors encountered during processing.
+.El
+.Pp
+If
+.Nm fs-traverse
+is called directly on a symbolic link, the link will be followed. All other
+links encountered during traversal will not be followed.
+.Pp
+.Nm fs-traverse
+will not descend into directories that have a different device number than
+the root of the descent.
+.Pp
+If you remove the current directory during traversal, be aware that you must call
+.Nm continue
+to inform
+.Nm fs-traverse
+that the directory should not be descended into.
+.It Xo
+.Ic curl fetch
+.Ar url
+.Ar file
+.Xc
+Fetch a resource at
+.Ar url
+and save it to
+.Ar file .
+.It Xo
+.Ic curl isnewer
+.Ar url
+.Ar date
+.Xc
+Determine if resource at
+.Ar url
+is newer than
+.Ar date
+(expressed in seconds since epoch).
+.It Xo
+.Ic adduser
+.Ar username
+.Op Cm uid Ns = Ns uid
+.Op Cm gid Ns = Ns gid
+.Op Cm passwd Ns = Ns passwd
+.Op Cm realname Ns = Ns realname
+.Op Cm home Ns = Ns home
+.Op Cm shell Ns = Ns shell
+.Xc
+Add a new local user to the system with the specified uid, gid,
+password, real name, home directory and login shell.
+.It Ic existsuser Ar username
+Check if a local user exists.
+.It Ic nextuid
+Returns the highest used uid plus one.
+.It Xo
+.Ic addgroup
+.Ar group
+.Op Cm gid Ns = Ns gid
+.Op Cm passwd Ns = Ns passwd
+.Op Cm users Ns = Ns users
+.Xc
+Add a new local group to the system, with the specified gid, password
+and with a list users as members.
+.It Ic existsgroup Ar group
+Check if a local group exists and return the corresponding gid. This can be used
+with adduser:
+.Dl addgroup foo 
+.Dl adduser foo gid=[existsgroup foo]
+.It Ic nextgid
+Returns the highest used gid plus one.
+.It Ic reinplace Ar regex Ar filename
+Provide in-place sed like editing of a file.
+.br
+.Sy Example:
+.Dl reinplace \*qs|/usr/local|${prefix}|g\*q doc/manpage.1
+.It Ic file
+Standard TCL command to manipulate file names and attributes, recommended if you wish to preserve Mac OS
+resource forks when destrooting ports on Mac OS X 10.3.x and Mac OS X 10.4.x . Use
+.Nm xinstall
+to also preserve Extended Attributes (i.e. Access Control Lists). See
+.Xr file n
+for more information on this command.
+.It Ic copy
+Built-in shorthand alternative to "file copy".
+.It Ic move
+Built-in shorthand alternative to "file rename".
+.It Ic delete
+Built-in shorthand alternative to "file -delete". Required over the latter for Portfiles that perform deleting
+operations on directories while building the port on Mac OS X 10.3 and earlier, due to a Tcl anomaly on those systems
+that causes "file -delete" to fail.
+.It Ic touch
+Built-in command mimicking the BSD touch command.
+.It Ic ln
+.br
+Built-in command mimicking the BSD ln command.
+.It Ic system Ar commandline
+Execute a program. See
+.Xr system 3 .
+For calls to
+.Xr install 1
+please use
+.Nm xinstall .
+For calls to 
+.Xr mv 1 ,
+.Xr cp 1 ,
+.Xr rm 1
+or similar, please use the built-in commands or
+.Nm file
+if they don't meet your requirements.
+.It Ic variant_isset Ar variant
+Checks if the given
+.Ar variant
+is being built.
+.It Ic variant_set Ar variant
+Set the given
+.Ar variant .
+.It Ic variant_unset Ar variant
+Unset the given
+.Ar variant .
+.It Va variable Ns - Ns Ic append Ar item
+Append
+.Ar item
+to the
+.Va variable .
+.br
+.Sy Example:
+.Dl configure.args-append --with-gnomedb
+.It Va variable Ns - Ns Ic delete Ar item
+Delete
+.Ar item
+from the
+.Va variable .
+.br
+.Sy Example:
+.Dl configure.args-delete --with-gnomedb
+.It Ic readdir Ar directory
+Return the list of elements in a
+.Ar directory ,
+excluding
+.Pa \&.
+and
+.Pa \&.. .
+.It Ic strsed Ar string Ar pattern
+Perform
+.Xr ed 1 Ns / Ns
+.Xr tr 1 Ns -like
+search, replace, and transliteration on a string.
+.It Ic mktemp Ar template
+Create a temporary file using a
+.Ar template .
+See
+.Xr mktemp 3 .
+.It Ic mkstemp Ar template
+Create a temporary file securely using a
+.Ar template .
+See
+.Xr mkstemp 3 .
+.It Ic md5 Ar
+Compute the MD5 hashes of the file(s).
+.It Ic rpm-vercomp Ar versionA Ar versionB
+Compare two RPM-format versions for equality.
+.It Ic sudo Ar password Ar command Ar \&...
+Execute
+.Ar command
+using
+.Cm sudo
+with the provided password.
+.El
+.Pp
+.Bl -tag -width lc -compact
+.It Ic ui_debug Ar message
+.It Ic ui_error Ar message
+.It Ic ui_info Ar message
+.It Ic ui_msg Ar message
+.It Ic ui_warn Ar message
+Display a
+.Ar message
+to the user, at various different levels.
+.br
+.Sy Example:
+.Dl ui_msg \*qAdd each user to the system using the clamav command\*q
+.El
+.Sh SEE ALSO
+.Xr port 1 ,
+.Xr ports.conf 5 ,
+.Xr portgroup 7 ,
+.Xr portstyle 7 ,
+.Xr porthier 7 ,
+.Xr file n
+.Sh AUTHORS
+.An "Landon Fuller" Aq landonf at macports.org
+.An "Juan Manuel Palacios" Aq jmpp at macports.org
+.An "Mark Duling" Aq markd at macports.org
+.An "Kevin Van Vechten" Aq kevin at opendarwin.org
+.An "Jordan K. Hubbard" Aq jkh at opendarwin.org
+.An "Chris Ridd" Aq cjr at opendarwin.org
+.An "Kevin Ballard" Aq eridius at macports.org

Deleted: branches/dp2mp-move/base/doc/ports.conf.5
===================================================================
--- trunk/base/doc/ports.conf.5	2007-04-22 07:33:59 UTC (rev 24327)
+++ branches/dp2mp-move/base/doc/ports.conf.5	2007-04-24 17:28:16 UTC (rev 24454)
@@ -1,185 +0,0 @@
-.\" Copyright (c) 2005 Matt Anton <matt at opendarwin.org>
-.\" 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 Eric Melville 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 REGENTS 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.
-.\"
-.Dd August 31, 2005
-.Dt PORTS.CONF 5 "MacPorts.org"
-.Os 
-.Sh NAME
-ports.conf
-.Nd Configuration file of the MacPorts system
-.Sh DESCRIPTION
-.Nm ports.conf
-is the configuration file used to bootstrap the MacPorts system. This file is read by the
-.Nm port
-command and determines how it behaves. Lines beginning with '#' are comments, empty lines are ignored.
-The format is that of a simple key/value space or tab separated pair.
-.Pp
-The file contains entries of the form:
-.Pp
-.Dl Va "<key> <value>"
-.Pp
-The value of any given key can be referred to by the '${<keyname>}' abstraction, where <keyname> expands
-to the key in question.
-.Pp
-.Sh KEYS
-The following keys are used by
-.Nm port
-itself:
-.Pp
-.Bl -tag -width lc
-.It Va prefix
-Sets the directory where ports are installed. Any path may be used but those with spaces and/or non ascii
-characters should be avoided, as this can broke some ports. This key is often referred to as '${prefix}'.
-.br
-.Ic Default:
-/opt/local
-.It Va x11prefix
-Path containing an X11 installation on your system.
-.br
-.Ic Default:
-/usr/X11R6
-.It Va portdbpath
-Directory where MacPorts keeps working data as downloaded sources, installed ports receipts
-and the main registry. Same path restrictions apply as for '${prefix}'.
-.br
-.Ic Default:
-${prefix}/var/db/dports
-.It Va portdbformat
-Storage type to use for the MacPorts registry. Currently the only supportted format is "flat".
-.br
-.Ic Default:
-flat
-.It Va portinstalltype
-Sets the mode in which ports are installed by MacPorts. Supported values are 'direct' or 'image'.
-The 'direct' mode is often used on systems that do not support 'image' due to limitations in their
-installed version of TCL. In 'direct' more ports are installed directly into '${prefix}' and only
-one flavor of a port can be installed at any given time. In 'image' mode multiple flavors of a port
-(i.e., different versions and/or any possible combination of its variants) can be installed concurrently
-into '${portdbpath}/software/${portname}' and only one can be "activated" onto '${prefix}' via soft or
-hard links from the former to the latter.
-.br
-.Ic Default:
-image
-.\" I think Paul wrote code to suppot image on Jaguar, so the following comment may no longer be needed.
-.\" is this the case?
-.Pp
-NOTE. Mac OS X 10.2 and Darwin 6.x users should switch to 'direct' mode to have MacPorts working properly
-on their systems.
-.It Va sources_conf
-Location of the sources file. This file enables rsync synchronization of the default dports tree with the
-MacPorts rsync server (through the "sync" target of the
-.Nm port
-commnand) and any other local tree(s) you might have.
-.br
-.Ic Default:
-${prefix}/etc/ports/sources.conf
-.It Va variants_conf
-Location of the optional global variants definition file, listing those that should be used in all installed
-ports if available.
-.br
-.Ic Default:
-${prefix}/etc/ports/variants.conf
-.It Va portarchivemode
-Key governing the creation of binary archives of installed ports for installation/reinstallation ease.
-.br
-.Ic Default:
-yes
-.It Va portarchivepath
-Location where to store/retrieve ports binary archive files from when archive mode is active.
-.br
-.Ic Default:
-${prefix}/var/db/dports/packages
-.It Va portarchivetype
-Colon or comma separated, space free list of supported formats of archives to create or read from when
-\&'${archivemode}' is set to 'yes'. Use of multiple types will cause archive creation to build all the
-specified types in one step. Unarchive uses multiple types as a search list to locate any existing archive,
-with the first found match being used.
-.br
-Supported types are: tgz, tar, tbz, tbz2, xar, zip, cpgz, cpio
-.br
-.Ic Default:
-tgz
-.It Va portautoclean
-Automatic cleaning of the build directory of a given port after it has been installed.
-.br
-.Ic Default:
-yes
-.It Va startupitem_type
-Set the default type of startupitems to be generated, overridable by Portfiles that explicitly state a
-startupitem.type key. If set to "default", then a type will be selected that's appropriate to the OS.
-Supported types are: SystemStarter, launchd, default, rcNG.
-.br
-.Ic Default:
-default
-.It va destroot_umask
-Umask value to use during the destrooting or a port.
-.br
-.Ic Default:
-022
-.It Va rsync_server
-Default rsync server to connect to when running "selfupdate" through the
-.Nm port
-command to update your entire MacPorts
-installation (spanning both the MacPorts infrastucture and the dports tree).
-.br
-.Ic Default:
-rsync.darwinports.org
-.It Va rsync_dir
-Rsync directory from which to pull the base/ component (infrastructure) of the MacPorts system off
-of the default rsync server.
-.br
-.Ic Default:
-dpupdate1/base/ (to pull in the sources from the shipping "release1" branch off of the MacPorts rsync
-server)
-.It Va rsync_options
-Default rsync options to use when connecting to the rsync server.
-.br
-.Ic Default:
--rtzv --delete --delete-after
-.It Va binpath
-Sets the directory search path for locating system executables used by MacPorts. This variable should contain
-the paths for locating utilities such as rsync, tar, cvs and others.
-.br
-.Ic Default:
-${prefix}/bin:${prefix}/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin
-.It Va extra_env
-List of extra environment variables MacPorts should keep in the user's environment when sanitizing it.
-.El
-.Sh FILES
-.Bl -tag -width
-.It Va ${prefix}/etc/ports/ports.conf
-Standard system-wide MacPorts configuration file.
-.It Va ~/.macports/ports.conf
-User-specific configuration override. This file, if found, will be used instead of the default file at
-${prefix}/etc/port/ports.conf.
-.El
-.Sh SEE ALSO
-.Xr port 1 ,
-.Xr portfile 7 ,
-.Xr portgroup 7 ,
-.Xr portstyle 7
-.Xr porthier 7 ,
-.Sh AUTHORS
-.An "Juan Manuel Palacios" Aq jmpp at macports.org
-.An "Matt Anton" Aq matt at opendarwin.org

Deleted: branches/dp2mp-move/base/doc/ports.conf.in
===================================================================
--- trunk/base/doc/ports.conf.in	2007-04-22 07:33:59 UTC (rev 24327)
+++ branches/dp2mp-move/base/doc/ports.conf.in	2007-04-24 17:28:16 UTC (rev 24454)
@@ -1,62 +0,0 @@
-# Set the directory in which to install ports
-prefix			@prefix_expanded@
-
-# Where to store MacPorts working data
-portdbpath		@localstatedir_expanded@/db/dports
-
-# Type of storage to use for the port registry information, "flat" or "sqlite"
-# NOTE: sqlite not yet supported.
-portdbformat		flat
-
-# Type of installation to do for ports, "direct" or "image".  See ports.conf(5) and online documentation.
-portinstalltype		image
-
-# Directory containing the X11 installation.
-x11prefix		/usr/X11R6
-
-# Where to find the sources list.
-sources_conf		@PORTCONFIGDIR_EXPANDED@/sources.conf
-
-# Where to find global variants definition file (optional)
-variants_conf		@PORTCONFIGDIR_EXPANDED@/variants.conf
-
-# Create and use binary archive packages for installation/reinstallation ease
-portarchivemode		no
-
-# Where to store/retrieve ports binary archive files
-portarchivepath		@localstatedir_expanded@/db/dports/packages
-
-# Type of binary archive packages to create when using archive mode
-#
-# Note: Multiple types ARE allowed and must be a colon or comma
-# separated list of choices (NO spaces). Use of multiple types will
-# cause archive creation to build all the specified types in one step.
-# Unarchive uses multiple types as a search list to locate the archive,
-# first archive to match one of the specified types in order is used.
-#
-# Supported types: tgz (default), tar, tbz, tbz2, xar, zip, cpgz, cpio
-portarchivetype		tgz
-
-# Set whether to automatically execute "clean" after "install" of ports
-portautoclean		yes
-
-# Rsync server to use
-rsync_server		rsync.darwinports.org
-
-# Rsync directory from which to pull the base/ component (infrastructure) of DP
-rsync_dir			dpupdate1/base/
-
-# Rsync options
-rsync_options		-rtzv --delete --delete-after
-
-# Options for generated startup items
-# startupitem_type may be "default", "systemstarter", or "launchd";
-# if the option is empty or "default" then a startupitem type appropriate
-# to the platform will be chosen. Tiger will default to launchd, while
-# older Mac OS X systems will default to systemstarter.
-startupitem_type	default
-
-# Extra environment variables to keep. Any variables listed here are added
-# to the list of variables that are not removed from the environment used
-# while processing ports
-# extra_env			KEEP_THIS THIS_TOO

Modified: branches/dp2mp-move/base/portmgr/IndexRegen.sh
===================================================================
--- trunk/base/portmgr/IndexRegen.sh	2007-04-22 07:33:59 UTC (rev 24327)
+++ branches/dp2mp-move/base/portmgr/IndexRegen.sh	2007-04-24 17:28:16 UTC (rev 24454)
@@ -21,14 +21,14 @@
 SPAM_LOVERS=macports-mgr at lists.macosforge.org,dluke at geeklair.net
 
 # Other settings (probably don't need to be changed).
-SVN_DPORTS_URL=http://svn.macports.org/repository/macports/trunk/dports
+SVN_PORTS_URL=http://svn.macports.org/repository/macports/trunk/dports
 SVN_BASE_URL=http://svn.macports.org/repository/macports/trunk/base
 SVN_CONFIG_DIR=${ROOT}/svnconfig
 # Where to checkout the source code. This needs to exist!
 SRCTREE=${ROOT}/source
 # Where MP will install its world. This gets created.
 PREFIX=${ROOT}/opt/local
-# Where MP installs darwinports1.0. This gets created.
+# Where MP installs macports1.0. This gets created.
 TCLPKG=${PREFIX}/lib/tcl
 # Path.
 PATH=${PREFIX}/bin:/bin:/usr/bin:/opt/local/bin
@@ -62,12 +62,12 @@
 
 # Update both the ports tree and base sources, bail out if they don't exist beforehand.
 if [ ! -d ${SRCTREE}/dports/.svn ]; then
-    echo "No dports tree found at ${SRCTREE}. This needs to exist (with proper svn \
+    echo "No ports tree found at ${SRCTREE}. This needs to exist (with proper svn \
         credentials at ${SVN_CONFIG_DIR}) prior to runnig this script." > $FAILURE_LOG; bail
 else
     cd ${SRCTREE}/dports && \
 	svn -q --non-interactive --config-dir $SVN_CONFIG_DIR update > $FAILURE_LOG 2>&1 \
-	|| { echo "Updating the ports tree from $SVN_DPORTS_URL failed." >> $FAILURE_LOG ; bail ; }
+	|| { echo "Updating the ports tree from $SVN_PORTS_URL failed." >> $FAILURE_LOG ; bail ; }
 fi
 if [ ! -d ${SRCTREE}/base/.svn ]; then
     echo "No base sources found at ${SRCTREE}. This needs to exist (with proper svn \

Modified: branches/dp2mp-move/base/portmgr/Makefile
===================================================================
--- trunk/base/portmgr/Makefile	2007-04-22 07:33:59 UTC (rev 24327)
+++ branches/dp2mp-move/base/portmgr/Makefile	2007-04-24 17:28:16 UTC (rev 24454)
@@ -1,4 +1,4 @@
-INSTALLDIR=	${DESTDIR}${datadir}/darwinports/resources/portmgr
+INSTALLDIR=	${DESTDIR}${datadir}/macports/resources/portmgr
 
 SCRIPTS=	PortIndex2MySQL
 
@@ -6,7 +6,7 @@
 	-e 's, at PREFIX\@,$(prefix),g' \
 	-e 's, at TCL_PACKAGE_DIR\@,$(TCL_PACKAGE_DIR),g'
 
-include ../Mk/dports.autoconf.mk
+include ../Mk/macports.autoconf.mk
 
 all: ${SCRIPTS}
 

Deleted: branches/dp2mp-move/base/portmgr/dprsyncup
===================================================================
--- trunk/base/portmgr/dprsyncup	2007-04-22 07:33:59 UTC (rev 24327)
+++ branches/dp2mp-move/base/portmgr/dprsyncup	2007-04-24 17:28:16 UTC (rev 24454)
@@ -1,30 +0,0 @@
-#!/bin/sh
-# fkr, jberry, yeled
-# checks out both HEAD and then the CVS Tag specified in $RELEASE_TAG_FILE
-# made for dulcinea 2005-12-06
-# TODO should clean up after itself.
-# TODO shouldn't refer to the Tag as "dp1.0"
-
-DPROOT="/Volumes/bigsrc/darwinports"
-RELEASE_TAG_FILE="base/config/RELEASE_TAG"
-
-# Check out HEAD
-export HOME=/var/root
-TMPDIR=dp
-cd ${DPROOT} ; cvs -q -R -d /cvs/od co -P -d ${TMPDIR}.tmp darwinports
-rsync -q --exclude=.cvsignore --exclude=CVS -a --delete ${DPROOT}/${TMPDIR}.tmp/ ${DPROOT}/${TMPDIR}/
-#rsync --dry-run --exclude=.cvsignore --exclude=CVS -a --delete ${DPROOT}/${TMPDIR}.tmp/ ${DPROOT}/${TMPDIR}/
-echo `date -u +%s` > ${DPROOT}/${TMPDIR}/TIMESTAMP
-
-# Extract the release tag from HEAD
-read RELEASE_TAG < ${DPROOT}/${TMPDIR}/${RELEASE_TAG_FILE}
-[ -n "${RELEASE_TAG}" ] || ( echo "no RELEASE_TAG specified in cvs HEAD" ; exit 1 )
-
-# Checkout from the release tag specified in HEAD
-export HOME=/var/root
-TMPDIR=dp1.0
-cd ${DPROOT} ; cvs -q -R -d /cvs/od co -r ${RELEASE_TAG} -P -d ${TMPDIR}.tmp darwinports
-rsync -q --exclude=.cvsignore --exclude=CVS -a --delete ${DPROOT}/${TMPDIR}.tmp/ ${DPROOT}/${TMPDIR}/
-#rsync --dry-run --exclude=.cvsignore --exclude=CVS -a --delete ${DPROOT}/${TMPDIR}.tmp/ ${DPROOT}/${TMPDIR}/
-echo `date -u +%s` > ${DPROOT}/${TMPDIR}/TIMESTAMP
-

Modified: branches/dp2mp-move/base/src/Makefile.in
===================================================================
--- trunk/base/src/Makefile.in	2007-04-22 07:33:59 UTC (rev 24327)
+++ branches/dp2mp-move/base/src/Makefile.in	2007-04-24 17:28:16 UTC (rev 24454)
@@ -1,4 +1,4 @@
-TCLPKG=		darwinports1.0 port1.0 package1.0 pextlib1.0 registry1.0 \
+TCLPKG=		macports1.0 port1.0 package1.0 pextlib1.0 registry1.0 \
 			darwintracelib1.0 @OUR_INCLUDED_PACKAGES@
 SUBDIR=		${TCLPKG} port programs
 
@@ -10,4 +10,4 @@
 
 test::
 
-include ../Mk/dports.subdir.mk
+include ../Mk/macports.subdir.mk

Modified: branches/dp2mp-move/base/src/cflib1.0/Makefile
===================================================================
--- trunk/base/src/cflib1.0/Makefile	2007-04-22 07:33:59 UTC (rev 24327)
+++ branches/dp2mp-move/base/src/cflib1.0/Makefile	2007-04-24 17:28:16 UTC (rev 24454)
@@ -1,7 +1,7 @@
 OBJS=		CFLib.o
 SHLIB_NAME=	CFLib${SHLIB_SUFFIX}
 LIBS+=		-framework CoreFoundation
-INSTALLDIR= ${DESTDIR}${datadir}/darwinports/Tcl/cflib1.0
+INSTALLDIR= ${DESTDIR}${datadir}/macports/Tcl/cflib1.0
 
-include ../../Mk/dports.autoconf.mk
-include ../../Mk/dports.tea.mk
+include ../../Mk/macports.autoconf.mk
+include ../../Mk/macports.tea.mk

Modified: branches/dp2mp-move/base/src/darwintracelib1.0/Makefile
===================================================================
--- trunk/base/src/darwintracelib1.0/Makefile	2007-04-22 07:33:59 UTC (rev 24327)
+++ branches/dp2mp-move/base/src/darwintracelib1.0/Makefile	2007-04-24 17:28:16 UTC (rev 24454)
@@ -1,8 +1,8 @@
 OBJS=		darwintrace.o
 SHLIB_NAME=	darwintrace${SHLIB_SUFFIX}
-INSTALLDIR= ${DESTDIR}${datadir}/darwinports/Tcl/darwintrace1.0
+INSTALLDIR= ${DESTDIR}${datadir}/macports/Tcl/darwintrace1.0
 
 test::
 
-include ../../Mk/dports.autoconf.mk
-include ../../Mk/dports.tea.mk
+include ../../Mk/macports.autoconf.mk
+include ../../Mk/macports.tea.mk

Copied: branches/dp2mp-move/base/src/macports1.0 (from rev 24452, trunk/base/src/darwinports1.0)

Modified: branches/dp2mp-move/base/src/macports1.0/Makefile
===================================================================
--- trunk/base/src/darwinports1.0/Makefile	2007-04-24 17:02:07 UTC (rev 24452)
+++ branches/dp2mp-move/base/src/macports1.0/Makefile	2007-04-24 17:28:16 UTC (rev 24454)
@@ -1,20 +1,19 @@
-SRCS=		darwinports.tcl darwinports_dlist.tcl darwinports_autoconf.tcl \
-		darwinports_index.tcl darwinports_fastload.tcl
-OBJS=		darwinports.o portconf.o session.o util.o
-SHLIB_NAME=	Darwinports${SHLIB_SUFFIX}
+SRCS=		macports.tcl macports_dlist.tcl macports_autoconf.tcl \
+		macports_index.tcl macports_fastload.tcl
+OBJS=		macports.o portconf.o session.o util.o
+SHLIB_NAME=	MacPorts${SHLIB_SUFFIX}
 
-INSTALLDIR=	${DESTDIR}${TCL_PACKAGE_DIR}/darwinports1.0
-DARWIN_OLD_PKGINDEX=	${DESTDIR}${TCL_PACKAGE_DIR}/8.3/darwinports1.0/pkgIndex.tcl
+INSTALLDIR=	${DESTDIR}${TCL_PACKAGE_DIR}/macports1.0
 
 ifneq ($(MAKECMDGOALS),distclean)
-include ../../Mk/dports.autoconf.mk
+include ../../Mk/macports.autoconf.mk
 endif
-include ../../Mk/dports.tea.mk
+include ../../Mk/macports.tea.mk
 
 test::
 
 distclean:: clean
-	rm -f darwinports_autoconf.tcl darwinports_fastload.tcl Darwinports.dylib
+	rm -f macports_autoconf.tcl macports_fastload.tcl ${SHLIB_NAME}
 
 install::
 	$(INSTALL) -d -o ${DSTUSR} -g ${DSTGRP} -m ${DSTMODE} ${INSTALLDIR}
@@ -23,15 +22,6 @@
 		$(INSTALL) -o ${DSTUSR} -g ${DSTGRP} -m 444 $$file ${INSTALLDIR}/$$file; \
 	done
 
-	echo "${TCL_PACKAGE_DIR}" > ${DESTDIR}${prefix}/var/db/dports/.tclpackage
+	echo "${TCL_PACKAGE_DIR}" > ${DESTDIR}${prefix}/var/macports/.tclpackage
 
 	$(SILENT) $(TCLSH) ../pkg_mkindex.tcl ${INSTALLDIR}
-# XXX Prior installations of dports on Darwin installed darwinports1.0 
-# in a version-specific Tcl path
-	$(SILENT) echo "/System/Library/Tcl" | grep "^/System/Library/Tcl" >/dev/null; \
-	    if test $$? -eq 0; then \
-		if test -f ${DARWIN_OLD_PKGINDEX}; then \
-			set -x; \
-			rm ${DARWIN_OLD_PKGINDEX}; \
-		fi \
-	    fi

Deleted: branches/dp2mp-move/base/src/macports1.0/darwinports.c
===================================================================
--- trunk/base/src/darwinports1.0/darwinports.c	2007-04-24 17:02:07 UTC (rev 24452)
+++ branches/dp2mp-move/base/src/macports1.0/darwinports.c	2007-04-24 17:28:16 UTC (rev 24454)
@@ -1,46 +0,0 @@
-/*
- * darwinports.c
- * $Id$
- *
- * Copyright (c) 2003 Apple Computer, Inc.
- * 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 Apple Computer, 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
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#if HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <tcl.h>
-
-int darwinports_Init(Tcl_Interp *interp)
-{
-	if(Tcl_InitStubs(interp, "8.3", 0) == NULL)
-		return TCL_ERROR;
-	if(Tcl_PkgProvide(interp, "darwinports", "1.0") != TCL_OK)
-		return TCL_ERROR;
-	return TCL_OK;
-}

Deleted: branches/dp2mp-move/base/src/macports1.0/darwinports.h
===================================================================
--- trunk/base/src/darwinports1.0/darwinports.h	2007-04-24 17:02:07 UTC (rev 24452)
+++ branches/dp2mp-move/base/src/macports1.0/darwinports.h	2007-04-24 17:28:16 UTC (rev 24454)
@@ -1,60 +0,0 @@
-/*
- * darwinports.h
- * $Id$
- *
- * Copyright (c) 2003 Apple Computer, Inc.
- * 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 Apple Computer, 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
- * 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.
- */
-
-#ifndef __DARWINPORTS_H__
-#define __DARWINPORTS_H__
-
-typedef void* dp_session_t;
-typedef void* dp_software_t;
-
-typedef void* dp_array_t;
-dp_array_t dp_array_create();
-dp_array_t dp_array_create_copy(dp_array_t a);
-dp_array_t dp_array_retain(dp_array_t a);
-void dp_array_release(dp_array_t a);
-void dp_array_append(dp_array_t a, const void* data);
-int dp_array_get_count(dp_array_t a);
-const void* dp_array_get_index(dp_array_t a, int index);
-/* something for delete */
-
-dp_session_t dp_session_open();
-int dp_session_sync_index();
-
-int dp_software_search(dp_session_t dp, const char* regexp, dp_software_t* out_matches, int* out_count);
-dp_software_t dp_software_open_portfile(dp_session_t dp, const char* path, const char** options);
-dp_session_t dp_software_get_session(dp_software_t sw);
-dp_software_t dp_software_exec(dp_software_t sw, const char* target);
-int dp_softare_close(dp_software_t sw);
-
-int dp_session_close();
-
-#endif /* __DARWINPORTS_H__ */

Deleted: branches/dp2mp-move/base/src/macports1.0/darwinports.tcl
===================================================================
--- trunk/base/src/darwinports1.0/darwinports.tcl	2007-04-24 17:02:07 UTC (rev 24452)
+++ branches/dp2mp-move/base/src/macports1.0/darwinports.tcl	2007-04-24 17:28:16 UTC (rev 24454)
@@ -1,1764 +0,0 @@
-# darwinports.tcl
-# $Id$
-#
-# Copyright (c) 2002 Apple Computer, Inc.
-# Copyright (c) 2004 - 2005 Paul Guyot, <pguyot at kallisys.net>.
-# Copyright (c) 2004 - 2006 Ole Guldberg Jensen <olegb at opendarwin.org>.
-# Copyright (c) 2004 - 2005 Robert Shaw <rshaw at opendarwin.org>
-# 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 Apple Computer, 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
-# 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 darwinports 1.0
-package require darwinports_dlist 1.0
-package require darwinports_index 1.0
-
-namespace eval darwinports {
-    namespace export bootstrap_options user_options portinterp_options open_dports ui_priorities
-    variable bootstrap_options "\
-    	portdbpath libpath binpath auto_path extra_env sources_conf prefix portdbformat \
-    	portinstalltype portarchivemode portarchivepath portarchivetype portautoclean \
-    	porttrace portverbose destroot_umask variants_conf rsync_server rsync_options \
-    	rsync_dir startupitem_type xcodeversion xcodebuildcmd"
-    variable user_options "submitter_name submitter_email submitter_key"
-    variable portinterp_options "\
-    	portdbpath portpath portbuildpath auto_path prefix portsharepath \
-    	registry.path registry.format registry.installtype portarchivemode portarchivepath \
-    	portarchivetype portautoclean porttrace portverbose destroot_umask rsync_server \
-    	rsync_options rsync_dir startupitem_type \
-    	$user_options"
-    
-    # deferred options are only computed when needed.
-    # they are not exported to the trace thread.
-    # they are not exported to the interpreter in system_options array.
-    variable portinterp_deferred_options "xcodeversion xcodebuildcmd"
-	
-    variable open_dports {}
-    
-    variable ui_priorities "debug info msg error warn"
-}
-
-# Provided UI instantiations
-# For standard messages, the following priorities are defined
-#     debug, info, msg, warn, error
-# Clients of the library are expected to provide ui_prefix and ui_channels with
-# the following prototypes.
-#     proc ui_prefix {priority}
-#     proc ui_channels {priority}
-# ui_prefix returns the prefix for the messages, if any.
-# ui_channels returns a list of channels to output the message to, empty for
-#     no message.
-
-proc darwinports::ui_init {priority message} {
-	# Get the list of channels.
-	set channels [ui_channels $priority]
-
-	# Simplify ui_$priority.
-	set nbchans [llength $channels]
-	if {$nbchans == 0} {
-		eval "proc ::ui_$priority {str} {}"
-	} else {
-		set prefix [ui_prefix $priority]
-
-		if {$nbchans == 1} {
-			set chan [lindex $channels 0]
-			eval "proc ::ui_$priority {str} \{ puts $chan \"$prefix\$str\" \}"
-		} else {
-			eval "proc ::ui_$priority {str} \{ \n\
-				foreach chan $channels \{ \n\
-					puts $chan \"$prefix\$str\" \n\
-				\} \n\
-			\}"
-		}
-
-		# Call ui_$priority
-		::ui_$priority $message
-	}
-}
-
-foreach priority ${darwinports::ui_priorities} {
-    eval "proc ui_$priority {str} \{ darwinports::ui_init $priority \$str \}"
-}
-
-# Replace puts to catch errors (typically broken pipes when being piped to head)
-rename puts tcl::puts
-proc puts {args} {
-	catch "tcl::puts $args"
-}
-
-# check for a binary in the path
-# returns an error code if it can not be found
-# copied from portutil.tcl
-proc darwinports::binaryInPath {binary} {
-    global env
-    foreach dir [split $env(PATH) :] { 
-	if {[file executable [file join $dir $binary]]} {
-	    return [file join $dir $binary]
-	}
-    }
-    
-    return -code error [format [msgcat::mc "Failed to locate '%s' in path: '%s'"] $binary $env(PATH)];
-}
-
-# deferred option processing
-proc darwinports::getoption {name} {
-	global darwinports::$name
-	return [expr $$name]
-}
-
-# deferred and on-need extraction of xcodeversion and xcodebuildcmd.
-proc darwinports::setxcodeinfo {name1 name2 op} {
-	global darwinports::xcodeversion
-	global darwinports::xcodebuildcmd
-	
-	trace remove variable darwinports::xcodeversion read darwinports::setxcodeinfo
-	trace remove variable darwinports::xcodebuildcmd read darwinports::setxcodeinfo
-
-	if {[catch {set xcodebuild [binaryInPath "xcodebuild"]}] == 0} {
-		if {![info exists xcodeversion]} {
-			# Determine xcode version (<= 2.0 or 2.1)
-			if {[catch {set xcodebuildversion [exec xcodebuild -version]}] == 0} {
-				if {[regexp "DevToolsCore-(.*); DevToolsSupport-(.*)" $xcodebuildversion devtoolscore_v devtoolssupport_v] == 1} {
-					if {$devtoolscore_v >= 620.0 && $devtoolssupport_v >= 610.0} {
-						# for now, we don't need to distinguish 2.1 from 2.1 or higher.
-						set darwinports::xcodeversion "2.1"
-					} else {
-						set darwinports::xcodeversion "2.0orlower"
-					}
-				} else {
-					set darwinports::xcodeversion "2.0orlower"
-				}
-			} else {
-				set darwinports::xcodeversion "2.0orlower"
-			}
-		}
-		
-		if {![info exists xcodebuildcmd]} {
-			set darwinports::xcodebuildcmd "xcodebuild"
-		}
-	} elseif {[catch {set pbxbuild [binaryInPath "pbxbuild"]}] == 0} {
-		if {![info exists xcodeversion]} {
-			set darwinports::xcodeversion "pb"
-		}
-		if {![info exists xcodebuildcmd]} {
-			set darwinports::xcodebuildcmd "pbxbuild"
-		}
-	} else {
-		if {![info exists xcodeversion]} {
-			set darwinports::xcodeversion "none"
-		}
-		if {![info exists xcodebuildcmd]} {
-			set darwinports::xcodebuildcmd "none"
-		}
-	}
-}
-
-proc dportinit {up_ui_options up_options up_variations} {
-	upvar  $up_ui_options ui_options
-	upvar  $up_options	  options
-	upvar  $up_variations variations
-	
-	global auto_path env
-	global darwinports::autoconf::dports_conf_path
-	global darwinports::bootstrap_options
-	global darwinports::user_options
-	global darwinports::extra_env
-	global darwinports::portconf
-	global darwinports::portdbpath
-	global darwinports::portsharepath
-	global darwinports::registry.format
-	global darwinports::registry.path
-	global darwinports::sources
-	global darwinports::sources_conf
-	global darwinports::startupitem_type
-   	global darwinports::destroot_umask
-   	global darwinports::libpath
-   	global darwinports::prefix
-   	global darwinports::registry.installtype
-   	global darwinports::rsync_dir
-   	global darwinports::rsync_options
-   	global darwinports::rsync_server
-   	global darwinports::variants_conf
-   	global darwinports::xcodebuildcmd
-   	global darwinports::xcodeversion
-   	
-   	# Configure the search path for configuration files
-   	set conf_files ""
-    if {[llength [array names env PORTSRC]] > 0} {
-		set PORTSRC [lindex [array get env PORTSRC] 1]
-		lappend conf_files ${PORTSRC}
-    }
-    lappend conf_files "~/.macports/ports.conf" "${dports_conf_path}/ports.conf"
-    
-    # Process the first configuration file we find on conf_files list
-	foreach file $conf_files {
-		if [file exists $file] {
-			set portconf $file
-			set fd [open $file r]
-			while {[gets $fd line] >= 0} {
-				if {[regexp {^(\w+)([ \t]+(.*))?$} $line match option ignore val] == 1} {
-					if {[regexp {^"(.*)"[ \t]*$} $val match val2] == 1} {
-						# Nasty hack for malformed rsync_options in ports.conf
-						set val $val2
-					}
-					if {[lsearch $bootstrap_options $option] >= 0} {
-						set darwinports::$option $val
-						global darwinports::$option
-					}
-				}
-			}
-			
-			break
-		}
-	}
-	
-	# Process per-user only settings
-	set per_user "~/.macports/user.conf"
-	if [file exists $per_user] {
-		set fd [open $per_user r]
-		while {[gets $fd line] >= 0} {
-			if {[regexp {^(\w+)([ \t]+(.*))?$} $line match option ignore val] == 1} {
-				if {[lsearch $user_options $option] >= 0} {
-					set darwinports::$option $val
-					global darwinports::$option
-				}
-			}
-		}
-	}
-	
-    if {![info exists sources_conf]} {
-        return -code error "sources_conf must be set in $dports_conf_path/ports.conf or in your ~/.portsrc"
-    }
-    if {[catch {set fd [open $sources_conf r]} result]} {
-        return -code error "$result"
-    }
-    while {[gets $fd line] >= 0} {
-        set line [string trimright $line]
-        if {![regexp {[\ \t]*#.*|^$} $line]} {
-            lappend sources $line
-	}
-    }
-    if {![info exists sources]} {
-	if {[file isdirectory dports]} {
-	    set sources "file://[pwd]/dports"
-	} else {
-	    return -code error "No sources defined in $sources_conf"
-	}
-    }
-
-	if {[info exists variants_conf]} {
-		if {[file exist $variants_conf]} {
-			if {[catch {set fd [open $variants_conf r]} result]} {
-				return -code error "$result"
-			}
-			while {[gets $fd line] >= 0} {
-				set line [string trimright $line]
-				if {![regexp {^[\ \t]*#.*$|^$} $line]} {
-					foreach arg [split $line " \t"] {
-						if {[regexp {^([-+])([-A-Za-z0-9_+\.]+)$} $arg match sign opt] == 1} {
-							if {![info exists variations($opt)]} {
-								set variations($opt) $sign
-							}
-						} else {
-							ui_warn "$variants_conf specifies invalid variant syntax '$arg', ignored."
-						}
-					}
-				}
-			}
-		} else {
-			ui_debug "$variants_conf does not exist, variants_conf setting ignored."
-		}
-	}
-
-    if {![info exists portdbpath]} {
-	return -code error "portdbpath must be set in $dports_conf_path/ports.conf or in your ~/.portsrc"
-    }
-    if {![file isdirectory $portdbpath]} {
-	if {![file exists $portdbpath]} {
-	    if {[catch {file mkdir $portdbpath} result]} {
-		return -code error "portdbpath $portdbpath does not exist and could not be created: $result"
-	    }
-	}
-    }
-    if {![file isdirectory $portdbpath]} {
-	return -code error "$portdbpath is not a directory. Please create the directory $portdbpath and try again"
-    }
-
-    set registry.path $portdbpath
-    if {![file isdirectory ${registry.path}]} {
-	if {![file exists ${registry.path}]} {
-	    if {[catch {file mkdir ${registry.path}} result]} {
-		return -code error "portdbpath ${registry.path} does not exist and could not be created: $result"
-	    }
-	}
-    }
-    if {![file isdirectory ${darwinports::registry.path}]} {
-	return -code error "${darwinports::registry.path} is not a directory. Please create the directory $portdbpath and try again"
-    }
-
-	# Format for receipts, can currently be either "flat" or "sqlite"
-	if {[info exists portdbformat]} {
-		if { $portdbformat == "sqlite" } {
-			return -code error "SQLite is not yet supported for registry storage."
-		} 
-		set registry.format receipt_${portdbformat}
-	} else {
-		set registry.format receipt_flat
-	}
-
-	# Installation type, whether to use port "images" or install "direct"
-	if {[info exists portinstalltype]} {
-		set registry.installtype $portinstalltype
-	} else {
-		set registry.installtype image
-	}
-    
-	# Autoclean mode, whether to automatically call clean after "install"
-	if {![info exists portautoclean]} {
-		set darwinports::portautoclean "yes"
-		global darwinports::portautoclean
-	}
-	# Check command line override for autoclean
-	if {[info exists options(ports_autoclean)]} {
-		if {![string equal $options(ports_autoclean) $portautoclean]} {
-			set darwinports::portautoclean $options(ports_autoclean)
-		}
-	}
-	# Trace mode, whether to use darwintrace to debug ports.
-	if {![info exists porttrace]} {
-		set darwinports::porttrace "no"
-		global darwinports::porttrace
-	}
-	# Check command line override for trace
-	if {[info exists options(ports_trace)]} {
-		if {![string equal $options(ports_trace) $porttrace]} {
-			set darwinports::porttrace $options(ports_trace)
-		}
-	}
-
-	# Export verbosity.
-	if {![info exists portverbose]} {
-		set darwinports::portverbose "no"
-		global darwinports::portverbose
-	}
-	if {[info exists ui_options(ports_verbose)]} {
-		if {![string equal $ui_options(ports_verbose) $portverbose]} {
-			set darwinports::portverbose $ui_options(ports_verbose)
-		}
-	}
-
-	# Archive mode, whether to create/use binary archive packages
-	if {![info exists portarchivemode]} {
-		set darwinports::portarchivemode "yes"
-		global darwinports::portarchivemode
-	}
-
-	# Archive path, where to store/retrieve binary archive packages
-	if {![info exists portarchivepath]} {
-		set darwinports::portarchivepath [file join $portdbpath packages]
-		global darwinports::portarchivepath
-	}
-	if {$portarchivemode == "yes"} {
-		if {![file isdirectory $portarchivepath]} {
-			if {![file exists $portarchivepath]} {
-				if {[catch {file mkdir $portarchivepath} result]} {
-					return -code error "portarchivepath $portarchivepath does not exist and could not be created: $result"
-				}
-			}
-		}
-		if {![file isdirectory $portarchivepath]} {
-			return -code error "$portarchivepath is not a directory. Please create the directory $portarchivepath and try again"
-		}
-	}
-
-	# Archive type, what type of binary archive to use (CPIO, gzipped
-	# CPIO, XAR, etc.)
-	if {![info exists portarchivetype]} {
-		set darwinports::portarchivetype "cpgz"
-		global darwinports::portarchivetype
-	}
-	# Convert archive type to a list for multi-archive support, colon or
-	# comma separators indicates to use multiple archive formats
-	# (reading and writing)
-	set darwinports::portarchivetype [split $portarchivetype {:,}]
-
-	# Set rync options
-	if {![info exists rsync_server]} {
-		set darwinports::rsync_server rsync.darwinports.org
-		global darwinports::rsync_server
-	}
-	if {![info exists rsync_dir]} {
-		set darwinports::rsync_dir dpupdate1/base/
-		global darwinports::rsync_dir
-	}
-	if {![info exists rsync_options]} {
-		set rsync_options "-rtzv --delete --delete-after"
-		global darwinports::rsync_options
-	}
-
-    set portsharepath ${prefix}/share/darwinports
-    if {![file isdirectory $portsharepath]} {
-	return -code error "Data files directory '$portsharepath' must exist"
-    }
-    
-    if {![info exists libpath]} {
-	set libpath "${prefix}/share/darwinports/Tcl"
-    }
-
-    if {![info exists binpath]} {
-	set env(PATH) "${prefix}/bin:${prefix}/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin"
-    } else {
-	set env(PATH) "$binpath"
-    }
-    
-    # Set startupitem default type (can be overridden by portfile)
-    if {![info exists startupitem_type]} {
-    	set darwinports::startupitem_type "default"
-    	global darwinports::startupitem_type
-    }
-    
-    # ENV cleanup.
-	set keepenvkeys { DISPLAY DYLD_FALLBACK_FRAMEWORK_PATH
-	                  DYLD_FALLBACK_LIBRARY_PATH DYLD_FRAMEWORK_PATH
-	                  DYLD_LIBRARY_PATH DYLD_INSERT_LIBRARIES
-	                  HOME JAVA_HOME LD_PREBIND
-	                  LD_PREBIND_ALLOW_OVERLAP MASTER_SITE_LOCAL
-	                  PATCH_SITE_LOCAL PATH PORTSRC RSYNC_PROXY TMP TMPDIR
-	                  USER GROUP
-	                  http_proxy HTTPS_PROXY FTP_PROXY ALL_PROXY NO_PROXY
-					}
-    if {[info exists extra_env]} {
-    	set keepenvkeys [concat ${keepenvkeys} ${extra_env}]
-    }
-	
-	foreach envkey [array names env] {
-		if {[lsearch $keepenvkeys $envkey] == -1} {
-			array unset env $envkey
-		}
-	}
-
-	if {![info exists xcodeversion] || ![info exists xcodebuildcmd]} {
-		# We'll resolve these later (if needed)
-		trace add variable darwinports::xcodeversion read darwinports::setxcodeinfo
-		trace add variable darwinports::xcodebuildcmd read darwinports::setxcodeinfo
-	}
-
-    # Set the default umask
-    if {![info exists destroot_umask]} {
-        set destroot_umask 022
-    }
-
-    if {[info exists master_site_local] && ![info exists env(MASTER_SITE_LOCAL)]} {
-	set env(MASTER_SITE_LOCAL) "$master_site_local"
-    }
-
-	# Prebinding. useful with MacOS X's ld, harmless elsewhere.
-	# With both variables, prebinding will always succeed but we might need
-	# to redo it.
-    if {![info exists env(LD_PREBIND)] && ![info exists env(LD_PREBIND_ALLOW_OVERLAP)]} {
-	set env(LD_PREBIND) "1"
-	set env(LD_PREBIND_ALLOW_OVERLAP) "1"
-    }
-
-    if {[file isdirectory $libpath]} {
-		lappend auto_path $libpath
-		set darwinports::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 darwinports1.0 API?
-		package require Pextlib 1.0
-		package require registry 1.0
-    } else {
-		return -code error "Library directory '$libpath' must exist"
-    }
-}
-
-proc darwinports::worker_init {workername portpath portbuildpath options variations} {
-    global darwinports::portinterp_options darwinports::portinterp_deferred_options registry.installtype
-
-	# Tell the sub interpreter about all the Tcl packages we already
-	# know about so it won't glob for packages.
-	foreach pkgName [package names] {
-		foreach pkgVers [package versions $pkgName] {
-			set pkgLoadScript [package ifneeded $pkgName $pkgVers]
-			$workername eval "package ifneeded $pkgName $pkgVers {$pkgLoadScript}"
-		}
-	}
-
-    # Create package require abstraction procedure
-    $workername eval "proc PortSystem \{version\} \{ \n\
-			package require port \$version \}"
-
-    # Clearly separate slave interpreters and the master interpreter.
-	$workername alias dport_exec dportexec
-	$workername alias dport_open dportopen
-	$workername alias dport_close dportclose
-	$workername alias dport_search dportsearch
-
-    # instantiate the UI call-backs
-	foreach priority ${darwinports::ui_priorities} {
-		$workername alias ui_$priority ui_$priority
-	}
-	$workername alias ui_prefix ui_prefix
-	$workername alias ui_channels ui_channels
-    
-    # Export some utility functions defined here.
-    $workername alias darwinports_create_thread darwinports::create_thread
-
-	# New Registry/Receipts stuff
-	$workername alias registry_new registry::new_entry
-	$workername alias registry_open registry::open_entry
-	$workername alias registry_write registry::write_entry
-	$workername alias registry_prop_store registry::property_store
-	$workername alias registry_prop_retr registry::property_retrieve
-	$workername alias registry_delete registry::delete_entry
-	$workername alias registry_exists registry::entry_exists
-	$workername alias registry_activate portimage::activate
-	$workername alias registry_deactivate portimage::deactivate
-	$workername alias registry_register_deps registry::register_dependencies
-	$workername alias registry_fileinfo_for_index registry::fileinfo_for_index
-	$workername alias registry_bulk_register_files registry::register_bulk_files
-	$workername alias registry_installed registry::installed
-	$workername alias registry_active registry::active
-
-	# deferred options processing.
-	$workername alias getoption darwinports::getoption
-
-    foreach opt $portinterp_options {
-		if {![info exists $opt]} {
-		    global darwinports::$opt
-		}
-        if {[info exists $opt]} {
-            $workername eval set system_options($opt) \{[set $opt]\}
-            $workername eval set $opt \{[set $opt]\}
-        }
-    }
-    
-	foreach opt $portinterp_deferred_options {
-		global darwinports::$opt
-		# define the trace hook.
-		$workername eval \
-			"proc trace_$opt {name1 name2 op} { \n\
-				trace remove variable ::$opt read ::trace_$opt \n\
-				global $opt \n\
-				set $opt \[getoption $opt\] \n\
-			}"
-		# next access will actually define the variable.
-		$workername eval "trace add variable ::$opt read ::trace_$opt"
-		# define some value now
-		$workername eval set $opt "?"
-	}		
-
-    foreach {opt val} $options {
-        $workername eval set user_options($opt) $val
-        $workername eval set $opt $val
-    }
-
-    foreach {var val} $variations {
-        $workername eval set variations($var) $val
-    }
-
-    if { [info exists registry.installtype] } {
-	    $workername eval set installtype ${registry.installtype}
-    }
-}
-
-# Create a thread with most configuration options set.
-# The newly created thread is sent portinterp_options vars and knows where to
-# find all packages we know.
-proc darwinports::create_thread {} {
-    package require Thread
-
-    global darwinports::portinterp_options
-
-	# Create the thread.
-	set result [thread::create -preserved {thread::wait}]
-
-	# Tell the thread about all the Tcl packages we already
-	# know about so it won't glob for packages.
-	foreach pkgName [package names] {
-		foreach pkgVers [package versions $pkgName] {
-			set pkgLoadScript [package ifneeded $pkgName $pkgVers]
-			thread::send -async $result "package ifneeded $pkgName $pkgVers {$pkgLoadScript}"
-		}
-	}
-
-	# inherit configuration variables.
-	thread::send -async $result "namespace eval darwinports {}"
-	foreach opt $portinterp_options {
-		if {![info exists $opt]} {
-			global darwinports::$opt
-		}
-        if {[info exists $opt]} {
-			thread::send -async $result "global darwinports::$opt"
-			set val [set darwinports::$opt]
-			thread::send -async $result "set darwinports::$opt \"$val\""
-		}
-	}
-	
-	return $result
-}
-
-proc darwinports::fetch_port {url} {
-    global darwinports::portdbpath tcl_platform
-    set fetchdir [file join $portdbpath portdirs]
-    set fetchfile [file tail $url]
-    if {[catch {file mkdir $fetchdir} result]} {
-        return -code error $result
-    }
-    if {![file writable $fetchdir]} {
-    	return -code error "Port remote fetch failed: You do not have permission to write to $fetchdir"
-    }
-    if {[catch {exec curl -L -s -S -o [file join $fetchdir $fetchfile] $url} result]} {
-        return -code error "Port remote fetch failed: $result"
-    }
-    if {[catch {cd $fetchdir} result]} {
-	return -code error $result
-    }
-    if {[catch {exec tar -zxf $fetchfile} result]} {
-	return -code error "Port extract failed: $result"
-    }
-    if {[regexp {(.+).tgz} $fetchfile match portdir] != 1} {
-        return -code error "Can't decipher portdir from $fetchfile"
-    }
-    return [file join $fetchdir $portdir]
-}
-
-proc darwinports::getprotocol {url} {
-    if {[regexp {(?x)([^:]+)://.+} $url match protocol] == 1} {
-        return ${protocol}
-    } else {
-        return -code error "Can't parse url $url"
-    }
-}
-
-# XXX: this really needs to be rethought in light of the remote index
-# I've added the destdir parameter.  This is the location a remotely
-# fetched port will be downloaded to (currently only applies to
-# dports:// sources).
-proc darwinports::getportdir {url {destdir "."}} {
-	if {[regexp {(?x)([^:]+)://(.+)} $url match protocol string] == 1} {
-		switch -regexp -- ${protocol} {
-			{^file$} {
-				return $string
-			}
-			{^dports$} {
-				return [darwinports::index::fetch_port $url $destdir]
-			}
-			{^https?$|^ftp$} {
-				return [darwinports::fetch_port $url]
-			}
-			default {
-				return -code error "Unsupported protocol $protocol"
-			}
-		}
-	} else {
-		return -code error "Can't parse url $url"
-	}
-}
-
-# dportopen
-# Opens a DarwinPorts portfile specified by a URL.  The portfile is
-# opened with the given list of options and variations.  The result
-# of this function should be treated as an opaque handle to a
-# DarwinPorts Portfile.
-
-proc dportopen {porturl {options ""} {variations ""} {nocache ""}} {
-    global darwinports::portdbpath darwinports::portconf darwinports::open_dports auto_path
-
-	# Look for an already-open DPort with the same URL.
-	# XXX: should compare options and variations here too.
-	# if found, return the existing reference and bump the refcount.
-	if {$nocache != ""} {
-		set dport {}
-	} else {
-		set dport [dlist_search $darwinports::open_dports porturl $porturl]
-	}
-	if {$dport != {}} {
-		set refcnt [ditem_key $dport refcnt]
-		incr refcnt
-		ditem_key $dport refcnt $refcnt
-		return $dport
-	}
-
-	array set options_array $options
-	if {[info exists options_array(portdir)]} {
-		set portdir $options_array(portdir)
-	} else {
-		set portdir ""
-	}
-
-	set portdir [darwinports::getportdir $porturl $portdir]
-	ui_debug "Changing to port directory: $portdir"
-	cd $portdir
-	set portpath [pwd]
-    if {![file isfile Portfile]} {
-        return -code error "Could not find Portfile in $portdir"
-    }
-
-	set workername [interp create]
-
-	set dport [ditem_create]
-	lappend darwinports::open_dports $dport
-	ditem_key $dport porturl $porturl
-	ditem_key $dport portpath $portpath
-	ditem_key $dport workername $workername
-	ditem_key $dport options $options
-	ditem_key $dport variations $variations
-	ditem_key $dport refcnt 1
-	
-    darwinports::worker_init $workername $portpath [darwinports::getportbuildpath $portpath] $options $variations
-
-    $workername eval source Portfile
-
-    ditem_key $dport provides [$workername eval return \$portname]
-
-    return $dport
-}
-
-# Traverse a directory with ports, calling a function on the path of ports
-# (at the second depth).
-# I.e. the structure of dir shall be:
-# category/port/
-# with a Portfile file in category/port/
-#
-# func:		function to call on every port directory (it is passed
-#			category/port/ as its parameter)
-# root:		the directory with all the categories directories.
-proc dporttraverse {func {root .}} {
-	# Save the current directory
-	set pwd [pwd]
-	
-	# Join the root.
-	set pathToRoot [file join $pwd $root]
-
-	# Go to root because some callers expects us to be there.
-	cd $pathToRoot
-
-    foreach category [lsort -increasing -unique [readdir $root]] {
-    	set pathToCategory [file join $root $category]
-        if {[file isdirectory $pathToCategory]} {
-        	# Iterate on port directories.
-			foreach port [lsort -increasing -unique [readdir $pathToCategory]] {
-				set pathToPort [file join $pathToCategory $port]
-				if {[file isdirectory $pathToPort] &&
-					[file exists [file join $pathToPort "Portfile"]]} {
-					# Call the function.
-					$func [file join $category $port]
-					
-					# Restore the current directory because some
-					# functions changes it.
-					cd $pathToRoot
-				}
-			}
-        }
-	}
-	
-	# Restore the current directory.
-	cd $pwd
-}
-
-### _dportsearchpath is private; subject to change without notice
-
-# depregex -> regex on the filename to find.
-# search_path -> directories to search
-# executable -> whether we want to check that the file is executable by current
-#				user or not.
-proc _dportsearchpath {depregex search_path {executable 0}} {
-    set found 0
-    foreach path $search_path {
-	if {![file isdirectory $path]} {
-	    continue
-	}
-
-	if {[catch {set filelist [readdir $path]} result]} {
-		return -code error "$result ($path)"
-		set filelist ""
-	}
-
-	foreach filename $filelist {
-	    if {[regexp $depregex $filename] &&
-	    	(($executable == 0) || [file executable [file join $path $filename]])} {
-		ui_debug "Found Dependency: path: $path filename: $filename regex: $depregex"
-		set found 1
-		break
-	    }
-	}
-    }
-    return $found
-}
-
-### _libtest is private; subject to change without notice
-# XXX - Architecture specific
-# XXX - Rely on information from internal defines in cctools/dyld:
-# define DEFAULT_FALLBACK_FRAMEWORK_PATH
-# /Library/Frameworks:/Library/Frameworks:/Network/Library/Frameworks:/System/Library/Frameworks
-# define DEFAULT_FALLBACK_LIBRARY_PATH /lib:/usr/local/lib:/lib:/usr/lib
-#   -- Since /usr/local is bad, using /lib:/usr/lib only.
-# Environment variables DYLD_FRAMEWORK_PATH, DYLD_LIBRARY_PATH,
-# DYLD_FALLBACK_FRAMEWORK_PATH, and DYLD_FALLBACK_LIBRARY_PATH take precedence
-
-proc _libtest {dport depspec} {
-    global env tcl_platform
-	set depline [lindex [split $depspec :] 1]
-	set prefix [_dportkey $dport prefix]
-	
-	if {[info exists env(DYLD_FRAMEWORK_PATH)]} {
-	    lappend search_path $env(DYLD_FRAMEWORK_PATH)
-	} else {
-	    lappend search_path /Library/Frameworks /Network/Library/Frameworks /System/Library/Frameworks
-	}
-	if {[info exists env(DYLD_FALLBACK_FRAMEWORK_PATH)]} {
-	    lappend search_path $env(DYLD_FALLBACK_FRAMEWORK_PATH)
-	}
-	if {[info exists env(DYLD_LIBRARY_PATH)]} {
-	    lappend search_path $env(DYLD_LIBRARY_PATH)
-	}
-	lappend search_path /lib /usr/lib /usr/X11R6/lib ${prefix}/lib
-	if {[info exists env(DYLD_FALLBACK_LIBRARY_PATH)]} {
-	    lappend search_path $env(DYLD_FALLBACK_LIBRARY_PATH)
-	}
-
-	set i [string first . $depline]
-	if {$i < 0} {set i [string length $depline]}
-	set depname [string range $depline 0 [expr $i - 1]]
-	set depversion [string range $depline $i end]
-	regsub {\.} $depversion {\.} depversion
-	if {$tcl_platform(os) == "Darwin"} {
-		set depregex \^${depname}${depversion}\\.dylib\$
-	} else {
-		set depregex \^${depname}\\.so${depversion}\$
-	}
-
-	return [_dportsearchpath $depregex $search_path]
-}
-
-### _bintest is private; subject to change without notice
-
-proc _bintest {dport depspec} {
-    global env
-	set depregex [lindex [split $depspec :] 1]
-	set prefix [_dportkey $dport prefix] 
-	
-	set search_path [split $env(PATH) :]
-	
-	set depregex \^$depregex\$
-	
-	return [_dportsearchpath $depregex $search_path 1]
-}
-
-### _pathtest is private; subject to change without notice
-
-proc _pathtest {dport depspec} {
-    global env
-	set depregex [lindex [split $depspec :] 1]
-	set prefix [_dportkey $dport prefix] 
-    
-	# separate directory from regex
-	set fullname $depregex
-
-	regexp {^(.*)/(.*?)$} "$fullname" match search_path depregex
-
-	if {[string index $search_path 0] != "/"} {
-		# Prepend prefix if not an absolute path
-		set search_path "${prefix}/${search_path}"
-	}
-
-	set depregex \^$depregex\$
-
-	return [_dportsearchpath $depregex $search_path]
-}
-
-### _porttest is private; subject to change without notice
-
-proc _porttest {dport depspec} {
-	# We don't actually look for the port, but just return false
-	# in order to let the dportdepends handle the dependency
-	return 0
-}
-
-### _dportinstalled is private; may change without notice
-
-# Determine if a port is already *installed*, as in "in the registry".
-proc _dportinstalled {dport} {
-	# Check for the presense of the port in the registry
-	set workername [ditem_key $dport workername]
-	set res [$workername eval registry_exists \${portname} \${portversion}]
-	if {$res != 0} {
-		ui_debug "[ditem_key $dport provides] is installed"
-		return 1
-	} else {
-		return 0
-	}
-}
-
-### _dportispresent is private; may change without notice
-
-# Determine if some depspec is satisfied or if the given port is installed.
-# We actually start with the registry (faster?)
-#
-# dport		the port to test (to figure out if it's present)
-# depspec	the dependency test specification (path, bin, lib, etc.)
-proc _dportispresent {dport depspec} {
-	# Check for the presense of the port in the registry
-	set workername [ditem_key $dport workername]
-	ui_debug "Searching for dependency: [ditem_key $dport provides]"
-	if {[catch {set reslist [$workername eval registry_installed \${portname}]} res]} {
-		set res 0
-	} else {
-		set res [llength $reslist]
-	}
-	if {$res != 0} {
-		ui_debug "Found Dependency: receipt exists for [ditem_key $dport provides]"
-		return 1
-	} else {
-		# The receipt test failed, use one of the depspec regex mechanisms
-		ui_debug "Didn't find receipt, going to depspec regex for: [ditem_key $dport provides]"
-		set type [lindex [split $depspec :] 0]
-		switch $type {
-			lib { return [_libtest $dport $depspec] }
-			bin { return [_bintest $dport $depspec] }
-			path { return [_pathtest $dport $depspec] }
-			port { return [_porttest $dport $depspec] }
-			default {return -code error "unknown depspec type: $type"}
-		}
-		return 0
-	}
-}
-
-### _dportexec is private; may change without notice
-
-proc _dportexec {target dport} {
-	# xxx: set the work path?
-	set workername [ditem_key $dport workername]
-	if {![catch {$workername eval eval_variants variations $target} result] && $result == 0 &&
-		![catch {$workername eval eval_targets $target} result] && $result == 0} {
-		# If auto-clean mode, clean-up after dependency install
-		if {[string equal ${darwinports::portautoclean} "yes"]} {
-			# Make sure we are back in the port path before clean
-			# otherwise if the current directory had been changed to
-			# inside the port,  the next port may fail when trying to
-			# install because [pwd] will return a "no file or directory"
-			# error since the directory it was in is now gone.
-			set portpath [ditem_key $dport portpath]
-			catch {cd $portpath}
-			$workername eval eval_targets clean
-		}
-		return 0
-	} else {
-		# An error occurred.
-		return 1
-	}
-}
-
-# dportexec
-# Execute the specified target of the given dport.
-
-proc dportexec {dport target} {
-    global darwinports::registry.installtype
-
-	set workername [ditem_key $dport workername]
-
-	# XXX: move this into dportopen?
-	if {[$workername eval eval_variants variations $target] != 0} {
-		return 1
-	}
-	
-	# Before we build the port, we must build its dependencies.
-	# XXX: need a more general way of comparing against targets
-	set dlist {}
-	if {$target == "package"} {
-		ui_warn "package target replaced by pkg target, please use the pkg target in the future."
-		set target "pkg"
-	}
-	if {$target == "configure" || $target == "build"
-		|| $target == "test"
-		|| $target == "destroot" || $target == "install"
-		|| $target == "archive"
-		|| $target == "pkg" || $target == "mpkg"
-		|| $target == "rpmpackage" || $target == "dpkg" } {
-
-		if {[dportdepends $dport $target] != 0} {
-			return 1
-		}
-		
-		# Select out the dependents along the critical path,
-		# but exclude this dport, we might not be installing it.
-		set dlist [dlist_append_dependents $darwinports::open_dports $dport {}]
-		
-		dlist_delete dlist $dport
-
-		# install them
-		# xxx: as with below, this is ugly.  and deps need to be fixed to
-		# understand Port Images before this can get prettier
-		if { [string equal ${darwinports::registry.installtype} "image"] } {
-			set result [dlist_eval $dlist _dportinstalled [list _dportexec "activate"]]
-		} else {
-			set result [dlist_eval $dlist _dportinstalled [list _dportexec "install"]]
-		}
-		
-		if {$result != {}} {
-			set errstring "The following dependencies failed to build:"
-			foreach ditem $result {
-				append errstring " [ditem_key $ditem provides]"
-			}
-			ui_error $errstring
-			return 1
-		}
-		
-		# Close the dependencies, we're done installing them.
-		foreach ditem $dlist {
-			dportclose $ditem
-		}
-	}
-
-	# If we're doing an install, check if we should clean after
-	set clean 0
-	if {[string equal ${darwinports::portautoclean} "yes"] && [string equal $target "install"] } {
-		set clean 1
-	}
-
-	# If we're doing image installs, then we should activate after install
-	# xxx: This isn't pretty
-	if { [string equal ${darwinports::registry.installtype} "image"] && [string equal $target "install"] } {
-		set target activate
-	}
-	
-	# Build this port with the specified target
-	set result [$workername eval eval_targets $target]
-
-	# If auto-clean mode and successful install, clean-up after install
-	if {$result == 0 && $clean == 1} {
-		# Make sure we are back in the port path, just in case
-		set portpath [ditem_key $dport portpath]
-		catch {cd $portpath}
-		$workername eval eval_targets clean
-	}
-
-	return $result
-}
-
-proc darwinports::getsourcepath {url} {
-	global darwinports::portdbpath
-	regsub {://} $url {.} source_path
-	regsub -all {/} $source_path {_} source_path
-	return [file join $portdbpath sources $source_path]
-}
-
-proc darwinports::getportbuildpath {id} {
-	global darwinports::portdbpath
-	regsub {://} $id {.} port_path
-	regsub -all {/} $port_path {_} port_path
-	return [file join $portdbpath build $port_path]
-}
-
-proc darwinports::getindex {source} {
-	# Special case file:// sources
-	if {[darwinports::getprotocol $source] == "file"} {
-		return [file join [darwinports::getportdir $source] PortIndex]
-	}
-
-	return [file join [darwinports::getsourcepath $source] PortIndex]
-}
-
-proc dportsync {args} {
-	global darwinports::sources darwinports::portdbpath tcl_platform
-	global darwinports::autoconf::rsync_path
-
-	foreach source $sources {
-		ui_info "Synchronizing from $source"
-		switch -regexp -- [darwinports::getprotocol $source] {
-			{^file$} {
-			    set portdir [darwinports::getportdir $source]
-				if {[file exists $portdir/.svn]} {
-				    if {[catch {set svncmd [darwinports::binaryInPath "svn"]}] == 0} {
-				        set svn_commandline "${svncmd} update --non-interactive \"${portdir}\""
-				        ui_debug $svn_commandline
-				        if {[catch {system $svn_commandline}]} {
-				            return -code error "sync failed doing svn update"
-				        }
-				        if {[catch {system "chmod -R a+r \"${portdir}\""}]} {
-				            ui_warn "Setting world read permissions on parts of the ports tree failed, need root?"
-				        }
-				    } else {
-				        return -code error "svn command not found"
-				    }
-				}
-			}
-			{^dports$} {
-				darwinports::index::sync $darwinports::portdbpath $source
-			}
-			{^rsync$} {
-				# Where to, boss?
-				set destdir [file dirname [darwinports::getindex $source]]
-
-				if {[catch {file mkdir $destdir} result]} {
-					return -code error $result
-				}
-
-				# Keep rsync happy with a trailing slash
-				if {[string index $source end] != "/"} {
-					set source "${source}/"
-				}
-
-				# Do rsync fetch
-				if {[catch {system "${darwinports::autoconf::rsync_path} -rtzv --delete-after --delete \"$source\" \"$destdir\""}]} {
-					return -code error "sync failed doing rsync"
-				}
-				if {[catch {system "chmod -R a+r \"$destdir\""}]} {
-				    ui_warn "Setting world read permissions on parts of the ports tree failed, need root?"
-				}
-			}
-			{^https?$|^ftp$} {
-				set indexfile [darwinports::getindex $source]
-				if {[catch {file mkdir [file dirname $indexfile]} result]} {
-					return -code error $result
-				}
-				exec curl -L -s -S -o $indexfile $source/PortIndex
-			}
-		}
-	}
-}
-
-proc dportsearch {pattern {case_sensitive yes} {matchstyle regexp} {field name}} {
-	global darwinports::portdbpath darwinports::sources
-	set matches [list]
-	set easy [expr { $field == "name" }]
-	
-	set found 0
-	foreach source $sources {
-		if {[darwinports::getprotocol $source] == "dports"} {
-			array set attrs [list name $pattern]
-			set res [darwinports::index::search $darwinports::portdbpath $source [array get attrs]]
-			eval lappend matches $res
-		} else {
-			if {[catch {set fd [open [darwinports::getindex $source] r]} result]} {
-				ui_warn "Can't open index file for source: $source"
-			} else {
-				incr found 1
-				while {[gets $fd line] >= 0} {
-					array unset portinfo
-					set name [lindex $line 0]
-					gets $fd line
-					
-					if {$easy} {
-						set target $name
-					} else {
-						array set portinfo $line
-						if {![info exists portinfo($field)]} continue
-						set target $portinfo($field)
-					}
-					
-					switch $matchstyle {
-						exact	{ set matchres [expr 0 == ( {$case_sensitive == "yes"} ? [string compare $pattern $target] : [string compare -nocase $pattern $target] )] }
-						glob	{ set matchres [expr {$case_sensitive == "yes"} ? [string match $pattern $target] : [string match -nocase $pattern $target]] }
-						regexp	-
-						default	{ set matchres [expr {$case_sensitive == "yes"} ? [regexp -- $pattern $target] : [regexp -nocase -- $pattern $target]] }
-					}
-					
-					if {$matchres == 1} {
-						if {$easy} {
-							array set portinfo $line
-						}
-						switch -regexp -- [darwinports::getprotocol ${source}] {
-							{^rsync$} {
-								# Rsync files are local
-								set source_url "file://[darwinports::getsourcepath $source]"
-							}
-							default {
-								set source_url $source
-							}
-						}
-						if {[info exists portinfo(portarchive)]} {
-							set porturl ${source_url}/$portinfo(portarchive)
-						} elseif {[info exists portinfo(portdir)]} {
-							set porturl ${source_url}/$portinfo(portdir)
-						}
-						if {[info exists porturl]} {
-							lappend line porturl $porturl
-							ui_debug "Found port in $porturl"
-						} else {
-							ui_debug "Found port info: $line"
-						}
-						lappend matches $name
-						lappend matches $line
-					}
-				}
-				close $fd
-			}
-		}
-	}
-	if {!$found} {
-		return -code error "No index(es) found! Have you synced your source indexes?"
-	}
-
-	return $matches
-}
-
-proc dportinfo {dport} {
-	set workername [ditem_key $dport workername]
-    return [$workername eval array get PortInfo]
-}
-
-proc dportclose {dport} {
-	global darwinports::open_dports
-	set refcnt [ditem_key $dport refcnt]
-	incr refcnt -1
-	ditem_key $dport refcnt $refcnt
-	if {$refcnt == 0} {
-		dlist_delete darwinports::open_dports $dport
-		set workername [ditem_key $dport workername]
-		interp delete $workername
-	}
-}
-
-##### Private Depspec API #####
-# This API should be considered work in progress and subject to change without notice.
-##### "
-
-# _dportkey
-# - returns a variable from the port's interpreter
-
-proc _dportkey {dport key} {
-	set workername [ditem_key $dport workername]
-	return [$workername eval "return \$${key}"]
-}
-
-# dportdepends builds the list of dports which the given port depends on.
-# This list is added to $dport.
-# This list actually depends on the target.
-# This method can optionally recurse through the dependencies, looking for
-#   dependencies of dependencies.
-# This method can optionally cut the search when ports are already installed or
-#   the dependencies are satisfied.
-#
-# dport -> dport item
-# target -> target to consider the dependency for
-# recurseDeps -> if the search should be recursive
-# skipSatisfied -> cut the search tree when encountering installed/satisfied
-#                  dependencies ports.
-# accDeps -> accumulator for recursive calls
-# return 0 if everything was ok, an non zero integer otherwise.
-proc dportdepends {dport {target ""} {recurseDeps 1} {skipSatisfied 1} {accDeps {}}} {
-
-	array set portinfo [dportinfo $dport]
-	set depends {}
-	set deptypes {}
-		
-	# Determine deptypes to look for based on target
-	switch $target {
-		configure	{ set deptypes "depends_lib" }
-		
-		build		{ set deptypes "depends_lib depends_build" }
-		
-		test		-
-		destroot	-
-		install		-
-		archive		-
-		pkg			-
-		mpkg		-
-		rpmpackage	-
-		dpkg		-
-		""			{ set deptypes "depends_lib depends_build depends_run" }
-	}
-	
-	# Gather the dependencies for deptypes
-	foreach deptype $deptypes {
-		# Add to the list of dependencies if the option exists and isn't empty.
-		if {[info exists portinfo($deptype)] && $portinfo($deptype) != ""} {
-			set depends [concat $depends $portinfo($deptype)]
-		}
-	}
-
-	set subPorts {}
-	
-	foreach depspec $depends {
-		# grab the portname portion of the depspec
-		set dep_portname [lindex [split $depspec :] end]
-		
-		# Find the porturl
-		if {[catch {set res [dportsearch $dep_portname false exact]} error]} {
-			global errorInfo
-			ui_debug "$errorInfo"
-			ui_error "Internal error: port search failed: $error"
-			return 1
-		}
-		foreach {name array} $res {
-			array set portinfo $array
-			if {[info exists portinfo(porturl)]} {
-				set porturl $portinfo(porturl)
-				break
-			}
-		}
-
-		if {![info exists porturl]} {
-			ui_error "Dependency '$dep_portname' not found."
-			return 1
-		}
-
-		set options [ditem_key $dport options]
-		set variations [ditem_key $dport variations]
-
-		# Figure out the subport.	
-		set subport [dportopen $porturl $options $variations]
-
-		# Is that dependency satisfied or this port installed?
-		# If we don't skip or if it is not, add it to the list.
-		if {!$skipSatisfied || ![_dportispresent $subport $depspec]} {
-			# Append the sub-port's provides to the port's requirements list.
-			ditem_append_unique $dport requires "[ditem_key $subport provides]"
-	
-			if {$recurseDeps} {
-				# Skip the port if it's already in the accumulated list.
-				if {[lsearch $accDeps $dep_portname] == -1} {
-					# Add it to the list
-					lappend accDeps $dep_portname
-				
-					# We'll recursively iterate on it.
-					lappend subPorts $subport
-				}
-			}
-		}
-	}
-
-	# Loop on the subports.
-	if {$recurseDeps} {
-		foreach subport $subPorts {
-			# Sub ports should be installed (all dependencies must be satisfied).
-			set res [dportdepends $subport "" $recurseDeps $skipSatisfied $accDeps]
-			if {$res != 0} {
-				return $res
-			}
-		}
-	}
-	
-	return 0
-}
-
-# selfupdate procedure
-proc darwinports::selfupdate {optionslist} {
-	global darwinports::prefix darwinports::rsync_server darwinports::rsync_dir darwinports::rsync_options
-	global darwinports::autoconf::rsync_path
-	array set options $optionslist
-	
-	if { [info exists options(ports_force)] && $options(ports_force) == "yes" } {
-		set use_the_force_luke yes
-		ui_debug "Forcing a rebuild of the MacPorts base system."
-	} else {
-		set use_the_force_luke no
-		ui_debug "Rebuilding the MacPorts base system if needed."
-	}
-	# syncing ports tree. We expect the user have rsync:// in the sources.conf
-	if {[catch {dportsync} result]} {
-		return -code error "Couldn't sync dports tree: $result"
-	}
-
-	set dp_base_path [file join $prefix var/db/dports/sources/rsync.${rsync_server}_${rsync_dir}/]
-	if {![file exists $dp_base_path]} {
-		file mkdir $dp_base_path
-	}
-	ui_debug "MacPorts base dir: $dp_base_path"
-
-	# get user of the darwinports system
-	set user [file attributes [file join $prefix var/db/dports/sources/] -owner]
-	ui_debug "Setting user: $user"
-
-	# get darwinports version 
-	set dp_version_path [file join ${prefix}/etc/ports/ dp_version]
-	if { [file exists $dp_version_path]} {
-		set fd [open $dp_version_path r]
-		gets $fd dp_version_old
-		close $fd
-	} else {
-		set dp_version_old 0
-	}
-	ui_msg "DarwinPorts base version $dp_version_old installed"
-
-	ui_debug "Updating using rsync"
-	if { [catch { system "${darwinports::autoconf::rsync_path} $rsync_options rsync://${rsync_server}/${rsync_dir} $dp_base_path" } ] } {
-		return -code error "Error: rsync failed in selfupdate"
-	}
-
-	# get downloaded darwinports version and write the old version back
-	set fd [open [file join $dp_base_path config/dp_version] r]
-	gets $fd dp_version_new
-	close $fd
-	ui_msg "Downloaded MacPorts base version $dp_version_new"
-
-	# check if we we need to rebuild base
-	if {$dp_version_new > $dp_version_old || $use_the_force_luke == "yes"} {
-		ui_msg "Configuring, Building and Installing new MacPorts base"
-		# check if $prefix/bin/port is writable, if so we go !
-		# get installation user / group 
-		set owner root
-		set group admin
-		if {[file exists [file join $prefix bin/port] ]} {
-			# set owner
-			set owner [file attributes [file join $prefix bin/port] -owner]
-			# set group
-			set group [file attributes [file join $prefix bin/port] -group]
-		}
-		set p_user [exec /usr/bin/whoami]
-		if {[file writable ${prefix}/bin/port] || [string equal $p_user $owner] } {
-			ui_debug "permissions OK"
-		} else {
-			return -code error "Error: $p_user cannot write to ${prefix}/bin - try using sudo"
-		}
-		ui_debug "Setting owner: $owner group: $group"
-
-		set dp_tclpackage_path [file join $prefix var/db/dports/ .tclpackage]
-		if { [file exists $dp_tclpackage_path]} {
-			set fd [open $dp_tclpackage_path r]
-			gets $fd tclpackage
-			close $fd
-		} else {
-			set tclpackage [file join ${prefix} share/darwinports/Tcl]
-		}
-		# do the actual installation of new base
-		ui_debug "Install in: $prefix as $owner : $group - TCL-PACKAGE in $tclpackage"
-		if { [catch { system "cd $dp_base_path && ./configure --prefix=$prefix --with-install-user=$owner --with-install-group=$group --with-tclpackage=$tclpackage && make && make install" } result] } {
-			return -code error "Error installing new MacPorts base: $result"
-		}
-	} else {
-		ui_msg "The MacPorts installation is not outdated and so was not updated"
-	}
-
-	# set the darwinports system to the right owner 
-	ui_debug "Setting ownership to $user"
-	if { [catch { exec chown -R $user [file join $prefix var/db/dports/sources/] } result] } {
-		return -code error "Couldn't change permissions: $result"
-	}
-
-	# set the right version
-	ui_msg "selfupdate done!"
-
-	return 0
-}
-
-proc darwinports::version {} {
-	global darwinports::prefix darwinports::rsync_server darwinports::rsync_dir
-	
-	set dp_version_path [file join $prefix etc/ports/ dp_version]
-
-	if [file exists $dp_version_path] {
-		set fd [open $dp_version_path r]
-		gets $fd retval
-		return $retval
-	} else {
-		return -1
-	}
-}
-
-# upgrade procedure
-proc darwinports::upgrade {portname dspec variationslist optionslist {depscachename ""}} {
-	global darwinports::registry.installtype
-	global darwinports::portarchivemode
-	array set options $optionslist
-	array set variations $variationslist
-	if {![string match "" $depscachename]} {
-		upvar $depscachename depscache
-	} 
-
-	# set to no-zero is epoch overrides version
-	set epoch_override 0
-
-	# check if the port is in tree
-	if {[catch {dportsearch $portname false exact} result]} {
-		global errorInfo
-		ui_debug "$errorInfo"
-		ui_error "port search failed: $result"
-		return 1
-	}
-	# argh! port doesnt exist!
-	if {$result == ""} {
-		ui_error "No port $portname found."
-		return 1
-	}
-	# fill array with information
-	array set portinfo [lindex $result 1]
-
-	# set version_in_tree
-	if {![info exists portinfo(version)]} {
-		ui_error "Invalid port entry for $portname, missing version"
-		return 1
-	}
-	set version_in_tree "$portinfo(version)_$portinfo(revision)"
-	set epoch_in_tree "$portinfo(epoch)"
-
-	# the depflag tells us if we should follow deps (this is for stuff installed outside DP)
-	# if this is set (not 0) we dont follow the deps
-	set depflag 0
-
-	# set version_installed
-	set ilist {}
-	if { [catch {set ilist [registry::installed $portname ""]} result] } {
-		if {$result == "Registry error: $portname not registered as installed." } {
-			ui_debug "$portname is *not* installed by DarwinPorts"
-			# open porthandle    
-			set porturl $portinfo(porturl)
-		    if {![info exists porturl]} {
-		        set porturl file://./    
-			}    
-			if {[catch {set workername [dportopen $porturl [array get options] ]} result]} {
-					global errorInfo
-					ui_debug "$errorInfo"
-			        ui_error "Unable to open port: $result"        
-					return 1
-		    }
-
-			if {![_dportispresent $workername $dspec ] } {
-				# port in not installed - install it!
-				if {[catch {set result [dportexec $workername install]} result]} {
-					global errorInfo
-					ui_debug "$errorInfo"
-					ui_error "Unable to exec port: $result"
-					return 1
-				}
-			} else {
-				# port installed outside DP
-				ui_debug "$portname installed outside the MacPorts system"
-				set depflag 1
-			}
-
-		} else {
-			ui_error "Checking installed version failed: $result"
-			exit 1
-		}
-	}
-	set anyactive 0
-	set version_installed 0
-	set epoch_installed 0
-	if {$ilist == ""} {
-		# XXX  this sets $version_installed to $version_in_tree even if not installed!!
-		set version_installed $version_in_tree
-		# That was a very dirty hack showing how ugly our depencendy and upgrade code is.
-		# To get it working when user provides -f, we also need to set the variant to
-		# avoid a future failure.
-		set variant ""
-	} else {
-		# a port could be installed but not activated
-		# so, deactivate all and save newest for activation later
-		set num 0
-		set variant ""
-		foreach i $ilist {
-			set variant [lindex $i 3]
-			set version "[lindex $i 1]_[lindex $i 2]"
-			if { [rpm-vercomp $version $version_installed] > 0} {
-				set version_installed $version
-				set epoch_installed [registry::property_retrieve [registry::open_entry $portname [lindex $i 1] [lindex $i 2] $variant] epoch]
-				set num $i
-			}
-
-			set isactive [lindex $i 4]
-			if {$isactive == 1 && [rpm-vercomp $version_installed $version] < 0 } {
-				# deactivate version
-    			if {[catch {portimage::deactivate $portname $version $optionslist} result]} {
-					global errorInfo
-					ui_debug "$errorInfo"
-    	    		ui_error "Deactivating $portname $version_installed failed: $result"
-    	    		return 1
-    			}
-			}
-		}
-        if { [lindex $num 4] == 0 && 0 == [string compare "image" ${darwinports::registry.installtype}] } {
-			# activate the latest installed version
-			if {[catch {portimage::activate $portname $version_installed$variant $optionslist} result]} {
-				global errorInfo
-				ui_debug "$errorInfo"
-    			ui_error "Activating $portname $version_installed failed: $result"
-				return 1
-			}
-		}
-	}
-
-	# output version numbers
-	ui_debug "epoch: in tree: $epoch_in_tree installed: $epoch_installed"
-	ui_debug "$portname $version_in_tree exists in the ports tree"
-	ui_debug "$portname $version_installed is installed"
-
-	# set the nodeps option  
-	if {![info exists options(ports_nodeps)]} {
-		set nodeps no
-	} else {	
-		set nodeps yes
-	}
-
-	if {$nodeps == "yes" || $depflag == 1} {
-		ui_debug "Not following dependencies"
-		set depflag 0
-	} else {
-		# build depends is upgraded
-		if {[info exists portinfo(depends_build)]} {
-			foreach i $portinfo(depends_build) {
-				if {![llength [array get depscache $i]]} {
-				set d [lindex [split $i :] end]
-					set depscache($i) 1
-					upgrade $d $i $variationslist $optionslist depscache
-				} 
-			}
-		}
-		# library depends is upgraded
-		if {[info exists portinfo(depends_lib)]} {
-			foreach i $portinfo(depends_lib) {
-				if {![llength [array get depscache $i]]} {
-				set d [lindex [split $i :] end]
-					set depscache($i) 1
-					upgrade $d $i $variationslist $optionslist depscache
-				} 
-			}
-		}
-		# runtime depends is upgraded
-		if {[info exists portinfo(depends_run)]} {
-			foreach i $portinfo(depends_run) {
-				if {![llength [array get depscache $i]]} {
-				set d [lindex [split $i :] end]
-					set depscache($i) 1
-					upgrade $d $i $variationslist $optionslist depscache
-				} 
-			}
-		}
-	}
-
-	# check installed version against version in ports
-	if { [rpm-vercomp $version_installed $version_in_tree] >= 0 && ![info exists options(ports_force)] } {
-		ui_debug "No need to upgrade! $portname $version_installed >= $portname $version_in_tree"
-		if { $epoch_installed >= $epoch_in_tree } {
-			# Check if we have to do dependents
-			if {[info exists options(ports_do_dependents)]} {
-				# We do dependents ..
-				set options(ports_nodeps) 1
-
-				registry::open_dep_map
-	   			set deplist [registry::list_dependents $portname]
-
-				if { [llength deplist] > 0 } {
-					foreach dep $deplist {
-						set dpname [lindex $dep 2] 
-						darwinports::upgrade $dpname "port:$dpname" [array get variations] [array get options]
-					}
-				}
-			}
-
-			return 0
-		} else {
-			ui_debug "epoch override ... upgrading!"
-			set epoch_override 1
-		}
-	}
-
-	# open porthandle
-	set porturl $portinfo(porturl)
-	if {![info exists porturl]} {
-		set porturl file://./
-	}
-
-	# check if the variants is present in $version_in_tree
-	set oldvariant $variant
-	set variant [split $variant +]
-	ui_debug "variants to install $variant"
-	if {[info exists portinfo(variants)]} {
-		set avariants $portinfo(variants)
-	} else {
-		set avariants {}
-	}
-	ui_debug "available variants are : $avariants"
-	foreach v $variant {
-		if {[lsearch $avariants $v] == -1} {
-		} else {
-			ui_debug "variant $v is present in $portname $version_in_tree"
-			set variations($v) "+"
-		}
-	}
-	ui_debug "new portvariants: [array get variations]"
-	
-	if {[catch {set workername [dportopen $porturl [array get options] [array get variations]]} result]} {
-		global errorInfo
-		ui_debug "$errorInfo"
-		ui_error "Unable to open port: $result"
-		return 1
-	}
-
-	# install version_in_tree
-	if {0 == [string compare "yes" ${darwinports::portarchivemode}]} {
-		set upgrade_action "archive"
-	} else {
-		set upgrade_action "destroot"
-	}
-
-	if {[catch {set result [dportexec $workername $upgrade_action]} result] || $result != 0} {
-		global errorInfo
-		ui_debug "$errorInfo"
-		ui_error "Unable to upgrade port: $result"
-		return 1
-	}
-
-	# uninstall old ports
-    if {[info exists options(port_uninstall_old)] || $epoch_override == 1 || [info exists options(ports_force)] || 0 != [string compare "image" ${darwinports::registry.installtype}] } {
-		# uninstall old
-		ui_debug "Uninstalling $portname $version_installed$oldvariant"
-		if {[catch {portuninstall::uninstall $portname $version_installed$oldvariant $optionslist} result]} {
-			global errorInfo
-			ui_debug "$errorInfo"
-     		ui_error "Uninstall $portname $version_installed$oldvariant failed: $result"
-       		return 1
-    	}
-	} else {
-		# XXX deactivate version_installed
-		if {[catch {portimage::deactivate $portname $version_installed$oldvariant $optionslist} result]} {
-			global errorInfo
-			ui_debug "$errorInfo"
-			ui_error "Deactivating $portname $version_installed failed: $result"
-			return 1
-		}
-	}
-
-	if {[catch {set result [dportexec $workername install]} result]} {
-		global errorInfo
-		ui_debug "$errorInfo"
-		ui_error "Couldn't activate $portname $version_in_tree$oldvariant: $result"
-		return 1
-	}
-
-	# Check if we have to do dependents
-	if {[info exists options(ports_do_dependents)]} {
-		# We do dependents ..
-		set options(ports_nodeps) 1
-
-		registry::open_dep_map
-	   	set deplist [registry::list_dependents $portname]
-
-		if { [llength deplist] > 0 } {
-			foreach dep $deplist {
-				set dpname [lindex $dep 2] 
-				darwinports::upgrade $dpname "port:$dpname" [array get variations] [array get options]
-			}
-		}
-	}
-
-	
-	# close the port handle
-	dportclose $workername
-}

Deleted: branches/dp2mp-move/base/src/macports1.0/darwinports_autoconf.tcl.in
===================================================================
--- trunk/base/src/darwinports1.0/darwinports_autoconf.tcl.in	2007-04-24 17:02:07 UTC (rev 24452)
+++ branches/dp2mp-move/base/src/macports1.0/darwinports_autoconf.tcl.in	2007-04-24 17:28:16 UTC (rev 24454)
@@ -1,36 +0,0 @@
-# darwinports-autoconf.tcl.in
-# $Id$
-#
-# Copyright (c) 2002 - 2003 Apple Computer, Inc.
-# 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 Apple Computer, 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
-# 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 darwinports 1.0
-
-namespace eval darwinports::autoconf {
-	variable dports_conf_path "@PORTCONFIGDIR_EXPANDED@"
-	variable rsync_path "@RSYNC@"
-}

Deleted: branches/dp2mp-move/base/src/macports1.0/darwinports_dlist.tcl
===================================================================
--- trunk/base/src/darwinports1.0/darwinports_dlist.tcl	2007-04-24 17:02:07 UTC (rev 24452)
+++ branches/dp2mp-move/base/src/macports1.0/darwinports_dlist.tcl	2007-04-24 17:28:16 UTC (rev 24454)
@@ -1,393 +0,0 @@
-# darwinports1.0/darwinports_dlist.tcl
-# $Id$
-#
-# Copyright (c) 2003 Kevin Van Vechten <kevin at opendarwin.org>
-# Copyright (c) 2002 Apple Computer, Inc.
-# 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 Apple Computer, 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
-# 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 darwinports_dlist 1.0
-
-# dependency dependency list evaluation package
-#
-# This package provides a generic mechanism for managing a list of
-# dependencies.  The basic model is that each dependency item
-# contains a list of tokens it Requires and tokens it Provides.
-# A dependency is selected once all of the tokens it Requires have
-# been provided by another dependency, or if a dependency has no
-# requirements.
-
-# Conceptually a dlist is an ordered list of ditem elements.
-# The order perserves the dependency hierarchy.
-
-# A dlist is an ordinary TCL list.
-# A ditem should be created with the [ditem_create] procedure,
-# and treated as an opaque reference.
-# A statusdict is an ordinary TCL array, though darwinports_dlist
-# should be given complete domain over its contents.
-# XXX: should statusdict and dlist be part of a ditem tuple?
-# Values in the status dict will be {-1, 0, 1} for {failure,
-# pending, success} respectively.
-
-# 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
-
-proc dlist_search {dlist key value} {
-	set result {}
-	foreach ditem $dlist {
-		if {[ditem_contains $ditem $key $value]} {
-			lappend result $ditem
-		}
-	}
-	return $result
-}
-
-# dlist_delete
-# Deletes the specified ditem from the dlist.
-#	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} {
-		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
-
-proc dlist_has_pending {dlist tokens} {
-	foreach token $tokens {
-		if {[llength [dlist_search $dlist provides $token]] > 0} {
-			return 1
-		}
-	}
-	return 0
-}
-
-# dlist_count_unmet
-# Returns the total number of unmet dependencies in
-# the list of tokens.  If the tokens are in the status
-# dictionary with a successful result code, they are 
-# considered met.
-proc dlist_count_unmet {dlist statusdict tokens} {
-	upvar $statusdict upstatus
-	set result 0
-	foreach token $tokens {
-		if {[info exists upstatus($token)] &&
-			$upstatus($token) == 1} {
-			continue
-		} else {
-			incr result
-		}
-	}
-	return $result
-}
-
-# ditem_create
-# Create a new array in the darwinports_dlist namespace
-# returns the name of the array.  This should be used as
-# the ditem handle.
-
-proc ditem_create {} {
-	return [darwinports_dlist::ditem_create]
-}
-
-# 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
-
-proc ditem_key {ditem args} {
-	set nbargs [llength $args]
-	if {$nbargs > 1} {
-		return [darwinports_dlist::ditem_key $ditem [lindex $args 0] [lindex $args 1]]
-	} elseif {$nbargs == 1} {
-		return [darwinports_dlist::ditem_key $ditem [lindex $args 0]]
-	} else {
-		return [darwinports_dlist::ditem_key $ditem]
-	}
-}
-
-# 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
-
-proc ditem_append {ditem key args} {
-	eval "return \[darwinports_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
-
-proc ditem_append_unique {ditem key args} {
-	eval "return \[darwinports_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
-proc ditem_contains {ditem key args} {
-	eval "return \[darwinports_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.
-
-proc dlist_append_dependents {dlist ditem result} {
-	# Only append things if the root item is not in the list.
-	# (otherwise, it means we already did this sub-graph)
-	if {[lsearch $result $ditem] == -1} {
-		lappend result $ditem
-
-		# Recursively append any hard dependencies.
-		foreach token [ditem_key $ditem requires] {
-			foreach provider [dlist_search $dlist provides $token] {
-				set result [dlist_append_dependents $dlist $provider $result]
-			}
-		}
-		# XXX: add soft-dependencies?
-	}
-	return $result
-}
-
-# dlist_get_next
-# Returns the any eligible item from the dependency list.
-# Eligibility is a function of the ditems in the list and
-# the status dictionary.  A ditem is eligible when all of
-# the services it Requires are present in the status
-# dictionary with a successful result code.
-#
-# Notes: this implementation of get next defers items based
-# 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.
-
-proc dlist_get_next {dlist statusdict} {
-	upvar $statusdict upstatus
-	set nextitem {}
-	
-	# arbitrary large number ~ INT_MAX
-	set minfailed 2000000000
-	
-	foreach ditem $dlist {
-		# Skip if the ditem has unsatisfied hard dependencies
-		if {[dlist_count_unmet $dlist upstatus [ditem_key $ditem requires]]} {
-			continue
-		}
-		
-		# We will favor the ditem with the fewest unmet soft dependencies
-		set unmet [dlist_count_unmet $dlist upstatus [ditem_key $ditem uses]]
-		
-		# Delay items with unment soft dependencies that can eventually be met
-		if {$unmet > 0 && [dlist_has_pending $dlist [ditem_key $ditem uses]]} {
-			continue
-		}
-		
-		if {$unmet >= $minfailed} {
-			# not better than the last pick
-			continue
-		} else {
-			# better than the last pick (fewer unmet soft deps)
-			set minfailed $unmet
-			set nextitem $ditem
-		}
-	}
-	return $nextitem
-}
-
-# dlist_eval
-# Evaluate the dlist, select each eligible ditem according to
-# the optional selector argument (the default selector is 
-# dlist_get_next).  The specified handler is then invoked on
-# each ditem in the order they are selected.  When no more
-# 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
-
-proc dlist_eval {dlist testcond handler {canfail "0"} {selector "dlist_get_next"}} {
-	array set statusdict [list]
-	
-	# Do a pre-run seeing if any items automagically
-	# can evaluate to true.
-	if {$testcond != ""} {
-		foreach ditem $dlist {
-			if {[eval "expr \[\$testcond \$ditem\] == 1"]} {
-				foreach token [ditem_key $ditem provides] {
-					set statusdict($token) 1
-				}
-				dlist_delete dlist $ditem
-			}
-		}
-	}
-	
-	# Loop for as long as there are ditems in the dlist.
-	while {1} {
-		set ditem [$selector $dlist statusdict]
-		
-		if {$ditem == {}} {
-			break
-		} else {
-			# $handler should return a unix status code, 0 for success.
-			# statusdict notation is 1 for success
-			if {[catch {eval "$handler $ditem"} result]} {
-				puts $result
-				return $dlist
-			}
-			# No news is good news at this point.
-			if {$result == {}} { set result 0 }
-			
-			foreach token [ditem_key $ditem provides] {
-				set statusdict($token) [expr $result == 0]
-			}
-			
-			# Abort if we're not allowed to fail
-			if {$canfail == 0 && $result != 0} {
-				return $dlist
-			}
-			
-			# Delete the ditem from the waiting list.
-			dlist_delete dlist $ditem
-		}
-	}
-	
-	# Return the list of lusers
-	return $dlist
-}
-
-
-##### Private API #####
-# Anything below this point is subject to change without notice.
-#####
-
-# Each ditem is actually an array in the darwinports_dlist
-# namespace.  ditem keys correspond to the equivalent array
-# key.  A dlist is simply a list of names of ditem arrays.
-# All private API functions exist in the darwinports_dlist
-# namespace.
-
-namespace eval darwinports_dlist {
-
-variable ditem_uniqid 0
-
-proc ditem_create {} {
-	variable ditem_uniqid
-	incr ditem_uniqid
-	set ditem "ditem_${ditem_uniqid}"
-	variable $ditem
-	array set $ditem [list]
-	return $ditem
-}
-
-proc ditem_key {ditem args} {
-	variable $ditem
-	set nbargs [llength $args]
-	if {$nbargs > 1} {
-		set key [lindex $args 0]
-		array set $ditem [list $key [lindex $args 1]]
-		return [lindex [array get $ditem $key] 1]
-	} elseif {$nbargs == 1} {
-		set key [lindex $args 0]
-		return [lindex [array get $ditem $key] 1]
-	} else {
-		return [array get $ditem]
-	}
-}
-
-proc ditem_append {ditem key args} {
-	variable $ditem
-	set x [lindex [array get $ditem $key] 1]
-	if {$x != {}} {
-		eval "lappend x $args"
-	} else {
-		set x $args
-	}
-	array set $ditem [list $key $x]
-	return $x
-}
-
-proc ditem_append_unique {ditem key args} {
-	variable $ditem
-	set x [lindex [array get $ditem $key] 1]
-	if {$x != {}} {
-		eval "lappend x $args"
-		set x [lsort -unique $x]
-	} else {
-		set x $args
-	}
-	array set $ditem [list $key $x]
-	return $x
-}
-
-proc ditem_contains {ditem key args} {
-	variable $ditem
-	if {[llength $args] == 0} {
-		eval "return \[info exists ${ditem}($key)\]"
-	} else {
-		set x [lindex [array get $ditem $key] 1]
-		if {[llength $x] > 0 && [lsearch -exact $x [lindex $args 0]] != -1} {
-			return 1
-		} else {
-			return 0
-		}
-	}
-}
-
-# End of darwinports_dlist namespace
-}
-

Deleted: branches/dp2mp-move/base/src/macports1.0/darwinports_fastload.tcl.in
===================================================================
--- trunk/base/src/darwinports1.0/darwinports_fastload.tcl.in	2007-04-24 17:02:07 UTC (rev 24452)
+++ branches/dp2mp-move/base/src/macports1.0/darwinports_fastload.tcl.in	2007-04-24 17:28:16 UTC (rev 24454)
@@ -1,83 +0,0 @@
-# darwinports_fastload.tcl.in
-# $Id$
-#
-# Copyright (c) 2004 Paul Guyot, Darwinports Team.
-# 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 Apple Computer, 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
-# 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 darwinports-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 DP and a user installation of DP (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 { ($tcl_version < 8.4) ||
-	(($tcl_version == 8.4) && ([lindex [split [info patchlevel] .] 3] < 7))} {
-	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 dir [file join "@TCL_PACKAGE_DIR@" darwinports1.0]
-catch {source [file join $dir pkgIndex.tcl]}
-
-foreach dir [glob -directory "@prefix_expanded@" -join share darwinports Tcl *] {
-	catch {source [file join $dir pkgIndex.tcl]}
-}
-
-if { "@SQLITE3_DIR@" != "" } {
-	set dir "@SQLITE3_DIR@"
-	catch {source [file join $dir pkgIndex.tcl]}
-}

Deleted: branches/dp2mp-move/base/src/macports1.0/darwinports_index.tcl
===================================================================
--- trunk/base/src/darwinports1.0/darwinports_index.tcl	2007-04-24 17:02:07 UTC (rev 24452)
+++ branches/dp2mp-move/base/src/macports1.0/darwinports_index.tcl	2007-04-24 17:28:16 UTC (rev 24454)
@@ -1,379 +0,0 @@
-# darwinports_index.tcl
-# $Id$
-#
-# Copyright (c) 2004 Apple Computer, Inc.
-# 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 Apple Computer, 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
-# 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.
-#
-# 31-Mar-2004
-# Kevin Van Vechten <kevin at opendarwin.org>
-#
-
-package provide darwinports_index 1.0
-
-namespace eval darwinports::index {
-	variable has_sqlite {}
-}
-
-proc darwinports::index::init {} {
-	global darwinports::index::has_sqlite darwinports::prefix
-	if {$darwinports::index::has_sqlite == 1 ||
-		[file exists ${darwinports::prefix}/lib/tclsqlite.dylib]} {
-		load ${darwinports::prefix}/lib/tclsqlite.dylib Sqlite
-		set darwinports::index::has_sqlite 1
-	} else {
-		return -code error "Sqlite must be installed to use a remote index.  Use the tclsqlite port."
-	}
-}
-
-proc darwinports::index::get_path {source} {
-    global darwinports::portdbpath
-    regsub {://} $source {.} source_dir
-    regsub -all {/} $source_dir {_} source_dir
-    return [file join $portdbpath sources $source_dir]
-}
-
-
-# darwinports::index::sync
-# Interact with the remote index at the specified URL.
-# Replays the SQL transactions contained in the remote
-# index file into a local database, creating it if it
-# does not yet exist.  If it does already exist, only
-# the transactions newer than the last sync will be
-# downloaded and replayed.
-#
-# portdbpath - the path to which the local database should
-#              be stored.  "portindex/" and a unique hash based
-#              on the url will be appended to this path.
-# url        - the url of the remote index to synchronize with
-
-proc darwinports::index::sync {portdbpath url} {
-	darwinports::index::init
-
-	set indexpath [darwinports::index::get_path $url]
-	if {[catch {file mkdir $indexpath} result]} {
-		return -code error "$indexpath could not be created: $result"
-	}
-
-	set oldpath [pwd]
-	cd $indexpath
-	
-	# We actually use http:// as the transport mechanism
-	set url [regsub -- {^dports} $url {http}]
-
-	# If the database didn't exist, initialize it.
-	# The schema is available on the server in the initialize.sql file.
-	if {![file exists [file join $indexpath database.sqlite]]} {
-		puts "Initializing portindex"
-		exec curl --silent -O "$url/index/initialize.sql"
-		# XXX detect curl failures
-		
-		set fd [open initialize.sql r]
-		set sql {}
-		while {[gets $fd line] >= 0} {
-			append sql " $line\n"
-		}
-		close $fd
-		# Database file has the name database.sqlite
-		sqlite DB database.sqlite
-		DB eval $sql
-		DB eval "CREATE TABLE priv_data (keyword text, value int);"
-		DB eval "INSERT INTO priv_data (keyword, value) VALUES ('last_index', 1);"
-		DB eval "INSERT INTO priv_data (keyword, value) VALUES ('last_trans', 0);"
-		DB close
-	}
-
-	# Database file has the name database.sqlite
-	sqlite DB database.sqlite
-
-	##
-	# Download any new files
-	##
-
-	# Get the last downloaded file index out of the database.
-	set start_index [DB eval "SELECT value FROM priv_data WHERE keyword='last_index';"]
-
-	# Get the current high-water mark from the server.
-	exec curl --silent -O "$url/index/.last_index"
-	# XXX detect curl failures
-	set fd [open ".last_index" r]
-	gets $fd last_index
-	# XXX should validate the contents of $last_index
-	close $fd
-	# Re-fetch the last file we fetched (transactions may have
-	# been appended to it) and any new files.
-	for {set i $start_index} {$i <= $last_index} {incr i} {
-		puts "Fetching portindex-$i"
-		exec curl --silent -O "$url/index/portindex-$i.sql"
-		# XXX detect curl failures
-		DB eval "UPDATE priv_data SET value=$i WHERE keyword='last_index';\n"
-	}
-
-	##
-	# Replay the transactions
-	##
-
-	# Get the last transaction ID out of the database.
-	set last_trans [DB eval "SELECT value FROM priv_data WHERE keyword='last_trans';"]
-
-	# Iterate through the files we just downloaded
-	for {set i $start_index} {$i <= $last_index} {incr i} {
-		puts "Processing portindex-$i"
-		set fd [open "portindex-$i.sql" r]
-		set sql {}
-		while {[gets $fd line] >= 0} {
-			append sql " $line\n"	
-			if {[regexp -- {^-- END TRANSACTION #([0-9]+)} $line unused trans_id] == 1} {
-				# If this is a transaction we have not seen before, commit it.
-				# Also update the last transaction number.
-				if {$trans_id > $last_trans} {
-					set last_trans $trans_id
-					append sql " UPDATE priv_data SET value=$last_trans WHERE keyword='last_trans';\n"
-					DB eval $sql
-				}
-				set sql {}
-			}
-		}
-		close $fd
-	}
-
-	# Clean Up
-	DB close
-	cd $oldpath
-}
-
-# darwinports::index::search
-#
-# Searches the cached copy of the specified port index for
-# the Portfile satisfying the given query.
-#
-# Todo -- in the future we may want to do an implicit "port sync"
-# when this function is called.
-#
-# portdbpath - the path to which the local database should
-#              be stored.  "portindex/" and a unique hash based
-#              on the url will be appended to this path.
-# url        - the url of the remote index to search
-#
-# attrs      - an array of the attributes to search for
-#			   currently only "name" is supported.
-
-proc darwinports::index::search {portdbpath url attrslist} {
-	darwinports::index::init
-	set indexpath [darwinports::index::get_path $url]
-
-	if {![file exists $indexpath/database.sqlite]} {
-		return -code error "Can't open index file for source $url. Have you synced your source indexes (port sync)?"
-	}
-
-	sqlite DB $indexpath/database.sqlite
-	# Map some functions into the SQL namespace
-	DB function regexp regexp
-	
-	# The guts of the search logic.
-	# Precedence is as follows:
-	# - If a name, version, and revision is specified return that single port.
-	# - If a name and version is specified, return the highest revision
-	# - If only a name is specified, return the highest revision of 
-	#   all distinct name, version combinations.
-	# - NOTE: it is an error to specify a revision without a version.
-
-	set pids [list]
-	array set attrs $attrslist
-	if {[info exists attrs(name)]} {
-		set name $attrs(name)
-
-		# If version was not specified, find all distinct versions;
-		# otherwise use the specified version.
-		if {![info exists attrs(version)]} {
-			set sql "SELECT version FROM ports WHERE regexp('--','$name',name) GROUP BY version ORDER BY version DESC"
-			set versions [DB eval $sql]
-		} else {
-			set versions [list $attrs(version)]
-		}
-	
-		# If revision was not specified, find the highest revision;
-		# otherwise use the specified revision.
-		if {![info exists attrs(revision)]} {
-			foreach version $versions {
-				set sql "SELECT max(revision) FROM ports WHERE regexp('--','$name',name) AND version LIKE '$version'"
-				set revisions($version) [DB eval $sql]
-			}
-		} else {
-			set revisions($version) $attrs(revision)
-		}
-		
-		foreach version $versions {
-			set sql "SELECT pid FROM ports WHERE regexp('--','$name',name) AND version LIKE '$version' AND revision LIKE '$revisions($version)'"
-			lappend pids [DB eval $sql]
-		}
-	}
-	
-	# Historically dportsearch has returned a serialized list of arrays.
-	# This is kinda gross and really needs to change to a more opaque
-	# data type in the future, but to ease the transition we're it the old
-	# way here.  For each port that matched the query, build up an array 
-	# from the keywords table and append it to the list.
-
-	set result [list]
-
-	foreach pid $pids {
-		set portinfo [list]
-		set primary_key [DB eval "SELECT name,version,revision FROM ports WHERE pid=$pid"]
-		set name [lindex $primary_key 0]
-		set version [lindex $primary_key 1]
-		set revision [lindex $primary_key 2]
-		lappend portinfo name $name
-		lappend portinfo version $version
-		lappend portinfo revision $revision
-		
-		set auxiliary_keys [DB eval "SELECT keyword, value FROM keywords WHERE pid=$pid"]
-		foreach {key value} $auxiliary_keys {
-			# XXX - special case list types: categories, maintainers, master_sites
-			lappend portinfo $key $value
-		}
-		
-		# Craft a URL where the port can be found.
-		lappend portinfo porturl $url/files/$name/$version/$revision/Portfile.tar.gz
-		
-		# Make a note of where this port came from.
-		lappend portsource $url
-		
-		lappend result $name
-		lappend result $portinfo
-	}
-
-	DB close
-
-	return $result
-}
-
-
-
-# darwinports::index::fetch_port
-#
-# Checks for a locally cached copy of the port, or downloads the port
-# from the specified URL.  The port is extracted into the current working
-# directory along with a .dports_source file containing the url of the
-# source the port came from.  (This can be later used as a default for
-# "port submit")
-#
-# The cached portfiles are in the same directory as the cached remote index.
-#
-# TODO - the existing infrastructure only gives us a URL at this point,
-# but we really ought to have an opaque handle to a port.  We want to
-# get the source URL and the Portfile.tar.gz md5 from this opaque handle.
-
-proc darwinports::index::fetch_port {url destdir} {
-	global darwinports::sources
-	
-	set portsource ""
-	set portname ""
-	set portversion ""
-	set portrevision ""
-	
-	# Iterate through the sources, to see which one this port is coming from.
-	# If the port is not coming from a known source, return an error (for now).
-	
-	set indexpath ""
-	set fetchpath ""
-	foreach source $sources {
-		if {[regexp -- "^$source" $url] == 1} {
-			set portsource $source
-			set indexpath [darwinports::index::get_path $source]
-			
-			# Extract the relative portion of the url, 
-			# and append it to the indexpath, this is where
-			# we will store the cached Portfile.
-			set dir [file dirname [regsub -- "$source/?" $url {}]]
-
-			# XXX: crude hack to get port name and version, should realy come from opaque port handle.
-			set portname [lindex [file split $dir] 1]
-			set portversion [lindex [file split $dir] 2]
-			set portrevision [lindex [file split $dir] 3]
-
-			set fetchpath [file join $indexpath $dir]
-			break
-		}
-	}
-	
-	if {$indexpath == "" || $fetchpath == ""} {
-		return -code error "Port URL has unknown source: $url"
-	}
-	
-	if {[catch {file mkdir $fetchpath} result]} {
-		return -code error $result
-	}
-
-	# If the portdir already exists, we don't bother extracting again.
-	
-	# Look to see if the file exists in our cache, if it does, attempt
-	# to extract it into the temporary directory that we will build in.
-	# If it does not exist, or if the tar extraction fails, then attempt
-	# to fetch it again.
-
-
-	set portdir [file join "$destdir" "$portname-$portversion"]
-
-	if {[file exists $portdir]} {
-		return $portdir
-	}
-	
-	if {[catch {file mkdir $portdir} result]} {
-		return -code error $result
-	}
-
-	set fetchfile [file join $fetchpath [file tail $url]]
-	set retries 2
-	while {$retries > 0} {
-		if {[file exists $fetchfile]} {
-			set oldcwd [pwd]
-			cd $portdir
-			
-			if {[catch {exec tar -zxf $fetchfile} result]} {
-				return -code error "Could not unpack port file: $result"
-			}
-			
-			set fd [open ".dports_source" w]
-			puts $fd "source: $portsource"
-			puts $fd "port: $portname"
-			puts $fd "version: $portversion"
-			puts $fd "revision: $portrevision"
-			close $fd
-			
-			cd $oldcwd
-		} else {		
-			# We actually use http:// as the transport mechanism
-			set http_url [regsub -- {^dports} $url {http}]
-			if {[catch {exec curl -L -s -S -o $fetchfile $http_url} result ]} {
-				return -code error "Could not download port from remote index: $result"
-			}
-		}
-		incr retries -1
-	}
-	
-	return $portdir
-}

Copied: branches/dp2mp-move/base/src/macports1.0/macports.c (from rev 24452, trunk/base/src/darwinports1.0/darwinports.c)
===================================================================
--- branches/dp2mp-move/base/src/macports1.0/macports.c	                        (rev 0)
+++ branches/dp2mp-move/base/src/macports1.0/macports.c	2007-04-24 17:28:16 UTC (rev 24454)
@@ -0,0 +1,46 @@
+/*
+ * darwinports.c
+ * $Id$
+ *
+ * Copyright (c) 2003 Apple Computer, Inc.
+ * 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 Apple Computer, 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
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <tcl.h>
+
+int darwinports_Init(Tcl_Interp *interp)
+{
+	if(Tcl_InitStubs(interp, "8.3", 0) == NULL)
+		return TCL_ERROR;
+	if(Tcl_PkgProvide(interp, "darwinports", "1.0") != TCL_OK)
+		return TCL_ERROR;
+	return TCL_OK;
+}

Copied: branches/dp2mp-move/base/src/macports1.0/macports.h (from rev 24452, trunk/base/src/darwinports1.0/darwinports.h)
===================================================================
--- branches/dp2mp-move/base/src/macports1.0/macports.h	                        (rev 0)
+++ branches/dp2mp-move/base/src/macports1.0/macports.h	2007-04-24 17:28:16 UTC (rev 24454)
@@ -0,0 +1,60 @@
+/*
+ * darwinports.h
+ * $Id$
+ *
+ * Copyright (c) 2003 Apple Computer, Inc.
+ * 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 Apple Computer, 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
+ * 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.
+ */
+
+#ifndef __DARWINPORTS_H__
+#define __DARWINPORTS_H__
+
+typedef void* dp_session_t;
+typedef void* dp_software_t;
+
+typedef void* dp_array_t;
+dp_array_t dp_array_create();
+dp_array_t dp_array_create_copy(dp_array_t a);
+dp_array_t dp_array_retain(dp_array_t a);
+void dp_array_release(dp_array_t a);
+void dp_array_append(dp_array_t a, const void* data);
+int dp_array_get_count(dp_array_t a);
+const void* dp_array_get_index(dp_array_t a, int index);
+/* something for delete */
+
+dp_session_t dp_session_open();
+int dp_session_sync_index();
+
+int dp_software_search(dp_session_t dp, const char* regexp, dp_software_t* out_matches, int* out_count);
+dp_software_t dp_software_open_portfile(dp_session_t dp, const char* path, const char** options);
+dp_session_t dp_software_get_session(dp_software_t sw);
+dp_software_t dp_software_exec(dp_software_t sw, const char* target);
+int dp_softare_close(dp_software_t sw);
+
+int dp_session_close();
+
+#endif /* __DARWINPORTS_H__ */

Copied: branches/dp2mp-move/base/src/macports1.0/macports.tcl (from rev 24452, trunk/base/src/darwinports1.0/darwinports.tcl)
===================================================================
--- branches/dp2mp-move/base/src/macports1.0/macports.tcl	                        (rev 0)
+++ branches/dp2mp-move/base/src/macports1.0/macports.tcl	2007-04-24 17:28:16 UTC (rev 24454)
@@ -0,0 +1,1764 @@
+# darwinports.tcl
+# $Id$
+#
+# Copyright (c) 2002 Apple Computer, Inc.
+# Copyright (c) 2004 - 2005 Paul Guyot, <pguyot at kallisys.net>.
+# Copyright (c) 2004 - 2006 Ole Guldberg Jensen <olegb at opendarwin.org>.
+# Copyright (c) 2004 - 2005 Robert Shaw <rshaw at opendarwin.org>
+# 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 Apple Computer, 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
+# 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 darwinports 1.0
+package require darwinports_dlist 1.0
+package require darwinports_index 1.0
+
+namespace eval darwinports {
+    namespace export bootstrap_options user_options portinterp_options open_dports ui_priorities
+    variable bootstrap_options "\
+    	portdbpath libpath binpath auto_path extra_env sources_conf prefix portdbformat \
+    	portinstalltype portarchivemode portarchivepath portarchivetype portautoclean \
+    	porttrace portverbose destroot_umask variants_conf rsync_server rsync_options \
+    	rsync_dir startupitem_type xcodeversion xcodebuildcmd"
+    variable user_options "submitter_name submitter_email submitter_key"
+    variable portinterp_options "\
+    	portdbpath portpath portbuildpath auto_path prefix portsharepath \
+    	registry.path registry.format registry.installtype portarchivemode portarchivepath \
+    	portarchivetype portautoclean porttrace portverbose destroot_umask rsync_server \
+    	rsync_options rsync_dir startupitem_type \
+    	$user_options"
+    
+    # deferred options are only computed when needed.
+    # they are not exported to the trace thread.
+    # they are not exported to the interpreter in system_options array.
+    variable portinterp_deferred_options "xcodeversion xcodebuildcmd"
+	
+    variable open_dports {}
+    
+    variable ui_priorities "debug info msg error warn"
+}
+
+# Provided UI instantiations
+# For standard messages, the following priorities are defined
+#     debug, info, msg, warn, error
+# Clients of the library are expected to provide ui_prefix and ui_channels with
+# the following prototypes.
+#     proc ui_prefix {priority}
+#     proc ui_channels {priority}
+# ui_prefix returns the prefix for the messages, if any.
+# ui_channels returns a list of channels to output the message to, empty for
+#     no message.
+
+proc darwinports::ui_init {priority message} {
+	# Get the list of channels.
+	set channels [ui_channels $priority]
+
+	# Simplify ui_$priority.
+	set nbchans [llength $channels]
+	if {$nbchans == 0} {
+		eval "proc ::ui_$priority {str} {}"
+	} else {
+		set prefix [ui_prefix $priority]
+
+		if {$nbchans == 1} {
+			set chan [lindex $channels 0]
+			eval "proc ::ui_$priority {str} \{ puts $chan \"$prefix\$str\" \}"
+		} else {
+			eval "proc ::ui_$priority {str} \{ \n\
+				foreach chan $channels \{ \n\
+					puts $chan \"$prefix\$str\" \n\
+				\} \n\
+			\}"
+		}
+
+		# Call ui_$priority
+		::ui_$priority $message
+	}
+}
+
+foreach priority ${darwinports::ui_priorities} {
+    eval "proc ui_$priority {str} \{ darwinports::ui_init $priority \$str \}"
+}
+
+# Replace puts to catch errors (typically broken pipes when being piped to head)
+rename puts tcl::puts
+proc puts {args} {
+	catch "tcl::puts $args"
+}
+
+# check for a binary in the path
+# returns an error code if it can not be found
+# copied from portutil.tcl
+proc darwinports::binaryInPath {binary} {
+    global env
+    foreach dir [split $env(PATH) :] { 
+	if {[file executable [file join $dir $binary]]} {
+	    return [file join $dir $binary]
+	}
+    }
+    
+    return -code error [format [msgcat::mc "Failed to locate '%s' in path: '%s'"] $binary $env(PATH)];
+}
+
+# deferred option processing
+proc darwinports::getoption {name} {
+	global darwinports::$name
+	return [expr $$name]
+}
+
+# deferred and on-need extraction of xcodeversion and xcodebuildcmd.
+proc darwinports::setxcodeinfo {name1 name2 op} {
+	global darwinports::xcodeversion
+	global darwinports::xcodebuildcmd
+	
+	trace remove variable darwinports::xcodeversion read darwinports::setxcodeinfo
+	trace remove variable darwinports::xcodebuildcmd read darwinports::setxcodeinfo
+
+	if {[catch {set xcodebuild [binaryInPath "xcodebuild"]}] == 0} {
+		if {![info exists xcodeversion]} {
+			# Determine xcode version (<= 2.0 or 2.1)
+			if {[catch {set xcodebuildversion [exec xcodebuild -version]}] == 0} {
+				if {[regexp "DevToolsCore-(.*); DevToolsSupport-(.*)" $xcodebuildversion devtoolscore_v devtoolssupport_v] == 1} {
+					if {$devtoolscore_v >= 620.0 && $devtoolssupport_v >= 610.0} {
+						# for now, we don't need to distinguish 2.1 from 2.1 or higher.
+						set darwinports::xcodeversion "2.1"
+					} else {
+						set darwinports::xcodeversion "2.0orlower"
+					}
+				} else {
+					set darwinports::xcodeversion "2.0orlower"
+				}
+			} else {
+				set darwinports::xcodeversion "2.0orlower"
+			}
+		}
+		
+		if {![info exists xcodebuildcmd]} {
+			set darwinports::xcodebuildcmd "xcodebuild"
+		}
+	} elseif {[catch {set pbxbuild [binaryInPath "pbxbuild"]}] == 0} {
+		if {![info exists xcodeversion]} {
+			set darwinports::xcodeversion "pb"
+		}
+		if {![info exists xcodebuildcmd]} {
+			set darwinports::xcodebuildcmd "pbxbuild"
+		}
+	} else {
+		if {![info exists xcodeversion]} {
+			set darwinports::xcodeversion "none"
+		}
+		if {![info exists xcodebuildcmd]} {
+			set darwinports::xcodebuildcmd "none"
+		}
+	}
+}
+
+proc dportinit {up_ui_options up_options up_variations} {
+	upvar  $up_ui_options ui_options
+	upvar  $up_options	  options
+	upvar  $up_variations variations
+	
+	global auto_path env
+	global darwinports::autoconf::dports_conf_path
+	global darwinports::bootstrap_options
+	global darwinports::user_options
+	global darwinports::extra_env
+	global darwinports::portconf
+	global darwinports::portdbpath
+	global darwinports::portsharepath
+	global darwinports::registry.format
+	global darwinports::registry.path
+	global darwinports::sources
+	global darwinports::sources_conf
+	global darwinports::startupitem_type
+   	global darwinports::destroot_umask
+   	global darwinports::libpath
+   	global darwinports::prefix
+   	global darwinports::registry.installtype
+   	global darwinports::rsync_dir
+   	global darwinports::rsync_options
+   	global darwinports::rsync_server
+   	global darwinports::variants_conf
+   	global darwinports::xcodebuildcmd
+   	global darwinports::xcodeversion
+   	
+   	# Configure the search path for configuration files
+   	set conf_files ""
+    if {[llength [array names env PORTSRC]] > 0} {
+		set PORTSRC [lindex [array get env PORTSRC] 1]
+		lappend conf_files ${PORTSRC}
+    }
+    lappend conf_files "~/.macports/ports.conf" "${dports_conf_path}/ports.conf"
+    
+    # Process the first configuration file we find on conf_files list
+	foreach file $conf_files {
+		if [file exists $file] {
+			set portconf $file
+			set fd [open $file r]
+			while {[gets $fd line] >= 0} {
+				if {[regexp {^(\w+)([ \t]+(.*))?$} $line match option ignore val] == 1} {
+					if {[regexp {^"(.*)"[ \t]*$} $val match val2] == 1} {
+						# Nasty hack for malformed rsync_options in ports.conf
+						set val $val2
+					}
+					if {[lsearch $bootstrap_options $option] >= 0} {
+						set darwinports::$option $val
+						global darwinports::$option
+					}
+				}
+			}
+			
+			break
+		}
+	}
+	
+	# Process per-user only settings
+	set per_user "~/.macports/user.conf"
+	if [file exists $per_user] {
+		set fd [open $per_user r]
+		while {[gets $fd line] >= 0} {
+			if {[regexp {^(\w+)([ \t]+(.*))?$} $line match option ignore val] == 1} {
+				if {[lsearch $user_options $option] >= 0} {
+					set darwinports::$option $val
+					global darwinports::$option
+				}
+			}
+		}
+	}
+	
+    if {![info exists sources_conf]} {
+        return -code error "sources_conf must be set in $dports_conf_path/ports.conf or in your ~/.portsrc"
+    }
+    if {[catch {set fd [open $sources_conf r]} result]} {
+        return -code error "$result"
+    }
+    while {[gets $fd line] >= 0} {
+        set line [string trimright $line]
+        if {![regexp {[\ \t]*#.*|^$} $line]} {
+            lappend sources $line
+	}
+    }
+    if {![info exists sources]} {
+	if {[file isdirectory dports]} {
+	    set sources "file://[pwd]/dports"
+	} else {
+	    return -code error "No sources defined in $sources_conf"
+	}
+    }
+
+	if {[info exists variants_conf]} {
+		if {[file exist $variants_conf]} {
+			if {[catch {set fd [open $variants_conf r]} result]} {
+				return -code error "$result"
+			}
+			while {[gets $fd line] >= 0} {
+				set line [string trimright $line]
+				if {![regexp {^[\ \t]*#.*$|^$} $line]} {
+					foreach arg [split $line " \t"] {
+						if {[regexp {^([-+])([-A-Za-z0-9_+\.]+)$} $arg match sign opt] == 1} {
+							if {![info exists variations($opt)]} {
+								set variations($opt) $sign
+							}
+						} else {
+							ui_warn "$variants_conf specifies invalid variant syntax '$arg', ignored."
+						}
+					}
+				}
+			}
+		} else {
+			ui_debug "$variants_conf does not exist, variants_conf setting ignored."
+		}
+	}
+
+    if {![info exists portdbpath]} {
+	return -code error "portdbpath must be set in $dports_conf_path/ports.conf or in your ~/.portsrc"
+    }
+    if {![file isdirectory $portdbpath]} {
+	if {![file exists $portdbpath]} {
+	    if {[catch {file mkdir $portdbpath} result]} {
+		return -code error "portdbpath $portdbpath does not exist and could not be created: $result"
+	    }
+	}
+    }
+    if {![file isdirectory $portdbpath]} {
+	return -code error "$portdbpath is not a directory. Please create the directory $portdbpath and try again"
+    }
+
+    set registry.path $portdbpath
+    if {![file isdirectory ${registry.path}]} {
+	if {![file exists ${registry.path}]} {
+	    if {[catch {file mkdir ${registry.path}} result]} {
+		return -code error "portdbpath ${registry.path} does not exist and could not be created: $result"
+	    }
+	}
+    }
+    if {![file isdirectory ${darwinports::registry.path}]} {
+	return -code error "${darwinports::registry.path} is not a directory. Please create the directory $portdbpath and try again"
+    }
+
+	# Format for receipts, can currently be either "flat" or "sqlite"
+	if {[info exists portdbformat]} {
+		if { $portdbformat == "sqlite" } {
+			return -code error "SQLite is not yet supported for registry storage."
+		} 
+		set registry.format receipt_${portdbformat}
+	} else {
+		set registry.format receipt_flat
+	}
+
+	# Installation type, whether to use port "images" or install "direct"
+	if {[info exists portinstalltype]} {
+		set registry.installtype $portinstalltype
+	} else {
+		set registry.installtype image
+	}
+    
+	# Autoclean mode, whether to automatically call clean after "install"
+	if {![info exists portautoclean]} {
+		set darwinports::portautoclean "yes"
+		global darwinports::portautoclean
+	}
+	# Check command line override for autoclean
+	if {[info exists options(ports_autoclean)]} {
+		if {![string equal $options(ports_autoclean) $portautoclean]} {
+			set darwinports::portautoclean $options(ports_autoclean)
+		}
+	}
+	# Trace mode, whether to use darwintrace to debug ports.
+	if {![info exists porttrace]} {
+		set darwinports::porttrace "no"
+		global darwinports::porttrace
+	}
+	# Check command line override for trace
+	if {[info exists options(ports_trace)]} {
+		if {![string equal $options(ports_trace) $porttrace]} {
+			set darwinports::porttrace $options(ports_trace)
+		}
+	}
+
+	# Export verbosity.
+	if {![info exists portverbose]} {
+		set darwinports::portverbose "no"
+		global darwinports::portverbose
+	}
+	if {[info exists ui_options(ports_verbose)]} {
+		if {![string equal $ui_options(ports_verbose) $portverbose]} {
+			set darwinports::portverbose $ui_options(ports_verbose)
+		}
+	}
+
+	# Archive mode, whether to create/use binary archive packages
+	if {![info exists portarchivemode]} {
+		set darwinports::portarchivemode "yes"
+		global darwinports::portarchivemode
+	}
+
+	# Archive path, where to store/retrieve binary archive packages
+	if {![info exists portarchivepath]} {
+		set darwinports::portarchivepath [file join $portdbpath packages]
+		global darwinports::portarchivepath
+	}
+	if {$portarchivemode == "yes"} {
+		if {![file isdirectory $portarchivepath]} {
+			if {![file exists $portarchivepath]} {
+				if {[catch {file mkdir $portarchivepath} result]} {
+					return -code error "portarchivepath $portarchivepath does not exist and could not be created: $result"
+				}
+			}
+		}
+		if {![file isdirectory $portarchivepath]} {
+			return -code error "$portarchivepath is not a directory. Please create the directory $portarchivepath and try again"
+		}
+	}
+
+	# Archive type, what type of binary archive to use (CPIO, gzipped
+	# CPIO, XAR, etc.)
+	if {![info exists portarchivetype]} {
+		set darwinports::portarchivetype "cpgz"
+		global darwinports::portarchivetype
+	}
+	# Convert archive type to a list for multi-archive support, colon or
+	# comma separators indicates to use multiple archive formats
+	# (reading and writing)
+	set darwinports::portarchivetype [split $portarchivetype {:,}]
+
+	# Set rync options
+	if {![info exists rsync_server]} {
+		set darwinports::rsync_server rsync.darwinports.org
+		global darwinports::rsync_server
+	}
+	if {![info exists rsync_dir]} {
+		set darwinports::rsync_dir dpupdate1/base/
+		global darwinports::rsync_dir
+	}
+	if {![info exists rsync_options]} {
+		set rsync_options "-rtzv --delete --delete-after"
+		global darwinports::rsync_options
+	}
+
+    set portsharepath ${prefix}/share/darwinports
+    if {![file isdirectory $portsharepath]} {
+	return -code error "Data files directory '$portsharepath' must exist"
+    }
+    
+    if {![info exists libpath]} {
+	set libpath "${prefix}/share/darwinports/Tcl"
+    }
+
+    if {![info exists binpath]} {
+	set env(PATH) "${prefix}/bin:${prefix}/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin"
+    } else {
+	set env(PATH) "$binpath"
+    }
+    
+    # Set startupitem default type (can be overridden by portfile)
+    if {![info exists startupitem_type]} {
+    	set darwinports::startupitem_type "default"
+    	global darwinports::startupitem_type
+    }
+    
+    # ENV cleanup.
+	set keepenvkeys { DISPLAY DYLD_FALLBACK_FRAMEWORK_PATH
+	                  DYLD_FALLBACK_LIBRARY_PATH DYLD_FRAMEWORK_PATH
+	                  DYLD_LIBRARY_PATH DYLD_INSERT_LIBRARIES
+	                  HOME JAVA_HOME LD_PREBIND
+	                  LD_PREBIND_ALLOW_OVERLAP MASTER_SITE_LOCAL
+	                  PATCH_SITE_LOCAL PATH PORTSRC RSYNC_PROXY TMP TMPDIR
+	                  USER GROUP
+	                  http_proxy HTTPS_PROXY FTP_PROXY ALL_PROXY NO_PROXY
+					}
+    if {[info exists extra_env]} {
+    	set keepenvkeys [concat ${keepenvkeys} ${extra_env}]
+    }
+	
+	foreach envkey [array names env] {
+		if {[lsearch $keepenvkeys $envkey] == -1} {
+			array unset env $envkey
+		}
+	}
+
+	if {![info exists xcodeversion] || ![info exists xcodebuildcmd]} {
+		# We'll resolve these later (if needed)
+		trace add variable darwinports::xcodeversion read darwinports::setxcodeinfo
+		trace add variable darwinports::xcodebuildcmd read darwinports::setxcodeinfo
+	}
+
+    # Set the default umask
+    if {![info exists destroot_umask]} {
+        set destroot_umask 022
+    }
+
+    if {[info exists master_site_local] && ![info exists env(MASTER_SITE_LOCAL)]} {
+	set env(MASTER_SITE_LOCAL) "$master_site_local"
+    }
+
+	# Prebinding. useful with MacOS X's ld, harmless elsewhere.
+	# With both variables, prebinding will always succeed but we might need
+	# to redo it.
+    if {![info exists env(LD_PREBIND)] && ![info exists env(LD_PREBIND_ALLOW_OVERLAP)]} {
+	set env(LD_PREBIND) "1"
+	set env(LD_PREBIND_ALLOW_OVERLAP) "1"
+    }
+
+    if {[file isdirectory $libpath]} {
+		lappend auto_path $libpath
+		set darwinports::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 darwinports1.0 API?
+		package require Pextlib 1.0
+		package require registry 1.0
+    } else {
+		return -code error "Library directory '$libpath' must exist"
+    }
+}
+
+proc darwinports::worker_init {workername portpath portbuildpath options variations} {
+    global darwinports::portinterp_options darwinports::portinterp_deferred_options registry.installtype
+
+	# Tell the sub interpreter about all the Tcl packages we already
+	# know about so it won't glob for packages.
+	foreach pkgName [package names] {
+		foreach pkgVers [package versions $pkgName] {
+			set pkgLoadScript [package ifneeded $pkgName $pkgVers]
+			$workername eval "package ifneeded $pkgName $pkgVers {$pkgLoadScript}"
+		}
+	}
+
+    # Create package require abstraction procedure
+    $workername eval "proc PortSystem \{version\} \{ \n\
+			package require port \$version \}"
+
+    # Clearly separate slave interpreters and the master interpreter.
+	$workername alias dport_exec dportexec
+	$workername alias dport_open dportopen
+	$workername alias dport_close dportclose
+	$workername alias dport_search dportsearch
+
+    # instantiate the UI call-backs
+	foreach priority ${darwinports::ui_priorities} {
+		$workername alias ui_$priority ui_$priority
+	}
+	$workername alias ui_prefix ui_prefix
+	$workername alias ui_channels ui_channels
+    
+    # Export some utility functions defined here.
+    $workername alias darwinports_create_thread darwinports::create_thread
+
+	# New Registry/Receipts stuff
+	$workername alias registry_new registry::new_entry
+	$workername alias registry_open registry::open_entry
+	$workername alias registry_write registry::write_entry
+	$workername alias registry_prop_store registry::property_store
+	$workername alias registry_prop_retr registry::property_retrieve
+	$workername alias registry_delete registry::delete_entry
+	$workername alias registry_exists registry::entry_exists
+	$workername alias registry_activate portimage::activate
+	$workername alias registry_deactivate portimage::deactivate
+	$workername alias registry_register_deps registry::register_dependencies
+	$workername alias registry_fileinfo_for_index registry::fileinfo_for_index
+	$workername alias registry_bulk_register_files registry::register_bulk_files
+	$workername alias registry_installed registry::installed
+	$workername alias registry_active registry::active
+
+	# deferred options processing.
+	$workername alias getoption darwinports::getoption
+
+    foreach opt $portinterp_options {
+		if {![info exists $opt]} {
+		    global darwinports::$opt
+		}
+        if {[info exists $opt]} {
+            $workername eval set system_options($opt) \{[set $opt]\}
+            $workername eval set $opt \{[set $opt]\}
+        }
+    }
+    
+	foreach opt $portinterp_deferred_options {
+		global darwinports::$opt
+		# define the trace hook.
+		$workername eval \
+			"proc trace_$opt {name1 name2 op} { \n\
+				trace remove variable ::$opt read ::trace_$opt \n\
+				global $opt \n\
+				set $opt \[getoption $opt\] \n\
+			}"
+		# next access will actually define the variable.
+		$workername eval "trace add variable ::$opt read ::trace_$opt"
+		# define some value now
+		$workername eval set $opt "?"
+	}		
+
+    foreach {opt val} $options {
+        $workername eval set user_options($opt) $val
+        $workername eval set $opt $val
+    }
+
+    foreach {var val} $variations {
+        $workername eval set variations($var) $val
+    }
+
+    if { [info exists registry.installtype] } {
+	    $workername eval set installtype ${registry.installtype}
+    }
+}
+
+# Create a thread with most configuration options set.
+# The newly created thread is sent portinterp_options vars and knows where to
+# find all packages we know.
+proc darwinports::create_thread {} {
+    package require Thread
+
+    global darwinports::portinterp_options
+
+	# Create the thread.
+	set result [thread::create -preserved {thread::wait}]
+
+	# Tell the thread about all the Tcl packages we already
+	# know about so it won't glob for packages.
+	foreach pkgName [package names] {
+		foreach pkgVers [package versions $pkgName] {
+			set pkgLoadScript [package ifneeded $pkgName $pkgVers]
+			thread::send -async $result "package ifneeded $pkgName $pkgVers {$pkgLoadScript}"
+		}
+	}
+
+	# inherit configuration variables.
+	thread::send -async $result "namespace eval darwinports {}"
+	foreach opt $portinterp_options {
+		if {![info exists $opt]} {
+			global darwinports::$opt
+		}
+        if {[info exists $opt]} {
+			thread::send -async $result "global darwinports::$opt"
+			set val [set darwinports::$opt]
+			thread::send -async $result "set darwinports::$opt \"$val\""
+		}
+	}
+	
+	return $result
+}
+
+proc darwinports::fetch_port {url} {
+    global darwinports::portdbpath tcl_platform
+    set fetchdir [file join $portdbpath portdirs]
+    set fetchfile [file tail $url]
+    if {[catch {file mkdir $fetchdir} result]} {
+        return -code error $result
+    }
+    if {![file writable $fetchdir]} {
+    	return -code error "Port remote fetch failed: You do not have permission to write to $fetchdir"
+    }
+    if {[catch {exec curl -L -s -S -o [file join $fetchdir $fetchfile] $url} result]} {
+        return -code error "Port remote fetch failed: $result"
+    }
+    if {[catch {cd $fetchdir} result]} {
+	return -code error $result
+    }
+    if {[catch {exec tar -zxf $fetchfile} result]} {
+	return -code error "Port extract failed: $result"
+    }
+    if {[regexp {(.+).tgz} $fetchfile match portdir] != 1} {
+        return -code error "Can't decipher portdir from $fetchfile"
+    }
+    return [file join $fetchdir $portdir]
+}
+
+proc darwinports::getprotocol {url} {
+    if {[regexp {(?x)([^:]+)://.+} $url match protocol] == 1} {
+        return ${protocol}
+    } else {
+        return -code error "Can't parse url $url"
+    }
+}
+
+# XXX: this really needs to be rethought in light of the remote index
+# I've added the destdir parameter.  This is the location a remotely
+# fetched port will be downloaded to (currently only applies to
+# dports:// sources).
+proc darwinports::getportdir {url {destdir "."}} {
+	if {[regexp {(?x)([^:]+)://(.+)} $url match protocol string] == 1} {
+		switch -regexp -- ${protocol} {
+			{^file$} {
+				return $string
+			}
+			{^dports$} {
+				return [darwinports::index::fetch_port $url $destdir]
+			}
+			{^https?$|^ftp$} {
+				return [darwinports::fetch_port $url]
+			}
+			default {
+				return -code error "Unsupported protocol $protocol"
+			}
+		}
+	} else {
+		return -code error "Can't parse url $url"
+	}
+}
+
+# dportopen
+# Opens a DarwinPorts portfile specified by a URL.  The portfile is
+# opened with the given list of options and variations.  The result
+# of this function should be treated as an opaque handle to a
+# DarwinPorts Portfile.
+
+proc dportopen {porturl {options ""} {variations ""} {nocache ""}} {
+    global darwinports::portdbpath darwinports::portconf darwinports::open_dports auto_path
+
+	# Look for an already-open DPort with the same URL.
+	# XXX: should compare options and variations here too.
+	# if found, return the existing reference and bump the refcount.
+	if {$nocache != ""} {
+		set dport {}
+	} else {
+		set dport [dlist_search $darwinports::open_dports porturl $porturl]
+	}
+	if {$dport != {}} {
+		set refcnt [ditem_key $dport refcnt]
+		incr refcnt
+		ditem_key $dport refcnt $refcnt
+		return $dport
+	}
+
+	array set options_array $options
+	if {[info exists options_array(portdir)]} {
+		set portdir $options_array(portdir)
+	} else {
+		set portdir ""
+	}
+
+	set portdir [darwinports::getportdir $porturl $portdir]
+	ui_debug "Changing to port directory: $portdir"
+	cd $portdir
+	set portpath [pwd]
+    if {![file isfile Portfile]} {
+        return -code error "Could not find Portfile in $portdir"
+    }
+
+	set workername [interp create]
+
+	set dport [ditem_create]
+	lappend darwinports::open_dports $dport
+	ditem_key $dport porturl $porturl
+	ditem_key $dport portpath $portpath
+	ditem_key $dport workername $workername
+	ditem_key $dport options $options
+	ditem_key $dport variations $variations
+	ditem_key $dport refcnt 1
+	
+    darwinports::worker_init $workername $portpath [darwinports::getportbuildpath $portpath] $options $variations
+
+    $workername eval source Portfile
+
+    ditem_key $dport provides [$workername eval return \$portname]
+
+    return $dport
+}
+
+# Traverse a directory with ports, calling a function on the path of ports
+# (at the second depth).
+# I.e. the structure of dir shall be:
+# category/port/
+# with a Portfile file in category/port/
+#
+# func:		function to call on every port directory (it is passed
+#			category/port/ as its parameter)
+# root:		the directory with all the categories directories.
+proc dporttraverse {func {root .}} {
+	# Save the current directory
+	set pwd [pwd]
+	
+	# Join the root.
+	set pathToRoot [file join $pwd $root]
+
+	# Go to root because some callers expects us to be there.
+	cd $pathToRoot
+
+    foreach category [lsort -increasing -unique [readdir $root]] {
+    	set pathToCategory [file join $root $category]
+        if {[file isdirectory $pathToCategory]} {
+        	# Iterate on port directories.
+			foreach port [lsort -increasing -unique [readdir $pathToCategory]] {
+				set pathToPort [file join $pathToCategory $port]
+				if {[file isdirectory $pathToPort] &&
+					[file exists [file join $pathToPort "Portfile"]]} {
+					# Call the function.
+					$func [file join $category $port]
+					
+					# Restore the current directory because some
+					# functions changes it.
+					cd $pathToRoot
+				}
+			}
+        }
+	}
+	
+	# Restore the current directory.
+	cd $pwd
+}
+
+### _dportsearchpath is private; subject to change without notice
+
+# depregex -> regex on the filename to find.
+# search_path -> directories to search
+# executable -> whether we want to check that the file is executable by current
+#				user or not.
+proc _dportsearchpath {depregex search_path {executable 0}} {
+    set found 0
+    foreach path $search_path {
+	if {![file isdirectory $path]} {
+	    continue
+	}
+
+	if {[catch {set filelist [readdir $path]} result]} {
+		return -code error "$result ($path)"
+		set filelist ""
+	}
+
+	foreach filename $filelist {
+	    if {[regexp $depregex $filename] &&
+	    	(($executable == 0) || [file executable [file join $path $filename]])} {
+		ui_debug "Found Dependency: path: $path filename: $filename regex: $depregex"
+		set found 1
+		break
+	    }
+	}
+    }
+    return $found
+}
+
+### _libtest is private; subject to change without notice
+# XXX - Architecture specific
+# XXX - Rely on information from internal defines in cctools/dyld:
+# define DEFAULT_FALLBACK_FRAMEWORK_PATH
+# /Library/Frameworks:/Library/Frameworks:/Network/Library/Frameworks:/System/Library/Frameworks
+# define DEFAULT_FALLBACK_LIBRARY_PATH /lib:/usr/local/lib:/lib:/usr/lib
+#   -- Since /usr/local is bad, using /lib:/usr/lib only.
+# Environment variables DYLD_FRAMEWORK_PATH, DYLD_LIBRARY_PATH,
+# DYLD_FALLBACK_FRAMEWORK_PATH, and DYLD_FALLBACK_LIBRARY_PATH take precedence
+
+proc _libtest {dport depspec} {
+    global env tcl_platform
+	set depline [lindex [split $depspec :] 1]
+	set prefix [_dportkey $dport prefix]
+	
+	if {[info exists env(DYLD_FRAMEWORK_PATH)]} {
+	    lappend search_path $env(DYLD_FRAMEWORK_PATH)
+	} else {
+	    lappend search_path /Library/Frameworks /Network/Library/Frameworks /System/Library/Frameworks
+	}
+	if {[info exists env(DYLD_FALLBACK_FRAMEWORK_PATH)]} {
+	    lappend search_path $env(DYLD_FALLBACK_FRAMEWORK_PATH)
+	}
+	if {[info exists env(DYLD_LIBRARY_PATH)]} {
+	    lappend search_path $env(DYLD_LIBRARY_PATH)
+	}
+	lappend search_path /lib /usr/lib /usr/X11R6/lib ${prefix}/lib
+	if {[info exists env(DYLD_FALLBACK_LIBRARY_PATH)]} {
+	    lappend search_path $env(DYLD_FALLBACK_LIBRARY_PATH)
+	}
+
+	set i [string first . $depline]
+	if {$i < 0} {set i [string length $depline]}
+	set depname [string range $depline 0 [expr $i - 1]]
+	set depversion [string range $depline $i end]
+	regsub {\.} $depversion {\.} depversion
+	if {$tcl_platform(os) == "Darwin"} {
+		set depregex \^${depname}${depversion}\\.dylib\$
+	} else {
+		set depregex \^${depname}\\.so${depversion}\$
+	}
+
+	return [_dportsearchpath $depregex $search_path]
+}
+
+### _bintest is private; subject to change without notice
+
+proc _bintest {dport depspec} {
+    global env
+	set depregex [lindex [split $depspec :] 1]
+	set prefix [_dportkey $dport prefix] 
+	
+	set search_path [split $env(PATH) :]
+	
+	set depregex \^$depregex\$
+	
+	return [_dportsearchpath $depregex $search_path 1]
+}
+
+### _pathtest is private; subject to change without notice
+
+proc _pathtest {dport depspec} {
+    global env
+	set depregex [lindex [split $depspec :] 1]
+	set prefix [_dportkey $dport prefix] 
+    
+	# separate directory from regex
+	set fullname $depregex
+
+	regexp {^(.*)/(.*?)$} "$fullname" match search_path depregex
+
+	if {[string index $search_path 0] != "/"} {
+		# Prepend prefix if not an absolute path
+		set search_path "${prefix}/${search_path}"
+	}
+
+	set depregex \^$depregex\$
+
+	return [_dportsearchpath $depregex $search_path]
+}
+
+### _porttest is private; subject to change without notice
+
+proc _porttest {dport depspec} {
+	# We don't actually look for the port, but just return false
+	# in order to let the dportdepends handle the dependency
+	return 0
+}
+
+### _dportinstalled is private; may change without notice
+
+# Determine if a port is already *installed*, as in "in the registry".
+proc _dportinstalled {dport} {
+	# Check for the presense of the port in the registry
+	set workername [ditem_key $dport workername]
+	set res [$workername eval registry_exists \${portname} \${portversion}]
+	if {$res != 0} {
+		ui_debug "[ditem_key $dport provides] is installed"
+		return 1
+	} else {
+		return 0
+	}
+}
+
+### _dportispresent is private; may change without notice
+
+# Determine if some depspec is satisfied or if the given port is installed.
+# We actually start with the registry (faster?)
+#
+# dport		the port to test (to figure out if it's present)
+# depspec	the dependency test specification (path, bin, lib, etc.)
+proc _dportispresent {dport depspec} {
+	# Check for the presense of the port in the registry
+	set workername [ditem_key $dport workername]
+	ui_debug "Searching for dependency: [ditem_key $dport provides]"
+	if {[catch {set reslist [$workername eval registry_installed \${portname}]} res]} {
+		set res 0
+	} else {
+		set res [llength $reslist]
+	}
+	if {$res != 0} {
+		ui_debug "Found Dependency: receipt exists for [ditem_key $dport provides]"
+		return 1
+	} else {
+		# The receipt test failed, use one of the depspec regex mechanisms
+		ui_debug "Didn't find receipt, going to depspec regex for: [ditem_key $dport provides]"
+		set type [lindex [split $depspec :] 0]
+		switch $type {
+			lib { return [_libtest $dport $depspec] }
+			bin { return [_bintest $dport $depspec] }
+			path { return [_pathtest $dport $depspec] }
+			port { return [_porttest $dport $depspec] }
+			default {return -code error "unknown depspec type: $type"}
+		}
+		return 0
+	}
+}
+
+### _dportexec is private; may change without notice
+
+proc _dportexec {target dport} {
+	# xxx: set the work path?
+	set workername [ditem_key $dport workername]
+	if {![catch {$workername eval eval_variants variations $target} result] && $result == 0 &&
+		![catch {$workername eval eval_targets $target} result] && $result == 0} {
+		# If auto-clean mode, clean-up after dependency install
+		if {[string equal ${darwinports::portautoclean} "yes"]} {
+			# Make sure we are back in the port path before clean
+			# otherwise if the current directory had been changed to
+			# inside the port,  the next port may fail when trying to
+			# install because [pwd] will return a "no file or directory"
+			# error since the directory it was in is now gone.
+			set portpath [ditem_key $dport portpath]
+			catch {cd $portpath}
+			$workername eval eval_targets clean
+		}
+		return 0
+	} else {
+		# An error occurred.
+		return 1
+	}
+}
+
+# dportexec
+# Execute the specified target of the given dport.
+
+proc dportexec {dport target} {
+    global darwinports::registry.installtype
+
+	set workername [ditem_key $dport workername]
+
+	# XXX: move this into dportopen?
+	if {[$workername eval eval_variants variations $target] != 0} {
+		return 1
+	}
+	
+	# Before we build the port, we must build its dependencies.
+	# XXX: need a more general way of comparing against targets
+	set dlist {}
+	if {$target == "package"} {
+		ui_warn "package target replaced by pkg target, please use the pkg target in the future."
+		set target "pkg"
+	}
+	if {$target == "configure" || $target == "build"
+		|| $target == "test"
+		|| $target == "destroot" || $target == "install"
+		|| $target == "archive"
+		|| $target == "pkg" || $target == "mpkg"
+		|| $target == "rpmpackage" || $target == "dpkg" } {
+
+		if {[dportdepends $dport $target] != 0} {
+			return 1
+		}
+		
+		# Select out the dependents along the critical path,
+		# but exclude this dport, we might not be installing it.
+		set dlist [dlist_append_dependents $darwinports::open_dports $dport {}]
+		
+		dlist_delete dlist $dport
+
+		# install them
+		# xxx: as with below, this is ugly.  and deps need to be fixed to
+		# understand Port Images before this can get prettier
+		if { [string equal ${darwinports::registry.installtype} "image"] } {
+			set result [dlist_eval $dlist _dportinstalled [list _dportexec "activate"]]
+		} else {
+			set result [dlist_eval $dlist _dportinstalled [list _dportexec "install"]]
+		}
+		
+		if {$result != {}} {
+			set errstring "The following dependencies failed to build:"
+			foreach ditem $result {
+				append errstring " [ditem_key $ditem provides]"
+			}
+			ui_error $errstring
+			return 1
+		}
+		
+		# Close the dependencies, we're done installing them.
+		foreach ditem $dlist {
+			dportclose $ditem
+		}
+	}
+
+	# If we're doing an install, check if we should clean after
+	set clean 0
+	if {[string equal ${darwinports::portautoclean} "yes"] && [string equal $target "install"] } {
+		set clean 1
+	}
+
+	# If we're doing image installs, then we should activate after install
+	# xxx: This isn't pretty
+	if { [string equal ${darwinports::registry.installtype} "image"] && [string equal $target "install"] } {
+		set target activate
+	}
+	
+	# Build this port with the specified target
+	set result [$workername eval eval_targets $target]
+
+	# If auto-clean mode and successful install, clean-up after install
+	if {$result == 0 && $clean == 1} {
+		# Make sure we are back in the port path, just in case
+		set portpath [ditem_key $dport portpath]
+		catch {cd $portpath}
+		$workername eval eval_targets clean
+	}
+
+	return $result
+}
+
+proc darwinports::getsourcepath {url} {
+	global darwinports::portdbpath
+	regsub {://} $url {.} source_path
+	regsub -all {/} $source_path {_} source_path
+	return [file join $portdbpath sources $source_path]
+}
+
+proc darwinports::getportbuildpath {id} {
+	global darwinports::portdbpath
+	regsub {://} $id {.} port_path
+	regsub -all {/} $port_path {_} port_path
+	return [file join $portdbpath build $port_path]
+}
+
+proc darwinports::getindex {source} {
+	# Special case file:// sources
+	if {[darwinports::getprotocol $source] == "file"} {
+		return [file join [darwinports::getportdir $source] PortIndex]
+	}
+
+	return [file join [darwinports::getsourcepath $source] PortIndex]
+}
+
+proc dportsync {args} {
+	global darwinports::sources darwinports::portdbpath tcl_platform
+	global darwinports::autoconf::rsync_path
+
+	foreach source $sources {
+		ui_info "Synchronizing from $source"
+		switch -regexp -- [darwinports::getprotocol $source] {
+			{^file$} {
+			    set portdir [darwinports::getportdir $source]
+				if {[file exists $portdir/.svn]} {
+				    if {[catch {set svncmd [darwinports::binaryInPath "svn"]}] == 0} {
+				        set svn_commandline "${svncmd} update --non-interactive \"${portdir}\""
+				        ui_debug $svn_commandline
+				        if {[catch {system $svn_commandline}]} {
+				            return -code error "sync failed doing svn update"
+				        }
+				        if {[catch {system "chmod -R a+r \"${portdir}\""}]} {
+				            ui_warn "Setting world read permissions on parts of the ports tree failed, need root?"
+				        }
+				    } else {
+				        return -code error "svn command not found"
+				    }
+				}
+			}
+			{^dports$} {
+				darwinports::index::sync $darwinports::portdbpath $source
+			}
+			{^rsync$} {
+				# Where to, boss?
+				set destdir [file dirname [darwinports::getindex $source]]
+
+				if {[catch {file mkdir $destdir} result]} {
+					return -code error $result
+				}
+
+				# Keep rsync happy with a trailing slash
+				if {[string index $source end] != "/"} {
+					set source "${source}/"
+				}
+
+				# Do rsync fetch
+				if {[catch {system "${darwinports::autoconf::rsync_path} -rtzv --delete-after --delete \"$source\" \"$destdir\""}]} {
+					return -code error "sync failed doing rsync"
+				}
+				if {[catch {system "chmod -R a+r \"$destdir\""}]} {
+				    ui_warn "Setting world read permissions on parts of the ports tree failed, need root?"
+				}
+			}
+			{^https?$|^ftp$} {
+				set indexfile [darwinports::getindex $source]
+				if {[catch {file mkdir [file dirname $indexfile]} result]} {
+					return -code error $result
+				}
+				exec curl -L -s -S -o $indexfile $source/PortIndex
+			}
+		}
+	}
+}
+
+proc dportsearch {pattern {case_sensitive yes} {matchstyle regexp} {field name}} {
+	global darwinports::portdbpath darwinports::sources
+	set matches [list]
+	set easy [expr { $field == "name" }]
+	
+	set found 0
+	foreach source $sources {
+		if {[darwinports::getprotocol $source] == "dports"} {
+			array set attrs [list name $pattern]
+			set res [darwinports::index::search $darwinports::portdbpath $source [array get attrs]]
+			eval lappend matches $res
+		} else {
+			if {[catch {set fd [open [darwinports::getindex $source] r]} result]} {
+				ui_warn "Can't open index file for source: $source"
+			} else {
+				incr found 1
+				while {[gets $fd line] >= 0} {
+					array unset portinfo
+					set name [lindex $line 0]
+					gets $fd line
+					
+					if {$easy} {
+						set target $name
+					} else {
+						array set portinfo $line
+						if {![info exists portinfo($field)]} continue
+						set target $portinfo($field)
+					}
+					
+					switch $matchstyle {
+						exact	{ set matchres [expr 0 == ( {$case_sensitive == "yes"} ? [string compare $pattern $target] : [string compare -nocase $pattern $target] )] }
+						glob	{ set matchres [expr {$case_sensitive == "yes"} ? [string match $pattern $target] : [string match -nocase $pattern $target]] }
+						regexp	-
+						default	{ set matchres [expr {$case_sensitive == "yes"} ? [regexp -- $pattern $target] : [regexp -nocase -- $pattern $target]] }
+					}
+					
+					if {$matchres == 1} {
+						if {$easy} {
+							array set portinfo $line
+						}
+						switch -regexp -- [darwinports::getprotocol ${source}] {
+							{^rsync$} {
+								# Rsync files are local
+								set source_url "file://[darwinports::getsourcepath $source]"
+							}
+							default {
+								set source_url $source
+							}
+						}
+						if {[info exists portinfo(portarchive)]} {
+							set porturl ${source_url}/$portinfo(portarchive)
+						} elseif {[info exists portinfo(portdir)]} {
+							set porturl ${source_url}/$portinfo(portdir)
+						}
+						if {[info exists porturl]} {
+							lappend line porturl $porturl
+							ui_debug "Found port in $porturl"
+						} else {
+							ui_debug "Found port info: $line"
+						}
+						lappend matches $name
+						lappend matches $line
+					}
+				}
+				close $fd
+			}
+		}
+	}
+	if {!$found} {
+		return -code error "No index(es) found! Have you synced your source indexes?"
+	}
+
+	return $matches
+}
+
+proc dportinfo {dport} {
+	set workername [ditem_key $dport workername]
+    return [$workername eval array get PortInfo]
+}
+
+proc dportclose {dport} {
+	global darwinports::open_dports
+	set refcnt [ditem_key $dport refcnt]
+	incr refcnt -1
+	ditem_key $dport refcnt $refcnt
+	if {$refcnt == 0} {
+		dlist_delete darwinports::open_dports $dport
+		set workername [ditem_key $dport workername]
+		interp delete $workername
+	}
+}
+
+##### Private Depspec API #####
+# This API should be considered work in progress and subject to change without notice.
+##### "
+
+# _dportkey
+# - returns a variable from the port's interpreter
+
+proc _dportkey {dport key} {
+	set workername [ditem_key $dport workername]
+	return [$workername eval "return \$${key}"]
+}
+
+# dportdepends builds the list of dports which the given port depends on.
+# This list is added to $dport.
+# This list actually depends on the target.
+# This method can optionally recurse through the dependencies, looking for
+#   dependencies of dependencies.
+# This method can optionally cut the search when ports are already installed or
+#   the dependencies are satisfied.
+#
+# dport -> dport item
+# target -> target to consider the dependency for
+# recurseDeps -> if the search should be recursive
+# skipSatisfied -> cut the search tree when encountering installed/satisfied
+#                  dependencies ports.
+# accDeps -> accumulator for recursive calls
+# return 0 if everything was ok, an non zero integer otherwise.
+proc dportdepends {dport {target ""} {recurseDeps 1} {skipSatisfied 1} {accDeps {}}} {
+
+	array set portinfo [dportinfo $dport]
+	set depends {}
+	set deptypes {}
+		
+	# Determine deptypes to look for based on target
+	switch $target {
+		configure	{ set deptypes "depends_lib" }
+		
+		build		{ set deptypes "depends_lib depends_build" }
+		
+		test		-
+		destroot	-
+		install		-
+		archive		-
+		pkg			-
+		mpkg		-
+		rpmpackage	-
+		dpkg		-
+		""			{ set deptypes "depends_lib depends_build depends_run" }
+	}
+	
+	# Gather the dependencies for deptypes
+	foreach deptype $deptypes {
+		# Add to the list of dependencies if the option exists and isn't empty.
+		if {[info exists portinfo($deptype)] && $portinfo($deptype) != ""} {
+			set depends [concat $depends $portinfo($deptype)]
+		}
+	}
+
+	set subPorts {}
+	
+	foreach depspec $depends {
+		# grab the portname portion of the depspec
+		set dep_portname [lindex [split $depspec :] end]
+		
+		# Find the porturl
+		if {[catch {set res [dportsearch $dep_portname false exact]} error]} {
+			global errorInfo
+			ui_debug "$errorInfo"
+			ui_error "Internal error: port search failed: $error"
+			return 1
+		}
+		foreach {name array} $res {
+			array set portinfo $array
+			if {[info exists portinfo(porturl)]} {
+				set porturl $portinfo(porturl)
+				break
+			}
+		}
+
+		if {![info exists porturl]} {
+			ui_error "Dependency '$dep_portname' not found."
+			return 1
+		}
+
+		set options [ditem_key $dport options]
+		set variations [ditem_key $dport variations]
+
+		# Figure out the subport.	
+		set subport [dportopen $porturl $options $variations]
+
+		# Is that dependency satisfied or this port installed?
+		# If we don't skip or if it is not, add it to the list.
+		if {!$skipSatisfied || ![_dportispresent $subport $depspec]} {
+			# Append the sub-port's provides to the port's requirements list.
+			ditem_append_unique $dport requires "[ditem_key $subport provides]"
+	
+			if {$recurseDeps} {
+				# Skip the port if it's already in the accumulated list.
+				if {[lsearch $accDeps $dep_portname] == -1} {
+					# Add it to the list
+					lappend accDeps $dep_portname
+				
+					# We'll recursively iterate on it.
+					lappend subPorts $subport
+				}
+			}
+		}
+	}
+
+	# Loop on the subports.
+	if {$recurseDeps} {
+		foreach subport $subPorts {
+			# Sub ports should be installed (all dependencies must be satisfied).
+			set res [dportdepends $subport "" $recurseDeps $skipSatisfied $accDeps]
+			if {$res != 0} {
+				return $res
+			}
+		}
+	}
+	
+	return 0
+}
+
+# selfupdate procedure
+proc darwinports::selfupdate {optionslist} {
+	global darwinports::prefix darwinports::rsync_server darwinports::rsync_dir darwinports::rsync_options
+	global darwinports::autoconf::rsync_path
+	array set options $optionslist
+	
+	if { [info exists options(ports_force)] && $options(ports_force) == "yes" } {
+		set use_the_force_luke yes
+		ui_debug "Forcing a rebuild of the MacPorts base system."
+	} else {
+		set use_the_force_luke no
+		ui_debug "Rebuilding the MacPorts base system if needed."
+	}
+	# syncing ports tree. We expect the user have rsync:// in the sources.conf
+	if {[catch {dportsync} result]} {
+		return -code error "Couldn't sync dports tree: $result"
+	}
+
+	set dp_base_path [file join $prefix var/db/dports/sources/rsync.${rsync_server}_${rsync_dir}/]
+	if {![file exists $dp_base_path]} {
+		file mkdir $dp_base_path
+	}
+	ui_debug "MacPorts base dir: $dp_base_path"
+
+	# get user of the darwinports system
+	set user [file attributes [file join $prefix var/db/dports/sources/] -owner]
+	ui_debug "Setting user: $user"
+
+	# get darwinports version 
+	set dp_version_path [file join ${prefix}/etc/ports/ dp_version]
+	if { [file exists $dp_version_path]} {
+		set fd [open $dp_version_path r]
+		gets $fd dp_version_old
+		close $fd
+	} else {
+		set dp_version_old 0
+	}
+	ui_msg "DarwinPorts base version $dp_version_old installed"
+
+	ui_debug "Updating using rsync"
+	if { [catch { system "${darwinports::autoconf::rsync_path} $rsync_options rsync://${rsync_server}/${rsync_dir} $dp_base_path" } ] } {
+		return -code error "Error: rsync failed in selfupdate"
+	}
+
+	# get downloaded darwinports version and write the old version back
+	set fd [open [file join $dp_base_path config/dp_version] r]
+	gets $fd dp_version_new
+	close $fd
+	ui_msg "Downloaded MacPorts base version $dp_version_new"
+
+	# check if we we need to rebuild base
+	if {$dp_version_new > $dp_version_old || $use_the_force_luke == "yes"} {
+		ui_msg "Configuring, Building and Installing new MacPorts base"
+		# check if $prefix/bin/port is writable, if so we go !
+		# get installation user / group 
+		set owner root
+		set group admin
+		if {[file exists [file join $prefix bin/port] ]} {
+			# set owner
+			set owner [file attributes [file join $prefix bin/port] -owner]
+			# set group
+			set group [file attributes [file join $prefix bin/port] -group]
+		}
+		set p_user [exec /usr/bin/whoami]
+		if {[file writable ${prefix}/bin/port] || [string equal $p_user $owner] } {
+			ui_debug "permissions OK"
+		} else {
+			return -code error "Error: $p_user cannot write to ${prefix}/bin - try using sudo"
+		}
+		ui_debug "Setting owner: $owner group: $group"
+
+		set dp_tclpackage_path [file join $prefix var/db/dports/ .tclpackage]
+		if { [file exists $dp_tclpackage_path]} {
+			set fd [open $dp_tclpackage_path r]
+			gets $fd tclpackage
+			close $fd
+		} else {
+			set tclpackage [file join ${prefix} share/darwinports/Tcl]
+		}
+		# do the actual installation of new base
+		ui_debug "Install in: $prefix as $owner : $group - TCL-PACKAGE in $tclpackage"
+		if { [catch { system "cd $dp_base_path && ./configure --prefix=$prefix --with-install-user=$owner --with-install-group=$group --with-tclpackage=$tclpackage && make && make install" } result] } {
+			return -code error "Error installing new MacPorts base: $result"
+		}
+	} else {
+		ui_msg "The MacPorts installation is not outdated and so was not updated"
+	}
+
+	# set the darwinports system to the right owner 
+	ui_debug "Setting ownership to $user"
+	if { [catch { exec chown -R $user [file join $prefix var/db/dports/sources/] } result] } {
+		return -code error "Couldn't change permissions: $result"
+	}
+
+	# set the right version
+	ui_msg "selfupdate done!"
+
+	return 0
+}
+
+proc darwinports::version {} {
+	global darwinports::prefix darwinports::rsync_server darwinports::rsync_dir
+	
+	set dp_version_path [file join $prefix etc/ports/ dp_version]
+
+	if [file exists $dp_version_path] {
+		set fd [open $dp_version_path r]
+		gets $fd retval
+		return $retval
+	} else {
+		return -1
+	}
+}
+
+# upgrade procedure
+proc darwinports::upgrade {portname dspec variationslist optionslist {depscachename ""}} {
+	global darwinports::registry.installtype
+	global darwinports::portarchivemode
+	array set options $optionslist
+	array set variations $variationslist
+	if {![string match "" $depscachename]} {
+		upvar $depscachename depscache
+	} 
+
+	# set to no-zero is epoch overrides version
+	set epoch_override 0
+
+	# check if the port is in tree
+	if {[catch {dportsearch $portname false exact} result]} {
+		global errorInfo
+		ui_debug "$errorInfo"
+		ui_error "port search failed: $result"
+		return 1
+	}
+	# argh! port doesnt exist!
+	if {$result == ""} {
+		ui_error "No port $portname found."
+		return 1
+	}
+	# fill array with information
+	array set portinfo [lindex $result 1]
+
+	# set version_in_tree
+	if {![info exists portinfo(version)]} {
+		ui_error "Invalid port entry for $portname, missing version"
+		return 1
+	}
+	set version_in_tree "$portinfo(version)_$portinfo(revision)"
+	set epoch_in_tree "$portinfo(epoch)"
+
+	# the depflag tells us if we should follow deps (this is for stuff installed outside DP)
+	# if this is set (not 0) we dont follow the deps
+	set depflag 0
+
+	# set version_installed
+	set ilist {}
+	if { [catch {set ilist [registry::installed $portname ""]} result] } {
+		if {$result == "Registry error: $portname not registered as installed." } {
+			ui_debug "$portname is *not* installed by DarwinPorts"
+			# open porthandle    
+			set porturl $portinfo(porturl)
+		    if {![info exists porturl]} {
+		        set porturl file://./    
+			}    
+			if {[catch {set workername [dportopen $porturl [array get options] ]} result]} {
+					global errorInfo
+					ui_debug "$errorInfo"
+			        ui_error "Unable to open port: $result"        
+					return 1
+		    }
+
+			if {![_dportispresent $workername $dspec ] } {
+				# port in not installed - install it!
+				if {[catch {set result [dportexec $workername install]} result]} {
+					global errorInfo
+					ui_debug "$errorInfo"
+					ui_error "Unable to exec port: $result"
+					return 1
+				}
+			} else {
+				# port installed outside DP
+				ui_debug "$portname installed outside the MacPorts system"
+				set depflag 1
+			}
+
+		} else {
+			ui_error "Checking installed version failed: $result"
+			exit 1
+		}
+	}
+	set anyactive 0
+	set version_installed 0
+	set epoch_installed 0
+	if {$ilist == ""} {
+		# XXX  this sets $version_installed to $version_in_tree even if not installed!!
+		set version_installed $version_in_tree
+		# That was a very dirty hack showing how ugly our depencendy and upgrade code is.
+		# To get it working when user provides -f, we also need to set the variant to
+		# avoid a future failure.
+		set variant ""
+	} else {
+		# a port could be installed but not activated
+		# so, deactivate all and save newest for activation later
+		set num 0
+		set variant ""
+		foreach i $ilist {
+			set variant [lindex $i 3]
+			set version "[lindex $i 1]_[lindex $i 2]"
+			if { [rpm-vercomp $version $version_installed] > 0} {
+				set version_installed $version
+				set epoch_installed [registry::property_retrieve [registry::open_entry $portname [lindex $i 1] [lindex $i 2] $variant] epoch]
+				set num $i
+			}
+
+			set isactive [lindex $i 4]
+			if {$isactive == 1 && [rpm-vercomp $version_installed $version] < 0 } {
+				# deactivate version
+    			if {[catch {portimage::deactivate $portname $version $optionslist} result]} {
+					global errorInfo
+					ui_debug "$errorInfo"
+    	    		ui_error "Deactivating $portname $version_installed failed: $result"
+    	    		return 1
+    			}
+			}
+		}
+        if { [lindex $num 4] == 0 && 0 == [string compare "image" ${darwinports::registry.installtype}] } {
+			# activate the latest installed version
+			if {[catch {portimage::activate $portname $version_installed$variant $optionslist} result]} {
+				global errorInfo
+				ui_debug "$errorInfo"
+    			ui_error "Activating $portname $version_installed failed: $result"
+				return 1
+			}
+		}
+	}
+
+	# output version numbers
+	ui_debug "epoch: in tree: $epoch_in_tree installed: $epoch_installed"
+	ui_debug "$portname $version_in_tree exists in the ports tree"
+	ui_debug "$portname $version_installed is installed"
+
+	# set the nodeps option  
+	if {![info exists options(ports_nodeps)]} {
+		set nodeps no
+	} else {	
+		set nodeps yes
+	}
+
+	if {$nodeps == "yes" || $depflag == 1} {
+		ui_debug "Not following dependencies"
+		set depflag 0
+	} else {
+		# build depends is upgraded
+		if {[info exists portinfo(depends_build)]} {
+			foreach i $portinfo(depends_build) {
+				if {![llength [array get depscache $i]]} {
+				set d [lindex [split $i :] end]
+					set depscache($i) 1
+					upgrade $d $i $variationslist $optionslist depscache
+				} 
+			}
+		}
+		# library depends is upgraded
+		if {[info exists portinfo(depends_lib)]} {
+			foreach i $portinfo(depends_lib) {
+				if {![llength [array get depscache $i]]} {
+				set d [lindex [split $i :] end]
+					set depscache($i) 1
+					upgrade $d $i $variationslist $optionslist depscache
+				} 
+			}
+		}
+		# runtime depends is upgraded
+		if {[info exists portinfo(depends_run)]} {
+			foreach i $portinfo(depends_run) {
+				if {![llength [array get depscache $i]]} {
+				set d [lindex [split $i :] end]
+					set depscache($i) 1
+					upgrade $d $i $variationslist $optionslist depscache
+				} 
+			}
+		}
+	}
+
+	# check installed version against version in ports
+	if { [rpm-vercomp $version_installed $version_in_tree] >= 0 && ![info exists options(ports_force)] } {
+		ui_debug "No need to upgrade! $portname $version_installed >= $portname $version_in_tree"
+		if { $epoch_installed >= $epoch_in_tree } {
+			# Check if we have to do dependents
+			if {[info exists options(ports_do_dependents)]} {
+				# We do dependents ..
+				set options(ports_nodeps) 1
+
+				registry::open_dep_map
+	   			set deplist [registry::list_dependents $portname]
+
+				if { [llength deplist] > 0 } {
+					foreach dep $deplist {
+						set dpname [lindex $dep 2] 
+						darwinports::upgrade $dpname "port:$dpname" [array get variations] [array get options]
+					}
+				}
+			}
+
+			return 0
+		} else {
+			ui_debug "epoch override ... upgrading!"
+			set epoch_override 1
+		}
+	}
+
+	# open porthandle
+	set porturl $portinfo(porturl)
+	if {![info exists porturl]} {
+		set porturl file://./
+	}
+
+	# check if the variants is present in $version_in_tree
+	set oldvariant $variant
+	set variant [split $variant +]
+	ui_debug "variants to install $variant"
+	if {[info exists portinfo(variants)]} {
+		set avariants $portinfo(variants)
+	} else {
+		set avariants {}
+	}
+	ui_debug "available variants are : $avariants"
+	foreach v $variant {
+		if {[lsearch $avariants $v] == -1} {
+		} else {
+			ui_debug "variant $v is present in $portname $version_in_tree"
+			set variations($v) "+"
+		}
+	}
+	ui_debug "new portvariants: [array get variations]"
+	
+	if {[catch {set workername [dportopen $porturl [array get options] [array get variations]]} result]} {
+		global errorInfo
+		ui_debug "$errorInfo"
+		ui_error "Unable to open port: $result"
+		return 1
+	}
+
+	# install version_in_tree
+	if {0 == [string compare "yes" ${darwinports::portarchivemode}]} {
+		set upgrade_action "archive"
+	} else {
+		set upgrade_action "destroot"
+	}
+
+	if {[catch {set result [dportexec $workername $upgrade_action]} result] || $result != 0} {
+		global errorInfo
+		ui_debug "$errorInfo"
+		ui_error "Unable to upgrade port: $result"
+		return 1
+	}
+
+	# uninstall old ports
+    if {[info exists options(port_uninstall_old)] || $epoch_override == 1 || [info exists options(ports_force)] || 0 != [string compare "image" ${darwinports::registry.installtype}] } {
+		# uninstall old
+		ui_debug "Uninstalling $portname $version_installed$oldvariant"
+		if {[catch {portuninstall::uninstall $portname $version_installed$oldvariant $optionslist} result]} {
+			global errorInfo
+			ui_debug "$errorInfo"
+     		ui_error "Uninstall $portname $version_installed$oldvariant failed: $result"
+       		return 1
+    	}
+	} else {
+		# XXX deactivate version_installed
+		if {[catch {portimage::deactivate $portname $version_installed$oldvariant $optionslist} result]} {
+			global errorInfo
+			ui_debug "$errorInfo"
+			ui_error "Deactivating $portname $version_installed failed: $result"
+			return 1
+		}
+	}
+
+	if {[catch {set result [dportexec $workername install]} result]} {
+		global errorInfo
+		ui_debug "$errorInfo"
+		ui_error "Couldn't activate $portname $version_in_tree$oldvariant: $result"
+		return 1
+	}
+
+	# Check if we have to do dependents
+	if {[info exists options(ports_do_dependents)]} {
+		# We do dependents ..
+		set options(ports_nodeps) 1
+
+		registry::open_dep_map
+	   	set deplist [registry::list_dependents $portname]
+
+		if { [llength deplist] > 0 } {
+			foreach dep $deplist {
+				set dpname [lindex $dep 2] 
+				darwinports::upgrade $dpname "port:$dpname" [array get variations] [array get options]
+			}
+		}
+	}
+
+	
+	# close the port handle
+	dportclose $workername
+}

Copied: branches/dp2mp-move/base/src/macports1.0/macports_autoconf.tcl.in (from rev 24452, trunk/base/src/darwinports1.0/darwinports_autoconf.tcl.in)
===================================================================
--- branches/dp2mp-move/base/src/macports1.0/macports_autoconf.tcl.in	                        (rev 0)
+++ branches/dp2mp-move/base/src/macports1.0/macports_autoconf.tcl.in	2007-04-24 17:28:16 UTC (rev 24454)
@@ -0,0 +1,36 @@
+# darwinports-autoconf.tcl.in
+# $Id$
+#
+# Copyright (c) 2002 - 2003 Apple Computer, Inc.
+# 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 Apple Computer, 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
+# 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 darwinports 1.0
+
+namespace eval darwinports::autoconf {
+	variable dports_conf_path "@PORTCONFIGDIR_EXPANDED@"
+	variable rsync_path "@RSYNC@"
+}

Copied: branches/dp2mp-move/base/src/macports1.0/macports_dlist.tcl (from rev 24452, trunk/base/src/darwinports1.0/darwinports_dlist.tcl)
===================================================================
--- branches/dp2mp-move/base/src/macports1.0/macports_dlist.tcl	                        (rev 0)
+++ branches/dp2mp-move/base/src/macports1.0/macports_dlist.tcl	2007-04-24 17:28:16 UTC (rev 24454)
@@ -0,0 +1,393 @@
+# darwinports1.0/darwinports_dlist.tcl
+# $Id$
+#
+# Copyright (c) 2003 Kevin Van Vechten <kevin at opendarwin.org>
+# Copyright (c) 2002 Apple Computer, Inc.
+# 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 Apple Computer, 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
+# 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 darwinports_dlist 1.0
+
+# dependency dependency list evaluation package
+#
+# This package provides a generic mechanism for managing a list of
+# dependencies.  The basic model is that each dependency item
+# contains a list of tokens it Requires and tokens it Provides.
+# A dependency is selected once all of the tokens it Requires have
+# been provided by another dependency, or if a dependency has no
+# requirements.
+
+# Conceptually a dlist is an ordered list of ditem elements.
+# The order perserves the dependency hierarchy.
+
+# A dlist is an ordinary TCL list.
+# A ditem should be created with the [ditem_create] procedure,
+# and treated as an opaque reference.
+# A statusdict is an ordinary TCL array, though darwinports_dlist
+# should be given complete domain over its contents.
+# XXX: should statusdict and dlist be part of a ditem tuple?
+# Values in the status dict will be {-1, 0, 1} for {failure,
+# pending, success} respectively.
+
+# 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
+
+proc dlist_search {dlist key value} {
+	set result {}
+	foreach ditem $dlist {
+		if {[ditem_contains $ditem $key $value]} {
+			lappend result $ditem
+		}
+	}
+	return $result
+}
+
+# dlist_delete
+# Deletes the specified ditem from the dlist.
+#	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} {
+		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
+
+proc dlist_has_pending {dlist tokens} {
+	foreach token $tokens {
+		if {[llength [dlist_search $dlist provides $token]] > 0} {
+			return 1
+		}
+	}
+	return 0
+}
+
+# dlist_count_unmet
+# Returns the total number of unmet dependencies in
+# the list of tokens.  If the tokens are in the status
+# dictionary with a successful result code, they are 
+# considered met.
+proc dlist_count_unmet {dlist statusdict tokens} {
+	upvar $statusdict upstatus
+	set result 0
+	foreach token $tokens {
+		if {[info exists upstatus($token)] &&
+			$upstatus($token) == 1} {
+			continue
+		} else {
+			incr result
+		}
+	}
+	return $result
+}
+
+# ditem_create
+# Create a new array in the darwinports_dlist namespace
+# returns the name of the array.  This should be used as
+# the ditem handle.
+
+proc ditem_create {} {
+	return [darwinports_dlist::ditem_create]
+}
+
+# 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
+
+proc ditem_key {ditem args} {
+	set nbargs [llength $args]
+	if {$nbargs > 1} {
+		return [darwinports_dlist::ditem_key $ditem [lindex $args 0] [lindex $args 1]]
+	} elseif {$nbargs == 1} {
+		return [darwinports_dlist::ditem_key $ditem [lindex $args 0]]
+	} else {
+		return [darwinports_dlist::ditem_key $ditem]
+	}
+}
+
+# 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
+
+proc ditem_append {ditem key args} {
+	eval "return \[darwinports_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
+
+proc ditem_append_unique {ditem key args} {
+	eval "return \[darwinports_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
+proc ditem_contains {ditem key args} {
+	eval "return \[darwinports_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.
+
+proc dlist_append_dependents {dlist ditem result} {
+	# Only append things if the root item is not in the list.
+	# (otherwise, it means we already did this sub-graph)
+	if {[lsearch $result $ditem] == -1} {
+		lappend result $ditem
+
+		# Recursively append any hard dependencies.
+		foreach token [ditem_key $ditem requires] {
+			foreach provider [dlist_search $dlist provides $token] {
+				set result [dlist_append_dependents $dlist $provider $result]
+			}
+		}
+		# XXX: add soft-dependencies?
+	}
+	return $result
+}
+
+# dlist_get_next
+# Returns the any eligible item from the dependency list.
+# Eligibility is a function of the ditems in the list and
+# the status dictionary.  A ditem is eligible when all of
+# the services it Requires are present in the status
+# dictionary with a successful result code.
+#
+# Notes: this implementation of get next defers items based
+# 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.
+
+proc dlist_get_next {dlist statusdict} {
+	upvar $statusdict upstatus
+	set nextitem {}
+	
+	# arbitrary large number ~ INT_MAX
+	set minfailed 2000000000
+	
+	foreach ditem $dlist {
+		# Skip if the ditem has unsatisfied hard dependencies
+		if {[dlist_count_unmet $dlist upstatus [ditem_key $ditem requires]]} {
+			continue
+		}
+		
+		# We will favor the ditem with the fewest unmet soft dependencies
+		set unmet [dlist_count_unmet $dlist upstatus [ditem_key $ditem uses]]
+		
+		# Delay items with unment soft dependencies that can eventually be met
+		if {$unmet > 0 && [dlist_has_pending $dlist [ditem_key $ditem uses]]} {
+			continue
+		}
+		
+		if {$unmet >= $minfailed} {
+			# not better than the last pick
+			continue
+		} else {
+			# better than the last pick (fewer unmet soft deps)
+			set minfailed $unmet
+			set nextitem $ditem
+		}
+	}
+	return $nextitem
+}
+
+# dlist_eval
+# Evaluate the dlist, select each eligible ditem according to
+# the optional selector argument (the default selector is 
+# dlist_get_next).  The specified handler is then invoked on
+# each ditem in the order they are selected.  When no more
+# 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
+
+proc dlist_eval {dlist testcond handler {canfail "0"} {selector "dlist_get_next"}} {
+	array set statusdict [list]
+	
+	# Do a pre-run seeing if any items automagically
+	# can evaluate to true.
+	if {$testcond != ""} {
+		foreach ditem $dlist {
+			if {[eval "expr \[\$testcond \$ditem\] == 1"]} {
+				foreach token [ditem_key $ditem provides] {
+					set statusdict($token) 1
+				}
+				dlist_delete dlist $ditem
+			}
+		}
+	}
+	
+	# Loop for as long as there are ditems in the dlist.
+	while {1} {
+		set ditem [$selector $dlist statusdict]
+		
+		if {$ditem == {}} {
+			break
+		} else {
+			# $handler should return a unix status code, 0 for success.
+			# statusdict notation is 1 for success
+			if {[catch {eval "$handler $ditem"} result]} {
+				puts $result
+				return $dlist
+			}
+			# No news is good news at this point.
+			if {$result == {}} { set result 0 }
+			
+			foreach token [ditem_key $ditem provides] {
+				set statusdict($token) [expr $result == 0]
+			}
+			
+			# Abort if we're not allowed to fail
+			if {$canfail == 0 && $result != 0} {
+				return $dlist
+			}
+			
+			# Delete the ditem from the waiting list.
+			dlist_delete dlist $ditem
+		}
+	}
+	
+	# Return the list of lusers
+	return $dlist
+}
+
+
+##### Private API #####
+# Anything below this point is subject to change without notice.
+#####
+
+# Each ditem is actually an array in the darwinports_dlist
+# namespace.  ditem keys correspond to the equivalent array
+# key.  A dlist is simply a list of names of ditem arrays.
+# All private API functions exist in the darwinports_dlist
+# namespace.
+
+namespace eval darwinports_dlist {
+
+variable ditem_uniqid 0
+
+proc ditem_create {} {
+	variable ditem_uniqid
+	incr ditem_uniqid
+	set ditem "ditem_${ditem_uniqid}"
+	variable $ditem
+	array set $ditem [list]
+	return $ditem
+}
+
+proc ditem_key {ditem args} {
+	variable $ditem
+	set nbargs [llength $args]
+	if {$nbargs > 1} {
+		set key [lindex $args 0]
+		array set $ditem [list $key [lindex $args 1]]
+		return [lindex [array get $ditem $key] 1]
+	} elseif {$nbargs == 1} {
+		set key [lindex $args 0]
+		return [lindex [array get $ditem $key] 1]
+	} else {
+		return [array get $ditem]
+	}
+}
+
+proc ditem_append {ditem key args} {
+	variable $ditem
+	set x [lindex [array get $ditem $key] 1]
+	if {$x != {}} {
+		eval "lappend x $args"
+	} else {
+		set x $args
+	}
+	array set $ditem [list $key $x]
+	return $x
+}
+
+proc ditem_append_unique {ditem key args} {
+	variable $ditem
+	set x [lindex [array get $ditem $key] 1]
+	if {$x != {}} {
+		eval "lappend x $args"
+		set x [lsort -unique $x]
+	} else {
+		set x $args
+	}
+	array set $ditem [list $key $x]
+	return $x
+}
+
+proc ditem_contains {ditem key args} {
+	variable $ditem
+	if {[llength $args] == 0} {
+		eval "return \[info exists ${ditem}($key)\]"
+	} else {
+		set x [lindex [array get $ditem $key] 1]
+		if {[llength $x] > 0 && [lsearch -exact $x [lindex $args 0]] != -1} {
+			return 1
+		} else {
+			return 0
+		}
+	}
+}
+
+# End of darwinports_dlist namespace
+}
+

Copied: branches/dp2mp-move/base/src/macports1.0/macports_fastload.tcl.in (from rev 24452, trunk/base/src/darwinports1.0/darwinports_fastload.tcl.in)
===================================================================
--- branches/dp2mp-move/base/src/macports1.0/macports_fastload.tcl.in	                        (rev 0)
+++ branches/dp2mp-move/base/src/macports1.0/macports_fastload.tcl.in	2007-04-24 17:28:16 UTC (rev 24454)
@@ -0,0 +1,83 @@
+# darwinports_fastload.tcl.in
+# $Id$
+#
+# Copyright (c) 2004 Paul Guyot, Darwinports Team.
+# 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 Apple Computer, 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
+# 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 darwinports-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 DP and a user installation of DP (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 { ($tcl_version < 8.4) ||
+	(($tcl_version == 8.4) && ([lindex [split [info patchlevel] .] 3] < 7))} {
+	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 dir [file join "@TCL_PACKAGE_DIR@" darwinports1.0]
+catch {source [file join $dir pkgIndex.tcl]}
+
+foreach dir [glob -directory "@prefix_expanded@" -join share darwinports Tcl *] {
+	catch {source [file join $dir pkgIndex.tcl]}
+}
+
+if { "@SQLITE3_DIR@" != "" } {
+	set dir "@SQLITE3_DIR@"
+	catch {source [file join $dir pkgIndex.tcl]}
+}

Copied: branches/dp2mp-move/base/src/macports1.0/macports_index.tcl (from rev 24452, trunk/base/src/darwinports1.0/darwinports_index.tcl)
===================================================================
--- branches/dp2mp-move/base/src/macports1.0/macports_index.tcl	                        (rev 0)
+++ branches/dp2mp-move/base/src/macports1.0/macports_index.tcl	2007-04-24 17:28:16 UTC (rev 24454)
@@ -0,0 +1,379 @@
+# darwinports_index.tcl
+# $Id$
+#
+# Copyright (c) 2004 Apple Computer, Inc.
+# 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 Apple Computer, 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
+# 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.
+#
+# 31-Mar-2004
+# Kevin Van Vechten <kevin at opendarwin.org>
+#
+
+package provide darwinports_index 1.0
+
+namespace eval darwinports::index {
+	variable has_sqlite {}
+}
+
+proc darwinports::index::init {} {
+	global darwinports::index::has_sqlite darwinports::prefix
+	if {$darwinports::index::has_sqlite == 1 ||
+		[file exists ${darwinports::prefix}/lib/tclsqlite.dylib]} {
+		load ${darwinports::prefix}/lib/tclsqlite.dylib Sqlite
+		set darwinports::index::has_sqlite 1
+	} else {
+		return -code error "Sqlite must be installed to use a remote index.  Use the tclsqlite port."
+	}
+}
+
+proc darwinports::index::get_path {source} {
+    global darwinports::portdbpath
+    regsub {://} $source {.} source_dir
+    regsub -all {/} $source_dir {_} source_dir
+    return [file join $portdbpath sources $source_dir]
+}
+
+
+# darwinports::index::sync
+# Interact with the remote index at the specified URL.
+# Replays the SQL transactions contained in the remote
+# index file into a local database, creating it if it
+# does not yet exist.  If it does already exist, only
+# the transactions newer than the last sync will be
+# downloaded and replayed.
+#
+# portdbpath - the path to which the local database should
+#              be stored.  "portindex/" and a unique hash based
+#              on the url will be appended to this path.
+# url        - the url of the remote index to synchronize with
+
+proc darwinports::index::sync {portdbpath url} {
+	darwinports::index::init
+
+	set indexpath [darwinports::index::get_path $url]
+	if {[catch {file mkdir $indexpath} result]} {
+		return -code error "$indexpath could not be created: $result"
+	}
+
+	set oldpath [pwd]
+	cd $indexpath
+	
+	# We actually use http:// as the transport mechanism
+	set url [regsub -- {^dports} $url {http}]
+
+	# If the database didn't exist, initialize it.
+	# The schema is available on the server in the initialize.sql file.
+	if {![file exists [file join $indexpath database.sqlite]]} {
+		puts "Initializing portindex"
+		exec curl --silent -O "$url/index/initialize.sql"
+		# XXX detect curl failures
+		
+		set fd [open initialize.sql r]
+		set sql {}
+		while {[gets $fd line] >= 0} {
+			append sql " $line\n"
+		}
+		close $fd
+		# Database file has the name database.sqlite
+		sqlite DB database.sqlite
+		DB eval $sql
+		DB eval "CREATE TABLE priv_data (keyword text, value int);"
+		DB eval "INSERT INTO priv_data (keyword, value) VALUES ('last_index', 1);"
+		DB eval "INSERT INTO priv_data (keyword, value) VALUES ('last_trans', 0);"
+		DB close
+	}
+
+	# Database file has the name database.sqlite
+	sqlite DB database.sqlite
+
+	##
+	# Download any new files
+	##
+
+	# Get the last downloaded file index out of the database.
+	set start_index [DB eval "SELECT value FROM priv_data WHERE keyword='last_index';"]
+
+	# Get the current high-water mark from the server.
+	exec curl --silent -O "$url/index/.last_index"
+	# XXX detect curl failures
+	set fd [open ".last_index" r]
+	gets $fd last_index
+	# XXX should validate the contents of $last_index
+	close $fd
+	# Re-fetch the last file we fetched (transactions may have
+	# been appended to it) and any new files.
+	for {set i $start_index} {$i <= $last_index} {incr i} {
+		puts "Fetching portindex-$i"
+		exec curl --silent -O "$url/index/portindex-$i.sql"
+		# XXX detect curl failures
+		DB eval "UPDATE priv_data SET value=$i WHERE keyword='last_index';\n"
+	}
+
+	##
+	# Replay the transactions
+	##
+
+	# Get the last transaction ID out of the database.
+	set last_trans [DB eval "SELECT value FROM priv_data WHERE keyword='last_trans';"]
+
+	# Iterate through the files we just downloaded
+	for {set i $start_index} {$i <= $last_index} {incr i} {
+		puts "Processing portindex-$i"
+		set fd [open "portindex-$i.sql" r]
+		set sql {}
+		while {[gets $fd line] >= 0} {
+			append sql " $line\n"	
+			if {[regexp -- {^-- END TRANSACTION #([0-9]+)} $line unused trans_id] == 1} {
+				# If this is a transaction we have not seen before, commit it.
+				# Also update the last transaction number.
+				if {$trans_id > $last_trans} {
+					set last_trans $trans_id
+					append sql " UPDATE priv_data SET value=$last_trans WHERE keyword='last_trans';\n"
+					DB eval $sql
+				}
+				set sql {}
+			}
+		}
+		close $fd
+	}
+
+	# Clean Up
+	DB close
+	cd $oldpath
+}
+
+# darwinports::index::search
+#
+# Searches the cached copy of the specified port index for
+# the Portfile satisfying the given query.
+#
+# Todo -- in the future we may want to do an implicit "port sync"
+# when this function is called.
+#
+# portdbpath - the path to which the local database should
+#              be stored.  "portindex/" and a unique hash based
+#              on the url will be appended to this path.
+# url        - the url of the remote index to search
+#
+# attrs      - an array of the attributes to search for
+#			   currently only "name" is supported.
+
+proc darwinports::index::search {portdbpath url attrslist} {
+	darwinports::index::init
+	set indexpath [darwinports::index::get_path $url]
+
+	if {![file exists $indexpath/database.sqlite]} {
+		return -code error "Can't open index file for source $url. Have you synced your source indexes (port sync)?"
+	}
+
+	sqlite DB $indexpath/database.sqlite
+	# Map some functions into the SQL namespace
+	DB function regexp regexp
+	
+	# The guts of the search logic.
+	# Precedence is as follows:
+	# - If a name, version, and revision is specified return that single port.
+	# - If a name and version is specified, return the highest revision
+	# - If only a name is specified, return the highest revision of 
+	#   all distinct name, version combinations.
+	# - NOTE: it is an error to specify a revision without a version.
+
+	set pids [list]
+	array set attrs $attrslist
+	if {[info exists attrs(name)]} {
+		set name $attrs(name)
+
+		# If version was not specified, find all distinct versions;
+		# otherwise use the specified version.
+		if {![info exists attrs(version)]} {
+			set sql "SELECT version FROM ports WHERE regexp('--','$name',name) GROUP BY version ORDER BY version DESC"
+			set versions [DB eval $sql]
+		} else {
+			set versions [list $attrs(version)]
+		}
+	
+		# If revision was not specified, find the highest revision;
+		# otherwise use the specified revision.
+		if {![info exists attrs(revision)]} {
+			foreach version $versions {
+				set sql "SELECT max(revision) FROM ports WHERE regexp('--','$name',name) AND version LIKE '$version'"
+				set revisions($version) [DB eval $sql]
+			}
+		} else {
+			set revisions($version) $attrs(revision)
+		}
+		
+		foreach version $versions {
+			set sql "SELECT pid FROM ports WHERE regexp('--','$name',name) AND version LIKE '$version' AND revision LIKE '$revisions($version)'"
+			lappend pids [DB eval $sql]
+		}
+	}
+	
+	# Historically dportsearch has returned a serialized list of arrays.
+	# This is kinda gross and really needs to change to a more opaque
+	# data type in the future, but to ease the transition we're it the old
+	# way here.  For each port that matched the query, build up an array 
+	# from the keywords table and append it to the list.
+
+	set result [list]
+
+	foreach pid $pids {
+		set portinfo [list]
+		set primary_key [DB eval "SELECT name,version,revision FROM ports WHERE pid=$pid"]
+		set name [lindex $primary_key 0]
+		set version [lindex $primary_key 1]
+		set revision [lindex $primary_key 2]
+		lappend portinfo name $name
+		lappend portinfo version $version
+		lappend portinfo revision $revision
+		
+		set auxiliary_keys [DB eval "SELECT keyword, value FROM keywords WHERE pid=$pid"]
+		foreach {key value} $auxiliary_keys {
+			# XXX - special case list types: categories, maintainers, master_sites
+			lappend portinfo $key $value
+		}
+		
+		# Craft a URL where the port can be found.
+		lappend portinfo porturl $url/files/$name/$version/$revision/Portfile.tar.gz
+		
+		# Make a note of where this port came from.
+		lappend portsource $url
+		
+		lappend result $name
+		lappend result $portinfo
+	}
+
+	DB close
+
+	return $result
+}
+
+
+
+# darwinports::index::fetch_port
+#
+# Checks for a locally cached copy of the port, or downloads the port
+# from the specified URL.  The port is extracted into the current working
+# directory along with a .dports_source file containing the url of the
+# source the port came from.  (This can be later used as a default for
+# "port submit")
+#
+# The cached portfiles are in the same directory as the cached remote index.
+#
+# TODO - the existing infrastructure only gives us a URL at this point,
+# but we really ought to have an opaque handle to a port.  We want to
+# get the source URL and the Portfile.tar.gz md5 from this opaque handle.
+
+proc darwinports::index::fetch_port {url destdir} {
+	global darwinports::sources
+	
+	set portsource ""
+	set portname ""
+	set portversion ""
+	set portrevision ""
+	
+	# Iterate through the sources, to see which one this port is coming from.
+	# If the port is not coming from a known source, return an error (for now).
+	
+	set indexpath ""
+	set fetchpath ""
+	foreach source $sources {
+		if {[regexp -- "^$source" $url] == 1} {
+			set portsource $source
+			set indexpath [darwinports::index::get_path $source]
+			
+			# Extract the relative portion of the url, 
+			# and append it to the indexpath, this is where
+			# we will store the cached Portfile.
+			set dir [file dirname [regsub -- "$source/?" $url {}]]
+
+			# XXX: crude hack to get port name and version, should realy come from opaque port handle.
+			set portname [lindex [file split $dir] 1]
+			set portversion [lindex [file split $dir] 2]
+			set portrevision [lindex [file split $dir] 3]
+
+			set fetchpath [file join $indexpath $dir]
+			break
+		}
+	}
+	
+	if {$indexpath == "" || $fetchpath == ""} {
+		return -code error "Port URL has unknown source: $url"
+	}
+	
+	if {[catch {file mkdir $fetchpath} result]} {
+		return -code error $result
+	}
+
+	# If the portdir already exists, we don't bother extracting again.
+	
+	# Look to see if the file exists in our cache, if it does, attempt
+	# to extract it into the temporary directory that we will build in.
+	# If it does not exist, or if the tar extraction fails, then attempt
+	# to fetch it again.
+
+
+	set portdir [file join "$destdir" "$portname-$portversion"]
+
+	if {[file exists $portdir]} {
+		return $portdir
+	}
+	
+	if {[catch {file mkdir $portdir} result]} {
+		return -code error $result
+	}
+
+	set fetchfile [file join $fetchpath [file tail $url]]
+	set retries 2
+	while {$retries > 0} {
+		if {[file exists $fetchfile]} {
+			set oldcwd [pwd]
+			cd $portdir
+			
+			if {[catch {exec tar -zxf $fetchfile} result]} {
+				return -code error "Could not unpack port file: $result"
+			}
+			
+			set fd [open ".dports_source" w]
+			puts $fd "source: $portsource"
+			puts $fd "port: $portname"
+			puts $fd "version: $portversion"
+			puts $fd "revision: $portrevision"
+			close $fd
+			
+			cd $oldcwd
+		} else {		
+			# We actually use http:// as the transport mechanism
+			set http_url [regsub -- {^dports} $url {http}]
+			if {[catch {exec curl -L -s -S -o $fetchfile $http_url} result ]} {
+				return -code error "Could not download port from remote index: $result"
+			}
+		}
+		incr retries -1
+	}
+	
+	return $portdir
+}

Modified: branches/dp2mp-move/base/src/package1.0/Makefile
===================================================================
--- trunk/base/src/package1.0/Makefile	2007-04-22 07:33:59 UTC (rev 24327)
+++ branches/dp2mp-move/base/src/package1.0/Makefile	2007-04-24 17:28:16 UTC (rev 24454)
@@ -1,9 +1,9 @@
-INSTALLDIR=	${DESTDIR}${datadir}/darwinports/Tcl/package1.0
+INSTALLDIR=	${DESTDIR}${datadir}/macports/Tcl/package1.0
 
 SRCS=	package.tcl portdmg.tcl portmpkg.tcl portpkg.tcl portrpmpackage.tcl \
 	portdpkg.tcl portunarchive.tcl portarchive.tcl
 
-include ../../Mk/dports.autoconf.mk
+include ../../Mk/macports.autoconf.mk
 
 all::
 

Modified: branches/dp2mp-move/base/src/pextlib1.0/Makefile
===================================================================
--- trunk/base/src/pextlib1.0/Makefile	2007-04-22 07:33:59 UTC (rev 24327)
+++ branches/dp2mp-move/base/src/pextlib1.0/Makefile	2007-04-24 17:28:16 UTC (rev 24454)
@@ -2,11 +2,11 @@
 		fs-traverse.o strcasecmp.o vercomp.o filemap.o \
 		sha1cmd.o compat.o curl.o rmd160cmd.o readline.o uid.o
 SHLIB_NAME=	Pextlib${SHLIB_SUFFIX}
-INSTALLDIR= ${DESTDIR}${datadir}/darwinports/Tcl/pextlib1.0
+INSTALLDIR= ${DESTDIR}${datadir}/macports/Tcl/pextlib1.0
 export MACOSX_DEPLOYMENT_TARGET=10.3
 
-include ../../Mk/dports.autoconf.mk
-include ../../Mk/dports.tea.mk
+include ../../Mk/macports.autoconf.mk
+include ../../Mk/macports.tea.mk
 
 .PHONY: test
 
@@ -15,4 +15,5 @@
 	${TCLSH} tests/checksums.tcl ${SHLIB_NAME}
 	${TCLSH} tests/filemap.tcl ${SHLIB_NAME}
 	${TCLSH} tests/fifo.tcl ${SHLIB_NAME}
+	${TCLSH} tests/fs-traverse.tcl ${SHLIB_NAME}
 	${TCLSH} tests/socketpair.tcl ${SHLIB_NAME}

Modified: branches/dp2mp-move/base/src/pextlib1.0/Pextlib.c
===================================================================
--- trunk/base/src/pextlib1.0/Pextlib.c	2007-04-22 07:33:59 UTC (rev 24327)
+++ branches/dp2mp-move/base/src/pextlib1.0/Pextlib.c	2007-04-24 17:28:16 UTC (rev 24454)
@@ -1094,6 +1094,30 @@
 	return TCL_OK;
 }
 
+/**
+ * symlink value target
+ * Create a symbolic link at target pointing to value
+ * See symlink(2) for possible errors
+ */
+int CreateSymlinkCmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
+{
+    char *value, *target;
+    
+    if (objc != 3) {
+        Tcl_WrongNumArgs(interp, 1, objv, "value target");
+        return TCL_ERROR;
+    }
+    
+    value = Tcl_GetString(objv[1]);
+    target = Tcl_GetString(objv[2]);
+    
+    if (symlink(value, target) != 0) {
+        Tcl_SetResult(interp, (char *)Tcl_PosixError(interp), TCL_STATIC);
+        return TCL_ERROR;
+    }
+    return TCL_OK;
+}
+
 int Pextlib_Init(Tcl_Interp *interp)
 {
 	if (Tcl_InitStubs(interp, "8.3", 0) == NULL)
@@ -1124,6 +1148,7 @@
 	Tcl_CreateObjCommand(interp, "mkchannelfromfd", MkChannelFromFdCmd, NULL, NULL);
 	Tcl_CreateObjCommand(interp, "pipe", PipeCmd, NULL, NULL);
 	Tcl_CreateObjCommand(interp, "curl", CurlCmd, NULL, NULL);
+    Tcl_CreateObjCommand(interp, "symlink", CreateSymlinkCmd, NULL, NULL);
 	
 	Tcl_CreateObjCommand(interp, "readline", ReadlineCmd, NULL, NULL);
 	Tcl_CreateObjCommand(interp, "rl_history", RLHistoryCmd, NULL, NULL);

Deleted: branches/dp2mp-move/base/src/pextlib1.0/fs-traverse.c
===================================================================
--- trunk/base/src/pextlib1.0/fs-traverse.c	2007-04-22 07:33:59 UTC (rev 24327)
+++ branches/dp2mp-move/base/src/pextlib1.0/fs-traverse.c	2007-04-24 17:28:16 UTC (rev 24454)
@@ -1,190 +0,0 @@
-/*
- * fs-traverse.c
- * $Id$
- *
- * Find files and execute arbitrary expressions on them.
- * Author: Jordan K. Hubbard, Kevin Ballard
- *
- * Copyright (c) 2004 Apple Computer, Inc.
- * 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 Apple Computer, 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
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#if HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#if HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-#include <sys/stat.h>
-#endif
-
-#if HAVE_DIRENT_H
-#include <dirent.h>
-#endif
-
-#if HAVE_LIMITS_H
-#include <limits.h>
-#endif
-
-#include <tcl.h>
-
-static int do_traverse(Tcl_Interp *interp, int flags, char *target, char *varname, char *body);
-
-#define F_DEPTH 0x1
-#define F_IGNORE_ERRORS 0x2
-
-/* fs-traverse ?-depth? ?-ignoreErrors? varname target ?target ...? body */
-int
-FsTraverseCmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
-{
-    char *varname;
-    char *body;
-    int flags = 0;
-    int rval = TCL_OK;
-    Tcl_Obj *CONST *objv_orig = objv;
-
-    /* Adjust arguments to remove initial `find' */
-    ++objv, --objc;
-
-    /* Parse flags */
-    while (objc) {
-        if (!strcmp(Tcl_GetString(*objv), "-depth")) {
-            flags |= F_DEPTH;
-            ++objv, --objc;
-            continue;
-        }
-        if (!strcmp(Tcl_GetString(*objv), "-ignoreErrors")) {
-            flags |= F_IGNORE_ERRORS;
-            ++objv, --objc;
-            continue;
-        }
-        break;
-    }
-    
-    /* Parse remaining args */
-    if (objc < 3) {
-        Tcl_WrongNumArgs(interp, 1, objv_orig, "?-depth? ?-ignoreErrors? varname target ?target target ...? body");
-        return TCL_ERROR;
-    }
-    
-    varname = Tcl_GetString(*objv);
-    ++objv, --objc;
-    
-    body = Tcl_GetString(objv[objc-1]);
-    --objc;
-    
-    while (objc) {
-        char *target = Tcl_GetString(*objv);
-        ++objv, --objc;
-        
-        if ((rval = do_traverse(interp, flags, target, varname, body)) == TCL_CONTINUE) {
-            rval = TCL_OK;
-            continue;
-        } else if (rval == TCL_BREAK) {
-            rval = TCL_OK;
-            break;
-        } else if (rval != TCL_OK) {
-            break;
-        }
-    }
-    return rval;
-}
-
-static int
-do_traverse(Tcl_Interp *interp, int flags, char *target, char *varname, char *body)
-{
-    DIR *dirp;
-    struct dirent *dp;
-    int rval = TCL_OK;
-    struct stat sb;
-    
-    /* No permission? */
-    if (lstat(target, &sb) != 0) {
-        if (flags & F_IGNORE_ERRORS) {
-            return TCL_OK;
-        } else {
-            Tcl_ResetResult(interp);
-            Tcl_AppendResult(interp, "Error: no permission to access file/folder `", target, "'");
-            return TCL_ERROR;
-        }
-    }
-    
-    /* Handle files now, or directories if !depth */
-    if (!(flags & F_DEPTH) || !(sb.st_mode & S_IFDIR)) {
-        Tcl_SetVar(interp, varname, target, 0);
-        if ((rval = Tcl_EvalEx(interp, body, -1, 0)) != TCL_OK) {
-            return rval;
-        }
-    }
-    
-    /* Handle directories */
-    if (sb.st_mode & S_IFDIR) {
-        if ((dirp = opendir(target)) == NULL) {
-            if (flags & F_IGNORE_ERRORS) {
-                return TCL_OK;
-            } else {
-                Tcl_ResetResult(interp);
-                Tcl_AppendResult(interp, "Error: Could not open directory `", target, "'");
-                return TCL_ERROR;
-            }
-        }
-        
-        while ((dp = readdir(dirp)) != NULL) {
-            char tmp_path[PATH_MAX];
-
-            if (!strcmp(dp->d_name, ".") || !strcmp(dp->d_name, ".."))
-                continue;
-            strcpy(tmp_path, target);
-            strcat(tmp_path, "/");
-            strcat(tmp_path, dp->d_name);
-
-            if ((rval = do_traverse(interp, flags, tmp_path, varname, body)) == TCL_CONTINUE) {
-                rval = TCL_OK;
-                continue;
-            } else if (rval != TCL_OK) {
-                break;
-            }
-        }
-        (void)closedir(dirp);
-        
-        /* Handle directory now if depth */
-        if (flags & F_DEPTH) {
-            Tcl_SetVar(interp, varname, target, 0);
-            if ((rval = Tcl_EvalEx(interp, body, -1, 0)) != TCL_OK) {
-                return rval;
-            }
-        }
-    }
-    return rval;
-}

Copied: branches/dp2mp-move/base/src/pextlib1.0/fs-traverse.c (from rev 24448, trunk/base/src/pextlib1.0/fs-traverse.c)
===================================================================
--- branches/dp2mp-move/base/src/pextlib1.0/fs-traverse.c	                        (rev 0)
+++ branches/dp2mp-move/base/src/pextlib1.0/fs-traverse.c	2007-04-24 17:28:16 UTC (rev 24454)
@@ -0,0 +1,208 @@
+/*
+ * fs-traverse.c
+ * $Id$
+ *
+ * Find files and execute arbitrary expressions on them.
+ * Author: Jordan K. Hubbard, Kevin Ballard
+ *
+ * Copyright (c) 2004 Apple Computer, Inc.
+ * 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 Apple Computer, 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
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+
+#include <fts.h>
+#include <errno.h>
+
+#if HAVE_LIMITS_H
+#include <limits.h>
+#endif
+
+#include <tcl.h>
+
+static int do_traverse(Tcl_Interp *interp, int flags, char * CONST *targets, Tcl_Obj *varname, Tcl_Obj *body);
+
+#define F_DEPTH 0x1
+#define F_IGNORE_ERRORS 0x2
+
+/* fs-traverse ?-depth? ?-ignoreErrors? ?--? varname target-list body */
+int
+FsTraverseCmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
+{
+    Tcl_Obj *varname;
+    Tcl_Obj *body;
+    int flags = 0;
+    int rval = TCL_OK;
+    Tcl_Obj *listPtr;
+    Tcl_Obj *CONST *objv_orig = objv;
+    int lobjc;
+    Tcl_Obj **lobjv;
+
+    /* Adjust arguments to remove command name */
+    ++objv, --objc;
+
+    /* Parse flags */
+    while (objc) {
+        char *arg = Tcl_GetString(*objv);
+        if (!strcmp(arg, "-depth")) {
+            flags |= F_DEPTH;
+            ++objv, --objc;
+            continue;
+        }
+        if (!strcmp(arg, "-ignoreErrors")) {
+            flags |= F_IGNORE_ERRORS;
+            ++objv, --objc;
+            continue;
+        }
+        if (!strcmp(arg, "--")) {
+            ++objv, --objc;
+            break;
+        }
+        break;
+    }
+    
+    /* Parse remaining args */
+    if (objc != 3) {
+        Tcl_WrongNumArgs(interp, 1, objv_orig, "?-depth? ?-ignoreErrors? ?--? varname target-list body");
+        return TCL_ERROR;
+    }
+    
+    varname = *objv;
+    ++objv, --objc;
+    
+    listPtr = *objv;
+    ++objv, --objc;
+    
+    body = *objv;
+    
+    if ((rval = Tcl_ListObjGetElements(interp, listPtr, &lobjc, &lobjv)) == TCL_OK) {
+        char **entries = calloc(objc, sizeof(char *));
+        char **iter = (char **)entries;
+        while (lobjc) {
+            *iter++ = Tcl_GetString(*lobjv);
+            --lobjc, ++lobjv;
+        }
+        rval = do_traverse(interp, flags, entries, varname, body);
+        free(entries);
+    }
+    return rval;
+}
+
+static int
+do_traverse(Tcl_Interp *interp, int flags, char * CONST *targets, Tcl_Obj *varname, Tcl_Obj *body)
+{
+    int rval = TCL_OK;
+    FTS *root_fts;
+    FTSENT *ent;
+    
+    root_fts = fts_open(targets, FTS_PHYSICAL | FTS_COMFOLLOW | FTS_NOCHDIR | FTS_XDEV, NULL);
+    
+    while ((ent = fts_read(root_fts)) != NULL) {
+        switch (ent->fts_info) {
+            case FTS_D:  /* directory in pre-order */
+            case FTS_DP: /* directory in post-order*/
+            {
+                if (!(flags & F_DEPTH) != !(ent->fts_info == FTS_D)) {
+                    Tcl_Obj *rpath, *path = Tcl_NewStringObj(ent->fts_path, ent->fts_pathlen);
+                    Tcl_IncrRefCount(path);
+                    rpath = Tcl_ObjSetVar2(interp, varname, NULL, path, TCL_LEAVE_ERR_MSG);
+                    Tcl_DecrRefCount(path);
+                    if (rpath == NULL && !(flags & F_IGNORE_ERRORS)) {
+                        fts_close(root_fts);
+                        return TCL_ERROR;
+                    }
+                    if ((rval = Tcl_EvalObjEx(interp, body, 0)) == TCL_CONTINUE) {
+                        fts_set(root_fts, ent, FTS_SKIP);
+                    } else if (rval == TCL_BREAK) {
+                        fts_close(root_fts);
+                        return TCL_OK;
+                    } else if (rval != TCL_OK) {
+                        fts_close(root_fts);
+                        return rval;
+                    }
+                }
+                break;
+            }
+            case FTS_F:   /* regular file */
+            case FTS_SL:  /* symbolic link */
+            case FTS_SLNONE: /* symbolic link with non-existant target */
+            case FTS_DEFAULT: /* file type not otherwise handled (e.g., fifo) */
+            {
+                Tcl_Obj *rpath, *path = Tcl_NewStringObj(ent->fts_path, ent->fts_pathlen);
+                Tcl_IncrRefCount(path);
+                rpath = Tcl_ObjSetVar2(interp, varname, NULL, path, TCL_LEAVE_ERR_MSG);
+                Tcl_DecrRefCount(path);
+                if (rpath == NULL && !(flags & F_IGNORE_ERRORS)) {
+                    fts_close(root_fts);
+                    return TCL_ERROR;
+                }
+                if ((rval = Tcl_EvalObjEx(interp, body, 0)) == TCL_CONTINUE) {
+                    fts_set(root_fts, ent, FTS_SKIP); /* probably useless on files/symlinks */
+                } else if (rval == TCL_BREAK) {
+                    fts_close(root_fts);
+                    return TCL_OK;
+                } else if (rval != TCL_OK) {
+                    fts_close(root_fts);
+                    return rval;
+                }
+            }
+            case FTS_DC:  /* directory that causes a cycle */
+                break;    /* ignore it */
+            case FTS_DNR: /* directory that cannot be read */
+            case FTS_ERR: /* error return */
+            case FTS_NS:  /* file with no stat(2) information */
+            {
+                if (!(flags & F_IGNORE_ERRORS)) {
+                    Tcl_SetErrno(ent->fts_errno);
+                    Tcl_SetResult(interp, (char *)Tcl_PosixError(interp),  TCL_STATIC);
+                    fts_close(root_fts);
+                    return TCL_ERROR;
+                }
+            }
+        }
+    }
+    /* check errno before calling fts_close in case it sets errno to 0 on success */
+    if (errno != 0 || (fts_close(root_fts) != 0 && !(flags & F_IGNORE_ERRORS))) {
+        Tcl_SetResult(interp, (char *)Tcl_PosixError(interp), TCL_STATIC);
+        return TCL_ERROR;
+    }
+    return TCL_OK;
+}

Copied: branches/dp2mp-move/base/src/pextlib1.0/tests (from rev 24449, trunk/base/src/pextlib1.0/tests)

Modified: branches/dp2mp-move/base/src/port/Makefile
===================================================================
--- trunk/base/src/port/Makefile	2007-04-22 07:33:59 UTC (rev 24327)
+++ branches/dp2mp-move/base/src/port/Makefile	2007-04-24 17:28:16 UTC (rev 24454)
@@ -7,7 +7,7 @@
 	-e 's, at TCLSH\@,$(TCLSH),g' \
 	-e 's, at TCL_PACKAGE_DIR\@,$(TCL_PACKAGE_DIR),g'
 
-include ../../Mk/dports.autoconf.mk
+include ../../Mk/macports.autoconf.mk
 
 all: ${SCRIPTS}
 

Modified: branches/dp2mp-move/base/src/port1.0/Makefile
===================================================================
--- trunk/base/src/port1.0/Makefile	2007-04-22 07:33:59 UTC (rev 24327)
+++ branches/dp2mp-move/base/src/port1.0/Makefile	2007-04-24 17:28:16 UTC (rev 24454)
@@ -1,4 +1,4 @@
-INSTALLDIR=	${DESTDIR}${datadir}/darwinports/Tcl/port1.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 \
@@ -9,9 +9,11 @@
 
 SUBDIR=		resources
 
-include ../../Mk/dports.subdir.mk
-include ../../Mk/dports.autoconf.mk
+include ../../Mk/macports.subdir.mk
+include ../../Mk/macports.autoconf.mk
 
+.PHONY: test
+
 all::
 
 clean::
@@ -25,3 +27,6 @@
 		$(INSTALL) -o ${DSTUSR} -g ${DSTGRP} -m 444 $$file ${INSTALLDIR}; \
 	done
 	$(SILENT) $(TCLSH) ../pkg_mkindex.tcl ${INSTALLDIR}
+
+test::
+	${TCLSH} tests/portutil.tcl

Modified: branches/dp2mp-move/base/src/port1.0/port_autoconf.tcl.in
===================================================================
--- trunk/base/src/port1.0/port_autoconf.tcl.in	2007-04-22 07:33:59 UTC (rev 24327)
+++ branches/dp2mp-move/base/src/port1.0/port_autoconf.tcl.in	2007-04-24 17:28:16 UTC (rev 24454)
@@ -33,6 +33,7 @@
 namespace eval portutil::autoconf {
 	variable cvs_path "@CVS@"
 	variable rsync_path "@RSYNC@"
+	variable mtree_path "@MTREE@"
 	variable xar_path "@XAR@"
 	variable tar_command "@TAR_CMD@"
 	variable have_launchd "@HAVE_LAUNCHD@"

Modified: branches/dp2mp-move/base/src/port1.0/portdestroot.tcl
===================================================================
--- trunk/base/src/port1.0/portdestroot.tcl	2007-04-22 07:33:59 UTC (rev 24327)
+++ branches/dp2mp-move/base/src/port1.0/portdestroot.tcl	2007-04-24 17:28:16 UTC (rev 24454)
@@ -85,6 +85,7 @@
     ui_msg "$UI_PREFIX [format [msgcat::mc "Staging %s into destroot"] ${portname}]"
 
     set oldmask [umask ${destroot.umask}]
+    set mtree ${portutil::autoconf::mtree_path}
     
     if { ${destroot.clean} == "yes" } {
 	system "rm -Rf \"${destroot}\""
@@ -92,10 +93,10 @@
     
     file mkdir "${destroot}"
     if { ${os.platform} == "darwin" } {
-	system "cd \"${destroot}\" && mtree -e -U -f ${portresourcepath}/install/macosx.mtree"
+	system "cd \"${destroot}\" && ${mtree} -e -U -f ${portresourcepath}/install/macosx.mtree"
     }
     file mkdir "${destroot}/${prefix}"
-    system "cd \"${destroot}/${prefix}\" && mtree -e -U -f ${portresourcepath}/install/prefix.mtree"
+    system "cd \"${destroot}/${prefix}\" && ${mtree} -e -U -f ${portresourcepath}/install/prefix.mtree"
 }
 
 proc destroot_main {args} {

Deleted: branches/dp2mp-move/base/src/port1.0/portutil.tcl
===================================================================
--- trunk/base/src/port1.0/portutil.tcl	2007-04-22 07:33:59 UTC (rev 24327)
+++ branches/dp2mp-move/base/src/port1.0/portutil.tcl	2007-04-24 17:28:16 UTC (rev 24454)
@@ -1,1786 +0,0 @@
-# et:ts=4
-# portutil.tcl
-# $Id$
-#
-# Copyright (c) 2004 Robert Shaw <rshaw at opendarwin.org>
-# Copyright (c) 2002 Apple Computer, Inc.
-# Copyright (c) 2006 Markus W. Weissmann <mww at opendarwin.org>
-# 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 Apple Computer, 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
-# 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 portutil 1.0
-package require Pextlib 1.0
-package require darwinports_dlist 1.0
-package require msgcat
-package require porttrace 1.0
-
-global targets target_uniqid all_variants
-
-set targets [list]
-set target_uniqid 0
-
-set all_variants [list]
-
-########### External High Level Procedures ###########
-
-namespace eval options {
-}
-
-# option
-# This is an accessor for Portfile options.  Targets may use
-# this in the same style as the standard Tcl "set" procedure.
-#	name  - the name of the option to read or write
-#	value - an optional value to assign to the option
-
-proc option {name args} {
-    # XXX: right now we just transparently use globals
-    # eventually this will need to bridge the options between
-    # the Portfile's interpreter and the target's interpreters.
-    global $name
-    if {[llength $args] > 0} {
-	ui_debug "setting option $name to $args"
-	set $name [lindex $args 0]
-    }
-    return [set $name]
-}
-
-# exists
-# This is an accessor for Portfile options.  Targets may use
-# this procedure to test for the existence of a Portfile option.
-#	name - the name of the option to test for existence
-
-proc exists {name} {
-    # XXX: right now we just transparently use globals
-    # eventually this will need to bridge the options between
-    # the Portfile's interpreter and the target's interpreters.
-    global $name
-    return [info exists $name]
-}
-
-# options
-# Exports options in an array as externally callable procedures
-# Thus, "options name date" would create procedures named "name"
-# and "date" that set global variables "name" and "date", respectively
-# When an option is modified in any way, options::$option is called,
-# if it exists
-# Arguments: <list of options>
-proc options {args} {
-    foreach option $args {
-        proc $option {args} "
-            global ${option} user_options option_procs
-            if {!\[info exists user_options(${option})\]} {
-                set ${option} \$args
-            }
-        "
-        proc ${option}-delete {args} "
-            global ${option} user_options option_procs
-            if {!\[info exists user_options(${option})\] && \[info exists ${option}\]} {
-                foreach val \$args {
-                   set ${option} \[ldelete \${$option} \$val\]
-                }
-                if {\[string length \${${option}}\] == 0} {
-                    unset ${option}
-                }
-            }
-        "
-        proc ${option}-append {args} "
-            global ${option} user_options option_procs
-            if {!\[info exists user_options(${option})\]} {
-                if {\[info exists ${option}\]} {
-                    set ${option} \[concat \${$option} \$args\]
-                } else {
-                    set ${option} \$args
-                }
-            }
-        "
-    }
-}
-
-proc options_export {args} {
-    foreach option $args {
-        proc options::export-${option} {args} "
-            global ${option} PortInfo
-            if {\[info exists ${option}\]} {
-                set PortInfo(${option}) \${${option}}
-            } else {
-                unset PortInfo(${option})
-            }
-        "
-        option_proc ${option} options::export-${option}
-    }
-}
-
-# option_deprecate
-# Causes a warning to be printed when an option is set or accessed
-proc option_deprecate {option {newoption ""} } {
-    # If a new option is specified, default the option to {${newoption}}
-    # Display a warning
-    if {$newoption != ""} {
-        proc warn_deprecated_${option} {option action args} "
-            global portname $option $newoption
-            if {\$action != \"read\"} {
-                $newoption \$$option
-            } else {
-                ui_warn \"Port \$portname using deprecated option \\\"$option\\\".\"
-                $option \[set $newoption\]
-            }
-        "
-    } else {
-        proc warn_deprecated_$option {option action args} "
-            global portname $option $newoption
-            ui_warn \"Port \$portname using deprecated option \\\"$option\\\".\"
-        "
-    }
-    option_proc $option warn_deprecated_$option
-}
-
-proc option_proc {option args} {
-    global option_procs $option
-    eval lappend option_procs($option) $args
-    # Add a read trace to the variable, as the option procedures have no access to reads
-    trace variable $option rwu option_proc_trace
-}
-
-# option_proc_trace
-# trace handler for option reads. Calls option procedures with correct arguments.
-proc option_proc_trace {optionName index op} {
-    global option_procs
-    upvar $optionName optionValue
-    switch $op {
-        w {
-            foreach p $option_procs($optionName) {
-                $p $optionName set $optionValue
-            }
-            return
-        }
-        r {
-            foreach p $option_procs($optionName) {
-                $p $optionName read
-            }
-            return
-        }
-        u {
-            foreach p $option_procs($optionName) {
-                $p $optionName delete
-                trace vdelete $optionName rwu $p
-            }
-            return
-        }
-    }
-}
-
-# commands
-# Accepts a list of arguments, of which several options are created
-# and used to form a standard set of command options.
-proc commands {args} {
-    foreach option $args {
-	options use_${option} ${option}.dir ${option}.pre_args ${option}.args ${option}.post_args ${option}.env ${option}.type ${option}.cmd
-    }
-}
-
-# Given a command name, assemble a command string
-# composed of the command options.
-proc command_string {command} {
-    global ${command}.dir ${command}.pre_args ${command}.args ${command}.post_args ${command}.env ${command}.type ${command}.cmd
-    
-    set cmdstring ""
-    if {[info exists ${command}.dir]} {
-	set cmdstring "cd \"[set ${command}.dir]\" &&"
-    }
-    
-    if {[info exists ${command}.cmd]} {
-	foreach string [set ${command}.cmd] {
-	    set cmdstring "$cmdstring $string"
-	}
-    } else {
-	set cmdstring "$cmdstring ${command}"
-    }
-    foreach var "${command}.pre_args ${command}.args ${command}.post_args" {
-	if {[info exists $var]} {
-	    foreach string [set ${var}] {
-		set cmdstring "$cmdstring $string"
-	    }
-	}
-    }
-    ui_debug "Assembled command: '$cmdstring'"
-    return $cmdstring
-}
-
-# Given a command name, execute it with the options.
-# command_exec command [-notty] [command_prefix [command_suffix]]
-# command			name of the command
-# command_prefix	additional command prefix (typically pipe command)
-# command_suffix	additional command suffix (typically redirection)
-proc command_exec {command args} {
-	global ${command}.env ${command}.env_array env
-	set notty 0
-	set command_prefix ""
-	set command_suffix ""
-
-	if {[llength $args] > 0} {
-		if {[lindex $args 0] == "-notty"} {
-			set notty 1
-			set args [lrange $args 1 end]
-		}
-
-		if {[llength $args] > 0} {
-			set command_prefix [lindex $args 0]
-			if {[llength $args] > 1} {
-				set command_suffix [lindex $args 1]
-			}
-		}
-	}
-	
-	# Set the environment.
-	# If the array doesn't exist, we create it with the value
-	# coming from ${command}.env
-	# Otherwise, it means the caller actually played with the environment
-	# array already (e.g. configure flags).
-	if {![array exists ${command}.env_array]} {
-		parse_environment ${command}
-	}
-	
-	# Debug that.
-    ui_debug "Environment: [environment_array_to_string ${command}.env_array]"
-
-	# Get the command string.
-	set cmdstring [command_string ${command}]
-	
-	# Call this command.
-	# TODO: move that to the system native call?
-	# Save the environment.
-	array set saved_env [array get env]
-	# Set the overriden variables from the portfile.
-	array set env [array get ${command}.env_array]
-	# Call the command.
-	set fullcmdstring "$command_prefix $cmdstring $command_suffix"
-	if {$notty} {
-		set code [catch {system -notty $fullcmdstring} result]
-	} else {
-		set code [catch {system $fullcmdstring} result]
-	}
-	# Unset the command array until next time.
-	array unset ${command}.env_array
-	
-	# Restore the environment.
-	array unset env *
-	array set env [array get saved_env]
-
-	# Return as if system had been called directly.	
-	return -code $code $result
-}
-
-# default
-# Sets a variable to the supplied default if it does not exist,
-# and adds a variable trace. The variable traces allows for delayed
-# variable and command expansion in the variable's default value.
-proc default {option val} {
-    global $option option_defaults
-    if {[info exists option_defaults($option)]} {
-	ui_debug "Re-registering default for $option"
-	# remove the old trace
-	trace vdelete $option rwu default_check
-    } else {
-	# If option is already set and we did not set it
-	# do not reset the value
-	if {[info exists $option]} {
-	    return
-	}
-    }
-    set option_defaults($option) $val
-    set $option $val
-    trace variable $option rwu default_check
-}
-
-# default_check
-# trace handler to provide delayed variable & command expansion
-# for default variable values
-proc default_check {optionName index op} {
-    global option_defaults $optionName
-    switch $op {
-	w {
-	    unset option_defaults($optionName)
-	    trace vdelete $optionName rwu default_check
-	    return
-	}
-	r {
-	    upvar $optionName option
-	    uplevel #0 set $optionName $option_defaults($optionName)
-	    return
-	}
-	u {
-	    unset option_defaults($optionName)
-	    trace vdelete $optionName rwu default_check
-	    return
-	}
-    }
-}
-
-# variant <provides> [<provides> ...] [requires <requires> [<requires>]]
-# Portfile level procedure to provide support for declaring variants
-proc variant {args} {
-    global all_variants PortInfo
-    upvar $args upargs
-    
-    set len [llength $args]
-    set code [lindex $args end]
-    set args [lrange $args 0 [expr $len - 2]]
-    
-    set ditem [variant_new "temp-variant"]
-    
-    # mode indicates what the arg is interpreted as.
-    # possible mode keywords are: requires, conflicts, provides
-    # The default mode is provides.  Arguments are added to the
-    # most recently specified mode (left to right).
-    set mode "provides"
-    foreach arg $args {
-	switch -exact $arg {
-	    provides { set mode "provides" }
-	    requires { set mode "requires" }
-	    conflicts { set mode "conflicts" }
-	    default { ditem_append $ditem $mode $arg }		
-        }
-    }
-    ditem_key $ditem name "[join [ditem_key $ditem provides] -]"
-    
-    # make a user procedure named variant-blah-blah
-    # we will call this procedure during variant-run
-    makeuserproc "variant-[ditem_key $ditem name]" \{$code\}
-    
-    # Export provided variant to PortInfo
-    # (don't list it twice if the variant was already defined, which can happen
-    # with universal or group code).
-    set variant_provides [ditem_key $ditem provides]
-    if {[variant_exists $variant_provides]} {
-		# This variant was already defined. Remove it from the dlist.
-		variant_remove_ditem $variant_provides
-	} else {
-	    lappend PortInfo(variants) $variant_provides
-	}
-
-	# Finally append the ditem to the dlist.
-    lappend all_variants $ditem
-}
-
-# variant_isset name
-# Returns 1 if variant name selected, otherwise 0
-proc variant_isset {name} {
-    global variations
-    
-    if {[info exists variations($name)] && $variations($name) == "+"} {
-	return 1
-    }
-    return 0
-}
-
-# variant_set name
-# Sets variant to run for current portfile
-proc variant_set {name} {
-    global variations
-    
-    set variations($name) +
-}
-
-# variant_unset name
-# Clear variant for current portfile
-proc variant_unset {name} {
-    global variations
-    
-    set variations($name) -
-}
-
-# variant_undef name
-# Undefine a variant for the current portfile.
-proc variant_undef {name} {
-    global variations PortInfo
-    
-    # Remove it from the list of selected variations.
-    array unset variations $name
-
-	# Remove the variant from the portinfo.
-	if {[info exists PortInfo(variants)]} {
-		set variant_index [lsearch -exact $PortInfo(variants) $name]
-		if {$variant_index >= 0} {
-			set new_list [lreplace $PortInfo(variants) $variant_index $variant_index]
-			if {"$new_list" == {}} {
-				unset PortInfo(variants) 
-			} else {
-				set PortInfo(variants) $new_list
-			}
-		}
-	}
-	
-	# And from the dlist.
-	variant_remove_ditem $name
-}
-
-# variant_remove_ditem name
-# Remove variant name's ditem from the all_variants dlist
-proc variant_remove_ditem {name} {
-	global all_variants
-	set item_index 0
-	foreach variant_item $all_variants {
-		set item_provides [ditem_key $variant_item provides]
-		if {$item_provides == $name} {
-			set all_variants [lreplace $all_variants $item_index $item_index]
-			break
-		}
-		
-		incr item_index
-	}
-}
-
-# variant_exists name
-# determine if a variant exists.
-proc variant_exists {name} {
-	global PortInfo
-	if {[info exists PortInfo(variants)] &&
-		[lsearch -exact $PortInfo(variants) $name] >= 0} {
-		return 1
-	}
-	
-	return 0
-}
-
-# platform <os> [<release>] [<arch>] 
-# Portfile level procedure to provide support for declaring platform-specifics
-# Basically, just wrap 'variant', so that Portfiles' platform declarations can
-# be more readable, and support arch and version specifics
-proc platform {args} {
-    global all_variants PortInfo os.platform os.arch os.version
-    upvar $args upargs
-    
-    set len [llength $args]
-    set code [lindex $args end]
-    set os [lindex $args 0]
-    set args [lrange $args 1 [expr $len - 2]]
-    
-    set ditem [variant_new "temp-variant"]
-    
-    foreach arg $args {
-	if {[regexp {(^[0-9]$)} $arg match result]} {
-	    set release $result
-	} elseif {[regexp {([a-zA-Z0-9]*)} $arg match result]} {
-	    set arch $result
-	}
-    }
-    
-    # Add the variant for this platform
-    set platform $os
-    if {[info exists release]} { set platform ${platform}_${release} }
-    if {[info exists arch]} { set platform ${platform}_${arch} }
-    
-    # Pick up a unique name.
-    if {[variant_exists $platform]} {
-    	set suffix 1
-    	while {[variant_exists "$platform-$suffix"]} {
-    		incr suffix
-    	}
-    	
-    	set platform "$platform-$suffix"
-    }
-    variant $platform $code
-    
-    # Set the variant if this platform matches the platform we're on
-    set matches 1
-    if {[info exists os.platform] && ${os.platform} == $os} { 
-	set sel_platform $os
-	if {[info exists os.version] && [info exists release]} {
-	    regexp {([0-9]*)[0-9\.]?} ${os.version} match major
-	    if {$major == $release } { 
-	    	set sel_platform ${sel_platform}_${release} 
-	    } else {
-		    set matches 0
-	    }
-	}
-	if {$matches == 1 && [info exists arch] && [info exists os.arch]} {
-		if {${os.arch} == $arch} {
-			set sel_platform ${sel_platform}_${arch}
-		} else {
-			set matches 0
-		}
-    }
-    if {$matches == 1} {
-    	variant_set $sel_platform
-    }
-    }
-}
-
-########### Environment utility functions ###########
-
-# Parse the environment string of a command, storing the values into the
-# associated environment array.
-proc parse_environment {command} {
-	global ${command}.env ${command}.env_array
-
-	if {[info exists ${command}.env]} {
-		# Flatten the environment string.
-		set the_environment ""
-		foreach str [set ${command}.env] {
-			set the_environment "$the_environment $str"
-		}
-	
-		while {[regexp "^(?: *)(\[^= \]+)=(\"|'|)(\[^\"'\].*?)\\2(?: +|$)(.*)$" ${the_environment} matchVar key delimiter value remaining]} {
-			set the_environment ${remaining}
-			set ${command}.env_array(${key}) ${value}
-		}
-	} else {
-		array set ${command}.env_array {}
-	}
-}
-
-# Append to the value in the parsed environment.
-# Leave the environment untouched if the value is empty.
-proc append_to_environment_value {command key value} {
-	global ${command}.env_array
-
-	if {[string length $value] == 0} {
-		return
-	}
-
-	# Parse out any delimiter.
-	set append_value $value
-	if {[regexp {^("|')(.*)\1$} $append_value matchVar append_delim matchedValue]} {
-		set append_value $matchedValue
-	}
-
-	if {[info exists ${command}.env_array($key)]} {
-		set original_value [set ${command}.env_array($key)]
-		set ${command}.env_array($key) "${original_value} ${append_value}"
-	} else {
-		set ${command}.env_array($key) $append_value
-	}
-}
-
-# Append several items to a value in the parsed environment.
-proc append_list_to_environment_value {command key vallist} {
-	foreach {value} $vallist {
-		append_to_environment_value ${command} $key $value
-	}
-}
-
-# Build the environment as a string.
-# Remark: this method is only used for debugging purposes.
-proc environment_array_to_string {environment_array} {
-	upvar 1 ${environment_array} env_array
-	
-	set theString ""
-	foreach {key value} [array get env_array] {
-		if {$theString == ""} {
-			set theString "$key='$value'"
-		} else {
-			set theString "${theString} $key='$value'"
-		}
-	}
-	
-	return $theString
-}
-
-########### Distname utility functions ###########
-
-# Given a distribution file name, return the appended tag
-# Example: getdisttag distfile.tar.gz:tag1 returns "tag1"
-# / isn't included in the regexp, thus allowing port specification in URLs.
-proc getdisttag {name} {
-    if {[regexp {.+:([0-9A-Za-z_-]+)$} $name match tag]} {
-        return $tag
-    } else {
-        return ""
-    }
-}
-
-# Given a distribution file name, return the name without an attached tag
-# Example : getdistname distfile.tar.gz:tag1 returns "distfile.tar.gz"
-# / isn't included in the regexp, thus allowing port specification in URLs.
-proc getdistname {name} {
-    regexp {(.+):[0-9A-Za-z_-]+$} $name match name
-    return $name
-}
-
-
-########### Misc Utility Functions ###########
-
-# tbool (testbool)
-# If the variable exists in the calling procedure's namespace
-# and is set to "yes", return 1. Otherwise, return 0
-proc tbool {key} {
-    upvar $key $key
-    if {[info exists $key]} {
-        if {[string equal -nocase [set $key] "yes"]} {
-            return 1
-        }
-    }
-    return 0
-}
-
-# ldelete
-# Deletes a value from the supplied list
-proc ldelete {list value} {
-    set ix [lsearch -exact $list $value]
-    if {$ix >= 0} {
-        return [lreplace $list $ix $ix]
-    }
-    return $list
-}
-
-# reinplace
-# Provides "sed in place" functionality
-proc reinplace {pattern args}  {
-    if {$args == ""} {
-    	ui_error "reinplace: no value given for parameter \"file\""
-	return -code error "no value given for parameter \"file\" to \"reinplace\"" 
-    }
-    
-    foreach file $args {
-	if {[catch {set tmpfile [mkstemp "/tmp/[file tail $file].sed.XXXXXXXX"]} error]} {
-		global errorInfo
-		ui_debug "$errorInfo"
-	    ui_error "reinplace: $error"
-	    return -code error "reinplace failed"
-	} else {
-	    # Extract the Tcl Channel number
-	    set tmpfd [lindex $tmpfile 0]
-	    # Set tmpfile to only the file name
-	    set tmpfile [lindex $tmpfile 1]
-	}
-	
-	if {[catch {exec sed $pattern < $file >@ $tmpfd} error]} {
-		global errorInfo
-		ui_debug "$errorInfo"
-	    ui_error "reinplace: $error"
-	    file delete "$tmpfile"
-	    close $tmpfd
-	    return -code error "reinplace sed(1) failed"
-	}
-	
-	close $tmpfd
-	
-	set attributes [file attributes $file]
-	# We need to overwrite this file
-	if {[catch {file attributes $file -permissions u+w} error]} {
-		global errorInfo
-		ui_debug "$errorInfo"
-	    ui_error "reinplace: $error"
-	    file delete "$tmpfile"
-	    return -code error "reinplace permissions failed"
-	}
-	
-	if {[catch {exec cp $tmpfile $file} error]} {
-		global errorInfo
-		ui_debug "$errorInfo"
-	    ui_error "reinplace: $error"
-	    file delete "$tmpfile"
-	    return -code error "reinplace copy failed"
-	}
-	
-	for {set i 0} {$i < [llength attributes]} {incr i} {
-	    set opt [lindex $attributes $i]
-	    incr i
-	    set arg [lindex $attributes $i]
-	    file attributes $file $opt $arg
-	}
-	
-	file delete "$tmpfile"
-    }
-    return
-}
-
-# delete
-# file delete -force by itself doesn't handle directories properly
-# on systems older than Tiger. However we can recurse this thing ourselves
-proc delete {args} {
-    foreach arg $args {
-        ui_debug "delete: $arg"
-        set stack [list $arg]
-        while {[llength $stack] > 0} {
-            set file [lindex $stack 0]
-            if {[string equal [file type $file] directory]} {
-                # it's a directory
-                set children [glob -nocomplain -directory $file * .*]
-                set children [ldelete [ldelete $children $file/.] $file/..]
-                if {[llength $children] > 0} {
-                    set stack [concat $children $stack]
-                } else {
-                    # directory is empty
-                    file delete -force -- $file
-                    set stack [lrange $stack 1 end]
-                }
-            } else {
-                # it's not a directory - kill it now
-                file delete -force -- $file
-                set stack [lrange $stack 1 end]
-            }
-        }
-    }
-}
-
-# touch
-# mimics the BSD touch command
-proc touch {args} {
-    while {[string match -* [lindex $args 0]]} {
-        set arg [string range [lindex $args 0] 1 end]
-        set args [lrange $args 1 end]
-        switch -- $arg {
-            a -
-            c -
-            m {set options($arg) yes}
-            r -
-            t {
-                set narg [lindex $args 0]
-                set args [lrange $args 1 end]
-                if {[string length $narg] == 0} {
-                    return -code error "touch: option requires an argument -- $arg"
-                }
-                set options($arg) $narg
-                set options(rt) $arg ;# later option overrides earlier
-            }
-            - break
-            default {return -code error "touch: illegal option -- $arg"}
-        }
-    }
-    
-    # parse the r/t options
-    if {[info exists options(rt)]} {
-        if {[string equal $options(rt) r]} {
-            # -r
-            # get atime/mtime from the file
-            if {[file exists $options(r)]} {
-                set atime [file atime $options(r)]
-                set mtime [file mtime $options(r)]
-            } else {
-                return -code error "touch: $options(r): No such file or directory"
-            }
-        } else {
-            # -t
-            # parse the time specification
-            # turn it into a CCyymmdd hhmmss
-            set timespec {^(?:(\d\d)?(\d\d))?(\d\d)(\d\d)(\d\d)(\d\d)(?:\.(\d\d))?$}
-            if {[regexp $timespec $options(t) {} CC YY MM DD hh mm SS]} {
-                if {[string length $YY] == 0} {
-                    set year [clock format [clock seconds] -format %Y]
-                } elseif {[string length $CC] == 0} {
-                    if {$YY >= 69 && $YY <= 99} {
-                        set year 19$YY
-                    } else {
-                        set year 20$YY
-                    }
-                } else {
-                    set year $CC$YY
-                }
-                if {[string length $SS] == 0} {
-                    set SS 00
-                }
-                set atime [clock scan "$year$MM$DD $hh$mm$SS"]
-                set mtime $atime
-            } else {
-                return -code error \
-                    {touch: out of range or illegal time specification: [[CC]YY]MMDDhhmm[.SS]}
-            }
-        }
-    } else {
-        set atime [clock seconds]
-        set mtime [clock seconds]
-    }
-    
-    # do we have any files to process?
-    if {[llength $args] == 0} {
-        # print usage
-        ui_msg {usage: touch [-a] [-c] [-m] [-r file] [-t [[CC]YY]MMDDhhmm[.SS]] file ...}
-        return
-    }
-    
-    foreach file $args {
-        if {![file exists $file]} {
-            if {[info exists options(c)]} {
-                continue
-            } else {
-                close [open $file w]
-            }
-        }
-        
-        if {[info exists options(a)] || ![info exists options(m)]} {
-            file atime $file $atime
-        }
-        if {[info exists options(m)] || ![info exists options(a)]} {
-            file mtime $file $mtime
-        }
-    }
-    return
-}
-
-# copy
-proc copy {args} {
-    exec file copy $args
-}
-
-# move
-proc move {args} {
-    exec file rename $args
-}
-
-# ln
-# Mimics the BSD ln implementation
-# ln [-f] [-h] [-s] [-v] source_file [target_file]
-# ln [-f] [-h] [-s] [-v] source_file ... target_dir
-proc ln {args} {
-    while {[string match -* [lindex $args 0]]} {
-        set arg [string range [lindex $args 0] 1 end]
-        set args [lrange $args 1 end]
-        switch -- $arg {
-            f -
-            h -
-            s -
-            v {set options($arg) yes}
-            - break
-            default {return -code error "ln: illegal option -- $arg"}
-        }
-    }
-    
-    if {[llength $args] == 0} {
-        ui_msg {usage: ln [-f] [-h] [-s] [-v] source_file [target_file]}
-        ui_msg {       ln [-f] [-h] [-s] [-v] file ... directory}
-        return
-    } elseif {[llength $args] == 1} {
-        set files $args
-        set target ./
-    } else {
-        set files [lrange $args 0 [expr [llength $args] - 2]]
-        set target [lindex $args end]
-    }
-    
-    foreach file $files {
-        if {[file isdirectory $file] && ![info exists options(s)]} {
-            return -code error "ln: $file: Is a directory"
-        }
-        
-        if {[file isdirectory $target] && ![info exists options(h)]} {
-            set linktarget [file join $target [file tail $file]]
-        } else {
-            set linktarget $target
-        }
-        
-        if {[file exists $linktarget] && ![info exists options(f)]} {
-            return -code error "ln: $linktarget: File exists"
-        }
-        
-        if {[llength $files] > 2} {
-            if {![file exists $linktarget]} {
-                return -code error "ln: $linktarget: No such file or directory"
-            } elseif {![file isdirectory $target]} {
-                # this error isn't striclty what BSD ln gives, but I think it's more useful
-                return -code error "ln: $target: Not a directory"
-            }
-        }
-        
-        if {[info exists options(v)]} {
-            ui_msg "ln: $linktarget -> $file"
-        }
-        if {[info exists options(s)]} {
-            file link -symbolic $linktarget $file
-        } else {
-            file link -hard $linktarget $file
-        }
-    }
-    return
-}
-
-# filefindbypath
-# Provides searching of the standard path for included files
-proc filefindbypath {fname} {
-    global distpath filesdir workdir worksrcdir portpath
-    
-    if {[file readable $portpath/$fname]} {
-	return $portpath/$fname
-    } elseif {[file readable $portpath/$filesdir/$fname]} {
-	return $portpath/$filesdir/$fname
-    } elseif {[file readable $distpath/$fname]} {
-	return $distpath/$fname
-    }
-    return ""
-}
-
-# include
-# Source a file, looking for it along a standard search path.
-proc include {fname} {
-    set tgt [filefindbypath $fname]
-    if {[string length $tgt]} {
-	uplevel "source $tgt"
-    } else {
-	return -code error "Unable to find include file $fname"
-    }
-}
-
-# makeuserproc
-# This procedure re-writes the user-defined custom target to include
-# all the globals in its scope.  This is undeniably ugly, but I haven't
-# thought of any other way to do this.
-proc makeuserproc {name body} {
-    regsub -- "^\{(.*?)" $body "\{ \n foreach g \[info globals\] \{ \n global \$g \n \} \n \\1" body
-    eval "proc $name {} $body"
-}
-
-# backup
-# Operates on universal_filelist, creates universal_archlist
-# Save single-architecture files, a temporary location, preserving the original
-# directory structure.
-
-proc backup {arch} {
-    global universal_archlist universal_filelist workpath
-    lappend universal_archlist ${arch}
-    foreach file ${universal_filelist} {
-        set filedir [file dirname $file]
-        xinstall -d ${workpath}/${arch}/${filedir}
-        xinstall ${file} ${workpath}/${arch}/${filedir}
-    }
-}
-
-# lipo
-# Operates on universal_filelist, universal_archlist.
-# Run lipo(1) on a list of single-arch files.
-
-proc lipo {} {
-    global universal_archlist universal_filelist workpath
-    foreach file ${universal_filelist} {
-        xinstall -d [file dirname $file]
-        file delete ${file}
-        set lipoSources ""
-        foreach arch $universal_archlist {
-            append lipoSources "-arch ${arch} ${workpath}/${arch}/${file} "
-        }
-        system "lipo ${lipoSources}-create -output ${file}"
-    }
-}
-
-########### Internal Dependency Manipulation Procedures ###########
-
-proc target_run {ditem} {
-    global target_state_fd portpath portname portversion portrevision portvariants ports_force variations workpath ports_trace PortInfo
-    set result 0
-    set skipped 0
-    set procedure [ditem_key $ditem procedure]
-    if {$procedure != ""} {
-	set name [ditem_key $ditem name]
-	
-	if {[ditem_contains $ditem init]} {
-	    set result [catch {[ditem_key $ditem init] $name} errstr]
-	}
-	
-	if { ![info exists portvariants] } {
-		set portvariants ""
-		set vlist [lsort -ascii [array names variations]]
-
-		# Put together variants in the form +foo+bar for the registry
-		foreach v $vlist {
-			if { ![string equal $v [option os.platform]] && ![string equal $v [option os.arch]] } {
-				set portvariants "${portvariants}+${v}"
-			}
-		}
-	}
-
-	if {$result == 0} {
-		# Skip the step if required and explain why through ui_debug.
-		# 1st case: the step was already done (as mentioned in the state file)
-		if {[check_statefile target $name $target_state_fd]} {
-		    ui_debug "Skipping completed $name ($portname)"
-		    set skipped 1
-		# 2nd case: the step is not to always be performed
-		# and this exact port/version/revision/variants is already installed
-		# and user didn't mention -f
-		# and portfile didn't change since installation.
-		} elseif {[ditem_key $ditem runtype] != "always"
-			&& [registry_exists $portname $portversion $portrevision $portvariants]
-			&& !([info exists ports_force] && $ports_force == "yes")} {
-						
-			# Did the Portfile change since installation?
-			set regref [registry_open $portname $portversion $portrevision $portvariants]
-			
-			set installdate [registry_prop_retr $regref date]
-			if { $installdate != 0
-				&& $installdate < [file mtime ${portpath}/Portfile]} {
-				ui_debug "Portfile changed since installation"
-			} else {
-				# Say we're skipping.
-				set skipped 1
-				
-				ui_debug "Skipping $name ($portname) since this port is already installed"
-			}
-			
-			# Something to close the registry entry may be called here, if it existed.
-		# 3rd case: the same port/version/revision/Variants is already active
-		# and user didn't mention -f
-		} elseif {$name == "com.apple.activate"
-			&& [registry_exists $portname $portversion $portrevision $portvariants]
-			&& !([info exists ports_force] && $ports_force == "yes")} {
-			
-			# Is port active?
-			set regref [registry_open $portname $portversion $portrevision $portvariants]
-			
-			if { [registry_prop_retr $regref active] != 0 } {
-				# Say we're skipping.
-				set skipped 1
-				
-				ui_debug "Skipping $name ($portname) since this port is already active"
-			}
-			
-		}
-			
-		# otherwise execute the task.
-		if {$skipped == 0} {
-			set target [ditem_key $ditem provides]
-			if {([info exists ports_trace]
-				&& $ports_trace == "yes"
-				&& $target != "clean")} {
-				trace_start $workpath
-
-				# Enable the fence to prevent any creation/modification
-				# outside the sandbox.
-				if {$target != "activate"
-					&& $target != "archive"
-					&& $target != "fetch"
-					&& $target != "install"} {
-					trace_enable_fence
-				}
-			}
-
-			# Execute pre-run procedure
-			if {[ditem_contains $ditem prerun]} {
-			set result [catch {[ditem_key $ditem prerun] $name} errstr]
-			}
-			
-			if {$result == 0} {
-			foreach pre [ditem_key $ditem pre] {
-				ui_debug "Executing $pre"
-				set result [catch {$pre $name} errstr]
-				if {$result != 0} { break }
-			}
-			}
-			
-			if {$result == 0} {
-			ui_debug "Executing $name ($portname)"
-			set result [catch {$procedure $name} errstr]
-			}
-			
-			if {$result == 0} {
-			foreach post [ditem_key $ditem post] {
-				ui_debug "Executing $post"
-				set result [catch {$post $name} errstr]
-				if {$result != 0} { break }
-			}
-			}
-			# Execute post-run procedure
-			if {[ditem_contains $ditem postrun] && $result == 0} {
-			set postrun [ditem_key $ditem postrun]
-			ui_debug "Executing $postrun"
-			set result [catch {$postrun $name} errstr]
-			}
-
-			# Check dependencies & file creations outside workpath.
-			if {[info exists ports_trace]
-				&& $ports_trace == "yes"
-				&& $target != "clean"} {
-				
-				# Don't check dependencies for extract (they're not honored
-				# anyway). This avoids warnings about bzip2.
-				if {$target != "extract"} {
-					set depends {}
-					set deptypes {}
-					
-					# Determine deptypes to look for based on target
-					switch $target {
-						configure	{ set deptypes "depends_lib" }
-						
-						build		{ set deptypes "depends_lib depends_build" }
-						
-						test		-
-						destroot	-
-						install		-
-						archive		-
-						pkg			-
-						mpkg		-
-						rpmpackage	-
-						dpkg		-
-						activate    -
-						""			{ set deptypes "depends_lib depends_build depends_run" }
-					}
-					
-					# Gather the dependencies for deptypes
-					foreach deptype $deptypes {
-						# Add to the list of dependencies if the option exists and isn't empty.
-						if {[info exists PortInfo($deptype)] && $PortInfo($deptype) != ""} {
-							set depends [concat $depends $PortInfo($deptype)]
-						}
-					}
-	
-					# Dependencies are in the form verb:[param:]port
-					set depsPorts {}
-					foreach depspec $depends {
-						# grab the portname portion of the depspec
-						set dep_portname [lindex [split $depspec :] end]
-						lappend depsPorts $dep_portname
-					}
-					trace_check_deps $target $depsPorts
-				}
-				
-				trace_check_violations
-				
-				# End of trace.
-				trace_stop
-			}
-		}
-	}
-	if {$result == 0} {
-		# Only write to state file if:
-		# - we indeed performed this step.
-		# - this step is not to always be performed
-		# - this step must be written to file
-		if {$skipped == 0
-	    && [ditem_key $ditem runtype] != "always"
-	    && [ditem_key $ditem state] != "no"} {
-		write_statefile target $name $target_state_fd
-	    }
-	} else {
-	    ui_error "Target $name returned: $errstr"
-	    set result 1
-	}
-	
-    } else {
-	ui_info "Warning: $name does not have a registered procedure"
-	set result 1
-    }
-    
-    return $result
-}
-
-proc eval_targets {target} {
-    global targets target_state_fd portname
-    set dlist $targets
-    
-    # Select the subset of targets under $target
-    if {$target != ""} {
-        set matches [dlist_search $dlist provides $target]
-	
-        if {[llength $matches] > 0} {
-	    set dlist [dlist_append_dependents $dlist [lindex $matches 0] [list]]
-	    # Special-case 'all'
-	} elseif {$target != "all"} {
-	    ui_error "unknown target: $target"
-            return 1
-        }
-    }
-    
-    # Restore the state from a previous run.
-    set target_state_fd [open_statefile]
-    
-    set dlist [dlist_eval $dlist "" target_run]
-    
-    if {[llength $dlist] > 0} {
-	# somebody broke!
-	set errstring "Warning: the following items did not execute (for $portname):"
-	foreach ditem $dlist {
-	    append errstring " [ditem_key $ditem name]"
-	}
-	ui_info $errstring
-	set result 1
-    } else {
-	set result 0
-    }
-    
-    close $target_state_fd
-    return $result
-}
-
-# open_statefile
-# open file to store name of completed targets
-proc open_statefile {args} {
-    global workpath worksymlink portname portpath ports_ignore_older
-    
-    if {![file isdirectory $workpath]} {
-	file mkdir $workpath
-    }
-    # flock Portfile
-    set statefile [file join $workpath .darwinports.${portname}.state]
-    if {[file exists $statefile]} {
-	if {![file writable $statefile]} {
-	    return -code error "$statefile is not writable - check permission on port directory"
-	}
-	if {!([info exists ports_ignore_older] && $ports_ignore_older == "yes") && [file mtime $statefile] < [file mtime ${portpath}/Portfile]} {
-	    ui_msg "Portfile changed since last build; discarding previous state."
-	    #file delete $statefile
-	    exec rm -rf [file join $workpath]
-	    exec mkdir [file join $workpath]
-	}
-    }
-
-    # Create a symlink to the workpath for port authors 
-    if {![file isdirectory $worksymlink]} {
-	    exec ln -sf $workpath $worksymlink
-    }
-    
-    set fd [open $statefile a+]
-    if {[catch {flock $fd -exclusive -noblock} result]} {
-        if {"$result" == "EAGAIN"} {
-            ui_msg "Waiting for lock on $statefile"
-	} elseif {"$result" == "EOPNOTSUPP"} {
-	    # Locking not supported, just return
-	    return $fd
-        } else {
-            return -code error "$result obtaining lock on $statefile"
-        }
-    }
-    flock $fd -exclusive
-    return $fd
-}
-
-# check_statefile
-# Check completed/selected state of target/variant $name
-proc check_statefile {class name fd} {
-    global portpath workdir
-    
-    seek $fd 0
-    while {[gets $fd line] >= 0} {
-	if {$line == "$class: $name"} {
-	    return 1
-	}
-    }
-    return 0
-}
-
-# write_statefile
-# Set target $name completed in the state file
-proc write_statefile {class name fd} {
-    if {[check_statefile $class $name $fd]} {
-	return 0
-    }
-    seek $fd 0 end
-    puts $fd "$class: $name"
-    flush $fd
-}
-
-# check_statefile_variants
-# Check that recorded selection of variants match the current selection
-proc check_statefile_variants {variations fd} {
-    upvar $variations upvariations
-    
-    seek $fd 0
-    while {[gets $fd line] >= 0} {
-	if {[regexp "variant: (.*)" $line match name]} {
-	    set oldvariations([string range $name 1 end]) [string range $name 0 0]
-	}
-    }
-    
-    set mismatch 0
-    if {[array size oldvariations] > 0} {
-	if {[array size oldvariations] != [array size upvariations]} {
-	    set mismatch 1
-	} else {
-	    foreach key [array names upvariations *] {
-		if {![info exists oldvariations($key)] || $upvariations($key) != $oldvariations($key)} {
-		    set mismatch 1
-		    break
-		}
-	    }
-	}
-    }
-    
-    return $mismatch
-}
-
-########### Port Variants ###########
-
-# Each variant which provides a subset of the requested variations
-# will be chosen.  Returns a list of the selected variants.
-proc choose_variants {dlist variations} {
-    upvar $variations upvariations
-    
-    set selected [list]
-    
-    foreach ditem $dlist {
-	# Enumerate through the provides, tallying the pros and cons.
-	set pros 0
-	set cons 0
-	set ignored 0
-	foreach flavor [ditem_key $ditem provides] {
-	    if {[info exists upvariations($flavor)]} {
-		if {$upvariations($flavor) == "+"} {
-		    incr pros
-		} elseif {$upvariations($flavor) == "-"} {
-		    incr cons
-		}
-	    } else {
-		incr ignored
-	    }
-	}
-	
-	if {$cons > 0} { continue }
-	
-	if {$pros > 0 && $ignored == 0} {
-	    lappend selected $ditem
-	}
-    }
-    return $selected
-}
-
-proc variant_run {ditem} {
-    set name [ditem_key $ditem name]
-    ui_debug "Executing variant $name provides [ditem_key $ditem provides]"
-    
-    # test for conflicting variants
-    foreach v [ditem_key $ditem conflicts] {
-	if {[variant_isset $v]} {
-	    ui_error "Variant $name conflicts with $v"
-	    return 1
-	}
-    }
-    
-    # execute proc with same name as variant.
-    if {[catch "variant-${name}" result]} {
-	global errorInfo
-	ui_debug "$errorInfo"
-	ui_error "Error executing $name: $result"
-	return 1
-    }
-    return 0
-}
-
-proc eval_variants {variations target} {
-    global all_variants ports_force PortInfo
-    set dlist $all_variants
-    set result 0
-    upvar $variations upvariations
-    set chosen [choose_variants $dlist upvariations]
-	set portname $PortInfo(name)
-
-	# Check to make sure the requested variations are available with this 
-	# port, if one is not, warn the user and remove the variant from the 
-	# array.
-	foreach key [array names upvariations *] {
-		if {![info exists PortInfo(variants)] || 
-			[lsearch $PortInfo(variants) $key] == -1} {
-			ui_debug "Requested variant $key is not provided by port $portname."
-			array unset upvariations $key
-		}
-	}
-
-    # now that we've selected variants, change all provides [a b c] to [a-b-c]
-    # this will eliminate ambiguity between item a, b, and a-b while fulfilling requirments.
-    #foreach obj $dlist {
-    #    $obj set provides [list [join [$obj get provides] -]]
-    #}
-    
-    set newlist [list]
-    foreach variant $chosen {
-		set newlist [dlist_append_dependents $dlist $variant $newlist]
-    }
-    
-    set dlist [dlist_eval $newlist "" variant_run]
-    if {[llength $dlist] > 0} {
-		return 1
-    }
-    
-    # Make sure the variations match those stored in the statefile.
-    # If they don't match, print an error indicating a 'port clean' 
-    # should be performed.  
-    # - Skip this test if the statefile is empty.
-    # - Skip this test if performing a clean.
-    # - Skip this test if ports_force was specified.
-    
-    if {$target != "clean" && 
-	!([info exists ports_force] && $ports_force == "yes")} {
-	set state_fd [open_statefile]
-	
-	if {[check_statefile_variants upvariations $state_fd]} {
-	    ui_error "Requested variants do not match original selection.\nPlease perform 'port clean $portname' or specify the force option."
-	    set result 1
-	} else {
-	    # Write variations out to the statefile
-	    foreach key [array names upvariations *] {
-		write_statefile variant $upvariations($key)$key $state_fd
-	    }
-	}
-	
-	close $state_fd
-    }
-    
-    return $result
-}
-
-# Target class definition.
-
-# constructor for target object
-proc target_new {name procedure} {
-    global targets
-    set ditem [ditem_create]
-    
-    ditem_key $ditem name $name
-    ditem_key $ditem procedure $procedure
-    
-    lappend targets $ditem
-    
-    return $ditem
-}
-
-proc target_provides {ditem args} {
-    global targets
-    # Register the pre-/post- hooks for use in Portfile.
-    # Portfile syntax: pre-fetch { puts "hello world" }
-    # User-code exceptions are caught and returned as a result of the target.
-    # Thus if the user code breaks, dependent targets will not execute.
-    foreach target $args {
-        set origproc [ditem_key $ditem procedure]
-        set ident [ditem_key $ditem name]
-        if {[info commands $target] != ""} {
-            ui_debug "$ident registered provides '$target', a pre-existing procedure. Target override will not be provided"
-        } else {
-            proc $target {args} "
-                variable proc_index
-                set proc_index \[llength \[ditem_key $ditem proc\]\]
-                ditem_key $ditem procedure proc-${ident}-${target}-\${proc_index}
-                proc proc-${ident}-${target}-\${proc_index} {name} \"
-                    if {\\\[catch userproc-${ident}-${target}-\${proc_index} result\\\]} {
-                        return -code error \\\$result
-                    } else {
-                        return 0
-                    }
-                \"
-                proc do-$target {} { $origproc $target }
-                makeuserproc userproc-${ident}-${target}-\${proc_index} \$args
-            "
-        }
-        proc pre-$target {args} "
-            variable proc_index
-            set proc_index \[llength \[ditem_key $ditem pre\]\]
-            ditem_append $ditem pre proc-pre-${ident}-${target}-\${proc_index}
-            proc proc-pre-${ident}-${target}-\${proc_index} {name} \"
-                if {\\\[catch userproc-pre-${ident}-${target}-\${proc_index} result\\\]} {
-                    return -code error \\\$result
-                } else {
-                    return 0
-                }
-            \"
-            makeuserproc userproc-pre-${ident}-${target}-\${proc_index} \$args
-        "
-        proc post-$target {args} "
-            variable proc_index
-            set proc_index \[llength \[ditem_key $ditem post\]\]
-            ditem_append $ditem post proc-post-${ident}-${target}-\${proc_index}
-            proc proc-post-${ident}-${target}-\${proc_index} {name} \"
-                if {\\\[catch userproc-post-${ident}-${target}-\${proc_index} result\\\]} {
-                    return -code error \\\$result
-                } else {
-                    return 0
-                }
-            \"
-            makeuserproc userproc-post-${ident}-${target}-\${proc_index} \$args
-        "
-    }
-    eval ditem_append $ditem provides $args
-}
-
-proc target_requires {ditem args} {
-    eval ditem_append $ditem requires $args
-}
-
-proc target_uses {ditem args} {
-    eval ditem_append $ditem uses $args
-}
-
-proc target_deplist {ditem args} {
-    eval ditem_append $ditem deplist $args
-}
-
-proc target_prerun {ditem args} {
-    eval ditem_append $ditem prerun $args
-}
-
-proc target_postrun {ditem args} {
-    eval ditem_append $ditem postrun $args
-}
-
-proc target_runtype {ditem args} {
-    eval ditem_append $ditem runtype $args
-}
-
-proc target_state {ditem args} {
-    eval ditem_append $ditem state $args
-}
-
-proc target_init {ditem args} {
-    eval ditem_append $ditem init $args
-}
-
-##### variant class #####
-
-# constructor for variant objects
-proc variant_new {name} {
-    set ditem [ditem_create]
-    ditem_key $ditem name $name
-    return $ditem
-}
-
-proc handle_default_variants {option action args} {
-    global variations
-    switch -regex $action {
-	set|append {
-	    foreach v $args {
-		if {[regexp {([-+])([-A-Za-z0-9_]+)} $v whole val variant]} {
-		    if {![info exists variations($variant)]} {
-			set variations($variant) $val
-		    }
-		}
-	    }
-	}
-	delete {
-	    # xxx
-	}
-    }
-}
-
-
-# builds the specified port (looked up in the index) to the specified target
-# doesn't yet support options or variants...
-# newworkpath defines the port's workpath - useful for when one port relies
-# on the source, etc, of another
-proc portexec_int {portname target {newworkpath ""}} {
-    ui_debug "Executing $target ($portname)"
-    set variations [list]
-    if {$newworkpath == ""} {
-        array set options [list]
-    } else {
-        set options(workpath) ${newworkpath}
-    }
-    # Escape regex special characters
-    regsub -all "(\\(){1}|(\\)){1}|(\\{1}){1}|(\\+){1}|(\\{1}){1}|(\\{){1}|(\\}){1}|(\\^){1}|(\\$){1}|(\\.){1}|(\\\\){1}" $portname "\\\\&" search_string 
-    
-    set res [dport_search ^$search_string\$]
-    if {[llength $res] < 2} {
-        ui_error "Dependency $portname not found"
-        return -1
-    }
-    
-    array set portinfo [lindex $res 1]
-    set porturl $portinfo(porturl)
-    if {[catch {set worker [dport_open $porturl [array get options] $variations]} result]} {
-		global errorInfo
-		ui_debug "$errorInfo"
-        ui_error "Opening $portname $target failed: $result"
-        return -1
-    }
-    if {[catch {dport_exec $worker $target} result] || $result != 0} {
-		global errorInfo
-		ui_debug "$errorInfo"
-        ui_error "Execution $portname $target failed: $result"
-        dport_close $worker
-        return -1
-    }
-    dport_close $worker
-    
-    return 0
-}
-
-# portfile primitive that calls portexec_int with newworkpath == ${workpath}
-proc portexec {portname target} {
-    global workpath
-    return [portexec_int $portname $target $workpath]
-}
-
-proc adduser {name args} {
-    global os.platform
-    set passwd {\*}
-    set uid [nextuid]
-    set gid [existsgroup nogroup]
-    set realname ${name}
-    set home /dev/null
-    set shell /dev/null
-    
-    foreach arg $args {
-	if {[regexp {([a-z]*)=(.*)} $arg match key val]} {
-	    regsub -all " " ${val} "\\ " val
-	    set $key $val
-	}
-    }
-    
-    if {[existsuser ${name}] != 0 || [existsuser ${uid}] != 0} {
-	return
-    }
-    
-    if {${os.platform} == "darwin"} {
-	system "niutil -create . /users/${name}"
-	system "niutil -createprop . /users/${name} name ${name}"
-	system "niutil -createprop . /users/${name} passwd ${passwd}"
-	system "niutil -createprop . /users/${name} uid ${uid}"
-	system "niutil -createprop . /users/${name} gid ${gid}"
-	system "niutil -createprop . /users/${name} realname ${realname}"
-	system "niutil -createprop . /users/${name} home ${home}"
-	system "niutil -createprop . /users/${name} shell ${shell}"
-    } else {
-	# XXX adduser is only available for darwin, add more support here
-	ui_warn "WARNING: adduser is not implemented on ${os.platform}."
-	ui_warn "The requested user was not created."
-    }
-}
-
-proc addgroup {name args} {
-    global os.platform
-    set gid [nextgid]
-    set passwd {\*}
-    set users ""
-    
-    foreach arg $args {
-	if {[regexp {([a-z]*)=(.*)} $arg match key val]} {
-	    regsub -all " " ${val} "\\ " val
-	    set $key $val
-	}
-    }
-    
-    if {[existsgroup ${name}] != 0 || [existsgroup ${gid}] != 0} {
-	return
-    }
-    
-    if {${os.platform} == "darwin"} {
-	system "niutil -create . /groups/${name}"
-	system "niutil -createprop . /groups/${name} name ${name}"
-	system "niutil -createprop . /groups/${name} gid ${gid}"
-	system "niutil -createprop . /groups/${name} passwd ${passwd}"
-	system "niutil -createprop . /groups/${name} users ${users}"
-    } else {
-	# XXX addgroup is only available for darwin, add more support here
-	ui_warn "WARNING: addgroup is not implemented on ${os.platform}."
-	ui_warn "The requested group was not created."
-    }
-}
-
-# proc to calculate size of a directory
-# moved here from portpkg.tcl
-proc dirSize {dir} {
-    set size    0;
-    foreach file [readdir $dir] {
-	if {[file type [file join $dir $file]] == "link" } {
-	    continue
-	}
-	if {[file isdirectory [file join $dir $file]]} {
-	    incr size [dirSize [file join $dir $file]]
-	} else {
-	    incr size [file size [file join $dir $file]];
-	}
-    }
-    return $size;
-}
-
-# check for a binary in the path
-# returns an error code if it can not be found
-proc binaryInPath {binary} {
-    global env
-    foreach dir [split $env(PATH) :] { 
-	if {[file executable [file join $dir $binary]]} {
-	    return [file join $dir $binary]
-	}
-    }
-    
-    return -code error [format [msgcat::mc "Failed to locate '%s' in path: '%s'"] $binary $env(PATH)];
-}
-
-# Set the UI prefix to something standard (so it can be grepped for in output)
-proc set_ui_prefix {} {
-	global UI_PREFIX env
-	if {[info exists env(UI_PREFIX)]} {
-		set UI_PREFIX $env(UI_PREFIX)
-	} else {
-		set UI_PREFIX "---> "
-	}
-}
-
-# Use a specified group/version.
-proc PortGroup {group version} {
-	global portresourcepath
-
-	set groupFile ${portresourcepath}/group/${group}-${version}.tcl
-
-	if {[file exists $groupFile]} {
-		uplevel "source $groupFile"
-	} else {
-		ui_warn "Group file could not be located."
-	}
-}
-
-# check if archive type is supported by current system
-# returns an error code if it is not
-proc archiveTypeIsSupported {type} {
-    global os.platform os.version
-	set errmsg ""
-	switch -regex $type {
-		cp(io|gz) {
-			set pax "pax"
-			if {[catch {set pax [binaryInPath $pax]} errmsg] == 0} {
-				if {[regexp {z$} $type]} {
-					set gzip "gzip"
-					if {[catch {set gzip [binaryInPath $gzip]} errmsg] == 0} {
-						return 0
-					}
-				} else {
-					return 0
-				}
-			}
-		}
-		t(ar|bz|gz) {
-			set tar "tar"
-			if {[catch {set tar [binaryInPath $tar]} errmsg] == 0} {
-				if {[regexp {z$} $type]} {
-					if {[regexp {bz$} $type]} {
-						set gzip "bzip2"
-					} else {
-						set gzip "gzip"
-					}
-					if {[catch {set gzip [binaryInPath $gzip]} errmsg] == 0} {
-						return 0
-					}
-				} else {
-					return 0
-				}
-			}
-		}
-		xar {
-			set xar "xar"
-			if {[catch {set xar [binaryInPath $xar]} errmsg] == 0} {
-				return 0
-			}
-		}
-		zip {
-			set zip "zip"
-			if {[catch {set zip [binaryInPath $zip]} errmsg] == 0} {
-				set unzip "unzip"
-				if {[catch {set unzip [binaryInPath $unzip]} errmsg] == 0} {
-					return 0
-				}
-			}
-		}
-		default {
-			return -code error [format [msgcat::mc "Invalid port archive type '%s' specified!"] $type]
-		}
-	}
-	return -code error [format [msgcat::mc "Unsupported port archive type '%s': %s"] $type $errmsg]
-}
-

Copied: branches/dp2mp-move/base/src/port1.0/portutil.tcl (from rev 24451, trunk/base/src/port1.0/portutil.tcl)
===================================================================
--- branches/dp2mp-move/base/src/port1.0/portutil.tcl	                        (rev 0)
+++ branches/dp2mp-move/base/src/port1.0/portutil.tcl	2007-04-24 17:28:16 UTC (rev 24454)
@@ -0,0 +1,1778 @@
+# et:ts=4
+# portutil.tcl
+# $Id$
+#
+# Copyright (c) 2004 Robert Shaw <rshaw at opendarwin.org>
+# Copyright (c) 2002 Apple Computer, Inc.
+# Copyright (c) 2006 Markus W. Weissmann <mww at opendarwin.org>
+# 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 Apple Computer, 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
+# 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 portutil 1.0
+package require Pextlib 1.0
+package require darwinports_dlist 1.0
+package require msgcat
+package require porttrace 1.0
+
+global targets target_uniqid all_variants
+
+set targets [list]
+set target_uniqid 0
+
+set all_variants [list]
+
+########### External High Level Procedures ###########
+
+namespace eval options {
+}
+
+# option
+# This is an accessor for Portfile options.  Targets may use
+# this in the same style as the standard Tcl "set" procedure.
+#	name  - the name of the option to read or write
+#	value - an optional value to assign to the option
+
+proc option {name args} {
+    # XXX: right now we just transparently use globals
+    # eventually this will need to bridge the options between
+    # the Portfile's interpreter and the target's interpreters.
+    global $name
+    if {[llength $args] > 0} {
+	ui_debug "setting option $name to $args"
+	set $name [lindex $args 0]
+    }
+    return [set $name]
+}
+
+# exists
+# This is an accessor for Portfile options.  Targets may use
+# this procedure to test for the existence of a Portfile option.
+#	name - the name of the option to test for existence
+
+proc exists {name} {
+    # XXX: right now we just transparently use globals
+    # eventually this will need to bridge the options between
+    # the Portfile's interpreter and the target's interpreters.
+    global $name
+    return [info exists $name]
+}
+
+# options
+# Exports options in an array as externally callable procedures
+# Thus, "options name date" would create procedures named "name"
+# and "date" that set global variables "name" and "date", respectively
+# When an option is modified in any way, options::$option is called,
+# if it exists
+# Arguments: <list of options>
+proc options {args} {
+    foreach option $args {
+        proc $option {args} "
+            global ${option} user_options option_procs
+            if {!\[info exists user_options(${option})\]} {
+                set ${option} \$args
+            }
+        "
+        proc ${option}-delete {args} "
+            global ${option} user_options option_procs
+            if {!\[info exists user_options(${option})\] && \[info exists ${option}\]} {
+                foreach val \$args {
+                   set ${option} \[ldelete \${$option} \$val\]
+                }
+                if {\[string length \${${option}}\] == 0} {
+                    unset ${option}
+                }
+            }
+        "
+        proc ${option}-append {args} "
+            global ${option} user_options option_procs
+            if {!\[info exists user_options(${option})\]} {
+                if {\[info exists ${option}\]} {
+                    set ${option} \[concat \${$option} \$args\]
+                } else {
+                    set ${option} \$args
+                }
+            }
+        "
+    }
+}
+
+proc options_export {args} {
+    foreach option $args {
+        proc options::export-${option} {args} "
+            global ${option} PortInfo
+            if {\[info exists ${option}\]} {
+                set PortInfo(${option}) \${${option}}
+            } else {
+                unset PortInfo(${option})
+            }
+        "
+        option_proc ${option} options::export-${option}
+    }
+}
+
+# option_deprecate
+# Causes a warning to be printed when an option is set or accessed
+proc option_deprecate {option {newoption ""} } {
+    # If a new option is specified, default the option to {${newoption}}
+    # Display a warning
+    if {$newoption != ""} {
+        proc warn_deprecated_${option} {option action args} "
+            global portname $option $newoption
+            if {\$action != \"read\"} {
+                $newoption \$$option
+            } else {
+                ui_warn \"Port \$portname using deprecated option \\\"$option\\\".\"
+                $option \[set $newoption\]
+            }
+        "
+    } else {
+        proc warn_deprecated_$option {option action args} "
+            global portname $option $newoption
+            ui_warn \"Port \$portname using deprecated option \\\"$option\\\".\"
+        "
+    }
+    option_proc $option warn_deprecated_$option
+}
+
+proc option_proc {option args} {
+    global option_procs $option
+    eval lappend option_procs($option) $args
+    # Add a read trace to the variable, as the option procedures have no access to reads
+    trace variable $option rwu option_proc_trace
+}
+
+# option_proc_trace
+# trace handler for option reads. Calls option procedures with correct arguments.
+proc option_proc_trace {optionName index op} {
+    global option_procs
+    upvar $optionName optionValue
+    switch $op {
+        w {
+            foreach p $option_procs($optionName) {
+                $p $optionName set $optionValue
+            }
+            return
+        }
+        r {
+            foreach p $option_procs($optionName) {
+                $p $optionName read
+            }
+            return
+        }
+        u {
+            foreach p $option_procs($optionName) {
+                $p $optionName delete
+                trace vdelete $optionName rwu $p
+            }
+            return
+        }
+    }
+}
+
+# commands
+# Accepts a list of arguments, of which several options are created
+# and used to form a standard set of command options.
+proc commands {args} {
+    foreach option $args {
+	options use_${option} ${option}.dir ${option}.pre_args ${option}.args ${option}.post_args ${option}.env ${option}.type ${option}.cmd
+    }
+}
+
+# Given a command name, assemble a command string
+# composed of the command options.
+proc command_string {command} {
+    global ${command}.dir ${command}.pre_args ${command}.args ${command}.post_args ${command}.env ${command}.type ${command}.cmd
+    
+    set cmdstring ""
+    if {[info exists ${command}.dir]} {
+	set cmdstring "cd \"[set ${command}.dir]\" &&"
+    }
+    
+    if {[info exists ${command}.cmd]} {
+	foreach string [set ${command}.cmd] {
+	    set cmdstring "$cmdstring $string"
+	}
+    } else {
+	set cmdstring "$cmdstring ${command}"
+    }
+    foreach var "${command}.pre_args ${command}.args ${command}.post_args" {
+	if {[info exists $var]} {
+	    foreach string [set ${var}] {
+		set cmdstring "$cmdstring $string"
+	    }
+	}
+    }
+    ui_debug "Assembled command: '$cmdstring'"
+    return $cmdstring
+}
+
+# Given a command name, execute it with the options.
+# command_exec command [-notty] [command_prefix [command_suffix]]
+# command			name of the command
+# command_prefix	additional command prefix (typically pipe command)
+# command_suffix	additional command suffix (typically redirection)
+proc command_exec {command args} {
+	global ${command}.env ${command}.env_array env
+	set notty 0
+	set command_prefix ""
+	set command_suffix ""
+
+	if {[llength $args] > 0} {
+		if {[lindex $args 0] == "-notty"} {
+			set notty 1
+			set args [lrange $args 1 end]
+		}
+
+		if {[llength $args] > 0} {
+			set command_prefix [lindex $args 0]
+			if {[llength $args] > 1} {
+				set command_suffix [lindex $args 1]
+			}
+		}
+	}
+	
+	# Set the environment.
+	# If the array doesn't exist, we create it with the value
+	# coming from ${command}.env
+	# Otherwise, it means the caller actually played with the environment
+	# array already (e.g. configure flags).
+	if {![array exists ${command}.env_array]} {
+		parse_environment ${command}
+	}
+	
+	# Debug that.
+    ui_debug "Environment: [environment_array_to_string ${command}.env_array]"
+
+	# Get the command string.
+	set cmdstring [command_string ${command}]
+	
+	# Call this command.
+	# TODO: move that to the system native call?
+	# Save the environment.
+	array set saved_env [array get env]
+	# Set the overriden variables from the portfile.
+	array set env [array get ${command}.env_array]
+	# Call the command.
+	set fullcmdstring "$command_prefix $cmdstring $command_suffix"
+	if {$notty} {
+		set code [catch {system -notty $fullcmdstring} result]
+	} else {
+		set code [catch {system $fullcmdstring} result]
+	}
+	# Unset the command array until next time.
+	array unset ${command}.env_array
+	
+	# Restore the environment.
+	array unset env *
+	array set env [array get saved_env]
+
+	# Return as if system had been called directly.	
+	return -code $code $result
+}
+
+# default
+# Sets a variable to the supplied default if it does not exist,
+# and adds a variable trace. The variable traces allows for delayed
+# variable and command expansion in the variable's default value.
+proc default {option val} {
+    global $option option_defaults
+    if {[info exists option_defaults($option)]} {
+	ui_debug "Re-registering default for $option"
+	# remove the old trace
+	trace vdelete $option rwu default_check
+    } else {
+	# If option is already set and we did not set it
+	# do not reset the value
+	if {[info exists $option]} {
+	    return
+	}
+    }
+    set option_defaults($option) $val
+    set $option $val
+    trace variable $option rwu default_check
+}
+
+# default_check
+# trace handler to provide delayed variable & command expansion
+# for default variable values
+proc default_check {optionName index op} {
+    global option_defaults $optionName
+    switch $op {
+	w {
+	    unset option_defaults($optionName)
+	    trace vdelete $optionName rwu default_check
+	    return
+	}
+	r {
+	    upvar $optionName option
+	    uplevel #0 set $optionName $option_defaults($optionName)
+	    return
+	}
+	u {
+	    unset option_defaults($optionName)
+	    trace vdelete $optionName rwu default_check
+	    return
+	}
+    }
+}
+
+# variant <provides> [<provides> ...] [requires <requires> [<requires>]]
+# Portfile level procedure to provide support for declaring variants
+proc variant {args} {
+    global all_variants PortInfo
+    upvar $args upargs
+    
+    set len [llength $args]
+    set code [lindex $args end]
+    set args [lrange $args 0 [expr $len - 2]]
+    
+    set ditem [variant_new "temp-variant"]
+    
+    # mode indicates what the arg is interpreted as.
+    # possible mode keywords are: requires, conflicts, provides
+    # The default mode is provides.  Arguments are added to the
+    # most recently specified mode (left to right).
+    set mode "provides"
+    foreach arg $args {
+	switch -exact $arg {
+	    provides { set mode "provides" }
+	    requires { set mode "requires" }
+	    conflicts { set mode "conflicts" }
+	    default { ditem_append $ditem $mode $arg }		
+        }
+    }
+    ditem_key $ditem name "[join [ditem_key $ditem provides] -]"
+    
+    # make a user procedure named variant-blah-blah
+    # we will call this procedure during variant-run
+    makeuserproc "variant-[ditem_key $ditem name]" \{$code\}
+    
+    # Export provided variant to PortInfo
+    # (don't list it twice if the variant was already defined, which can happen
+    # with universal or group code).
+    set variant_provides [ditem_key $ditem provides]
+    if {[variant_exists $variant_provides]} {
+		# This variant was already defined. Remove it from the dlist.
+		variant_remove_ditem $variant_provides
+	} else {
+	    lappend PortInfo(variants) $variant_provides
+	}
+
+	# Finally append the ditem to the dlist.
+    lappend all_variants $ditem
+}
+
+# variant_isset name
+# Returns 1 if variant name selected, otherwise 0
+proc variant_isset {name} {
+    global variations
+    
+    if {[info exists variations($name)] && $variations($name) == "+"} {
+	return 1
+    }
+    return 0
+}
+
+# variant_set name
+# Sets variant to run for current portfile
+proc variant_set {name} {
+    global variations
+    
+    set variations($name) +
+}
+
+# variant_unset name
+# Clear variant for current portfile
+proc variant_unset {name} {
+    global variations
+    
+    set variations($name) -
+}
+
+# variant_undef name
+# Undefine a variant for the current portfile.
+proc variant_undef {name} {
+    global variations PortInfo
+    
+    # Remove it from the list of selected variations.
+    array unset variations $name
+
+	# Remove the variant from the portinfo.
+	if {[info exists PortInfo(variants)]} {
+		set variant_index [lsearch -exact $PortInfo(variants) $name]
+		if {$variant_index >= 0} {
+			set new_list [lreplace $PortInfo(variants) $variant_index $variant_index]
+			if {"$new_list" == {}} {
+				unset PortInfo(variants) 
+			} else {
+				set PortInfo(variants) $new_list
+			}
+		}
+	}
+	
+	# And from the dlist.
+	variant_remove_ditem $name
+}
+
+# variant_remove_ditem name
+# Remove variant name's ditem from the all_variants dlist
+proc variant_remove_ditem {name} {
+	global all_variants
+	set item_index 0
+	foreach variant_item $all_variants {
+		set item_provides [ditem_key $variant_item provides]
+		if {$item_provides == $name} {
+			set all_variants [lreplace $all_variants $item_index $item_index]
+			break
+		}
+		
+		incr item_index
+	}
+}
+
+# variant_exists name
+# determine if a variant exists.
+proc variant_exists {name} {
+	global PortInfo
+	if {[info exists PortInfo(variants)] &&
+		[lsearch -exact $PortInfo(variants) $name] >= 0} {
+		return 1
+	}
+	
+	return 0
+}
+
+# platform <os> [<release>] [<arch>] 
+# Portfile level procedure to provide support for declaring platform-specifics
+# Basically, just wrap 'variant', so that Portfiles' platform declarations can
+# be more readable, and support arch and version specifics
+proc platform {args} {
+    global all_variants PortInfo os.platform os.arch os.version
+    upvar $args upargs
+    
+    set len [llength $args]
+    set code [lindex $args end]
+    set os [lindex $args 0]
+    set args [lrange $args 1 [expr $len - 2]]
+    
+    set ditem [variant_new "temp-variant"]
+    
+    foreach arg $args {
+	if {[regexp {(^[0-9]$)} $arg match result]} {
+	    set release $result
+	} elseif {[regexp {([a-zA-Z0-9]*)} $arg match result]} {
+	    set arch $result
+	}
+    }
+    
+    # Add the variant for this platform
+    set platform $os
+    if {[info exists release]} { set platform ${platform}_${release} }
+    if {[info exists arch]} { set platform ${platform}_${arch} }
+    
+    # Pick up a unique name.
+    if {[variant_exists $platform]} {
+    	set suffix 1
+    	while {[variant_exists "$platform-$suffix"]} {
+    		incr suffix
+    	}
+    	
+    	set platform "$platform-$suffix"
+    }
+    variant $platform $code
+    
+    # Set the variant if this platform matches the platform we're on
+    set matches 1
+    if {[info exists os.platform] && ${os.platform} == $os} { 
+	set sel_platform $os
+	if {[info exists os.version] && [info exists release]} {
+	    regexp {([0-9]*)[0-9\.]?} ${os.version} match major
+	    if {$major == $release } { 
+	    	set sel_platform ${sel_platform}_${release} 
+	    } else {
+		    set matches 0
+	    }
+	}
+	if {$matches == 1 && [info exists arch] && [info exists os.arch]} {
+		if {${os.arch} == $arch} {
+			set sel_platform ${sel_platform}_${arch}
+		} else {
+			set matches 0
+		}
+    }
+    if {$matches == 1} {
+    	variant_set $sel_platform
+    }
+    }
+}
+
+########### Environment utility functions ###########
+
+# Parse the environment string of a command, storing the values into the
+# associated environment array.
+proc parse_environment {command} {
+	global ${command}.env ${command}.env_array
+
+	if {[info exists ${command}.env]} {
+		# Flatten the environment string.
+		set the_environment ""
+		foreach str [set ${command}.env] {
+			set the_environment "$the_environment $str"
+		}
+	
+		while {[regexp "^(?: *)(\[^= \]+)=(\"|'|)(\[^\"'\].*?)\\2(?: +|$)(.*)$" ${the_environment} matchVar key delimiter value remaining]} {
+			set the_environment ${remaining}
+			set ${command}.env_array(${key}) ${value}
+		}
+	} else {
+		array set ${command}.env_array {}
+	}
+}
+
+# Append to the value in the parsed environment.
+# Leave the environment untouched if the value is empty.
+proc append_to_environment_value {command key value} {
+	global ${command}.env_array
+
+	if {[string length $value] == 0} {
+		return
+	}
+
+	# Parse out any delimiter.
+	set append_value $value
+	if {[regexp {^("|')(.*)\1$} $append_value matchVar append_delim matchedValue]} {
+		set append_value $matchedValue
+	}
+
+	if {[info exists ${command}.env_array($key)]} {
+		set original_value [set ${command}.env_array($key)]
+		set ${command}.env_array($key) "${original_value} ${append_value}"
+	} else {
+		set ${command}.env_array($key) $append_value
+	}
+}
+
+# Append several items to a value in the parsed environment.
+proc append_list_to_environment_value {command key vallist} {
+	foreach {value} $vallist {
+		append_to_environment_value ${command} $key $value
+	}
+}
+
+# Build the environment as a string.
+# Remark: this method is only used for debugging purposes.
+proc environment_array_to_string {environment_array} {
+	upvar 1 ${environment_array} env_array
+	
+	set theString ""
+	foreach {key value} [array get env_array] {
+		if {$theString == ""} {
+			set theString "$key='$value'"
+		} else {
+			set theString "${theString} $key='$value'"
+		}
+	}
+	
+	return $theString
+}
+
+########### Distname utility functions ###########
+
+# Given a distribution file name, return the appended tag
+# Example: getdisttag distfile.tar.gz:tag1 returns "tag1"
+# / isn't included in the regexp, thus allowing port specification in URLs.
+proc getdisttag {name} {
+    if {[regexp {.+:([0-9A-Za-z_-]+)$} $name match tag]} {
+        return $tag
+    } else {
+        return ""
+    }
+}
+
+# Given a distribution file name, return the name without an attached tag
+# Example : getdistname distfile.tar.gz:tag1 returns "distfile.tar.gz"
+# / isn't included in the regexp, thus allowing port specification in URLs.
+proc getdistname {name} {
+    regexp {(.+):[0-9A-Za-z_-]+$} $name match name
+    return $name
+}
+
+
+########### Misc Utility Functions ###########
+
+# tbool (testbool)
+# If the variable exists in the calling procedure's namespace
+# and is set to "yes", return 1. Otherwise, return 0
+proc tbool {key} {
+    upvar $key $key
+    if {[info exists $key]} {
+        if {[string equal -nocase [set $key] "yes"]} {
+            return 1
+        }
+    }
+    return 0
+}
+
+# ldelete
+# Deletes a value from the supplied list
+proc ldelete {list value} {
+    set ix [lsearch -exact $list $value]
+    if {$ix >= 0} {
+        return [lreplace $list $ix $ix]
+    }
+    return $list
+}
+
+# reinplace
+# Provides "sed in place" functionality
+proc reinplace {pattern args}  {
+    if {$args == ""} {
+    	ui_error "reinplace: no value given for parameter \"file\""
+	return -code error "no value given for parameter \"file\" to \"reinplace\"" 
+    }
+    
+    foreach file $args {
+	if {[catch {set tmpfile [mkstemp "/tmp/[file tail $file].sed.XXXXXXXX"]} error]} {
+		global errorInfo
+		ui_debug "$errorInfo"
+	    ui_error "reinplace: $error"
+	    return -code error "reinplace failed"
+	} else {
+	    # Extract the Tcl Channel number
+	    set tmpfd [lindex $tmpfile 0]
+	    # Set tmpfile to only the file name
+	    set tmpfile [lindex $tmpfile 1]
+	}
+	
+	if {[catch {exec sed $pattern < $file >@ $tmpfd} error]} {
+		global errorInfo
+		ui_debug "$errorInfo"
+	    ui_error "reinplace: $error"
+	    file delete "$tmpfile"
+	    close $tmpfd
+	    return -code error "reinplace sed(1) failed"
+	}
+	
+	close $tmpfd
+	
+	set attributes [file attributes $file]
+	# We need to overwrite this file
+	if {[catch {file attributes $file -permissions u+w} error]} {
+		global errorInfo
+		ui_debug "$errorInfo"
+	    ui_error "reinplace: $error"
+	    file delete "$tmpfile"
+	    return -code error "reinplace permissions failed"
+	}
+	
+	if {[catch {exec cp $tmpfile $file} error]} {
+		global errorInfo
+		ui_debug "$errorInfo"
+	    ui_error "reinplace: $error"
+	    file delete "$tmpfile"
+	    return -code error "reinplace copy failed"
+	}
+	
+	for {set i 0} {$i < [llength attributes]} {incr i} {
+	    set opt [lindex $attributes $i]
+	    incr i
+	    set arg [lindex $attributes $i]
+	    file attributes $file $opt $arg
+	}
+	
+	file delete "$tmpfile"
+    }
+    return
+}
+
+# delete
+# file delete -force by itself doesn't handle directories properly
+# on systems older than Tiger. Lets recurse using fs-traverse instead
+proc delete {args} {
+    ui_debug "delete: $args"
+    fs-traverse -depth file $args {
+        file delete -force -- $file
+        continue
+    }
+}
+
+# touch
+# mimics the BSD touch command
+proc touch {args} {
+    while {[string match -* [lindex $args 0]]} {
+        set arg [string range [lindex $args 0] 1 end]
+        set args [lrange $args 1 end]
+        switch -- $arg {
+            a -
+            c -
+            m {set options($arg) yes}
+            r -
+            t {
+                set narg [lindex $args 0]
+                set args [lrange $args 1 end]
+                if {[string length $narg] == 0} {
+                    return -code error "touch: option requires an argument -- $arg"
+                }
+                set options($arg) $narg
+                set options(rt) $arg ;# later option overrides earlier
+            }
+            - break
+            default {return -code error "touch: illegal option -- $arg"}
+        }
+    }
+    
+    # parse the r/t options
+    if {[info exists options(rt)]} {
+        if {[string equal $options(rt) r]} {
+            # -r
+            # get atime/mtime from the file
+            if {[file exists $options(r)]} {
+                set atime [file atime $options(r)]
+                set mtime [file mtime $options(r)]
+            } else {
+                return -code error "touch: $options(r): No such file or directory"
+            }
+        } else {
+            # -t
+            # parse the time specification
+            # turn it into a CCyymmdd hhmmss
+            set timespec {^(?:(\d\d)?(\d\d))?(\d\d)(\d\d)(\d\d)(\d\d)(?:\.(\d\d))?$}
+            if {[regexp $timespec $options(t) {} CC YY MM DD hh mm SS]} {
+                if {[string length $YY] == 0} {
+                    set year [clock format [clock seconds] -format %Y]
+                } elseif {[string length $CC] == 0} {
+                    if {$YY >= 69 && $YY <= 99} {
+                        set year 19$YY
+                    } else {
+                        set year 20$YY
+                    }
+                } else {
+                    set year $CC$YY
+                }
+                if {[string length $SS] == 0} {
+                    set SS 00
+                }
+                set atime [clock scan "$year$MM$DD $hh$mm$SS"]
+                set mtime $atime
+            } else {
+                return -code error \
+                    {touch: out of range or illegal time specification: [[CC]YY]MMDDhhmm[.SS]}
+            }
+        }
+    } else {
+        set atime [clock seconds]
+        set mtime [clock seconds]
+    }
+    
+    # do we have any files to process?
+    if {[llength $args] == 0} {
+        # print usage
+        ui_msg {usage: touch [-a] [-c] [-m] [-r file] [-t [[CC]YY]MMDDhhmm[.SS]] file ...}
+        return
+    }
+    
+    foreach file $args {
+        if {![file exists $file]} {
+            if {[info exists options(c)]} {
+                continue
+            } else {
+                close [open $file w]
+            }
+        }
+        
+        if {[info exists options(a)] || ![info exists options(m)]} {
+            file atime $file $atime
+        }
+        if {[info exists options(m)] || ![info exists options(a)]} {
+            file mtime $file $mtime
+        }
+    }
+    return
+}
+
+# copy
+proc copy {args} {
+    exec file copy $args
+}
+
+# move
+proc move {args} {
+    exec file rename $args
+}
+
+# ln
+# Mimics the BSD ln implementation
+# ln [-f] [-h] [-s] [-v] source_file [target_file]
+# ln [-f] [-h] [-s] [-v] source_file ... target_dir
+proc ln {args} {
+    while {[string match -* [lindex $args 0]]} {
+        set arg [string range [lindex $args 0] 1 end]
+        if {[string length $arg] > 1} {
+            set remainder -[string range $arg 1 end]
+            set arg [string range $arg 0 0]
+            set args [lreplace $args 0 0 $remainder]
+        } else {
+            set args [lreplace $args 0 0]
+        }
+        switch -- $arg {
+            f -
+            h -
+            s -
+            v {set options($arg) yes}
+            - break
+            default {return -code error "ln: illegal option -- $arg"}
+        }
+    }
+    
+    if {[llength $args] == 0} {
+        ui_msg {usage: ln [-f] [-h] [-s] [-v] source_file [target_file]}
+        ui_msg {       ln [-f] [-h] [-s] [-v] file ... directory}
+        return
+    } elseif {[llength $args] == 1} {
+        set files $args
+        set target ./
+    } else {
+        set files [lrange $args 0 [expr [llength $args] - 2]]
+        set target [lindex $args end]
+    }
+    
+    foreach file $files {
+        if {[file isdirectory $file] && ![info exists options(s)]} {
+            return -code error "ln: $file: Is a directory"
+        }
+        
+        if {[file isdirectory $target] && ([file type $target] ne "link" || ![info exists options(h)])} {
+            set linktarget [file join $target [file tail $file]]
+        } else {
+            set linktarget $target
+        }
+        
+        if {![catch {file type $linktarget}]} {
+            if {[info exists options(f)]} {
+                file delete $linktarget
+            } else {
+                return -code error "ln: $linktarget: File exists"
+            }
+        }
+        
+        if {[llength $files] > 2} {
+            if {![file exists $linktarget]} {
+                return -code error "ln: $linktarget: No such file or directory"
+            } elseif {![file isdirectory $target]} {
+                # this error isn't striclty what BSD ln gives, but I think it's more useful
+                return -code error "ln: $target: Not a directory"
+            }
+        }
+        
+        if {[info exists options(v)]} {
+            ui_msg "ln: $linktarget -> $file"
+        }
+        if {[info exists options(s)]} {
+            symlink $file $linktarget
+        } else {
+            file link -hard $linktarget $file
+        }
+    }
+    return
+}
+
+# filefindbypath
+# Provides searching of the standard path for included files
+proc filefindbypath {fname} {
+    global distpath filesdir workdir worksrcdir portpath
+    
+    if {[file readable $portpath/$fname]} {
+	return $portpath/$fname
+    } elseif {[file readable $portpath/$filesdir/$fname]} {
+	return $portpath/$filesdir/$fname
+    } elseif {[file readable $distpath/$fname]} {
+	return $distpath/$fname
+    }
+    return ""
+}
+
+# include
+# Source a file, looking for it along a standard search path.
+proc include {fname} {
+    set tgt [filefindbypath $fname]
+    if {[string length $tgt]} {
+	uplevel "source $tgt"
+    } else {
+	return -code error "Unable to find include file $fname"
+    }
+}
+
+# makeuserproc
+# This procedure re-writes the user-defined custom target to include
+# all the globals in its scope.  This is undeniably ugly, but I haven't
+# thought of any other way to do this.
+proc makeuserproc {name body} {
+    regsub -- "^\{(.*?)" $body "\{ \n foreach g \[info globals\] \{ \n global \$g \n \} \n \\1" body
+    eval "proc $name {} $body"
+}
+
+# backup
+# Operates on universal_filelist, creates universal_archlist
+# Save single-architecture files, a temporary location, preserving the original
+# directory structure.
+
+proc backup {arch} {
+    global universal_archlist universal_filelist workpath
+    lappend universal_archlist ${arch}
+    foreach file ${universal_filelist} {
+        set filedir [file dirname $file]
+        xinstall -d ${workpath}/${arch}/${filedir}
+        xinstall ${file} ${workpath}/${arch}/${filedir}
+    }
+}
+
+# lipo
+# Operates on universal_filelist, universal_archlist.
+# Run lipo(1) on a list of single-arch files.
+
+proc lipo {} {
+    global universal_archlist universal_filelist workpath
+    foreach file ${universal_filelist} {
+        xinstall -d [file dirname $file]
+        file delete ${file}
+        set lipoSources ""
+        foreach arch $universal_archlist {
+            append lipoSources "-arch ${arch} ${workpath}/${arch}/${file} "
+        }
+        system "lipo ${lipoSources}-create -output ${file}"
+    }
+}
+
+########### Internal Dependency Manipulation Procedures ###########
+
+proc target_run {ditem} {
+    global target_state_fd portpath portname portversion portrevision portvariants ports_force variations workpath ports_trace PortInfo
+    set result 0
+    set skipped 0
+    set procedure [ditem_key $ditem procedure]
+    if {$procedure != ""} {
+	set name [ditem_key $ditem name]
+	
+	if {[ditem_contains $ditem init]} {
+	    set result [catch {[ditem_key $ditem init] $name} errstr]
+	}
+	
+	if { ![info exists portvariants] } {
+		set portvariants ""
+		set vlist [lsort -ascii [array names variations]]
+
+		# Put together variants in the form +foo+bar for the registry
+		foreach v $vlist {
+			if { ![string equal $v [option os.platform]] && ![string equal $v [option os.arch]] } {
+				set portvariants "${portvariants}+${v}"
+			}
+		}
+	}
+
+	if {$result == 0} {
+		# Skip the step if required and explain why through ui_debug.
+		# 1st case: the step was already done (as mentioned in the state file)
+		if {[check_statefile target $name $target_state_fd]} {
+		    ui_debug "Skipping completed $name ($portname)"
+		    set skipped 1
+		# 2nd case: the step is not to always be performed
+		# and this exact port/version/revision/variants is already installed
+		# and user didn't mention -f
+		# and portfile didn't change since installation.
+		} elseif {[ditem_key $ditem runtype] != "always"
+			&& [registry_exists $portname $portversion $portrevision $portvariants]
+			&& !([info exists ports_force] && $ports_force == "yes")} {
+						
+			# Did the Portfile change since installation?
+			set regref [registry_open $portname $portversion $portrevision $portvariants]
+			
+			set installdate [registry_prop_retr $regref date]
+			if { $installdate != 0
+				&& $installdate < [file mtime ${portpath}/Portfile]} {
+				ui_debug "Portfile changed since installation"
+			} else {
+				# Say we're skipping.
+				set skipped 1
+				
+				ui_debug "Skipping $name ($portname) since this port is already installed"
+			}
+			
+			# Something to close the registry entry may be called here, if it existed.
+		# 3rd case: the same port/version/revision/Variants is already active
+		# and user didn't mention -f
+		} elseif {$name == "com.apple.activate"
+			&& [registry_exists $portname $portversion $portrevision $portvariants]
+			&& !([info exists ports_force] && $ports_force == "yes")} {
+			
+			# Is port active?
+			set regref [registry_open $portname $portversion $portrevision $portvariants]
+			
+			if { [registry_prop_retr $regref active] != 0 } {
+				# Say we're skipping.
+				set skipped 1
+				
+				ui_debug "Skipping $name ($portname) since this port is already active"
+			}
+			
+		}
+			
+		# otherwise execute the task.
+		if {$skipped == 0} {
+			set target [ditem_key $ditem provides]
+			if {([info exists ports_trace]
+				&& $ports_trace == "yes"
+				&& $target != "clean")} {
+				trace_start $workpath
+
+				# Enable the fence to prevent any creation/modification
+				# outside the sandbox.
+				if {$target != "activate"
+					&& $target != "archive"
+					&& $target != "fetch"
+					&& $target != "install"} {
+					trace_enable_fence
+				}
+			}
+
+			# Execute pre-run procedure
+			if {[ditem_contains $ditem prerun]} {
+			set result [catch {[ditem_key $ditem prerun] $name} errstr]
+			}
+			
+			if {$result == 0} {
+			foreach pre [ditem_key $ditem pre] {
+				ui_debug "Executing $pre"
+				set result [catch {$pre $name} errstr]
+				if {$result != 0} { break }
+			}
+			}
+			
+			if {$result == 0} {
+			ui_debug "Executing $name ($portname)"
+			set result [catch {$procedure $name} errstr]
+			}
+			
+			if {$result == 0} {
+			foreach post [ditem_key $ditem post] {
+				ui_debug "Executing $post"
+				set result [catch {$post $name} errstr]
+				if {$result != 0} { break }
+			}
+			}
+			# Execute post-run procedure
+			if {[ditem_contains $ditem postrun] && $result == 0} {
+			set postrun [ditem_key $ditem postrun]
+			ui_debug "Executing $postrun"
+			set result [catch {$postrun $name} errstr]
+			}
+
+			# Check dependencies & file creations outside workpath.
+			if {[info exists ports_trace]
+				&& $ports_trace == "yes"
+				&& $target != "clean"} {
+				
+				# Don't check dependencies for extract (they're not honored
+				# anyway). This avoids warnings about bzip2.
+				if {$target != "extract"} {
+					set depends {}
+					set deptypes {}
+					
+					# Determine deptypes to look for based on target
+					switch $target {
+						configure	{ set deptypes "depends_lib" }
+						
+						build		{ set deptypes "depends_lib depends_build" }
+						
+						test		-
+						destroot	-
+						install		-
+						archive		-
+						pkg			-
+						mpkg		-
+						rpmpackage	-
+						dpkg		-
+						activate    -
+						""			{ set deptypes "depends_lib depends_build depends_run" }
+					}
+					
+					# Gather the dependencies for deptypes
+					foreach deptype $deptypes {
+						# Add to the list of dependencies if the option exists and isn't empty.
+						if {[info exists PortInfo($deptype)] && $PortInfo($deptype) != ""} {
+							set depends [concat $depends $PortInfo($deptype)]
+						}
+					}
+	
+					# Dependencies are in the form verb:[param:]port
+					set depsPorts {}
+					foreach depspec $depends {
+						# grab the portname portion of the depspec
+						set dep_portname [lindex [split $depspec :] end]
+						lappend depsPorts $dep_portname
+					}
+					trace_check_deps $target $depsPorts
+				}
+				
+				trace_check_violations
+				
+				# End of trace.
+				trace_stop
+			}
+		}
+	}
+	if {$result == 0} {
+		# Only write to state file if:
+		# - we indeed performed this step.
+		# - this step is not to always be performed
+		# - this step must be written to file
+		if {$skipped == 0
+	    && [ditem_key $ditem runtype] != "always"
+	    && [ditem_key $ditem state] != "no"} {
+		write_statefile target $name $target_state_fd
+	    }
+	} else {
+	    ui_error "Target $name returned: $errstr"
+	    set result 1
+	}
+	
+    } else {
+	ui_info "Warning: $name does not have a registered procedure"
+	set result 1
+    }
+    
+    return $result
+}
+
+proc eval_targets {target} {
+    global targets target_state_fd portname
+    set dlist $targets
+    
+    # Select the subset of targets under $target
+    if {$target != ""} {
+        set matches [dlist_search $dlist provides $target]
+	
+        if {[llength $matches] > 0} {
+	    set dlist [dlist_append_dependents $dlist [lindex $matches 0] [list]]
+	    # Special-case 'all'
+	} elseif {$target != "all"} {
+	    ui_error "unknown target: $target"
+            return 1
+        }
+    }
+    
+    # Restore the state from a previous run.
+    set target_state_fd [open_statefile]
+    
+    set dlist [dlist_eval $dlist "" target_run]
+    
+    if {[llength $dlist] > 0} {
+	# somebody broke!
+	set errstring "Warning: the following items did not execute (for $portname):"
+	foreach ditem $dlist {
+	    append errstring " [ditem_key $ditem name]"
+	}
+	ui_info $errstring
+	set result 1
+    } else {
+	set result 0
+    }
+    
+    close $target_state_fd
+    return $result
+}
+
+# open_statefile
+# open file to store name of completed targets
+proc open_statefile {args} {
+    global workpath worksymlink portname portpath ports_ignore_older
+    
+    if {![file isdirectory $workpath]} {
+	file mkdir $workpath
+    }
+    # flock Portfile
+    set statefile [file join $workpath .darwinports.${portname}.state]
+    if {[file exists $statefile]} {
+	if {![file writable $statefile]} {
+	    return -code error "$statefile is not writable - check permission on port directory"
+	}
+	if {!([info exists ports_ignore_older] && $ports_ignore_older == "yes") && [file mtime $statefile] < [file mtime ${portpath}/Portfile]} {
+	    ui_msg "Portfile changed since last build; discarding previous state."
+	    #file delete $statefile
+	    exec rm -rf [file join $workpath]
+	    exec mkdir [file join $workpath]
+	}
+    }
+
+    # Create a symlink to the workpath for port authors 
+    if {![file isdirectory $worksymlink]} {
+	    exec ln -sf $workpath $worksymlink
+    }
+    
+    set fd [open $statefile a+]
+    if {[catch {flock $fd -exclusive -noblock} result]} {
+        if {"$result" == "EAGAIN"} {
+            ui_msg "Waiting for lock on $statefile"
+	} elseif {"$result" == "EOPNOTSUPP"} {
+	    # Locking not supported, just return
+	    return $fd
+        } else {
+            return -code error "$result obtaining lock on $statefile"
+        }
+    }
+    flock $fd -exclusive
+    return $fd
+}
+
+# check_statefile
+# Check completed/selected state of target/variant $name
+proc check_statefile {class name fd} {
+    global portpath workdir
+    
+    seek $fd 0
+    while {[gets $fd line] >= 0} {
+	if {$line == "$class: $name"} {
+	    return 1
+	}
+    }
+    return 0
+}
+
+# write_statefile
+# Set target $name completed in the state file
+proc write_statefile {class name fd} {
+    if {[check_statefile $class $name $fd]} {
+	return 0
+    }
+    seek $fd 0 end
+    puts $fd "$class: $name"
+    flush $fd
+}
+
+# check_statefile_variants
+# Check that recorded selection of variants match the current selection
+proc check_statefile_variants {variations fd} {
+    upvar $variations upvariations
+    
+    seek $fd 0
+    while {[gets $fd line] >= 0} {
+	if {[regexp "variant: (.*)" $line match name]} {
+	    set oldvariations([string range $name 1 end]) [string range $name 0 0]
+	}
+    }
+    
+    set mismatch 0
+    if {[array size oldvariations] > 0} {
+	if {[array size oldvariations] != [array size upvariations]} {
+	    set mismatch 1
+	} else {
+	    foreach key [array names upvariations *] {
+		if {![info exists oldvariations($key)] || $upvariations($key) != $oldvariations($key)} {
+		    set mismatch 1
+		    break
+		}
+	    }
+	}
+    }
+    
+    return $mismatch
+}
+
+########### Port Variants ###########
+
+# Each variant which provides a subset of the requested variations
+# will be chosen.  Returns a list of the selected variants.
+proc choose_variants {dlist variations} {
+    upvar $variations upvariations
+    
+    set selected [list]
+    
+    foreach ditem $dlist {
+	# Enumerate through the provides, tallying the pros and cons.
+	set pros 0
+	set cons 0
+	set ignored 0
+	foreach flavor [ditem_key $ditem provides] {
+	    if {[info exists upvariations($flavor)]} {
+		if {$upvariations($flavor) == "+"} {
+		    incr pros
+		} elseif {$upvariations($flavor) == "-"} {
+		    incr cons
+		}
+	    } else {
+		incr ignored
+	    }
+	}
+	
+	if {$cons > 0} { continue }
+	
+	if {$pros > 0 && $ignored == 0} {
+	    lappend selected $ditem
+	}
+    }
+    return $selected
+}
+
+proc variant_run {ditem} {
+    set name [ditem_key $ditem name]
+    ui_debug "Executing variant $name provides [ditem_key $ditem provides]"
+    
+    # test for conflicting variants
+    foreach v [ditem_key $ditem conflicts] {
+	if {[variant_isset $v]} {
+	    ui_error "Variant $name conflicts with $v"
+	    return 1
+	}
+    }
+    
+    # execute proc with same name as variant.
+    if {[catch "variant-${name}" result]} {
+	global errorInfo
+	ui_debug "$errorInfo"
+	ui_error "Error executing $name: $result"
+	return 1
+    }
+    return 0
+}
+
+proc eval_variants {variations target} {
+    global all_variants ports_force PortInfo
+    set dlist $all_variants
+    set result 0
+    upvar $variations upvariations
+    set chosen [choose_variants $dlist upvariations]
+	set portname $PortInfo(name)
+
+	# Check to make sure the requested variations are available with this 
+	# port, if one is not, warn the user and remove the variant from the 
+	# array.
+	foreach key [array names upvariations *] {
+		if {![info exists PortInfo(variants)] || 
+			[lsearch $PortInfo(variants) $key] == -1} {
+			ui_debug "Requested variant $key is not provided by port $portname."
+			array unset upvariations $key
+		}
+	}
+
+    # now that we've selected variants, change all provides [a b c] to [a-b-c]
+    # this will eliminate ambiguity between item a, b, and a-b while fulfilling requirments.
+    #foreach obj $dlist {
+    #    $obj set provides [list [join [$obj get provides] -]]
+    #}
+    
+    set newlist [list]
+    foreach variant $chosen {
+		set newlist [dlist_append_dependents $dlist $variant $newlist]
+    }
+    
+    set dlist [dlist_eval $newlist "" variant_run]
+    if {[llength $dlist] > 0} {
+		return 1
+    }
+    
+    # Make sure the variations match those stored in the statefile.
+    # If they don't match, print an error indicating a 'port clean' 
+    # should be performed.  
+    # - Skip this test if the statefile is empty.
+    # - Skip this test if performing a clean.
+    # - Skip this test if ports_force was specified.
+    
+    if {$target != "clean" && 
+	!([info exists ports_force] && $ports_force == "yes")} {
+	set state_fd [open_statefile]
+	
+	if {[check_statefile_variants upvariations $state_fd]} {
+	    ui_error "Requested variants do not match original selection.\nPlease perform 'port clean $portname' or specify the force option."
+	    set result 1
+	} else {
+	    # Write variations out to the statefile
+	    foreach key [array names upvariations *] {
+		write_statefile variant $upvariations($key)$key $state_fd
+	    }
+	}
+	
+	close $state_fd
+    }
+    
+    return $result
+}
+
+# Target class definition.
+
+# constructor for target object
+proc target_new {name procedure} {
+    global targets
+    set ditem [ditem_create]
+    
+    ditem_key $ditem name $name
+    ditem_key $ditem procedure $procedure
+    
+    lappend targets $ditem
+    
+    return $ditem
+}
+
+proc target_provides {ditem args} {
+    global targets
+    # Register the pre-/post- hooks for use in Portfile.
+    # Portfile syntax: pre-fetch { puts "hello world" }
+    # User-code exceptions are caught and returned as a result of the target.
+    # Thus if the user code breaks, dependent targets will not execute.
+    foreach target $args {
+        set origproc [ditem_key $ditem procedure]
+        set ident [ditem_key $ditem name]
+        if {[info commands $target] != ""} {
+            ui_debug "$ident registered provides '$target', a pre-existing procedure. Target override will not be provided"
+        } else {
+            proc $target {args} "
+                variable proc_index
+                set proc_index \[llength \[ditem_key $ditem proc\]\]
+                ditem_key $ditem procedure proc-${ident}-${target}-\${proc_index}
+                proc proc-${ident}-${target}-\${proc_index} {name} \"
+                    if {\\\[catch userproc-${ident}-${target}-\${proc_index} result\\\]} {
+                        return -code error \\\$result
+                    } else {
+                        return 0
+                    }
+                \"
+                proc do-$target {} { $origproc $target }
+                makeuserproc userproc-${ident}-${target}-\${proc_index} \$args
+            "
+        }
+        proc pre-$target {args} "
+            variable proc_index
+            set proc_index \[llength \[ditem_key $ditem pre\]\]
+            ditem_append $ditem pre proc-pre-${ident}-${target}-\${proc_index}
+            proc proc-pre-${ident}-${target}-\${proc_index} {name} \"
+                if {\\\[catch userproc-pre-${ident}-${target}-\${proc_index} result\\\]} {
+                    return -code error \\\$result
+                } else {
+                    return 0
+                }
+            \"
+            makeuserproc userproc-pre-${ident}-${target}-\${proc_index} \$args
+        "
+        proc post-$target {args} "
+            variable proc_index
+            set proc_index \[llength \[ditem_key $ditem post\]\]
+            ditem_append $ditem post proc-post-${ident}-${target}-\${proc_index}
+            proc proc-post-${ident}-${target}-\${proc_index} {name} \"
+                if {\\\[catch userproc-post-${ident}-${target}-\${proc_index} result\\\]} {
+                    return -code error \\\$result
+                } else {
+                    return 0
+                }
+            \"
+            makeuserproc userproc-post-${ident}-${target}-\${proc_index} \$args
+        "
+    }
+    eval ditem_append $ditem provides $args
+}
+
+proc target_requires {ditem args} {
+    eval ditem_append $ditem requires $args
+}
+
+proc target_uses {ditem args} {
+    eval ditem_append $ditem uses $args
+}
+
+proc target_deplist {ditem args} {
+    eval ditem_append $ditem deplist $args
+}
+
+proc target_prerun {ditem args} {
+    eval ditem_append $ditem prerun $args
+}
+
+proc target_postrun {ditem args} {
+    eval ditem_append $ditem postrun $args
+}
+
+proc target_runtype {ditem args} {
+    eval ditem_append $ditem runtype $args
+}
+
+proc target_state {ditem args} {
+    eval ditem_append $ditem state $args
+}
+
+proc target_init {ditem args} {
+    eval ditem_append $ditem init $args
+}
+
+##### variant class #####
+
+# constructor for variant objects
+proc variant_new {name} {
+    set ditem [ditem_create]
+    ditem_key $ditem name $name
+    return $ditem
+}
+
+proc handle_default_variants {option action {value ""}} {
+    global variations
+    switch -regex $action {
+	set|append {
+	    foreach v $value {
+		if {[regexp {([-+])([-A-Za-z0-9_]+)} $v whole val variant]} {
+		    if {![info exists variations($variant)]} {
+			set variations($variant) $val
+		    }
+		}
+	    }
+	}
+	delete {
+	    # xxx
+	}
+    }
+}
+
+
+# builds the specified port (looked up in the index) to the specified target
+# doesn't yet support options or variants...
+# newworkpath defines the port's workpath - useful for when one port relies
+# on the source, etc, of another
+proc portexec_int {portname target {newworkpath ""}} {
+    ui_debug "Executing $target ($portname)"
+    set variations [list]
+    if {$newworkpath == ""} {
+        array set options [list]
+    } else {
+        set options(workpath) ${newworkpath}
+    }
+    # Escape regex special characters
+    regsub -all "(\\(){1}|(\\)){1}|(\\{1}){1}|(\\+){1}|(\\{1}){1}|(\\{){1}|(\\}){1}|(\\^){1}|(\\$){1}|(\\.){1}|(\\\\){1}" $portname "\\\\&" search_string 
+    
+    set res [dport_search ^$search_string\$]
+    if {[llength $res] < 2} {
+        ui_error "Dependency $portname not found"
+        return -1
+    }
+    
+    array set portinfo [lindex $res 1]
+    set porturl $portinfo(porturl)
+    if {[catch {set worker [dport_open $porturl [array get options] $variations]} result]} {
+		global errorInfo
+		ui_debug "$errorInfo"
+        ui_error "Opening $portname $target failed: $result"
+        return -1
+    }
+    if {[catch {dport_exec $worker $target} result] || $result != 0} {
+		global errorInfo
+		ui_debug "$errorInfo"
+        ui_error "Execution $portname $target failed: $result"
+        dport_close $worker
+        return -1
+    }
+    dport_close $worker
+    
+    return 0
+}
+
+# portfile primitive that calls portexec_int with newworkpath == ${workpath}
+proc portexec {portname target} {
+    global workpath
+    return [portexec_int $portname $target $workpath]
+}
+
+proc adduser {name args} {
+    global os.platform
+    set passwd {\*}
+    set uid [nextuid]
+    set gid [existsgroup nogroup]
+    set realname ${name}
+    set home /dev/null
+    set shell /dev/null
+    
+    foreach arg $args {
+	if {[regexp {([a-z]*)=(.*)} $arg match key val]} {
+	    regsub -all " " ${val} "\\ " val
+	    set $key $val
+	}
+    }
+    
+    if {[existsuser ${name}] != 0 || [existsuser ${uid}] != 0} {
+	return
+    }
+    
+    if {${os.platform} == "darwin"} {
+	system "niutil -create . /users/${name}"
+	system "niutil -createprop . /users/${name} name ${name}"
+	system "niutil -createprop . /users/${name} passwd ${passwd}"
+	system "niutil -createprop . /users/${name} uid ${uid}"
+	system "niutil -createprop . /users/${name} gid ${gid}"
+	system "niutil -createprop . /users/${name} realname ${realname}"
+	system "niutil -createprop . /users/${name} home ${home}"
+	system "niutil -createprop . /users/${name} shell ${shell}"
+    } else {
+	# XXX adduser is only available for darwin, add more support here
+	ui_warn "WARNING: adduser is not implemented on ${os.platform}."
+	ui_warn "The requested user was not created."
+    }
+}
+
+proc addgroup {name args} {
+    global os.platform
+    set gid [nextgid]
+    set passwd {\*}
+    set users ""
+    
+    foreach arg $args {
+	if {[regexp {([a-z]*)=(.*)} $arg match key val]} {
+	    regsub -all " " ${val} "\\ " val
+	    set $key $val
+	}
+    }
+    
+    if {[existsgroup ${name}] != 0 || [existsgroup ${gid}] != 0} {
+	return
+    }
+    
+    if {${os.platform} == "darwin"} {
+	system "niutil -create . /groups/${name}"
+	system "niutil -createprop . /groups/${name} name ${name}"
+	system "niutil -createprop . /groups/${name} gid ${gid}"
+	system "niutil -createprop . /groups/${name} passwd ${passwd}"
+	system "niutil -createprop . /groups/${name} users ${users}"
+    } else {
+	# XXX addgroup is only available for darwin, add more support here
+	ui_warn "WARNING: addgroup is not implemented on ${os.platform}."
+	ui_warn "The requested group was not created."
+    }
+}
+
+# proc to calculate size of a directory
+# moved here from portpkg.tcl
+proc dirSize {dir} {
+    set size    0;
+    foreach file [readdir $dir] {
+	if {[file type [file join $dir $file]] == "link" } {
+	    continue
+	}
+	if {[file isdirectory [file join $dir $file]]} {
+	    incr size [dirSize [file join $dir $file]]
+	} else {
+	    incr size [file size [file join $dir $file]];
+	}
+    }
+    return $size;
+}
+
+# check for a binary in the path
+# returns an error code if it can not be found
+proc binaryInPath {binary} {
+    global env
+    foreach dir [split $env(PATH) :] { 
+	if {[file executable [file join $dir $binary]]} {
+	    return [file join $dir $binary]
+	}
+    }
+    
+    return -code error [format [msgcat::mc "Failed to locate '%s' in path: '%s'"] $binary $env(PATH)];
+}
+
+# Set the UI prefix to something standard (so it can be grepped for in output)
+proc set_ui_prefix {} {
+	global UI_PREFIX env
+	if {[info exists env(UI_PREFIX)]} {
+		set UI_PREFIX $env(UI_PREFIX)
+	} else {
+		set UI_PREFIX "---> "
+	}
+}
+
+# Use a specified group/version.
+proc PortGroup {group version} {
+	global portresourcepath
+
+	set groupFile ${portresourcepath}/group/${group}-${version}.tcl
+
+	if {[file exists $groupFile]} {
+		uplevel "source $groupFile"
+	} else {
+		ui_warn "Group file could not be located."
+	}
+}
+
+# check if archive type is supported by current system
+# returns an error code if it is not
+proc archiveTypeIsSupported {type} {
+    global os.platform os.version
+	set errmsg ""
+	switch -regex $type {
+		cp(io|gz) {
+			set pax "pax"
+			if {[catch {set pax [binaryInPath $pax]} errmsg] == 0} {
+				if {[regexp {z$} $type]} {
+					set gzip "gzip"
+					if {[catch {set gzip [binaryInPath $gzip]} errmsg] == 0} {
+						return 0
+					}
+				} else {
+					return 0
+				}
+			}
+		}
+		t(ar|bz|gz) {
+			set tar "tar"
+			if {[catch {set tar [binaryInPath $tar]} errmsg] == 0} {
+				if {[regexp {z$} $type]} {
+					if {[regexp {bz$} $type]} {
+						set gzip "bzip2"
+					} else {
+						set gzip "gzip"
+					}
+					if {[catch {set gzip [binaryInPath $gzip]} errmsg] == 0} {
+						return 0
+					}
+				} else {
+					return 0
+				}
+			}
+		}
+		xar {
+			set xar "xar"
+			if {[catch {set xar [binaryInPath $xar]} errmsg] == 0} {
+				return 0
+			}
+		}
+		zip {
+			set zip "zip"
+			if {[catch {set zip [binaryInPath $zip]} errmsg] == 0} {
+				set unzip "unzip"
+				if {[catch {set unzip [binaryInPath $unzip]} errmsg] == 0} {
+					return 0
+				}
+			}
+		}
+		default {
+			return -code error [format [msgcat::mc "Invalid port archive type '%s' specified!"] $type]
+		}
+	}
+	return -code error [format [msgcat::mc "Unsupported port archive type '%s': %s"] $type $errmsg]
+}
+

Modified: branches/dp2mp-move/base/src/port1.0/resources/Makefile
===================================================================
--- trunk/base/src/port1.0/resources/Makefile	2007-04-22 07:33:59 UTC (rev 24327)
+++ branches/dp2mp-move/base/src/port1.0/resources/Makefile	2007-04-24 17:28:16 UTC (rev 24454)
@@ -1,12 +1,10 @@
 SUBDIR=		package fetch group
-INSTALLDIR=	${DESTDIR}${datadir}/darwinports/resources/port1.0/
+INSTALLDIR=	${DESTDIR}${datadir}/macports/resources/port1.0/
 RSRCS=
 
-include ../../../Mk/dports.subdir.mk
-include ../../../Mk/dports.autoconf.mk
+include ../../../Mk/macports.subdir.mk
+include ../../../Mk/macports.autoconf.mk
 
 install::
 	$(INSTALL) -d -o ${DSTUSR} -g ${DSTGRP} -m ${DSTMODE} ${INSTALLDIR}
-#	$(SILENT)set -x; for file in ${RSRCS}; do \
-#		$(INSTALL) -o ${DSTUSR} -g ${DSTGRP} -m 444 $$file ${INSTALLDIR}; \
-#	done
+

Modified: branches/dp2mp-move/base/src/port1.0/resources/fetch/Makefile
===================================================================
--- trunk/base/src/port1.0/resources/fetch/Makefile	2007-04-22 07:33:59 UTC (rev 24327)
+++ branches/dp2mp-move/base/src/port1.0/resources/fetch/Makefile	2007-04-24 17:28:16 UTC (rev 24454)
@@ -1,8 +1,8 @@
-INSTALLDIR=	${DESTDIR}${prefix}/share/darwinports/resources/port1.0/fetch
+INSTALLDIR=	${DESTDIR}${prefix}/share/macports/resources/port1.0/fetch
 
 RSRCS=		mirror_sites.tcl
 
-include ../../../../Mk/dports.autoconf.mk
+include ../../../../Mk/macports.autoconf.mk
 
 all:
 

Modified: branches/dp2mp-move/base/src/port1.0/resources/group/Makefile
===================================================================
--- trunk/base/src/port1.0/resources/group/Makefile	2007-04-22 07:33:59 UTC (rev 24327)
+++ branches/dp2mp-move/base/src/port1.0/resources/group/Makefile	2007-04-24 17:28:16 UTC (rev 24454)
@@ -1,9 +1,9 @@
-INSTALLDIR=	${DESTDIR}${prefix}/share/darwinports/resources/port1.0/group
+INSTALLDIR=	${DESTDIR}${prefix}/share/macports/resources/port1.0/group
 
 RSRCS=		gnustep-1.0.tcl perl5-1.0.tcl python-1.0.tcl python24-1.0.tcl python25-1.0.tcl ruby-1.0.tcl \
 		xcode-1.0.tcl zope-1.0.tcl
 
-include ../../../../Mk/dports.autoconf.mk
+include ../../../../Mk/macports.autoconf.mk
 
 all:
 

Modified: branches/dp2mp-move/base/src/port1.0/resources/package/Makefile
===================================================================
--- trunk/base/src/port1.0/resources/package/Makefile	2007-04-22 07:33:59 UTC (rev 24327)
+++ branches/dp2mp-move/base/src/port1.0/resources/package/Makefile	2007-04-24 17:28:16 UTC (rev 24454)
@@ -1,7 +1,7 @@
-INSTALLDIR=	${DESTDIR}${datadir}/darwinports/resources/port1.0/package
+INSTALLDIR=	${DESTDIR}${datadir}/macports/resources/port1.0/package
 RSRCS=		background.tiff
 
-include ../../../../Mk/dports.autoconf.mk
+include ../../../../Mk/macports.autoconf.mk
 
 all:
 

Copied: branches/dp2mp-move/base/src/port1.0/tests (from rev 24448, trunk/base/src/port1.0/tests)

Modified: branches/dp2mp-move/base/src/port1.0/tests/portutil.tcl
===================================================================
--- trunk/base/src/port1.0/tests/portutil.tcl	2007-04-24 14:54:00 UTC (rev 24448)
+++ branches/dp2mp-move/base/src/port1.0/tests/portutil.tcl	2007-04-24 17:28:16 UTC (rev 24454)
@@ -177,6 +177,10 @@
         
         ln -s -f -h z $root/dir
         if {[catch {file type $root/dir/z}] || [file type $root/dir/z] ne "link"} { error "ln failed" }
+        
+        # test combined flags
+        ln -sf q $root/dir
+        if {[catch {file type $root/dir/q}] || [file type $root/dir/q] ne "link"} { error "ln failed" }
     } finally {
         file delete -force $root
     }

Modified: branches/dp2mp-move/base/src/programs/Makefile.in
===================================================================
--- trunk/base/src/programs/Makefile.in	2007-04-22 07:33:59 UTC (rev 24327)
+++ branches/dp2mp-move/base/src/programs/Makefile.in	2007-04-24 17:28:16 UTC (rev 24454)
@@ -2,7 +2,7 @@
 
 SUBDIR=	@REPLACEMENT_PROGS@ @EXTRA_PROGS@
 
-include ../../Mk/dports.subdir.mk
+include ../../Mk/macports.subdir.mk
 
 distclean::
 	rm -f Makefile

Modified: branches/dp2mp-move/base/src/programs/daemondo/Makefile.in
===================================================================
--- trunk/base/src/programs/daemondo/Makefile.in	2007-04-22 07:33:59 UTC (rev 24327)
+++ branches/dp2mp-move/base/src/programs/daemondo/Makefile.in	2007-04-24 17:28:16 UTC (rev 24454)
@@ -2,7 +2,7 @@
 
 top_srcdir = @top_srcdir@
 
-include ${top_srcdir}/Mk/dports.autoconf.mk
+include ${top_srcdir}/Mk/macports.autoconf.mk
 
 mandir=		@mandir@
 mandircat8=	${mandir}/cat8

Modified: branches/dp2mp-move/base/src/registry1.0/Makefile
===================================================================
--- trunk/base/src/registry1.0/Makefile	2007-04-22 07:33:59 UTC (rev 24327)
+++ branches/dp2mp-move/base/src/registry1.0/Makefile	2007-04-24 17:28:16 UTC (rev 24454)
@@ -1,8 +1,8 @@
-INSTALLDIR=	${DESTDIR}${datadir}/darwinports/Tcl/registry1.0
+INSTALLDIR=	${DESTDIR}${datadir}/macports/Tcl/registry1.0
 
 SRCS= registry.tcl registry_autoconf.tcl receipt_flat.tcl receipt_sqlite.tcl portimage.tcl portuninstall.tcl
 
-include ../../Mk/dports.autoconf.mk
+include ../../Mk/macports.autoconf.mk
 
 all::
 

Modified: branches/dp2mp-move/base/tests/Makefile
===================================================================
--- trunk/base/tests/Makefile	2007-04-22 07:33:59 UTC (rev 24327)
+++ branches/dp2mp-move/base/tests/Makefile	2007-04-24 17:28:16 UTC (rev 24454)
@@ -1,4 +1,4 @@
-include ../Mk/dports.autoconf.mk
+include ../Mk/macports.autoconf.mk
 
 TESTS?=checksums-1 cvs-and-patchsites envvariables site-tags trace universal universal-2 xcodeversion dependencies-c
 
@@ -6,20 +6,20 @@
 
 all:
 
-/tmp/macports-tests/opt/local/etc/ports/sources.conf: sources.conf
+/tmp/macports-tests/opt/local/etc/macports/sources.conf: sources.conf
 	@echo setting up test installation
 	rm -rf /tmp/macports-tests/
-	mkdir -p /tmp/macports-tests/dports
-	mkdir -p /tmp/macports-tests/opt/local/etc/ports/
+	mkdir -p /tmp/macports-tests/ports
+	mkdir -p /tmp/macports-tests/opt/local/etc/macports/
 	mkdir -p /tmp/macports-tests/opt/local/share/
-	mkdir -p /tmp/macports-tests/opt/local/var/db/dports/receipts/
-	mkdir -p /tmp/macports-tests/opt/local/var/db/dports/build/
+	mkdir -p /tmp/macports-tests/opt/local/var/db/macports/receipts/
+	mkdir -p /tmp/macports-tests/opt/local/var/db/macports/build/
 	ln -s $(datadir)/darwinports /tmp/macports-tests/opt/local/share/
-	ln -s $(PWD)/test /tmp/macports-tests/dports/
-	cp sources.conf /tmp/macports-tests/opt/local/etc/ports/
+	ln -s $(PWD)/test /tmp/macports-tests/ports/
+	cp sources.conf /tmp/macports-tests/opt/local/etc/macports/
 
-/tmp/macports-tests/dports/PortIndex: /tmp/macports-tests/opt/local/etc/ports/sources.conf PortIndex
-	cp PortIndex /tmp/macports-tests/dports/PortIndex
+/tmp/macports-tests/ports/PortIndex: /tmp/macports-tests/opt/local/etc/macports/sources.conf PortIndex
+	cp PortIndex /tmp/macports-tests/ports/PortIndex
 
 PortIndex:
 	portindex
@@ -29,10 +29,10 @@
 	rm -f PortIndex
 
 $(bindir)/port:
-	@echo "Please install macports before running these tests"
+	@echo "Please install MacPorts before running these tests"
 	@exit 1
-	
-test: clean /tmp/macports-tests/dports/PortIndex /tmp/macports-tests/opt/local/etc/ports/sources.conf
+
+test: clean /tmp/macports-tests/ports/PortIndex /tmp/macports-tests/opt/local/etc/macports/sources.conf
 	@for testname in $(TESTS); do\
 	    subdir=test/$$testname; \
 		echo ===\> test ${DIRPRFX}$$subdir; \

Modified: branches/dp2mp-move/base/tests/sources.conf
===================================================================
--- trunk/base/tests/sources.conf	2007-04-22 07:33:59 UTC (rev 24327)
+++ branches/dp2mp-move/base/tests/sources.conf	2007-04-24 17:28:16 UTC (rev 24454)
@@ -1,3 +1,3 @@
 # To enable your local ports repository, uncomment and customize the
 # following line to point at your local dports directory
-file:///tmp/macports-tests/dports
+file:///tmp/macports-tests/ports

Modified: branches/dp2mp-move/base/tests/test/envvariables/Makefile
===================================================================
--- trunk/base/tests/test/envvariables/Makefile	2007-04-22 07:33:59 UTC (rev 24327)
+++ branches/dp2mp-move/base/tests/test/envvariables/Makefile	2007-04-24 17:28:16 UTC (rev 24454)
@@ -1,11 +1,11 @@
-include ../../../Mk/dports.autoconf.mk
+include ../../../Mk/macports.autoconf.mk
 
 .PHONY: test
 
 $(bindir)/port:
 	@echo "Please install MacPorts before running this test"
 	@exit 1
-	
+
 test:
 	@PORTSRC=$(PORTSRC) $(bindir)/port clean > /dev/null
 	@sh -c "export ENVA=A ; export ENVB=B; \

Modified: branches/dp2mp-move/base/tests/test/trace/Makefile
===================================================================
--- trunk/base/tests/test/trace/Makefile	2007-04-22 07:33:59 UTC (rev 24327)
+++ branches/dp2mp-move/base/tests/test/trace/Makefile	2007-04-24 17:28:16 UTC (rev 24454)
@@ -1,11 +1,11 @@
-include ../../../Mk/dports.autoconf.mk
+include ../../../Mk/macports.autoconf.mk
 
 .PHONY: test
 
 $(bindir)/port:
 	@echo "Please install MacPorts before running this test"
 	@exit 1
-	
+
 test:
 	@PORTSRC=$(PORTSRC) $(bindir)/port clean > /dev/null
 	@touch delete-trace

Modified: branches/dp2mp-move/base/tests/test/universal/Makefile
===================================================================
--- trunk/base/tests/test/universal/Makefile	2007-04-22 07:33:59 UTC (rev 24327)
+++ branches/dp2mp-move/base/tests/test/universal/Makefile	2007-04-24 17:28:16 UTC (rev 24454)
@@ -1,11 +1,11 @@
-include ../../../Mk/dports.autoconf.mk
+include ../../../Mk/macports.autoconf.mk
 
 .PHONY: test
 
 $(bindir)/port:
 	@echo "Please install MacPorts before running this test"
 	@exit 1
-	
+
 test:
 	@PORTSRC=$(PORTSRC) $(bindir)/port clean > /dev/null
 	@sh -c "export PORTSRC=$(PORTSRC); $(bindir)/port info" > output 2>&1 || (cat output; exit 1)

Modified: branches/dp2mp-move/base/tests/test/universal-2/Makefile
===================================================================
--- trunk/base/tests/test/universal-2/Makefile	2007-04-22 07:33:59 UTC (rev 24327)
+++ branches/dp2mp-move/base/tests/test/universal-2/Makefile	2007-04-24 17:28:16 UTC (rev 24454)
@@ -1,11 +1,11 @@
-include ../../../Mk/dports.autoconf.mk
+include ../../../Mk/macports.autoconf.mk
 
 .PHONY: test
 
 $(bindir)/port:
 	@echo "Please install MacPorts before running this test"
 	@exit 1
-	
+
 test:
 	@PORTSRC=$(PORTSRC) $(bindir)/port clean > /dev/null
 	@sh -c "export PORTSRC=$(PORTSRC); $(bindir)/port info" > output 2>&1 || (cat output; exit 1)

Modified: branches/dp2mp-move/base/tests/test-ports.conf
===================================================================
--- trunk/base/tests/test-ports.conf	2007-04-22 07:33:59 UTC (rev 24327)
+++ branches/dp2mp-move/base/tests/test-ports.conf	2007-04-24 17:28:16 UTC (rev 24454)
@@ -2,7 +2,7 @@
 prefix			/tmp/macports-tests/opt/local
 
 # Where to store ports specific database files
-portdbpath		/tmp/macports-tests/opt/local/var/db/dports
+portdbpath		/tmp/macports-tests/opt/local/var/db/macports
 
 # Type of storage to use for the port registry information, "flat" or "sqlite"
 # NOTE: sqlite not yet supported.
@@ -15,16 +15,16 @@
 x11prefix		/tmp/macports-tests/usr/X11R6
 
 # Where to find the sources list.
-sources_conf		/tmp/macports-tests/opt/local/etc/ports/sources.conf
+sources_conf		/tmp/macports-tests/opt/local/etc/macports/sources.conf
 
 # Where to find global variants definition file (optional)
-#variants_conf		/opt/local/etc/ports/variants.conf
+#variants_conf		/opt/local/etc/macports/variants.conf
 
 # Create and use binary archive packages for installation/reinstallation ease
 portarchivemode		no
 
 # Where to store/retrieve ports binary archive files
-portarchivepath		/tmp/macports-tests/opt/local/var/db/dports/packages
+portarchivepath		/tmp/macports-tests/opt/local/var/db/macports/packages
 
 # Type of binary archive packages to create when using archive mode
 #
@@ -41,13 +41,13 @@
 portautoclean		yes
 
 # Rsync server to use
-rsync_server		rsync.opendarwin.org
+rsync_server		rsync.macports.org
 
 # Rsync directory from which to pull the base/ component (infrastructure) of DP
-rsync_dir			dpupdate1/base/
+rsync_dir			release/base/
 
 # Rsync options
-rsync_options		"-rtzv --delete --delete-after"
+rsync_options		-rtzv --delete --delete-after
 
 # Extra environment variables to keep. Any variables listed here are added
 # to the list of variables that are not removed from the environment used

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20070424/4eba1128/attachment.html


More information about the macports-changes mailing list