<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[117084] branches/new-help-system/base</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="https://trac.macports.org/changeset/117084">117084</a></dd>
<dt>Author</dt> <dd>raimue@macports.org</dd>
<dt>Date</dt> <dd>2014-02-15 06:35:04 -0800 (Sat, 15 Feb 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Merge from trunk</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#branchesnewhelpsystembaseChangeLog">branches/new-help-system/base/ChangeLog</a></li>
<li><a href="#branchesnewhelpsystembaseHACKING">branches/new-help-system/base/HACKING</a></li>
<li><a href="#branchesnewhelpsystembaseMkmacportsautoconfmkin">branches/new-help-system/base/Mk/macports.autoconf.mk.in</a></li>
<li><a href="#branchesnewhelpsystembaseaclocalm4">branches/new-help-system/base/aclocal.m4</a></li>
<li><a href="#branchesnewhelpsystembaseconfigRELEASE_URL">branches/new-help-system/base/config/RELEASE_URL</a></li>
<li><a href="#branchesnewhelpsystembaseconfigure">branches/new-help-system/base/configure</a></li>
<li><a href="#branchesnewhelpsystembaseconfigureac">branches/new-help-system/base/configure.ac</a></li>
<li><a href="#branchesnewhelpsystembasedocportfile7">branches/new-help-system/base/doc/portfile.7</a></li>
<li><a href="#branchesnewhelpsystembaseportmgrReleaseProcess">branches/new-help-system/base/portmgr/ReleaseProcess</a></li>
<li><a href="#branchesnewhelpsystembaseportmgrautosubmittcl">branches/new-help-system/base/portmgr/autosubmit.tcl</a></li>
<li><a href="#branchesnewhelpsystembaseportmgrjobsPortIndex2MySQLtcl">branches/new-help-system/base/portmgr/jobs/PortIndex2MySQL.tcl</a></li>
<li><a href="#branchesnewhelpsystembaseportmgrjobsmprsyncup">branches/new-help-system/base/portmgr/jobs/mprsyncup</a></li>
<li><a href="#branchesnewhelpsystembaseportmgrjobsport_binary_distributabletcl">branches/new-help-system/base/portmgr/jobs/port_binary_distributable.tcl</a></li>
<li><a href="#branchesnewhelpsystembaseportmgrpackagingdpkgalltcl">branches/new-help-system/base/portmgr/packaging/dpkgall.tcl</a></li>
<li><a href="#branchesnewhelpsystembaseportmgrpackagingmpkgalltcl">branches/new-help-system/base/portmgr/packaging/mpkgall.tcl</a></li>
<li><a href="#branchesnewhelpsystembaseportmgrpackagingpackagealltcl">branches/new-help-system/base/portmgr/packaging/packageall.tcl</a></li>
<li><a href="#branchesnewhelpsystembaseportmgrpackagingrpmalltcl">branches/new-help-system/base/portmgr/packaging/rpmall.tcl</a></li>
<li><a href="#branchesnewhelpsystembasesrcMakefilein">branches/new-help-system/base/src/Makefile.in</a></li>
<li><a href="#branchesnewhelpsystembasesrcconfighin">branches/new-help-system/base/src/config.h.in</a></li>
<li><a href="#branchesnewhelpsystembasesrccregistryfilec">branches/new-help-system/base/src/cregistry/file.c</a></li>
<li><a href="#branchesnewhelpsystembasesrccregistryregistryc">branches/new-help-system/base/src/cregistry/registry.c</a></li>
<li><a href="#branchesnewhelpsystembasesrccregistryutilc">branches/new-help-system/base/src/cregistry/util.c</a></li>
<li><a href="#branchesnewhelpsystembasesrccregistryvercompc">branches/new-help-system/base/src/cregistry/vercomp.c</a></li>
<li><a href="#branchesnewhelpsystembasesrcdarwintracelib10Makefile">branches/new-help-system/base/src/darwintracelib1.0/Makefile</a></li>
<li><a href="#branchesnewhelpsystembasesrcdarwintracelib10darwintracec">branches/new-help-system/base/src/darwintracelib1.0/darwintrace.c</a></li>
<li><a href="#branchesnewhelpsystembasesrcimages_to_archivestcl">branches/new-help-system/base/src/images_to_archives.tcl</a></li>
<li><a href="#branchesnewhelpsystembasesrcmachista10libmachistac">branches/new-help-system/base/src/machista1.0/libmachista.c</a></li>
<li><a href="#branchesnewhelpsystembasesrcmachista10teststesttcl">branches/new-help-system/base/src/machista1.0/tests/test.tcl</a></li>
<li><a href="#branchesnewhelpsystembasesrcmacports10Makefile">branches/new-help-system/base/src/macports1.0/Makefile</a></li>
<li><a href="#branchesnewhelpsystembasesrcmacports10get_systemconfiguration_proxiesc">branches/new-help-system/base/src/macports1.0/get_systemconfiguration_proxies.c</a></li>
<li><a href="#branchesnewhelpsystembasesrcmacports10macportstcl">branches/new-help-system/base/src/macports1.0/macports.tcl</a></li>
<li><a href="#branchesnewhelpsystembasesrcmacports10macports_autoconftclin">branches/new-help-system/base/src/macports1.0/macports_autoconf.tcl.in</a></li>
<li><a href="#branchesnewhelpsystembasesrcmacports10macports_dlisttcl">branches/new-help-system/base/src/macports1.0/macports_dlist.tcl</a></li>
<li><a href="#branchesnewhelpsystembasesrcmacports10macports_utiltcl">branches/new-help-system/base/src/macports1.0/macports_util.tcl</a></li>
<li><a href="#branchesnewhelpsystembasesrcpackage10Makefile">branches/new-help-system/base/src/package1.0/Makefile</a></li>
<li><a href="#branchesnewhelpsystembasesrcpackage10portarchivefetchtcl">branches/new-help-system/base/src/package1.0/portarchivefetch.tcl</a></li>
<li><a href="#branchesnewhelpsystembasesrcpackage10portdmgtcl">branches/new-help-system/base/src/package1.0/portdmg.tcl</a></li>
<li><a href="#branchesnewhelpsystembasesrcpackage10portdpkgtcl">branches/new-help-system/base/src/package1.0/portdpkg.tcl</a></li>
<li><a href="#branchesnewhelpsystembasesrcpackage10portmdmgtcl">branches/new-help-system/base/src/package1.0/portmdmg.tcl</a></li>
<li><a href="#branchesnewhelpsystembasesrcpackage10portmpkgtcl">branches/new-help-system/base/src/package1.0/portmpkg.tcl</a></li>
<li><a href="#branchesnewhelpsystembasesrcpackage10portpkgtcl">branches/new-help-system/base/src/package1.0/portpkg.tcl</a></li>
<li><a href="#branchesnewhelpsystembasesrcpackage10portrpmtcl">branches/new-help-system/base/src/package1.0/portrpm.tcl</a></li>
<li><a href="#branchesnewhelpsystembasesrcpackage10portsrpmtcl">branches/new-help-system/base/src/package1.0/portsrpm.tcl</a></li>
<li><a href="#branchesnewhelpsystembasesrcpackage10portunarchivetcl">branches/new-help-system/base/src/package1.0/portunarchive.tcl</a></li>
<li><a href="#branchesnewhelpsystembasesrcpextlib10Makefilein">branches/new-help-system/base/src/pextlib1.0/Makefile.in</a></li>
<li><a href="#branchesnewhelpsystembasesrcpextlib10Pextlibc">branches/new-help-system/base/src/pextlib1.0/Pextlib.c</a></li>
<li><a href="#branchesnewhelpsystembasesrcpextlib10curlc">branches/new-help-system/base/src/pextlib1.0/curl.c</a></li>
<li><a href="#branchesnewhelpsystembasesrcpextlib10filemapc">branches/new-help-system/base/src/pextlib1.0/filemap.c</a></li>
<li><a href="#branchesnewhelpsystembasesrcpextlib10strsedc">branches/new-help-system/base/src/pextlib1.0/strsed.c</a></li>
<li><a href="#branchesnewhelpsystembasesrcpextlib10systemc">branches/new-help-system/base/src/pextlib1.0/system.c</a></li>
<li><a href="#branchesnewhelpsystembasesrcpextlib10testsfilemaptcl">branches/new-help-system/base/src/pextlib1.0/tests/filemap.tcl</a></li>
<li><a href="#branchesnewhelpsystembasesrcpextlib10testsfstraversetcl">branches/new-help-system/base/src/pextlib1.0/tests/fs-traverse.tcl</a></li>
<li><a href="#branchesnewhelpsystembasesrcpextlib10tracelibc">branches/new-help-system/base/src/pextlib1.0/tracelib.c</a></li>
<li><a href="#branchesnewhelpsystembasesrcportporttcl">branches/new-help-system/base/src/port/port.tcl</a></li>
<li><a href="#branchesnewhelpsystembasesrcportportindextcl">branches/new-help-system/base/src/port/portindex.tcl</a></li>
<li><a href="#branchesnewhelpsystembasesrcportportmirrortcl">branches/new-help-system/base/src/port/portmirror.tcl</a></li>
<li><a href="#branchesnewhelpsystembasesrcport10Makefile">branches/new-help-system/base/src/port1.0/Makefile</a></li>
<li><a href="#branchesnewhelpsystembasesrcport10fetch_commontcl">branches/new-help-system/base/src/port1.0/fetch_common.tcl</a></li>
<li><a href="#branchesnewhelpsystembasesrcport10portactivatetcl">branches/new-help-system/base/src/port1.0/portactivate.tcl</a></li>
<li><a href="#branchesnewhelpsystembasesrcport10portbuildtcl">branches/new-help-system/base/src/port1.0/portbuild.tcl</a></li>
<li><a href="#branchesnewhelpsystembasesrcport10portchecksumtcl">branches/new-help-system/base/src/port1.0/portchecksum.tcl</a></li>
<li><a href="#branchesnewhelpsystembasesrcport10portcleantcl">branches/new-help-system/base/src/port1.0/portclean.tcl</a></li>
<li><a href="#branchesnewhelpsystembasesrcport10portconfiguretcl">branches/new-help-system/base/src/port1.0/portconfigure.tcl</a></li>
<li><a href="#branchesnewhelpsystembasesrcport10portdestroottcl">branches/new-help-system/base/src/port1.0/portdestroot.tcl</a></li>
<li><a href="#branchesnewhelpsystembasesrcport10portdistchecktcl">branches/new-help-system/base/src/port1.0/portdistcheck.tcl</a></li>
<li><a href="#branchesnewhelpsystembasesrcport10portdistfilestcl">branches/new-help-system/base/src/port1.0/portdistfiles.tcl</a></li>
<li><a href="#branchesnewhelpsystembasesrcport10portextracttcl">branches/new-help-system/base/src/port1.0/portextract.tcl</a></li>
<li><a href="#branchesnewhelpsystembasesrcport10portfetchtcl">branches/new-help-system/base/src/port1.0/portfetch.tcl</a></li>
<li><a href="#branchesnewhelpsystembasesrcport10portinstalltcl">branches/new-help-system/base/src/port1.0/portinstall.tcl</a></li>
<li><a href="#branchesnewhelpsystembasesrcport10portlinttcl">branches/new-help-system/base/src/port1.0/portlint.tcl</a></li>
<li><a href="#branchesnewhelpsystembasesrcport10portlivechecktcl">branches/new-help-system/base/src/port1.0/portlivecheck.tcl</a></li>
<li><a href="#branchesnewhelpsystembasesrcport10portloadtcl">branches/new-help-system/base/src/port1.0/portload.tcl</a></li>
<li><a href="#branchesnewhelpsystembasesrcport10portmaintcl">branches/new-help-system/base/src/port1.0/portmain.tcl</a></li>
<li><a href="#branchesnewhelpsystembasesrcport10portmirrortcl">branches/new-help-system/base/src/port1.0/portmirror.tcl</a></li>
<li><a href="#branchesnewhelpsystembasesrcport10portpatchtcl">branches/new-help-system/base/src/port1.0/portpatch.tcl</a></li>
<li><a href="#branchesnewhelpsystembasesrcport10portsandboxtcl">branches/new-help-system/base/src/port1.0/portsandbox.tcl</a></li>
<li><a href="#branchesnewhelpsystembasesrcport10portstartupitemtcl">branches/new-help-system/base/src/port1.0/portstartupitem.tcl</a></li>
<li><a href="#branchesnewhelpsystembasesrcport10porttracetcl">branches/new-help-system/base/src/port1.0/porttrace.tcl</a></li>
<li><a href="#branchesnewhelpsystembasesrcport10portunloadtcl">branches/new-help-system/base/src/port1.0/portunload.tcl</a></li>
<li><a href="#branchesnewhelpsystembasesrcport10portutiltcl">branches/new-help-system/base/src/port1.0/portutil.tcl</a></li>
<li><a href="#branchesnewhelpsystembasesrcprogramsdaemondomainc">branches/new-help-system/base/src/programs/daemondo/main.c</a></li>
<li><a href="#branchesnewhelpsystembasesrcregistry20portimagetcl">branches/new-help-system/base/src/registry2.0/portimage.tcl</a></li>
<li><a href="#branchesnewhelpsystembasesrcregistry20portuninstalltcl">branches/new-help-system/base/src/registry2.0/portuninstall.tcl</a></li>
<li><a href="#branchesnewhelpsystembasesrcregistry20receipt_flattcl">branches/new-help-system/base/src/registry2.0/receipt_flat.tcl</a></li>
<li><a href="#branchesnewhelpsystembasesrcregistry20receipt_sqlitetcl">branches/new-help-system/base/src/registry2.0/receipt_sqlite.tcl</a></li>
<li><a href="#branchesnewhelpsystembasesrcregistry20registrytcl">branches/new-help-system/base/src/registry2.0/registry.tcl</a></li>
<li><a href="#branchesnewhelpsystembasesrcregistry20registry_utiltcl">branches/new-help-system/base/src/registry2.0/registry_util.tcl</a></li>
<li><a href="#branchesnewhelpsystembasesrcregistry20testsentrytcl">branches/new-help-system/base/src/registry2.0/tests/entry.tcl</a></li>
<li><a href="#branchesnewhelpsystembasesrcregistry20utilc">branches/new-help-system/base/src/registry2.0/util.c</a></li>
<li><a href="#branchesnewhelpsystembasesrcupgrade_sources_conf_defaulttcl">branches/new-help-system/base/src/upgrade_sources_conf_default.tcl</a></li>
<li><a href="#branchesnewhelpsystembaseteststestchecksums1Portfile">branches/new-help-system/base/tests/test/checksums-1/Portfile</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#branchesnewhelpsystembasesrcdarwintracelib10accessc">branches/new-help-system/base/src/darwintracelib1.0/access.c</a></li>
<li><a href="#branchesnewhelpsystembasesrcdarwintracelib10closec">branches/new-help-system/base/src/darwintracelib1.0/close.c</a></li>
<li><a href="#branchesnewhelpsystembasesrcdarwintracelib10darwintraceh">branches/new-help-system/base/src/darwintracelib1.0/darwintrace.h</a></li>
<li><a href="#branchesnewhelpsystembasesrcdarwintracelib10dup2c">branches/new-help-system/base/src/darwintracelib1.0/dup2.c</a></li>
<li><a href="#branchesnewhelpsystembasesrcdarwintracelib10mkdirc">branches/new-help-system/base/src/darwintracelib1.0/mkdir.c</a></li>
<li><a href="#branchesnewhelpsystembasesrcdarwintracelib10openc">branches/new-help-system/base/src/darwintracelib1.0/open.c</a></li>
<li><a href="#branchesnewhelpsystembasesrcdarwintracelib10procc">branches/new-help-system/base/src/darwintracelib1.0/proc.c</a></li>
<li><a href="#branchesnewhelpsystembasesrcdarwintracelib10readdirc">branches/new-help-system/base/src/darwintracelib1.0/readdir.c</a></li>
<li><a href="#branchesnewhelpsystembasesrcdarwintracelib10readlinkc">branches/new-help-system/base/src/darwintracelib1.0/readlink.c</a></li>
<li><a href="#branchesnewhelpsystembasesrcdarwintracelib10renamec">branches/new-help-system/base/src/darwintracelib1.0/rename.c</a></li>
<li><a href="#branchesnewhelpsystembasesrcdarwintracelib10rmdirc">branches/new-help-system/base/src/darwintracelib1.0/rmdir.c</a></li>
<li><a href="#branchesnewhelpsystembasesrcdarwintracelib10statc">branches/new-help-system/base/src/darwintracelib1.0/stat.c</a></li>
<li><a href="#branchesnewhelpsystembasesrcdarwintracelib10unlinkc">branches/new-help-system/base/src/darwintracelib1.0/unlink.c</a></li>
<li><a href="#branchesnewhelpsystembasesrcmacports10macports_test_autoconftclin">branches/new-help-system/base/src/macports1.0/macports_test_autoconf.tcl.in</a></li>
<li><a href="#branchesnewhelpsystembasesrcmacports10testsPortfile">branches/new-help-system/base/src/macports1.0/tests/Portfile</a></li>
<li><a href="#branchesnewhelpsystembasesrcmacports10testslibrarytcl">branches/new-help-system/base/src/macports1.0/tests/library.tcl</a></li>
<li><a href="#branchesnewhelpsystembasesrcmacports10testsmacportstest">branches/new-help-system/base/src/macports1.0/tests/macports.test</a></li>
<li><a href="#branchesnewhelpsystembasesrcmacports10testsmacports_dlisttest">branches/new-help-system/base/src/macports1.0/tests/macports_dlist.test</a></li>
<li><a href="#branchesnewhelpsystembasesrcmacports10testsmacports_utiltest">branches/new-help-system/base/src/macports1.0/tests/macports_util.test</a></li>
<li><a href="#branchesnewhelpsystembasesrcmacports10testssourcesconf">branches/new-help-system/base/src/macports1.0/tests/sources.conf</a></li>
<li><a href="#branchesnewhelpsystembasesrcmacports10teststesttcl">branches/new-help-system/base/src/macports1.0/tests/test.tcl</a></li>
<li><a href="#branchesnewhelpsystembasesrcpackage10package_test_autoconftclin">branches/new-help-system/base/src/package1.0/package_test_autoconf.tcl.in</a></li>
<li>branches/new-help-system/base/src/package1.0/tests/</li>
<li><a href="#branchesnewhelpsystembasesrcport10port_test_autoconftclin">branches/new-help-system/base/src/port1.0/port_test_autoconf.tcl.in</a></li>
<li><a href="#branchesnewhelpsystembasesrcport10testsPortfile">branches/new-help-system/base/src/port1.0/tests/Portfile</a></li>
<li><a href="#branchesnewhelpsystembasesrcport10testslibrarytcl">branches/new-help-system/base/src/port1.0/tests/library.tcl</a></li>
<li><a href="#branchesnewhelpsystembasesrcport10testsportactivatetest">branches/new-help-system/base/src/port1.0/tests/portactivate.test</a></li>
<li><a href="#branchesnewhelpsystembasesrcport10testsportchecksumtest">branches/new-help-system/base/src/port1.0/tests/portchecksum.test</a></li>
<li><a href="#branchesnewhelpsystembasesrcport10testsportcleantest">branches/new-help-system/base/src/port1.0/tests/portclean.test</a></li>
<li><a href="#branchesnewhelpsystembasesrcport10testsportdeactivatetest">branches/new-help-system/base/src/port1.0/tests/portdeactivate.test</a></li>
<li><a href="#branchesnewhelpsystembasesrcport10testsportdependstest">branches/new-help-system/base/src/port1.0/tests/portdepends.test</a></li>
<li><a href="#branchesnewhelpsystembasesrcport10testsportdistchecktest">branches/new-help-system/base/src/port1.0/tests/portdistcheck.test</a></li>
<li><a href="#branchesnewhelpsystembasesrcport10testsportinstalltest">branches/new-help-system/base/src/port1.0/tests/portinstall.test</a></li>
<li><a href="#branchesnewhelpsystembasesrcport10testsportloadtest">branches/new-help-system/base/src/port1.0/tests/portload.test</a></li>
<li><a href="#branchesnewhelpsystembasesrcport10testsportmaintest">branches/new-help-system/base/src/port1.0/tests/portmain.test</a></li>
<li><a href="#branchesnewhelpsystembasesrcport10testsportpatchtest">branches/new-help-system/base/src/port1.0/tests/portpatch.test</a></li>
<li><a href="#branchesnewhelpsystembasesrcport10testsporttesttest">branches/new-help-system/base/src/port1.0/tests/porttest.test</a></li>
<li><a href="#branchesnewhelpsystembasesrcport10testsportuninstalltest">branches/new-help-system/base/src/port1.0/tests/portuninstall.test</a></li>
<li><a href="#branchesnewhelpsystembasesrcport10testsportutiltest">branches/new-help-system/base/src/port1.0/tests/portutil.test</a></li>
<li><a href="#branchesnewhelpsystembasesrcport10testsstatefile">branches/new-help-system/base/src/port1.0/tests/statefile</a></li>
<li><a href="#branchesnewhelpsystembasesrcport10teststesttcl">branches/new-help-system/base/src/port1.0/tests/test.tcl</a></li>
<li><a href="#branchesnewhelpsystembasetestsMakefile">branches/new-help-system/base/tests/Makefile</a></li>
<li><a href="#branchesnewhelpsystembaseteststestcaseinsensitivedeactivateDESCRIPTION">branches/new-help-system/base/tests/test/case-insensitive-deactivate/DESCRIPTION</a></li>
<li><a href="#branchesnewhelpsystembaseteststestcaseinsensitivedeactivatetesttcl">branches/new-help-system/base/tests/test/case-insensitive-deactivate/test.tcl</a></li>
<li><a href="#branchesnewhelpsystembaseteststestchecksums1DESCRIPTION">branches/new-help-system/base/tests/test/checksums-1/DESCRIPTION</a></li>
<li><a href="#branchesnewhelpsystembaseteststestchecksums1testtcl">branches/new-help-system/base/tests/test/checksums-1/test.tcl</a></li>
<li><a href="#branchesnewhelpsystembaseteststestdependenciesaDESCRIPTION">branches/new-help-system/base/tests/test/dependencies-a/DESCRIPTION</a></li>
<li><a href="#branchesnewhelpsystembaseteststestdependenciesatesttcl">branches/new-help-system/base/tests/test/dependencies-a/test.tcl</a></li>
<li><a href="#branchesnewhelpsystembaseteststestdependenciesbDESCRIPTION">branches/new-help-system/base/tests/test/dependencies-b/DESCRIPTION</a></li>
<li><a href="#branchesnewhelpsystembaseteststestdependenciesbtesttcl">branches/new-help-system/base/tests/test/dependencies-b/test.tcl</a></li>
<li><a href="#branchesnewhelpsystembaseteststestdependenciescDESCRIPTION">branches/new-help-system/base/tests/test/dependencies-c/DESCRIPTION</a></li>
<li><a href="#branchesnewhelpsystembaseteststestdependenciesctesttcl">branches/new-help-system/base/tests/test/dependencies-c/test.tcl</a></li>
<li><a href="#branchesnewhelpsystembaseteststestdependenciesdDESCRIPTION">branches/new-help-system/base/tests/test/dependencies-d/DESCRIPTION</a></li>
<li><a href="#branchesnewhelpsystembaseteststestdependenciesdtesttcl">branches/new-help-system/base/tests/test/dependencies-d/test.tcl</a></li>
<li><a href="#branchesnewhelpsystembaseteststestdependencieseDESCRIPTION">branches/new-help-system/base/tests/test/dependencies-e/DESCRIPTION</a></li>
<li><a href="#branchesnewhelpsystembaseteststestdependenciesetesttcl">branches/new-help-system/base/tests/test/dependencies-e/test.tcl</a></li>
<li><a href="#branchesnewhelpsystembaseteststestenvvariablesDESCRIPTION">branches/new-help-system/base/tests/test/envvariables/DESCRIPTION</a></li>
<li><a href="#branchesnewhelpsystembaseteststestenvvariablestesttcl">branches/new-help-system/base/tests/test/envvariables/test.tcl</a></li>
<li><a href="#branchesnewhelpsystembaseteststestlibrarytcl">branches/new-help-system/base/tests/test/library.tcl</a></li>
<li><a href="#branchesnewhelpsystembaseteststestsitetagsDESCRIPTION">branches/new-help-system/base/tests/test/site-tags/DESCRIPTION</a></li>
<li><a href="#branchesnewhelpsystembaseteststestsitetagstesttcl">branches/new-help-system/base/tests/test/site-tags/test.tcl</a></li>
<li><a href="#branchesnewhelpsystembaseteststeststatefileunknownversionDESCRIPTION">branches/new-help-system/base/tests/test/statefile-unknown-version/DESCRIPTION</a></li>
<li><a href="#branchesnewhelpsystembaseteststeststatefileunknownversiontesttcl">branches/new-help-system/base/tests/test/statefile-unknown-version/test.tcl</a></li>
<li><a href="#branchesnewhelpsystembaseteststeststatefileversion1DESCRIPTION">branches/new-help-system/base/tests/test/statefile-version1/DESCRIPTION</a></li>
<li><a href="#branchesnewhelpsystembaseteststeststatefileversion1testtcl">branches/new-help-system/base/tests/test/statefile-version1/test.tcl</a></li>
<li><a href="#branchesnewhelpsystembaseteststeststatefileversion1outdatedDESCRIPTION">branches/new-help-system/base/tests/test/statefile-version1-outdated/DESCRIPTION</a></li>
<li><a href="#branchesnewhelpsystembaseteststeststatefileversion1outdatedtesttcl">branches/new-help-system/base/tests/test/statefile-version1-outdated/test.tcl</a></li>
<li><a href="#branchesnewhelpsystembaseteststeststatefileversion2DESCRIPTION">branches/new-help-system/base/tests/test/statefile-version2/DESCRIPTION</a></li>
<li><a href="#branchesnewhelpsystembaseteststeststatefileversion2testtcl">branches/new-help-system/base/tests/test/statefile-version2/test.tcl</a></li>
<li><a href="#branchesnewhelpsystembaseteststeststatefileversion2invalidDESCRIPTION">branches/new-help-system/base/tests/test/statefile-version2-invalid/DESCRIPTION</a></li>
<li><a href="#branchesnewhelpsystembaseteststeststatefileversion2invalidtesttcl">branches/new-help-system/base/tests/test/statefile-version2-invalid/test.tcl</a></li>
<li><a href="#branchesnewhelpsystembaseteststeststatefileversion2outdatedDESCRIPTION">branches/new-help-system/base/tests/test/statefile-version2-outdated/DESCRIPTION</a></li>
<li><a href="#branchesnewhelpsystembaseteststeststatefileversion2outdatedtesttcl">branches/new-help-system/base/tests/test/statefile-version2-outdated/test.tcl</a></li>
<li><a href="#branchesnewhelpsystembaseteststestsvnandpatchsitesDESCRIPTION">branches/new-help-system/base/tests/test/svn-and-patchsites/DESCRIPTION</a></li>
<li><a href="#branchesnewhelpsystembaseteststestsvnandpatchsitestesttcl">branches/new-help-system/base/tests/test/svn-and-patchsites/test.tcl</a></li>
<li><a href="#branchesnewhelpsystembaseteststesttraceDESCRIPTION">branches/new-help-system/base/tests/test/trace/DESCRIPTION</a></li>
<li><a href="#branchesnewhelpsystembaseteststesttracetesttcl">branches/new-help-system/base/tests/test/trace/test.tcl</a></li>
<li><a href="#branchesnewhelpsystembaseteststestuniversalDESCRIPTION">branches/new-help-system/base/tests/test/universal/DESCRIPTION</a></li>
<li><a href="#branchesnewhelpsystembaseteststestuniversalPortfilein">branches/new-help-system/base/tests/test/universal/Portfile.in</a></li>
<li><a href="#branchesnewhelpsystembaseteststestuniversaltesttcl">branches/new-help-system/base/tests/test/universal/test.tcl</a></li>
<li><a href="#branchesnewhelpsystembaseteststestvariantsDESCRIPTION">branches/new-help-system/base/tests/test/variants/DESCRIPTION</a></li>
<li><a href="#branchesnewhelpsystembaseteststestvariantstesttcl">branches/new-help-system/base/tests/test/variants/test.tcl</a></li>
<li><a href="#branchesnewhelpsystembaseteststestxcodeversionDESCRIPTION">branches/new-help-system/base/tests/test/xcodeversion/DESCRIPTION</a></li>
<li><a href="#branchesnewhelpsystembaseteststestxcodeversiontesttcl">branches/new-help-system/base/tests/test/xcodeversion/test.tcl</a></li>
<li><a href="#branchesnewhelpsystembaseteststesttcl">branches/new-help-system/base/tests/test.tcl</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#branchesnewhelpsystembasesrcmacports10testsmacports_dlisttcl">branches/new-help-system/base/src/macports1.0/tests/macports_dlist.tcl</a></li>
<li><a href="#branchesnewhelpsystembasesrcmacports10testsmacports_utiltcl">branches/new-help-system/base/src/macports1.0/tests/macports_util.tcl</a></li>
<li><a href="#branchesnewhelpsystembasesrcport10testscommontcl">branches/new-help-system/base/src/port1.0/tests/common.tcl</a></li>
<li><a href="#branchesnewhelpsystembasesrcport10testsportdestroottcl">branches/new-help-system/base/src/port1.0/tests/portdestroot.tcl</a></li>
<li><a href="#branchesnewhelpsystembasesrcport10testsportfetchtcl">branches/new-help-system/base/src/port1.0/tests/portfetch.tcl</a></li>
<li><a href="#branchesnewhelpsystembasesrcport10testsportutiltcl">branches/new-help-system/base/src/port1.0/tests/portutil.tcl</a></li>
<li><a href="#branchesnewhelpsystembasetestsMakefile">branches/new-help-system/base/tests/Makefile</a></li>
<li><a href="#branchesnewhelpsystembaseteststestcaseinsensitivedeactivateMakefile">branches/new-help-system/base/tests/test/case-insensitive-deactivate/Makefile</a></li>
<li><a href="#branchesnewhelpsystembaseteststestchecksums1master">branches/new-help-system/base/tests/test/checksums-1/master</a></li>
<li><a href="#branchesnewhelpsystembaseteststestdependenciescmaster">branches/new-help-system/base/tests/test/dependencies-c/master</a></li>
<li><a href="#branchesnewhelpsystembaseteststestdependenciesdmaster">branches/new-help-system/base/tests/test/dependencies-d/master</a></li>
<li><a href="#branchesnewhelpsystembaseteststestdependencieseerror_expected">branches/new-help-system/base/tests/test/dependencies-e/error_expected</a></li>
<li><a href="#branchesnewhelpsystembaseteststestdependenciesemaster">branches/new-help-system/base/tests/test/dependencies-e/master</a></li>
<li><a href="#branchesnewhelpsystembaseteststestenvvariablesMakefile">branches/new-help-system/base/tests/test/envvariables/Makefile</a></li>
<li><a href="#branchesnewhelpsystembaseteststestenvvariablesmaster">branches/new-help-system/base/tests/test/envvariables/master</a></li>
<li><a href="#branchesnewhelpsystembaseteststestsitetagsmaster">branches/new-help-system/base/tests/test/site-tags/master</a></li>
<li><a href="#branchesnewhelpsystembaseteststeststatefileunknownversionMakefile">branches/new-help-system/base/tests/test/statefile-unknown-version/Makefile</a></li>
<li><a href="#branchesnewhelpsystembaseteststeststatefileunknownversionmaster">branches/new-help-system/base/tests/test/statefile-unknown-version/master</a></li>
<li><a href="#branchesnewhelpsystembaseteststeststatefileversion1Makefile">branches/new-help-system/base/tests/test/statefile-version1/Makefile</a></li>
<li><a href="#branchesnewhelpsystembaseteststeststatefileversion1master">branches/new-help-system/base/tests/test/statefile-version1/master</a></li>
<li><a href="#branchesnewhelpsystembaseteststeststatefileversion1outdatedMakefile">branches/new-help-system/base/tests/test/statefile-version1-outdated/Makefile</a></li>
<li><a href="#branchesnewhelpsystembaseteststeststatefileversion1outdatedmaster">branches/new-help-system/base/tests/test/statefile-version1-outdated/master</a></li>
<li><a href="#branchesnewhelpsystembaseteststeststatefileversion2Makefile">branches/new-help-system/base/tests/test/statefile-version2/Makefile</a></li>
<li><a href="#branchesnewhelpsystembaseteststeststatefileversion2master">branches/new-help-system/base/tests/test/statefile-version2/master</a></li>
<li><a href="#branchesnewhelpsystembaseteststeststatefileversion2invalidMakefile">branches/new-help-system/base/tests/test/statefile-version2-invalid/Makefile</a></li>
<li><a href="#branchesnewhelpsystembaseteststeststatefileversion2invalidmaster">branches/new-help-system/base/tests/test/statefile-version2-invalid/master</a></li>
<li><a href="#branchesnewhelpsystembaseteststeststatefileversion2outdatedMakefile">branches/new-help-system/base/tests/test/statefile-version2-outdated/Makefile</a></li>
<li><a href="#branchesnewhelpsystembaseteststeststatefileversion2outdatedmaster">branches/new-help-system/base/tests/test/statefile-version2-outdated/master</a></li>
<li><a href="#branchesnewhelpsystembaseteststestsvnandpatchsitesmaster">branches/new-help-system/base/tests/test/svn-and-patchsites/master</a></li>
<li><a href="#branchesnewhelpsystembaseteststestuniversalMakefile">branches/new-help-system/base/tests/test/universal/Makefile</a></li>
<li><a href="#branchesnewhelpsystembaseteststestuniversalPortfile">branches/new-help-system/base/tests/test/universal/Portfile</a></li>
<li><a href="#branchesnewhelpsystembaseteststestuniversalmaster">branches/new-help-system/base/tests/test/universal/master</a></li>
<li>branches/new-help-system/base/tests/test/universal-2/</li>
<li><a href="#branchesnewhelpsystembaseteststestvariantsmaster">branches/new-help-system/base/tests/test/variants/master</a></li>
<li><a href="#branchesnewhelpsystembaseteststestxcodeversionmaster">branches/new-help-system/base/tests/test/xcodeversion/master</a></li>
</ul>

<h3>Property Changed</h3>
<ul>
<li><a href="#branchesnewhelpsystembase">branches/new-help-system/base/</a></li>
<li><a href="#branchesnewhelpsystembasesrcmacports10">branches/new-help-system/base/src/macports1.0/</a></li>
<li><a href="#branchesnewhelpsystembasesrcpackage10">branches/new-help-system/base/src/package1.0/</a></li>
<li><a href="#branchesnewhelpsystembasesrcpextlib10Makefilein">branches/new-help-system/base/src/pextlib1.0/Makefile.in</a></li>
<li><a href="#branchesnewhelpsystembasesrcpextlib10sha2c">branches/new-help-system/base/src/pextlib1.0/sha2.c</a></li>
<li><a href="#branchesnewhelpsystembasesrcpextlib10sha2h">branches/new-help-system/base/src/pextlib1.0/sha2.h</a></li>
<li><a href="#branchesnewhelpsystembasesrcpextlib10sha256cmdc">branches/new-help-system/base/src/pextlib1.0/sha256cmd.c</a></li>
<li><a href="#branchesnewhelpsystembasesrcpextlib10sha256cmdh">branches/new-help-system/base/src/pextlib1.0/sha256cmd.h</a></li>
<li><a href="#branchesnewhelpsystembasesrcport10">branches/new-help-system/base/src/port1.0/</a></li>
<li><a href="#branchesnewhelpsystembasesrcregistry20receipt_sqlitetcl">branches/new-help-system/base/src/registry2.0/receipt_sqlite.tcl</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchesnewhelpsystembase"></a>
<div class="propset"><h4>Property changes: branches/new-help-system/base</h4>
<pre class="diff"><span>
</span></pre></div>
<a id="svnmergeinfo"></a>
<div class="modfile"><h4>Modified: svn:mergeinfo</h4></div>
<span class="cx">/branches/gsoc09-logging/base:51231-60371
</span><span class="cx">/branches/gsoc11-rev-upgrade/base:78828-88375
</span><span class="cx">/branches/universal-sanity/base:51872-52323
</span><span class="cx">/branches/variant-descs-14482/base:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
</span><span class="cx">/trunk/base:49341-110831
</span><span class="cx">/users/perry/base-bugs_and_notes:45682-46060
</span><span class="cx">/users/perry/base-select:44044-44692
</span><span class="cx">   + /branches/gsoc08-privileges/base:37343-46937
</span><span class="cx">/branches/gsoc09-logging/base:51231-60371
</span><span class="cx">/branches/gsoc11-rev-upgrade/base:78828-88375
</span><span class="cx">/branches/gsoc11-statistics/base:79520,79666
</span><span class="cx">/branches/gsoc13-tests:106692-111324
</span><span class="cx">/branches/universal-sanity/base:51872-52323
</span><span class="cx">/branches/variant-descs-14482/base:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
</span><span class="cx">/trunk/base:49341-117083
</span><span class="cx">/users/perry/base-bugs_and_notes:45682-46060
</span><span class="cx">/users/perry/base-select:44044-44692
</span><a id="branchesnewhelpsystembaseChangeLog"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/ChangeLog (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/ChangeLog        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/ChangeLog        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -3,7 +3,40 @@
</span><span class="cx"> # $Id$
</span><span class="cx"> ###
</span><span class="cx"> 
</span><del>-Release 2.2.1 (unreleased)
</del><ins>+Release 2.3 (unreleased)
+    - Display a progress indicator for slow downloads. (cal in r117044)
+
+    - Allow ports to select a specific version of the Mac OS X SDK
+      for builds. (larryv in r116437)
+
+    - Enhance the &quot;move&quot; Portfile builtin to support case-only renames
+      on case-insensitive filesystems. (#41679, ryandesign in r114289)
+
+    - Disable Spotlight indexing on build directories, distfiles,
+      registry, log files, archives, base source and the default ports
+      tree. (cal in r113649)
+
+    - Detect when base is running on a different platform than the one
+      it was configured for and refer user to migration instructions.
+      (raimue in r113478)
+
+    - In debug output, sort environment variables and print one per
+      line. (#40703, ryandesign in r113037)
+
+    - Fix incorrect lint messages when an uppercase letter is used in
+      a PortGroup name. (#40733, ryandesign in r112064)
+
+    - Add &quot;-prepend&quot; command for Portfile options (similar to existing
+      &quot;-append&quot; command). (#40655, ryandesign in r111990)
+
+Release 2.2.1 (2013-10-26 by jmr)
+    - Fixed a problem where dependency calculation could sometimes fail for
+      ports that only support 32-bit architectures when the configured
+      build_arch is 64-bit and dependencies thus need to be +universal
+      (#40721, jmr in r112067)
+
+    - Fixed a potential crash in the strsed procedure (toby in r110985)
+
</ins><span class="cx">     - Provide choice of GCC version when compiling with DragonEgg.
</span><span class="cx">       (larryv in r108040)
</span><span class="cx"> 
</span></span></pre></div>
<a id="branchesnewhelpsystembaseHACKING"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/HACKING (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/HACKING        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/HACKING        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -70,3 +70,6 @@
</span><span class="cx"> 
</span><span class="cx">  *  All other files (documentation, etc) SHOULD NOT use a modeline as it
</span><span class="cx">     is probably meant for human consumption.
</span><ins>+
+ -  When adding new features, always add test cases.
+    See &quot;https://trac.macports.org/wiki/Tests&quot;.
</ins></span></pre></div>
<a id="branchesnewhelpsystembaseMkmacportsautoconfmkin"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/Mk/macports.autoconf.mk.in (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/Mk/macports.autoconf.mk.in        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/Mk/macports.autoconf.mk.in        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -16,6 +16,8 @@
</span><span class="cx"> CFLAGS_PEDANTIC                = @CFLAGS_PEDANTIC@
</span><span class="cx"> CFLAGS_WERROR                = @CFLAGS_WERROR@
</span><span class="cx"> 
</span><ins>+UNIVERSAL_ARCHFLAGS        = @UNIVERSAL_ARCHFLAGS@
+
</ins><span class="cx"> READLINE_CFLAGS                =
</span><span class="cx"> MD5_CFLAGS                =
</span><span class="cx"> SQLITE3_CFLAGS                = @CFLAGS_SQLITE3@
</span></span></pre></div>
<a id="branchesnewhelpsystembaseaclocalm4"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/aclocal.m4 (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/aclocal.m4        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/aclocal.m4        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -511,6 +511,9 @@
</span><span class="cx"> 
</span><span class="cx">   if test &quot;x$UNIVERSAL_ARCHS&quot; = &quot;x&quot;; then
</span><span class="cx">     case &quot;$MACOSX_VERSION&quot; in
</span><ins>+      10.1[[0-9]]*)
+        UNIVERSAL_ARCHS=&quot;x86_64 i386&quot;
+        ;;
</ins><span class="cx">       10.[[0-5]]*)
</span><span class="cx">         UNIVERSAL_ARCHS=&quot;i386 ppc&quot;
</span><span class="cx">         ;;
</span><span class="lines">@@ -520,9 +523,15 @@
</span><span class="cx">     esac
</span><span class="cx">   fi
</span><span class="cx"> 
</span><ins>+  UNIVERSAL_ARCHFLAGS=
+  for arch in $UNIVERSAL_ARCHS; do
+    UNIVERSAL_ARCHFLAGS=&quot;$UNIVERSAL_ARCHFLAGS -arch $arch&quot;
+  done
+
</ins><span class="cx">   AC_MSG_CHECKING([for Universal CPU architectures])
</span><span class="cx">   AC_MSG_RESULT([$UNIVERSAL_ARCHS])
</span><span class="cx">   AC_SUBST(UNIVERSAL_ARCHS)
</span><ins>+  AC_SUBST(UNIVERSAL_ARCHFLAGS)
</ins><span class="cx"> ])
</span><span class="cx"> 
</span><span class="cx"> # MP_LIB_MD5
</span><span class="lines">@@ -883,7 +892,7 @@
</span><span class="cx">         
</span><span class="cx"> ])
</span><span class="cx"> 
</span><del>-dnl This macro ensures MP installation prefix bin/sbin paths are NOT in PATH
</del><ins>+dnl This macro ensures MP installation prefix paths are NOT in PATH
</ins><span class="cx"> dnl for configure to prevent potential problems when base/ code is updated
</span><span class="cx"> dnl and ports are installed that would match needed items.
</span><span class="cx"> AC_DEFUN([MP_PATH_SCAN],[
</span><span class="lines">@@ -897,14 +906,17 @@
</span><span class="cx">         for as_dir in $oldPATH
</span><span class="cx">         do
</span><span class="cx">                 IFS=$as_save_IFS
</span><del>-                if test &quot;x$as_dir&quot; != &quot;x$prefix/bin&quot; &amp;&amp;
-                        test &quot;x$as_dir&quot; != &quot;x$prefix/sbin&quot;; then
-                        if test -z &quot;$newPATH&quot;; then
-                                newPATH=$as_dir
-                        else
-                                newPATH=$newPATH$PATH_SEPARATOR$as_dir
-                        fi
-                fi
</del><ins>+                case &quot;$as_dir&quot; in
+                        $prefix/*)
+                                ;
+                        *)
+                                if test -z &quot;$newPATH&quot;; then
+                                        newPATH=$as_dir
+                                else
+                                        newPATH=$newPATH$PATH_SEPARATOR$as_dir
+                                fi
+                                ;
+                esac
</ins><span class="cx">         done
</span><span class="cx">         PATH=$newPATH; export PATH
</span><span class="cx">         AC_SUBST(PATH_CLEANED,$newPATH)
</span><span class="lines">@@ -1138,3 +1150,83 @@
</span><span class="cx">         CPPFLAGS=$mp_check_sqlite_version_cppflags_save
</span><span class="cx"> ])
</span><span class="cx"> 
</span><ins>+#------------------------------------------------------------------------
+# MP_TCL_PLATFORM --
+#
+#       Export target platform and major version
+#
+# Arguments:
+#       none.
+#
+# Requires:
+#       TCLSH must be set.
+#
+# Depends:
+#       none.
+#
+# Results:
+#       Defines OS_PLATFORM and OS_MAJOR.
+#
+#------------------------------------------------------------------------
+AC_DEFUN([MP_TCL_PLATFORM],[
+        AC_MSG_CHECKING([for Tcl target platform])
+        OS_PLATFORM=`echo 'puts -nonewline [[string tolower \$tcl_platform(os)]]' | $TCLSH`
+        OS_MAJOR=`echo 'puts -nonewline [[lindex [split \$tcl_platform(osVersion) .] 0]]' | $TCLSH`
+        AC_MSG_RESULT($OS_PLATFORM $OS_MAJOR)
+        AC_SUBST(OS_PLATFORM)
+        AC_SUBST(OS_MAJOR)
+])
+
+#------------------------------------------------------------------------
+# MP_TRACEMODE_SUPPORT --
+#
+#       Check whether trace mode is supported on this platform
+#
+# Arguments:
+#       none.
+#
+# Requires:
+#       OS_PLATOFRM and OS_MAJOR from MP_TCL_PLATFORM.
+#
+# Depends:
+#       none.
+#
+# Results:
+#       Defines the TRACEMODE_SUPPORT substitution and the
+#       HAVE_TRACEMODE_SUPPORT macro.
+#
+#------------------------------------------------------------------------
+AC_DEFUN([MP_TRACEMODE_SUPPORT],[
+                AC_REQUIRE([MP_TCL_PLATFORM])
+
+                AC_CHECK_FUNCS([kqueue kevent])
+
+                AC_MSG_CHECKING([whether trace mode is supported on this platform])
+                if test x&quot;${OS_PLATFORM}&quot; != &quot;xdarwin&quot;; then
+                        AC_MSG_RESULT([not darwin, no])
+                        TRACEMODE_SUPPORT=0
+                elif test x&quot;${ac_cv_func_kqueue}&quot; != &quot;xyes&quot;; then
+                        AC_MSG_RESULT([kqueue() not available, no])
+                        TRACEMODE_SUPPORT=0
+                elif test x&quot;${ac_cv_func_kevent}&quot; != &quot;xyes&quot;; then
+                        AC_MSG_RESULT([kevent() not available, no])
+                        TRACEMODE_SUPPORT=0
+                else
+                        AC_EGREP_CPP(yes_have_ev_receipt, [
+                                #include &lt;sys/types.h&gt;
+                                #include &lt;sys/event.h&gt;
+                                #include &lt;sys/time.h&gt;
+                                #ifdef EV_RECEIPT
+                                yes_have_ev_receipt
+                                #endif
+                        ],[
+                                AC_MSG_RESULT([yes])
+                                TRACEMODE_SUPPORT=1
+                                AC_DEFINE([HAVE_TRACEMODE_SUPPORT], [1], [Platform supports tracemode.])
+                        ],[
+                                AC_MSG_RESULT([EV_RECEIPT not available, no])
+                                TRACEMODE_SUPPORT=0
+                        ])
+                fi
+        AC_SUBST(TRACEMODE_SUPPORT)
+])
</ins></span></pre></div>
<a id="branchesnewhelpsystembaseconfigRELEASE_URL"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/config/RELEASE_URL (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/config/RELEASE_URL        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/config/RELEASE_URL        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -1 +1 @@
</span><del>-https://svn.macports.org/repository/macports/tags/release_2_2_0/base
</del><ins>+https://svn.macports.org/repository/macports/tags/release_2_2_1/base
</ins></span></pre></div>
<a id="branchesnewhelpsystembaseconfigure"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/configure (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/configure        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/configure        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -640,6 +640,7 @@
</span><span class="cx"> STLIB_LD
</span><span class="cx"> INCLUDES
</span><span class="cx"> subdirs
</span><ins>+TRACEMODE_SUPPORT
</ins><span class="cx"> SQLITE3_TCL_DIR
</span><span class="cx"> LDFLAGS_SQLITE3
</span><span class="cx"> CFLAGS_SQLITE3
</span><span class="lines">@@ -647,6 +648,8 @@
</span><span class="cx"> LDFLAGS_LIBCURL
</span><span class="cx"> CFLAGS_LIBCURL
</span><span class="cx"> CURL_CONFIG
</span><ins>+OS_MAJOR
+OS_PLATFORM
</ins><span class="cx"> TCLSH
</span><span class="cx"> TCL_INCLUDES
</span><span class="cx"> TCL_STUB_LIB_SPEC
</span><span class="lines">@@ -663,6 +666,7 @@
</span><span class="cx"> READLINK_IS_NOT_P1003_1A
</span><span class="cx"> ac_cv_func_strlcat
</span><span class="cx"> CPP
</span><ins>+UNIVERSAL_ARCHFLAGS
</ins><span class="cx"> UNIVERSAL_ARCHS
</span><span class="cx"> MPFRAMEWORKSDIR
</span><span class="cx"> MPAPPLICATIONSDIR
</span><span class="lines">@@ -2806,14 +2810,17 @@
</span><span class="cx">         for as_dir in $oldPATH
</span><span class="cx">         do
</span><span class="cx">                 IFS=$as_save_IFS
</span><del>-                if test &quot;x$as_dir&quot; != &quot;x$prefix/bin&quot; &amp;&amp;
-                        test &quot;x$as_dir&quot; != &quot;x$prefix/sbin&quot;; then
-                        if test -z &quot;$newPATH&quot;; then
-                                newPATH=$as_dir
-                        else
-                                newPATH=$newPATH$PATH_SEPARATOR$as_dir
-                        fi
-                fi
</del><ins>+                case &quot;$as_dir&quot; in
+                        $prefix/*)
+                                ;
+                        *)
+                                if test -z &quot;$newPATH&quot;; then
+                                        newPATH=$as_dir
+                                else
+                                        newPATH=$newPATH$PATH_SEPARATOR$as_dir
+                                fi
+                                ;
+                esac
</ins><span class="cx">         done
</span><span class="cx">         PATH=$newPATH; export PATH
</span><span class="cx">         PATH_CLEANED=$newPATH
</span><span class="lines">@@ -2951,17 +2958,17 @@
</span><span class="cx"> fi
</span><span class="cx"> 
</span><span class="cx"> case &quot;$MACOSX_VERSION&quot; in
</span><del>-  10.0*|10.1*|10.2*|10.3*)
</del><ins>+  10.0*|10.1|10.1.*|10.2*|10.3*)
</ins><span class="cx">     as_fn_error $? &quot;This version of Mac OS X is not supported
</span><span class="cx">                   Please upgrade at http://store.apple.com/&quot; &quot;$LINENO&quot; 5
</span><span class="cx">     ;;
</span><del>-  10.4.[0-9]|10.4.10|10.5.[0-7]|10.6.[0-7]|10.7.[0-4]|10.8.[0-3])
</del><ins>+  10.4.[0-9]|10.4.10|10.5.[0-7]|10.6.[0-7]|10.7.[0-4]|10.8.[0-4])
</ins><span class="cx">     { $as_echo &quot;$as_me:${as_lineno-$LINENO}: WARNING: This version of Mac OS X is out of date&quot; &gt;&amp;5
</span><span class="cx"> $as_echo &quot;$as_me: WARNING: This version of Mac OS X is out of date&quot; &gt;&amp;2;}
</span><span class="cx">     { $as_echo &quot;$as_me:${as_lineno-$LINENO}: WARNING: Please run Software Update to update it&quot; &gt;&amp;5
</span><span class="cx"> $as_echo &quot;$as_me: WARNING: Please run Software Update to update it&quot; &gt;&amp;2;}
</span><span class="cx">     ;;
</span><del>-  10.4*|10.5*|10.6*|10.7*|10.8*)
</del><ins>+  10.4*|10.5*|10.6*|10.7*|10.8*|10.9*)
</ins><span class="cx">         ;;
</span><span class="cx">   *)
</span><span class="cx">     ;;
</span><span class="lines">@@ -3018,7 +3025,7 @@
</span><span class="cx">     { $as_echo &quot;$as_me:${as_lineno-$LINENO}: WARNING: Please consider upgrading as some ports fail compiling&quot; &gt;&amp;5
</span><span class="cx"> $as_echo &quot;$as_me: WARNING: Please consider upgrading as some ports fail compiling&quot; &gt;&amp;2;}
</span><span class="cx">     ;;
</span><del>-  2.*|3.*|4.*)
</del><ins>+  2.*|3.*|4.*|5.*)
</ins><span class="cx">         ;;
</span><span class="cx">   *)
</span><span class="cx">     ;;
</span><span class="lines">@@ -3031,197 +3038,7 @@
</span><span class="cx"> ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS &gt;&amp;5'
</span><span class="cx"> ac_compiler_gnu=$ac_cv_c_compiler_gnu
</span><span class="cx"> if test -n &quot;$ac_tool_prefix&quot;; then
</span><del>-  # Extract the first word of &quot;${ac_tool_prefix}gcc&quot;, so it can be a program name with args.
-set dummy ${ac_tool_prefix}gcc; ac_word=$2
-{ $as_echo &quot;$as_me:${as_lineno-$LINENO}: checking for $ac_word&quot; &gt;&amp;5
-$as_echo_n &quot;checking for $ac_word... &quot; &gt;&amp;6; }
-if ${ac_cv_prog_CC+:} false; then :
-  $as_echo_n &quot;(cached) &quot; &gt;&amp;6
-else
-  if test -n &quot;$CC&quot;; then
-  ac_cv_prog_CC=&quot;$CC&quot; # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z &quot;$as_dir&quot; &amp;&amp; as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p &quot;$as_dir/$ac_word$ac_exec_ext&quot;; then
-    ac_cv_prog_CC=&quot;${ac_tool_prefix}gcc&quot;
-    $as_echo &quot;$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext&quot; &gt;&amp;5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n &quot;$CC&quot;; then
-  { $as_echo &quot;$as_me:${as_lineno-$LINENO}: result: $CC&quot; &gt;&amp;5
-$as_echo &quot;$CC&quot; &gt;&amp;6; }
-else
-  { $as_echo &quot;$as_me:${as_lineno-$LINENO}: result: no&quot; &gt;&amp;5
-$as_echo &quot;no&quot; &gt;&amp;6; }
-fi
-
-
-fi
-if test -z &quot;$ac_cv_prog_CC&quot;; then
-  ac_ct_CC=$CC
-  # Extract the first word of &quot;gcc&quot;, so it can be a program name with args.
-set dummy gcc; ac_word=$2
-{ $as_echo &quot;$as_me:${as_lineno-$LINENO}: checking for $ac_word&quot; &gt;&amp;5
-$as_echo_n &quot;checking for $ac_word... &quot; &gt;&amp;6; }
-if ${ac_cv_prog_ac_ct_CC+:} false; then :
-  $as_echo_n &quot;(cached) &quot; &gt;&amp;6
-else
-  if test -n &quot;$ac_ct_CC&quot;; then
-  ac_cv_prog_ac_ct_CC=&quot;$ac_ct_CC&quot; # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z &quot;$as_dir&quot; &amp;&amp; as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p &quot;$as_dir/$ac_word$ac_exec_ext&quot;; then
-    ac_cv_prog_ac_ct_CC=&quot;gcc&quot;
-    $as_echo &quot;$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext&quot; &gt;&amp;5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_CC=$ac_cv_prog_ac_ct_CC
-if test -n &quot;$ac_ct_CC&quot;; then
-  { $as_echo &quot;$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC&quot; &gt;&amp;5
-$as_echo &quot;$ac_ct_CC&quot; &gt;&amp;6; }
-else
-  { $as_echo &quot;$as_me:${as_lineno-$LINENO}: result: no&quot; &gt;&amp;5
-$as_echo &quot;no&quot; &gt;&amp;6; }
-fi
-
-  if test &quot;x$ac_ct_CC&quot; = x; then
-    CC=&quot;&quot;
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo &quot;$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet&quot; &gt;&amp;5
-$as_echo &quot;$as_me: WARNING: using cross tools not prefixed with host triplet&quot; &gt;&amp;2;}
-ac_tool_warned=yes ;;
-esac
-    CC=$ac_ct_CC
-  fi
-else
-  CC=&quot;$ac_cv_prog_CC&quot;
-fi
-
-if test -z &quot;$CC&quot;; then
-          if test -n &quot;$ac_tool_prefix&quot;; then
-    # Extract the first word of &quot;${ac_tool_prefix}cc&quot;, so it can be a program name with args.
-set dummy ${ac_tool_prefix}cc; ac_word=$2
-{ $as_echo &quot;$as_me:${as_lineno-$LINENO}: checking for $ac_word&quot; &gt;&amp;5
-$as_echo_n &quot;checking for $ac_word... &quot; &gt;&amp;6; }
-if ${ac_cv_prog_CC+:} false; then :
-  $as_echo_n &quot;(cached) &quot; &gt;&amp;6
-else
-  if test -n &quot;$CC&quot;; then
-  ac_cv_prog_CC=&quot;$CC&quot; # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z &quot;$as_dir&quot; &amp;&amp; as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p &quot;$as_dir/$ac_word$ac_exec_ext&quot;; then
-    ac_cv_prog_CC=&quot;${ac_tool_prefix}cc&quot;
-    $as_echo &quot;$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext&quot; &gt;&amp;5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n &quot;$CC&quot;; then
-  { $as_echo &quot;$as_me:${as_lineno-$LINENO}: result: $CC&quot; &gt;&amp;5
-$as_echo &quot;$CC&quot; &gt;&amp;6; }
-else
-  { $as_echo &quot;$as_me:${as_lineno-$LINENO}: result: no&quot; &gt;&amp;5
-$as_echo &quot;no&quot; &gt;&amp;6; }
-fi
-
-
-  fi
-fi
-if test -z &quot;$CC&quot;; then
-  # Extract the first word of &quot;cc&quot;, so it can be a program name with args.
-set dummy cc; ac_word=$2
-{ $as_echo &quot;$as_me:${as_lineno-$LINENO}: checking for $ac_word&quot; &gt;&amp;5
-$as_echo_n &quot;checking for $ac_word... &quot; &gt;&amp;6; }
-if ${ac_cv_prog_CC+:} false; then :
-  $as_echo_n &quot;(cached) &quot; &gt;&amp;6
-else
-  if test -n &quot;$CC&quot;; then
-  ac_cv_prog_CC=&quot;$CC&quot; # Let the user override the test.
-else
-  ac_prog_rejected=no
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z &quot;$as_dir&quot; &amp;&amp; as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p &quot;$as_dir/$ac_word$ac_exec_ext&quot;; then
-    if test &quot;$as_dir/$ac_word$ac_exec_ext&quot; = &quot;/usr/ucb/cc&quot;; then
-       ac_prog_rejected=yes
-       continue
-     fi
-    ac_cv_prog_CC=&quot;cc&quot;
-    $as_echo &quot;$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext&quot; &gt;&amp;5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-if test $ac_prog_rejected = yes; then
-  # We found a bogon in the path, so make sure we never use it.
-  set dummy $ac_cv_prog_CC
-  shift
-  if test $# != 0; then
-    # We chose a different compiler from the bogus one.
-    # However, it has the same basename, so the bogon will be chosen
-    # first if we set CC to just the basename; use the full file name.
-    shift
-    ac_cv_prog_CC=&quot;$as_dir/$ac_word${1+' '}$@&quot;
-  fi
-fi
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n &quot;$CC&quot;; then
-  { $as_echo &quot;$as_me:${as_lineno-$LINENO}: result: $CC&quot; &gt;&amp;5
-$as_echo &quot;$CC&quot; &gt;&amp;6; }
-else
-  { $as_echo &quot;$as_me:${as_lineno-$LINENO}: result: no&quot; &gt;&amp;5
-$as_echo &quot;no&quot; &gt;&amp;6; }
-fi
-
-
-fi
-if test -z &quot;$CC&quot;; then
-  if test -n &quot;$ac_tool_prefix&quot;; then
-  for ac_prog in cl.exe
</del><ins>+  for ac_prog in clang cc gcc
</ins><span class="cx">   do
</span><span class="cx">     # Extract the first word of &quot;$ac_tool_prefix$ac_prog&quot;, so it can be a program name with args.
</span><span class="cx"> set dummy $ac_tool_prefix$ac_prog; ac_word=$2
</span><span class="lines">@@ -3265,7 +3082,7 @@
</span><span class="cx"> fi
</span><span class="cx"> if test -z &quot;$CC&quot;; then
</span><span class="cx">   ac_ct_CC=$CC
</span><del>-  for ac_prog in cl.exe
</del><ins>+  for ac_prog in clang cc gcc
</ins><span class="cx"> do
</span><span class="cx">   # Extract the first word of &quot;$ac_prog&quot;, so it can be a program name with args.
</span><span class="cx"> set dummy $ac_prog; ac_word=$2
</span><span class="lines">@@ -3320,9 +3137,7 @@
</span><span class="cx">   fi
</span><span class="cx"> fi
</span><span class="cx"> 
</span><del>-fi
</del><span class="cx"> 
</span><del>-
</del><span class="cx"> test -z &quot;$CC&quot; &amp;&amp; { { $as_echo &quot;$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':&quot; &gt;&amp;5
</span><span class="cx"> $as_echo &quot;$as_me: error: in \`$ac_pwd':&quot; &gt;&amp;2;}
</span><span class="cx"> as_fn_error $? &quot;no acceptable C compiler found in \$PATH
</span><span class="lines">@@ -3955,7 +3770,7 @@
</span><span class="cx"> ac_link='$OBJC -o conftest$ac_exeext $OBJCFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS &gt;&amp;5'
</span><span class="cx"> ac_compiler_gnu=$ac_cv_objc_compiler_gnu
</span><span class="cx"> if test -n &quot;$ac_tool_prefix&quot;; then
</span><del>-  for ac_prog in gcc objcc objc cc CC
</del><ins>+  for ac_prog in clang cc gcc
</ins><span class="cx">   do
</span><span class="cx">     # Extract the first word of &quot;$ac_tool_prefix$ac_prog&quot;, so it can be a program name with args.
</span><span class="cx"> set dummy $ac_tool_prefix$ac_prog; ac_word=$2
</span><span class="lines">@@ -3999,7 +3814,7 @@
</span><span class="cx"> fi
</span><span class="cx"> if test -z &quot;$OBJC&quot;; then
</span><span class="cx">   ac_ct_OBJC=$OBJC
</span><del>-  for ac_prog in gcc objcc objc cc CC
</del><ins>+  for ac_prog in clang cc gcc
</ins><span class="cx"> do
</span><span class="cx">   # Extract the first word of &quot;$ac_prog&quot;, so it can be a program name with args.
</span><span class="cx"> set dummy $ac_prog; ac_word=$2
</span><span class="lines">@@ -8360,6 +8175,9 @@
</span><span class="cx"> 
</span><span class="cx">   if test &quot;x$UNIVERSAL_ARCHS&quot; = &quot;x&quot;; then
</span><span class="cx">     case &quot;$MACOSX_VERSION&quot; in
</span><ins>+      10.1[0-9]*)
+        UNIVERSAL_ARCHS=&quot;x86_64 i386&quot;
+        ;;
</ins><span class="cx">       10.[0-5]*)
</span><span class="cx">         UNIVERSAL_ARCHS=&quot;i386 ppc&quot;
</span><span class="cx">         ;;
</span><span class="lines">@@ -8369,6 +8187,11 @@
</span><span class="cx">     esac
</span><span class="cx">   fi
</span><span class="cx"> 
</span><ins>+  UNIVERSAL_ARCHFLAGS=
+  for arch in $UNIVERSAL_ARCHS; do
+    UNIVERSAL_ARCHFLAGS=&quot;$UNIVERSAL_ARCHFLAGS -arch $arch&quot;
+  done
+
</ins><span class="cx">   { $as_echo &quot;$as_me:${as_lineno-$LINENO}: checking for Universal CPU architectures&quot; &gt;&amp;5
</span><span class="cx"> $as_echo_n &quot;checking for Universal CPU architectures... &quot; &gt;&amp;6; }
</span><span class="cx">   { $as_echo &quot;$as_me:${as_lineno-$LINENO}: result: $UNIVERSAL_ARCHS&quot; &gt;&amp;5
</span><span class="lines">@@ -8376,6 +8199,7 @@
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> 
</span><ins>+
</ins><span class="cx"> # Check for standard header files.
</span><span class="cx"> ac_ext=c
</span><span class="cx"> ac_cpp='$CPP $CPPFLAGS'
</span><span class="lines">@@ -8826,8 +8650,9 @@
</span><span class="cx"> 
</span><span class="cx"> fi
</span><span class="cx"> 
</span><del>-for ac_header in limits.h paths.h sys/file.h crt_externs.h fcntl.h sys/fcntl.h sys/cdefs.h err.h sys/socket.h \
-        sys/event.h sys/sysctl.h readline/readline.h readline/history.h pwd.h sys/paths.h utime.h
</del><ins>+for ac_header in crt_externs.h err.h fcntl.h libkern/OSAtomic.h limits.h paths.h pwd.h \
+        readline/history.h readline/readline.h spawn.h sys/cdefs.h sys/event.h sys/fcntl.h sys/file.h \
+        sys/paths.h sys/socket.h sys/sysctl.h utime.h
</ins><span class="cx"> do :
</span><span class="cx">   as_ac_Header=`$as_echo &quot;ac_cv_header_$ac_header&quot; | $as_tr_sh`
</span><span class="cx"> ac_fn_c_check_header_mongrel &quot;$LINENO&quot; &quot;$ac_header&quot; &quot;$as_ac_Header&quot; &quot;$ac_includes_default&quot;
</span><span class="lines">@@ -8844,7 +8669,9 @@
</span><span class="cx"> INCLUDES=&quot;-I.. -I. $INCLUDES&quot;
</span><span class="cx"> 
</span><span class="cx"> # Checks for library functions.
</span><del>-for ac_func in bzero memset fgetln lockf flock setmode strcasecmp strncasecmp strlcpy strlcat copyfile clearenv sysctlbyname kqueue
</del><ins>+for ac_func in OSAtomicCompareAndSwap32 OSAtomicCompareAndSwap64 OSAtomicCompareAndSwapPtr bzero \
+        clearenv copyfile fgetln flock fls kqueue lockf memset posix_spawn setmode strcasecmp strlcat \
+        strlcpy strncasecmp sysctlbyname
</ins><span class="cx"> do :
</span><span class="cx">   as_ac_var=`$as_echo &quot;ac_cv_func_$ac_func&quot; | $as_tr_sh`
</span><span class="cx"> ac_fn_c_check_func &quot;$LINENO&quot; &quot;$ac_func&quot; &quot;$as_ac_var&quot;
</span><span class="lines">@@ -9583,6 +9410,18 @@
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> 
</span><ins>+# Substitute Tcl platform for base compatibility check
+
+        { $as_echo &quot;$as_me:${as_lineno-$LINENO}: checking for Tcl target platform&quot; &gt;&amp;5
+$as_echo_n &quot;checking for Tcl target platform... &quot; &gt;&amp;6; }
+        OS_PLATFORM=`echo 'puts -nonewline [string tolower \$tcl_platform(os)]' | $TCLSH`
+        OS_MAJOR=`echo 'puts -nonewline [lindex [split \$tcl_platform(osVersion) .] 0]' | $TCLSH`
+        { $as_echo &quot;$as_me:${as_lineno-$LINENO}: result: $OS_PLATFORM $OS_MAJOR&quot; &gt;&amp;5
+$as_echo &quot;$OS_PLATFORM $OS_MAJOR&quot; &gt;&amp;6; }
+
+
+
+
</ins><span class="cx"> # Check for Tcl package path
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="lines">@@ -10006,6 +9845,72 @@
</span><span class="cx"> 
</span><span class="cx"> fi
</span><span class="cx"> 
</span><ins>+# check whether trace mode is supported on this platform
+
+
+
+                for ac_func in kqueue kevent
+do :
+  as_ac_var=`$as_echo &quot;ac_cv_func_$ac_func&quot; | $as_tr_sh`
+ac_fn_c_check_func &quot;$LINENO&quot; &quot;$ac_func&quot; &quot;$as_ac_var&quot;
+if eval test \&quot;x\$&quot;$as_ac_var&quot;\&quot; = x&quot;yes&quot;; then :
+  cat &gt;&gt;confdefs.h &lt;&lt;_ACEOF
+#define `$as_echo &quot;HAVE_$ac_func&quot; | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+
+                { $as_echo &quot;$as_me:${as_lineno-$LINENO}: checking whether trace mode is supported on this platform&quot; &gt;&amp;5
+$as_echo_n &quot;checking whether trace mode is supported on this platform... &quot; &gt;&amp;6; }
+                if test x&quot;${OS_PLATFORM}&quot; != &quot;xdarwin&quot;; then
+                        { $as_echo &quot;$as_me:${as_lineno-$LINENO}: result: not darwin, no&quot; &gt;&amp;5
+$as_echo &quot;not darwin, no&quot; &gt;&amp;6; }
+                        TRACEMODE_SUPPORT=0
+                elif test x&quot;${ac_cv_func_kqueue}&quot; != &quot;xyes&quot;; then
+                        { $as_echo &quot;$as_me:${as_lineno-$LINENO}: result: kqueue() not available, no&quot; &gt;&amp;5
+$as_echo &quot;kqueue() not available, no&quot; &gt;&amp;6; }
+                        TRACEMODE_SUPPORT=0
+                elif test x&quot;${ac_cv_func_kevent}&quot; != &quot;xyes&quot;; then
+                        { $as_echo &quot;$as_me:${as_lineno-$LINENO}: result: kevent() not available, no&quot; &gt;&amp;5
+$as_echo &quot;kevent() not available, no&quot; &gt;&amp;6; }
+                        TRACEMODE_SUPPORT=0
+                else
+                        cat confdefs.h - &lt;&lt;_ACEOF &gt;conftest.$ac_ext
+/* end confdefs.h.  */
+
+                                #include &lt;sys/types.h&gt;
+                                #include &lt;sys/event.h&gt;
+                                #include &lt;sys/time.h&gt;
+                                #ifdef EV_RECEIPT
+                                yes_have_ev_receipt
+                                #endif
+
+_ACEOF
+if (eval &quot;$ac_cpp conftest.$ac_ext&quot;) 2&gt;&amp;5 |
+  $EGREP &quot;yes_have_ev_receipt&quot; &gt;/dev/null 2&gt;&amp;1; then :
+
+                                { $as_echo &quot;$as_me:${as_lineno-$LINENO}: result: yes&quot; &gt;&amp;5
+$as_echo &quot;yes&quot; &gt;&amp;6; }
+                                TRACEMODE_SUPPORT=1
+
+$as_echo &quot;#define HAVE_TRACEMODE_SUPPORT 1&quot; &gt;&gt;confdefs.h
+
+
+else
+
+                                { $as_echo &quot;$as_me:${as_lineno-$LINENO}: result: EV_RECEIPT not available, no&quot; &gt;&amp;5
+$as_echo &quot;EV_RECEIPT not available, no&quot; &gt;&amp;6; }
+                                TRACEMODE_SUPPORT=0
+
+fi
+rm -f conftest*
+
+                fi
+
+
+
</ins><span class="cx"> # Determine if we need to install some bundled packages
</span><span class="cx"> OUR_INCLUDED_PACKAGES=
</span><span class="cx"> 
</span><span class="lines">@@ -10140,7 +10045,7 @@
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> # Output
</span><del>-ac_config_files=&quot;$ac_config_files Doxyfile Makefile Mk/macports.autoconf.mk doc/base.mtree doc/macosx.mtree doc/macports.conf doc/prefix.mtree doc/pubkeys.conf portmgr/freebsd/Makefile setupenv.bash src/Makefile src/machista1.0/Makefile src/macports1.0/macports_autoconf.tcl src/macports1.0/macports_fastload.tcl src/pextlib1.0/Makefile src/port1.0/port_autoconf.tcl src/programs/Makefile src/registry2.0/registry_autoconf.tcl&quot;
</del><ins>+ac_config_files=&quot;$ac_config_files Doxyfile Makefile Mk/macports.autoconf.mk doc/base.mtree doc/macosx.mtree doc/macports.conf doc/prefix.mtree doc/pubkeys.conf portmgr/freebsd/Makefile setupenv.bash src/Makefile src/machista1.0/Makefile src/macports1.0/macports_autoconf.tcl src/macports1.0/macports_test_autoconf.tcl src/macports1.0/macports_fastload.tcl src/package1.0/package_test_autoconf.tcl src/pextlib1.0/Makefile src/port1.0/port_autoconf.tcl src/port1.0/port_test_autoconf.tcl src/programs/Makefile src/registry2.0/registry_autoconf.tcl&quot;
</ins><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> ac_config_files=&quot;$ac_config_files src/pkg_mkindex.sh&quot;
</span><span class="lines">@@ -10851,9 +10756,12 @@
</span><span class="cx">     &quot;src/Makefile&quot;) CONFIG_FILES=&quot;$CONFIG_FILES src/Makefile&quot; ;;
</span><span class="cx">     &quot;src/machista1.0/Makefile&quot;) CONFIG_FILES=&quot;$CONFIG_FILES src/machista1.0/Makefile&quot; ;;
</span><span class="cx">     &quot;src/macports1.0/macports_autoconf.tcl&quot;) CONFIG_FILES=&quot;$CONFIG_FILES src/macports1.0/macports_autoconf.tcl&quot; ;;
</span><ins>+    &quot;src/macports1.0/macports_test_autoconf.tcl&quot;) CONFIG_FILES=&quot;$CONFIG_FILES src/macports1.0/macports_test_autoconf.tcl&quot; ;;
</ins><span class="cx">     &quot;src/macports1.0/macports_fastload.tcl&quot;) CONFIG_FILES=&quot;$CONFIG_FILES src/macports1.0/macports_fastload.tcl&quot; ;;
</span><ins>+    &quot;src/package1.0/package_test_autoconf.tcl&quot;) CONFIG_FILES=&quot;$CONFIG_FILES src/package1.0/package_test_autoconf.tcl&quot; ;;
</ins><span class="cx">     &quot;src/pextlib1.0/Makefile&quot;) CONFIG_FILES=&quot;$CONFIG_FILES src/pextlib1.0/Makefile&quot; ;;
</span><span class="cx">     &quot;src/port1.0/port_autoconf.tcl&quot;) CONFIG_FILES=&quot;$CONFIG_FILES src/port1.0/port_autoconf.tcl&quot; ;;
</span><ins>+    &quot;src/port1.0/port_test_autoconf.tcl&quot;) CONFIG_FILES=&quot;$CONFIG_FILES src/port1.0/port_test_autoconf.tcl&quot; ;;
</ins><span class="cx">     &quot;src/programs/Makefile&quot;) CONFIG_FILES=&quot;$CONFIG_FILES src/programs/Makefile&quot; ;;
</span><span class="cx">     &quot;src/registry2.0/registry_autoconf.tcl&quot;) CONFIG_FILES=&quot;$CONFIG_FILES src/registry2.0/registry_autoconf.tcl&quot; ;;
</span><span class="cx">     &quot;src/pkg_mkindex.sh&quot;) CONFIG_FILES=&quot;$CONFIG_FILES src/pkg_mkindex.sh&quot; ;;
</span></span></pre></div>
<a id="branchesnewhelpsystembaseconfigureac"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/configure.ac (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/configure.ac        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/configure.ac        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -28,15 +28,15 @@
</span><span class="cx"> fi
</span><span class="cx"> 
</span><span class="cx"> case &quot;$MACOSX_VERSION&quot; in
</span><del>-  10.0*|10.1*|10.2*|10.3*)
</del><ins>+  10.0*|10.1|10.1.*|10.2*|10.3*)
</ins><span class="cx">     AC_MSG_ERROR([This version of Mac OS X is not supported
</span><span class="cx">                   Please upgrade at http://store.apple.com/])
</span><span class="cx">     ;;
</span><del>-  10.4.[[0-9]]|10.4.10|10.5.[[0-7]]|10.6.[[0-7]]|10.7.[[0-4]]|10.8.[[0-3]])
</del><ins>+  10.4.[[0-9]]|10.4.10|10.5.[[0-7]]|10.6.[[0-7]]|10.7.[[0-4]]|10.8.[[0-4]])
</ins><span class="cx">     AC_MSG_WARN([This version of Mac OS X is out of date])
</span><span class="cx">     AC_MSG_WARN([Please run Software Update to update it])
</span><span class="cx">     ;;
</span><del>-  10.4*|10.5*|10.6*|10.7*|10.8*)
</del><ins>+  10.4*|10.5*|10.6*|10.7*|10.8*|10.9*)
</ins><span class="cx">     dnl Supported version
</span><span class="cx">     ;;
</span><span class="cx">   *)
</span><span class="lines">@@ -86,7 +86,7 @@
</span><span class="cx">     AC_MSG_WARN([This version of Xcode Tools is out of date])
</span><span class="cx">     AC_MSG_WARN([Please consider upgrading as some ports fail compiling])
</span><span class="cx">     ;;
</span><del>-  2.*|3.*|4.*)
</del><ins>+  2.*|3.*|4.*|5.*)
</ins><span class="cx">     dnl Supported version
</span><span class="cx">     ;;
</span><span class="cx">   *)
</span><span class="lines">@@ -94,11 +94,11 @@
</span><span class="cx"> esac
</span><span class="cx"> 
</span><span class="cx"> # Checks for programs.
</span><del>-AC_PROG_CC
</del><ins>+AC_PROG_CC([clang cc gcc])
</ins><span class="cx"> AC_PROG_INSTALL
</span><span class="cx"> AC_PROG_LN_S
</span><span class="cx"> AC_PROG_MAKE_SET
</span><del>-AC_PROG_OBJC
</del><ins>+AC_PROG_OBJC([clang cc gcc])
</ins><span class="cx"> 
</span><span class="cx"> AC_PATH_PROGS(BSDMAKE, [bsdmake pmake], [])
</span><span class="cx"> AC_PATH_PROG(BZIP2, [bzip2], [])
</span><span class="lines">@@ -239,14 +239,17 @@
</span><span class="cx"> AC_HEADER_STDC
</span><span class="cx"> AC_HEADER_DIRENT
</span><span class="cx"> AC_HEADER_SYS_WAIT
</span><del>-AC_CHECK_HEADERS([limits.h paths.h sys/file.h crt_externs.h fcntl.h sys/fcntl.h sys/cdefs.h err.h sys/socket.h \
-        sys/event.h sys/sysctl.h readline/readline.h readline/history.h pwd.h sys/paths.h utime.h])
</del><ins>+AC_CHECK_HEADERS([crt_externs.h err.h fcntl.h libkern/OSAtomic.h limits.h paths.h pwd.h \
+        readline/history.h readline/readline.h spawn.h sys/cdefs.h sys/event.h sys/fcntl.h sys/file.h \
+        sys/paths.h sys/socket.h sys/sysctl.h utime.h])
</ins><span class="cx"> 
</span><span class="cx"> INCLUDES=&quot;-I.. -I. $INCLUDES&quot;
</span><span class="cx"> 
</span><span class="cx"> # Checks for library functions.
</span><del>-AC_CHECK_FUNCS([bzero memset fgetln lockf flock setmode strcasecmp strncasecmp strlcpy strlcat copyfile clearenv sysctlbyname kqueue])
-AC_SUBST(ac_cv_func_strlcat)
</del><ins>+AC_CHECK_FUNCS([OSAtomicCompareAndSwap32 OSAtomicCompareAndSwap64 OSAtomicCompareAndSwapPtr bzero \
+        clearenv copyfile fgetln flock fls kqueue lockf memset posix_spawn setmode strcasecmp strlcat \
+        strlcpy strncasecmp sysctlbyname])
+AC_SUBST([ac_cv_func_strlcat])
</ins><span class="cx"> 
</span><span class="cx"> MP_CHECK_READLINK_IS_P1003_1A
</span><span class="cx"> 
</span><span class="lines">@@ -286,6 +289,9 @@
</span><span class="cx"> # Check for tclsh binary
</span><span class="cx"> MP_PROG_TCLSH
</span><span class="cx"> 
</span><ins>+# Substitute Tcl platform for base compatibility check
+MP_TCL_PLATFORM
+
</ins><span class="cx"> # Check for Tcl package path
</span><span class="cx"> MP_TCL_PACKAGE_DIR
</span><span class="cx"> 
</span><span class="lines">@@ -303,6 +309,9 @@
</span><span class="cx">         AC_DEFINE([sqlite3_prepare_v2], [sqlite3_prepare], [define sqlite3_prepare to sqlite_prepare_v2 if the latter is not available])
</span><span class="cx"> fi
</span><span class="cx"> 
</span><ins>+# check whether trace mode is supported on this platform
+MP_TRACEMODE_SUPPORT
+
</ins><span class="cx"> # Determine if we need to install some bundled packages
</span><span class="cx"> OUR_INCLUDED_PACKAGES=
</span><span class="cx"> 
</span><span class="lines">@@ -398,9 +407,12 @@
</span><span class="cx">         src/Makefile
</span><span class="cx">         src/machista1.0/Makefile
</span><span class="cx">         src/macports1.0/macports_autoconf.tcl
</span><ins>+        src/macports1.0/macports_test_autoconf.tcl
</ins><span class="cx">         src/macports1.0/macports_fastload.tcl
</span><ins>+        src/package1.0/package_test_autoconf.tcl
</ins><span class="cx">         src/pextlib1.0/Makefile
</span><span class="cx">         src/port1.0/port_autoconf.tcl
</span><ins>+        src/port1.0/port_test_autoconf.tcl
</ins><span class="cx">         src/programs/Makefile
</span><span class="cx">         src/registry2.0/registry_autoconf.tcl
</span><span class="cx"> ])
</span></span></pre></div>
<a id="branchesnewhelpsystembasedocportfile7"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/doc/portfile.7 (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/doc/portfile.7        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/doc/portfile.7        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -1,6 +1,6 @@
</span><span class="cx"> .\&quot; portfile.7
</span><span class="cx"> .\&quot;
</span><del>-.\&quot; Copyright (c) 2004-2013 The MacPorts Project
</del><ins>+.\&quot; Copyright (c) 2004-2014 The MacPorts Project
</ins><span class="cx"> .\&quot; Copyright (c) 2002-2003 Apple Inc.
</span><span class="cx"> .\&quot; All rights reserved.
</span><span class="cx"> .\&quot;
</span><span class="lines">@@ -319,7 +319,7 @@
</span><span class="cx"> .Em (current OS version)
</span><span class="cx"> .br
</span><span class="cx"> .Sy Example:
</span><del>-.Dl macosx_deployment_target 10.4
</del><ins>+.Dl macosx_deployment_target 10.8
</ins><span class="cx"> .It Ic use_parallel_build
</span><span class="cx"> If set to yes (and the user has enabled buildmakejobs in
</span><span class="cx"> .Pa macports.conf
</span><span class="lines">@@ -821,7 +821,7 @@
</span><span class="cx"> .Em optional
</span><span class="cx"> .br
</span><span class="cx"> .Sy Default:
</span><del>-.Em [suffix ${distname}]
</del><ins>+.Em ${distname}${extract.suffix}
</ins><span class="cx"> .br
</span><span class="cx"> .Sy Example:
</span><span class="cx"> .Dl distfiles magicsource.tar.gz cluebat.tar.bz2
</span><span class="lines">@@ -1132,7 +1132,7 @@
</span><span class="cx"> .Em optional
</span><span class="cx"> .br
</span><span class="cx"> .Sy Default:
</span><del>-.Em -I${prefix}/include
</del><ins>+.Em -isystem${prefix}/include
</ins><span class="cx"> .It Ic configure.cxxflags
</span><span class="cx"> Flags to put in the CXXFLAGS environment variable when invoking the configure script.
</span><span class="cx"> .br
</span><span class="lines">@@ -1156,7 +1156,7 @@
</span><span class="cx"> .Em optional
</span><span class="cx"> .br
</span><span class="cx"> .Sy Default:
</span><del>-.Em -L${prefix}/lib
</del><ins>+.Em -L${prefix}/lib -Wl,-headerpad_max_install_names
</ins><span class="cx"> .It Ic configure.fflags
</span><span class="cx"> Flags to put in the FFLAGS environment variable when invoking the configure script.
</span><span class="cx"> .br 
</span><span class="lines">@@ -1261,6 +1261,17 @@
</span><span class="cx"> .br
</span><span class="cx"> .Sy Example:
</span><span class="cx"> .Dl configure.compiler llvm-gcc-4.2
</span><ins>+.It Ic configure.sdk_version
+Mac OS X SDK version to build against.
+.br 
+.Sy Type:
+.Em optional
+.br 
+.Sy Default:
+.Em (current OS version)
+.br
+.Sy Example:
+.Dl configure.sdk_version 10.8
</ins><span class="cx"> .\&quot; FOOBAR
</span><span class="cx"> .El
</span><span class="cx"> .Ss UNIVERSAL TARGET HOOKS
</span></span></pre></div>
<a id="branchesnewhelpsystembaseportmgrReleaseProcess"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/portmgr/ReleaseProcess (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/portmgr/ReleaseProcess        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/portmgr/ReleaseProcess        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -231,6 +231,7 @@
</span><span class="cx">  * The macports-announce@, macports-users@ and macports-dev@ mailing lists.
</span><span class="cx">  * The MacPorts website, by adapting the $macports_version_major and $macports_version_latest variables as
</span><span class="cx">    appropriate in the trunk/www/includes/common.inc file.
</span><ins>+ * The &amp;macports-version; entity in trunk/doc-new/guide/xml/installing.xml.
</ins><span class="cx">  * [https://trac.macports.org/news/] The MacOSforge news section (submitter: portmgr@)
</span><span class="cx">  * [http://freecode.com/projects/macports/ Freecode] (submitter: mww@)
</span><span class="cx">  * [http://www.versiontracker.com/dyn/moreinfo/macosx/26679 VersionTracker] (submitter: mij@)
</span></span></pre></div>
<a id="branchesnewhelpsystembaseportmgrautosubmittcl"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/portmgr/autosubmit.tcl (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/portmgr/autosubmit.tcl        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/portmgr/autosubmit.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -66,7 +66,7 @@
</span><span class="cx">                         db eval { select * from submitinfo where porturl=$porturl } values {
</span><span class="cx">                                 set none 0
</span><span class="cx">                                 
</span><del>-                                if { $values(last_mod_date) == &quot;&quot; || $values(last_mod_date) != $mod_date } {
</del><ins>+                                if { $values(last_mod_date) eq &quot;&quot; || $values(last_mod_date) != $mod_date } {
</ins><span class="cx">                                 
</span><span class="cx">                                         # The last_mod_date has changed, so just update it to provide
</span><span class="cx">                                         # hysteresis for file changes
</span><span class="lines">@@ -118,7 +118,7 @@
</span><span class="cx">                         }
</span><span class="cx">                         
</span><span class="cx">                         # Do update or insert post processing
</span><del>-                        if { $post != &quot;&quot; } {
</del><ins>+                        if { $post ne &quot;&quot; } {
</ins><span class="cx">                                 db eval $post
</span><span class="cx">                         }
</span><span class="cx">                 }
</span></span></pre></div>
<a id="branchesnewhelpsystembaseportmgrjobsPortIndex2MySQLtcl"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/portmgr/jobs/PortIndex2MySQL.tcl (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/portmgr/jobs/PortIndex2MySQL.tcl        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/portmgr/jobs/PortIndex2MySQL.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -75,7 +75,7 @@
</span><span class="cx"> # handle command line arguments
</span><span class="cx"> set create_tables true
</span><span class="cx"> if {[llength $argv]} {
</span><del>-    if {[lindex $argv 0] == &quot;--create-tables&quot;} {
</del><ins>+    if {[lindex $argv 0] eq &quot;--create-tables&quot;} {
</ins><span class="cx">         set create_tables true
</span><span class="cx">     }
</span><span class="cx"> }
</span></span></pre></div>
<a id="branchesnewhelpsystembaseportmgrjobsmprsyncup"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/portmgr/jobs/mprsyncup (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/portmgr/jobs/mprsyncup        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/portmgr/jobs/mprsyncup        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -55,7 +55,7 @@
</span><span class="cx"> PATH=${PREFIX}/bin:/bin:/usr/bin:/usr/sbin:/opt/local/bin
</span><span class="cx"> 
</span><span class="cx"> # platforms we generate indexes for
</span><del>-PLATFORMS=&quot;8_powerpc 8_i386 9_powerpc 9_i386 10_i386 11_i386 12_i386&quot;
</del><ins>+PLATFORMS=&quot;8_powerpc 8_i386 9_powerpc 9_i386 10_i386 11_i386 12_i386 13_i386&quot;
</ins><span class="cx"> 
</span><span class="cx"> # Sources information:
</span><span class="cx"> SVNURL=https://svn.macports.org/repository/macports
</span></span></pre></div>
<a id="branchesnewhelpsystembaseportmgrjobsport_binary_distributabletcl"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/portmgr/jobs/port_binary_distributable.tcl (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/portmgr/jobs/port_binary_distributable.tcl        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/portmgr/jobs/port_binary_distributable.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -122,7 +122,7 @@
</span><span class="cx">     mportclose $mport
</span><span class="cx"> 
</span><span class="cx">     foreach dependencyType $check_deptypes {
</span><del>-        if {[info exists portInfo($dependencyType)] &amp;&amp; [string length $portInfo($dependencyType)] &gt; 0} {
</del><ins>+        if {[info exists portInfo($dependencyType)] &amp;&amp; $portInfo($dependencyType) ne &quot;&quot;} {
</ins><span class="cx">             foreach dependency $portInfo($dependencyType) {
</span><span class="cx">                 set afterColon [expr {[string last &quot;:&quot; $dependency] + 1}]
</span><span class="cx">                 lappend dependencyList [string range $dependency $afterColon end]
</span><span class="lines">@@ -146,8 +146,8 @@
</span><span class="cx"> # return license with any trailing dash followed by a number and/or plus sign removed
</span><span class="cx"> proc remove_version {license} {
</span><span class="cx">     set dash [string last - $license]
</span><del>-    if {$dash != -1 &amp;&amp; [regexp {[0-9.+]+} [string range $license [expr $dash + 1] end]]} {
-        return [string range $license 0 [expr $dash - 1]]
</del><ins>+    if {$dash != -1 &amp;&amp; [regexp {[0-9.+]+} [string range $license [expr {$dash + 1}] end]]} {
+        return [string range $license 0 [expr {$dash - 1}]]
</ins><span class="cx">     } else {
</span><span class="cx">         return $license
</span><span class="cx">     }
</span></span></pre></div>
<a id="branchesnewhelpsystembaseportmgrpackagingdpkgalltcl"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/portmgr/packaging/dpkgall.tcl (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/portmgr/packaging/dpkgall.tcl        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/portmgr/packaging/dpkgall.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -12,14 +12,14 @@
</span><span class="cx"> # modification, are permitted provided that the following conditions
</span><span class="cx"> # are met:
</span><span class="cx"> # 1. Redistributions of source code must retain the above copyright
</span><del>-#    notice, this list of conditions and the following disclaimer.
</del><ins>+#         notice, this list of conditions and the following disclaimer.
</ins><span class="cx"> # 2. Redistributions in binary form must reproduce the above copyright
</span><del>-#    notice, this list of conditions and the following disclaimer in the
-#    documentation and/or other materials provided with the distribution.
</del><ins>+#         notice, this list of conditions and the following disclaimer in the
+#         documentation and/or other materials provided with the distribution.
</ins><span class="cx"> # 3. Neither the name of Apple Inc. nor the names of its contributors
</span><del>-#    may be used to endorse or promote products derived from this software
-#    without specific prior written permission.
-# 
</del><ins>+#         may be used to endorse or promote products derived from this software
+#         without specific prior written permission.
+#
</ins><span class="cx"> # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &quot;AS IS&quot;
</span><span class="cx"> # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
</span><span class="cx"> # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
</span><span class="lines">@@ -88,27 +88,27 @@
</span><span class="cx"> 
</span><span class="cx"> # MacPorts UI Event Callbacks
</span><span class="cx"> proc ui_prefix {priority} {
</span><del>-    switch $priority {
-        debug {
-                return &quot;Debug: &quot;
-        }
-        error {
-                return &quot;Error: &quot;
-        }
-        warn {
-                return &quot;Warning: &quot;
-        }
-        default {
-                return &quot;&quot;
-        }
-    }
</del><ins>+        switch $priority {
+                debug {
+                        return &quot;Debug: &quot;
+                }
+                error {
+                        return &quot;Error: &quot;
+                }
+                warn {
+                        return &quot;Warning: &quot;
+                }
+                default {
+                        return &quot;&quot;
+                }
+        }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> proc ui_channels {priority} {
</span><span class="cx">         global dpkg::logfd
</span><del>-        if {[info exists logfd] &amp;&amp; [string length $logfd] &gt; 0 } {
</del><ins>+        if {[info exists logfd] &amp;&amp; $logfd ne &quot;&quot;} {
</ins><span class="cx">                 return {$logfd}
</span><del>-        } elseif {$message(priority) != &quot;debug&quot;} {
</del><ins>+        } elseif {$message(priority) ne &quot;debug&quot;} {
</ins><span class="cx">                 # If there's no log file, echo to stdout
</span><span class="cx">                 return {stdout}
</span><span class="cx">         }
</span><span class="lines">@@ -302,7 +302,7 @@
</span><span class="cx">                 exit 0
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        # We must have dpkg by now 
</del><ins>+        # We must have dpkg by now
</ins><span class="cx">         if {[catch {set_architecture} result]} {
</span><span class="cx">                 puts &quot;$result.&quot;
</span><span class="cx">                 puts &quot;Have you initialized the build system? Use the -i flag:&quot;
</span><span class="lines">@@ -432,16 +432,16 @@
</span><span class="cx">                 array set portinfo [lindex $res 1]
</span><span class="cx"> 
</span><span class="cx">                 if {![info exists portinfo(name)] ||
</span><del>-                        ![info exists portinfo(version)] || 
-                        ![info exists portinfo(revision)] || 
</del><ins>+                        ![info exists portinfo(version)] ||
+                        ![info exists portinfo(revision)] ||
</ins><span class="cx">                         ![info exists portinfo(categories)]} {
</span><span class="cx">                         ui_noisy_error &quot;Internal error: $name missing some portinfo keys&quot;
</span><span class="cx">                         close $logfd
</span><span class="cx">                         continue
</span><span class="cx">                 }
</span><span class="cx"> 
</span><del>-        # open correct subport
-        set options(subport) $portinfo(name)
</del><ins>+                # open correct subport
+                set options(subport) $portinfo(name)
</ins><span class="cx"> 
</span><span class="cx">                 # Skip un-supported ports
</span><span class="cx">                 if {[info exists portinfo(platforms)] &amp;&amp; ${anyplatform_flag} != &quot;true&quot;} {
</span><span class="lines">@@ -555,7 +555,7 @@
</span><span class="cx">                 }
</span><span class="cx"> 
</span><span class="cx">                 ui_silent &quot;Package build for $portinfo(name) succeeded&quot;
</span><del>-                
</del><ins>+
</ins><span class="cx">                 # Into the apt repository you go!
</span><span class="cx">                 copy_pkg_to_apt $portinfo(name) $portinfo(version) $portinfo(revision) [lindex $portinfo(categories) 0]
</span><span class="cx"> 
</span><span class="lines">@@ -597,7 +597,7 @@
</span><span class="cx">                         }
</span><span class="cx">                 }
</span><span class="cx"> 
</span><del>-                if {[info exists newpkglist]} {                
</del><ins>+                if {[info exists newpkglist]} {
</ins><span class="cx">                         set pkglist [lsort -unique [concat $newpkglist $pkglist]]
</span><span class="cx">                 }
</span><span class="cx"> 
</span><span class="lines">@@ -640,7 +640,7 @@
</span><span class="cx">         set reqlist &quot;&quot;
</span><span class="cx"> 
</span><span class="cx">         foreach {binary port} $requiredports {
</span><del>-                if {[find_binary $binary] == &quot;&quot;} {
</del><ins>+                if {[find_binary $binary] eq &quot;&quot;} {
</ins><span class="cx">                         lappend reqlist $port
</span><span class="cx">                 }
</span><span class="cx">         }
</span><span class="lines">@@ -685,7 +685,7 @@
</span><span class="cx">         set buildlist [lsort -unique $builddeps]
</span><span class="cx"> 
</span><span class="cx">         foreach port $builddeps {
</span><del>-                if {[lsearch -exact $port $rundeps] &gt;= 0 } {
</del><ins>+                if {[lsearch -exact $port $rundeps] &gt;= 0} {
</ins><span class="cx">                         lappend removelist $port
</span><span class="cx">                 }
</span><span class="cx">         }
</span><span class="lines">@@ -694,7 +694,7 @@
</span><span class="cx">         set variations &quot;&quot;
</span><span class="cx"> 
</span><span class="cx">         foreach port [get_required_ports] {
</span><del>-            set options(subport) $port
</del><ins>+                set options(subport) $port
</ins><span class="cx">                 if {[catch {do_portexec $port [array get options] [array get variants] activate} result]} {
</span><span class="cx">                         global errorInfo
</span><span class="cx">                         ui_debug &quot;$errorInfo&quot;
</span><span class="lines">@@ -718,8 +718,8 @@
</span><span class="cx">                 }
</span><span class="cx">                 ui_msg &quot;Done.&quot;
</span><span class="cx">         }
</span><del>-                        
</del><span class="cx"> 
</span><ins>+
</ins><span class="cx">         if {[catch {set_architecture} result]} {
</span><span class="cx">                 puts &quot;Fatal error: $result.&quot;
</span><span class="cx">                 exit 1
</span><span class="lines">@@ -858,14 +858,14 @@
</span><span class="cx"> 
</span><span class="cx"> proc get_dependencies_recurse {portname includeBuildDeps} {
</span><span class="cx">         set result {}
</span><del>-        
</del><ins>+
</ins><span class="cx">         set res [get_portinfo $portname]
</span><span class="cx"> 
</span><span class="cx">         foreach {name array} $res {
</span><span class="cx">                 array set portinfo $array
</span><span class="cx">                 if {![info exists portinfo(name)] ||
</span><del>-                        ![info exists portinfo(version)] || 
-                        ![info exists portinfo(revision)] || 
</del><ins>+                        ![info exists portinfo(version)] ||
+                        ![info exists portinfo(revision)] ||
</ins><span class="cx">                         ![info exists portinfo(categories)]} {
</span><span class="cx">                         ui_error &quot;Internal error: $name missing some portinfo keys&quot;
</span><span class="cx">                         continue
</span><span class="lines">@@ -877,13 +877,13 @@
</span><span class="cx">                 set depends {}
</span><span class="cx">                 if {[info exists portinfo(depends_run)]} { eval &quot;lappend depends $portinfo(depends_run)&quot; }
</span><span class="cx">                 if {[info exists portinfo(depends_lib)]} { eval &quot;lappend depends $portinfo(depends_lib)&quot; }
</span><del>-                if {$includeBuildDeps == &quot;true&quot; &amp;&amp; [info exists portinfo(depends_build)]} { 
</del><ins>+                if {$includeBuildDeps == &quot;true&quot; &amp;&amp; [info exists portinfo(depends_build)]} {
</ins><span class="cx">                         eval &quot;lappend depends $portinfo(depends_build)&quot;
</span><span class="cx">                 }
</span><del>-                if {$includeBuildDeps == &quot;true&quot; &amp;&amp; [info exists portinfo(depends_fetch)]} { 
</del><ins>+                if {$includeBuildDeps == &quot;true&quot; &amp;&amp; [info exists portinfo(depends_fetch)]} {
</ins><span class="cx">                         eval &quot;lappend depends $portinfo(depends_fetch)&quot;
</span><span class="cx">                 }
</span><del>-                if {$includeBuildDeps == &quot;true&quot; &amp;&amp; [info exists portinfo(depends_extract)]} { 
</del><ins>+                if {$includeBuildDeps == &quot;true&quot; &amp;&amp; [info exists portinfo(depends_extract)]} {
</ins><span class="cx">                         eval &quot;lappend depends $portinfo(depends_extract)&quot;
</span><span class="cx">                 }
</span><span class="cx">                 foreach depspec $depends {
</span><span class="lines">@@ -913,7 +913,7 @@
</span><span class="cx">         } else {
</span><span class="cx">                 set verstring ${portversion}
</span><span class="cx">         }
</span><del>-        
</del><ins>+
</ins><span class="cx">         set receiptdir [file join $portprefix var db receipts ${portname} ${verstring}]
</span><span class="cx">         set pkgpath [get_pkgpath ${portname} ${portversion} ${portrevision}]
</span><span class="cx"> 
</span></span></pre></div>
<a id="branchesnewhelpsystembaseportmgrpackagingmpkgalltcl"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/portmgr/packaging/mpkgall.tcl (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/portmgr/packaging/mpkgall.tcl        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/portmgr/packaging/mpkgall.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -10,14 +10,14 @@
</span><span class="cx"> # modification, are permitted provided that the following conditions
</span><span class="cx"> # are met:
</span><span class="cx"> # 1. Redistributions of source code must retain the above copyright
</span><del>-#    notice, this list of conditions and the following disclaimer.
</del><ins>+#         notice, this list of conditions and the following disclaimer.
</ins><span class="cx"> # 2. Redistributions in binary form must reproduce the above copyright
</span><del>-#    notice, this list of conditions and the following disclaimer in the
-#    documentation and/or other materials provided with the distribution.
</del><ins>+#         notice, this list of conditions and the following disclaimer in the
+#         documentation and/or other materials provided with the distribution.
</ins><span class="cx"> # 3. Neither the name of Apple Inc. nor the names of its contributors
</span><del>-#    may be used to endorse or promote products derived from this software
-#    without specific prior written permission.
-# 
</del><ins>+#         may be used to endorse or promote products derived from this software
+#         without specific prior written permission.
+#
</ins><span class="cx"> # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &quot;AS IS&quot;
</span><span class="cx"> # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
</span><span class="cx"> # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
</span><span class="lines">@@ -53,7 +53,7 @@
</span><span class="cx">         # XXX: don't overwrite Apple X11
</span><span class="cx">         # XXX: probably should exclude KDE here too
</span><span class="cx">         if {$portname == &quot;XFree86&quot;} { return {} }
</span><del>-        
</del><ins>+
</ins><span class="cx">         if {[catch {set res [mportsearch &quot;^$portname\$&quot;]} error]} {
</span><span class="cx">                 puts stderr &quot;Internal error: port search failed: $error&quot;
</span><span class="cx">                 return
</span><span class="lines">@@ -63,11 +63,11 @@
</span><span class="cx">                 if {![info exists portinfo(name)]} { return -1 }
</span><span class="cx">                 if {![info exists portinfo(version)]} { return -1 }
</span><span class="cx">                 if {![info exists portinfo(categories)]} { return -1 }
</span><del>-                
</del><ins>+
</ins><span class="cx">                 set portname $portinfo(name)
</span><span class="cx">                 set portversion $portinfo(version)
</span><span class="cx">                 set category [lindex $portinfo(categories) 0]
</span><del>-                
</del><ins>+
</ins><span class="cx">                 set depends {}
</span><span class="cx">                 if {[info exists portinfo(depends_run)]} { eval &quot;lappend depends $portinfo(depends_run)&quot; }
</span><span class="cx">                 if {[info exists portinfo(depends_lib)]} { eval &quot;lappend depends $portinfo(depends_lib)&quot; }
</span><span class="lines">@@ -75,13 +75,13 @@
</span><span class="cx">                 foreach depspec $depends {
</span><span class="cx">                         set dep [lindex [split $depspec :] end]
</span><span class="cx">                         set result [copy_package_if_available $dep $basepath $destpath]
</span><del>-                        if {$result == -1} { 
</del><ins>+                        if {$result == -1} {
</ins><span class="cx">                                 return -1
</span><span class="cx">                         } else {
</span><span class="cx">                                 eval &quot;lappend dependencies $result&quot;
</span><span class="cx">                         }
</span><span class="cx">                 }
</span><del>-                
</del><ins>+
</ins><span class="cx">                 set pkgname &quot;${portname}-${portversion}.pkg&quot;
</span><span class="cx">                 lappend dependencies $pkgname
</span><span class="cx">                 set pkgpath &quot;${basepath}/${category}/${pkgname}&quot;
</span><span class="lines">@@ -95,7 +95,7 @@
</span><span class="cx">                         return -1
</span><span class="cx">                 }
</span><span class="cx">         }
</span><del>-        
</del><ins>+
</ins><span class="cx">         return $dependencies
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -120,10 +120,10 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> proc write_welcome_html {filename portname portversion long_description description homepage} {
</span><del>-    set fd [open ${filename} w+]
-    if {$long_description == &quot;&quot;} {
-        set long_description $description
-    }
</del><ins>+        set fd [open ${filename} w+]
+        if {$long_description eq &quot;&quot;} {
+                set long_description $description
+        }
</ins><span class="cx"> 
</span><span class="cx"> puts $fd &quot;
</span><span class="cx"> &lt;html lang=\&quot;en\&quot;&gt;
</span><span class="lines">@@ -137,15 +137,15 @@
</span><span class="cx"> &lt;font face=\&quot;Helvetica\&quot;&gt;${long_description}&lt;/font&gt;
</span><span class="cx"> &lt;p&gt;&quot;
</span><span class="cx"> 
</span><del>-    if {$homepage != &quot;&quot;} {
-        puts $fd &quot;&lt;font face=\&quot;Helvetica\&quot;&gt;${homepage}&lt;/font&gt;&lt;p&gt;&quot;
-    }
</del><ins>+        if {$homepage ne &quot;&quot;} {
+                puts $fd &quot;&lt;font face=\&quot;Helvetica\&quot;&gt;${homepage}&lt;/font&gt;&lt;p&gt;&quot;
+        }
</ins><span class="cx"> 
</span><del>-    puts $fd &quot;&lt;font face=\&quot;Helvetica\&quot;&gt;This installer guides you through the steps necessary to install ${portname} ${portversion} for Mac OS X. To get started, click Continue.&lt;/font&gt;
</del><ins>+        puts $fd &quot;&lt;font face=\&quot;Helvetica\&quot;&gt;This installer guides you through the steps necessary to install ${portname} ${portversion} for Mac OS X. To get started, click Continue.&lt;/font&gt;
</ins><span class="cx"> &lt;/body&gt;
</span><span class="cx"> &lt;/html&gt;&quot;
</span><span class="cx"> 
</span><del>-    close $fd
</del><ins>+        close $fd
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> proc write_PkgInfo {infofile} {
</span><span class="lines">@@ -156,11 +156,11 @@
</span><span class="cx"> 
</span><span class="cx"> proc mpkg_write_info_plist {infofile portname portversion portrevision destination dependencies} {
</span><span class="cx">         set vers [split $portversion &quot;.&quot;]
</span><del>-        
-        if {[string index $destination end] != &quot;/&quot;} {
</del><ins>+
+        if {[string index $destination end] ne &quot;/&quot;} {
</ins><span class="cx">                 append destination /
</span><span class="cx">         }
</span><del>-        
</del><ins>+
</ins><span class="cx">         set depxml &quot;&quot;
</span><span class="cx">         foreach dep $dependencies {
</span><span class="cx">                 append depxml &quot;&lt;dict&gt;
</span><span class="lines">@@ -206,9 +206,9 @@
</span><span class="cx"> # Standard procedures
</span><span class="cx"> 
</span><span class="cx"> proc fatal args {
</span><del>-    global argv0
-    puts stderr &quot;$argv0: $args&quot;
-    exit
</del><ins>+        global argv0
+        puts stderr &quot;$argv0: $args&quot;
+        exit
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> # Main
</span><span class="lines">@@ -217,120 +217,118 @@
</span><span class="cx"> #        set ui_options(ports_verbose) yes
</span><span class="cx"> 
</span><span class="cx"> if {[catch {mportinit ui_options options variations} result]} {
</span><del>-    puts &quot;Failed to initialize ports system, $result&quot;
-    exit 1
</del><ins>+        puts &quot;Failed to initialize ports system, $result&quot;
+        exit 1
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> package require Pextlib
</span><span class="cx"> 
</span><span class="cx"> # If no arguments were given, default to all ports.
</span><span class="cx"> if {[llength $argv] == 0} {
</span><del>-        lappend argv &quot;.*&quot;
</del><ins>+        lappend argv &quot;.*&quot;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> foreach pname $argv {
</span><ins>+        if {[catch {set res [mportsearch &quot;^${pname}\$&quot;]} result]} {
+                puts &quot;port search failed: $result&quot;
+                exit 1
+        }
</ins><span class="cx"> 
</span><del>-if {[catch {set res [mportsearch &quot;^${pname}\$&quot;]} result]} {
-        puts &quot;port search failed: $result&quot;
-        exit 1
-}
</del><ins>+        foreach {name array} $res {
+                global prefix
+                array unset portinfo
+                array set portinfo $array
</ins><span class="cx"> 
</span><del>-foreach {name array} $res {
-        global prefix
-        array unset portinfo
-        array set portinfo $array
</del><ins>+                if {![info exists portinfo(porturl)]} {
+                        puts stderr &quot;Internal error: no porturl for $name&quot;
+                        continue
+                }
</ins><span class="cx"> 
</span><del>-        if {![info exists portinfo(porturl)]} {
-                puts stderr &quot;Internal error: no porturl for $name&quot;
-                continue
-        }
-        
-        set pkgbase &quot;/darwinports/pkgs/&quot;
-        set mpkgbase &quot;/darwinports/mpkgs/&quot;
-        set porturl $portinfo(porturl)
-        set prefix &quot;/opt/local&quot;
</del><ins>+                set pkgbase &quot;/darwinports/pkgs/&quot;
+                set mpkgbase &quot;/darwinports/mpkgs/&quot;
+                set porturl $portinfo(porturl)
+                set prefix &quot;/opt/local&quot;
</ins><span class="cx"> 
</span><del>-        # Skip up-to-date packages
-        if {[regsub {^file://} $portinfo(porturl) &quot;&quot; portpath]} {
-                if {[info exists portinfo(name)] &amp;&amp;
-                        [info exists portinfo(version)] &amp;&amp;
-                        [info exists portinfo(categories)]} {
-                        set portname $portinfo(name)
-                        set portversion $portinfo(version)
-                        set category [lindex $portinfo(categories) 0]
-                        set mpkgfile ${mpkgbase}/${category}/${portname}-${portversion}.mpkg/Contents/Info.plist
-                        if {[file readable $mpkgfile] &amp;&amp; ([file mtime ${mpkgfile}] &gt; [file mtime ${portpath}/Portfile])} {
-                                puts stderr &quot;Skipping ${portname}-${portversion}; meta-package is up to date.&quot;
-                                continue
</del><ins>+                # Skip up-to-date packages
+                if {[regsub {^file://} $portinfo(porturl) &quot;&quot; portpath]} {
+                        if {[info exists portinfo(name)] &amp;&amp;
+                                [info exists portinfo(version)] &amp;&amp;
+                                [info exists portinfo(categories)]} {
+                                set portname $portinfo(name)
+                                set portversion $portinfo(version)
+                                set category [lindex $portinfo(categories) 0]
+                                set mpkgfile ${mpkgbase}/${category}/${portname}-${portversion}.mpkg/Contents/Info.plist
+                                if {[file readable $mpkgfile] &amp;&amp; ([file mtime ${mpkgfile}] &gt; [file mtime ${portpath}/Portfile])} {
+                                        puts stderr &quot;Skipping ${portname}-${portversion}; meta-package is up to date.&quot;
+                                        continue
+                                }
</ins><span class="cx">                         }
</span><span class="cx">                 }
</span><del>-        }
-        
-        # Skipt packages which previously failed
-                
-        # Building the mpkg:
-        # - create an mpkg skeleton
-        # - copy dependent pkgs into Contents/Resources directory
</del><span class="cx"> 
</span><del>-        set portname &quot;&quot;
-        set portversion &quot;&quot;
-        set description &quot;&quot;
-        set long_description &quot;&quot;
-        set homepage &quot;&quot;
-        set category &quot;&quot;
</del><ins>+                # Skipt packages which previously failed
</ins><span class="cx"> 
</span><del>-        if {[info exists portinfo(name)]} {        set portname $portinfo(name) }
-        if {[info exists portinfo(version)]} { set portversion $portinfo(version) }
-        if {[info exists portinfo(description)]} { set description $portinfo(description) }
-        if {[info exists portinfo(long_description)]} { set long_description $portinfo(long_description) }
-        if {[info exists portinfo(homepage)]} { set homepage $portinfo(homepage) }
-        if {[info exists portinfo(categories)]} { set category [lindex $portinfo(categories) 0] }
-        if {[info exists portinfo(maintainers)]} { set maintainers $portinfo(maintainers) }
-        
-        puts &quot;meta-packaging ${category}/${portname}-${portversion}&quot;
</del><ins>+                # Building the mpkg:
+                # - create an mpkg skeleton
+                # - copy dependent pkgs into Contents/Resources directory
</ins><span class="cx"> 
</span><del>-        set mpkgpath &quot;${mpkgbase}/${category}/${portname}-${portversion}.mpkg&quot;
</del><ins>+                set portname &quot;&quot;
+                set portversion &quot;&quot;
+                set description &quot;&quot;
+                set long_description &quot;&quot;
+                set homepage &quot;&quot;
+                set category &quot;&quot;
</ins><span class="cx"> 
</span><del>-        if {[catch {system &quot;mkdir -p -m 0755 ${mpkgpath}/Contents/Resources&quot;} error]} {
-                puts stderr &quot;Internal error: $error&quot;
-        }
-        
-        # list of .pkg names for dependencies,
-        # built up by copy_package_if_available, and used in the Info.plist
-        set dependencies {}
-        set result [copy_package_if_available ${portname} $pkgbase &quot;${mpkgpath}/Contents/Resources/&quot;]
-        if {$result == -1} {
-                puts stderr &quot;aborting; one or more dependencies was missing.&quot;
-                if {[catch {system &quot;rm -R ${mpkgpath}&quot;} error]} {
</del><ins>+                if {[info exists portinfo(name)]} {        set portname $portinfo(name) }
+                if {[info exists portinfo(version)]} { set portversion $portinfo(version) }
+                if {[info exists portinfo(description)]} { set description $portinfo(description) }
+                if {[info exists portinfo(long_description)]} { set long_description $portinfo(long_description) }
+                if {[info exists portinfo(homepage)]} { set homepage $portinfo(homepage) }
+                if {[info exists portinfo(categories)]} { set category [lindex $portinfo(categories) 0] }
+                if {[info exists portinfo(maintainers)]} { set maintainers $portinfo(maintainers) }
+
+                puts &quot;meta-packaging ${category}/${portname}-${portversion}&quot;
+
+                set mpkgpath &quot;${mpkgbase}/${category}/${portname}-${portversion}.mpkg&quot;
+
+                if {[catch {system &quot;mkdir -p -m 0755 ${mpkgpath}/Contents/Resources&quot;} error]} {
</ins><span class="cx">                         puts stderr &quot;Internal error: $error&quot;
</span><span class="cx">                 }
</span><del>-                continue
-        } else {
-                set result [lsort -uniq $result]
-                eval &quot;lappend dependencies $result&quot;
-        }
-        
-        #
-        # Begin quote from portmpkg.tcl
-        #
-    write_PkgInfo ${mpkgpath}/Contents/PkgInfo
-    mpkg_write_info_plist ${mpkgpath}/Contents/Info.plist $portname $portversion $prefix $dependencies
-    write_description_plist ${mpkgpath}/Contents/Resources/Description.plist $portname $portversion $description
-    # long_description, description, or homepage may not exist
-    foreach variable {long_description description homepage} {
-        if {![info exists $variable]} {
-            set pkg_$variable &quot;&quot;
-        } else {
-            set pkg_$variable [set $variable]
-        }
-    }
-    write_welcome_html ${mpkgpath}/Contents/Resources/Welcome.html $portname $portversion $pkg_long_description $pkg_description $pkg_homepage
-    file copy -force -- /opt/local/share/darwinports/resources/port1.0/package/background.tiff \
</del><ins>+
+                # list of .pkg names for dependencies,
+                # built up by copy_package_if_available, and used in the Info.plist
+                set dependencies {}
+                set result [copy_package_if_available ${portname} $pkgbase &quot;${mpkgpath}/Contents/Resources/&quot;]
+                if {$result == -1} {
+                        puts stderr &quot;aborting; one or more dependencies was missing.&quot;
+                        if {[catch {system &quot;rm -R ${mpkgpath}&quot;} error]} {
+                                puts stderr &quot;Internal error: $error&quot;
+                        }
+                        continue
+                } else {
+                        set result [lsort -uniq $result]
+                        eval &quot;lappend dependencies $result&quot;
+                }
+
+                #
+                # Begin quote from portmpkg.tcl
+                #
+                write_PkgInfo ${mpkgpath}/Contents/PkgInfo
+                mpkg_write_info_plist ${mpkgpath}/Contents/Info.plist $portname $portversion $prefix $dependencies
+                write_description_plist ${mpkgpath}/Contents/Resources/Description.plist $portname $portversion $description
+                # long_description, description, or homepage may not exist
+                foreach variable {long_description description homepage} {
+                        if {![info exists $variable]} {
+                                set pkg_$variable &quot;&quot;
+                        } else {
+                                set pkg_$variable [set $variable]
+                        }
+                }
+                write_welcome_html ${mpkgpath}/Contents/Resources/Welcome.html $portname $portversion $pkg_long_description $pkg_description $pkg_homepage
+                file copy -force -- /opt/local/share/darwinports/resources/port1.0/package/background.tiff \
</ins><span class="cx">                         ${mpkgpath}/Contents/Resources/background.tiff
</span><del>-        #
-        # End quote from portmpkg.tcl
-        #
</del><ins>+                #
+                # End quote from portmpkg.tcl
+                #
+        }
</ins><span class="cx"> }
</span><del>-
-}
</del><span class="cx"> # end foreach pname
</span></span></pre></div>
<a id="branchesnewhelpsystembaseportmgrpackagingpackagealltcl"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/portmgr/packaging/packageall.tcl (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/portmgr/packaging/packageall.tcl        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/portmgr/packaging/packageall.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -11,14 +11,14 @@
</span><span class="cx"> # modification, are permitted provided that the following conditions
</span><span class="cx"> # are met:
</span><span class="cx"> # 1. Redistributions of source code must retain the above copyright
</span><del>-#    notice, this list of conditions and the following disclaimer.
</del><ins>+#         notice, this list of conditions and the following disclaimer.
</ins><span class="cx"> # 2. Redistributions in binary form must reproduce the above copyright
</span><del>-#    notice, this list of conditions and the following disclaimer in the
-#    documentation and/or other materials provided with the distribution.
</del><ins>+#         notice, this list of conditions and the following disclaimer in the
+#         documentation and/or other materials provided with the distribution.
</ins><span class="cx"> # 3. Neither the name of Apple Inc. nor the names of its contributors
</span><del>-#    may be used to endorse or promote products derived from this software
-#    without specific prior written permission.
-# 
</del><ins>+#         may be used to endorse or promote products derived from this software
+#         without specific prior written permission.
+#
</ins><span class="cx"> # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &quot;AS IS&quot;
</span><span class="cx"> # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
</span><span class="cx"> # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
</span><span class="lines">@@ -44,82 +44,82 @@
</span><span class="cx"> 
</span><span class="cx"> # ui_options accessor
</span><span class="cx"> proc ui_isset {val} {
</span><del>-    global ui_options
-    if {[info exists ui_options($val)]} {
-        if {$ui_options($val) == &quot;yes&quot;} {
-            return 1
</del><ins>+        global ui_options
+        if {[info exists ui_options($val)]} {
+                if {$ui_options($val) eq &quot;yes&quot;} {
+                        return 1
+                }
</ins><span class="cx">         }
</span><del>-    }
-    return 0
</del><ins>+        return 0
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-# UI Callback 
</del><ins>+# UI Callback
</ins><span class="cx"> 
</span><span class="cx"> proc ui_prefix {priority} {
</span><del>-    switch $priority {
-        debug {
-                return &quot;DEBUG: &quot;
-        }
-        error {
-                return &quot;Error: &quot;
-        }
-        warn {
-                return &quot;Warning: &quot;
-        }
-        default {
-                return &quot;&quot;
-        }
-    }
</del><ins>+        switch $priority {
+                debug {
+                        return &quot;DEBUG: &quot;
+                }
+                error {
+                        return &quot;Error: &quot;
+                }
+                warn {
+                        return &quot;Warning: &quot;
+                }
+                default {
+                        return &quot;&quot;
+                }
+        }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> proc ui_channels {priority} {
</span><del>-    global logfd
-    switch $priority {
-        debug {
-            if {[ui_isset ports_debug]} {
-                    return {stdout}
-            } else {
-                    return {}
-            }
-        }
-        info {
</del><ins>+        global logfd
+        switch $priority {
+                debug {
+                        if {[ui_isset ports_debug]} {
+                                return {stdout}
+                        } else {
+                                return {}
+                        }
+                }
+                info {
</ins><span class="cx">                         # put verbose stuff only to the log file
</span><del>-            if {[ui_isset ports_verbose]} {
-                return {$logfd}
-            } else {
-                return {}
</del><ins>+                        if {[ui_isset ports_verbose]} {
+                                return {$logfd}
+                        } else {
+                                return {}
</ins><span class="cx">                         }
</span><span class="cx">                 }
</span><del>-        msg {
-            if {[ui_isset ports_quiet]} {
-                return {}
</del><ins>+                msg {
+                        if {[ui_isset ports_quiet]} {
+                                return {}
</ins><span class="cx">                         } else {
</span><span class="cx">                                 return {stdout}
</span><span class="cx">                         }
</span><span class="cx">                 }
</span><del>-        default {
-                return {stdout}
-        }
-    }
</del><ins>+                default {
+                        return {stdout}
+                }
+        }
</ins><span class="cx"> }
</span><del>-        
</del><ins>+
</ins><span class="cx"> proc pkg_ui_log {message} {
</span><del>-    global logfd
-    if {[string length $logfd] &gt; 0 } {
-        log_message $logfd $message
-    }
</del><ins>+        global logfd
+        if {$logfd ne &quot;&quot;} {
+                log_message $logfd $message
+        }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> proc log_message {channel message} {
</span><del>-    seek $channel 0 end
-    puts $channel $message
-    flush $channel
</del><ins>+        seek $channel 0 end
+        puts $channel $message
+        flush $channel
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> # Recursive bottom-up approach of building a list of dependencies.
</span><span class="cx"> proc get_dependencies {portname includeBuildDeps} {
</span><span class="cx">         set result {}
</span><del>-        
</del><ins>+
</ins><span class="cx">         if {[catch {set res [mportsearch &quot;^$portname\$&quot;]} error]} {
</span><span class="cx">                 global errorInfo
</span><span class="cx">                 ui_debug &quot;$errorInfo&quot;
</span><span class="lines">@@ -129,12 +129,12 @@
</span><span class="cx">         foreach {name array} $res {
</span><span class="cx">                 array set portinfo $array
</span><span class="cx">                 if {![info exists portinfo(name)] ||
</span><del>-                        ![info exists portinfo(version)] || 
</del><ins>+                        ![info exists portinfo(version)] ||
</ins><span class="cx">                         ![info exists portinfo(categories)]} {
</span><span class="cx">                         ui_error &quot;Internal error: $name missing some portinfo keys&quot;
</span><span class="cx">                         continue
</span><span class="cx">                 }
</span><del>-                
</del><ins>+
</ins><span class="cx">                 set portname $portinfo(name)
</span><span class="cx">                 set portversion $portinfo(version)
</span><span class="cx">                 set category [lindex $portinfo(categories) 0]
</span><span class="lines">@@ -147,16 +147,16 @@
</span><span class="cx">                 set depends {}
</span><span class="cx">                 if {[info exists portinfo(depends_run)]} { eval &quot;lappend depends $portinfo(depends_run)&quot; }
</span><span class="cx">                 if {[info exists portinfo(depends_lib)]} { eval &quot;lappend depends $portinfo(depends_lib)&quot; }
</span><del>-                if {$includeBuildDeps != &quot;&quot; &amp;&amp; [info exists portinfo(depends_build)]} { 
</del><ins>+                if {$includeBuildDeps ne &quot;&quot; &amp;&amp; [info exists portinfo(depends_build)]} {
</ins><span class="cx">                         eval &quot;lappend depends $portinfo(depends_build)&quot;
</span><span class="cx">                 }
</span><del>-                if {$includeBuildDeps != &quot;&quot; &amp;&amp; [info exists portinfo(depends_fetch)]} { 
</del><ins>+                if {$includeBuildDeps ne &quot;&quot; &amp;&amp; [info exists portinfo(depends_fetch)]} {
</ins><span class="cx">                         eval &quot;lappend depends $portinfo(depends_fetch)&quot;
</span><span class="cx">                 }
</span><del>-                if {$includeBuildDeps != &quot;&quot; &amp;&amp; [info exists portinfo(depends_extract)]} { 
</del><ins>+                if {$includeBuildDeps ne &quot;&quot; &amp;&amp; [info exists portinfo(depends_extract)]} {
</ins><span class="cx">                         eval &quot;lappend depends $portinfo(depends_extract)&quot;
</span><span class="cx">                 }
</span><del>-                
</del><ins>+
</ins><span class="cx">                 foreach depspec $depends {
</span><span class="cx">                         set dep [lindex [split $depspec :] end]
</span><span class="cx">                         set x [get_dependencies $dep $includeBuildDeps]
</span><span class="lines">@@ -175,7 +175,7 @@
</span><span class="cx">         set portname [lindex $dep 0]
</span><span class="cx">         set portversion [lindex $dep 1]
</span><span class="cx">         set category [lindex $dep 2]
</span><del>-        
</del><ins>+
</ins><span class="cx">         set pkgpath ${basepath}/${category}/${portname}-${portversion}.pkg
</span><span class="cx">         if {[file readable $pkgpath]} {
</span><span class="cx">                 ui_msg &quot;installing binary: $pkgpath&quot;
</span><span class="lines">@@ -194,13 +194,12 @@
</span><span class="cx">         }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-
</del><span class="cx"> # Standard procedures
</span><span class="cx"> 
</span><span class="cx"> proc fatal args {
</span><del>-    global argv0
-    puts stderr &quot;$argv0: $args&quot;
-    exit
</del><ins>+        global argv0
+        puts stderr &quot;$argv0: $args&quot;
+        exit
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> # Main
</span><span class="lines">@@ -209,8 +208,8 @@
</span><span class="cx"> #        set ui_options(ports_verbose) yes
</span><span class="cx"> 
</span><span class="cx"> if {[catch {mportinit ui_options options variations} result]} {
</span><del>-    puts &quot;Failed to initialize ports system, $result&quot;
-    exit 1
</del><ins>+        puts &quot;Failed to initialize ports system, $result&quot;
+        exit 1
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> package require Pextlib
</span><span class="lines">@@ -221,210 +220,208 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> foreach pname $argv {
</span><ins>+        if {[catch {set res [mportsearch &quot;^${pname}\$&quot;]} result]} {
+                puts &quot;port search failed: $result&quot;
+                exit 1
+        }
</ins><span class="cx"> 
</span><del>-if {[catch {set res [mportsearch &quot;^${pname}\$&quot;]} result]} {
-        puts &quot;port search failed: $result&quot;
-        exit 1
-}
</del><ins>+        set logpath &quot;/darwinports/logs&quot;
+        set logfd &quot;&quot;
</ins><span class="cx"> 
</span><del>-set logpath &quot;/darwinports/logs&quot;
-set logfd &quot;&quot;
</del><ins>+        foreach {name array} $res {
+                array unset portinfo
+                array set portinfo $array
</ins><span class="cx"> 
</span><del>-foreach {name array} $res {
-        array unset portinfo
-        array set portinfo $array
</del><ins>+                # Start with verbose output off;
+                # this will prevent the repopulation of /opt/local from getting logged.
+                set ui_options(ports_verbose) no
</ins><span class="cx"> 
</span><del>-        # Start with verbose output off;
-        # this will prevent the repopulation of /opt/local from getting logged.
-        set ui_options(ports_verbose) no
</del><ins>+                if {![info exists portinfo(porturl)]} {
+                        puts stderr &quot;Internal error: no porturl for $name&quot;
+                        continue
+                }
</ins><span class="cx"> 
</span><del>-        if {![info exists portinfo(porturl)]} {
-                puts stderr &quot;Internal error: no porturl for $name&quot;
-                continue
-        }
-        
-        set pkgbase /darwinports/pkgs/
-        set porturl $portinfo(porturl)
</del><ins>+                set pkgbase /darwinports/pkgs/
+                set porturl $portinfo(porturl)
</ins><span class="cx"> 
</span><del>-        # Skip up-to-date packages
-        if {[regsub {^file://} $portinfo(porturl) &quot;&quot; portpath]} {
-                if {[info exists portinfo(name)] &amp;&amp;
-                        [info exists portinfo(version)] &amp;&amp;
-                        [info exists portinfo(categories)]} {
-                        set portname $portinfo(name)
-                        set portversion $portinfo(version)
-                        set category [lindex $portinfo(categories) 0]
-                        set pkgfile ${pkgbase}/${category}/${portname}-${portversion}.pkg/Contents/Archive.pax.gz
-                        if {[file readable $pkgfile] &amp;&amp; ([file mtime ${pkgfile}] &gt; [file mtime ${portpath}/Portfile])} {
-                                puts stderr &quot;Skipping ${portname}-${portversion}; package is up to date.&quot;
-                                continue
</del><ins>+                # Skip up-to-date packages
+                if {[regsub {^file://} $portinfo(porturl) &quot;&quot; portpath]} {
+                        if {[info exists portinfo(name)] &amp;&amp;
+                                [info exists portinfo(version)] &amp;&amp;
+                                [info exists portinfo(categories)]} {
+                                set portname $portinfo(name)
+                                set portversion $portinfo(version)
+                                set category [lindex $portinfo(categories) 0]
+                                set pkgfile ${pkgbase}/${category}/${portname}-${portversion}.pkg/Contents/Archive.pax.gz
+                                if {[file readable $pkgfile] &amp;&amp; ([file mtime ${pkgfile}] &gt; [file mtime ${portpath}/Portfile])} {
+                                        puts stderr &quot;Skipping ${portname}-${portversion}; package is up to date.&quot;
+                                        continue
+                                }
</ins><span class="cx">                         }
</span><span class="cx">                 }
</span><del>-        }
-        
-        # Skipt packages which previously failed
-                
-        # Building the port:
-        # - remove /opt/local so it won't pollute the port.
-        # - re-install MacPorts.
-        # - keep distfiles outside /opt/local so we don't have to keep fetching them.
-        # - send out an email to the maintainer if any errors occurred.
</del><span class="cx"> 
</span><del>-        ui_msg &quot;removing /opt/local&quot;
-        #unset ui_options(ports_verbose)
-        if {[catch {system &quot;rm -Rf /opt/local&quot;} error]} {
-                puts stderr &quot;Internal error: $error&quot;
-        }
-        if {[catch {system &quot;rm -Rf /usr/X11R6&quot;} error]} {
-                puts stderr &quot;Internal error: $error&quot;
-        }
-        if {[catch {system &quot;rm -Rf /etc/X11&quot;} error]} {
-                puts stderr &quot;Internal error: $error&quot;
-        }
-        if {[catch {system &quot;rm -Rf /etc/fonts&quot;} error]} {
-                puts stderr &quot;Internal error: $error&quot;
-        }
-        if {[catch {system &quot;cd $env(HOME)/darwinports &amp;&amp; make &amp;&amp; make install&quot;} error]} {
-                puts stderr &quot;Internal error: $error&quot;
-        }
-        if {[catch {system &quot;rmdir /opt/local/var/db/dports/distfiles&quot;} error]} {
-                puts stderr &quot;Internal error: $error&quot;
-        }
-        if {[catch {system &quot;ln -s /darwinports/distfiles /opt/local/var/db/dports/distfiles&quot;} error]} {
-                puts stderr &quot;Internal error: $error&quot;
-        }
-        #set ui_options(ports_verbose) yes
</del><ins>+                # Skipt packages which previously failed
</ins><span class="cx"> 
</span><del>-        # If there was a log file left over from the previous pass,
-        # then the port failed with an error.  Send the log in an
-        # email to the maintainers.
-        if {[string length $logfd] &gt; 0} {
-                close $logfd
-                set logfd &quot;&quot;
-        }
-        #if {[file readable $logfilename]} {
-        #        if {[catch {system &quot;&lt;$logfilename /usr/sbin/sendmail -t&quot;} error]} {
-        #                puts stderr &quot;Internal error: $error&quot;
-        #        }
-        #}
</del><ins>+                # Building the port:
+                # - remove /opt/local so it won't pollute the port.
+                # - re-install MacPorts.
+                # - keep distfiles outside /opt/local so we don't have to keep fetching them.
+                # - send out an email to the maintainer if any errors occurred.
</ins><span class="cx"> 
</span><del>-        # Open the log file for writing
-        set logfd [open ${logpath}/${name}.log w]
</del><ins>+                ui_msg &quot;removing /opt/local&quot;
+                #unset ui_options(ports_verbose)
+                if {[catch {system &quot;rm -Rf /opt/local&quot;} error]} {
+                        puts stderr &quot;Internal error: $error&quot;
+                }
+                if {[catch {system &quot;rm -Rf /usr/X11R6&quot;} error]} {
+                        puts stderr &quot;Internal error: $error&quot;
+                }
+                if {[catch {system &quot;rm -Rf /etc/X11&quot;} error]} {
+                        puts stderr &quot;Internal error: $error&quot;
+                }
+                if {[catch {system &quot;rm -Rf /etc/fonts&quot;} error]} {
+                        puts stderr &quot;Internal error: $error&quot;
+                }
+                if {[catch {system &quot;cd $env(HOME)/darwinports &amp;&amp; make &amp;&amp; make install&quot;} error]} {
+                        puts stderr &quot;Internal error: $error&quot;
+                }
+                if {[catch {system &quot;rmdir /opt/local/var/db/dports/distfiles&quot;} error]} {
+                        puts stderr &quot;Internal error: $error&quot;
+                }
+                if {[catch {system &quot;ln -s /darwinports/distfiles /opt/local/var/db/dports/distfiles&quot;} error]} {
+                        puts stderr &quot;Internal error: $error&quot;
+                }
+                #set ui_options(ports_verbose) yes
</ins><span class="cx"> 
</span><del>-        set valid 1
</del><ins>+                # If there was a log file left over from the previous pass,
+                # then the port failed with an error.  Send the log in an
+                # email to the maintainers.
+                if {$logfd ne &quot;&quot;} {
+                        close $logfd
+                        set logfd &quot;&quot;
+                }
+                #if {[file readable $logfilename]} {
+                #        if {[catch {system &quot;&lt;$logfilename /usr/sbin/sendmail -t&quot;} error]} {
+                #                puts stderr &quot;Internal error: $error&quot;
+                #        }
+                #}
</ins><span class="cx"> 
</span><del>-        set lint_errors {}
-        set portname &quot;&quot;
-        set portversion &quot;&quot;
-        set description &quot;&quot;
-        set category &quot;&quot;
</del><ins>+                # Open the log file for writing
+                set logfd [open ${logpath}/${name}.log w]
</ins><span class="cx"> 
</span><del>-        if {![info exists portinfo(name)]} {
-                lappend lint_errors &quot;missing name key&quot;
-                set valid 0
-        } else {
-                set portname $portinfo(name)
-        }
-        
-        if {![info exists portinfo(description)]} {
-                lappend lint_errors &quot;missing description key&quot;
-                set valid 0
-        } else {
-                set description $portinfo(description)
-        }
-        
-        if {![info exists portinfo(version)]} {
-                lappend lint_errors &quot;missing version key&quot;
-                set valid 0
-        } else {
-                set portversion $portinfo(version)
-        }
-        
-        if {![info exists portinfo(categories)]} {
-                lappend lint_errors &quot;missing categories key&quot;
-                set valid 0
-        } else {
-                set category [lindex $portinfo(categories) 0]
-        }
-        
-        if {![info exists portinfo(maintainers)]} {
-                append lint_errors &quot;missing maintainers key&quot;
-                set valid 0
-                set maintainers kevin@opendarwin.org
-        } else {
-                set maintainers $portinfo(maintainers)
-        }
-        
-        pkg_ui_log &quot;To: [join $maintainers {, }]&quot;
-        pkg_ui_log &quot;From: donotreply@opendarwin.org&quot;
-        pkg_ui_log &quot;Subject: MacPorts $portinfo(name)-$portinfo(version) build failure&quot;
-        pkg_ui_log &quot;&quot;
-        pkg_ui_log &quot;The following is a transcript produced by the MacPorts automated build       &quot;
-        pkg_ui_log &quot;system.  You are receiving this email because you are listed as a maintainer    &quot;
-        pkg_ui_log &quot;of this port, which has failed the automated packaging process.  Please update  &quot;
-        pkg_ui_log &quot;the port as soon as possible.&quot;
-        pkg_ui_log &quot;&quot;
-        pkg_ui_log &quot;&quot;
-        pkg_ui_log &quot;Thank you,&quot;
-        pkg_ui_log &quot;The MacPorts Team&quot;
-        pkg_ui_log &quot;&quot;
-        pkg_ui_log &quot;================================================================================&quot;
-        pkg_ui_log &quot;&quot;
</del><ins>+                set valid 1
</ins><span class="cx"> 
</span><del>-        if {!$valid} {
-                foreach error $lint_errors {
-                        ui_error $error
</del><ins>+                set lint_errors {}
+                set portname &quot;&quot;
+                set portversion &quot;&quot;
+                set description &quot;&quot;
+                set category &quot;&quot;
+
+                if {![info exists portinfo(name)]} {
+                        lappend lint_errors &quot;missing name key&quot;
+                        set valid 0
+                } else {
+                        set portname $portinfo(name)
</ins><span class="cx">                 }
</span><del>-        }
</del><span class="cx"> 
</span><del>-        ui_msg &quot;packaging ${category}/${portname}-${portversion}&quot;
</del><ins>+                if {![info exists portinfo(description)]} {
+                        lappend lint_errors &quot;missing description key&quot;
+                        set valid 0
+                } else {
+                        set description $portinfo(description)
+                }
</ins><span class="cx"> 
</span><del>-        # Install binary dependencies if we can, to speed things up.
-        #set depends {}
-        #if {[info exists portinfo(depends_run)]} { eval &quot;lappend depends $portinfo(depends_run)&quot; }
-        #if {[info exists portinfo(depends_lib)]} { eval &quot;lappend depends $portinfo(depends_lib)&quot; }
-        #if {[info exists portinfo(depends_build)]} { eval &quot;lappend depends $portinfo(depends_build)&quot; }
-        #foreach depspec $depends {
-        #        set dep [lindex [split $depspec :] end]
-                #install_binary_if_available $dep $pkgbase
-        #}
-        set dependencies [get_dependencies $portname 1]
-        set dependencies [lsort -unique $dependencies]
-        foreach dep $dependencies {
-                install_binary_if_available $dep $pkgbase
-        }
</del><ins>+                if {![info exists portinfo(version)]} {
+                        lappend lint_errors &quot;missing version key&quot;
+                        set valid 0
+                } else {
+                        set portversion $portinfo(version)
+                }
</ins><span class="cx"> 
</span><del>-        set options(package.type) pkg
-        set options(package.destpath) ${pkgbase}/${category}/
</del><ins>+                if {![info exists portinfo(categories)]} {
+                        lappend lint_errors &quot;missing categories key&quot;
+                        set valid 0
+                } else {
+                        set category [lindex $portinfo(categories) 0]
+                }
</ins><span class="cx"> 
</span><del>-        # Turn on verbose output for the build
-        set ui_options(ports_verbose) yes
-        set options(subport) $name
-        if {[catch {set workername [mportopen $porturl [array get options] [array get variations] yes]} result] ||
-                $result == 1} {
-                global errorInfo
-                ui_debug &quot;$errorInfo&quot;
-            ui_error &quot;Internal error: unable to open port: $result&quot;
-            continue
-        }        
-        if {[catch {set result [mportexec $workername pkg]} result] ||
-                $result == 1} {
-                global errorInfo
-                ui_debug &quot;$errorInfo&quot;
-            ui_error &quot;port package failed: $result&quot;
-                mportclose $workername
-            continue
-        }
-        set ui_options(ports_verbose) no
-        # Turn verbose output off after the build
</del><ins>+                if {![info exists portinfo(maintainers)]} {
+                        append lint_errors &quot;missing maintainers key&quot;
+                        set valid 0
+                        set maintainers kevin@opendarwin.org
+                } else {
+                        set maintainers $portinfo(maintainers)
+                }
</ins><span class="cx"> 
</span><del>-        mportclose $workername
</del><ins>+                pkg_ui_log &quot;To: [join $maintainers {, }]&quot;
+                pkg_ui_log &quot;From: donotreply@opendarwin.org&quot;
+                pkg_ui_log &quot;Subject: MacPorts $portinfo(name)-$portinfo(version) build failure&quot;
+                pkg_ui_log &quot;&quot;
+                pkg_ui_log &quot;The following is a transcript produced by the MacPorts automated build                 &quot;
+                pkg_ui_log &quot;system.  You are receiving this email because you are listed as a maintainer        &quot;
+                pkg_ui_log &quot;of this port, which has failed the automated packaging process.  Please update        &quot;
+                pkg_ui_log &quot;the port as soon as possible.&quot;
+                pkg_ui_log &quot;&quot;
+                pkg_ui_log &quot;&quot;
+                pkg_ui_log &quot;Thank you,&quot;
+                pkg_ui_log &quot;The MacPorts Team&quot;
+                pkg_ui_log &quot;&quot;
+                pkg_ui_log &quot;================================================================================&quot;
+                pkg_ui_log &quot;&quot;
</ins><span class="cx"> 
</span><del>-        # We made it to the end.  We can delete the log file.
-        close $logfd
-        set logfd &quot;&quot;
-        file delete ${logpath}/${name}.log
-}
</del><ins>+                if {!$valid} {
+                        foreach error $lint_errors {
+                                ui_error $error
+                        }
+                }
</ins><span class="cx"> 
</span><ins>+                ui_msg &quot;packaging ${category}/${portname}-${portversion}&quot;
+
+                # Install binary dependencies if we can, to speed things up.
+                #set depends {}
+                #if {[info exists portinfo(depends_run)]} { eval &quot;lappend depends $portinfo(depends_run)&quot; }
+                #if {[info exists portinfo(depends_lib)]} { eval &quot;lappend depends $portinfo(depends_lib)&quot; }
+                #if {[info exists portinfo(depends_build)]} { eval &quot;lappend depends $portinfo(depends_build)&quot; }
+                #foreach depspec $depends {
+                #        set dep [lindex [split $depspec :] end]
+                        #install_binary_if_available $dep $pkgbase
+                #}
+                set dependencies [get_dependencies $portname 1]
+                set dependencies [lsort -unique $dependencies]
+                foreach dep $dependencies {
+                        install_binary_if_available $dep $pkgbase
+                }
+
+                set options(package.type) pkg
+                set options(package.destpath) ${pkgbase}/${category}/
+
+                # Turn on verbose output for the build
+                set ui_options(ports_verbose) yes
+                set options(subport) $name
+                if {[catch {set workername [mportopen $porturl [array get options] [array get variations] yes]} result] ||
+                        $result == 1} {
+                        global errorInfo
+                        ui_debug &quot;$errorInfo&quot;
+                        ui_error &quot;Internal error: unable to open port: $result&quot;
+                        continue
+                }
+                if {[catch {set result [mportexec $workername pkg]} result] ||
+                        $result == 1} {
+                        global errorInfo
+                        ui_debug &quot;$errorInfo&quot;
+                        ui_error &quot;port package failed: $result&quot;
+                        mportclose $workername
+                        continue
+                }
+                set ui_options(ports_verbose) no
+                # Turn verbose output off after the build
+
+                mportclose $workername
+
+                # We made it to the end.  We can delete the log file.
+                close $logfd
+                set logfd &quot;&quot;
+                file delete ${logpath}/${name}.log
+        }
</ins><span class="cx"> }
</span><span class="cx"> # end foreach pname
</span></span></pre></div>
<a id="branchesnewhelpsystembaseportmgrpackagingrpmalltcl"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/portmgr/packaging/rpmall.tcl (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/portmgr/packaging/rpmall.tcl        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/portmgr/packaging/rpmall.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -12,14 +12,14 @@
</span><span class="cx"> # modification, are permitted provided that the following conditions
</span><span class="cx"> # are met:
</span><span class="cx"> # 1. Redistributions of source code must retain the above copyright
</span><del>-#    notice, this list of conditions and the following disclaimer.
</del><ins>+#         notice, this list of conditions and the following disclaimer.
</ins><span class="cx"> # 2. Redistributions in binary form must reproduce the above copyright
</span><del>-#    notice, this list of conditions and the following disclaimer in the
-#    documentation and/or other materials provided with the distribution.
</del><ins>+#         notice, this list of conditions and the following disclaimer in the
+#         documentation and/or other materials provided with the distribution.
</ins><span class="cx"> # 3. Neither the name of Apple Inc. nor the names of its contributors
</span><del>-#    may be used to endorse or promote products derived from this software
-#    without specific prior written permission.
-# 
</del><ins>+#         may be used to endorse or promote products derived from this software
+#         without specific prior written permission.
+#
</ins><span class="cx"> # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &quot;AS IS&quot;
</span><span class="cx"> # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
</span><span class="cx"> # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
</span><span class="lines">@@ -45,84 +45,84 @@
</span><span class="cx"> 
</span><span class="cx"> # ui_options accessor
</span><span class="cx"> proc ui_isset {val} {
</span><del>-    global ui_options
-    if {[info exists ui_options($val)]} {
-        if {$ui_options($val) == &quot;yes&quot;} {
-            return 1
</del><ins>+        global ui_options
+        if {[info exists ui_options($val)]} {
+                if {$ui_options($val) eq &quot;yes&quot;} {
+                        return 1
+                }
</ins><span class="cx">         }
</span><del>-    }
-    return 0
</del><ins>+        return 0
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> set options(package.destpath) &quot;/darwinports/rpms&quot;
</span><span class="cx"> 
</span><del>-# UI Callback 
</del><ins>+# UI Callback
</ins><span class="cx"> 
</span><span class="cx"> proc ui_prefix {priority} {
</span><del>-    switch $priority {
-        debug {
-                return &quot;DEBUG: &quot;
-        }
-        error {
-                return &quot;Error: &quot;
-        }
-        warn {
-                return &quot;Warning: &quot;
-        }
-        default {
-                return &quot;&quot;
-        }
-    }
</del><ins>+        switch $priority {
+                debug {
+                        return &quot;DEBUG: &quot;
+                }
+                error {
+                        return &quot;Error: &quot;
+                }
+                warn {
+                        return &quot;Warning: &quot;
+                }
+                default {
+                        return &quot;&quot;
+                }
+        }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> proc ui_channels {priority} {
</span><del>-    global logfd
-    switch $priority {
-        debug {
-            if {[ui_isset ports_debug]} {
-                    return {stdout}
-            } else {
-                    return {}
-            }
-        }
-        info {
</del><ins>+        global logfd
+        switch $priority {
+                debug {
+                        if {[ui_isset ports_debug]} {
+                                return {stdout}
+                        } else {
+                                return {}
+                        }
+                }
+                info {
</ins><span class="cx">                         # put verbose stuff only to the log file
</span><del>-            if {[ui_isset ports_verbose]} {
-                return {$logfd}
-            } else {
-                return {}
</del><ins>+                        if {[ui_isset ports_verbose]} {
+                                return {$logfd}
+                        } else {
+                                return {}
</ins><span class="cx">                         }
</span><span class="cx">                 }
</span><del>-        msg {
-            if {[ui_isset ports_quiet]} {
-                return {}
</del><ins>+                msg {
+                        if {[ui_isset ports_quiet]} {
+                                return {}
</ins><span class="cx">                         } else {
</span><span class="cx">                                 return {stdout}
</span><span class="cx">                         }
</span><span class="cx">                 }
</span><del>-        default {
-                return {stdout}
-        }
-    }
</del><ins>+                default {
+                        return {stdout}
+                }
+        }
</ins><span class="cx"> }
</span><del>-        
</del><ins>+
</ins><span class="cx"> proc pkg_ui_log {message} {
</span><del>-    global logfd
-    if {[string length $logfd] &gt; 0 } {
-        log_message $logfd $message
-    }
</del><ins>+        global logfd
+        if {$logfd ne &quot;&quot;} {
+                log_message $logfd $message
+        }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> proc log_message {channel message} {
</span><del>-    seek $channel 0 end
-    puts $channel $message
-    flush $channel
</del><ins>+        seek $channel 0 end
+        puts $channel $message
+        flush $channel
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> # Recursive bottom-up approach of building a list of dependencies.
</span><span class="cx"> proc get_dependencies {portname includeBuildDeps} {
</span><span class="cx">         set result {}
</span><del>-        
</del><ins>+
</ins><span class="cx">         if {[catch {set search [mportsearch &quot;^$portname\$&quot;]} error]} {
</span><span class="cx">                 global errorInfo
</span><span class="cx">                 ui_debug &quot;$errorInfo&quot;
</span><span class="lines">@@ -132,7 +132,7 @@
</span><span class="cx">         foreach {name array} $search {
</span><span class="cx">                 array set portinfo $array
</span><span class="cx">                 if {![info exists portinfo(name)] ||
</span><del>-                        ![info exists portinfo(version)] || 
</del><ins>+                        ![info exists portinfo(version)] ||
</ins><span class="cx">                         ![info exists portinfo(categories)]} {
</span><span class="cx">                         ui_error &quot;Internal error: $name missing some portinfo keys&quot;
</span><span class="cx">                         continue
</span><span class="lines">@@ -140,7 +140,7 @@
</span><span class="cx">                 if {![info exists portinfo(revision)]} {
</span><span class="cx">                         set portinfo(revision) 0
</span><span class="cx">                 }
</span><del>-                
</del><ins>+
</ins><span class="cx">                 set portname $portinfo(name)
</span><span class="cx">                 set portversion $portinfo(version)
</span><span class="cx">                 set revision $portinfo(revision)
</span><span class="lines">@@ -152,13 +152,13 @@
</span><span class="cx">                 set depends {}
</span><span class="cx">                 if {[info exists portinfo(depends_run)]} { eval &quot;lappend depends $portinfo(depends_run)&quot; }
</span><span class="cx">                 if {[info exists portinfo(depends_lib)]} { eval &quot;lappend depends $portinfo(depends_lib)&quot; }
</span><del>-                if {$includeBuildDeps != &quot;&quot; &amp;&amp; [info exists portinfo(depends_build)]} { 
</del><ins>+                if {$includeBuildDeps ne &quot;&quot; &amp;&amp; [info exists portinfo(depends_build)]} {
</ins><span class="cx">                         eval &quot;lappend depends $portinfo(depends_build)&quot;
</span><span class="cx">                 }
</span><del>-                if {$includeBuildDeps != &quot;&quot; &amp;&amp; [info exists portinfo(depends_fetch)]} { 
</del><ins>+                if {$includeBuildDeps ne &quot;&quot; &amp;&amp; [info exists portinfo(depends_fetch)]} {
</ins><span class="cx">                         eval &quot;lappend depends $portinfo(depends_fetch)&quot;
</span><span class="cx">                 }
</span><del>-                if {$includeBuildDeps != &quot;&quot; &amp;&amp; [info exists portinfo(depends_extract)]} { 
</del><ins>+                if {$includeBuildDeps ne &quot;&quot; &amp;&amp; [info exists portinfo(depends_extract)]} {
</ins><span class="cx">                         eval &quot;lappend depends $portinfo(depends_extract)&quot;
</span><span class="cx">                 }
</span><span class="cx">                 foreach depspec $depends {
</span><span class="lines">@@ -202,9 +202,9 @@
</span><span class="cx"> # Standard procedures
</span><span class="cx"> 
</span><span class="cx"> proc fatal args {
</span><del>-    global argv0
-    puts stderr &quot;$argv0: $args&quot;
-    exit
</del><ins>+        global argv0
+        puts stderr &quot;$argv0: $args&quot;
+        exit
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> # Main
</span><span class="lines">@@ -217,8 +217,8 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> if {[catch {mportinit ui_options options variations} result]} {
</span><del>-    puts &quot;Failed to initialize ports system, $result&quot;
-    exit 1
</del><ins>+        puts &quot;Failed to initialize ports system, $result&quot;
+        exit 1
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> package require Pextlib
</span><span class="lines">@@ -229,275 +229,274 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> foreach pname $argv {
</span><ins>+        if {[catch {set allpackages [mportsearch &quot;^${pname}\$&quot;]} result]} {
+                puts &quot;port search failed: $result&quot;
+                exit 1
+        }
</ins><span class="cx"> 
</span><del>-if {[catch {set allpackages [mportsearch &quot;^${pname}\$&quot;]} result]} {
-        puts &quot;port search failed: $result&quot;
-        exit 1
-}
</del><ins>+        set logpath &quot;/darwinports/logs&quot;
+        set logfd &quot;&quot;
</ins><span class="cx"> 
</span><del>-set logpath &quot;/darwinports/logs&quot;
-set logfd &quot;&quot;
</del><ins>+        foreach {name array} $allpackages {
+                array unset portinfo
+                array set portinfo $array
</ins><span class="cx"> 
</span><del>-foreach {name array} $allpackages {
-        array unset portinfo
-        array set portinfo $array
</del><ins>+                #ui_msg &quot;foo $portinfo(porturl)&quot;
</ins><span class="cx"> 
</span><del>-        #ui_msg &quot;foo $portinfo(porturl)&quot;
</del><ins>+                # Start with verbose output off;
+                # this will prevent the repopulation of /opt/local from getting logged.
+                set ui_options(ports_verbose) no
</ins><span class="cx"> 
</span><del>-        # Start with verbose output off;
-        # this will prevent the repopulation of /opt/local from getting logged.
-        set ui_options(ports_verbose) no
</del><ins>+                if {![info exists portinfo(porturl)]} {
+                        puts stderr &quot;Internal error: no porturl for $name&quot;
+                        continue
+                }
+                if {![info exists portinfo(revision)]} {
+                        set portinfo(revision) 0
+                }
</ins><span class="cx"> 
</span><del>-        if {![info exists portinfo(porturl)]} {
-                puts stderr &quot;Internal error: no porturl for $name&quot;
-                continue
-        }
-        if {![info exists portinfo(revision)]} {
-                set portinfo(revision) 0
-        }
</del><ins>+                set porturl $portinfo(porturl)
</ins><span class="cx"> 
</span><del>-        set porturl $portinfo(porturl)
</del><ins>+                # this is used to short-circuit the RPM check and
+                # move on to the next package
</ins><span class="cx"> 
</span><del>-        # this is used to short-circuit the RPM check and
-        # move on to the next package
</del><ins>+                global exit_loop
+                set exit_loop false
</ins><span class="cx"> 
</span><del>-        global exit_loop
-        set exit_loop false
</del><ins>+                # Skip up-to-date packages
+                if {[regsub {^file://} $portinfo(porturl) &quot;&quot; portpath]} {
+                        if {[info exists portinfo(name)] &amp;&amp;
+                                [info exists portinfo(version)] &amp;&amp;
+                                [info exists portinfo(revision)]} {
+                                set portname $portinfo(name)
+                                set portversion $portinfo(version)
+                                set revision $portinfo(revision)
</ins><span class="cx"> 
</span><del>-        # Skip up-to-date packages
-        if {[regsub {^file://} $portinfo(porturl) &quot;&quot; portpath]} {
-                if {[info exists portinfo(name)] &amp;&amp;
-                        [info exists portinfo(version)] &amp;&amp;
-                        [info exists portinfo(revision)]} {
-                        set portname $portinfo(name)
-                        set portversion $portinfo(version)
-                        set revision $portinfo(revision)
-
-                        foreach dir {&quot;/opt/local/src/apple/RPMS&quot; &quot;/usr/src/apple/RPMS&quot; &quot;/darwinports/rpms/RPMS&quot;} {
-                                foreach arch {&quot;ppc&quot; &quot;i386&quot; &quot;fat&quot;} {
-                                        set rpmpath &quot;${dir}/${arch}/${portname}-${portversion}-${revision}.${arch}.rpm&quot;
-                                        #ui_msg &quot;trying ${rpmpath}&quot;
-                                        if {[file readable $rpmpath] &amp;&amp; ([file mtime ${rpmpath}] &gt;= [file mtime ${portpath}/Portfile])} {
-                                                puts stderr &quot;-&gt;    skipping ${portname}-${portversion}; package is up to date.&quot;
-                                                set exit_loop true
</del><ins>+                                foreach dir {&quot;/opt/local/src/apple/RPMS&quot; &quot;/usr/src/apple/RPMS&quot; &quot;/darwinports/rpms/RPMS&quot;} {
+                                        foreach arch {&quot;ppc&quot; &quot;i386&quot; &quot;fat&quot;} {
+                                                set rpmpath &quot;${dir}/${arch}/${portname}-${portversion}-${revision}.${arch}.rpm&quot;
+                                                #ui_msg &quot;trying ${rpmpath}&quot;
+                                                if {[file readable $rpmpath] &amp;&amp; ([file mtime ${rpmpath}] &gt;= [file mtime ${portpath}/Portfile])} {
+                                                        puts stderr &quot;-&gt;    skipping ${portname}-${portversion}; package is up to date.&quot;
+                                                        set exit_loop true
+                                                        break
+                                                }
+                                        }
+                                        if {${exit_loop}} {
</ins><span class="cx">                                                 break
</span><span class="cx">                                         }
</span><span class="cx">                                 }
</span><del>-                                if {${exit_loop}} {
-                                        break
</del><ins>+                        }
+                }
+                if {${exit_loop}} {
+                        continue
+                }
+
+                # Skip packages which previously failed
+                set exit_loop false
+
+                # Skip up-to-date packages
+                if {[regsub {^file://} $portinfo(porturl) &quot;&quot; portpath]} {
+                        if {[info exists portinfo(name)] &amp;&amp;
+                                [info exists portinfo(version)] &amp;&amp;
+                                [info exists portinfo(revision)]} {
+                                set portname $portinfo(name)
+                                set portversion $portinfo(version)
+                                set revision $portinfo(revision)
+
+                                set logfilepath &quot;${logpath}/${portname}.log&quot;
+                                if {[file readable ${logfilepath}] &amp;&amp; ([file mtime ${logfilepath}] &gt; [file mtime ${portpath}/Portfile])} {
+                                        puts stderr &quot;-&gt;    skipping ${portname}-${portversion}; package failed, but has not changed.&quot;
+                                        set exit_loop true
</ins><span class="cx">                                 }
</span><span class="cx">                         }
</span><span class="cx">                 }
</span><del>-        }
-        if {${exit_loop}} {
-                continue
-        }
-        
-        # Skip packages which previously failed
-        set exit_loop false
-                
-        # Skip up-to-date packages
-        if {[regsub {^file://} $portinfo(porturl) &quot;&quot; portpath]} {
-                if {[info exists portinfo(name)] &amp;&amp;
-                        [info exists portinfo(version)] &amp;&amp;
-                        [info exists portinfo(revision)]} {
-                        set portname $portinfo(name)
-                        set portversion $portinfo(version)
-                        set revision $portinfo(revision)
</del><ins>+                if {${exit_loop}} {
+                        continue
+                }
</ins><span class="cx"> 
</span><del>-                        set logfilepath &quot;${logpath}/${portname}.log&quot;
-                        if {[file readable ${logfilepath}] &amp;&amp; ([file mtime ${logfilepath}] &gt; [file mtime ${portpath}/Portfile])} {
-                                puts stderr &quot;-&gt;    skipping ${portname}-${portversion}; package failed, but has not changed.&quot;
-                                set exit_loop true
</del><ins>+                # Building the port:
+                # - remove /opt/local so it won't pollute the port.
+                # - re-install MacPorts.
+                # - keep distfiles outside /opt/local so we don't have to keep fetching them.
+                # - send out an email to the maintainer if any errors occurred.
+
+                set remove_files &quot;&quot;
+                foreach dir {&quot;/opt/local/src/apple/RPMS&quot; &quot;/usr/src/apple/RPMS&quot; &quot;/darwinports/rpms/RPMS&quot;} {
+                        foreach arch {&quot;ppc&quot; &quot;i386&quot; &quot;fat&quot;} {
+                                set remove_files &quot;${remove_files} '${dir}/${arch}/'*.rpm&quot;
</ins><span class="cx">                         }
</span><span class="cx">                 }
</span><del>-        }
-        if {${exit_loop}} {
-                continue
-        }
-        
-        # Building the port:
-        # - remove /opt/local so it won't pollute the port.
-        # - re-install MacPorts.
-        # - keep distfiles outside /opt/local so we don't have to keep fetching them.
-        # - send out an email to the maintainer if any errors occurred.
</del><ins>+                system &quot;rpm -q --queryformat='%{name} ' -p ${remove_files} | xargs rpm -e || true&quot;
</ins><span class="cx"> 
</span><del>-        set remove_files &quot;&quot;
-        foreach dir {&quot;/opt/local/src/apple/RPMS&quot; &quot;/usr/src/apple/RPMS&quot; &quot;/darwinports/rpms/RPMS&quot;} {
-                foreach arch {&quot;ppc&quot; &quot;i386&quot; &quot;fat&quot;} {
-                        set remove_files &quot;${remove_files} '${dir}/${arch}/'*.rpm&quot;
</del><ins>+                ui_msg &quot;-&gt;          Removing /opt/local&quot;
+                #unset ui_options(ports_verbose)
+                if {[catch {system &quot;rm -Rf /opt/local&quot;} error]} {
+                        puts stderr &quot;Internal error: $error&quot;
</ins><span class="cx">                 }
</span><del>-        }
-        system &quot;rpm -q --queryformat='%{name} ' -p ${remove_files} | xargs rpm -e || true&quot;
</del><ins>+                # this is bad on pure darwin  :)
+                #if {[catch {system &quot;rm -Rf /usr/X11R6&quot;} error]} {
+                #        puts stderr &quot;Internal error: $error&quot;
+                #}
+                #if {[catch {system &quot;rm -Rf /etc/X11&quot;} error]} {
+                #        puts stderr &quot;Internal error: $error&quot;
+                #}
+                #if {[catch {system &quot;rm -Rf /etc/fonts&quot;} error]} {
+                #        puts stderr &quot;Internal error: $error&quot;
+                #}
+                ui_msg &quot;-&gt;          Installing MacPorts&quot;
+                if {[catch {system &quot;cd $env(HOME)/darwinports &amp;&amp; make &amp;&amp; make install&quot;} error]} {
+                        puts stderr &quot;Internal error: $error&quot;
+                }
+                if {[catch {system &quot;rmdir /opt/local/var/db/dports/distfiles&quot;} error]} {
+                        puts stderr &quot;Internal error: $error&quot;
+                }
+                if {[catch {system &quot;ln -s /darwinports/distfiles /opt/local/var/db/dports/distfiles&quot;} error]} {
+                        puts stderr &quot;Internal error: $error&quot;
+                }
+                #set ui_options(ports_verbose) yes
</ins><span class="cx"> 
</span><del>-        ui_msg &quot;-&gt;    Removing /opt/local&quot;
-        #unset ui_options(ports_verbose)
-        if {[catch {system &quot;rm -Rf /opt/local&quot;} error]} {
-                puts stderr &quot;Internal error: $error&quot;
-        }
-        # this is bad on pure darwin  :)
-        #if {[catch {system &quot;rm -Rf /usr/X11R6&quot;} error]} {
-        #        puts stderr &quot;Internal error: $error&quot;
-        #}
-        #if {[catch {system &quot;rm -Rf /etc/X11&quot;} error]} {
-        #        puts stderr &quot;Internal error: $error&quot;
-        #}
-        #if {[catch {system &quot;rm -Rf /etc/fonts&quot;} error]} {
-        #        puts stderr &quot;Internal error: $error&quot;
-        #}
-        ui_msg &quot;-&gt;    Installing MacPorts&quot;
-        if {[catch {system &quot;cd $env(HOME)/darwinports &amp;&amp; make &amp;&amp; make install&quot;} error]} {
-                puts stderr &quot;Internal error: $error&quot;
-        }
-        if {[catch {system &quot;rmdir /opt/local/var/db/dports/distfiles&quot;} error]} {
-                puts stderr &quot;Internal error: $error&quot;
-        }
-        if {[catch {system &quot;ln -s /darwinports/distfiles /opt/local/var/db/dports/distfiles&quot;} error]} {
-                puts stderr &quot;Internal error: $error&quot;
-        }
-        #set ui_options(ports_verbose) yes
</del><ins>+                # If there was a log file left over from the previous pass,
+                # then the port failed with an error.  Send the log in an
+                # email to the maintainers.
+                if {$logfd ne &quot;&quot;} {
+                        close $logfd
+                        set logfd &quot;&quot;
+                }
+                #if {[file readable $logfilename]} {
+                #        if {[catch {system &quot;&lt;$logfilename /usr/sbin/sendmail -t&quot;} error]} {
+                #                puts stderr &quot;Internal error: $error&quot;
+                #        }
+                #}
</ins><span class="cx"> 
</span><del>-        # If there was a log file left over from the previous pass,
-        # then the port failed with an error.  Send the log in an
-        # email to the maintainers.
-        if {[string length $logfd] &gt; 0} {
-                close $logfd
-                set logfd &quot;&quot;
-        }
-        #if {[file readable $logfilename]} {
-        #        if {[catch {system &quot;&lt;$logfilename /usr/sbin/sendmail -t&quot;} error]} {
-        #                puts stderr &quot;Internal error: $error&quot;
-        #        }
-        #}
</del><ins>+                # Open the log file for writing
+                set logfd [open ${logpath}/${name}.log w]
</ins><span class="cx"> 
</span><del>-        # Open the log file for writing
-        set logfd [open ${logpath}/${name}.log w]
</del><ins>+                set valid 1
</ins><span class="cx"> 
</span><del>-        set valid 1
</del><ins>+                set lint_errors {}
+                set portname &quot;&quot;
+                set portversion &quot;&quot;
+                set description &quot;&quot;
+                set category &quot;&quot;
</ins><span class="cx"> 
</span><del>-        set lint_errors {}
-        set portname &quot;&quot;
-        set portversion &quot;&quot;
-        set description &quot;&quot;
-        set category &quot;&quot;
</del><ins>+                if {![info exists portinfo(name)]} {
+                        lappend lint_errors &quot;missing name key&quot;
+                        set valid 0
+                } else {
+                        set portname $portinfo(name)
+                }
</ins><span class="cx"> 
</span><del>-        if {![info exists portinfo(name)]} {
-                lappend lint_errors &quot;missing name key&quot;
-                set valid 0
-        } else {
-                set portname $portinfo(name)
-        }
-        
-        if {![info exists portinfo(description)]} {
-                lappend lint_errors &quot;missing description key&quot;
-                set valid 0
-        } else {
-                set description $portinfo(description)
-        }
-        
-        if {![info exists portinfo(version)]} {
-                lappend lint_errors &quot;missing version key&quot;
-                set valid 0
-        } else {
-                set portversion $portinfo(version)
-        }
-        
-        if {![info exists portinfo(categories)]} {
-                lappend lint_errors &quot;missing categories key&quot;
-                set valid 0
-        } else {
-                set category [lindex $portinfo(categories) 0]
-        }
-        
-        if {![info exists portinfo(maintainers)]} {
-                append lint_errors &quot;missing maintainers key&quot;
-                set valid 0
-                set maintainers kevin@opendarwin.org
-        } else {
-                set maintainers $portinfo(maintainers)
-        }
-        
-        pkg_ui_log &quot;To: [join $maintainers {, }]&quot;
-        pkg_ui_log &quot;From: donotreply@opendarwin.org&quot;
-        pkg_ui_log &quot;Subject: MacPorts $portinfo(name)-$portinfo(version) build failure&quot;
-        pkg_ui_log &quot;&quot;
-        pkg_ui_log &quot;The following is a transcript produced by the MacPorts automated build       &quot;
-        pkg_ui_log &quot;system.  You are receiving this email because you are listed as a maintainer    &quot;
-        pkg_ui_log &quot;of this port, which has failed the automated packaging process.  Please update  &quot;
-        pkg_ui_log &quot;the port as soon as possible.&quot;
-        pkg_ui_log &quot;&quot;
-        pkg_ui_log &quot;&quot;
-        pkg_ui_log &quot;Thank you,&quot;
-        pkg_ui_log &quot;The MacPorts Team&quot;
-        pkg_ui_log &quot;&quot;
-        pkg_ui_log &quot;================================================================================&quot;
-        pkg_ui_log &quot;&quot;
</del><ins>+                if {![info exists portinfo(description)]} {
+                        lappend lint_errors &quot;missing description key&quot;
+                        set valid 0
+                } else {
+                        set description $portinfo(description)
+                }
</ins><span class="cx"> 
</span><del>-        if {!$valid} {
-                foreach error $lint_errors {
-                        ui_error $error
</del><ins>+                if {![info exists portinfo(version)]} {
+                        lappend lint_errors &quot;missing version key&quot;
+                        set valid 0
+                } else {
+                        set portversion $portinfo(version)
</ins><span class="cx">                 }
</span><del>-        }
</del><span class="cx"> 
</span><del>-        ui_msg &quot;--&gt;   Packaging ${category}/${portname}-${portversion}&quot;
</del><ins>+                if {![info exists portinfo(categories)]} {
+                        lappend lint_errors &quot;missing categories key&quot;
+                        set valid 0
+                } else {
+                        set category [lindex $portinfo(categories) 0]
+                }
</ins><span class="cx"> 
</span><del>-        foreach prebuild {&quot;ccache&quot; &quot;rpm&quot; &quot;unzip&quot;} {
-                if {![file exists /bin/${prebuild}] &amp;&amp; ![file exists /usr/bin/${prebuild}]} {
-                        ui_msg &quot;---&gt;  Pre-installing ${prebuild}&quot;
-                        if {[catch {set search [mportsearch &quot;^${prebuild}\$&quot;]} error]} {
-                                global errorInfo
-                                ui_debug &quot;$errorInfo&quot;
-                                ui_error &quot;Internal error: port search ${prebuild} failed: $error&quot;
</del><ins>+                if {![info exists portinfo(maintainers)]} {
+                        append lint_errors &quot;missing maintainers key&quot;
+                        set valid 0
+                        set maintainers kevin@opendarwin.org
+                } else {
+                        set maintainers $portinfo(maintainers)
+                }
+
+                pkg_ui_log &quot;To: [join $maintainers {, }]&quot;
+                pkg_ui_log &quot;From: donotreply@opendarwin.org&quot;
+                pkg_ui_log &quot;Subject: MacPorts $portinfo(name)-$portinfo(version) build failure&quot;
+                pkg_ui_log &quot;&quot;
+                pkg_ui_log &quot;The following is a transcript produced by the MacPorts automated build                 &quot;
+                pkg_ui_log &quot;system.  You are receiving this email because you are listed as a maintainer        &quot;
+                pkg_ui_log &quot;of this port, which has failed the automated packaging process.  Please update        &quot;
+                pkg_ui_log &quot;the port as soon as possible.&quot;
+                pkg_ui_log &quot;&quot;
+                pkg_ui_log &quot;&quot;
+                pkg_ui_log &quot;Thank you,&quot;
+                pkg_ui_log &quot;The MacPorts Team&quot;
+                pkg_ui_log &quot;&quot;
+                pkg_ui_log &quot;================================================================================&quot;
+                pkg_ui_log &quot;&quot;
+
+                if {!$valid} {
+                        foreach error $lint_errors {
+                                ui_error $error
</ins><span class="cx">                         }
</span><del>-                        array set prebuildinfo [lindex $search 1]
-                        set ui_options(ports_verbose) yes
-                        set options(subport) ${prebuild}
-                        if {[catch {set workername [mportopen $prebuildinfo(porturl) [array get options] [array get variations] yes]} result] ||
-                                $result == 1} {
-                                global errorInfo
-                                ui_debug &quot;$errorInfo&quot;
-                                ui_error &quot;Internal error: unable to install ${prebuild}... exiting&quot;
-                                exit 1
</del><ins>+                }
+
+                ui_msg &quot;--&gt;   Packaging ${category}/${portname}-${portversion}&quot;
+
+                foreach prebuild {&quot;ccache&quot; &quot;rpm&quot; &quot;unzip&quot;} {
+                        if {![file exists /bin/${prebuild}] &amp;&amp; ![file exists /usr/bin/${prebuild}]} {
+                                ui_msg &quot;---&gt;  Pre-installing ${prebuild}&quot;
+                                if {[catch {set search [mportsearch &quot;^${prebuild}\$&quot;]} error]} {
+                                        global errorInfo
+                                        ui_debug &quot;$errorInfo&quot;
+                                        ui_error &quot;Internal error: port search ${prebuild} failed: $error&quot;
+                                }
+                                array set prebuildinfo [lindex $search 1]
+                                set ui_options(ports_verbose) yes
+                                set options(subport) ${prebuild}
+                                if {[catch {set workername [mportopen $prebuildinfo(porturl) [array get options] [array get variations] yes]} result] ||
+                                        $result == 1} {
+                                        global errorInfo
+                                        ui_debug &quot;$errorInfo&quot;
+                                        ui_error &quot;Internal error: unable to install ${prebuild}... exiting&quot;
+                                        exit 1
+                                }
+                                if {[catch {set result [mportexec $workername activate]} result] ||
+                                        $result == 1} {
+                                        global errorInfo
+                                        ui_debug &quot;$errorInfo&quot;
+                                        ui_error &quot;installation of ${prebuild} failed: $result&quot;
+                                        mportclose $workername
+                                        exit 1
+                                }
</ins><span class="cx">                         }
</span><del>-                        if {[catch {set result [mportexec $workername activate]} result] ||
-                                $result == 1} {
-                                global errorInfo
-                                ui_debug &quot;$errorInfo&quot;
-                                ui_error &quot;installation of ${prebuild} failed: $result&quot;
-                                mportclose $workername
-                                exit 1
-                        }
</del><span class="cx">                 }
</span><del>-        }
</del><span class="cx"> 
</span><del>-        # Turn on verbose output for the build
-        set ui_options(ports_verbose) yes
-        set options(subport) $name
-        if {[catch {set workername [mportopen $porturl [array get options] [array get variations]]} result] ||
-                $result == 1} {
-                global errorInfo
-                ui_debug &quot;$errorInfo&quot;
-            ui_error &quot;Internal error: unable to open port: $result&quot;
-            continue
-        }
-        if {[catch {set result [mportexec $workername rpmpackage]} result] ||
-                $result == 1} {
-                global errorInfo
-                ui_debug &quot;$errorInfo&quot;
-            ui_error &quot;port package failed: $result&quot;
</del><ins>+                # Turn on verbose output for the build
+                set ui_options(ports_verbose) yes
+                set options(subport) $name
+                if {[catch {set workername [mportopen $porturl [array get options] [array get variations]]} result] ||
+                        $result == 1} {
+                        global errorInfo
+                        ui_debug &quot;$errorInfo&quot;
+                        ui_error &quot;Internal error: unable to open port: $result&quot;
+                        continue
+                }
+                if {[catch {set result [mportexec $workername rpmpackage]} result] ||
+                        $result == 1} {
+                        global errorInfo
+                        ui_debug &quot;$errorInfo&quot;
+                        ui_error &quot;port package failed: $result&quot;
+                        mportclose $workername
+                        continue
+                }
+                set ui_options(ports_verbose) no
+                # Turn verbose output off after the build
+
</ins><span class="cx">                 mportclose $workername
</span><del>-            continue
</del><ins>+
+                # We made it to the end.  We can delete the log file.
+                close $logfd
+                set logfd &quot;&quot;
+                file delete ${logpath}/${name}.log
</ins><span class="cx">         }
</span><del>-        set ui_options(ports_verbose) no
-        # Turn verbose output off after the build
</del><span class="cx"> 
</span><del>-        mportclose $workername
-
-        # We made it to the end.  We can delete the log file.
-        close $logfd
-        set logfd &quot;&quot;
-        file delete ${logpath}/${name}.log
</del><span class="cx"> }
</span><del>-
-}
</del><span class="cx"> # end foreach pname
</span></span></pre></div>
<a id="branchesnewhelpsystembasesrcMakefilein"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/src/Makefile.in (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/Makefile.in        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/src/Makefile.in        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -8,7 +8,7 @@
</span><span class="cx">                         machista1.0
</span><span class="cx"> SUBDIR=                ${TCLPKG} port programs
</span><span class="cx"> 
</span><del>-ifeq ($(shell uname),Darwin)
</del><ins>+ifeq (@TRACEMODE_SUPPORT@,1)
</ins><span class="cx"> TCLPKG+= darwintracelib1.0
</span><span class="cx"> endif
</span><span class="cx"> 
</span></span></pre></div>
<a id="branchesnewhelpsystembasesrcconfighin"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/src/config.h.in (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/config.h.in        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/src/config.h.in        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -67,6 +67,9 @@
</span><span class="cx"> /* Define to 1 if you have the `flock' function. */
</span><span class="cx"> #undef HAVE_FLOCK
</span><span class="cx"> 
</span><ins>+/* Define to 1 if you have the `fls' function. */
+#undef HAVE_FLS
+
</ins><span class="cx"> /* Define if CoreFoundation framework is available */
</span><span class="cx"> #undef HAVE_FRAMEWORK_COREFOUNDATION
</span><span class="cx"> 
</span><span class="lines">@@ -83,12 +86,18 @@
</span><span class="cx"> /* Define to 1 if you have the &lt;inttypes.h&gt; header file. */
</span><span class="cx"> #undef HAVE_INTTYPES_H
</span><span class="cx"> 
</span><ins>+/* Define to 1 if you have the `kevent' function. */
+#undef HAVE_KEVENT
+
</ins><span class="cx"> /* Define to 1 if you have the `kqueue' function. */
</span><span class="cx"> #undef HAVE_KQUEUE
</span><span class="cx"> 
</span><span class="cx"> /* Define if you have the `crypto' library (-lcrypto). */
</span><span class="cx"> #undef HAVE_LIBCRYPTO
</span><span class="cx"> 
</span><ins>+/* Define to 1 if you have the &lt;libkern/OSAtomic.h&gt; header file. */
+#undef HAVE_LIBKERN_OSATOMIC_H
+
</ins><span class="cx"> /* Define if you have the `md' library (-lmd). */
</span><span class="cx"> #undef HAVE_LIBMD
</span><span class="cx"> 
</span><span class="lines">@@ -125,9 +134,21 @@
</span><span class="cx"> /* Define to 1 if you have the &lt;openssl/sha.h&gt; header file. */
</span><span class="cx"> #undef HAVE_OPENSSL_SHA_H
</span><span class="cx"> 
</span><ins>+/* Define to 1 if you have the `OSAtomicCompareAndSwap32' function. */
+#undef HAVE_OSATOMICCOMPAREANDSWAP32
+
+/* Define to 1 if you have the `OSAtomicCompareAndSwap64' function. */
+#undef HAVE_OSATOMICCOMPAREANDSWAP64
+
+/* Define to 1 if you have the `OSAtomicCompareAndSwapPtr' function. */
+#undef HAVE_OSATOMICCOMPAREANDSWAPPTR
+
</ins><span class="cx"> /* Define to 1 if you have the &lt;paths.h&gt; header file. */
</span><span class="cx"> #undef HAVE_PATHS_H
</span><span class="cx"> 
</span><ins>+/* Define to 1 if you have the `posix_spawn' function. */
+#undef HAVE_POSIX_SPAWN
+
</ins><span class="cx"> /* Define if you have POSIX threads libraries and header files. */
</span><span class="cx"> #undef HAVE_PTHREAD
</span><span class="cx"> 
</span><span class="lines">@@ -158,6 +179,9 @@
</span><span class="cx"> /* Define to 1 if you have the &lt;sha.h&gt; header file. */
</span><span class="cx"> #undef HAVE_SHA_H
</span><span class="cx"> 
</span><ins>+/* Define to 1 if you have the &lt;spawn.h&gt; header file. */
+#undef HAVE_SPAWN_H
+
</ins><span class="cx"> /* Define to 1 if you have the &lt;sqlite3ext.h&gt; header file. */
</span><span class="cx"> #undef HAVE_SQLITE3EXT_H
</span><span class="cx"> 
</span><span class="lines">@@ -226,6 +250,9 @@
</span><span class="cx"> /* Define to 1 if you have &lt;sys/wait.h&gt; that is POSIX.1 compatible. */
</span><span class="cx"> #undef HAVE_SYS_WAIT_H
</span><span class="cx"> 
</span><ins>+/* Platform supports tracemode. */
+#undef HAVE_TRACEMODE_SUPPORT
+
</ins><span class="cx"> /* Define to 1 if you have the &lt;unistd.h&gt; header file. */
</span><span class="cx"> #undef HAVE_UNISTD_H
</span><span class="cx"> 
</span></span></pre></div>
<a id="branchesnewhelpsystembasesrccregistryfilec"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/src/cregistry/file.c (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/cregistry/file.c        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/src/cregistry/file.c        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -97,7 +97,7 @@
</span><span class="cx">  *
</span><span class="cx">  * @param [in] reg      registry to open entry in
</span><span class="cx">  * @param [in] id       port id in the dabatase
</span><del>- * @param [in] path     file path in the database
</del><ins>+ * @param [in] name     file path in the database
</ins><span class="cx">  * @param [out] errPtr  on error, a description of the error that occures
</span><span class="cx">  * @return              the file if success, NULL if failure
</span><span class="cx">  */
</span></span></pre></div>
<a id="branchesnewhelpsystembasesrccregistryregistryc"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/src/cregistry/registry.c (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/cregistry/registry.c        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/src/cregistry/registry.c        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -189,19 +189,6 @@
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx">     /* can_write is still true if one of the stat calls succeeded */
</span><del>-    if (can_write) {
-        if (sb.st_uid == getuid()) {
-            if (!(sb.st_mode &amp; S_IWUSR)) {
-                can_write = 0;
-            }
-        } else if (sb.st_gid == getgid()) {
-            if (!(sb.st_mode &amp; S_IWGRP)) {
-                can_write = 0;
-            }
-        } else if (!(sb.st_mode &amp; S_IWOTH) &amp;&amp; getuid() != 0) {
-            can_write = 0;
-        }
-    }
</del><span class="cx">     if (initialized || can_write) {
</span><span class="cx">         sqlite3_stmt* stmt = NULL;
</span><span class="cx">         char* query = sqlite3_mprintf(&quot;ATTACH DATABASE '%q' AS registry&quot;, path);
</span></span></pre></div>
<a id="branchesnewhelpsystembasesrccregistryutilc"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/src/cregistry/util.c (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/cregistry/util.c        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/src/cregistry/util.c        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -123,7 +123,7 @@
</span><span class="cx">  * @param [in] query_len length of the query (or -1 for automatic)
</span><span class="cx">  * @param [out] objects  the objects selected
</span><span class="cx">  * @param [in] fn        a function to convert sqlite3_stmts to the desired type
</span><del>- * @param [inout] data   data passed along to the cast function
</del><ins>+ * @param [in,out] castcalldata data passed along to the cast function
</ins><span class="cx">  * @param [in] del       a function to delete the desired type of object
</span><span class="cx">  * @param [out] errPtr   on error, a description of the error that occurred
</span><span class="cx">  * @return               the number of objects if success; negative if failure
</span></span></pre></div>
<a id="branchesnewhelpsystembasesrccregistryvercompc"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/src/cregistry/vercomp.c (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/cregistry/vercomp.c        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/src/cregistry/vercomp.c        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -55,7 +55,7 @@
</span><span class="cx">  * @param [in] versionA first version string, i.e. &quot;1.4.1&quot;
</span><span class="cx">  * @param [in] lengthA  length of first version string, or -1 to use strlen
</span><span class="cx">  * @param [in] versionB second version string, i.e. &quot;1.4.2&quot;
</span><del>- * @param [in] lengthA  length of second version string, or -1 to use strlen
</del><ins>+ * @param [in] lengthB  length of second version string, or -1 to use strlen
</ins><span class="cx">  * @return              -1 if A &lt; B; 0 if A = B; 1 if A &gt; B
</span><span class="cx">  */
</span><span class="cx"> static int vercmp (const char *versionA, int lengthA, const char *versionB,
</span><span class="lines">@@ -65,12 +65,12 @@
</span><span class="cx">         const char *eptrA, *eptrB;
</span><span class="cx"> 
</span><span class="cx">     if (lengthA &lt; 0)
</span><del>-        lengthA = strlen(versionA);
</del><ins>+        lengthA = (int)strlen(versionA);
</ins><span class="cx">     if (lengthB &lt; 0)
</span><del>-        lengthB = strlen(versionB);
</del><ins>+        lengthB = (int)strlen(versionB);
</ins><span class="cx"> 
</span><span class="cx">         /* if versions equal, return zero */
</span><del>-        if(lengthA == lengthB &amp;&amp; !strncmp(versionA, versionB, lengthA))
</del><ins>+        if(lengthA == lengthB &amp;&amp; !strncmp(versionA, versionB, (size_t)lengthA))
</ins><span class="cx">                 return 0;
</span><span class="cx"> 
</span><span class="cx">         ptrA = versionA;
</span></span></pre></div>
<a id="branchesnewhelpsystembasesrcdarwintracelib10Makefile"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/src/darwintracelib1.0/Makefile (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/darwintracelib1.0/Makefile        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/src/darwintracelib1.0/Makefile        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -1,11 +1,17 @@
</span><del>-OBJS=                darwintrace.o
</del><ins>+# This Makefile will only be run on Darwin systems; we can safely use
+# Apple-specifics here
+SRCS=                $(wildcard *.c)
+OBJS=                $(SRCS:%.c=%.o)
</ins><span class="cx"> SHLIB_NAME=        darwintrace${SHLIB_SUFFIX}
</span><span class="cx"> INSTALLDIR=        ${DESTDIR}${datadir}/macports/Tcl/darwintrace1.0
</span><span class="cx"> 
</span><span class="cx"> include ../../Mk/macports.autoconf.mk
</span><span class="cx"> 
</span><del>-CFLAGS+= -fPIC -Wno-deprecated-declarations
</del><ins>+# Yes, we know having $ signs in identifiers is not a very good idea; in the
+# case of darwintrace we still need them, though.
</ins><span class="cx"> CFLAGS_PEDANTIC=
</span><ins>+CFLAGS+= -fPIC ${UNIVERSAL_ARCHFLAGS}
+SHLIB_LDFLAGS+=${UNIVERSAL_ARCHFLAGS}
</ins><span class="cx"> 
</span><span class="cx"> all:: ${SHLIB_NAME}
</span><span class="cx"> 
</span></span></pre></div>
<a id="branchesnewhelpsystembasesrcdarwintracelib10accesscfromrev117083trunkbasesrcdarwintracelib10accessc"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/src/darwintracelib1.0/access.c (from rev 117083, trunk/base/src/darwintracelib1.0/access.c) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/darwintracelib1.0/access.c                                (rev 0)
+++ branches/new-help-system/base/src/darwintracelib1.0/access.c        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,61 @@
</span><ins>+/*
+ * Copyright (c) 2005 Apple Inc. All rights reserved.
+ * Copyright (c) 2005-2006 Paul Guyot &lt;pguyot@kallisys.net&gt;,
+ * All rights reserved.
+ * Copyright (c) 2006-2013 The MacPorts Project
+ *
+ * $Id: darwintrace.c 112642 2013-10-28 18:59:19Z cal@macports.org $
+ *
+ * @APPLE_BSD_LICENSE_HEADER_START@
+ *
+ * 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 Inc. (&quot;Apple&quot;) 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 APPLE AND ITS CONTRIBUTORS &quot;AS IS&quot; 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 APPLE OR ITS 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.
+ *
+ * @APPLE_BSD_LICENSE_HEADER_END@
+ */
+
+#include &quot;darwintrace.h&quot;
+
+#include &lt;errno.h&gt;
+#include &lt;sys/syscall.h&gt;
+#include &lt;unistd.h&gt;
+
+int access(const char *path, int amode) {
+#define access(x, y) syscall(SYS_access, (x), (y))
+        __darwintrace_setup();
+
+        int result = 0;
+
+        if (!__darwintrace_is_in_sandbox(path, DT_REPORT | DT_ALLOWDIR | DT_FOLLOWSYMS)) {
+                errno = ENOENT;
+                result = -1;
+        } else {
+                result = access(path, amode);
+        }
+
+        debug_printf(&quot;access(%s) = %d\n&quot;, path, result);
+
+        return result;
+#undef access
+}
</ins></span></pre></div>
<a id="branchesnewhelpsystembasesrcdarwintracelib10closecfromrev117083trunkbasesrcdarwintracelib10closec"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/src/darwintracelib1.0/close.c (from rev 117083, trunk/base/src/darwintracelib1.0/close.c) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/darwintracelib1.0/close.c                                (rev 0)
+++ branches/new-help-system/base/src/darwintracelib1.0/close.c        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,68 @@
</span><ins>+/*
+ * Copyright (c) 2005 Apple Inc. All rights reserved.
+ * Copyright (c) 2005-2006 Paul Guyot &lt;pguyot@kallisys.net&gt;,
+ * All rights reserved.
+ * Copyright (c) 2006-2013 The MacPorts Project
+ *
+ * $Id: darwintrace.c 112642 2013-10-28 18:59:19Z cal@macports.org $
+ *
+ * @APPLE_BSD_LICENSE_HEADER_START@
+ *
+ * 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 Inc. (&quot;Apple&quot;) 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 APPLE AND ITS CONTRIBUTORS &quot;AS IS&quot; 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 APPLE OR ITS 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.
+ *
+ * @APPLE_BSD_LICENSE_HEADER_END@
+ */
+
+#define DARWINTRACE_USE_PRIVATE_API 1
+#include &quot;darwintrace.h&quot;
+
+#include &lt;stdio.h&gt;
+#include &lt;sys/syscall.h&gt;
+#include &lt;unistd.h&gt;
+
+/**
+ * Wrapper around \c close(2) to deny closing the file descriptor used by
+ * darwintrace to communicate with the control socket. Since we sometimes want
+ * to close our socket using \c fclose(3) and that internally calls \c
+ * close(2), we need a way to specifically allow closing the socket when we
+ * need to. This possibility is the \c __darwintrace_close_sock variable, which
+ * will be set to the FD to be closed when closing should be allowed.
+ */
+int close(int fd) {
+#define close(x) syscall(SYS_close, (x))
+        __darwintrace_setup();
+
+        FILE *stream = __darwintrace_sock();
+        if (stream) {
+                int dtsock = fileno(stream);
+                if (fd == dtsock &amp;&amp; dtsock != __darwintrace_close_sock) {
+                        errno = EBADF;
+                        return -1;
+                }
+        }
+
+        return close(fd);
+#undef close
+}
</ins></span></pre></div>
<a id="branchesnewhelpsystembasesrcdarwintracelib10darwintracec"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/src/darwintracelib1.0/darwintrace.c (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/darwintracelib1.0/darwintrace.c        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/src/darwintracelib1.0/darwintrace.c        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -35,44 +35,17 @@
</span><span class="cx">  * @APPLE_BSD_LICENSE_HEADER_END@
</span><span class="cx">  */
</span><span class="cx"> 
</span><del>-#ifdef HAVE_CONFIG_H
-#include &lt;config.h&gt;
-#endif
</del><ins>+#define DARWINTRACE_USE_PRIVATE_API 1
+#include &quot;darwintrace.h&quot;
</ins><span class="cx"> 
</span><del>-#if HAVE_SYS_CDEFS_H
-#include &lt;sys/cdefs.h&gt;
</del><ins>+#ifdef HAVE_LIBKERN_OSATOMIC_H
+#include &lt;libkern/OSAtomic.h&gt;
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-#if defined(_DARWIN_FEATURE_64_BIT_INODE) &amp;&amp; !defined(_DARWIN_FEATURE_ONLY_64_BIT_INODE)
-/* The architecture we're building for has multiple versions of stat.
-   We need to undo sys/cdefs.h changes for _DARWIN_FEATURE_64_BIT_INODE */
-#undef  __DARWIN_64_BIT_INO_T
-#define __DARWIN_64_BIT_INO_T 0
-#undef  __DARWIN_SUF_64_BIT_INO_T
-#define __DARWIN_SUF_64_BIT_INO_T &quot;&quot;
-#undef _DARWIN_FEATURE_64_BIT_INODE
-#endif
-
-#ifdef HAVE_CRT_EXTERNS_H
-#include &lt;crt_externs.h&gt;
-#endif
-
-#ifdef HAVE_SYS_PATHS_H
-#include &lt;sys/paths.h&gt;
-#endif
-
-#include &lt;ctype.h&gt;
-#include &lt;dirent.h&gt;
-#include &lt;dlfcn.h&gt;
</del><span class="cx"> #include &lt;errno.h&gt;
</span><del>-#include &lt;fcntl.h&gt;
</del><span class="cx"> #include &lt;pthread.h&gt;
</span><del>-#include &lt;stdarg.h&gt;
-#include &lt;stdbool.h&gt;
-#include &lt;stdint.h&gt;
-#include &lt;stdio.h&gt;
-#include &lt;stdlib.h&gt;
</del><span class="cx"> #include &lt;string.h&gt;
</span><ins>+#include &lt;sys/attr.h&gt;
</ins><span class="cx"> #include &lt;sys/param.h&gt;
</span><span class="cx"> #include &lt;sys/socket.h&gt;
</span><span class="cx"> #include &lt;sys/stat.h&gt;
</span><span class="lines">@@ -81,6 +54,14 @@
</span><span class="cx"> #include &lt;sys/un.h&gt;
</span><span class="cx"> #include &lt;unistd.h&gt;
</span><span class="cx"> 
</span><ins>+#if __DARWIN_64_BIT_INO_T
+#define STATSYSNUM SYS_stat64
+#define LSTATSYSNUM SYS_lstat64
+#else
+#define STATSYSNUM SYS_stat
+#define LSTATSYSNUM SYS_lstat
+#endif
+
</ins><span class="cx"> #ifndef HAVE_STRLCPY
</span><span class="cx"> /* Define strlcpy if it's not available. */
</span><span class="cx"> size_t strlcpy(char *dst, const char *src, size_t size) {
</span><span class="lines">@@ -99,59 +80,43 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;../pextlib1.0/strlcat.c&quot;
</span><span class="cx"> 
</span><del>-/* global variables (only checked when setup is first called)
- * DARWINTRACE_LOG
- *    path to the log file (no logging happens if it's unset).
- * DARWINTRACE_SANDBOX_BOUNDS
- *    : separated allowed paths for the creation of files.
- *    \: -&gt; :
- *    \\ -&gt; \
- */
-
-/*
- * DARWINTRACE_DEBUG: verbose output of operations to debug darwintrace
- */
-#ifndef DARWINTRACE_DEBUG
-#define DARWINTRACE_DEBUG (0)
-#endif
-
-static inline int __darwintrace_strbeginswith(const char *str, const char *prefix);
-static inline int __darwintrace_pathbeginswith(const char *str, const char *prefix);
-static inline void __darwintrace_log_op(const char *op, const char *path, int fd);
-static void __darwintrace_copy_env() __attribute__((constructor));
-static void __darwintrace_setup_tls() __attribute__((constructor));
-static inline char *__darwintrace_alloc_env(const char *varName, const char *varValue);
-static inline char *const *__darwintrace_restore_env(char *const envp[]);
-static inline void __darwintrace_setup();
-static inline void __darwintrace_cleanup_path(char *path);
-static char *__send(const char *buf, uint32_t len, int answer);
-
</del><ins>+// Global Variables
</ins><span class="cx"> /**
</span><span class="cx">  * PID of the process darwintrace was last used in. This is used to detect
</span><span class="cx">  * forking and opening a new connection to the control socket in the child
</span><span class="cx">  * process. Not doing so would potentially cause two processes writing to the
</span><span class="cx">  * same socket.
</span><span class="cx">  */
</span><del>-static pid_t __darwintrace_pid = (pid_t) - 1;
</del><ins>+pid_t __darwintrace_pid = (pid_t) - 1;
</ins><span class="cx"> 
</span><span class="cx"> /**
</span><del>- * pthread_key_ts for the pthread_t returned by pthread_self() and the
- * darwintrace socket to ensure the socket is only used from a single thread.
- */
-static pthread_key_t tid_key;
-static pthread_key_t sock_key;
-
-/**
</del><span class="cx">  * Helper variable containing the number of the darwintrace socket, iff the
</span><span class="cx">  * close(2) syscall should be allowed to close it. Used by \c
</span><span class="cx">  * __darwintrace_close.
</span><span class="cx">  */
</span><del>-static volatile int __darwintrace_close_sock = -1;
</del><ins>+volatile int __darwintrace_close_sock = -1;
</ins><span class="cx"> 
</span><span class="cx"> /**
</span><ins>+ * Debug socket. Will be initialized by a constructor function.
+ */
+FILE *__darwintrace_stderr = NULL;
+
+static inline void __darwintrace_log_op(const char *op, const char *path);
+static void __darwintrace_setup_tls() __attribute__((constructor));
+static char *__send(const char *buf, uint32_t len, int answer);
+
+/**
+ * pthread_key_ts for the pthread_t returned by pthread_self() and the
+ * darwintrace socket to ensure the socket is only used from a single thread.
+ */
+static pthread_key_t tid_key;
+// The sock key is needed in close(2) and dup2(2)
+pthread_key_t sock_key;
+
+/**
</ins><span class="cx">  * size of the communication buffer
</span><span class="cx">  */
</span><del>-#define BUFFER_SIZE 1024
</del><ins>+#define BUFFER_SIZE 4096
</ins><span class="cx"> 
</span><span class="cx"> /**
</span><span class="cx">  * Variable holding the sandbox bounds in the following format:
</span><span class="lines">@@ -160,55 +125,18 @@
</span><span class="cx">  *  &lt;operation&gt;     :: '0' | '1' | '2'
</span><span class="cx">  * where
</span><span class="cx">  *  0: allow
</span><del>- *  1: map the path to the one given in additional_data
</del><ins>+ *  1: map the path to the one given in additional_data (currently unsupported)
</ins><span class="cx">  *  2: check for a dependency using the socket
</span><span class="cx">  */
</span><span class="cx"> static char *filemap;
</span><span class="cx"> 
</span><span class="cx"> enum {
</span><span class="cx">     FILEMAP_ALLOW = 0,
</span><del>-    FILEMAP_REDIR = 1,
</del><ins>+    // FILEMAP_REDIR = 1,
</ins><span class="cx">     FILEMAP_ASK   = 2
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> /**
</span><del>- * Copy of the DYLD_INSERT_LIBRARIES environment variable to restore it in
- * execve(2). DYLD_INSERT_LIBRARIES is needed to preload this library into any
- * process' address space.
- */
-static char *__env_dyld_insert_libraries;
-
-/**
- * Copy of the DYLD_FORCE_FLAT_NAMESPACE environment variable to restore it in
- * execve(2). DYLD_FORCE_FLAT_NAMESPACE=1 is needed for the preload-based
- * sandbox to work.
- */
-static char *__env_dyld_force_flat_namespace;
-
-/**
- * Copy of the DARWINTRACE_LOG environment variable to restore it in execve(2).
- * Contains the path to the unix socket used for communication with the
- * MacPorts-side of the sandbox.
- */
-static char *__env_darwintrace_log;
-
-#if DARWINTRACE_DEBUG
-#   if __STDC_VERSION__&gt;=199901L
-#       define debug_printf(format, ...) \
-        fprintf(stderr, &quot;darwintrace[%d]: &quot; format, getpid(), __VA_ARGS__);
-#   else
-__attribute__((format(printf, 1, 2))) static inline void debug_printf(const char *format, ...) {
-        va_list args;
-        va_start(args, format);
-        vfprintf(stderr, format, args);
-        va_end(args);
-}
-#   endif
-#else
-#   define debug_printf(...)
-#endif
-
-/**
</del><span class="cx">  * Setup method called as constructor to set up thread-local storage for the
</span><span class="cx">  * thread id and the darwintrace socket.
</span><span class="cx">  */
</span><span class="lines">@@ -224,13 +152,6 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><del>- * Convenience getter function for the thread-local darwintrace socket
- */
-static inline FILE *__darwintrace_sock() {
-        return (FILE *) pthread_getspecific(sock_key);
-}
-
-/**
</del><span class="cx">  * Convenience getter function for the thread ID
</span><span class="cx">  */
</span><span class="cx"> static inline pthread_t __darwintrace_tid() {
</span><span class="lines">@@ -240,16 +161,6 @@
</span><span class="cx"> /**
</span><span class="cx">  * Convenience setter function for the thread-local darwintrace socket
</span><span class="cx">  */
</span><del>-static inline void __darwintrace_sock_set(FILE *stream) {
-        if (0 != (errno = pthread_setspecific(sock_key, stream))) {
-                perror(&quot;darwintrace: pthread_setspecific&quot;);
-                abort();
-        }
-}
-
-/**
- * Convenience setter function for the thread-local darwintrace socket
- */
</del><span class="cx"> static inline void __darwintrace_tid_set() {
</span><span class="cx">         if (0 != (errno = pthread_setspecific(tid_key, (const void *) pthread_self()))) {
</span><span class="cx">                 perror(&quot;darwintrace: pthread_setspecific&quot;);
</span><span class="lines">@@ -258,16 +169,16 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><del>- * Return 0 if str doesn't begin with prefix, 1 otherwise. Note that this is
- * not a simple string comparison, but works on a path component level.
</del><ins>+ * Return false if str doesn't begin with prefix, true otherwise. Note that
+ * this is not a simple string comparison, but works on a path component level.
</ins><span class="cx">  * A prefix of /var/tmp will not match a string of /var/tmpfoo.
</span><span class="cx">  */
</span><del>-static inline int __darwintrace_pathbeginswith(const char *str, const char *prefix) {
</del><ins>+static inline bool __darwintrace_pathbeginswith(const char *str, const char *prefix) {
</ins><span class="cx">         char s;
</span><span class="cx">         char p;
</span><span class="cx"> 
</span><span class="cx">         /* '/' is the allow all wildcard */
</span><del>-        if (strcmp(prefix, &quot;/&quot;) == 0) {
</del><ins>+        if (prefix[0] == '\0' || (prefix[0] == '/' &amp;&amp; prefix[1] == '\0')) {
</ins><span class="cx">                 return 1;
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="lines">@@ -275,132 +186,10 @@
</span><span class="cx">                 s = *str++;
</span><span class="cx">                 p = *prefix++;
</span><span class="cx">         } while (p &amp;&amp; (p == s));
</span><del>-        return (p == 0 &amp;&amp; (s == '/' || s == '\0'));
</del><ins>+        return (p == '\0' &amp;&amp; (s == '/' || s == '\0'));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-/**
- * Return 0 if str doesn't begin with prefix, 1 otherwise.
- */
-static inline int __darwintrace_strbeginswith(const char *str, const char *prefix) {
-        char s;
-        char p;
-        do {
-                s = *str++;
-                p = *prefix++;
-        } while (p &amp;&amp; (p == s));
-        return (p == 0);
-}
-
</del><span class="cx"> /*
</span><del>- * Copy the environment variables, if they're defined. This is run as
- * a constructor at startup.
- */
-static void __darwintrace_copy_env() {
-#define COPYENV(name, variable) \
-        if (NULL != (val = getenv(#name))) {\
-                if (NULL == (variable = strdup(val))) {\
-                        perror(&quot;darwintrace: strdup&quot;);\
-                        abort();\
-                }\
-        } else {\
-                variable = NULL;\
-        }
-
-        char *val;
-        COPYENV(DYLD_INSERT_LIBRARIES,     __env_dyld_insert_libraries)
-        COPYENV(DYLD_FORCE_FLAT_NAMESPACE, __env_dyld_force_flat_namespace)
-        COPYENV(DARWINTRACE_LOG,           __env_darwintrace_log)
-#undef COPYENV
-}
-
-/**
- * Allocate a X=Y string where X is the variable name and Y its value.
- * Return the new string.
- *
- * If the value is NULL, return NULL.
- */
-static inline char *__darwintrace_alloc_env(const char *name, const char *val) {
-        char *result = NULL;
-
-        if (val) {
-                size_t size = strlen(name) + strlen(val) + 2;
-                if (NULL == (result = malloc(size))) {
-                        perror(&quot;darwintrace: malloc&quot;);
-                        abort();
-                }
-                snprintf(result, size, &quot;%s=%s&quot;, name, val);
-                if (size &gt; 0) {
-                        result[size - 1] = '\0';
-                }
-        }
-
-        return result;
-}
-
-/**
- * This function checks that envp contains the global variables we had when the
- * library was loaded and modifies it if it doesn't.
- */
-static inline char *const *__darwintrace_restore_env(char *const envp[]) {
-        /* allocate the strings. */
-        /* we don't care about the leak here because we're going to call execve,
-         * which, if it succeeds, will get rid of our heap */
-        char *dyld_insert_libraries_ptr     = __darwintrace_alloc_env(&quot;DYLD_INSERT_LIBRARIES&quot;,     __env_dyld_insert_libraries);
-        char *dyld_force_flat_namespace_ptr = __darwintrace_alloc_env(&quot;DYLD_FORCE_FLAT_NAMESPACE&quot;, __env_dyld_force_flat_namespace);
-        char *darwintrace_log_ptr           = __darwintrace_alloc_env(&quot;DARWINTRACE_LOG&quot;,           __env_darwintrace_log);
-
-        char *const *enviter = envp;
-        size_t envlen = 0;
-        char **copy;
-        char **copyiter;
-
-        while (*enviter != NULL) {
-                envlen++;
-                enviter++;
-        }
-
-        /* 4 is sufficient for the three variables we copy and the terminator */
-        copy = malloc(sizeof(char *) * (envlen + 4));
-
-        enviter  = envp;
-        copyiter = copy;
-
-        while (*enviter != NULL) {
-                char *val = *enviter;
-                if (__darwintrace_strbeginswith(val, &quot;DYLD_INSERT_LIBRARIES=&quot;)) {
-                        val = dyld_insert_libraries_ptr;
-                        dyld_insert_libraries_ptr = NULL;
-                } else if (__darwintrace_strbeginswith(val, &quot;DYLD_FORCE_FLAT_NAMESPACE=&quot;)) {
-                        val = dyld_force_flat_namespace_ptr;
-                        dyld_force_flat_namespace_ptr = NULL;
-                } else if (__darwintrace_strbeginswith(val, &quot;DARWINTRACE_LOG=&quot;)) {
-                        val = darwintrace_log_ptr;
-                        darwintrace_log_ptr = NULL;
-                }
-
-                if (val) {
-                        *copyiter++ = val;
-                }
-
-                enviter++;
-        }
-
-        if (dyld_insert_libraries_ptr) {
-                *copyiter++ = dyld_insert_libraries_ptr;
-        }
-        if (dyld_force_flat_namespace_ptr) {
-                *copyiter++ = dyld_force_flat_namespace_ptr;
-        }
-        if (darwintrace_log_ptr) {
-                *copyiter++ = darwintrace_log_ptr;
-        }
-
-        *copyiter = 0;
-
-        return copy;
-}
-
-/*
</del><span class="cx">  * Data structures and functions to iterate over the filemap received from
</span><span class="cx">  * tracelib code.
</span><span class="cx">  */
</span><span class="lines">@@ -432,16 +221,13 @@
</span><span class="cx">  *
</span><span class="cx">  * \param[out] command location for the command specified for this filemap
</span><span class="cx">  *                     entry
</span><del>- * \param[out] replacement location for a replacement path, if any. This field
- *                         is only valid if the command field indicates
- *                         a replacement path is being used.
</del><span class="cx">  * \param[in]  it pointer to a \c filemap_iterator_t keeping the state of this
</span><span class="cx">  *                iteration
</span><span class="cx">  * \return string containing the path this filemap entry corresponds to, or \c
</span><span class="cx">  *         NULL if the end of the filemap was reached
</span><span class="cx">  */
</span><del>-static inline char *__darwintrace_filemap_iter(char *command, char **replacement, filemap_iterator_t *it) {
-        enum { PATH, COMMAND, REPLACEPATH, DONE } state = PATH;
</del><ins>+static inline char *__darwintrace_filemap_iter(char *command, filemap_iterator_t *it) {
+        enum { PATH, COMMAND, DONE } state = PATH;
</ins><span class="cx">         char *t;
</span><span class="cx">         char *path;
</span><span class="cx"> 
</span><span class="lines">@@ -459,31 +245,24 @@
</span><span class="cx">         while (state != DONE) {
</span><span class="cx">                 switch (state) {
</span><span class="cx">                         case DONE:
</span><del>-                                fprintf(stderr, &quot;darwintrace: illegal state in dfa in &quot; __FILE__ &quot;:%d\n&quot;, __LINE__);
-                                abort();
</del><ins>+                                /* unreachable */
</ins><span class="cx">                                 break;
</span><span class="cx">                         case PATH:
</span><del>-                                if (!*t) {
</del><ins>+                                if (*t == '\0') {
</ins><span class="cx">                                         state = COMMAND;
</span><span class="cx">                                 }
</span><span class="cx">                                 break;
</span><span class="cx">                         case COMMAND:
</span><span class="cx">                                 *command = *t;
</span><span class="cx">                                 if (*t == 1) {
</span><del>-                                        state = REPLACEPATH;
-                                        *replacement = t + 1;
-                                } else {
-                                        state = DONE;
-                                        /* the byte after the status code is 0, if the status
-                                         * code isn't 1 */
-                                        t++;
</del><ins>+                                        fprintf(stderr, &quot;darwintrace: unsupported state REPLACEPATH in dfa in &quot; __FILE__ &quot;:%d\n&quot;, __LINE__);
+                                        abort();
</ins><span class="cx">                                 }
</span><ins>+                                state = DONE;
+                                /* the byte after the status code is '\0', if the status code
+                                 * isn't 1 (which is no longer supported) */
+                                t++;
</ins><span class="cx">                                 break;
</span><del>-                        case REPLACEPATH:
-                                if (!*t) {
-                                        state = DONE;
-                                }
-                                break;
</del><span class="cx">                 }
</span><span class="cx">                 t++;
</span><span class="cx">         }
</span><span class="lines">@@ -500,11 +279,23 @@
</span><span class="cx">         char *newfilemap;
</span><span class="cx"> #if DARWINTRACE_DEBUG &amp;&amp; 0
</span><span class="cx">         filemap_iterator_t it;
</span><del>-        char *path, *replacement, command;
</del><ins>+        char *path, command;
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-#if __GNUC__ &amp;&amp; (__GNUC__ &lt; 4 || (__GNUC__ == 4 &amp;&amp; __GNUC_MINOR__ &lt; 2))
-#error Please build with gcc-4.2 or later
</del><ins>+#if defined(HAVE_OSATOMICCOMPAREANDSWAPPTR)
+#        define CAS(old, new, mem) OSAtomicCompareAndSwapPtr(old, new, (void * volatile *) (mem))
+#elif defined(__LP64__)
+#        ifdef HAVE_OSATOMICCOMPAREANDSWAP64
+#                define CAS(old, new, mem) OSAtomicCompareAndSwap64((int64_t) (old), (int64_t) (new), (volatile int64_t *) (mem))
+#        else
+#                error &quot;No 64-bit compare and swap primitive available on 64-bit OS.&quot;
+#        endif
+#else
+#        ifdef HAVE_OSATOMICCOMPAREANDSWAP32
+#                define CAS(old, new, mem) OSAtomicCompareAndSwap32((int32_t) (old), (int32_t) (new), (volatile int32_t *) (mem))
+#        else
+#                error &quot;No 32-bit compare and swap primitive available.&quot;
+#        endif
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">         /*
</span><span class="lines">@@ -521,12 +312,12 @@
</span><span class="cx">                 if (filemap != NULL)
</span><span class="cx">                         break;
</span><span class="cx">                 newfilemap = __send(&quot;filemap\t&quot;, (uint32_t) strlen(&quot;filemap\t&quot;), 1);
</span><del>-        } while (!__sync_bool_compare_and_swap(&amp;filemap, NULL, newfilemap));
</del><ins>+        } while (!CAS(NULL, newfilemap, &amp;filemap));
</ins><span class="cx"> 
</span><span class="cx"> #if DARWINTRACE_DEBUG &amp;&amp; 0
</span><span class="cx">         for (__darwintrace_filemap_iterator_init(&amp;it);
</span><del>-                (path = __darwintrace_filemap_iter(&amp;command, &amp;replacement, &amp;it));) {
-                debug_printf(&quot;filemap: {cmd=%d, path=%-120s, replacement=%s}\n&quot;, command, path, (command == 1) ? replacement : &quot;-&quot;);
</del><ins>+                (path = __darwintrace_filemap_iter(&amp;command, &amp;it));) {
+                debug_printf(&quot;filemap: {cmd=%d, path=%s}\n&quot;, command, path);
</ins><span class="cx">         }
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="lines">@@ -537,7 +328,7 @@
</span><span class="cx">  * library and this library prevents closing the socket to MacPorts, we use \c
</span><span class="cx">  * __darwintrace_close_sock to allow closing specific FDs.
</span><span class="cx">  */
</span><del>-static inline void __darwintrace_close() {
</del><ins>+void __darwintrace_close() {
</ins><span class="cx">         FILE *dtsock = __darwintrace_sock();
</span><span class="cx">         if (dtsock) {
</span><span class="cx">                 __darwintrace_close_sock = fileno(dtsock);
</span><span class="lines">@@ -553,7 +344,7 @@
</span><span class="cx">  * called after \c fork(2), i.e. when the current PID doesn't match the one
</span><span class="cx">  * stored when the function was called last.
</span><span class="cx">  */
</span><del>-static inline void __darwintrace_setup() {
</del><ins>+void __darwintrace_setup() {
</ins><span class="cx">         /*
</span><span class="cx">          * Check whether this is a child process and we've inherited the socket. We
</span><span class="cx">          * want to avoid race conditions with our parent process when communicating
</span><span class="lines">@@ -627,90 +418,62 @@
</span><span class="cx">  * \param[in] op the operation (sent as-is to tracelib, should be interpreted
</span><span class="cx">  *               as command)
</span><span class="cx">  * \param[in] path the (not necessarily absolute) path to send to tracelib
</span><del>- * \param[in] fd a FD to the file, or 0, if none available
</del><span class="cx">  */
</span><del>-static inline void __darwintrace_log_op(const char *op, const char *path, int fd) {
</del><ins>+static inline void __darwintrace_log_op(const char *op, const char *path) {
</ins><span class="cx">         uint32_t size;
</span><del>-        char somepath[MAXPATHLEN];
</del><ins>+        char pathbuf[MAXPATHLEN];
</ins><span class="cx">         char logbuffer[BUFFER_SIZE];
</span><ins>+        const char *realpath;
</ins><span class="cx"> 
</span><span class="cx">         do {
</span><del>-#       ifdef __APPLE__ /* Only Darwin has volfs and F_GETPATH */
-                if ((fd &gt; 0) &amp;&amp; (strncmp(path, &quot;/.vol/&quot;, 6) == 0)) {
-                        if (fcntl(fd, F_GETPATH, somepath) != -1) {
</del><ins>+#if defined(__APPLE__) &amp;&amp; defined(ATTR_CMN_FULLPATH) &amp;&amp; 0
+                if (false &amp;&amp; strncmp(path, &quot;/.vol/&quot;, 6) == 0) {
+                        // path in VOLFS, try to get inode -&gt; name lookup from
+                        // getattrlist(2).
+                        struct attrlist attrlist;
+                        attrlist.bitmapcount = ATTR_BIT_MAP_COUNT;
+                        attrlist.reserved = 0;
+                        attrlist.commonattr = ATTR_CMN_FULLPATH;
+                        attrlist.volattr = 0;
+                        attrlist.dirattr = 0;
+                        attrlist.fileattr = 0;
+                        attrlist.forkattr = 0;
+
+                        char attrbuf[sizeof(uint32_t) + sizeof(attrreference_t) + (PATH_MAX)];
+                        /*           attrlength         attrref_t for the name     UTF-8 name up to PATH_MAX chars */
+                        if (-1 == (getattrlist(path, &amp;attrlist, attrbuf, sizeof(attrbuf), FSOPT_NOFOLLOW))) {
+                                perror(&quot;darwintrace: getattrlist&quot;);
+                                // ignore and just print the /.vol/ path
+                        } else {
+                                attrreference_t *nameAttrRef = (attrreference_t *) (attrbuf + sizeof(uint32_t));
+                                strlcpy(pathbuf, ((char *) nameAttrRef) + nameAttrRef-&gt;attr_dataoffset, sizeof(pathbuf));
+                                realpath = pathbuf;
</ins><span class="cx">                                 break;
</span><span class="cx">                         }
</span><span class="cx">                 }
</span><del>-#       endif
</del><ins>+#endif
</ins><span class="cx"> 
</span><span class="cx">                 if (*path != '/') {
</span><del>-                        if (!getcwd(somepath, sizeof(somepath))) {
</del><ins>+                        if (!getcwd(pathbuf, sizeof(pathbuf))) {
</ins><span class="cx">                                 perror(&quot;darwintrace: getcwd&quot;);
</span><span class="cx">                                 abort();
</span><span class="cx">                         }
</span><span class="cx"> 
</span><del>-                        strlcat(somepath, &quot;/&quot;, sizeof(somepath));
-                        strlcat(somepath, path, sizeof(somepath));
</del><ins>+                        strlcat(pathbuf, &quot;/&quot;, sizeof(pathbuf));
+                        strlcat(pathbuf, path, sizeof(pathbuf));
+                        realpath = pathbuf;
</ins><span class="cx">                         break;
</span><span class="cx">                 }
</span><span class="cx"> 
</span><span class="cx">                 /* otherwise, just copy the original path. */
</span><del>-                strlcpy(somepath, path, sizeof(somepath));
</del><ins>+                realpath = path;
</ins><span class="cx">         } while (0);
</span><span class="cx"> 
</span><del>-        /* clean the path. */
-        __darwintrace_cleanup_path(somepath);
-
-        size = snprintf(logbuffer, sizeof(logbuffer), &quot;%s\t%s&quot;, op, somepath);
</del><ins>+        size = snprintf(logbuffer, sizeof(logbuffer), &quot;%s\t%s&quot;, op, realpath);
</ins><span class="cx">         __send(logbuffer, size, 0);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><del>- * remap resource fork access to the data fork.
- * do a partial realpath(3) to fix &quot;foo//bar&quot; to &quot;foo/bar&quot;
- */
-static inline void __darwintrace_cleanup_path(char *path) {
-        size_t pathlen;
-#   ifdef __APPLE__
-        size_t rsrclen;
-#   endif
-        char *dst, *src;
-        enum { SAWSLASH, NOTHING } state = NOTHING;
-
-        /* if this is a foo/..namedfork/rsrc, strip it off */
-        pathlen = strlen(path);
-        /* ..namedfork/rsrc is only on OS X */
-#   ifdef __APPLE__
-        rsrclen = strlen(_PATH_RSRCFORKSPEC);
-        if (pathlen &gt; rsrclen &amp;&amp; 0 == strcmp(path + pathlen - rsrclen, _PATH_RSRCFORKSPEC)) {
-                path[pathlen - rsrclen] = '\0';
-                pathlen -= rsrclen;
-        }
-#   endif
-
-        /* for each position in string, check if we're in a run of multiple
-         * slashes, and only emit the first one */
-        for (src = path, dst = path; *src; src++) {
-                if (state == SAWSLASH) {
-                        if (*src == '/') {
-                                /* consume it */
-                                continue;
-                        }
-                        state = NOTHING;
-                } else {
-                        if (*src == '/') {
-                                state = SAWSLASH;
-                        }
-                }
-                if (dst != src) {
-                        // if dst == src, avoid the copy operation
-                        *dst = *src;
-                }
-                dst++;
-        }
-}
-
-/**
</del><span class="cx">  * Check whether the port currently being installed declares a dependency on
</span><span class="cx">  * a given file. Communicates with MacPorts tracelib, which uses the registry
</span><span class="cx">  * database to answer this question. Returns 1, if a dependency was declared,
</span><span class="lines">@@ -721,14 +484,14 @@
</span><span class="cx">  * \return 1, if access should be granted, 0, if access should be denied, and
</span><span class="cx">  *         -1 if MacPorts doesn't know about the file.
</span><span class="cx">  */
</span><del>-static int dependency_check(char *path) {
-#define stat(y, z) syscall(SYS_stat, (y), (z))
</del><ins>+static int dependency_check(const char *path) {
+#define lstat(y, z) syscall(LSTATSYSNUM, (y), (z))
</ins><span class="cx">         char buffer[BUFFER_SIZE], *p;
</span><span class="cx">         uint32_t len;
</span><span class="cx">         int result = 0;
</span><span class="cx">         struct stat st;
</span><span class="cx"> 
</span><del>-        if (-1 == stat(path, &amp;st)) {
</del><ins>+        if (-1 == lstat(path, &amp;st)) {
</ins><span class="cx">                 return 1;
</span><span class="cx">         }
</span><span class="cx">         if (S_ISDIR(st.st_mode)) {
</span><span class="lines">@@ -759,14 +522,14 @@
</span><span class="cx">                 default:
</span><span class="cx">                         fprintf(stderr, &quot;darwintrace: unexpected answer from tracelib: '%c' (0x%x)\n&quot;, *p, *p);
</span><span class="cx">                         abort();
</span><del>-                        break;
</del><ins>+                        /*NOTREACHED*/
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         debug_printf(&quot;dependency_check: %s returned %d\n&quot;, path, result);
</span><span class="cx"> 
</span><span class="cx">         free(p);
</span><span class="cx">         return result;
</span><del>-#undef stat
</del><ins>+#undef lstat
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><span class="lines">@@ -813,7 +576,7 @@
</span><span class="cx">  * protocol and supports reading and returning an answer.
</span><span class="cx">  *
</span><span class="cx">  * \param[in] buf buffer to send to tracelib
</span><del>- * \param[in] size size of the buffer to send
</del><ins>+ * \param[in] len size of the buffer to send
</ins><span class="cx">  * \param[in] answer boolean indicating whether an answer is expected and
</span><span class="cx">  *                   should be returned
</span><span class="cx">  * \return allocated answer buffer. Callers should free this buffer. If an
</span><span class="lines">@@ -843,129 +606,68 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><del>- * Check a path against the current sandbox
</del><ins>+ * Check a fully normalized path against the current sandbox. Helper function
+ * for __darwintrace_is_in_sandbox; do not use directly.
</ins><span class="cx">  *
</span><del>- * \param[in] path the path to be checked; not necessarily absolute
- * \param[out] newpath buffer for a replacement path when redirection should
- *                     occur. Initialize the first byte with 0 before calling
- *                     this function. The buffer should be at least MAXPATHLEN
- *                     bytes large. If newpath[0] isn't 0 after the call,
- *                     redirection should occur and the path from newpath
- *                     should be used for the syscall instead.
- * \param[in] report If access to this path is being denied, report it as
- *                   sandbox violation. Set this to \c true for all operations
- *                   that read file contents. Set this to \c false for
- *                   operations that only check for the file's existance, e.g.,
- *                   reading a directory.
- * \return 1, if the file is within sandbox bounds, 0, if access should be denied
</del><ins>+ * \param[in] path the path to be checked; must be absolute and normalized.
+ * \param[in] flags A binary or combination of the following flags:
+ *                  - DT_REPORT: If access to this path is being denied, report
+ *                    it as sandbox violation. Set this for all operations that
+ *                    read file contents or check file attributes. Omit this
+ *                    flag for operations that might only attempt to access
+ *                    a file by chance, such as readdir(3).
+ *                  - DT_ALLOWDIR: Whether to always allow access if the given
+ *                    path references an existing directory. Set this for
+ *                    read operations such as stat(2), omit this for operations
+ *                    that modify directories like rmdir(2) and mkdir(2).
+ * \return \c true if the file is within sandbox bounds, \c false if access
+ *         should be denied
</ins><span class="cx">  */
</span><del>-static inline int __darwintrace_is_in_sandbox(const char *path, char *newpath, bool report) {
-        char *t, *_;
-        char *strpos, *normpos;
-        char lpath[MAXPATHLEN];
-        char normalizedpath[MAXPATHLEN];
</del><ins>+static inline bool __darwintrace_sandbox_check(const char *path, int flags) {
+#define lstat(x,y) syscall(LSTATSYSNUM, (x), (y))
</ins><span class="cx">         filemap_iterator_t filemap_it;
</span><ins>+
</ins><span class="cx">         char command;
</span><del>-        char *replacementpath;
</del><ins>+        char *t;
</ins><span class="cx"> 
</span><del>-        __darwintrace_setup();
-
-        if (!filemap) {
-                return 1;
</del><ins>+        if (path[0] == '/' &amp;&amp; path[1] == '\0') {
+                // Always allow access to /. Strange things start to happen if you deny this.
+                return true;
</ins><span class="cx">         }
</span><span class="cx"> 
</span><del>-        /* Make sure the path is absolute. */
-        if (*path == '/') {
-                strcpy(lpath, path);
-        } else {
-                if (getcwd(lpath, MAXPATHLEN - 1) == NULL) {
-                        perror(&quot;darwintrace: getcwd&quot;);
-                        abort();
</del><ins>+        if ((flags &amp; DT_ALLOWDIR) &gt; 0) {
+                struct stat st;
+                if (-1 != lstat(path, &amp;st) &amp;&amp; S_ISDIR(st.st_mode)) {
+                        return true;
</ins><span class="cx">                 }
</span><del>-                strlcat(lpath, &quot;/&quot;, MAXPATHLEN);
-                strlcat(lpath, path, MAXPATHLEN);
</del><span class="cx">         }
</span><span class="cx"> 
</span><del>-        /* Make sure the path is normalized. NOTE: Do _not_ use realpath(3) here.
-         * Doing so _will_ lead to problems. This is essentially a very simple
-         * re-implementation of realpath(3). */
-        normalizedpath[0] = '\0';
-        strpos = lpath + 1;
-        normpos = normalizedpath;
-        for (;;) {
-                char *curpos = strsep(&amp;strpos, &quot;/&quot;);
-                if (curpos == NULL) {
-                        /* reached the end of the path */
-                        break;
-                } else if (*curpos == '\0') {
-                        /* empty entry, ignore */
-                        continue;
-                } else if (strcmp(curpos, &quot;.&quot;) == 0) {
-                        /* no-op directory, ignore */
-                        continue;
-                } else if (strcmp(curpos, &quot;..&quot;) == 0) {
-                        /* walk up one directory */
-                        char *lastSep = strrchr(normalizedpath, '/');
-                        if (lastSep == NULL) {
-                                /* path is completely empty */
-                                normpos = normalizedpath;
-                                *normpos = '\0';
-                                continue;
-                        }
-                        /* remove last component by overwriting the slash with \0, update normpos */
-                        *lastSep = '\0';
-                        normpos = lastSep;
-                        continue;
-                }
-                /* default case: standard path, copy */
-                strcat(normpos, &quot;/&quot;);
-                normpos++;
-                strcat(normpos, curpos);
-        }
-        if (*normalizedpath == '\0') {
-                strcat(normalizedpath, &quot;/&quot;);
-        }
-
-        /* Iterate over the sandbox bounds and try to find a directive matching this path */
</del><ins>+        // Iterate over the sandbox bounds and try to find a directive matching this path
</ins><span class="cx">         for (__darwintrace_filemap_iterator_init(&amp;filemap_it);
</span><del>-                (t = __darwintrace_filemap_iter(&amp;command, &amp;replacementpath, &amp;filemap_it));) {
-                if (__darwintrace_pathbeginswith(normalizedpath, t)) {
-                        /* move t to the integer describing how to handle this match */
-                        t += strlen(t) + 1;
-                        switch (*t) {
</del><ins>+                (t = __darwintrace_filemap_iter(&amp;command, &amp;filemap_it));) {
+                if (__darwintrace_pathbeginswith(path, t)) {
+                        switch (command) {
</ins><span class="cx">                                 case FILEMAP_ALLOW:
</span><del>-                                        return 1;
-                                case FILEMAP_REDIR:
-                                        if (!newpath) {
-                                                return 0;
-                                        }
-                                        /* the redirected path starts right after the byte telling
-                                         * us we should redirect */
-                                        strcpy(newpath, t + 1);
-                                        _ = newpath + strlen(newpath);
-                                        /* append '/' if it's missing */
-                                        if (_[-1] != '/') {
-                                                *_++ = '/';
-                                        }
-                                        strcpy(_, normalizedpath);
-                                        return 1;
</del><ins>+                                        return true;
</ins><span class="cx">                                 case FILEMAP_ASK:
</span><del>-                                        /* ask the socket whether this file is OK */
-                                        switch (dependency_check(normalizedpath)) {
</del><ins>+                                        // ask the socket whether this file is OK
+                                        switch (dependency_check(path)) {
</ins><span class="cx">                                                 case 1:
</span><del>-                                                        return 1;
</del><ins>+                                                        return true;
</ins><span class="cx">                                                 case -1:
</span><del>-                                                        /* if the file isn't known to MacPorts, allow
-                                                         * access anyway, but report a sandbox violation.
-                                                         * TODO find a better solution */
-                                                        if (report)
-                                                                __darwintrace_log_op(&quot;sandbox_violation&quot;, normalizedpath, 0);
-                                                        return 1;
</del><ins>+                                                        // if the file isn't known to MacPorts, allow
+                                                        // access anyway, but report a sandbox violation.
+                                                        // TODO find a better solution
+                                                        if ((flags &amp; DT_REPORT) &gt; 0) {
+                                                                __darwintrace_log_op(&quot;sandbox_violation&quot;, path);
+                                                        }
+                                                        return true;
</ins><span class="cx">                                                 case 0:
</span><del>-                                                        /* file belongs to a foreign port, deny access */
-                                                        if (report)
-                                                                __darwintrace_log_op(&quot;sandbox_violation&quot;, normalizedpath, 0);
-                                                        return 0;
</del><ins>+                                                        // file belongs to a foreign port, deny access
+                                                        if ((flags &amp; DT_REPORT) &gt; 0) {
+                                                                __darwintrace_log_op(&quot;sandbox_violation&quot;, path);
+                                                        }
+                                                        return false;
</ins><span class="cx">                                         }
</span><span class="cx">                                 default:
</span><span class="cx">                                         fprintf(stderr, &quot;darwintrace: error: unexpected byte in file map: `%x'\n&quot;, *t);
</span><span class="lines">@@ -974,547 +676,251 @@
</span><span class="cx">                 }
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        if (report)
-                __darwintrace_log_op(&quot;sandbox_violation&quot;, normalizedpath, 0);
-        return 0;
</del><ins>+        if ((flags &amp; DT_REPORT) &gt; 0) {
+                __darwintrace_log_op(&quot;sandbox_violation&quot;, path);
+        }
+        return false;
+#undef lstat
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-/* wrapper for open(2) preventing opening files outside the sandbox */
-int open(const char *path, int flags, ...) {
-#define open(x,y,z) syscall(SYS_open, (x), (y), (z))
-        mode_t mode;
-        va_list args;
-        char newpath[MAXPATHLEN];
-
-        debug_printf(&quot;open(%s)\n&quot;, path);
-
-        *newpath = '\0';
-        if (!__darwintrace_is_in_sandbox(path, newpath, true)) {
-                debug_printf(&quot;open %s was forbidden\n&quot;, path);
-                errno = ((flags &amp; O_CREAT) &gt; 0) ? EACCES : ENOENT;
-                return -1;
</del><ins>+/**
+ * Check a path against the current sandbox
+ *
+ * \param[in] path the path to be checked; not necessarily absolute
+ * \param[in] flags A binary or combination of the following flags:
+ *                  - DT_REPORT: If access to this path is being denied, report
+ *                    it as sandbox violation. Set this for all operations that
+ *                    read file contents or check file attributes. Omit this
+ *                    flag for operations that might only attempt to access
+ *                    a file by chance, such as readdir(3).
+ *                  - DT_ALLOWDIR: Whether to always allow access if the given
+ *                    path references an existing directory. Set this for
+ *                    read operations such as stat(2), omit this for operations
+ *                    that modify directories like rmdir(2) and mkdir(2).
+ * \return \c true if the file is within sandbox bounds, \c false if access
+ *         should be denied
+ */
+bool __darwintrace_is_in_sandbox(const char *path, int flags) {
+#define lstat(x, y) syscall(LSTATSYSNUM, (x), (y))
+#define readlink(x,y,z) syscall(SYS_readlink, (x), (y), (z))
+        if (!filemap) {
+                return true;
</ins><span class="cx">         }
</span><span class="cx"> 
</span><del>-        if (*newpath) {
-                path = newpath;
-        }
</del><ins>+        typedef struct {
+                char *start;
+                size_t len;
+        } path_component_t;
</ins><span class="cx"> 
</span><del>-        /* Why mode here ? */
-        va_start(args, flags);
-        mode = va_arg(args, int);
-        va_end(args);
</del><ins>+        char normPath[MAXPATHLEN];
+        normPath[0] = '/';
+        normPath[1] = '\0';
</ins><span class="cx"> 
</span><del>-        return open(path, flags, mode);
-#undef open
-}
</del><ins>+        path_component_t pathComponents[MAXPATHLEN / 2 + 2];
+        size_t numComponents = 0;
</ins><span class="cx"> 
</span><del>-/* Log calls to readlink(2) into the file specified by DARWINTRACE_LOG.
-   Only logs if the DARWINTRACE_LOG environment variable is set.
-   Only logs files where the readlink succeeds.
-*/
-#ifdef READLINK_IS_NOT_P1003_1A
-int readlink(const char *path, char *buf, int bufsiz) {
-#else
-ssize_t readlink(const char *path, char *buf, size_t bufsiz) {
-#endif
-#define readlink(x,y,z) syscall(SYS_readlink, (x), (y), (z))
-        char newpath[MAXPATHLEN];
-
-        debug_printf(&quot;readlink(%s)\n&quot;, path);
-
-        *newpath = '\0';
-        if (!__darwintrace_is_in_sandbox(path, newpath, true)) {
-                errno = ENOENT;
-                return -1;
</del><ins>+        // Make sure the path is absolute.
+        if (path == NULL || *path == '\0') {
+                // this is most certainly invalid, let the syscall deal with it
+                return true;
</ins><span class="cx">         }
</span><span class="cx"> 
</span><del>-        if (*newpath) {
-                path = newpath;
-        }
</del><ins>+        char *dst = NULL;
+        const char *token = NULL;
+        size_t idx;
+        if (*path != '/') {
+                // The path isn't absolute, start by populating pathcomponents with the
+                // current working directory
+                if (getcwd(normPath, sizeof(normPath)) == NULL) {
+                        perror(&quot;darwintrace: getcwd&quot;);
+                        abort();
+                }
</ins><span class="cx"> 
</span><del>-        return readlink(path, buf, bufsiz);
-#undef readlink
-}
</del><ins>+                char *writableToken = normPath + 1;
+                while ((idx = strcspn(writableToken, &quot;/&quot;)) &gt; 0) {
+                        // found a token, tokenize and store it
+                        pathComponents[numComponents].start = writableToken;
+                        pathComponents[numComponents].len   = idx;
+                        numComponents++;
</ins><span class="cx"> 
</span><del>-int execve(const char *path, char *const argv[], char *const envp[]) {
-#define execve(x,y,z) syscall(SYS_execve, (x), (y), (z))
-#define open(x,y,z) syscall(SYS_open, (x), (y), (z))
-#define close(x) syscall(SYS_close, (x))
-#define lstat(x, y) syscall(SYS_lstat, (x), (y))
-        debug_printf(&quot;execve(%s)\n&quot;, path);
-        __darwintrace_setup();
-        struct stat sb;
-        /* for symlinks, we want to capture both the original path and the modified
-         * one, since for $prefix/bin/gcc -&gt; mp-gcc-4.8, both &quot;gcc_select&quot; and
-         * &quot;gcc48&quot; are contributors. This requires changes to the select code such
-         * that the symlinks are registered to the *_select ports. Since this
-         * a general problem (when executing $prefix/libexec/mysql/bin/foo where
-         * $prefix/libexec/mysql is a symlink to $prefix/libexec/mysql55, the
-         * mysql_select port needs to be a contributor!) we should really implement
-         * this in __darwintrace_is_in_sandbox().
-         */
-        if (lstat(path, &amp;sb) == 0) {
-                if (!__darwintrace_is_in_sandbox(path, NULL, true)) {
-                        errno = ENOENT;
-                        return -1;
</del><ins>+                        bool final = writableToken[idx] == '\0';
+                        writableToken[idx] = '\0';
+                        if (final) {
+                                break;
+                        }
+                        // advance token
+                        writableToken += idx + 1;
</ins><span class="cx">                 }
</span><span class="cx"> 
</span><del>-                int fd = open(path, O_RDONLY, 0);
-                if (fd &gt; 0) {
-                        char buffer[MAXPATHLEN + 1];
-                        ssize_t bytes_read;
</del><ins>+                // copy path after the CWD into the buffer and normalize it
+                if (numComponents &gt; 0) {
+                        path_component_t *lastComponent = pathComponents + (numComponents - 1);
+                        dst = lastComponent-&gt;start + lastComponent-&gt;len + 1;
+                } else {
+                        dst = normPath + 1;
+                }
</ins><span class="cx"> 
</span><del>-                        /* Read the file for the interpreter. Fortunately, on OS X:
-                         *   The system guarantees to read the number of bytes requested if
-                         *   the descriptor references a normal file that has that many
-                         *   bytes left before the end-of-file, but in no other case.
-                         * That _does_ save us another ugly loop to get things right. */
-                        bytes_read = read(fd, buffer, MAXPATHLEN);
-                        buffer[bytes_read] = '\0';
-                        const char *buffer_end = buffer + bytes_read;
-                        if (bytes_read &gt; 2 &amp;&amp; buffer[0] == '#' &amp;&amp; buffer[1] == '!') {
-                                char *interp = buffer + 2;
</del><ins>+                // continue parsing at the begin of path
+                token = path;
+        } else {
+                // skip leading '/'
+                dst = normPath + 1;
+                *dst = '\0';
+                token = path + 1;
+        }
</ins><span class="cx"> 
</span><del>-                                /* skip past leading whitespace */
-                                while (interp &lt; buffer_end &amp;&amp; isblank(*interp)) {
-                                        ++interp;
-                                }
-                                /* found interpreter (or ran out of data); skip until next
-                                 * whitespace, then terminate the string */
-                                if (interp &lt; buffer_end) {
-                                        char *interp_end = interp;
-                                        strsep(&amp;interp_end, &quot; \t&quot;);
-                                }
</del><ins>+        /* Make sure the path is normalized. NOTE: Do _not_ use realpath(3) here.
+         * Doing so _will_ lead to problems. This is essentially a very simple
+         * re-implementation of realpath(3). */
+        while ((idx = strcspn(token, &quot;/&quot;)) &gt; 0) {
+                // found a token, process it
</ins><span class="cx"> 
</span><del>-                                /* check the iterpreter against the sandbox */
-                                if (!__darwintrace_is_in_sandbox(interp, NULL, true)) {
-                                        close(fd);
-                                        errno = ENOENT;
-                                        return -1;
</del><ins>+                if (token[0] == '\0' || token[0] == '/') {
+                        // empty entry, ignore
+                } else if (token[0] == '.' &amp;&amp; (token[1] == '\0' || token[1] == '/')) {
+                        // reference to current directory, ignore
+                } else if (token[0] == '.' &amp;&amp; token[1] == '.' &amp;&amp; (token[2] == '\0' || token[2] == '/')) {
+                        // walk up one directory, but not if it's the last one, because /.. -&gt; /
+                        if (numComponents &gt; 0) {
+                                numComponents--;
+                                if (numComponents &gt; 0) {
+                                        // move dst back to the previous entry
+                                        path_component_t *lastComponent = pathComponents + (numComponents - 1);
+                                        dst = lastComponent-&gt;start + lastComponent-&gt;len + 1;
+                                } else {
+                                        // we're at the top, move dst back to the beginning
+                                        dst = normPath + 1;
</ins><span class="cx">                                 }
</span><span class="cx">                         }
</span><ins>+                } else {
+                        // copy token to normPath buffer (and null-terminate it)
+                        strlcpy(dst, token, idx + 1);
+                        dst[idx] = '\0';
+                        // add descriptor entry for new token
+                        pathComponents[numComponents].start = dst;
+                        pathComponents[numComponents].len   = idx;
+                        numComponents++;
</ins><span class="cx"> 
</span><del>-                        close(fd);
</del><ins>+                        // advance destination
+                        dst += idx + 1;
+                }
</ins><span class="cx"> 
</span><ins>+                if (token[idx] == '\0') {
+                        break;
</ins><span class="cx">                 }
</span><ins>+                token += idx + 1;
</ins><span class="cx">         }
</span><span class="cx"> 
</span><del>-        /* our variables won't survive exec, clean up */
-        __darwintrace_close();
-        __darwintrace_pid = (pid_t) - 1;
</del><ins>+        bool pathIsSymlink;
+        size_t loopCount = 0;
+        do {
+                pathIsSymlink = false;
</ins><span class="cx"> 
</span><del>-        /* call the original execve function, but fix the environment if required. */
-        return execve(path, argv, __darwintrace_restore_env(envp));
-#undef lstat
-#undef close
-#undef open
-#undef execve
-}
-
-/* if darwintrace has been initialized, trap attempts to close our file
- * descriptor */
-int close(int fd) {
-#define close(x) syscall(SYS_close, (x))
-        FILE *stream = __darwintrace_sock();
-        if (stream) {
-                int dtsock = fileno(stream);
-                if (fd == dtsock &amp;&amp; dtsock != __darwintrace_close_sock) {
-                        errno = EBADF;
-                        return -1;
</del><ins>+                // Add the slashes and the terminating \0
+                for (size_t i = 0; i &lt; numComponents; ++i) {
+                        if (i == numComponents - 1) {
+                                pathComponents[i].start[pathComponents[i].len] = '\0';
+                        } else {
+                                pathComponents[i].start[pathComponents[i].len] = '/';
+                        }
</ins><span class="cx">                 }
</span><del>-        }
</del><span class="cx"> 
</span><del>-        return close(fd);
-#undef close
-}
-
-/* if darwintrace has been initialized, trap attempts to dup2 over our file descriptor */
-int dup2(int filedes, int filedes2) {
-#define dup2(x, y) syscall(SYS_dup2, (x), (y))
-        FILE *stream = __darwintrace_sock();
-
-        debug_printf(&quot;dup2(%d, %d)\n&quot;, filedes, filedes2);
-        if (stream &amp;&amp; filedes2 == fileno(stream)) {
-                /* if somebody tries to close our file descriptor, just move it out of
-                 * the way. Make sure it doesn't end up as stdin/stdout/stderr, though!
-                 * */
-                int new_darwintrace_fd;
-                FILE *new_stream;
-
-                if (-1 == (new_darwintrace_fd = fcntl(fileno(stream), F_DUPFD, STDOUT_FILENO + 1))) {
-                        /* if duplicating fails, do not allow overwriting either! */
-                        return -1;
</del><ins>+                if ((flags &amp; DT_FOLLOWSYMS) == 0) {
+                        // only expand symlinks when the DT_FOLLOWSYMS flags is set;
+                        // otherwise just ignore whether this path is a symlink or not to
+                        // speed up readdir(3).
+                        break;
</ins><span class="cx">                 }
</span><span class="cx"> 
</span><del>-                debug_printf(&quot;moving __darwintrace FD from %d to %d\n&quot;, fileno(stream), new_darwintrace_fd);
-                __darwintrace_close();
-                if (NULL == (new_stream = fdopen(new_darwintrace_fd, &quot;a+&quot;))) {
-                        perror(&quot;darwintrace: fdopen&quot;);
-                        abort();
</del><ins>+                if (++loopCount &gt;= 10) {
+                        // assume cylce and let the OS deal with that (yes, this actually
+                        // happens in software!)
+                        break;
</ins><span class="cx">                 }
</span><del>-                __darwintrace_sock_set(new_stream);
-        }
</del><span class="cx"> 
</span><del>-        return dup2(filedes, filedes2);
-#undef dup2
-}
-
-/* Trap attempts to unlink a file outside the sandbox. */
-int unlink(const char *path) {
-#define __unlink(x) syscall(SYS_unlink, (x))
-        char newpath[MAXPATHLEN];
-
-        *newpath = '\0';
-        if (!__darwintrace_is_in_sandbox(path, newpath, true)) {
-                debug_printf(&quot;unlink %s was forbidden\n&quot;, path);
-                errno = ENOENT;
-                return -1;
-        }
-
-        if (*newpath) {
-                path = newpath;
-        }
-
-        debug_printf(&quot;unlink %s was allowed\n&quot;, path);
-
-        return __unlink(path);
-}
-
-/* Trap attempts to create directories outside the sandbox.
- */
-int mkdir(const char *path, mode_t mode) {
-#define __mkdir(x,y) syscall(SYS_mkdir, (x), (y))
-        char newpath[MAXPATHLEN];
-
-        *newpath = '\0';
-        if (!__darwintrace_is_in_sandbox(path, newpath, true)) {
</del><ins>+                // Check whether the last component is a symlink; if it is, check
+                // whether it is in the sandbox, expand it and do the same thing again.
</ins><span class="cx">                 struct stat st;
</span><del>-                if (-1 == lstat(path, &amp;st)) {
-                        if (errno == ENOENT) {
-                                /* directory doesn't exist yet */
-                                debug_printf(&quot;mkdir was forbidden at %s\n&quot;, path);
-                                errno = EACCES;
-                                return -1;
</del><ins>+                //debug_printf(&quot;checking for symlink: %s\n&quot;, normPath);
+                if (lstat(normPath, &amp;st) != -1 &amp;&amp; S_ISLNK(st.st_mode)) {
+                        if (!__darwintrace_sandbox_check(normPath, flags)) {
+                                return false;
</ins><span class="cx">                         }
</span><del>-                }
-                /* otherwise, mkdir will do nothing or fail with a hopefully meaningful
-                 * error */
-        } else {
-                if (*newpath) {
-                        path = newpath;
-                }
</del><span class="cx"> 
</span><del>-                debug_printf(&quot;mkdir was allowed at %s\n&quot;, path);
-        }
</del><ins>+                        char link[MAXPATHLEN];
+                        pathIsSymlink = true;
</ins><span class="cx"> 
</span><del>-        return __mkdir(path, mode);
-}
</del><ins>+                        ssize_t linksize;
+                        if (-1 == (linksize = readlink(normPath, link, sizeof(link)))) {
+                                perror(&quot;darwintrace: readlink&quot;);
+                                abort();
+                        }
+                        link[linksize] = '\0';
+                        //debug_printf(&quot;readlink(%s) = %s\n&quot;, normPath, link);
</ins><span class="cx"> 
</span><del>-/* Trap attempts to remove directories outside the sandbox.
- */
-int rmdir(const char *path) {
-#define __rmdir(x) syscall(SYS_rmdir, (x))
-        if (!__darwintrace_is_in_sandbox(path, NULL, true)) {
-                debug_printf(&quot;removing directory %s was forbidden\n&quot;, path);
-                errno = ENOENT;
-                return -1;
-        }
</del><ins>+                        if (*link == '/') {
+                                // symlink is absolute, start fresh
+                                numComponents = 0;
+                                token = link + 1;
+                                dst = normPath + 1;
+                        } else {
+                                // symlink is relative, remove last component
+                                token = link;
+                                if (numComponents &gt; 0) {
+                                        numComponents--;
+                                        if (numComponents &gt; 0) {
+                                                // move dst back to the previous entry
+                                                path_component_t *lastComponent = pathComponents + (numComponents - 1);
+                                                dst = lastComponent-&gt;start + lastComponent-&gt;len + 1;
+                                        } else {
+                                                // we're at the top, move dst back to the beginning
+                                                dst = normPath + 1;
+                                        }
+                                }
+                        }
</ins><span class="cx"> 
</span><del>-        debug_printf(&quot;rmdir %s was allowed\n&quot;, path);
</del><ins>+                        while ((idx = strcspn(token, &quot;/&quot;)) &gt; 0) {
+                                // found a token, process it
</ins><span class="cx"> 
</span><del>-        return __rmdir(path);
-}
</del><ins>+                                if (token[0] == '\0' || token[0] == '/') {
+                                        // empty entry, ignore
+                                } else if (token[0] == '.' &amp;&amp; (token[1] == '\0' || token[1] == '/')) {
+                                        // reference to current directory, ignore
+                                } else if (token[0] == '.' &amp;&amp; token[1] == '.' &amp;&amp; (token[2] == '\0' || token[2] == '/')) {
+                                        // walk up one directory, but not if it's the last one, because /.. -&gt; /
+                                        if (numComponents &gt; 0) {
+                                                numComponents--;
+                                                if (numComponents &gt; 0) {
+                                                        // move dst back to the previous entry
+                                                        path_component_t *lastComponent = pathComponents + (numComponents - 1);
+                                                        dst = lastComponent-&gt;start + lastComponent-&gt;len + 1;
+                                                } else {
+                                                        // we're at the top, move dst back to the beginning
+                                                        dst = normPath + 1;
+                                                }
+                                        }
+                                } else {
+                                        // copy token to normPath buffer
+                                        strlcpy(dst, token, idx + 1);
+                                        dst[idx] = '\0';
+                                        // add descriptor entry for new token
+                                        pathComponents[numComponents].start = dst;
+                                        pathComponents[numComponents].len   = idx;
+                                        numComponents++;
</ins><span class="cx"> 
</span><del>-/* Trap attempts to rename files/directories outside the sandbox.
- */
-int rename(const char *from, const char *to) {
-#define __rename(x,y) syscall(SYS_rename, (x), (y))
-        if (!__darwintrace_is_in_sandbox(from, NULL, true)) {
-                /* outside sandbox, forbid */
-                debug_printf(&quot;renaming from %s was forbidden\n&quot;, from);
-                errno = ENOENT;
-                return -1;
-        }
-        if (!__darwintrace_is_in_sandbox(to, NULL, true)) {
-                debug_printf(&quot;renaming to %s was forbidden\n&quot;, to);
-                errno = EACCES;
-                return -1;
-        }
</del><ins>+                                        // advance destination
+                                        dst += idx + 1;
+                                }
</ins><span class="cx"> 
</span><del>-        debug_printf(&quot;renaming from %s to %s was allowed\n&quot;, from, to);
-
-        return __rename(from, to);
-}
-
-int stat(const char *path, struct stat *sb) {
-#define stat(path, sb) syscall(SYS_stat, path, sb)
-        int result = 0;
-        char newpath[MAXPATHLEN];
-
-        debug_printf(&quot;stat(%s)\n&quot;, path);
-        if (-1 == (result = stat(path, sb))) {
-                return -1;
-        }
-
-        if (S_ISDIR(sb-&gt;st_mode)) {
-                return result;
-        }
-
-        *newpath = '\0';
-        if (!__darwintrace_is_in_sandbox(path, newpath, true)) {
-                errno = ENOENT;
-                return -1;
-        }
-
-        if (*newpath) {
-                result = stat(newpath, sb);
-        }
-
-        return result;
-#undef stat
-}
-
-#if defined(__DARWIN_64_BIT_INO_T) &amp;&amp; !defined(_DARWIN_FEATURE_ONLY_64_BIT_INODE)
-
-int stat64(const char *path, struct stat64 *sb) {
-#define stat64(path, sb) syscall(SYS_stat64, path, sb)
-        int result = 0;
-        char newpath[MAXPATHLEN];
-
-        debug_printf(&quot;stat64(%s)\n&quot;, path);
-        if (-1 == (result = stat64(path, sb))) {
-                return -1;
-        }
-
-        if (S_ISDIR(sb-&gt;st_mode)) {
-                return result;
-        }
-
-        *newpath = '\0';
-        if (!__darwintrace_is_in_sandbox(path, newpath, true)) {
-                errno = ENOENT;
-                return -1;
-        }
-
-        if (*newpath) {
-                result = stat64(newpath, sb);
-        }
-
-        return result;
-#undef stat64
-}
-
-int stat$INODE64(const char *path, struct stat64 *sb) {
-        return stat64(path, sb);
-}
-
-#endif /* defined(__DARWIN_64_BIT_INO_T) &amp;&amp; !defined(_DARWIN_FEATURE_ONLY_64_BIT_INODE) */
-
-
-int lstat(const char *path, struct stat *sb) {
-#define lstat(path, sb) syscall(SYS_lstat, path, sb)
-        int result = 0;
-        char newpath[MAXPATHLEN];
-
-        debug_printf(&quot;lstat(%s)\n&quot;, path);
-        if (-1 == (result = lstat(path, sb))) {
-                return -1;
-        }
-
-        if (S_ISDIR(sb-&gt;st_mode)) {
-                return result;
-        }
-
-        *newpath = '\0';
-        if (!__darwintrace_is_in_sandbox(path, newpath, true)) {
-                errno = ENOENT;
-                return -1;
-        }
-
-        if (*newpath) {
-                result = lstat(newpath, sb);
-        }
-
-        return result;
-#undef lstat
-}
-
-#if defined(__DARWIN_64_BIT_INO_T) &amp;&amp; !defined(_DARWIN_FEATURE_ONLY_64_BIT_INODE)
-
-int lstat64(const char *path, struct stat64 *sb) {
-#define lstat64(path, sb) syscall(SYS_lstat64, path, sb)
-        int result = 0;
-        char newpath[MAXPATHLEN];
-
-        debug_printf(&quot;lstat64(%s)\n&quot;, path);
-        if (-1 == (result = lstat64(path, sb))) {
-                return -1;
-        }
-
-        if (S_ISDIR(sb-&gt;st_mode)) {
-                return result;
-        }
-
-        *newpath = '\0';
-        if (!__darwintrace_is_in_sandbox(path, newpath, true)) {
-                errno = ENOENT;
-                return -1;
-        }
-
-        if (*newpath) {
-                result = lstat64(newpath, sb);
-        }
-
-        return result;
-#undef lstat64
-}
-
-int lstat$INODE64(const char *path, struct stat64 *sb) {
-        return lstat64(path, sb);
-}
-
-#endif /* defined(__DARWIN_64_BIT_INO_T) &amp;&amp; !defined(_DARWIN_FEATURE_ONLY_64_BIT_INODE) */
-
-/**
- * re-implementation of getdirent(2) and __getdirent64(2) preventing paths
- * outside the sandbox to show up when reading the contents of a directory.
- * Unfortunately, since we need to access the contents of the buffer, but the
- * contents differ by architecture, we can not rely on the dirent structure
- * defined by the header included by this program, because we don't know
- * whether darwintrace.dylib has been compiled for 64bit or 32bit inodes. We
- * thus copy both structs and decide at runtime.
- */
-
-#ifdef __APPLE__
-/* only do this on mac, because fcntl(fd, F_GETPATH) might not be available on
- * other systems, and because other system's syscall names are probably
- * different anyway */
-
-#if defined(__DARWIN_64_BIT_INO_T)
-
-struct dirent64  {
-        __uint64_t  d_ino;      /* file number of entry */
-        __uint64_t  d_seekoff;  /* seek offset */
-        __uint16_t  d_reclen;   /* length of this record */
-        __uint16_t  d_namlen;   /* length of string in d_name */
-        __uint8_t   d_type;     /* file type */
-        char      d_name[__DARWIN_MAXPATHLEN]; /* entry name (up to MAXPATHLEN bytes) */
-};
-
-size_t __getdirentries64(int fd, void *buf, size_t bufsize, __darwin_off_t *basep) {
-#define __getdirentries64(w,x,y,z) syscall(SYS_getdirentries64, (w), (x), (y), (z))
-        size_t sz = __getdirentries64(fd, buf, bufsize, basep);
-        char dirname[MAXPATHLEN];
-        size_t dnamelen;
-
-        if (-1 == fcntl(fd, F_GETPATH, dirname)) {
-                errno = EBADF;
-                return -1;
-        }
-
-        dnamelen = strlen(dirname);
-        if (dirname[dnamelen - 1] != '/') {
-                dirname[dnamelen] = '/';
-                dirname[dnamelen + 1] = '\0';
-                dnamelen++;
-        }
-
-        dnamelen = strlen(dirname);
-        size_t offset;
-        for (offset = 0; offset &lt; sz;) {
-                struct dirent64 *dent = (struct dirent64 *)(((char *) buf) + offset);
-                dirname[dnamelen] = '\0';
-                strcat(dirname, dent-&gt;d_name);
-                if (!__darwintrace_is_in_sandbox(dirname, NULL, false)) {
-                        debug_printf(&quot;__getdirentries64: filtered %s\n&quot;, dirname);
-                        dent-&gt;d_ino = 0;
-                } else {
-                        debug_printf(&quot;__getdirentries64:  allowed %s\n&quot;, dirname);
</del><ins>+                                if (token[idx] == '\0') {
+                                        break;
+                                }
+                                token += idx + 1;
+                        }
</ins><span class="cx">                 }
</span><del>-                offset += dent-&gt;d_reclen;
-        }
</del><ins>+        } while (pathIsSymlink);
</ins><span class="cx"> 
</span><del>-        return sz;
-#undef __getdirentries64
-}
-
-#endif /* defined(__DARWIN_64_BIT_INO_T) */
-
-#pragma pack(4)
-struct dirent32 {
-        ino_t d_ino;            /* file number of entry */
-        __uint16_t d_reclen;    /* length of this record */
-        __uint8_t  d_type;      /* file type */
-        __uint8_t  d_namlen;    /* length of string in d_name */
-        char d_name[__DARWIN_MAXNAMLEN + 1]; /* name must be no longer than this */
-};
-#pragma pack()
-
-int getdirentries(int fd, char *buf, int nbytes, long *basep) {
-#define getdirentries(w,x,y,z) syscall(SYS_getdirentries, (w), (x), (y), (z))
-        size_t sz = getdirentries(fd, buf, nbytes, basep);
-        char dirname[MAXPATHLEN];
-        size_t dnamelen;
-
-        if (-1 == fcntl(fd, F_GETPATH, dirname)) {
-                errno = EBADF;
-                return 0;
-        }
-
-        dnamelen = strlen(dirname);
-        if (dirname[dnamelen - 1] != '/') {
-                dirname[dnamelen] = '/';
-                dirname[dnamelen + 1] = '\0';
-                dnamelen++;
-        }
-
-        size_t offset;
-        for (offset = 0; offset &lt; sz;) {
-                struct dirent32 *dent = (struct dirent32 *)(buf + offset);
-                dirname[dnamelen] = '\0';
-                strcat(dirname, dent-&gt;d_name);
-                if (!__darwintrace_is_in_sandbox(dirname, NULL, false)) {
-                        debug_printf(&quot;getdirentries: filtered %s\n&quot;, dirname);
-                        dent-&gt;d_ino = 0;
-                } else {
-                        debug_printf(&quot;getdirentries:  allowed %s\n&quot;, dirname);
-                }
-                offset += dent-&gt;d_reclen;
-        }
-
-        return sz;
-#undef getdirentries
-}
-
-int access(const char *path, int amode) {
-#define access(x, y) syscall(SYS_access, (x), (y))
-#define lstat(path, sb) syscall(SYS_lstat, path, sb)
-        struct stat st;
-        char newpath[MAXPATHLEN];
-
-        debug_printf(&quot;access(%s, %d)\n&quot;, path, amode);
-
-        if (-1 == lstat(path, &amp;st)) {
-                return -1;
-        }
-
-        if (S_ISDIR(st.st_mode)) {
-                return access(path, amode);
-        }
-
-        *newpath = '\0';
-        if (!__darwintrace_is_in_sandbox(path, newpath, true)) {
-                errno = ENOENT;
-                return -1;
-        }
-
-        if (*newpath) {
-                return access(newpath, amode);
-        }
-
-        return access(path, amode);
</del><ins>+        return __darwintrace_sandbox_check(normPath, flags);
+#undef readlink
</ins><span class="cx"> #undef lstat
</span><del>-#undef access
</del><span class="cx"> }
</span><del>-
-#endif /* __APPLE__ */
</del></span></pre></div>
<a id="branchesnewhelpsystembasesrcdarwintracelib10darwintracehfromrev117083trunkbasesrcdarwintracelib10darwintraceh"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/src/darwintracelib1.0/darwintrace.h (from rev 117083, trunk/base/src/darwintracelib1.0/darwintrace.h) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/darwintracelib1.0/darwintrace.h                                (rev 0)
+++ branches/new-help-system/base/src/darwintracelib1.0/darwintrace.h        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,171 @@
</span><ins>+/*
+ * Copyright (c) 2005 Apple Inc. All rights reserved.
+ * Copyright (c) 2005-2006 Paul Guyot &lt;pguyot@kallisys.net&gt;,
+ * All rights reserved.
+ * Copyright (c) 2006-2013 The MacPorts Project
+ *
+ * $Id$
+ *
+ * @APPLE_BSD_LICENSE_HEADER_START@
+ *
+ * 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 Inc. (&quot;Apple&quot;) 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 APPLE AND ITS CONTRIBUTORS &quot;AS IS&quot; 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 APPLE OR ITS 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.
+ *
+ * @APPLE_BSD_LICENSE_HEADER_END@
+ */
+
+#ifdef HAVE_CONFIG_H
+#include &lt;config.h&gt;
+#endif
+
+#include &lt;pthread.h&gt;
+#include &lt;stdbool.h&gt;
+#include &lt;stdio.h&gt;
+
+/**
+ * DARWINTRACE_DEBUG: verbose output of operations to debug darwintrace
+ */
+#ifndef DARWINTRACE_DEBUG
+#define DARWINTRACE_DEBUG (0)
+#endif
+
+/**
+ * \c debug_printf() is a macro that will print a message prefixed with
+ * &quot;darwintrace&quot; and the calling process' PID to stderr, or to the file
+ * indicated by the environment variable \c DARWINTRACE_DEBUG, if set.
+ */
+#if DARWINTRACE_DEBUG
+#        define debug_printf(format, ...) \
+                if (__darwintrace_stderr != NULL) { \
+                        fprintf(__darwintrace_stderr, &quot;darwintrace[%d:%p]: &quot; format, getpid(), (void *) pthread_self(), __VA_ARGS__); \
+                        fflush(__darwintrace_stderr); \
+                }
+#else
+#   define debug_printf(...)
+#endif
+
+enum {
+        DT_REPORT     = 1 &lt;&lt; 0,
+        DT_ALLOWDIR   = 1 &lt;&lt; 1,
+        DT_FOLLOWSYMS = 1 &lt;&lt; 2
+};
+
+/**
+ * Debug socket. Will be set by a constructor function in darwintrace.c.
+ */
+extern FILE *__darwintrace_stderr;
+
+/**
+ * Initializer function, ensures darwintrace has been properly set up and check
+ * whether this process was fork(2)'d or clone(2)'d since the last call. Call
+ * this before calling any other functions from this library.
+ */
+void __darwintrace_setup();
+
+/**
+ * Close the darwintrace socket and set it to \c NULL. Since this uses \c
+ * fclose(3), which internally calls \c close(2), which is intercepted by this
+ * library and this library prevents closing the socket to MacPorts, we use \c
+ * __darwintrace_close_sock to allow closing specific FDs.
+ */
+void __darwintrace_close();
+
+/**
+ * Check a path against the current sandbox
+ *
+ * \param[in] path the path to be checked; not necessarily absolute
+ * \param[in] flags A binary or combination of the following flags:
+ *                  - DT_REPORT: If access to this path is being denied, report
+ *                    it as sandbox violation. Set this for all operations that
+ *                    read file contents or check file attributes. Omit this
+ *                    flag for operations that might only attempt to access
+ *                    a file by chance, such as readdir(3).
+ *                  - DT_ALLOWDIR: Whether to always allow access if the given
+ *                    path references an existing directory. Set this for
+ *                    read operations such as stat(2), omit this for operations
+ *                    that modify directories like rmdir(2) and mkdir(2).
+ *                  - DT_FOLLOWSYMS: Check for and expand symlinks, while
+ *                    checking both the link name and the link target against
+ *                    the sandbox. Set this for all operations that read file
+ *                    contents or check file attributes. Omit this flag for
+ *                    operations that only list the file (or rather symlink)
+ *                    name.
+ * \return \c true if the file is within sandbox bounds, \c false if access
+ *         should be denied
+ */
+bool __darwintrace_is_in_sandbox(const char *path, int flags);
+
+#ifdef DARWINTRACE_USE_PRIVATE_API
+#include &lt;errno.h&gt;
+#include &lt;stdlib.h&gt;
+
+/**
+ * PID of the process darwintrace was last used in. This is used to detect
+ * forking and opening a new connection to the control socket in the child
+ * process. Not doing so would potentially cause two processes writing to the
+ * same socket.
+ */
+extern pid_t __darwintrace_pid;
+
+/**
+ * Copy of the DARWINTRACE_LOG environment variable to restore it in execve(2).
+ * Contains the path to the unix socket used for communication with the
+ * MacPorts-side of the sandbox.
+ */
+extern char *__env_darwintrace_log;
+
+/**
+ * Helper variable containing the number of the darwintrace socket, iff the
+ * close(2) syscall should be allowed to close it. Used by \c
+ * __darwintrace_close.
+ */
+extern volatile int __darwintrace_close_sock;
+
+/**
+ * pthread_key_t for the darwintrace socket to ensure the socket is only used
+ * from a single thread.
+ */
+extern pthread_key_t sock_key;
+
+/**
+ * Convenience getter function for the thread-local darwintrace socket. Do not
+ * consider this part of public API. It is only needed to prevent closing and
+ * duplicating over darwintrace's socket FDs.
+ */
+static inline FILE *__darwintrace_sock() {
+        return (FILE *) pthread_getspecific(sock_key);
+}
+
+/**
+ * Convenience setter function for the thread-local darwintrace socket. Do not
+ * consider this part of public API. It is only needed to prevent closing and
+ * duplicating over darwintrace's socket FDs.
+ */
+static inline void __darwintrace_sock_set(FILE *stream) {
+        if (0 != (errno = pthread_setspecific(sock_key, stream))) {
+                perror(&quot;darwintrace: pthread_setspecific&quot;);
+                abort();
+        }
+}
+#endif /* defined(DARWINTRACE_USE_PRIVATE_API) */
</ins></span></pre></div>
<a id="branchesnewhelpsystembasesrcdarwintracelib10dup2cfromrev117083trunkbasesrcdarwintracelib10dup2c"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/src/darwintracelib1.0/dup2.c (from rev 117083, trunk/base/src/darwintracelib1.0/dup2.c) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/darwintracelib1.0/dup2.c                                (rev 0)
+++ branches/new-help-system/base/src/darwintracelib1.0/dup2.c        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,77 @@
</span><ins>+/*
+ * Copyright (c) 2005 Apple Inc. All rights reserved.
+ * Copyright (c) 2005-2006 Paul Guyot &lt;pguyot@kallisys.net&gt;,
+ * All rights reserved.
+ * Copyright (c) 2006-2013 The MacPorts Project
+ *
+ * $Id: darwintrace.c 112642 2013-10-28 18:59:19Z cal@macports.org $
+ *
+ * @APPLE_BSD_LICENSE_HEADER_START@
+ *
+ * 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 Inc. (&quot;Apple&quot;) 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 APPLE AND ITS CONTRIBUTORS &quot;AS IS&quot; 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 APPLE OR ITS 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.
+ *
+ * @APPLE_BSD_LICENSE_HEADER_END@
+ */
+
+#define DARWINTRACE_USE_PRIVATE_API 1
+#include &quot;darwintrace.h&quot;
+
+#include &lt;fcntl.h&gt;
+#include &lt;stdio.h&gt;
+#include &lt;sys/syscall.h&gt;
+#include &lt;unistd.h&gt;
+
+/**
+ * Wrapper around \c dup(2) that moves darwintrace's socket FD if software
+ * attempts to overwrite it using \c dup(2). Shells tend to do that a lot when
+ * FDs are numbered in ascending order.
+ */
+int dup2(int filedes, int filedes2) {
+#define dup2(x, y) syscall(SYS_dup2, (x), (y))
+        __darwintrace_setup();
+
+        FILE *stream = __darwintrace_sock();
+        if (stream &amp;&amp; filedes2 == fileno(stream)) {
+                // if somebody tries to close our file descriptor, just move it out of
+                // the way. Make sure it doesn't end up as stdin/stdout/stderr, though!
+                int new_darwintrace_fd;
+                FILE *new_stream;
+
+                if (-1 == (new_darwintrace_fd = fcntl(fileno(stream), F_DUPFD, STDOUT_FILENO + 1))) {
+                        // if duplicating fails, do not allow overwriting either!
+                        return -1;
+                }
+
+                __darwintrace_close();
+                if (NULL == (new_stream = fdopen(new_darwintrace_fd, &quot;a+&quot;))) {
+                        perror(&quot;darwintrace: fdopen&quot;);
+                        abort();
+                }
+                __darwintrace_sock_set(new_stream);
+        }
+
+        return dup2(filedes, filedes2);
+#undef dup2
+}
</ins></span></pre></div>
<a id="branchesnewhelpsystembasesrcdarwintracelib10mkdircfromrev117083trunkbasesrcdarwintracelib10mkdirc"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/src/darwintracelib1.0/mkdir.c (from rev 117083, trunk/base/src/darwintracelib1.0/mkdir.c) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/darwintracelib1.0/mkdir.c                                (rev 0)
+++ branches/new-help-system/base/src/darwintracelib1.0/mkdir.c        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,80 @@
</span><ins>+/*
+ * Copyright (c) 2005 Apple Inc. All rights reserved.
+ * Copyright (c) 2005-2006 Paul Guyot &lt;pguyot@kallisys.net&gt;,
+ * All rights reserved.
+ * Copyright (c) 2006-2013 The MacPorts Project
+ *
+ * $Id: darwintrace.c 112642 2013-10-28 18:59:19Z cal@macports.org $
+ *
+ * @APPLE_BSD_LICENSE_HEADER_START@
+ *
+ * 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 Inc. (&quot;Apple&quot;) 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 APPLE AND ITS CONTRIBUTORS &quot;AS IS&quot; 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 APPLE OR ITS 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.
+ *
+ * @APPLE_BSD_LICENSE_HEADER_END@
+ */
+
+#include &quot;darwintrace.h&quot;
+
+#include &lt;errno.h&gt;
+#include &lt;sys/stat.h&gt;
+#include &lt;sys/syscall.h&gt;
+#include &lt;unistd.h&gt;
+
+#if __DARWIN_64_BIT_INO_T
+#define LSTATSYSNUM SYS_lstat64
+#else
+#define LSTATSYSNUM SYS_lstat
+#endif
+
+/**
+ * Wrapper around \c mkdir(2) that prevents creation of directories outside of
+ * the sandbox. Will silently do nothing and return success for directories
+ * outside the sandbox that already exist.
+ */
+int mkdir(const char *path, mode_t mode) {
+#define mkdir(x,y) syscall(SYS_mkdir, (x), (y))
+#define lstat(x,y) syscall(LSTATSYSNUM, (x), (y))
+        __darwintrace_setup();
+
+        int result = 0;
+
+        if (!__darwintrace_is_in_sandbox(path, DT_REPORT | DT_FOLLOWSYMS)) {
+                struct stat st;
+                if (-1 == lstat(path, &amp;st) &amp;&amp; errno == ENOENT) {
+                        // directory doesn't exist yet */
+                        errno = EACCES;
+                        result = -1;
+                }
+                // otherwise, leave result at 0 and return to indicate success
+        } else {
+                result = mkdir(path, mode);
+        }
+
+        debug_printf(&quot;mkdir(%s) = %d\n&quot;, path, result);
+
+        return result;
+#undef lstat
+#undef mkdir
+}
</ins></span></pre></div>
<a id="branchesnewhelpsystembasesrcdarwintracelib10opencfromrev117083trunkbasesrcdarwintracelib10openc"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/src/darwintracelib1.0/open.c (from rev 117083, trunk/base/src/darwintracelib1.0/open.c) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/darwintracelib1.0/open.c                                (rev 0)
+++ branches/new-help-system/base/src/darwintracelib1.0/open.c        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,72 @@
</span><ins>+/*
+ * Copyright (c) 2005 Apple Inc. All rights reserved.
+ * Copyright (c) 2005-2006 Paul Guyot &lt;pguyot@kallisys.net&gt;,
+ * All rights reserved.
+ * Copyright (c) 2006-2013 The MacPorts Project
+ *
+ * $Id: darwintrace.h 112642 2013-10-28 18:59:19Z cal@macports.org $
+ *
+ * @APPLE_BSD_LICENSE_HEADER_START@
+ *
+ * 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 Inc. (&quot;Apple&quot;) 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 APPLE AND ITS CONTRIBUTORS &quot;AS IS&quot; 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 APPLE OR ITS 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.
+ *
+ * @APPLE_BSD_LICENSE_HEADER_END@
+ */
+
+#include &quot;darwintrace.h&quot;
+
+#include &lt;errno.h&gt;
+#include &lt;fcntl.h&gt;
+#include &lt;stdarg.h&gt;
+#include &lt;sys/syscall.h&gt;
+#include &lt;unistd.h&gt;
+
+/**
+ * Wrapper function for \c open(2). Prevents opening files outside the sandbox.
+ * Indicates the file does not exist on sandbox violation, or permission denied
+ * when attempting to create a file, i.e., when \c O_CREAT is set.
+ */
+int open(const char *path, int flags, ...) {
+#define open(x,y,z) syscall(SYS_open, (x), (y), (z))
+        __darwintrace_setup();
+        int result = 0;
+
+        if (!__darwintrace_is_in_sandbox(path, DT_REPORT | DT_ALLOWDIR | DT_FOLLOWSYMS)) {
+                errno = ((flags &amp; O_CREAT) &gt; 0) ? EACCES : ENOENT;
+                result = -1;
+        } else {
+                // Read mode and pass it to the syscall, because we cannot optionally pass
+                // parameters to syscalls
+                va_list args;
+                va_start(args, flags);
+                mode_t mode = va_arg(args, int);
+                va_end(args);
+
+                result = open(path, flags, mode);
+        }
+        debug_printf(&quot;open(%s) = %d\n&quot;, path, result);
+        return result;
+#undef open
+}
</ins></span></pre></div>
<a id="branchesnewhelpsystembasesrcdarwintracelib10proccfromrev117083trunkbasesrcdarwintracelib10procc"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/src/darwintracelib1.0/proc.c (from rev 117083, trunk/base/src/darwintracelib1.0/proc.c) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/darwintracelib1.0/proc.c                                (rev 0)
+++ branches/new-help-system/base/src/darwintracelib1.0/proc.c        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,357 @@
</span><ins>+/*
+ * Copyright (c) 2005 Apple Inc. All rights reserved.
+ * Copyright (c) 2005-2006 Paul Guyot &lt;pguyot@kallisys.net&gt;,
+ * All rights reserved.
+ * Copyright (c) 2006-2013 The MacPorts Project
+ *
+ * $Id: darwintrace.h 112642 2013-10-28 18:59:19Z cal@macports.org $
+ *
+ * @APPLE_BSD_LICENSE_HEADER_START@
+ *
+ * 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 Inc. (&quot;Apple&quot;) 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 APPLE AND ITS CONTRIBUTORS &quot;AS IS&quot; 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 APPLE OR ITS 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.
+ *
+ * @APPLE_BSD_LICENSE_HEADER_END@
+ */
+
+#define DARWINTRACE_USE_PRIVATE_API 1
+#include &quot;darwintrace.h&quot;
+
+#include &lt;ctype.h&gt;
+#include &lt;dlfcn.h&gt;
+#include &lt;errno.h&gt;
+#include &lt;fcntl.h&gt;
+#include &lt;stdlib.h&gt;
+#include &lt;string.h&gt;
+#include &lt;sys/param.h&gt;
+#include &lt;sys/syscall.h&gt;
+#include &lt;sys/types.h&gt;
+#include &lt;sys/uio.h&gt;
+#include &lt;unistd.h&gt;
+
+#if defined(HAVE_SPAWN_H) &amp;&amp; defined(HAVE_POSIX_SPAWN)
+#include &lt;spawn.h&gt;
+#endif
+
+static void store_env() __attribute__((constructor));
+
+/**
+ * Copy of the DYLD_INSERT_LIBRARIES environment variable to restore it in
+ * execve(2). DYLD_INSERT_LIBRARIES is needed to preload this library into any
+ * process' address space.
+ */
+static char *__env_dyld_insert_libraries;
+static char *__env_full_dyld_insert_libraries;
+
+/**
+ * Copy of the DYLD_FORCE_FLAT_NAMESPACE environment variable to restore it in
+ * execve(2). DYLD_FORCE_FLAT_NAMESPACE=1 is needed for the preload-based
+ * sandbox to work.
+ */
+static char *__env_dyld_force_flat_namespace;
+static char *__env_full_dyld_force_flat_namespace;
+
+/**
+ * Copy of the DARWINTRACE_LOG environment variable to restore it in execve(2).
+ * Contains the path to the unix socket used for communication with the
+ * MacPorts-side of the sandbox. Since this variable is also used from
+ * darwintrace.c, is can not be static.
+ */
+char *__env_darwintrace_log;
+static char *__env_full_darwintrace_log;
+
+/**
+ * Copy the environment variables, if they're defined. This is run as
+ * a constructor at startup.
+ */
+static void store_env() {
+#define COPYENV(name, variable, valuevar) do {\
+                char *val;\
+                if (NULL != (val = getenv(#name))) {\
+                        size_t lenName = strlen(#name);\
+                        size_t lenVal  = strlen(val);\
+                        if (NULL == (variable = malloc(lenName + lenVal + 0 + 1))) {\
+                                perror(&quot;darwintrace: malloc&quot;);\
+                                abort();\
+                        }\
+                        strcpy(variable, #name);\
+                        strcat(variable, &quot;=&quot;);\
+                        strcat(variable, val);\
+                        valuevar = variable + lenName + 1;\
+                } else {\
+                        variable = NULL;\
+                        valuevar = NULL;\
+                }\
+        } while (0)
+
+        COPYENV(DYLD_INSERT_LIBRARIES, __env_full_dyld_insert_libraries, __env_dyld_insert_libraries);
+        COPYENV(DYLD_FORCE_FLAT_NAMESPACE, __env_full_dyld_force_flat_namespace, __env_dyld_force_flat_namespace);
+        COPYENV(DARWINTRACE_LOG, __env_full_darwintrace_log, __env_darwintrace_log);
+#undef COPYENV
+
+        char *debugpath = getenv(&quot;DARWINTRACE_DEBUG&quot;);
+        if (debugpath) {
+                __darwintrace_stderr = fopen(debugpath, &quot;a+&quot;);
+        } else {
+                __darwintrace_stderr = stderr;
+        }
+}
+
+/**
+ * Return false if str doesn't begin with prefix, true otherwise.
+ */
+static inline bool __darwintrace_strbeginswith(const char *str, const char *prefix) {
+        char s;
+        char p;
+        do {
+                s = *str++;
+                p = *prefix++;
+        } while (p &amp;&amp; (p == s));
+        return (p == '\0');
+}
+
+/**
+ * This function checks that envp contains the global variables we had when the
+ * library was loaded and modifies it if it doesn't. Returns a malloc(3)'d copy
+ * of envp where the appropriate values have been restored. The caller should
+ * pass the returned pointer to free(3) if necessary to avoid leaks.
+ */
+static inline char **restore_env(char *const envp[]) {
+        // we can re-use pre-allocated strings from store_env
+        char *dyld_insert_libraries_ptr     = __env_full_dyld_insert_libraries;
+        char *dyld_force_flat_namespace_ptr = __env_full_dyld_force_flat_namespace;
+        char *darwintrace_log_ptr           = __env_full_darwintrace_log;
+
+        char *const *enviter = envp;
+        size_t envlen = 0;
+        char **copy;
+        char **copyiter;
+
+        while (*enviter != NULL) {
+                envlen++;
+                enviter++;
+        }
+
+        // 4 is sufficient for the three variables we copy and the terminator
+        copy = malloc(sizeof(char *) * (envlen + 4));
+
+        enviter  = envp;
+        copyiter = copy;
+
+        while (*enviter != NULL) {
+                char *val = *enviter;
+                if (__darwintrace_strbeginswith(val, &quot;DYLD_INSERT_LIBRARIES=&quot;)) {
+                        val = dyld_insert_libraries_ptr;
+                        dyld_insert_libraries_ptr = NULL;
+                } else if (__darwintrace_strbeginswith(val, &quot;DYLD_FORCE_FLAT_NAMESPACE=&quot;)) {
+                        val = dyld_force_flat_namespace_ptr;
+                        dyld_force_flat_namespace_ptr = NULL;
+                } else if (__darwintrace_strbeginswith(val, &quot;DARWINTRACE_LOG=&quot;)) {
+                        val = darwintrace_log_ptr;
+                        darwintrace_log_ptr = NULL;
+                }
+
+                if (val) {
+                        *copyiter++ = val;
+                }
+
+                enviter++;
+        }
+
+        if (dyld_insert_libraries_ptr) {
+                *copyiter++ = dyld_insert_libraries_ptr;
+        }
+        if (dyld_force_flat_namespace_ptr) {
+                *copyiter++ = dyld_force_flat_namespace_ptr;
+        }
+        if (darwintrace_log_ptr) {
+                *copyiter++ = darwintrace_log_ptr;
+        }
+
+        *copyiter = 0;
+
+        return copy;
+}
+
+/**
+ * Helper function that opens the file indicated by \a path, checks whether it
+ * is a script (i.e., contains a shebang line) and verifies the interpreter is
+ * within the sandbox bounds.
+ *
+ * \param[in] path The path of the file to be executed
+ * \return 0, if access should be granted, a non-zero error code to be stored
+ *         in \c errno otherwise
+ */
+static inline int check_interpreter(const char *restrict path) {
+#define open(x,y,z) syscall(SYS_open, (x), (y), (z))
+#define close(x) syscall(SYS_close, (x))
+        int fd = open(path, O_RDONLY, 0);
+        if (fd &lt;= 0) {
+                return errno;
+        }
+
+        char buffer[MAXPATHLEN + 1 + 2];
+        ssize_t bytes_read;
+
+        /* Read the file for the interpreter. Fortunately, on OS X:
+         *   The system guarantees to read the number of bytes requested if
+         *   the descriptor references a normal file that has that many
+         *   bytes left before the end-of-file, but in no other case.
+         * That _does_ save us another ugly loop to get things right. */
+        bytes_read = read(fd, buffer, sizeof(buffer) - 1);
+        buffer[bytes_read] = '\0';
+        const char *buffer_end = buffer + bytes_read;
+        if (bytes_read &gt; 2 &amp;&amp; buffer[0] == '#' &amp;&amp; buffer[1] == '!') {
+                char *interp = buffer + 2;
+
+                /* skip past leading whitespace */
+                while (interp &lt; buffer_end &amp;&amp; isblank(*interp)) {
+                        ++interp;
+                }
+                /* found interpreter (or ran out of data); skip until next
+                 * whitespace, then terminate the string */
+                if (interp &lt; buffer_end) {
+                        char *interp_end = interp;
+                        strsep(&amp;interp_end, &quot; \t&quot;);
+                }
+
+                /* check the iterpreter against the sandbox */
+                if (!__darwintrace_is_in_sandbox(interp, DT_REPORT | DT_ALLOWDIR | DT_FOLLOWSYMS)) {
+                        close(fd);
+                        return ENOENT;
+                }
+        }
+
+        close(fd);
+        return 0;
+#undef open
+#undef close
+}
+
+/**
+ * Wrapper for \c execve(2). Denies access and simulates the file does not
+ * exist, if it's outside the sandbox. Also checks for potential interpreters
+ * using \c check_interpreter.
+ */
+int execve(const char *path, char *const argv[], char *const envp[]) {
+#define execve(x,y,z) syscall(SYS_execve, (x), (y), (z))
+        __darwintrace_setup();
+
+        int result = 0;
+
+        if (!__darwintrace_is_in_sandbox(path, DT_REPORT | DT_ALLOWDIR | DT_FOLLOWSYMS)) {
+                errno = ENOENT;
+                result = -1;
+        } else {
+                int interp_result = check_interpreter(path);
+                if (interp_result != 0) {
+                        errno = interp_result;
+                        result = -1;
+                } else {
+                        // Since \c execve(2) will likely not return, log before calling
+                        debug_printf(&quot;execve(%s) = ?\n&quot;, path);
+
+                        // Our variables won't survive exec, clean up
+                        __darwintrace_close();
+                        __darwintrace_pid = (pid_t) -1;
+
+                        // Call the original execve function, but restore environment
+                        char **newenv = restore_env(envp);
+                        result = execve(path, argv, newenv);
+                        free(newenv);
+                }
+        }
+
+        debug_printf(&quot;execve(%s) = %d\n&quot;, path, result);
+
+        return result;
+#undef execve
+}
+
+#if defined(HAVE_SPAWN_H) &amp;&amp; defined(HAVE_POSIX_SPAWN)
+// Let's save some typing work...
+typedef int (*posix_spawn_t)(
+                        pid_t *restrict,
+                        const char *restrict,
+                        const posix_spawn_file_actions_t *,
+                        const posix_spawnattr_t *restrict,
+                        char *const *restrict,
+                        char *const *restrict);
+/**
+ * Wrapper for \c posix_spawn(2). Denies access and simulates the file does not
+ * exist, if it's outside the sandbox. Also checks for potential interpreters
+ * using \c check_interpreter.
+ */
+int posix_spawn(pid_t *restrict pid, const char *restrict path, const posix_spawn_file_actions_t *file_actions,
+                const posix_spawnattr_t *restrict attrp, char *const argv[restrict], char *const envp[restrict]) {
+        __darwintrace_setup();
+
+        static posix_spawn_t prev_posix_spawn = NULL;
+        int result = 0;
+
+        if (!__darwintrace_is_in_sandbox(path, DT_REPORT | DT_ALLOWDIR | DT_FOLLOWSYMS)) {
+                result = ENOENT;
+        } else {
+                int interp_result = check_interpreter(path);
+                if (interp_result != 0) {
+                        result = interp_result;
+                } else {
+                        short attrflags;
+                        if (   attrp != NULL
+                                &amp;&amp; posix_spawnattr_getflags(attrp, &amp;attrflags) == 0
+                                &amp;&amp; (attrflags &amp; POSIX_SPAWN_SETEXEC) &gt; 0) {
+                                // Apple-specific extension: This call will not return, but
+                                // behave like execve(2). Since our variables won't survive
+                                // that, clean up. Also log the call, because we likely won't
+                                // be able to after the call.
+                                debug_printf(&quot;execve(%s) = ?\n&quot;, path);
+
+                                __darwintrace_close();
+                                __darwintrace_pid = (pid_t) - 1;
+                        }
+
+                        /* ATTN: the mac syscall you get from syscall(SYS_posix_spawn) corresponds
+                         * to __posix_spawn from /usr/lib/system/libsystem_kernel.dylib. We can not
+                         * override __posix_spawn directly, because it is called from posix_spawn
+                         * inside the same library (i.e., there is no dyld stub we can override).
+                         *
+                         * We cannot override posix_spawn and call __posix_spawn from it
+                         * either, because that will fail with an invalid argument. Thus,
+                         * we need to call the original posix_spawn from here. */
+                        // retrieve the original posix_spawn function
+                        if (prev_posix_spawn == NULL) {
+                                prev_posix_spawn = (posix_spawn_t) dlsym(RTLD_NEXT, &quot;posix_spawn&quot;);
+                        }
+                        // call the original posix_spawn function, but restore environment
+                        char **newenv = restore_env(envp);
+                        result = prev_posix_spawn(pid, path, file_actions, attrp, argv, newenv);
+                        free(newenv);
+                }
+        }
+
+        debug_printf(&quot;posix_spawn(%s) = %d\n&quot;, path, result);
+
+        return result;
+}
+#endif
</ins></span></pre></div>
<a id="branchesnewhelpsystembasesrcdarwintracelib10readdircfromrev117083trunkbasesrcdarwintracelib10readdirc"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/src/darwintracelib1.0/readdir.c (from rev 117083, trunk/base/src/darwintracelib1.0/readdir.c) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/darwintracelib1.0/readdir.c                                (rev 0)
+++ branches/new-help-system/base/src/darwintracelib1.0/readdir.c        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,156 @@
</span><ins>+/*
+ * Copyright (c) 2005 Apple Inc. All rights reserved.
+ * Copyright (c) 2005-2006 Paul Guyot &lt;pguyot@kallisys.net&gt;,
+ * All rights reserved.
+ * Copyright (c) 2006-2013 The MacPorts Project
+ *
+ * $Id: darwintrace.c 112642 2013-10-28 18:59:19Z cal@macports.org $
+ *
+ * @APPLE_BSD_LICENSE_HEADER_START@
+ *
+ * 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 Inc. (&quot;Apple&quot;) 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 APPLE AND ITS CONTRIBUTORS &quot;AS IS&quot; 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 APPLE OR ITS 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.
+ *
+ * @APPLE_BSD_LICENSE_HEADER_END@
+ */
+
+#include &quot;darwintrace.h&quot;
+
+#include &lt;errno.h&gt;
+#include &lt;sys/dirent.h&gt;
+#include &lt;sys/param.h&gt;
+#include &lt;sys/syscall.h&gt;
+#include &lt;unistd.h&gt;
+#include &lt;fcntl.h&gt;
+#include &lt;string.h&gt;
+
+/**
+ * re-implementation of getdirent(2) and __getdirent64(2) preventing paths
+ * outside the sandbox to show up when reading the contents of a directory.
+ * Unfortunately, since we need to access the contents of the buffer, but the
+ * contents differ by architecture, we can not rely on the dirent structure
+ * defined by the header included by this program, because we don't know
+ * whether darwintrace.dylib has been compiled for 64bit or 32bit inodes. We
+ * thus copy both structs and decide at runtime.
+ */
+
+#if defined(__DARWIN_64_BIT_INO_T)
+
+struct dirent64  {
+        __uint64_t  d_ino;      /* file number of entry */
+        __uint64_t  d_seekoff;  /* seek offset */
+        __uint16_t  d_reclen;   /* length of this record */
+        __uint16_t  d_namlen;   /* length of string in d_name */
+        __uint8_t   d_type;     /* file type */
+        char      d_name[__DARWIN_MAXPATHLEN]; /* entry name (up to MAXPATHLEN bytes) */
+};
+
+size_t __getdirentries64(int fd, void *buf, size_t bufsize, __darwin_off_t *basep) {
+#define __getdirentries64(w,x,y,z) syscall(SYS_getdirentries64, (w), (x), (y), (z))
+        __darwintrace_setup();
+
+        size_t sz = __getdirentries64(fd, buf, bufsize, basep);
+        char dirname[MAXPATHLEN];
+        size_t dnamelen;
+
+        if (-1 == fcntl(fd, F_GETPATH, dirname)) {
+                errno = EBADF;
+                return -1;
+        }
+
+        dnamelen = strlen(dirname);
+        if (dirname[dnamelen - 1] != '/') {
+                dirname[dnamelen] = '/';
+                dirname[dnamelen + 1] = '\0';
+                dnamelen++;
+        }
+
+        dnamelen = strlen(dirname);
+        size_t offset;
+        for (offset = 0; offset &lt; sz;) {
+                struct dirent64 *dent = (struct dirent64 *)(((char *) buf) + offset);
+                dirname[dnamelen] = '\0';
+                strcat(dirname, dent-&gt;d_name);
+                if (!__darwintrace_is_in_sandbox(dirname, DT_ALLOWDIR)) {
+                        debug_printf(&quot;__getdirentries64: filtered %s\n&quot;, dirname);
+                        dent-&gt;d_ino = 0;
+                } else {
+                        debug_printf(&quot;__getdirentries64:  allowed %s\n&quot;, dirname);
+                }
+                offset += dent-&gt;d_reclen;
+        }
+
+        return sz;
+#undef __getdirentries64
+}
+
+#endif /* defined(__DARWIN_64_BIT_INO_T) */
+
+#pragma pack(4)
+struct dirent32 {
+        ino_t d_ino;            /* file number of entry */
+        __uint16_t d_reclen;    /* length of this record */
+        __uint8_t  d_type;      /* file type */
+        __uint8_t  d_namlen;    /* length of string in d_name */
+        char d_name[__DARWIN_MAXNAMLEN + 1]; /* name must be no longer than this */
+};
+#pragma pack()
+
+int getdirentries(int fd, char *buf, int nbytes, long *basep) {
+#define getdirentries(w,x,y,z) syscall(SYS_getdirentries, (w), (x), (y), (z))
+        __darwintrace_setup();
+
+        size_t sz = getdirentries(fd, buf, nbytes, basep);
+        char dirname[MAXPATHLEN];
+        size_t dnamelen;
+
+        if (-1 == fcntl(fd, F_GETPATH, dirname)) {
+                errno = EBADF;
+                return 0;
+        }
+
+        dnamelen = strlen(dirname);
+        if (dirname[dnamelen - 1] != '/') {
+                dirname[dnamelen] = '/';
+                dirname[dnamelen + 1] = '\0';
+                dnamelen++;
+        }
+
+        size_t offset;
+        for (offset = 0; offset &lt; sz;) {
+                struct dirent32 *dent = (struct dirent32 *)(buf + offset);
+                dirname[dnamelen] = '\0';
+                strcat(dirname, dent-&gt;d_name);
+                if (!__darwintrace_is_in_sandbox(dirname, DT_ALLOWDIR)) {
+                        debug_printf(&quot;getdirentries: filtered %s\n&quot;, dirname);
+                        dent-&gt;d_ino = 0;
+                } else {
+                        debug_printf(&quot;getdirentries:  allowed %s\n&quot;, dirname);
+                }
+                offset += dent-&gt;d_reclen;
+        }
+
+        return sz;
+#undef getdirentries
+}
</ins></span></pre></div>
<a id="branchesnewhelpsystembasesrcdarwintracelib10readlinkcfromrev117083trunkbasesrcdarwintracelib10readlinkc"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/src/darwintracelib1.0/readlink.c (from rev 117083, trunk/base/src/darwintracelib1.0/readlink.c) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/darwintracelib1.0/readlink.c                                (rev 0)
+++ branches/new-help-system/base/src/darwintracelib1.0/readlink.c        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,71 @@
</span><ins>+/*
+ * Copyright (c) 2005 Apple Inc. All rights reserved.
+ * Copyright (c) 2005-2006 Paul Guyot &lt;pguyot@kallisys.net&gt;,
+ * All rights reserved.
+ * Copyright (c) 2006-2013 The MacPorts Project
+ *
+ * $Id: darwintrace.h 112642 2013-10-28 18:59:19Z cal@macports.org $
+ *
+ * @APPLE_BSD_LICENSE_HEADER_START@
+ *
+ * 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 Inc. (&quot;Apple&quot;) 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 APPLE AND ITS CONTRIBUTORS &quot;AS IS&quot; 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 APPLE OR ITS 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.
+ *
+ * @APPLE_BSD_LICENSE_HEADER_END@
+ */
+
+#include &quot;darwintrace.h&quot;
+
+#include &lt;errno.h&gt;
+#include &lt;sys/syscall.h&gt;
+#include &lt;unistd.h&gt;
+#include &lt;unistd.h&gt;
+
+/**
+ * Deny \c readlink(2) if the file is not within the sandbox bounds.
+ */
+#ifdef READLINK_IS_NOT_P1003_1A
+int readlink(const char *path, char *buf, int bufsiz) {
+#else
+ssize_t readlink(const char *path, char *buf, size_t bufsiz) {
+#endif
+#define readlink(x,y,z) syscall(SYS_readlink, (x), (y), (z))
+        __darwintrace_setup();
+
+        int result = 0;
+
+        // don't follow symlinks here; whether access to the link target is allowed
+        // or not does not matter for reading the symlink
+        if (!__darwintrace_is_in_sandbox(path, DT_REPORT | DT_ALLOWDIR)) {
+                errno = ENOENT;
+                result = -1;
+        } else {
+                result = readlink(path, buf, bufsiz);
+        }
+
+        debug_printf(&quot;readlink(%s) = %d\n&quot;, path, result);
+
+        return result;
+#undef readlink
+}
</ins></span></pre></div>
<a id="branchesnewhelpsystembasesrcdarwintracelib10renamecfromrev117083trunkbasesrcdarwintracelib10renamec"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/src/darwintracelib1.0/rename.c (from rev 117083, trunk/base/src/darwintracelib1.0/rename.c) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/darwintracelib1.0/rename.c                                (rev 0)
+++ branches/new-help-system/base/src/darwintracelib1.0/rename.c        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,69 @@
</span><ins>+/*
+ * Copyright (c) 2005 Apple Inc. All rights reserved.
+ * Copyright (c) 2005-2006 Paul Guyot &lt;pguyot@kallisys.net&gt;,
+ * All rights reserved.
+ * Copyright (c) 2006-2013 The MacPorts Project
+ *
+ * $Id: darwintrace.c 112642 2013-10-28 18:59:19Z cal@macports.org $
+ *
+ * @APPLE_BSD_LICENSE_HEADER_START@
+ *
+ * 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 Inc. (&quot;Apple&quot;) 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 APPLE AND ITS CONTRIBUTORS &quot;AS IS&quot; 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 APPLE OR ITS 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.
+ *
+ * @APPLE_BSD_LICENSE_HEADER_END@
+ */
+
+#include &quot;darwintrace.h&quot;
+
+#include &lt;errno.h&gt;
+#include &lt;stdio.h&gt;
+#include &lt;sys/syscall.h&gt;
+#include &lt;unistd.h&gt;
+
+/**
+ * Wrapper around \c rename(2) to prevent moving a file outside, or out of the
+ * sandbox.
+ */
+int rename(const char *from, const char *to) {
+#define rename(x,y) syscall(SYS_rename, (x), (y))
+        __darwintrace_setup();
+
+        int result = 0;
+
+        if (!__darwintrace_is_in_sandbox(from, DT_REPORT | DT_FOLLOWSYMS)) {
+                errno = ENOENT;
+                result = -1;
+        } else if (!__darwintrace_is_in_sandbox(to, DT_REPORT | DT_FOLLOWSYMS)) {
+                errno = EACCES;
+                result = -1;
+        } else {
+                result = rename(from, to);
+        }
+
+        debug_printf(&quot;rename(%s, %s) = %d\n&quot;, from, to, result);
+
+        return result;
+#undef rename
+}
</ins></span></pre></div>
<a id="branchesnewhelpsystembasesrcdarwintracelib10rmdircfromrev117083trunkbasesrcdarwintracelib10rmdirc"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/src/darwintracelib1.0/rmdir.c (from rev 117083, trunk/base/src/darwintracelib1.0/rmdir.c) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/darwintracelib1.0/rmdir.c                                (rev 0)
+++ branches/new-help-system/base/src/darwintracelib1.0/rmdir.c        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,66 @@
</span><ins>+/*
+ * Copyright (c) 2005 Apple Inc. All rights reserved.
+ * Copyright (c) 2005-2006 Paul Guyot &lt;pguyot@kallisys.net&gt;,
+ * All rights reserved.
+ * Copyright (c) 2006-2013 The MacPorts Project
+ *
+ * $Id: darwintrace.c 112642 2013-10-28 18:59:19Z cal@macports.org $
+ *
+ * @APPLE_BSD_LICENSE_HEADER_START@
+ *
+ * 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 Inc. (&quot;Apple&quot;) 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 APPLE AND ITS CONTRIBUTORS &quot;AS IS&quot; 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 APPLE OR ITS 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.
+ *
+ * @APPLE_BSD_LICENSE_HEADER_END@
+ */
+
+#include &quot;darwintrace.h&quot;
+
+#include &lt;errno.h&gt;
+#include &lt;sys/syscall.h&gt;
+#include &lt;unistd.h&gt;
+#include &lt;unistd.h&gt;
+
+/**
+ * Wrapper around \c rmdir(2) to deny deleting directories outside of the
+ * sandbox.
+ */
+int rmdir(const char *path) {
+#define rmdir(x) syscall(SYS_rmdir, (x))
+        __darwintrace_setup();
+
+        int result = 0;
+
+        if (!__darwintrace_is_in_sandbox(path, DT_REPORT | DT_FOLLOWSYMS)) {
+                errno = ENOENT;
+                result = -1;
+        } else {
+                result = rmdir(path);
+        }
+
+        debug_printf(&quot;rmdir(%s) = %d\n&quot;, path, result);
+
+        return result;
+#undef rmdir
+}
</ins></span></pre></div>
<a id="branchesnewhelpsystembasesrcdarwintracelib10statcfromrev117083trunkbasesrcdarwintracelib10statc"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/src/darwintracelib1.0/stat.c (from rev 117083, trunk/base/src/darwintracelib1.0/stat.c) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/darwintracelib1.0/stat.c                                (rev 0)
+++ branches/new-help-system/base/src/darwintracelib1.0/stat.c        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,140 @@
</span><ins>+/*
+ * Copyright (c) 2005 Apple Inc. All rights reserved.
+ * Copyright (c) 2005-2006 Paul Guyot &lt;pguyot@kallisys.net&gt;,
+ * All rights reserved.
+ * Copyright (c) 2006-2013 The MacPorts Project
+ *
+ * $Id: darwintrace.c 112642 2013-10-28 18:59:19Z cal@macports.org $
+ *
+ * @APPLE_BSD_LICENSE_HEADER_START@
+ *
+ * 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 Inc. (&quot;Apple&quot;) 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 APPLE AND ITS CONTRIBUTORS &quot;AS IS&quot; 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 APPLE OR ITS 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.
+ *
+ * @APPLE_BSD_LICENSE_HEADER_END@
+ */
+
+#include &quot;darwintrace.h&quot;
+
+#include &lt;errno.h&gt;
+#include &lt;sys/syscall.h&gt;
+#include &lt;unistd.h&gt;
+
+// Do *not* include sys/stat.h, it will rewrite the stat to a stat$INODE64 symbol
+
+/**
+ * Wrapper around \c stat(2) to hide information about files outside the
+ * sandbox.
+ */
+int stat(const char *path, void *sb) {
+#define stat(path, sb) syscall(SYS_stat, path, sb)
+        __darwintrace_setup();
+
+        int result = 0;
+
+        if (!__darwintrace_is_in_sandbox(path, DT_REPORT | DT_ALLOWDIR | DT_FOLLOWSYMS)) {
+                errno = ENOENT;
+                result = -1;
+        } else {
+                result = stat(path, sb);
+        }
+
+        debug_printf(&quot;stat(%s) = %d\n&quot;, path, result);
+
+        return result;
+#undef stat
+}
+
+// Don't provide stat64 on systems that have no stat64 syscall
+#ifdef SYS_stat64
+int stat64(const char *path, void *sb) {
+#define stat64(path, sb) syscall(SYS_stat64, path, sb)
+        __darwintrace_setup();
+
+        int result = 0;
+
+        if (!__darwintrace_is_in_sandbox(path, DT_REPORT | DT_ALLOWDIR | DT_FOLLOWSYMS)) {
+                errno = ENOENT;
+                result = -1;
+        } else {
+                result = stat64(path, sb);
+        }
+
+        debug_printf(&quot;stat64(%s) = %d\n&quot;, path, result);
+
+        return result;
+#undef stat64
+}
+
+int stat$INODE64(const char *path, void *sb) {
+        return stat64(path, sb);
+}
+#endif /* defined(SYS_stat64) */
+
+int lstat(const char *path, void *sb) {
+#define lstat(path, sb) syscall(SYS_lstat, path, sb)
+        __darwintrace_setup();
+
+        int result = 0;
+
+        // don't follow symlinks for lstat
+        if (!__darwintrace_is_in_sandbox(path, DT_REPORT | DT_ALLOWDIR)) {
+                errno = ENOENT;
+                result = -1;
+        } else {
+                result = lstat(path, sb);
+        }
+
+        debug_printf(&quot;lstat(%s) = %d\n&quot;, path, result);
+
+        return result;
+#undef lstat
+}
+
+// Don't provide lstat64 on systems that have no lstat64 syscall
+#ifdef SYS_lstat64
+int lstat64(const char *path, void *sb) {
+#define lstat64(path, sb) syscall(SYS_lstat64, path, sb)
+        __darwintrace_setup();
+
+        int result = 0;
+
+        // don't follow symlinks for lstat
+        if (!__darwintrace_is_in_sandbox(path, DT_REPORT | DT_ALLOWDIR)) {
+                errno = ENOENT;
+                result = -1;
+        } else {
+                result = lstat64(path, sb);
+        }
+
+        debug_printf(&quot;lstat64(%s) = %d\n&quot;, path, result);
+
+        return result;
+#undef lstat64
+}
+
+int lstat$INODE64(const char *path, void *sb) {
+        return lstat64(path, sb);
+}
+#endif /* defined(SYS_lstat64) */
</ins></span></pre></div>
<a id="branchesnewhelpsystembasesrcdarwintracelib10unlinkcfromrev117083trunkbasesrcdarwintracelib10unlinkc"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/src/darwintracelib1.0/unlink.c (from rev 117083, trunk/base/src/darwintracelib1.0/unlink.c) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/darwintracelib1.0/unlink.c                                (rev 0)
+++ branches/new-help-system/base/src/darwintracelib1.0/unlink.c        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,66 @@
</span><ins>+/*
+ * Copyright (c) 2005 Apple Inc. All rights reserved.
+ * Copyright (c) 2005-2006 Paul Guyot &lt;pguyot@kallisys.net&gt;,
+ * All rights reserved.
+ * Copyright (c) 2006-2013 The MacPorts Project
+ *
+ * $Id: darwintrace.c 112642 2013-10-28 18:59:19Z cal@macports.org $
+ *
+ * @APPLE_BSD_LICENSE_HEADER_START@
+ *
+ * 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 Inc. (&quot;Apple&quot;) 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 APPLE AND ITS CONTRIBUTORS &quot;AS IS&quot; 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 APPLE OR ITS 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.
+ *
+ * @APPLE_BSD_LICENSE_HEADER_END@
+ */
+
+#include &quot;darwintrace.h&quot;
+
+#include &lt;errno.h&gt;
+#include &lt;sys/syscall.h&gt;
+#include &lt;unistd.h&gt;
+#include &lt;unistd.h&gt;
+
+/**
+ * Wrapper around \c unlink(2) that will deny attempts to delete files outside
+ * of the sandbox and simulate non-existence of the file instead.
+ */
+int unlink(const char *path) {
+#define unlink(x) syscall(SYS_unlink, (x))
+        __darwintrace_setup();
+
+        int result = 0;
+
+        if (!__darwintrace_is_in_sandbox(path, DT_REPORT | DT_ALLOWDIR | DT_FOLLOWSYMS)) {
+                errno = ENOENT;
+                result = -1;
+        } else {
+                result = unlink(path);
+        }
+
+        debug_printf(&quot;unlink(%s) = %d\n&quot;, path, result);
+
+        return result;
+#undef unlink
+}
</ins></span></pre></div>
<a id="branchesnewhelpsystembasesrcimages_to_archivestcl"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/src/images_to_archives.tcl (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/images_to_archives.tcl        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/src/images_to_archives.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -45,19 +45,19 @@
</span><span class="cx">     set iepoch [lindex $installed 5]
</span><span class="cx">     set iref [registry::open_entry $iname $iversion $irevision $ivariants $iepoch]
</span><span class="cx">     set installtype [registry::property_retrieve $iref installtype]
</span><del>-    if {$installtype == &quot;image&quot;} {
</del><ins>+    if {$installtype eq &quot;image&quot;} {
</ins><span class="cx">         set location [registry::property_retrieve $iref location]
</span><del>-        if {$location == &quot;0&quot;} {
</del><ins>+        if {$location == 0} {
</ins><span class="cx">             set location [registry::property_retrieve $iref imagedir]
</span><span class="cx">         }
</span><span class="cx">     } else {
</span><span class="cx">         set location &quot;&quot;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if {$location == &quot;&quot; || ![file isfile $location]} {
</del><ins>+    if {$location eq &quot;&quot; || ![file isfile $location]} {
</ins><span class="cx">         # no image archive present, so make one
</span><span class="cx">         set archs [registry::property_retrieve $iref archs]
</span><del>-        if {$archs == &quot;&quot; || $archs == &quot;0&quot;} {
</del><ins>+        if {$archs eq &quot;&quot; || $archs == 0} {
</ins><span class="cx">             set archs ${macports::os_arch}
</span><span class="cx">         }
</span><span class="cx">         # look for any existing archive in the old location
</span><span class="lines">@@ -88,12 +88,12 @@
</span><span class="cx">         # compute new name and location of archive
</span><span class="cx">         set archivename &quot;${iname}-${iversion}_${irevision}${ivariants}.${macports::os_platform}_${macports::os_major}.[join $archs -].${archivetype}&quot;
</span><span class="cx">         ui_msg &quot;Processing ${counter} of ${installed_len}: ${archivename}&quot;
</span><del>-        if {$installtype == &quot;image&quot;} {
</del><ins>+        if {$installtype eq &quot;image&quot;} {
</ins><span class="cx">             set targetdir [file dirname $location]
</span><span class="cx">         } else {
</span><span class="cx">             set targetdir [file join ${macports::registry.path} software ${iname}]
</span><span class="cx">         }
</span><del>-        if {$location == &quot;&quot; || ![file isdirectory $location]} {
</del><ins>+        if {$location eq &quot;&quot; || ![file isdirectory $location]} {
</ins><span class="cx">             set contents [$iref imagefiles]
</span><span class="cx">         }
</span><span class="cx">         file mkdir $targetdir
</span><span class="lines">@@ -101,7 +101,7 @@
</span><span class="cx"> 
</span><span class="cx">         if {$found} {
</span><span class="cx">             file rename $oldarchivefullpath $newlocation
</span><del>-        } elseif {$installtype == &quot;image&quot; &amp;&amp; [file isdirectory $location]} {
</del><ins>+        } elseif {$installtype eq &quot;image&quot; &amp;&amp; [file isdirectory $location]} {
</ins><span class="cx">             # create archive from image dir
</span><span class="cx">             system -W $location &quot;$tarcmd -cjf $newlocation * &gt; ${targetdir}/error.log 2&gt;&amp;1&quot;
</span><span class="cx">             file delete -force ${targetdir}/error.log
</span><span class="lines">@@ -132,7 +132,7 @@
</span><span class="cx">         set iref [lindex $archived 1]
</span><span class="cx">         set newlocation [lindex $archived 3]
</span><span class="cx">     
</span><del>-        if {$installtype == &quot;direct&quot;} {
</del><ins>+        if {$installtype eq &quot;direct&quot;} {
</ins><span class="cx">             # change receipt to image
</span><span class="cx">             $iref installtype image
</span><span class="cx">             $iref state imaged
</span><span class="lines">@@ -150,7 +150,7 @@
</span><span class="cx">     incr counter
</span><span class="cx">     set location [lindex $archived 2]
</span><span class="cx">     ui_msg &quot;Deleting ${counter} of ${archived_len}: ${location}&quot;
</span><del>-    if {$location != &quot;&quot; &amp;&amp; [file isdirectory $location]} {
</del><ins>+    if {$location ne &quot;&quot; &amp;&amp; [file isdirectory $location]} {
</ins><span class="cx">         if {[catch {file delete -force $location} result]} {
</span><span class="cx">             ui_warn &quot;Failed to delete ${location}: $result&quot;
</span><span class="cx">         }
</span></span></pre></div>
<a id="branchesnewhelpsystembasesrcmachista10libmachistac"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/src/machista1.0/libmachista.c (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/machista1.0/libmachista.c        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/src/machista1.0/libmachista.c        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -30,6 +30,8 @@
</span><span class="cx">  * POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx">  */
</span><span class="cx"> 
</span><ins>+#include &lt;config.h&gt;
+
</ins><span class="cx"> #include &lt;stdbool.h&gt;
</span><span class="cx"> #include &lt;stdio.h&gt;
</span><span class="cx"> #include &lt;stdlib.h&gt;
</span><span class="lines">@@ -41,6 +43,7 @@
</span><span class="cx"> 
</span><span class="cx"> #include &lt;err.h&gt;
</span><span class="cx"> #include &lt;string.h&gt;
</span><ins>+#include &lt;strings.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> #ifdef __MACH__
</span><span class="cx"> #include &lt;mach-o/fat.h&gt;
</span><span class="lines">@@ -338,15 +341,21 @@
</span><span class="cx">     mat-&gt;mat_arch = swap32(header-&gt;cputype);
</span><span class="cx"> 
</span><span class="cx">     /* Parse the Mach-O load commands */
</span><del>-    const struct load_command *cmd = macho_offset(input, header, header_size, sizeof(struct load_command));
-    if (cmd == NULL)
-        return MACHO_ERANGE;
</del><span class="cx">     uint32_t ncmds = swap32(header-&gt;ncmds);
</span><span class="cx"> 
</span><ins>+    /* Setup to jump over the header on the first pass through instead of the previous command */
+    const struct load_command *cmd = (void *)header;
+    uint32_t cmdsize = header_size;
+
</ins><span class="cx">     /* Iterate over the load commands */
</span><span class="cx">     for (uint32_t i = 0; i &lt; ncmds; i++) {
</span><ins>+        /* Load the next command */
+        cmd = macho_offset(input, cmd, cmdsize, sizeof(struct load_command));
+        if (cmd == NULL)
+            return MACHO_ERANGE;
+
</ins><span class="cx">         /* Load the full command */
</span><del>-        uint32_t cmdsize = swap32(cmd-&gt;cmdsize);
</del><ins>+        cmdsize = swap32(cmd-&gt;cmdsize);
</ins><span class="cx">         cmd = macho_read(input, cmd, cmdsize);
</span><span class="cx">         if (cmd == NULL)
</span><span class="cx">             return MACHO_ERANGE;
</span><span class="lines">@@ -425,11 +434,6 @@
</span><span class="cx">             default:
</span><span class="cx">                 break;
</span><span class="cx">         }
</span><del>-
-        /* Load the next command */
-        cmd = macho_offset(input, cmd, cmdsize, sizeof(struct load_command));
-        if (cmd == NULL)
-            return MACHO_ERANGE;
</del><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     return MACHO_SUCCESS;
</span><span class="lines">@@ -530,11 +534,18 @@
</span><span class="cx"> 
</span><span class="cx"> /* Returns string representation of the MACHO_* error code constants */
</span><span class="cx"> const char *macho_strerror(int err) {
</span><del>-    int num = 0;
</del><ins>+    int num;
+#ifdef HAVE_FLS
+    num = fls(err);
+#else
+    /* Tiger compatibility, see #42186 */
+    num = 0;
</ins><span class="cx">     while (err &gt; 0) {
</span><span class="cx">         err &gt;&gt;= 1;
</span><span class="cx">         num++;
</span><span class="cx">     }
</span><ins>+#endif
+
</ins><span class="cx">     static char *errors[] = {
</span><span class="cx">         /* 0x00 */ &quot;Success&quot;,
</span><span class="cx">         /* 0x01 */ &quot;Error opening or reading file&quot;,
</span></span></pre></div>
<a id="branchesnewhelpsystembasesrcmachista10teststesttcl"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/src/machista1.0/tests/test.tcl (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/machista1.0/tests/test.tcl        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/src/machista1.0/tests/test.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -12,14 +12,14 @@
</span><span class="cx">         if {[lindex $rlist 0] == $machista::SUCCESS} {
</span><span class="cx">                 set r [lindex $rlist 1]
</span><span class="cx">                 set a [$r cget -mt_archs]
</span><del>-                while {$a != &quot;NULL&quot;} {
</del><ins>+                while {$a ne &quot;NULL&quot;} {
</ins><span class="cx">                         puts &quot;        Architecture: [$a cget -mat_arch]&quot;
</span><span class="cx">                         puts &quot;                         install name: [$a cget -mat_install_name]&quot;
</span><span class="cx">                         puts &quot;                      current version: [machista::format_dylib_version [$a cget -mat_version]]&quot;
</span><span class="cx">                         puts &quot;                compatibility version: [machista::format_dylib_version [$a cget -mat_comp_version]]&quot;
</span><span class="cx">         
</span><span class="cx">                         set l [$a cget -mat_loadcmds]
</span><del>-                        while {$l != &quot;NULL&quot;} {
</del><ins>+                        while {$l ne &quot;NULL&quot;} {
</ins><span class="cx">                                 puts &quot;                        [$l cget -mlt_install_name] (current version [machista::format_dylib_version [$l cget -mlt_version]], compatibility version [machista::format_dylib_version [$l cget -mlt_comp_version]])&quot;
</span><span class="cx">                                 set l [$l cget -next]
</span><span class="cx">                         }
</span></span></pre></div>
<a id="branchesnewhelpsystembasesrcmacports10"></a>
<div class="propset"><h4>Property changes: branches/new-help-system/base/src/macports1.0</h4>
<pre class="diff"><span>
</span></pre></div>
<a id="svnignore"></a>
<div class="modfile"><h4>Modified: svn:ignore</h4></div>
<span class="cx">macports_autoconf.tcl
</span><span class="cx">macports_fastload.tcl
</span><span class="cx">pkgIndex.tcl
</span><span class="cx">   + *.dylib
</span><span class="cx">macports_autoconf.tcl
</span><span class="cx">macports_test_autoconf.tcl
</span><span class="cx">macports_fastload.tcl
</span><span class="cx">pkgIndex.tcl
</span><a id="branchesnewhelpsystembasesrcmacports10Makefile"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/src/macports1.0/Makefile (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/macports1.0/Makefile        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/src/macports1.0/Makefile        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -16,11 +16,10 @@
</span><span class="cx"> pkgIndex.tcl: $(SRCS)
</span><span class="cx"> 
</span><span class="cx"> test::
</span><del>-        ${TCLSH} tests/macports_dlist.tcl
-        ${TCLSH} tests/macports_util.tcl
</del><ins>+        $(TCLSH) ./tests/test.tcl -nocolor
</ins><span class="cx"> 
</span><span class="cx"> distclean:: clean
</span><del>-        rm -f macports_autoconf.tcl macports_fastload.tcl ${SHLIB_NAME}
</del><ins>+        rm -f macports_autoconf.tcl macports_fastload.tcl macports_test_autoconf.tcl ${SHLIB_NAME}
</ins><span class="cx"> 
</span><span class="cx"> install:: all
</span><span class="cx">         $(INSTALL) -d -o ${DSTUSR} -g ${DSTGRP} -m ${DSTMODE} ${INSTALLDIR}
</span></span></pre></div>
<a id="branchesnewhelpsystembasesrcmacports10get_systemconfiguration_proxiesc"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/src/macports1.0/get_systemconfiguration_proxies.c (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/macports1.0/get_systemconfiguration_proxies.c        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/src/macports1.0/get_systemconfiguration_proxies.c        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -132,7 +132,7 @@
</span><span class="cx">                  * We are adding :&lt;port&gt;\0 to the end, which is up to 7
</span><span class="cx">                  * bytes additional (up to 5 for the port)
</span><span class="cx">                  */
</span><del>-                int newLength = strlen( hostname ) + 7;
</del><ins>+                size_t newLength = strlen( hostname ) + 7;
</ins><span class="cx">                 char *hostnameAndPort = calloc( 1, newLength );
</span><span class="cx">                 if( hostnameAndPort != NULL )
</span><span class="cx">                 {
</span><span class="lines">@@ -165,8 +165,8 @@
</span><span class="cx">  */
</span><span class="cx"> char *cfStringToCStringASCII( CFStringRef cfString )
</span><span class="cx"> {
</span><del>-    int strLen = CFStringGetMaximumSizeForEncoding( CFStringGetLength( cfString ), kCFStringEncodingASCII ) + 1;
-    char *cString = calloc( 1, strLen );
</del><ins>+    CFIndex strLen = CFStringGetMaximumSizeForEncoding( CFStringGetLength( cfString ), kCFStringEncodingASCII ) + 1;
+    char *cString = calloc( 1, (size_t)strLen );
</ins><span class="cx">     if( cString != NULL )
</span><span class="cx">         CFStringGetCString( cfString, cString, strLen, kCFStringEncodingASCII );
</span><span class="cx"> 
</span></span></pre></div>
<a id="branchesnewhelpsystembasesrcmacports10macportstcl"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/src/macports1.0/macports.tcl (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/macports1.0/macports.tcl        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/src/macports1.0/macports.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -45,7 +45,7 @@
</span><span class="cx">         porttrace portverbose keeplogs destroot_umask variants_conf rsync_server rsync_options \
</span><span class="cx">         rsync_dir startupitem_type startupitem_install place_worksymlink xcodeversion xcodebuildcmd \
</span><span class="cx">         configureccache ccache_dir ccache_size configuredistcc configurepipe buildnicevalue buildmakejobs \
</span><del>-        applications_dir frameworks_dir developer_dir universal_archs build_arch macosx_deployment_target \
</del><ins>+        applications_dir frameworks_dir developer_dir universal_archs build_arch macosx_sdk_version macosx_deployment_target \
</ins><span class="cx">         macportsuser proxy_override_env proxy_http proxy_https proxy_ftp proxy_rsync proxy_skip \
</span><span class="cx">         master_site_local patch_site_local archive_site_local buildfromsource \
</span><span class="cx">         revupgrade_autorun revupgrade_mode revupgrade_check_id_loadcmds \
</span><span class="lines">@@ -59,7 +59,7 @@
</span><span class="cx">         rsync_server rsync_options rsync_dir startupitem_type startupitem_install place_worksymlink macportsuser \
</span><span class="cx">         configureccache ccache_dir ccache_size configuredistcc configurepipe buildnicevalue buildmakejobs \
</span><span class="cx">         applications_dir current_phase frameworks_dir developer_dir universal_archs build_arch \
</span><del>-        os_arch os_endian os_version os_major os_platform macosx_version macosx_deployment_target \
</del><ins>+        os_arch os_endian os_version os_major os_platform macosx_version macosx_sdk_version macosx_deployment_target \
</ins><span class="cx">         packagemaker_path default_compilers sandbox_enable delete_la_files cxx_stdlib \
</span><span class="cx">         pkg_post_unarchive_deletions $user_options&quot;
</span><span class="cx"> 
</span><span class="lines">@@ -575,6 +575,7 @@
</span><span class="cx">         macports::os_major \
</span><span class="cx">         macports::os_platform \
</span><span class="cx">         macports::macosx_version \
</span><ins>+        macports::macosx_sdk_version \
</ins><span class="cx">         macports::macosx_deployment_target \
</span><span class="cx">         macports::archivefetch_pubkeys \
</span><span class="cx">         macports::ping_cache \
</span><span class="lines">@@ -596,11 +597,21 @@
</span><span class="cx">     # Remove trailing &quot;Endian&quot;
</span><span class="cx">     set os_endian [string range $tcl_platform(byteOrder) 0 end-6]
</span><span class="cx">     set macosx_version {}
</span><del>-    if {$os_platform eq {darwin}} {
-        # This will probably break when Apple changes versioning
-        set macosx_version [expr {10.0 + ($os_major - 4) / 10.0}]
</del><ins>+    if {$os_platform eq &quot;darwin&quot; &amp;&amp; [file executable /usr/bin/sw_vers]} {
+        if {![catch {exec /usr/bin/sw_vers -productVersion | cut -f1,2 -d.} result]} {
+            set macosx_version $result
+        } else {
+            ui_debug &quot;sw_vers exists but running it failed: $result&quot;
+        }
</ins><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    # Check that the current platform is the one we were configured for, otherwise need to do migration
+    if {($os_platform != $macports::autoconf::os_platform) || ($os_major != $macports::autoconf::os_major)} {
+        ui_error &quot;Current platform \&quot;$os_platform $os_major\&quot; does not match expected platform \&quot;$macports::autoconf::os_platform $macports::autoconf::os_major\&quot;&quot;
+        ui_error &quot;If you upgraded your OS, please follow the migration instructions: https://trac.macports.org/wiki/Migration&quot;
+        return -code error &quot;OS platform mismatch&quot;
+    }
+
</ins><span class="cx">     # Ensure that the macports user directory (i.e. ~/.macports) exists if HOME is defined.
</span><span class="cx">     # Also save $HOME for later use before replacing it with our own.
</span><span class="cx">     if {[info exists env(HOME)]} {
</span><span class="lines">@@ -950,6 +961,9 @@
</span><span class="cx">     if {![info exists macports::macosx_deployment_target]} {
</span><span class="cx">         set macports::macosx_deployment_target $macosx_version
</span><span class="cx">     }
</span><ins>+    if {![info exists macports::macosx_sdk_version]} {
+        set macports::macosx_sdk_version $macosx_version
+    }
</ins><span class="cx"> 
</span><span class="cx">     if {![info exists macports::revupgrade_autorun]} {
</span><span class="cx">         set macports::revupgrade_autorun yes
</span><span class="lines">@@ -965,7 +979,9 @@
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx">     if {![info exists macports::cxx_stdlib]} {
</span><del>-        if {$os_platform eq &quot;darwin&quot; &amp;&amp; $os_major &lt; 13} {
</del><ins>+        if {$os_platform eq &quot;darwin&quot; &amp;&amp; $os_major &gt;= 13} {
+            set macports::cxx_stdlib libc++
+        } elseif {$os_platform eq &quot;darwin&quot;} {
</ins><span class="cx">             set macports::cxx_stdlib libstdc++
</span><span class="cx">         } else {
</span><span class="cx">             set macports::cxx_stdlib {}
</span><span class="lines">@@ -1014,6 +1030,15 @@
</span><span class="cx">         return -code error &quot;Library directory '$libpath' must exist&quot;
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    # set the hidden flag on $portdbpath to avoid spotlight indexing, which
+    # might slow builds down considerably. You can avoid this by touching
+    # $portdbpath/.nohide.
+    if {$os_platform eq &quot;darwin&quot; &amp;&amp; [vercmp [info tclversion] 8.5] &gt;= 0 &amp;&amp; ![file exists [file join $portdbpath .nohide]] &amp;&amp; [file writable $portdbpath] &amp;&amp; [file attributes $portdbpath -hidden] == 0} {
+        if {[catch {file attributes $portdbpath -hidden yes} result]} {
+            ui_debug &quot;error setting hidden flag for $portdbpath: $result&quot;
+        }
+    }
+
</ins><span class="cx">     # don't keep unusable TMPDIR/TMP values
</span><span class="cx">     foreach var {TMP TMPDIR} {
</span><span class="cx">         if {[info exists env($var)] &amp;&amp; [file writable $env($var)] &amp;&amp;
</span><span class="lines">@@ -1255,8 +1280,11 @@
</span><span class="cx">         foreach phase $macports::port_phases {
</span><span class="cx">             $workername alias ui_${priority}_$phase ui_${priority}_$phase
</span><span class="cx">         }
</span><del>-
</del><span class="cx">     }
</span><ins>+    # add the UI progress call-back
+    if {[info exists macports::ui_options(progress_download)]} {
+        $workername alias ui_progress_download $macports::ui_options(progress_download)
+    }
</ins><span class="cx"> 
</span><span class="cx">     $workername alias ui_prefix ui_prefix
</span><span class="cx">     $workername alias ui_channels ui_channels
</span><span class="lines">@@ -1414,7 +1442,7 @@
</span><span class="cx"> # @param local one, if the URL is local, zero otherwise
</span><span class="cx"> # @return a path to a directory containing the Portfile, or an error code
</span><span class="cx"> proc macports::fetch_port {url {local 0}} {
</span><del>-    global macports::portdbpath macports::ui_prefix macports::portverbose
</del><ins>+    global macports::portdbpath macports::ui_prefix macports::portverbose macports::ui_options
</ins><span class="cx"> 
</span><span class="cx">     set fetchdir [file join $portdbpath portdirs]
</span><span class="cx">     file mkdir $fetchdir
</span><span class="lines">@@ -1427,11 +1455,13 @@
</span><span class="cx">     } else {
</span><span class="cx">         ui_msg &quot;$macports::ui_prefix Fetching port $url&quot;
</span><span class="cx">         set fetchfile [file tail $url]
</span><del>-        set verboseflag {}
</del><ins>+        set progressflag {}
</ins><span class="cx">         if {$macports::portverbose eq {yes}} {
</span><del>-            set verboseflag -v
</del><ins>+            set progressflag &quot;--progress builtin&quot;
+        } elseif {[info exists macports::ui_options(progress_download)]} {
+            set progressflag &quot;--progress ${macports::ui_options(progress_download)}&quot;
</ins><span class="cx">         }
</span><del>-        if {[catch {eval curl fetch $verboseflag {$url} {[file join $fetchdir $fetchfile]}} result]} {
</del><ins>+        if {[catch {eval curl fetch $progressflag {$url} {[file join $fetchdir $fetchfile]}} result]} {
</ins><span class="cx">             return -code error &quot;Port remote fetch failed: $result&quot;
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="lines">@@ -1903,7 +1933,7 @@
</span><span class="cx">             if {![macports::ui_isset ports_debug]} {
</span><span class="cx">                 ui_msg {}
</span><span class="cx">             }
</span><del>-            return -code error &quot;Can't install $portinfo(name) because conflicting ports are installed: $conflictlist&quot;
</del><ins>+            return -code error &quot;Can't install $portinfo(name) because conflicting ports are active: $conflictlist&quot;
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="lines">@@ -2222,7 +2252,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> proc macports::getportworkpath_from_buildpath {portbuildpath} {
</span><del>-    return [file join $portbuildpath work]
</del><ins>+    return [file normalize [file join $portbuildpath work]]
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> proc macports::getportworkpath_from_portdir {portpath {portname {}}} {
</span><span class="lines">@@ -2241,7 +2271,8 @@
</span><span class="cx"> proc mportsync {{optionslist {}}} {
</span><span class="cx">     global macports::sources macports::portdbpath macports::rsync_options \
</span><span class="cx">            tcl_platform macports::portverbose macports::autoconf::rsync_path \
</span><del>-           macports::autoconf::tar_path macports::autoconf::openssl_path
</del><ins>+           macports::autoconf::tar_path macports::autoconf::openssl_path \
+           macports::ui_options
</ins><span class="cx">     array set options $optionslist
</span><span class="cx">     if {[info exists options(no_reindex)]} {
</span><span class="cx">         upvar $options(needed_portindex_var) any_needed_portindex
</span><span class="lines">@@ -2290,14 +2321,14 @@
</span><span class="cx">                         incr numfailed
</span><span class="cx">                         continue
</span><span class="cx">                     }
</span><del>-                } elseif {$git_cmd ne {} &amp;&amp; [file exists ${portdir}/.git]} {
</del><ins>+                } elseif {$git_cmd ne {} &amp;&amp; ![catch {exec sh -c &quot;cd ${portdir} &amp;&amp; $git_cmd rev-parse --is-inside-work-tree&quot;} result]} {
</ins><span class="cx">                     # determine what type of git repository this is
</span><del>-                    if {![catch {exec sh -c &quot;$git_cmd --git-dir=${portdir}/.git config --local --get svn-remote.svn.url&quot;} result]} {
</del><ins>+                    if {![catch {exec sh -c &quot;cd ${portdir} &amp;&amp; $git_cmd config --local --get svn-remote.svn.url&quot;} result]} {
</ins><span class="cx">                         set git_action &quot;svn rebase&quot;
</span><span class="cx">                     } else {
</span><span class="cx">                         set git_action &quot;pull --rebase&quot;
</span><span class="cx">                     }
</span><del>-                    set git_commandline &quot;$git_cmd --git-dir=${portdir}/.git --work-tree=${portdir} $git_action&quot;
</del><ins>+                    set git_commandline &quot;pushd $portdir ; $git_cmd $git_action ; popd&quot;
</ins><span class="cx">                     ui_debug $git_commandline
</span><span class="cx">                     if {
</span><span class="cx">                         [catch {
</span><span class="lines">@@ -2484,12 +2515,14 @@
</span><span class="cx"> 
</span><span class="cx">                 file mkdir $destdir
</span><span class="cx"> 
</span><del>-                set verboseflag {}
</del><ins>+                set progressflag {}
</ins><span class="cx">                 if {$macports::portverbose eq {yes}} {
</span><del>-                    set verboseflag -v
</del><ins>+                    set progressflag &quot;--progress builtin&quot;
+                } elseif {[info exists macports::ui_options(progress_download)]} {
+                    set progressflag &quot;--progress ${macports::ui_options(progress_download)}&quot;
</ins><span class="cx">                 }
</span><span class="cx"> 
</span><del>-                if {[catch {eval curl fetch $verboseflag {$source} {$tarpath}} error]} {
</del><ins>+                if {[catch {eval curl fetch $progressflag {$source} {$tarpath}} error]} {
</ins><span class="cx">                     ui_error &quot;Fetching $source failed ($error)&quot;
</span><span class="cx">                     incr numfailed
</span><span class="cx">                     continue
</span><span class="lines">@@ -2632,7 +2665,7 @@
</span><span class="cx">                             } else {
</span><span class="cx">                                 set compres [string compare -nocase $pattern $target]
</span><span class="cx">                             }
</span><del>-                            set matchres [expr 0 == $compres]
</del><ins>+                            set matchres [expr {0 == $compres}]
</ins><span class="cx">                         }
</span><span class="cx">                         glob {
</span><span class="cx">                             if {$case_sensitive eq yes} {
</span><span class="lines">@@ -3104,17 +3137,23 @@
</span><span class="cx">                     return 1
</span><span class="cx">                 } elseif {[info exists dep_portinfo(installs_libs)] &amp;&amp; !$dep_portinfo(installs_libs)} {
</span><span class="cx">                     set check_archs 0
</span><ins>+                    if {$skipSatisfied &amp;&amp; $present} {
+                        set parse 0
+                    }
</ins><span class="cx">                 }
</span><del>-                set dep_options $options
-                lappend dep_options subport $dep_portinfo(name)
-                # Figure out the depport. Check the open_mports list first, since
-                # we potentially leak mport references if we mportopen each time,
-                # because mportexec only closes each open mport once.
-                set depport [dlist_match_multi $macports::open_mports [list porturl $dep_portinfo(porturl) options $dep_options]]
</del><span class="cx"> 
</span><del>-                if {$depport eq {}} {
-                    # We haven't opened this one yet.
-                    set depport [mportopen $dep_portinfo(porturl) $dep_options $variations]
</del><ins>+                if {$parse} {
+                    set dep_options $options
+                    lappend dep_options subport $dep_portinfo(name)
+                    # Figure out the depport. Check the open_mports list first, since
+                    # we potentially leak mport references if we mportopen each time,
+                    # because mportexec only closes each open mport once.
+                    set depport [dlist_match_multi $macports::open_mports [list porturl $dep_portinfo(porturl) options $dep_options]]
+
+                    if {$depport eq {}} {
+                        # We haven't opened this one yet.
+                        set depport [mportopen $dep_portinfo(porturl) $dep_options $variations]
+                    }
</ins><span class="cx">                 }
</span><span class="cx">             }
</span><span class="cx"> 
</span><span class="lines">@@ -3166,11 +3205,15 @@
</span><span class="cx"> 
</span><span class="cx">     # Loop on the depports.
</span><span class="cx">     if {$recurseDeps} {
</span><ins>+        # Dep ports should be installed (all dependencies must be satisfied).
</ins><span class="cx">         foreach depport $depPorts {
</span><del>-            # Sub ports should be installed (all dependencies must be satisfied).
-            set res [mportdepends $depport {} $recurseDeps $skipSatisfied 1]
-            if {$res != 0} {
-                return $res
</del><ins>+            # Any of these may have been closed by a previous recursive call
+            # and replaced by a universal version. This is fine, just skip.
+            if {[ditem_key $depport] ne {}} {
+                set res [mportdepends $depport {} $recurseDeps $skipSatisfied 1]
+                if {$res != 0} {
+                    return $res
+                }
</ins><span class="cx">             }
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="lines">@@ -3816,6 +3859,11 @@
</span><span class="cx">     array set interp_options [array get options]
</span><span class="cx">     set interp_options(ports_requested) $requestedflag
</span><span class="cx">     set interp_options(subport) $newname
</span><ins>+    # Mark this port to be rebuilt from source if this isn't the first time it
+    # was flagged as broken by rev-upgrade
+    if {$is_revupgrade_second_run} {
+        set interp_options(ports_source_only) yes
+    }
</ins><span class="cx"> 
</span><span class="cx">     if {[catch {set mport [mportopen $porturl [array get interp_options] [array get variations]]} result]} {
</span><span class="cx">         global errorInfo
</span><span class="lines">@@ -3885,7 +3933,7 @@
</span><span class="cx">     # first upgrade dependencies
</span><span class="cx">     if {![info exists options(ports_nodeps)]} {
</span><span class="cx">         # the last arg is because we might have to build from source if a rebuild is being forced
</span><del>-        set status [_upgrade_dependencies portinfo depscache variationslist options [expr {$will_build &amp;&amp; $already_installed &amp;&amp; !$is_revupgrade}]]
</del><ins>+        set status [_upgrade_dependencies portinfo depscache variationslist options [expr {$will_build &amp;&amp; $already_installed}]]
</ins><span class="cx">         if {$status != 0 &amp;&amp; $status != 2 &amp;&amp; ![ui_isset ports_processall]} {
</span><span class="cx">             catch {mportclose $mport}
</span><span class="cx">             return $status
</span><span class="lines">@@ -3976,7 +4024,7 @@
</span><span class="cx">         # we have to force the uninstall in case of dependents
</span><span class="cx">         set force_cur [info exists options(ports_force)]
</span><span class="cx">         set options(ports_force) yes
</span><del>-        set existing_epoch [lindex [lindex [registry::installed $newname ${version_in_tree}_${revision_in_tree}$portinfo(canonical_active_variants)] 0] 5]
</del><ins>+        set existing_epoch [lindex [registry::installed $newname ${version_in_tree}_${revision_in_tree}$portinfo(canonical_active_variants)] 0 5]
</ins><span class="cx">         set newregref [registry::open_entry $newname $version_in_tree $revision_in_tree $portinfo(canonical_active_variants) $existing_epoch]
</span><span class="cx">         if {$is_dryrun eq {yes}} {
</span><span class="cx">             ui_msg &quot;Skipping uninstall $newname @${version_in_tree}_${revision_in_tree}$portinfo(canonical_active_variants) (dry run)&quot;
</span><span class="lines">@@ -4307,17 +4355,22 @@
</span><span class="cx"> 
</span><span class="cx">     set files [registry::file search active 1 binary -null]
</span><span class="cx">     set files_count [llength $files]
</span><del>-    set fancy_output [expr {![macports::ui_isset ports_debug] &amp;&amp; [isatty stdout]}]
</del><ins>+    set fancy_output [expr {![macports::ui_isset ports_debug] &amp;&amp; [info exists macports::ui_options(progress_generic)]}]
+    if {$fancy_output} {
+        set revupgrade_progress $macports::ui_options(progress_generic)
+    }
</ins><span class="cx">     if {$files_count &gt; 0} {
</span><span class="cx">         registry::write {
</span><span class="cx">             try {
</span><del>-                ui_msg -nonewline &quot;$macports::ui_prefix Updating database of binaries&quot;
</del><ins>+                ui_msg &quot;$macports::ui_prefix Updating database of binaries&quot;
</ins><span class="cx">                 set i 1
</span><ins>+                if {$fancy_output} {
+                    $revupgrade_progress start
+                }
</ins><span class="cx">                 foreach f $files {
</span><span class="cx">                     if {$fancy_output} {
</span><del>-                        if {$files_count &lt; 10000 || $i % 10 == 1 || $i == $files_count} {
-                            ui_msg -nonewline &quot;\r$macports::ui_prefix Updating database of binaries: [expr {($i * 1000 / $files_count) / 10.0}]%&quot;
-                            flush stdout
</del><ins>+                        if {$files_count &lt; 10000 || $i % 10 == 1} {
+                            $revupgrade_progress update $i $files_count
</ins><span class="cx">                         }
</span><span class="cx">                     }
</span><span class="cx">                     set fpath [$f actual_path]
</span><span class="lines">@@ -4327,7 +4380,7 @@
</span><span class="cx">                     if {0 != [catch {$f binary [fileIsBinary $fpath]} fileIsBinaryError]} {
</span><span class="cx">                         # handle errors (e.g. file not found, permission denied) gracefully
</span><span class="cx">                         if {$fancy_output} {
</span><del>-                            ui_msg {}
</del><ins>+                            $revupgrade_progress intermission
</ins><span class="cx">                         }
</span><span class="cx">                         ui_warn &quot;Error determining file type of `$fpath': $fileIsBinaryError&quot;
</span><span class="cx">                         ui_warn &quot;A file belonging to the `[[registry::entry owner $fpath] name]' port is missing or unreadable. Consider reinstalling it.&quot;
</span><span class="lines">@@ -4338,14 +4391,16 @@
</span><span class="cx">                 throw
</span><span class="cx">             }
</span><span class="cx">         }
</span><del>-        ui_msg {}
</del><ins>+        if {$fancy_output} {
+            $revupgrade_progress finish
+        }
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     set broken_files {};
</span><span class="cx">     set binaries [registry::file search active 1 binary 1]
</span><span class="cx">     set binary_count [llength $binaries]
</span><span class="cx">     if {$binary_count &gt; 0} {
</span><del>-        ui_msg -nonewline &quot;$macports::ui_prefix Scanning binaries for linking errors&quot;
</del><ins>+        ui_msg &quot;$macports::ui_prefix Scanning binaries for linking errors&quot;
</ins><span class="cx">         set handle [machista::create_handle]
</span><span class="cx">         if {$handle eq {NULL}} {
</span><span class="cx">             error &quot;Error creating libmachista handle&quot;
</span><span class="lines">@@ -4353,12 +4408,15 @@
</span><span class="cx">         array unset files_warned_about
</span><span class="cx">         array set files_warned_about [list]
</span><span class="cx"> 
</span><ins>+        if {$fancy_output} {
+            $revupgrade_progress start
+        }
+
</ins><span class="cx">         set i 1
</span><span class="cx">         foreach b $binaries {
</span><span class="cx">             if {$fancy_output} {
</span><del>-                if {$binary_count &lt; 10000 || $i % 10 == 1 || $i == $binary_count} {
-                    ui_msg -nonewline &quot;\r$macports::ui_prefix Scanning binaries for linking errors: [expr {($i * 1000 / $binary_count) / 10.0}]%&quot;
-                    flush stdout
</del><ins>+                if {$binary_count &lt; 10000 || $i % 10 == 1} {
+                    $revupgrade_progress update $i $binary_count
</ins><span class="cx">                 }
</span><span class="cx">             }
</span><span class="cx">             set bpath [$b actual_path]
</span><span class="lines">@@ -4376,7 +4434,7 @@
</span><span class="cx">                     #ui_debug &quot;Error parsing file ${bpath}: [machista::strerror $returncode]&quot;
</span><span class="cx">                 } else {
</span><span class="cx">                     if {$fancy_output} {
</span><del>-                        ui_msg {}
</del><ins>+                        $revupgrade_progress intermission
</ins><span class="cx">                     }
</span><span class="cx">                     ui_warn &quot;Error parsing file ${bpath}: [machista::strerror $returncode]&quot;
</span><span class="cx">                 }
</span><span class="lines">@@ -4398,7 +4456,7 @@
</span><span class="cx">                                     set portname &lt;unknown-port&gt;
</span><span class="cx">                                 }
</span><span class="cx">                                 if {$fancy_output} {
</span><del>-                                    ui_msg {}
</del><ins>+                                    $revupgrade_progress intermission
</ins><span class="cx">                                 }
</span><span class="cx">                                 ui_warn &quot;ID load command in ${bpath}, arch [machista::get_arch_name [$architecture cget -mat_arch]] (belonging to port $portname) contains relative path&quot;
</span><span class="cx">                             } elseif {![file exists $idloadcmdpath]} {
</span><span class="lines">@@ -4409,7 +4467,7 @@
</span><span class="cx">                                     set portname &lt;unknown-port&gt;
</span><span class="cx">                                 }
</span><span class="cx">                                 if {$fancy_output} {
</span><del>-                                    ui_msg {}
</del><ins>+                                    $revupgrade_progress intermission
</ins><span class="cx">                                 }
</span><span class="cx">                                 ui_warn &quot;ID load command in ${bpath}, arch [machista::get_arch_name [$architecture cget -mat_arch]] refers to non-existant file $idloadcmdpath&quot;
</span><span class="cx">                                 ui_warn &quot;This is probably a bug in the $portname port and might cause problems in libraries linking against this file&quot;
</span><span class="lines">@@ -4426,7 +4484,7 @@
</span><span class="cx">                                         set portname &lt;unknown-port&gt;
</span><span class="cx">                                     }
</span><span class="cx">                                     if {$fancy_output} {
</span><del>-                                        ui_msg {}
</del><ins>+                                        $revupgrade_progress intermission
</ins><span class="cx">                                     }
</span><span class="cx">                                     ui_warn &quot;ID load command in ${bpath}, arch [machista::get_arch_name [$architecture cget -mat_arch]] refers to file ${idloadcmdpath}, which is a different file&quot;
</span><span class="cx">                                     ui_warn &quot;This is probably a bug in the $portname port and might cause problems in libraries linking against this file&quot;
</span><span class="lines">@@ -4451,14 +4509,23 @@
</span><span class="cx">                         continue;
</span><span class="cx">                     }
</span><span class="cx"> 
</span><ins>+                    if {(${filepath} == &quot;/usr/lib/libstdc++.6.dylib&quot; &amp;&amp; ${macports::cxx_stdlib} == &quot;libc++&quot;) ||
+                        (${filepath} == &quot;/usr/lib/libc++.1.dylib&quot; &amp;&amp; ${macports::cxx_stdlib} == &quot;libstdc++&quot;)} {
+
+                        if {$fancy_output} {
+                            $revupgrade_progress intermission
+                        }
+                        ui_warn &quot;${bpath} uses ${filepath} as C++ standard library although macports::cxx_stdlib is set to ${macports::cxx_stdlib}.&quot;
+                    }
+
</ins><span class="cx">                     set libresultlist [machista::parse_file $handle $filepath]
</span><span class="cx">                     set libreturncode [lindex $libresultlist 0]
</span><span class="cx">                     set libresult     [lindex $libresultlist 1]
</span><span class="cx"> 
</span><span class="cx">                     if {$libreturncode != $machista::SUCCESS} {
</span><span class="cx">                         if {![info exists files_warned_about($filepath)]} {
</span><del>-                            if {[macports::ui_isset ports_verbose]} {
-                                ui_msg {}
</del><ins>+                            if {$fancy_output} {
+                                $revupgrade_progress intermission
</ins><span class="cx">                             }
</span><span class="cx">                             ui_info &quot;Could not open ${filepath}: [machista::strerror $libreturncode] (referenced from $bpath)&quot;
</span><span class="cx">                             set files_warned_about($filepath) yes
</span><span class="lines">@@ -4480,8 +4547,8 @@
</span><span class="cx">                         }
</span><span class="cx"> 
</span><span class="cx">                         if {[$loadcommand cget -mlt_version] ne [$libarchitecture cget -mat_version] &amp;&amp; [$loadcommand cget -mlt_comp_version] &gt; [$libarchitecture cget -mat_comp_version]} {
</span><del>-                            if {[macports::ui_isset ports_verbose]} {
-                                ui_msg {}
</del><ins>+                            if {$fancy_output} {
+                                $revupgrade_progress intermission
</ins><span class="cx">                             }
</span><span class="cx">                             ui_info &quot;Incompatible library version: $bpath requires version [machista::format_dylib_version [$loadcommand cget -mlt_comp_version]] or later, but $filepath provides version [machista::format_dylib_version [$libarchitecture cget -mat_comp_version]]&quot;
</span><span class="cx">                             ui_debug &quot;Marking $bpath as broken&quot;
</span><span class="lines">@@ -4508,7 +4575,9 @@
</span><span class="cx">                 set architecture [$architecture cget -next]
</span><span class="cx">             }
</span><span class="cx">         }
</span><del>-        ui_msg {}
</del><ins>+        if {$fancy_output} {
+            $revupgrade_progress finish
+        }
</ins><span class="cx"> 
</span><span class="cx">         machista::destroy_handle $handle
</span><span class="cx"> 
</span><span class="lines">@@ -4664,16 +4733,20 @@
</span><span class="cx">         array set depscache {}
</span><span class="cx">         set status 0
</span><span class="cx">         array set my_options [array get macports::global_options]
</span><ins>+        set my_options(ports_revupgrade) yes
</ins><span class="cx">         foreach port $topsort_ports {
</span><span class="cx">             set portname [$port name]
</span><span class="cx">             if {![info exists depscache(port:$portname)]} {
</span><del>-                # set rev-upgrade options and nodeps if this is not the first run
-                set my_options(ports_revupgrade) yes
-                unset -nocomplain my_options(ports_revupgrade_second_run)
</del><ins>+                unset -nocomplain my_options(ports_revupgrade_second_run) \
+                                  my_options(ports_nodeps)
</ins><span class="cx">                 if {$broken_port_counts($portname) &gt; 1} {
</span><span class="cx">                     set my_options(ports_revupgrade_second_run) yes
</span><del>-                    # build from source only until the buildbot has some method of rev-upgrade, too
-                    set my_options(ports_source_only) yes
</del><ins>+
+                    if {$broken_port_counts($portname) &gt; 2} {
+                        # runtime deps are upgraded the first time, build deps 
+                        # the second, so none left to do the third time
+                        set my_options(ports_nodeps) yes
+                    }
</ins><span class="cx">                 }
</span><span class="cx"> 
</span><span class="cx">                 # call macports::upgrade with ports_revupgrade option to rebuild the port
</span></span></pre></div>
<a id="branchesnewhelpsystembasesrcmacports10macports_autoconftclin"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/src/macports1.0/macports_autoconf.tcl.in (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/macports1.0/macports_autoconf.tcl.in        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/src/macports1.0/macports_autoconf.tcl.in        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -54,4 +54,6 @@
</span><span class="cx">     variable xar_path &quot;@XAR@&quot;
</span><span class="cx">     variable xcode_select_path &quot;@XCODE_SELECT@&quot;
</span><span class="cx">     variable xcodebuild_path &quot;@XCODEBUILD@&quot;
</span><ins>+    variable os_platform &quot;@OS_PLATFORM@&quot;
+    variable os_major &quot;@OS_MAJOR@&quot;
</ins><span class="cx"> }
</span></span></pre></div>
<a id="branchesnewhelpsystembasesrcmacports10macports_dlisttcl"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/src/macports1.0/macports_dlist.tcl (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/macports1.0/macports_dlist.tcl        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/src/macports1.0/macports_dlist.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -292,7 +292,7 @@
</span><span class="cx">         
</span><span class="cx">         # Do a pre-run seeing if any items automagically
</span><span class="cx">         # can evaluate to true.
</span><del>-        if {$testcond != &quot;&quot;} {
</del><ins>+        if {$testcond ne &quot;&quot;} {
</ins><span class="cx">                 foreach ditem $dlist {
</span><span class="cx">                         if {[eval &quot;expr \[\$testcond \$ditem\] == 1&quot;]} {
</span><span class="cx">                                 foreach token [ditem_key $ditem provides] {
</span><span class="lines">@@ -323,7 +323,7 @@
</span><span class="cx">                         if {$result == {}} { set result 0 }
</span><span class="cx">                         
</span><span class="cx">                         foreach token [ditem_key $ditem provides] {
</span><del>-                                set statusdict($token) [expr $result == 0]
</del><ins>+                                set statusdict($token) [expr {$result == 0}]
</ins><span class="cx">                         }
</span><span class="cx">                         
</span><span class="cx">                         # Abort if we're not allowed to fail
</span></span></pre></div>
<a id="branchesnewhelpsystembasesrcmacports10macports_test_autoconftclinfromrev117083trunkbasesrcmacports10macports_test_autoconftclin"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/src/macports1.0/macports_test_autoconf.tcl.in (from rev 117083, trunk/base/src/macports1.0/macports_test_autoconf.tcl.in) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/macports1.0/macports_test_autoconf.tcl.in                                (rev 0)
+++ branches/new-help-system/base/src/macports1.0/macports_test_autoconf.tcl.in        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,37 @@
</span><ins>+# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4
+# macports-autoconf.tcl.in
+# $Id: macports_autoconf.tcl.in 90070 2012-02-20 21:54:35Z jberry@macports.org $
+#
+# Copyright (c) 2006 - 2009, 2011 The MacPorts Project
+# Copyright (c) 2002 - 2003 Apple 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 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 &quot;AS IS&quot;
+# 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.
+#
+
+namespace eval macports::autoconf {
+    variable macports_tcl_dir &quot;@macports_tcl_dir@&quot;
+    variable prefix &quot;@prefix@&quot;
+}
</ins></span></pre></div>
<a id="branchesnewhelpsystembasesrcmacports10macports_utiltcl"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/src/macports1.0/macports_util.tcl (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/macports1.0/macports_util.tcl        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/src/macports1.0/macports_util.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -98,8 +98,8 @@
</span><span class="cx">             if {$size == 0} {
</span><span class="cx">                 set badrange? 1
</span><span class="cx">             }
</span><del>-        } elseif {[string match end-* $idx] &amp;&amp; [string is integer -strict [string range $idx 4 end]]} {
-            set i [expr $size - 1 - [string range $idx 4 end]]
</del><ins>+        } elseif {[string match &quot;end-*&quot; $idx] &amp;&amp; [string is integer -strict [string range $idx 4 end]]} {
+            set i [expr {$size - 1 - [string range $idx 4 end]}]
</ins><span class="cx">             if {$i &lt; 0 || $i &gt;= $size} {
</span><span class="cx">                 set badrange? 1
</span><span class="cx">             }
</span><span class="lines">@@ -270,8 +270,8 @@
</span><span class="cx">         foreach {elem catchBody} $catchList {
</span><span class="cx">             set typeList [lshift elem]
</span><span class="cx">             set match? 1
</span><del>-            set typeList [lrange $typeList 0 [expr [llength $savedErrorCode] - 1]]
-            set codeList [lrange $savedErrorCode 0 [expr [llength $typeList] - 1]]
</del><ins>+            set typeList [lrange $typeList 0 [expr {[llength $savedErrorCode] - 1}]]
+            set codeList [lrange $savedErrorCode 0 [expr {[llength $typeList] - 1}]]
</ins><span class="cx">             foreach type $typeList code $codeList {
</span><span class="cx">                 if {![string match $type $code]} {
</span><span class="cx">                     set match? 0
</span></span></pre></div>
<a id="branchesnewhelpsystembasesrcmacports10testsPortfilefromrev117083trunkbasesrcmacports10testsPortfile"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/src/macports1.0/tests/Portfile (from rev 117083, trunk/base/src/macports1.0/tests/Portfile) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/macports1.0/tests/Portfile                                (rev 0)
+++ branches/new-help-system/base/src/macports1.0/tests/Portfile        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,40 @@
</span><ins>+# $Id: Portfile 85472 2011-10-14 01:52:18Z dports@macports.org $
+
+PortSystem              1.0
+
+name                    fondu
+version                 060102
+revision                1
+platforms               darwin
+categories              print
+license                 BSD
+maintainers             nomaintainer
+homepage                http://fondu.sourceforge.net/
+master_sites            http://fondu.sourceforge.net/
+
+description             A set of programs to interconvert between Mac font \
+                        formats and pfb, ttf, otf and bdf files on UNIX.
+
+long_description        Dealing with Mac fonts is hard on other operating \
+                        systems because Mac fonts are stored in the resource \
+                        fork, and other operating systems do not support \
+                        this concept. Fondu will extract the resource fork \
+                        from either a MacBinary file or a BinHex file. Ufond \
+                        will create a resource fork inside a MacBinary file.
+
+checksums               md5 e20861beacddc1ab392bef7813641bf8
+extract.suffix          .tgz
+distfiles               ${name}_src-${version}${extract.suffix}
+
+post-patch {
+    reinplace &quot;s|^CFLAGS = -g \$(WFLAGS)|CFLAGS = -g \$(WFLAGS) ${configure.cppflags} ${configure.cflags} ${configure.ldflags} [get_canonical_archflags]|g&quot; ${worksrcpath}/Makefile.in
+}
+
+configure.args          --bindir=${prefix}/bin \
+                        --mandir=${prefix}/share/man
+
+post-destroot {
+    eval xinstall -m 644 [glob ${worksrcpath}/*.1] ${destroot}${prefix}/share/man/man1/
+}
+
+test.run                yes
</ins></span></pre></div>
<a id="branchesnewhelpsystembasesrcmacports10testslibrarytclfromrev117083trunkbasesrcmacports10testslibrarytcl"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/src/macports1.0/tests/library.tcl (from rev 117083, trunk/base/src/macports1.0/tests/library.tcl) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/macports1.0/tests/library.tcl                                (rev 0)
+++ branches/new-help-system/base/src/macports1.0/tests/library.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,65 @@
</span><ins>+##
+# This is basically a copy of macports::worker_init, but without using
+# sub-interpreters
+proc macports_worker_init {} {
+    interp alias {} _cd {} cd
+    proc PortSystem {version} {
+        package require port $version
+    }
+    # Clearly separate slave interpreters and the master interpreter.
+    interp alias {} mport_exec      {} mportexec
+    interp alias {} mport_open      {} mportopen
+    interp alias {} mport_close     {} mportclose
+    interp alias {} mport_lookup    {} mportlookup
+    interp alias {} mport_info      {} mportinfo
+    # Export some utility functions defined here.
+    interp alias {} macports_create_thread          {} macports::create_thread
+    interp alias {} getportworkpath_from_buildpath  {} macports::getportworkpath_from_buildpath
+    interp alias {} getportresourcepath             {} macports::getportresourcepath
+    interp alias {} getportlogpath                  {} macports::getportlogpath
+    interp alias {} getdefaultportresourcepath      {} macports::getdefaultportresourcepath
+    interp alias {} getprotocol                     {} macports::getprotocol
+    interp alias {} getportdir                      {} macports::getportdir
+    interp alias {} findBinary                      {} macports::findBinary
+    interp alias {} binaryInPath                    {} macports::binaryInPath
+    # New Registry/Receipts stuff
+    interp alias {} registry_new                    {} registry::new_entry
+    interp alias {} registry_open                   {} registry::open_entry
+    interp alias {} registry_write                  {} registry::write_entry
+    interp alias {} registry_prop_store             {} registry::property_store
+    interp alias {} registry_prop_retr              {} registry::property_retrieve
+    interp alias {} registry_exists                 {} registry::entry_exists
+    interp alias {} registry_exists_for_name        {} registry::entry_exists_for_name
+    interp alias {} registry_activate               {} portimage::activate
+    interp alias {} registry_deactivate             {} portimage::deactivate
+    interp alias {} registry_deactivate_composite   {} portimage::deactivate_composite
+    interp alias {} registry_uninstall              {} registry_uninstall::uninstall
+    interp alias {} registry_register_deps          {} registry::register_dependencies
+    interp alias {} registry_fileinfo_for_index     {} registry::fileinfo_for_index
+    interp alias {} registry_fileinfo_for_file      {} registry::fileinfo_for_file
+    interp alias {} registry_bulk_register_files    {} registry::register_bulk_files
+    interp alias {} registry_active                 {} registry::active
+    interp alias {} registry_file_registered        {} registry::file_registered
+    interp alias {} registry_port_registered        {} registry::port_registered
+    interp alias {} registry_list_depends           {} registry::list_depends
+    # deferred options processing.
+    interp alias {} getoption {} macports::getoption
+    # ping cache
+    interp alias {} get_pingtime {} macports::get_pingtime
+    interp alias {} set_pingtime {} macports::set_pingtime
+    # archive_sites.conf handling
+    interp alias {} get_archive_sites_conf_values {} macports::get_archive_sites_conf_values
+    foreach opt $macports::portinterp_options {
+        if {![info exists $opt]} {
+            global macports::$opt
+            set ::$opt macports::$opt
+        }
+        if {[info exists $opt]} {
+            set system_options($opt) $opt
+            set ::$opt $opt
+        }
+    }
+
+    # We don't need to handle portinterp_deferred_options, they're
+    # automatically handled correctly.
+}
</ins></span></pre></div>
<a id="branchesnewhelpsystembasesrcmacports10testsmacportstestfromrev117083trunkbasesrcmacports10testsmacportstest"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/src/macports1.0/tests/macports.test (from rev 117083, trunk/base/src/macports1.0/tests/macports.test) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/macports1.0/tests/macports.test                                (rev 0)
+++ branches/new-help-system/base/src/macports1.0/tests/macports.test        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,966 @@
</span><ins>+# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
+
+package require tcltest 2
+namespace import tcltest::*
+eval ::tcltest::configure $::argv
+
+set pwd [file dirname [file normalize $argv0]]
+
+source ../macports_test_autoconf.tcl
+source $macports::autoconf::macports_tcl_dir/macports1.0/macports_fastload.tcl
+package require macports 1.0
+
+# clean leftovers from interrupted tests
+file delete -force $pwd/tmpdir
+
+# use custom macports.conf and sources.conf
+makeDirectory $pwd/tmpdir
+makeDirectory $pwd/tmpdir/share
+makeDirectory $pwd/tmpdir/var/macports/registry
+set fd [open $pwd/tmpdir/macports.conf w+]
+puts $fd &quot;portdbpath $pwd/tmpdir/var/macports&quot;
+puts $fd &quot;prefix $pwd/tmpdir&quot;
+puts $fd &quot;variants_conf $pwd/tmpdir/variants.conf&quot;
+puts $fd &quot;sources_conf $pwd/sources.conf&quot;
+puts $fd &quot;applications_dir $pwd/tmpdir/Applications&quot;
+puts $fd &quot;frameworks_dir $pwd/tmpdir/Library/Frameworks&quot;
+close $fd
+set env(PORTSRC) $pwd/tmpdir/macports.conf
+file link -symbolic $pwd/tmpdir/share/macports $macports::autoconf::prefix/share/macports
+close [open $pwd/tmpdir/variants.conf w+]
+
+# Debug options
+array set ui_options {}
+#set ui_options(ports_debug)   yes
+#set ui_options(ports_verbose) yes
+mportinit ui_options
+
+package require portutil 1.0
+package require portinstall 1.0
+package require portuninstall 1.0
+package require Thread
+source ../../registry2.0/portuninstall.tcl
+source ../../port1.0/port_autoconf.tcl
+source ./library.tcl
+macports_worker_init
+
+
+test mportclose {
+    Mport close unit test.
+} -setup {
+    set mport [mportopen file://.]
+} -body {
+    if {[catch {mportclose $mport}] != 0} {
+       return &quot;FAIL: cannot run mportclose&quot;
+    }
+    if {[ditem_key $mport workername] != &quot;&quot;} {
+       return &quot;FAIL: port not closed&quot;
+    }
+    return &quot;Mport close successful.&quot;
+} -cleanup {
+    catch {mportclose $mport}
+} -result &quot;Mport close successful.&quot;
+
+
+test mportinfo {
+    Mport info uni test.
+} -setup {
+    set mport [mportopen file://.]
+} -body {
+    set res [mportinfo $mport]
+    if {[lindex $res 2] != &quot;canonical_active_variants&quot;} {
+        return &quot;FAIL: cannot get ::PortInfo&quot;
+    }
+    return &quot;Mport info successful.&quot;
+} -cleanup {
+    mportclose $mport
+} -result &quot;Mport info successful.&quot;
+
+
+test mportopen_installed {
+    Mport installed unit test.
+} -constraints {
+    root
+} -setup {
+    set os.platform darwin
+    set macosx_version 10.8
+    set os.major 10
+    set os_version 11
+    set os_arch i386
+
+    set supported_archs {}
+    set configure.build_arch build_arch
+    set portarchivetype tgz
+
+    set destpath $pwd/work/destroot
+    set portdbpath $pwd/portdbpath
+    set workpath $pwd/fondu/work
+    set portpath $pwd
+
+    set subport fondu
+    set version 3.0
+    set revision 1
+    set epoch i386
+
+    file copy -force $pwd/Portfile /tmp/
+    set mport [mportopen file://.]
+
+    proc getportbuildpath {id {portname &quot;&quot;}} {
+        global portdbpath
+        regsub {://} $id {.} port_path
+        regsub -all {/} $port_path {_} port_path
+        return [file join $portdbpath build $port_path $portname]
+    }
+
+    proc getportworkpath_from_buildpath {portbuildpath} {
+        return [file join $portbuildpath work]
+    }
+
+    proc getportworkpath_from_portdir {portpath {portname &quot;&quot;}} {
+        return [getportworkpath_from_buildpath [getportbuildpath $portpath $portname]]
+    }
+
+    source $pwd/../../port1.0/portmain.tcl
+
+    # sets up PortInfo array
+    if {[eval_variants variations] != 0} {
+        mportclose $mport
+        error &quot;Error evaluating variants&quot;
+    }
+
+    # set $version var
+    set workername [ditem_key $mport workername]
+
+    # run destroot
+    $workername eval eval_targets destroot
+
+    # portinstall setup
+    interp alias {} _cd {} cd
+    set macosx_deployment_target $pwd/deploy_target
+    file mkdir $pwd/$subport
+    file link -symbolic $pwd/$subport/work $pwd/work
+
+    if {[catch {portinstall::install_main}] != 0} {
+        return &quot;FAIL: cannot install port&quot;
+    }
+
+    set variants {}
+    set options {}
+
+} -body {
+    set res [mportopen_installed $subport $version $revision $variants $options]
+    if {![string match &quot;ditem_*&quot; $res]} {
+       return &quot;FAIL: installed port not opened&quot;
+    }
+
+    if {[catch {mportclose_installed $res}] != 0} {
+       return &quot;FAIL: cannot close port&quot;
+    }
+    if {[catch {mportclose_installed $res}] != 1} {
+       return &quot;FAIL: installed port not closed&quot;
+    }
+    return &quot;Installed port open successful.&quot;
+
+} -cleanup {
+    if {[catch {portuninstall::uninstall_main}] != 0} {
+        return &quot;FAIL: cannot install port&quot;
+    }
+    mportclose $mport
+
+    file delete -force $pwd/work
+    file delete -force $pwd/$subport
+} -result &quot;Installed port open successful.&quot;
+
+
+test ui_isset {
+    Ui is set unit test.
+} -body {
+    namespace eval macports {
+    array set ui_options { test yes }
+    }
+    if {[macports::ui_isset test] != 1} {
+       return &quot;FAIL: set option not detected&quot;
+    }
+    if {[macports::ui_isset port] != 0} {
+       return &quot;FAIL: unset option detected&quot;
+    }
+    return &quot;ui_isset successful.&quot;
+} -result &quot;ui_isset successful.&quot;
+
+
+test global_option_isset {
+    Global option is set unit test.
+} -body {
+    namespace eval macports {
+    array set global_options { test yes }
+    }
+    if {[macports::global_option_isset test] != 1} {
+       return &quot;FAIL: set option not detected&quot;
+    }
+    if {[macports::global_option_isset port] != 0} {
+       return &quot;FAIL: unset option detected&quot;
+    }
+    return &quot;Global option isset successful.&quot;
+} -result &quot;Global option isset successful.&quot;
+
+
+test init_logging {
+    Init logging unit test.
+} -constraints {
+    root
+} -setup {
+    set mport [mportopen file://.]
+} -body {
+    if {[macports::init_logging $mport] != 0} {
+       return &quot;FAIL: incorrect channels&quot;
+    }
+    if {$macports::channels(any) != &quot;stdout debuglog&quot;} {
+       return &quot;FAIL: incorrect channels(any)&quot;
+    }
+    if {$macports::channels(debug) != &quot;debuglog&quot;} {
+       return &quot;FAIL: incorrect channels(debug)&quot;
+    }
+    return &quot;Init logging successful.&quot;
+} -cleanup {
+    mportclose $mport
+} -result &quot;Init logging successful.&quot;
+
+
+test ch_logging {
+    Channel logging unit test. Assumes main.log filename.
+} -constraints {
+    root
+} -setup {
+    set mport [mportopen file://.]
+
+    set portname [_mportkey $mport subport]
+    set portpath [_mportkey $mport portpath]
+    set logname [macports::getportlogpath $portpath $portname]
+    file delete -force $logname
+
+} -body {
+    if {[macports::ch_logging $mport] != 0} {
+       return &quot;FAIL: channels not set&quot;
+    }
+    if {![file exists $logname]} {
+       return &quot;FAIL: logname dir missing&quot;
+    }
+    if {![file exists $logname/main.log]} {
+       return &quot;FAIL: main.log missing&quot;
+    }
+    return &quot;Channel logging successful.&quot;
+
+} -cleanup {
+    mportclose $mport
+} -result &quot;Channel logging successful.&quot;
+
+
+test push_log {
+    Push log unit test.
+} -constraints {
+    root
+} -setup {
+    set mport [mportopen file://.]
+    set ::logenabled 1
+} -body {
+    if {[catch {macports::push_log $mport}] != 0} {
+       return &quot;FAIL: cannot push log&quot;
+    }
+    if {[lindex $::logstack 0] != [list $::debuglog $::debuglogname]} {
+       return &quot;FAIL: incorrect logstack&quot;
+    }
+    return &quot;Push log successful.&quot;
+} -cleanup {
+    mportclose $mport
+} -result &quot;Push log successful.&quot;
+
+
+test pop_log {
+    Pop log unit test.
+} -setup {
+    set ::logenabled 1
+    set ::logstack [open $pwd/logstack w+]
+    set ::debuglog [open $pwd/log w+]
+    set mport [mportopen file://.]
+    if {[catch {macports::push_log $mport}] != 0} {
+       return &quot;FAIL: cannot push log&quot;
+    }
+} -body {
+    macports::pop_log
+    if {$::debuglog != $::logstack} {
+        return &quot;FAIL: cannot pop log&quot;
+    }
+    return &quot;Pop log successful.&quot;
+} -cleanup {
+    unset ::logenabled
+    unset ::logstack
+    unset ::debuglog
+    mportclose $mport
+    file delete -force $pwd/log
+    file delete -force $pwd/logstack
+} -result &quot;Pop log successful.&quot;
+
+
+test set_phase {
+    Set phase unit test.
+} -body {
+    set res [set_phase test]
+    if {$macports::current_phase != &quot;test&quot;} {
+        return &quot;FAIL: phase not set&quot;
+    }
+    return &quot;Set phase successful.&quot;
+} -result &quot;Set phase successful.&quot;
+
+
+test ui_message {
+    UI message unit test.
+} -setup {
+    set fd [open $pwd/message w+]
+    set fd2 [open $pwd/log w+]
+    set macports::channels(0) $fd
+    set macports::channels(debuglog) $fd2
+    set macports::current_phase test
+    set ::debuglog $fd2
+} -body {
+    set res [ui_message 0 prefix phase args]
+    close $fd
+    close $fd2
+    set fd2 [open $pwd/message r]
+    set line [read $fd2]
+    if {$line != &quot;prefixargs\n&quot;} {
+        return &quot;FAIL: wrong message&quot;
+    }
+    close $fd2
+
+    set fd [open $pwd/message w+]
+    set fd2 [open $pwd/log w+]
+    set res [ui_message debuglog prefix phase -nonewline arg]
+    close $fd
+    close $fd2
+    set fd2 [open $pwd/log r]
+    set line [read $fd2]
+    if {$line != &quot;prefixarg&quot;} {
+        return &quot;FAIL: wrong message&quot;
+    }
+    close $fd2
+
+    return &quot;UI message successful.&quot;
+} -cleanup {
+    file delete -force $pwd/log
+    file delete -force $pwd/message
+} -result &quot;UI message successful.&quot;
+
+
+# test ui_init
+
+
+test ui_prefix_default {
+    UI prefix default unit test.
+} -body {
+    if {[macports::ui_prefix_default debug] ne {DEBUG: }} {
+        return &quot;FAIL: wrong prefix&quot;
+    }
+    if {[macports::ui_prefix_default error] ne {Error: }} {
+        return &quot;FAIL: wrong prefix&quot;
+    }
+    if {[macports::ui_prefix_default warn] ne {Warning: }} {
+        return &quot;FAIL: wrong prefix&quot;
+    }
+    if {[macports::ui_prefix_default default] ne {}} {
+        return &quot;FAIL: wrong prefix&quot;
+    }
+    return &quot;UI prefix default successful.&quot;
+} -result &quot;UI prefix default successful.&quot;
+
+
+test ui_channels_default {
+    UI channels default unit test.
+} -setup {
+    set macports::ui_options(ports_debug) yes
+    set macports::ui_options(ports_verbose) yes
+    set macports::ui_options(ports_quiet) yes
+} -body {
+    if {[macports::ui_channels_default debug] ne {stderr}} {
+        return &quot;FAIL: stderr not set&quot;
+    }
+    if {[macports::ui_channels_default info] ne {stdout}} {
+        return &quot;FAIL: stdout not set&quot;
+    }
+    if {[macports::ui_channels_default notice] ne {}} {
+        return &quot;FAIL: channel not set&quot;
+    }
+    if {[macports::ui_channels_default msg] ne {stdout}} {
+        return &quot;FAIL: channel not set&quot;
+    }
+    if {[macports::ui_channels_default warn] ne {stderr}} {
+        return &quot;FAIL: channel not set&quot;
+    }
+    if {[macports::ui_channels_default error] ne {stderr}} {
+        return &quot;FAIL: channel not set&quot;
+    }
+    if {[macports::ui_channels_default default] ne {stdout}} {
+        return &quot;FAIL: channel not set&quot;
+    }
+    return &quot;UI channels default successful.&quot;
+} -result &quot;UI channels default successful.&quot;
+
+
+test ui_warn_once {
+    UI warn once unit test.
+} -body {
+    set res [ui_warn_once 0 test]
+    if {$macports::warning_done(0) != 1} {
+        return &quot;FAIL: warning flag not set&quot;
+    }
+    return &quot;UI warn once successful.&quot;
+} -result &quot;UI warn once successful.&quot;
+
+
+# Replace puts to catch errors 
+# test puts
+
+
+test findBinary {
+    Find binary unit test.
+} -body {
+    if {[macports::findBinary pwd ls] != &quot;/bin/pwd&quot;} {
+       return &quot;FAIL: wrong binary&quot;
+    }
+    if {[macports::findBinary pwd /bin/ls] != &quot;/bin/ls&quot;} {
+       return &quot;FAIL: wrong binary&quot;
+    }
+    return &quot;Find binary successful.&quot;
+} -result &quot;Find binary successful.&quot;
+
+
+test binaryInPath {
+    Binary in path unit test.
+} -body {
+    if {[catch {macports::binaryInPath zz}] != 1} {
+       return &quot;FAIL: invalid binary found&quot;
+    }
+    if {[macports::binaryInPath ls] != &quot;/bin/ls&quot;} {
+       return &quot;FAIL: wrong binary found&quot;
+    }
+    return &quot;Binary in path successful.&quot;
+} -result &quot;Binary in path successful.&quot;
+
+
+test getoption {
+    Get option unit test.
+} -body {
+    set macports::test macports
+    if {[macports::getoption test] != &quot;macports&quot;} {
+        return &quot;FAIL: cannot get option&quot;
+    }
+    return &quot;Get option successful.&quot;
+} -result &quot;Get option successful.&quot;
+
+
+test setxcodeinfo {
+    Set XCode info unit test.
+} -constraints {
+    root
+} -setup {
+    unset macports::xcodeversion
+} -body {
+    if {[macports::setxcodeinfo a b c] != &quot;&quot;} {
+       return &quot;FAIL: xcode binary not found&quot;
+    }
+    if {![info exists macports::xcodeversion]} {
+       return &quot;FAIL: xcodeversion unset&quot;
+    }
+    return &quot;Set XCode version successful.&quot;
+} -result &quot;Set XCode version successful.&quot;
+
+
+test set_developer_dir {
+    Set developer dir unit test. Tests only for correct xcode-select dir.
+} -constraints {
+    root
+} -body {
+    unset macports::developer_dir
+
+    if {[macports::set_developer_dir a b c] != &quot;&quot;} {
+       return &quot;FAIL: cannot set dev dir&quot;
+    }
+    if {![info exists macports::developer_dir]} {
+       return &quot;FAIL: developer_dir var no set&quot;
+    }
+    return &quot;Set developer dir successful.&quot;
+} -result &quot;Set developer dir successful.&quot;
+
+
+test _is_valid_developer_dir {
+    Check valid dev dir unit test.
+} -body {
+    set macports::set_developer /Applications/Xcode.app/Contents/Developer
+    if {[macports::_is_valid_developer_dir $macports::developer_dir] != 1} {
+       return &quot;FAIL: valid dir not detected&quot;
+    }
+    return &quot;Valid dev dir successful.&quot;
+} -result &quot;Valid dev dir successful.&quot;
+
+
+# test mportinit
+
+
+test mportshutdown {
+    Mport shutdown unit test.
+} -setup {
+    unset macports::ping_cache
+
+    set time [expr [clock seconds] - 86100]
+    set time_exp [expr [clock seconds] - 87000]
+    set macports::portdbpath $pwd/portdbpath
+    set macports::ping_cache(host1) [list test $time]
+    set macports::ping_cache(host2) [list test $time_exp]
+
+    file mkdir $macports::portdbpath
+    close [open $macports::portdbpath/pingtimes w+]
+
+} -body {
+    if {[mportshutdown] != &quot;&quot;} {
+       return &quot;FAIL: errors occured&quot;
+    }
+
+    set res &quot;&quot;
+    append res &quot;host1 \{test &quot; $time &quot;\}&quot;
+    set fd [open $macports::portdbpath/pingtimes r]
+
+    if {[gets $fd] != $res} {
+       return &quot;FAIL: wrong value saved&quot;
+    }
+    close $fd
+    return &quot;Mportshutdown successful.&quot;
+
+} -cleanup {
+    file delete -force $macports::portdbpath
+} -result &quot;Mportshutdown successful.&quot;
+
+
+test copy_xcode_plist {
+    Copy xcode plist unit test.
+} -constraints {
+    root
+} -body {
+    set target $pwd/target
+
+    if {[macports::copy_xcode_plist $target] != &quot;&quot;} {
+       return &quot;FAIL: cannot copy xcode plist&quot;
+    }
+    if {![file exists $target/Library/Preferences/com.apple.dt.Xcode.plist]} {
+       return &quot;FAIL: missing plist file&quot;
+    }
+    return &quot;Copy xcode plist successful.&quot;
+} -cleanup {
+    file delete -force $target
+} -result &quot;Copy xcode plist successful.&quot;
+
+
+test worker_init {
+    Worker init unit test.
+} -setup {
+    set name [interp create]
+    set portpath $pwd/portpath
+    set porturl http://www.macports.org
+    set portbuildpath $pwd/build
+    set options {a b}
+    set variations {1 2}
+} -body {
+    macports::worker_init $name $portpath $porturl $portbuildpath $options $variations
+    if {$name != &quot;interp0&quot;} {
+       return &quot;FAIL: wrong workername&quot;
+    }
+    if {[$name eval source Portfile] != &quot;yes&quot;} {
+       return &quot;FAIL: cannot load Portfile&quot;
+    }
+    if {[$name eval findBinary ls] != &quot;/bin/ls&quot;} {
+       return &quot;FAIL: alias not created&quot;
+    }
+    if {[$name eval return \$os_arch] != &quot;i386&quot;} {
+       return &quot;FAIL: var not set&quot;
+    }
+    return &quot;Worker init successful.&quot;
+} -result &quot;Worker init successful.&quot;
+
+
+test create_thread {
+    Create thread unit test.
+} -body {
+    unset macports::portinterp_options
+    set macports::portinterp_options {a b}
+
+    set res [macports::create_thread]
+    if {![string match &quot;tid0x*&quot; $res]} {
+       return &quot;FAIL: cannot create thread&quot;
+    }
+    return &quot;Create thread successful.&quot;
+} -result &quot;Create thread successful.&quot;
+
+
+test get_tar_flags {
+    Get tar flags unit test.
+} -body {
+    if {[macports::get_tar_flags .tbz2] != &quot;-j&quot;} {
+        return &quot;FAIL: wrong flaga (-j)&quot;
+    }
+    if {[macports::get_tar_flags .tgz] != &quot;-z&quot;} {
+        return &quot;FAIL: wrong flaga (-z)&quot;
+    }
+    return &quot;Get tar flags successful.&quot;
+} -result &quot;Get tar flags successful.&quot;
+
+
+test fetch_port {
+    Fetch port unit test.
+} -body {
+    set url http://packages.macports.org/fondu/fondu-060102_1.darwin_10.x86_64.tbz2
+    set res [macports::fetch_port $url]
+    if {$res != &quot;${pwd}/portdbpath/portdirs/fondu-060102_1&quot;} {
+        return &quot;FAIL: cannot fetch port&quot;
+    }
+    return &quot;Fetch port successful.&quot;
+} -cleanup {
+    file delete -force $pwd/portdbpath
+} -result &quot;Fetch port successful.&quot;
+
+
+test getprotocol {
+    Get protocol unit test.
+} -body {
+    if {[macports::getprotocol http://www.macports.org] != &quot;http&quot;} {
+       return &quot;FAIL: wrong protocol&quot;
+    }
+    return &quot;Get protocol successful.&quot;
+} -result &quot;Get protocol successful.&quot;
+
+
+test getportdir {
+    Get port directory unit test.
+} -setup {
+    close [open $pwd/local_file w+]
+} -body {
+    set url http://fondu.sourceforge.net/fondu_src-060102.tgz
+    set res [macports::getportdir $url]
+    if {$res != &quot;${pwd}/portdbpath/portdirs/fondu_src-060102&quot;} {
+        return &quot;FAIL: invalid port directory&quot;
+    }
+
+    set url file://${pwd}/local_file
+    if {[macports::getportdir $url] != &quot;${pwd}/local_file&quot;} {
+        return &quot;FAIL: invalid local port directory&quot;
+    }
+    return &quot;Get port dir successful.&quot;
+} -cleanup {
+    file delete -force $pwd/portdbpath
+    file delete -force $pwd/local_file
+} -result &quot;Get port dir successful.&quot;
+
+
+test getportresourcepath {
+    Get port resource path. Doesn't check for 'file' protocol.
+} -body {
+    set macports::portdbpath $pwd/portdbpath
+    set url &quot;http://packages.macports.org/fondu/fondu-060102_1.darwin_12.x86_64.tbz2&quot;
+    set default_path $pwd/portdbpath/sources/rsync.macports.org/release/tarballs/ports/_resources
+    set fallback_path $pwd/portdbpath/sources/packages.macports.org/fondu/fondu-060102_1.darwin_12.x86_64.tbz2/_resources
+
+    if {[macports::getportresourcepath $url &quot;&quot; yes] != $default_path} {
+       return &quot;FAIL: wrong resource path&quot;
+    }
+    if {[macports::getportresourcepath $url &quot;&quot; no] != $fallback_path} {
+       return &quot;FAIL: wrong fallback path&quot;
+    }
+    if {[macports::getportresourcepath $url &quot;test&quot; no] != &quot;${fallback_path}/test&quot;} {
+       return &quot;FAIL: wrong fallback path with subdir&quot;
+    }
+
+    return &quot;Get resource path successful.&quot;
+} -result &quot;Get resource path successful.&quot;
+
+
+test getdefaultportresourcepath {
+    Get default port resource path unit test.
+} -body {
+    set path test/path
+    set macports::sources_default file://$pwd
+    if {[macports::getdefaultportresourcepath $path] != &quot;${pwd}/_resources/${path}&quot;} {
+       return &quot;FAIL: wrong file res path&quot;
+    }
+
+    set macports::sources_default http://$pwd
+    set default_source_url [lindex ${macports::sources_default} 0]
+    set right_path [macports::getsourcepath $default_source_url]/_resources/test/path
+    if {[macports::getdefaultportresourcepath $path] != $right_path} {
+       return &quot;FAIL: wrong http res path&quot;
+    }
+    return &quot;Default res path successful.&quot;
+} -result &quot;Default res path successful.&quot;
+
+
+# test mportopen
+
+
+# Covered by mportopen_installed
+# test mportclose_installed
+
+
+test mporttraverse {
+    Mport traverse unit test. Uses 3rd column of the Portfile.
+} -setup {
+    file mkdir $pwd/porttree
+    file mkdir $pwd/porttree/cat1/fondu
+    file mkdir $pwd/porttree/cat2/fondu
+
+    file copy -force $pwd/Portfile $pwd/porttree/cat1/fondu/Portfile
+    file copy -force $pwd/Portfile $pwd/porttree/cat2/fondu/Portfile
+
+    proc test_proc {file} {
+       global pwd res
+       set fd [open ${pwd}/porttree/${file}/Portfile r]
+       gets $fd line
+       append res [lindex [split $line &quot; &quot;] 3]
+    }
+
+    global res
+    set res &quot;&quot;
+} -body {
+    mporttraverse test_proc $pwd/porttree
+    if {$res != &quot;8547285472&quot;} {
+       return &quot;FAIL: porttree not traversed&quot;
+    }
+    return &quot;Mport traverse successful.&quot;
+} -cleanup {
+    file delete -force $pwd/porttree
+} -result &quot;Mport traverse successful.&quot;
+
+
+# test _mportsearchpath
+# test _mportinstalled
+# test _mportactive
+# test _portnameactive
+# test _mportispresent
+# test _mporterrorifconflictsinstalled
+# test _mportexec
+# test mportexec
+# test _upgrade_mport_deps
+# test _get_registry_archs
+# test getsourcepath
+# test _source_is_snapshot
+# test getportbuildpath
+# test getportlogpath
+# test getportworkpath_from_buildpath
+# test getportworkpath_from_portdir
+# test getindex
+# test mportsync
+# test mportsearch
+# test mportlookup
+# test mportlistall
+# test _mports_load_quickindex
+# test mports_generate_quickindex
+
+
+# test _mportkey
+# test mportdepends
+# test _mport_supports_archs
+# test _mport_archs
+# test _active_supports_archs
+# test _active_archs
+# test _explain_arch_mismatch
+# test _mport_has_deptypes
+# test _target_needs_deps
+# test _deptypes_for_target
+# test selfupdate
+# test upgrade
+# test _upgrade
+# test _upgrade_dependencies
+
+
+test mportselect {
+    Mport select unit test.
+} -setup {
+    set macports::prefix $pwd/prefix
+
+    file mkdir $macports::prefix/etc/select/group
+    set f1 [open $macports::prefix/etc/select/group/file1 w+]
+    set f2 [open $macports::prefix/etc/select/group/file2 w+]
+    set f3 [open $macports::prefix/srcs w+]
+    puts $f1 &quot;srcs\n&quot;
+    close $f1
+    close $f2
+    close $f3
+
+    set fd [open $macports::prefix/etc/select/group/base w+]
+    puts $fd &quot;a\nb&quot;
+    close $fd
+} -body {
+    if {[mportselect list group] != {file1 file2}} {
+       return &quot;FAIL: files not listed&quot;
+    }
+    if {[mportselect set group file1] != &quot;&quot;} {
+       reutrn &quot;FAIL: cannot set links&quot;
+    }
+    if {![file exists $macports::prefix/a]} {
+       return &quot;FAIL: link not created&quot;
+    }
+    if {[mportselect show group] != &quot;file1&quot;} {
+       return &quot;FAIL: file not selected&quot;
+    }
+    return &quot;Mport select successful.&quot;
+
+} -cleanup {
+    file delete -force $macports::prefix
+} -result &quot;Mport select successful.&quot;
+
+
+test gettmpdir {
+    Get tmp dir unit test.
+} -body {
+    global env
+    set env(TMPDIR) temporal
+    if {[macports::gettmpdir] != &quot;temporal&quot;} {
+       return &quot;FAIL: set temp dir not detected&quot;
+    }
+    unset env(TMPDIR)
+    if {[macports::gettmpdir] != &quot;/tmp&quot;} {
+       return &quot;FAIL: default value not set&quot;
+    }
+    return &quot;Get tmp dir successful.&quot;
+} -result &quot;Get tmp dir successful.&quot;
+
+
+test arch_runnable {
+    Arch runnable unit test.
+} -body {
+    set macports::os_major 12
+    set macports::os_arch i386
+    set macports::os_platform darwin
+    if {[macports::arch_runnable ppc1] != no} {
+       return &quot;FAIL: major:12 arch:i386 arch:ppc* not detected&quot;
+    }
+    if {[macports::arch_runnable ppc64] != no} {
+       return &quot;FAIL: major:12 arch:i386 arch:ppc64 not detected&quot;
+    }
+    set macports::os_major 7
+    set macports::os_arch i386
+    set macports::os_platform darwin
+    if {[macports::arch_runnable x86_64] != no} {
+       return &quot;FAIL: major:7 arch:i386 arch:x86_64 not detected&quot;
+    }
+    set macports::os_major 12
+    set macports::os_arch i386
+    set macports::os_platform darwin
+    if {[macports::arch_runnable x86_64] != yes} {
+       return &quot;FAIL: major:12 arch:i386 arch:x86_64 not detected&quot;
+    }
+    return &quot;Arch runnable successful.&quot;
+} -result &quot;Arch runnable successful.&quot;
+
+
+# test revupgrade
+# test revupgrade_scanandrebuild
+
+
+test path_is_in_prefix {
+    Path is in prefix unit test.
+} -body {
+    set macports::applications_dir appdir
+    if {[macports::path_is_in_prefix appdir/test/port] != yes} {
+       return &quot;FAIL: application dir not detected&quot;
+    }
+    set macports::prefix prefix
+    if {[macports::path_is_in_prefix prefix/test/port] != yes} {
+       return &quot;FAIL: prefix not detected&quot;
+    }
+    if {[macports::path_is_in_prefix test/port] != no} {
+       return &quot;FAIL: no prefix detected&quot;
+    }
+    return &quot;Path prefix successful.&quot;
+} -result &quot;Path prefix successful.&quot;
+
+
+test revupgrade_handle_special_paths {
+    Revupgrade handle special paths unit test.
+} -body {
+    set res [macports::revupgrade_handle_special_paths fname test_path]
+    if {$res != &quot;test_path&quot;} {
+       return &quot;FAIL: wrong path&quot;
+    }
+    set res [macports::revupgrade_handle_special_paths fname @loader_path/test_load]
+    if {$res != &quot;./test_load&quot;} {
+       return &quot;FAIL: wrong load path&quot;
+    }
+    return &quot;Revupgrade handle special path successful.&quot;
+} -result &quot;Revupgrade handle special path successful.&quot;
+
+
+# test revupgrade_buildgraph
+
+
+test get_pingtime {
+    Get ping time unit test.
+} -setup {
+    set time [expr [clock seconds] - 86300]
+    set macports::ping_cache(macports.org) [list MacPorts $time]
+    set macports::host_blacklisted(macports_blacklist) [list black $time]
+    set macports::host_preferred(macports_pref) [list pref $time]
+
+} -body {
+    if {[macports::get_pingtime macports.org] != &quot;MacPorts&quot;} {
+       return &quot;FAIL: wrong ping time&quot;
+    }
+    if {[macports::get_pingtime macports_blacklist] != -1} {
+       return &quot;FAIL: wrong time for blacklisted host&quot;
+    }
+    if {[macports::get_pingtime macports_pref] != 1} {
+       return &quot;FAIL: wrong time for preferred host&quot;
+    }
+    return &quot;Get ping time successful.&quot;
+} -result &quot;Get ping time successful.&quot;
+
+
+test set_pingtime {
+    Set ping time unit test.
+} -body {
+    set macports::ping_cache(macports) {}
+    if {[lindex [macports::set_pingtime macports 007] 0] != 007} {
+       return &quot;FAIL: ping time not set&quot;
+    }
+    return &quot;Set ping time successful.&quot;
+} -result &quot;Set ping time successful.&quot;
+
+
+test get_archive_sites_conf_values {
+    Get archive sites conf values unit test.
+} -setup {
+    file mkdir $pwd/archive_sites
+    set fd [open $pwd/archive_sites/archive_sites.conf w+]
+    puts $fd &quot;name fondu&quot;
+    puts $fd &quot;urls macports.org&quot;
+    puts $fd &quot;type tgz&quot;
+    close $fd
+
+    set macports::autoconf::macports_conf_path $pwd/archive_sites
+
+} -body {
+    set res [macports::get_archive_sites_conf_values]
+    if {[lindex [split $res &quot; &quot;] 1] != &quot;macports.org:nosubdir&quot;} {
+       return &quot;FAIL: name not set&quot;
+    }
+    if {[lindex [split $res &quot; &quot;] 3] != &quot;tgz&quot;} {
+       return &quot;FAIL: wrong type set&quot;
+    }
+
+    set macports::archive_sites_conf_values {a b c}
+    if {[macports::get_archive_sites_conf_values] != {a b c}} {
+       return &quot;FAIL: wrong  result for bad conf file&quot;
+    }
+    return &quot;Get archive sites conf values successful.&quot;
+
+} -cleanup {
+    file delete -force $pwd/archive_sites
+} -result &quot;Get archive sites conf values successful.&quot;
+
+
+cleanupTests
</ins></span></pre></div>
<a id="branchesnewhelpsystembasesrcmacports10testsmacports_dlisttcl"></a>
<div class="delfile"><h4>Deleted: branches/new-help-system/base/src/macports1.0/tests/macports_dlist.tcl (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/macports1.0/tests/macports_dlist.tcl        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/src/macports1.0/tests/macports_dlist.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -1,114 +0,0 @@
</span><del>-#!/usr/bin/env tclsh
-# macports1.0/test_dlist.tcl
-# $Id$
-#
-# Copyright (c) 2007 The MacPorts Project
-# Copyright (c) 2003 Kevin Van Vechten &lt;kevin@opendarwin.org&gt;
-
-# Test suite for macports_dlist package.
-
-#lappend auto_path .
-#package require macports_dlist 1.0
-source macports_dlist.tcl
-
-puts &quot;&quot;
-puts &quot;Testing ditem&quot;
-
-puts -nonewline &quot;Checking ditem_create... &quot;
-if {[catch {ditem_create} ditem] || $ditem == &quot;&quot;} {
-        puts &quot;failed: $ditem&quot;
-} else {
-        puts &quot;ok&quot;
-}
-
-puts -nonewline &quot;Checking ditem_key... &quot;
-if {[catch {ditem_key $ditem provides &quot;foo&quot;} value] || $value != &quot;foo&quot;} {
-        puts &quot;failed: $value&quot;
-} else {
-        puts &quot;ok&quot;
-}
-
-puts -nonewline &quot;Checking ditem_append... &quot;
-if {[catch {ditem_append $ditem provides &quot;bar&quot;} value] || $value != {foo bar}} {
-        puts &quot;failed: $value&quot;
-} else {
-        puts &quot;ok&quot;
-}
-
-puts -nonewline &quot;Checking ditem_contains... &quot;
-set value2 &quot;&quot;
-if {[catch {ditem_contains $ditem provides &quot;foo&quot;} value] || $value != 1 ||
-        [catch {ditem_contains $ditem provides &quot;zzz&quot;} value2] || $value2 != 0} {
-        puts &quot;failed: ${value}\n${value2}&quot;
-} else {
-        puts &quot;ok&quot;
-}
-
-puts &quot;&quot;
-puts &quot;Testing dlist&quot;
-
-puts -nonewline &quot;Checking dlist_search... &quot;
-if {[catch {dlist_search [list $ditem] provides &quot;bar&quot;} value] || $value != $ditem} {
-        puts &quot;failed: $value&quot;
-} else {
-        puts &quot;ok&quot;
-}
-
-puts -nonewline &quot;Checking dlist_has_pending... &quot;
-if {[catch {dlist_has_pending [list $ditem] &quot;foo&quot;} value] || $value != 1} {
-        puts &quot;failed: $value&quot;
-} else {
-        puts &quot;ok&quot;
-}
-
-puts -nonewline &quot;Checking dlist_count_unmet... &quot;
-array set status [list foo 1 bar 0]
-if {[catch {dlist_count_unmet [list] status &quot;foo&quot;} value] || $value != 0 ||
-        [catch {dlist_count_unmet [list] status &quot;bar&quot;} value2] || $value2 != 1} {
-        puts &quot;failed: ${value}\n${value2}&quot;
-} else {
-        puts &quot;ok&quot;
-}
-
-# Replicate Shantonu's Bug #354 to test dlist functionality.
-# https://trac.macports.org/ticket/354
-# A depends on B, C.
-# B depends on C.
-# C has no dependencies.
-
-set A [ditem_create]
-ditem_key $A provides A
-ditem_append $A requires B
-ditem_append $A requires C
-
-set B [ditem_create]
-ditem_key $B provides B
-ditem_append $B requires C
-
-set C [ditem_create]
-ditem_key $C provides C
-
-array set status [list]
-puts -nonewline &quot;Checking dlist_get_next... &quot;
-if {[catch {dlist_get_next [list $A $B $C] status} value] || $value != $C} {
-        puts &quot;failed: ${value}&quot;
-} else {
-        puts &quot;ok&quot;
-}
-
-puts -nonewline &quot;Checking dlist_eval... &quot;
-proc handler {ditem} { puts -nonewline &quot;[ditem_key $ditem provides] &quot; }
-if {[catch {dlist_eval [list $A $B $C] {} handler} value] || $value != {}} {
-        puts &quot;failed: ${value}&quot;
-} else {
-        puts &quot;ok&quot;
-}
-
-puts -nonewline &quot;Checking dlist_append_dependents... &quot;
-if {[catch {dlist_append_dependents [list $A $B $C] $B {}} value] || $value != [list $B $C]} {
-        puts &quot;failed: ${value}&quot;
-} else {
-        puts &quot;ok&quot;
-}
-
-
</del></span></pre></div>
<a id="branchesnewhelpsystembasesrcmacports10testsmacports_dlisttestfromrev117083trunkbasesrcmacports10testsmacports_dlisttest"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/src/macports1.0/tests/macports_dlist.test (from rev 117083, trunk/base/src/macports1.0/tests/macports_dlist.test) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/macports1.0/tests/macports_dlist.test                                (rev 0)
+++ branches/new-help-system/base/src/macports1.0/tests/macports_dlist.test        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,266 @@
</span><ins>+# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
+
+package require tcltest 2
+namespace import tcltest::*
+
+source ../macports_test_autoconf.tcl
+source $macports::autoconf::macports_tcl_dir/macports1.0/macports_fastload.tcl
+package require macports 1.0
+
+# Debug options
+array set ui_options {}
+#set ui_options(ports_debug)   yes
+#set ui_options(ports_verbose) yes
+mportinit ui_options
+
+source ../macports_dlist.tcl
+
+
+test dlist_match_multi {
+    Dlist match multi unit test.
+} -setup {
+    set mport [mportopen file://.]
+    set crit {
+       provides fondu
+       porturl file://.
+    }
+    set crit2 { provides fondu2 }
+
+} -body {
+    if {[dlist_match_multi $mport $crit] != $mport} {
+       return &quot;FAIL: correct dlist not matched&quot;
+    }
+    if {[dlist_match_multi $mport $crit2] != &quot;&quot;} {
+       return &quot;FAIL: incorrect dlist matched&quot;
+    }
+    return &quot;dlist match successful.&quot;
+} -cleanup {
+    mportclose $mport
+} -result &quot;dlist match successful.&quot;
+
+
+test dlist_search {
+    Dlist search unit test.
+} -setup {
+    set mport [mportopen file://.]
+} -body {
+    if {[dlist_search $mport provides fondu] != $mport} {
+       return &quot;FAIL: matching item not found&quot;
+    }
+    if {[dlist_search $mport provides fondu2] != &quot;&quot;} {
+       return &quot;FAIL: wrong item detected&quot;
+    }
+    return &quot;dlist successful.&quot;
+} -cleanup {
+    mportclose $mport
+} -result &quot;dlist successful.&quot;
+
+
+test dlist_delete {
+    Dlist delete unit test.
+} -setup {
+    set mport [mportopen file://.]
+    set dlist [list]
+    lappend dlist $mport
+} -body {
+    if {[dlist_delete dlist $mport] != &quot;&quot;} {
+       return &quot;FAIL: cannot run dlist_delete&quot;
+    }
+    if {$dlist != &quot;&quot;} {
+       return &quot;FAIL: port not removed from list&quot;
+    }
+    return &quot;Dlist delete successful.&quot;
+} -cleanup {
+    mportclose $mport
+} -result &quot;Dlist delete successful.&quot;
+
+
+test dlist_has_pending {
+    Dlist has pending unit test.
+} -setup {
+    set mport [mportopen file://.]
+} -body {
+    if {[dlist_has_pending $mport fondu] != 1} {
+       return &quot;FAIL: not detected&quot;
+    }
+    if {[dlist_has_pending $mport provides] != 0} {
+       return &quot;FAIL: incorrect detected&quot;
+    }
+    return &quot;dlist pending successful.&quot;
+} -cleanup {
+    mportclose $mport
+} -result &quot;dlist pending successful.&quot;
+
+
+test dlist_count_unmet {
+    Dlist count unmet unit test.
+} -setup {
+    set mport [mportopen file://.]
+    array set statusdict {
+       vara 0
+       varb 0
+       varc 1
+    }
+    set tokens {vara varb vard}
+} -body {
+    if {[dlist_count_unmet $mport statusdict $tokens] != 3} {
+       return &quot;FAIL: wrong unmet number&quot;
+    }
+    return &quot;count unmet successful.&quot;
+} -cleanup {
+    mportclose $mport
+} -result &quot;count unmet successful.&quot;
+
+
+# These just call the procs in macports_dlist namespace
+# test ditem_create
+# test ditem_delete
+# test ditem_key
+# test ditem_append
+# test ditem_append_unique
+# test ditem_contains
+
+
+test dlist_append_dependents {
+    Dlist append dependents unit test.
+} -setup {
+    set mport [mportopen file://.]
+    set result {fondu2}
+} -body {
+    if {[dlist_append_dependents $mport provides $result] != {fondu2 provides}} {
+       return &quot;FAIL: wrong depends&quot;
+    }
+    return &quot;Append depends successful.&quot;
+} -cleanup {
+    mportclose $mport
+} -result &quot;Append depends successful.&quot;
+
+
+test dlist_get_next {
+    Dlist get next unit test.
+} -setup {
+    set mport [mportopen file://.]
+    set dict {fondu}
+} -body {
+    if {[dlist_get_next $mport $dict] != $mport} {
+       return &quot;FAIL: wrong dlist&quot;
+    }
+    return &quot;dlist get next successful.&quot;
+} -cleanup {
+    mportclose $mport
+} -result &quot;dlist get next successful.&quot;
+
+
+test dlist_eval {
+    Dlist eval unit test.
+} -setup {
+    set mport [mportopen file://.]
+    proc cond {arg} {
+       if {[string match &quot;ditem_*&quot; $arg] != 0} {
+            return 0
+       } else {
+            return 1
+       }
+    }
+    proc handler {arg} {}
+} -body {
+    if {[dlist_eval $mport cond handler] != &quot;&quot;} {
+       return &quot;FAIL: wrong value returned&quot;
+    }
+    return &quot;dlist eval successful.&quot;
+} -cleanup {
+    mportclose $mport
+} -result &quot;dlist eval successful.&quot;
+
+
+test ditem_create {
+    Ditem create unit test.
+} -body {
+    set res [macports_dlist::ditem_create]
+    if {[string match &quot;ditem_*&quot; $res] == 0} {
+        return &quot;FAIL: ditem not created&quot;
+    }
+    if {[info exists macports_dlist::$res] != 1} {
+        return &quot;FAIL: array not set&quot;
+    }
+    return &quot;Create ditem successful.&quot;
+} -result &quot;Create ditem successful.&quot;
+
+
+test ditem_delete {
+    Ditem delete unit test.
+} -body {
+    set res [macports_dlist::ditem_create]
+    set res [macports_dlist::ditem_delete $res]
+    if {[info exists macports_dlist::$res] != 0} {
+        return &quot;FAIL: array not deleted&quot;
+    }
+    return &quot;Ditem delete successful.&quot;
+} -result &quot;Ditem delete successful.&quot;
+
+
+test ditem_key {
+    Ditem key unit test.
+} -setup {
+    set res [macports_dlist::ditem_create]
+    macports_dlist::ditem_key $res macports test
+} -body {
+    if {[array get macports_dlist::$res macports] != &quot;macports test&quot;} {
+        return &quot;FAIL ditem key not set&quot;
+    }
+    return &quot;Ditem key successful.&quot;
+} -cleanup {
+    macports_dlist::ditem_delete $res
+} -result &quot;Ditem key successful.&quot;
+
+
+test ditem_append {
+    Ditem append unit test.
+} -setup {
+    set res [macports_dlist::ditem_create]
+    macports_dlist::ditem_key $res macports test
+    macports_dlist::ditem_append $res macports test2
+} -body {
+    if {[array get macports_dlist::$res macports] != &quot;macports {test test2}&quot;} {
+        return &quot;FAIL: ditem key not appended&quot;
+    }
+    return &quot;Ditem key append successful.&quot;
+} -cleanup {
+    macports_dlist::ditem_delete $res
+} -result &quot;Ditem key append successful.&quot;
+
+
+test ditem_append_unique {
+    Ditem append unique unit test.
+} -setup {
+    set res [macports_dlist::ditem_create]
+    macports_dlist::ditem_key $res macports test
+    macports_dlist::ditem_append_unique $res macports test
+} -body {
+    if {[array get macports_dlist::$res macports] != &quot;macports test&quot;} {
+        return &quot;FAIL: ditem key not unique&quot;
+    }
+    return &quot;Ditem append unique successful.&quot;
+} -cleanup {
+    macports_dlist::ditem_delete $res
+} -result &quot;Ditem append unique successful.&quot;
+
+
+test ditem_contains {
+    Ditem contains unit test.
+} -setup {
+    set mport [mportopen file://.]
+} -body {
+    if {[ditem_contains $mport provides] != 1} {
+       return &quot;FAIL: valid key not detected&quot;
+    }
+    if {[ditem_contains $mport wants] != 0} {
+       return &quot;FAIL: invalid key detected&quot;
+    }
+    return &quot;ditem contains successful.&quot;
+} -cleanup {
+    mportclose $mport
+} -result &quot;ditem contains successful.&quot;
+
+
+cleanupTests
</ins></span></pre></div>
<a id="branchesnewhelpsystembasesrcmacports10testsmacports_utiltcl"></a>
<div class="delfile"><h4>Deleted: branches/new-help-system/base/src/macports1.0/tests/macports_util.tcl (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/macports1.0/tests/macports_util.tcl        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/src/macports1.0/tests/macports_util.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -1,476 +0,0 @@
</span><del>-# test_util.tcl
-# $Id$
-#
-# Comprehensive test file for macports_util.tcl
-# Written by Kevin Ballard &lt;eridius@macports.org&gt;
-
-source ./macports_util.tcl
-
-array set options {t 0 w 0}
-
-set ::traceNest &quot;&quot;
-set ::traceSquelch 0
-set ::traceSquelchNest &quot;&quot;
-proc dotrace {args} {
-    global traceNest options
-    flush stdout
-    set command [lindex $args 0]
-    if {$options(w) &gt; 0} {
-        # trim command to 1 line
-        if {[llength [set lines [split $command &quot;\n&quot;]]] &gt; 1} {
-            set command &quot;[lindex $lines 0] [ansi fg-blue]...[ansi reset]&quot;
-        }
-    }
-    set op [lindex $args end]
-    switch $op {
-        enter { append traceNest &quot;#&quot; }
-        enterstep { append traceNest &quot;+&quot; }
-    }
-    switch $op {
-        enter {
-            puts stderr &quot;[ansi fg-yellow inverse]$traceNest&gt;[ansi reset] $command&quot;
-            set ::traceSquelch 0
-        }
-        enterstep {
-            if {!$::traceSquelch} {
-                puts stderr &quot;[ansi fg-yellow]$traceNest&gt;[ansi reset] $command&quot;
-                if {[llength [info procs [lindex [split $command] 0]]] &gt; 0} {
-                    # it's a proc, lets start squelching
-                    set ::traceSquelch 1
-                    set ::traceSquelchNest $::traceNest
-                }
-            }
-        }
-        leave -
-        leavestep {
-            if {$op eq &quot;leavestep&quot; &amp;&amp; $::traceSquelch &amp;&amp; $::traceNest eq $::traceSquelchNest} {
-                set ::traceSquelch 0
-            }
-            if {$op eq &quot;leave&quot; || !$::traceSquelch} {
-                set code [lindex $args 1]
-                set result [lindex $args 2]
-                if {$options(w) &gt; 0} {
-                    # trim result just like command
-                    if {[llength [set lines [split $result &quot;\n&quot;]]] &gt; 1} {
-                        set result &quot;[lindex $lines 0] [ansi fg-blue]...[ansi reset]&quot;
-                    }
-                }
-                if {$op eq &quot;leave&quot;} {
-                    set prefix &quot;[ansi fg-blue inverse]$traceNest&quot;
-                } else {
-                    set prefix &quot;[ansi fg-blue]$traceNest&quot;
-                }
-                if {$code != 0} {
-                    puts stderr &quot;$prefix =\[$code\]&gt;[ansi reset] $result&quot;
-                } else {
-                    puts stderr &quot;$prefix =&gt;[ansi reset] $result&quot;
-                }
-            }
-        }
-    }
-    switch $op {
-        leave -
-        leavestep {
-            set traceNest [string range $traceNest 0 end-1]
-        }
-    }
-}
-while {[llength $argv] &gt; 0} {
-    set arg [lshift argv]
-    if {$arg eq &quot;--&quot;} {
-        break
-    } elseif {[string match -* $arg]} {
-        set arg [string range $arg 1 end]
-        while {[string length $arg] &gt; 0} {
-            set opt [string index $arg 0]
-            set arg [string range $arg 1 end]
-            switch $opt {
-                t { incr options(t) }
-                w { incr options(w) }
-                default {
-                    error &quot;Unknown option: -$opt&quot;
-                }
-            }
-        }
-    } else {
-        lunshift argv $arg
-        break
-    }
-}
-if {$options(t) &gt; 0} {
-    set ops {enter leave}
-    if {$options(t) &gt; 1} {
-        lappend ops enterstep leavestep
-    }
-    set util_list {ldindex lpop lpush lshift lunshift try throw}
-    if {[llength $argv] &gt; 0} {
-        set list $argv
-        if {[set idx [lsearch -exact $list *]] != -1} {
-            set list [eval lreplace [list $list] $idx $idx $util_list]
-        }
-    } else {
-        set list $util_list
-    }
-    foreach arg $list {
-        trace add execution $arg $ops dotrace
-    }
-}
-
-proc init {name value} {
-    set name [list $name]
-    set value [list $value]
-    uplevel 1 [subst -nocommands {
-        set $name $value
-        set $name-bak [set $name]
-    }]
-}
-
-proc restore {name} {
-    set name [list $name]
-    uplevel 1 [subst -nocommands {
-        if {[info exists $name-bak]} {
-            set $name [set $name-bak]
-        } else {
-            unset $name
-        }
-    }]
-}
-
-array set kStateToAnsiTable {
-    error fg-magenta
-    expected fg-cyan
-    correct fg-green
-    wrong fg-red
-}
-
-array set kAnsiTable {
-    reset           0
-    
-    bold            1
-    dim             2
-    underline       4
-    blink           5
-    inverse         7
-    hidden          8
-    
-    fg-black        30
-    fg-red          31
-    fg-green        32
-    fg-yellow       33
-    fg-blue         34
-    fg-magenta      35
-    fg-cyan         36
-    fg-white        37
-    fg-default      39
-    
-    bg-black        40
-    bg-red          41
-    bg-green        42
-    bg-yellow       43
-    bg-blue         44
-    bg-magenta      45
-    bg-cyan         46
-    bg-white        47
-    bg-default      49
-}
-
-proc ansi {args} {
-    global kAnsiTable
-    if {[llength $args] == 0} {
-        error &quot;wrong # args: should be \&quot;ansi code ...\&quot;&quot;
-    }
-    set colors {}
-    foreach code $args {
-        lappend colors $kAnsiTable($code)
-    }
-    return &quot;\033\[[join $colors &quot;;&quot;]m&quot;
-}
-
-proc state {code} {
-    global kStateToAnsiTable
-    return [ansi $kStateToAnsiTable($code)]
-}
-
-proc line {cmd expected args} {
-    uplevel 1 [list block $cmd $cmd $expected] $args
-}
-
-proc block {name cmd expected args} {
-    if {[set err [catch {uplevel 1 $cmd} value]]} {
-        set savedErrorInfo $::errorInfo
-        set savedErrorCode $::errorCode
-        if {$expected eq &quot;-error&quot; &amp;&amp; $err == 1} {
-            if {[llength $args] &gt; 0} {
-                set errCode [lindex $args 0]
-                if {$errCode == $savedErrorCode} {
-                    if {[llength $args] &gt; 1} {
-                        set errMsg [lindex $args 1]
-                        if {$errMsg == $value} {
-                            set code expected
-                        } else {
-                            set code error
-                        }
-                    } else {
-                        set code expected
-                    }
-                } else {
-                    set code error
-                }
-            } else {
-                set code expected
-            }
-        } elseif {$expected eq &quot;-return&quot; &amp;&amp; $err == 2} {
-            if {[llength $args] &gt; 0} {
-                set errMsg [lindex $args 0]
-                if {$errMsg == $value} {
-                    set code expected
-                } else {
-                    set code error
-                }
-            } else {
-                set code expected
-            }
-        } elseif {$expected eq &quot;-break&quot; &amp;&amp; $err == 3} {
-            set code expected
-        } else {
-            set code error
-        }
-    } elseif {$value == $expected} {
-        set code correct
-    } else {
-        set code wrong
-    }
-    if {$code eq &quot;error&quot;} {
-        append value &quot;\n$savedErrorInfo&quot;
-    }
-    puts &quot;[state $code]$name =[if {$err != 0} {format \[$err\]}]&gt; $value[ansi reset]&quot;
-}
-
-proc var {name expected} {
-    set exists [uplevel 1 info exists [list $name]]
-    if {!$exists} {
-        set value &quot;does not exist&quot;
-        if {$expected eq &quot;-unset&quot;} {
-            set code expected
-        } else {
-            set code error
-        }
-    } else {
-        set value [uplevel 1 set [list $name]]
-        if {$value == $expected} {
-            set code correct
-        } else {
-            set code wrong
-        }
-    }
-    puts &quot;[state $code]$name: $value[ansi reset]&quot;
-}
-
-if {[set err [catch {
-    namespace eval test {
-        namespace eval vars {}
-        init vars::ary(one) {1 2 {3 4}}
-        init vars::ary(zero) {1 {2 3 {&quot;4 5&quot; 6} 7} 8 9}
-        
-        var vars::ary(zero) {1 {2 3 {&quot;4 5&quot; 6} 7} 8 9}
-        line {ldindex vars::ary(zero) 1 2 0} {4 5}
-        var vars::ary(zero) {1 {2 3 6 7} 8 9}
-        line {ldindex vars::ary(zero) 1 1 0} 3
-        var vars::ary(zero) {1 {2 {} 6 7} 8 9}
-        line {ldindex vars::ary(zero) 1 2} 6
-        var vars::ary(zero) {1 {2 {} 7} 8 9}
-        line {ldindex vars::ary(zero) 1} {2 {} 7}
-        var vars::ary(zero) {1 8 9}
-        line {ldindex vars::ary(zero)} {1 8 9}
-        var vars::ary(zero) {}
-        
-        var vars::ary(one) {1 2 {3 4}}
-        line {lpop vars::ary(one)} {3 4}
-        var vars::ary(one) {1 2}
-        line {lpop vars::ary(one)} 2
-        var vars::ary(one) 1
-        line {lpop vars::ary(one)} 1
-        var vars::ary(one) {}
-        line {lpop vars::ary(one)} {}
-        var vars::ary(one) {}
-        
-        line {lpop vars::foo} -error NONE {can't read &quot;vars::foo&quot;: no such variable}
-        
-        restore vars::ary(one)
-        var vars::ary(one) {1 2 {3 4}}
-        line {lshift vars::ary(one)} 1
-        var vars::ary(one) {2 {3 4}}
-        line {lshift vars::ary(one)} 2
-        var vars::ary(one) {{3 4}}
-        line {lshift vars::ary(one)} {3 4}
-        var vars::ary(one) {}
-        line {lshift vars::ary(one)} {}
-        var vars::ary(one) {}
-        
-        line {lshift vars::foo} -error NONE {can't read &quot;vars::foo&quot;: no such variable}
-        
-        var vars::ary(two) -unset
-        line {lpush vars::ary(two) 1} 1
-        var vars::ary(two) 1
-        line {lpush vars::ary(two) 2 3 4 5} {1 2 3 4 5}
-        var vars::ary(two) {1 2 3 4 5}
-        line {lpush vars::ary(two) &quot;this is a test&quot;} {1 2 3 4 5 {this is a test}}
-        var vars::ary(two) {1 2 3 4 5 {this is a test}}
-        line {lpop vars::ary(two)} {this is a test}
-        var vars::ary(two) {1 2 3 4 5}
-        
-        line {lpush &quot;foo bar&quot; 3} {3}
-        var {foo bar} 3
-        
-        restore vars::ary(two)
-        var vars::ary(two) -unset
-        line {lunshift vars::ary(two) 5} 5
-        var vars::ary(two) 5
-        line {lunshift vars::ary(two) 4} {4 5}
-        var vars::ary(two) {4 5}
-        line {lunshift vars::ary(two) 1 2 3} {1 2 3 4 5}
-        var vars::ary(two) {1 2 3 4 5}
-        line {lunshift vars::ary(two) &quot;this is a test&quot;} {{this is a test} 1 2 3 4 5}
-        var vars::ary(two) {{this is a test} 1 2 3 4 5}
-        line {lshift vars::ary(two)} {this is a test}
-        var vars::ary(two) {1 2 3 4 5}
-        
-        # now test the try/throw stuff
-        line {throw} -error NONE {error: throw with no parameters outside of a catch}
-        line {throw 1 2 3 4} -error NONE {wrong # args: should be &quot;throw ?type? ?message? ?info?&quot;}
-        line {try {format 3} catch {} {}} -error NONE {invalid syntax in catch clause: type-list must contain at least one type}
-        line {try {format 3} finally {format 4} test} -error NONE {trailing args after finally clause}
-        block {basic try} {
-            try {
-                error &quot;random error&quot;
-            }
-        } -error NONE &quot;random error&quot;
-        block {try-finally} {
-            try {
-                error &quot;try-finally error&quot;
-            } finally {
-                set myVar &quot;finally clause worked&quot;
-            }
-        } -error NONE &quot;try-finally error&quot;
-        var myVar &quot;finally clause worked&quot;
-        block {try-finally-error} {
-            try {
-                error &quot;try-finally error&quot;
-            } finally {
-                error &quot;finally error&quot;
-            }
-        } -error NONE &quot;finally error&quot;
-        block {try-catch} {
-            try {
-                error &quot;try-catch error&quot;
-            } catch NONE {
-                format &quot;catch clause worked&quot;
-            }
-        } &quot;catch clause worked&quot;
-        block {try-catch-throw} {
-            try {
-                error &quot;try-catch error&quot;
-            } catch NONE {
-                set myVar &quot;thrown&quot;
-                throw
-            }
-        } -error NONE &quot;try-catch error&quot; ;# really should test errorInfo but that's messy
-        var myVar &quot;thrown&quot;
-        unset myVar
-        block {try-catch-finally} {
-            try {
-                error &quot;try-catch-finally error&quot;
-            } catch NONE {
-                set myVar &quot;thrown&quot;
-                throw
-            } finally {
-                lappend myVar &quot;finally&quot;
-            }
-        } -error NONE &quot;try-catch-finally error&quot;
-        var myVar &quot;thrown finally&quot;
-        block {try-catch-all} {
-            try {
-                error &quot;this is a test&quot;
-            } catch * {
-                format &quot;catch-all worked&quot;
-            }
-        } &quot;catch-all worked&quot;
-        block {try-catch-return} {
-            try {
-                error &quot;this is a test&quot;
-            } catch * {
-                return &quot;catch-return worked&quot;
-            }
-        } -return &quot;catch-return worked&quot;
-        block {try-catch-break} {
-            try {
-                error &quot;this is a test&quot;
-            } catch * {
-                break
-            }
-        } -break
-        block {try-catch-multiple} {
-            try {
-                error &quot;this is a test&quot;
-            } catch POSIX {
-                error &quot;POSIX catch&quot;
-            } catch * {
-                format &quot;catch-all&quot;
-            }
-        } &quot;catch-all&quot;
-        unset myVar
-        block {try-catch-multiple-finally} {
-            try {
-                error &quot;this is a test&quot;
-            } catch * {
-                lappend myVar &quot;catch-all 1&quot;
-            } catch * {
-                lappend myVar &quot;catch-all 2&quot;
-            } finally {
-                lappend myVar &quot;finally&quot;
-            }
-        } [list {catch-all 1}]
-        var myVar [list &quot;catch-all 1&quot; &quot;finally&quot;]
-        block {try-catch-types} {
-            try {
-                error &quot;try-catch-types error&quot; {} {MYERR arg1 arg2}
-            } catch POSIX {
-                error &quot;POSIX catch&quot;
-            } catch {{MY* arg*} code} {
-                format &quot;caught code $code&quot;
-            }
-        } &quot;caught code MYERR arg1 arg2&quot;
-        block {try-catch-vars} {
-            try {
-                error &quot;random error&quot;
-            } catch {* code msg info} {
-                set list {}
-                if {$code eq &quot;NONE&quot;} {
-                    lappend list &quot;code: correct&quot;
-                }
-                if {$msg eq &quot;random error&quot;} {
-                    lappend list &quot;msg: correct&quot;
-                }
-                if {[string match &quot;random error\n*&quot; $info]} {
-                    lappend list &quot;info: probably correct&quot;
-                }
-                join $list &quot;, &quot;
-            }
-        } &quot;code: correct, msg: correct, info: probably correct&quot;
-        block {try-break-catch} {
-            try {
-                break
-            } catch {*} {
-                error &quot;catch triggered&quot;
-            }
-        } -break
-        
-        # ensure the stack is sound
-        var ::_trycatch::catchStack {}
-    }
-} result]]} {
-    puts &quot;&quot;
-    puts &quot;error: $result&quot;
-    puts &quot;code: $err&quot;
-    puts $::errorInfo
-}
</del></span></pre></div>
<a id="branchesnewhelpsystembasesrcmacports10testsmacports_utiltestfromrev117083trunkbasesrcmacports10testsmacports_utiltest"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/src/macports1.0/tests/macports_util.test (from rev 117083, trunk/base/src/macports1.0/tests/macports_util.test) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/macports1.0/tests/macports_util.test                                (rev 0)
+++ branches/new-help-system/base/src/macports1.0/tests/macports_util.test        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,163 @@
</span><ins>+# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
+
+package require tcltest 2
+namespace import tcltest::*
+
+source ../macports_test_autoconf.tcl
+source $macports::autoconf::macports_tcl_dir/macports1.0/macports_fastload.tcl
+package require macports 1.0
+
+
+test method_wrap {
+    Method wrap unit test.
+} -setup {
+    proc test_proc {a} {
+       if { $a == 1} {
+           return -code error $a -errorcode 7
+       } else {
+            return $a
+       }
+    }
+
+} -body {
+    macports_util::method_wrap test_proc
+    if {[test_proc 1] != 7} {
+       return &quot;FAIL: no wrap around method&quot;
+    }
+    if {[test_proc arg] != &quot;arg&quot;} {
+       return &quot;FAIL: no wrap around method&quot;
+    }
+    return &quot;Method wrap successful.&quot;
+} -result &quot;Method wrap successful.&quot;
+
+
+test ldindex {
+    Ldindex unit test.
+} -body {
+    set list {0 1 2 3}
+    if {[ldindex list 1] != 1} {
+       return &quot;FAIL: element not poped&quot;
+    }
+    if {$list != {0 2 3}} {
+       return &quot;FAIL: wrong list remaining&quot;
+    }
+    if {[catch {ldindex list 4}] != 1} {
+       return &quot;FAIL: error not detected&quot;
+    }
+    if {[ldindex list] != {0 2 3}} {
+       return &quot;FAIL: not all elements poped&quot;
+    }
+    if {$list != &quot;&quot;} {
+       return &quot;FAIL: list not emptied&quot;
+    }
+    return &quot;ldindex successful.&quot;
+} -result &quot;ldindex successful.&quot;
+
+
+test lpop {
+    Lpop unit test.
+} -body {
+    set list {0 1 2}
+    if {[lpop list] != 2} {
+       return &quot;FAIL: element not poped&quot;
+    }
+    if {$list != {0 1}} {
+       return &quot;FAIL: wrong element poped&quot;
+    }
+    return &quot;lpop successful.&quot;
+} -result &quot;lpop successful.&quot;
+
+
+test lpush {
+    Lpush unit test.
+} -body {
+    set list {0 1}
+    if {[lpush list 2] != {0 1 2}} {
+       return &quot;FAIL: element not appended&quot;
+    }
+    if {[lpush list 3 4] != {0 1 2 3 4}} {
+       return &quot;FAIL: multiple elements not appended&quot;
+    }
+    if {[lpush list1 0] != 0} {
+       return &quot;FAIL: list not created&quot;
+    }
+    return &quot;lpop successful.&quot;
+} -result &quot;lpop successful.&quot;
+
+
+test lshift {
+    Lshift unit test.
+} -body {
+    set list {0 1 2}
+    set list1 {}
+
+    if {[lshift list] != 0} {
+       return &quot;FAIL: wrong element poped&quot;
+    }
+    if {$list != {1 2}} {
+       return &quot;FAIL: wrong list remaining&quot;
+    }
+    if {[lshift list1] != &quot;&quot;} {
+       return &quot;FAIL: empty list not detected&quot;
+    }
+    return &quot;lshift successful.&quot;
+} -result &quot;lshift successful.&quot;
+
+
+test lunshift {
+    Lunshift unit test.
+} -body {
+    set list {3 4}
+
+    if {[lunshift list 2] != {2 3 4}} {
+       return &quot;FAIL: element not inserted&quot;
+    }
+    if {[lunshift list 0 1] != {0 1 2 3 4}} {
+       return &quot;FAIL: multiple elements not inserted&quot;
+    }
+    if {[lunshift list2 0] != 0} {
+       return &quot;FAIL: list not created&quot;
+    }
+    return &quot;lunshift successful.&quot;
+} -result &quot;lunshift successful.&quot;
+
+
+
+test throw {
+    Throw unit test.
+} -setup {
+    proc test_proc {arg} {
+       catch {throw $arg} res
+       return $res
+    }
+} -body {
+    if {[test_proc {7 msg info}] != &quot;error: 7 msg info&quot;} {
+       return &quot;FAIL: wrong error returneed&quot;
+    }
+    if {[catch {test_proc &quot;&quot;}] != 0} {
+       return &quot;FAIL: wrong value returned&quot;
+    }
+    return &quot;throw successful.&quot;
+} -result &quot;throw successful.&quot;
+
+
+test try {
+    Try unit test.
+} -setup {
+    proc test_proc {} {try {return 7} catch * {return 6}}
+    proc test_proc2 {} {try {error &quot;msg&quot; &quot;info&quot; 3} catch * {return 6}}
+} -body {
+    if {[test_proc] != 7} {
+       return &quot;FAIL: try clause not working&quot;
+    }
+    if {[test_proc2] != 6} {
+       reutrn &quot;FAIL: catch clause not working&quot;
+    }
+    if {[catch {try}] != 1} {
+       return &quot;FAIL: no args err not detected&quot;
+    }
+    return &quot;try successful.&quot;
+} -result &quot;try successful.&quot;
+
+
+cleanupTests
</ins></span></pre></div>
<a id="branchesnewhelpsystembasesrcmacports10testssourcesconffromrev117083trunkbasesrcmacports10testssourcesconf"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/src/macports1.0/tests/sources.conf (from rev 117083, trunk/base/src/macports1.0/tests/sources.conf) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/macports1.0/tests/sources.conf                                (rev 0)
+++ branches/new-help-system/base/src/macports1.0/tests/sources.conf        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,28 @@
</span><ins>+# $Id$
+# MacPorts system-wide configuration file for ports tree sources.
+#
+# To change how MacPorts fetches base, see rsync_server and rsync_dir in
+# macports.conf.
+# To add a local source, add a &quot;file://&quot; entry.
+#
+#   Example: file:///Users/landonf/misc/MacPorts/ports
+#
+# To prevent a source from synchronizing when `port sync` is used,
+# append &quot;[nosync]&quot; at the end.
+#
+#   Example: file:///Users/landonf/misc/MacPorts/ports [nosync]
+#
+# Note that MacPorts parses source URLs in order; when a port appears in
+# multiple sources, it installs the first occurrence. For local sources
+# to shadow remote ones, &quot;file://&quot; URLs must come before other URLs.
+# A list of rsync mirrors is available at
+# https://trac.macports.org/wiki/Mirrors#Portfiles.
+#
+# If an &quot;rsync://&quot; URL points to a .tar file, a signed .rmd160 file must
+# exist in the same directory on the server and will be used to verify
+# its integrity.
+#
+# For proper functionality of various resources (port groups, mirror
+# sites, etc.), the primary MacPorts source must always be tagged
+# &quot;[default]&quot;, even if switched from the default &quot;rsync://&quot; URL.
+rsync://rsync.macports.org/release/tarballs/ports.tar [default]
</ins></span></pre></div>
<a id="branchesnewhelpsystembasesrcmacports10teststesttclfromrev117083trunkbasesrcmacports10teststesttcl"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/src/macports1.0/tests/test.tcl (from rev 117083, trunk/base/src/macports1.0/tests/test.tcl) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/macports1.0/tests/test.tcl                                (rev 0)
+++ branches/new-help-system/base/src/macports1.0/tests/test.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,131 @@
</span><ins>+# Global vars
+set arguments &quot;&quot;
+set test_name &quot;&quot;
+set color_out &quot;&quot;
+set tcl &quot;&quot;
+set err &quot;&quot;
+
+# Get tclsh path.
+set autoconf ../../Mk/macports.autoconf.mk
+set fp [open $autoconf r]
+while {[gets $fp line] != -1} {
+    if {[string match &quot;TCLSH*&quot; $line] != 0} {
+        set tcl [lrange [split $line &quot; &quot;] 1 1]
+    }
+}
+
+proc print_help {arg} {
+    if { $arg eq &quot;tests&quot; } {
+        puts &quot;The list of available tests is:&quot;
+        cd tests
+        set test_suite [glob *.test]
+        foreach test $test_suite {
+            puts [puts -nonewline &quot;  &quot;]$test
+        }
+    } else {
+        puts &quot;Usage: tclsh test.tcl \[-debug level\] \[-t test\] \[-l\]\n&quot;
+        puts &quot;  -debug LVL : sets the level of printed debug info \[0-3\]&quot;
+        puts &quot;  -t TEST    : run a specific test&quot;
+        puts &quot;  -nocolor   : disable color output (for automatic testing)&quot;
+        puts &quot;  -l         : print the list of available tests&quot;
+        puts &quot;  -h, -help  : print this message\n&quot;
+    }
+}
+
+# Process args
+foreach arg $argv {
+    if { $arg eq &quot;-h&quot; || $arg eq &quot;-help&quot; } {
+        print_help &quot;&quot;
+        exit 0
+    } elseif { $arg eq &quot;-debug&quot; } {
+        set index [expr {[lsearch $argv $arg] + 1}]
+        set level [lindex $argv $index]
+        if { $level &gt;= 0 &amp;&amp; $level &lt;= 3 } {
+            append arguments &quot;-debug &quot; $level
+        } else {
+            puts &quot;Invalid debug level.&quot;
+            exit 1
+        }
+    } elseif { $arg eq &quot;-t&quot; } {
+        set index [expr {[lsearch $argv $arg] + 1}]
+        set test_name [lindex $argv $index]
+        set no 0
+        cd tests
+        set test_suite [glob *.test]
+        foreach test $test_suite {
+            if { $test_name != $test } {
+                set no [expr {$no + 1}]
+            }
+        }
+        if { $no == [llength $test_suite] } {
+            print_help tests
+            exit 1
+        }
+    } elseif { $arg eq &quot;-l&quot; } {
+        print_help tests
+        exit 0
+    } elseif { $arg eq &quot;-nocolor&quot; } {
+        set color_out &quot;no&quot;
+    }
+}
+
+
+# Run tests
+if { $test_name ne &quot;&quot;} {
+    set result [eval exec $tcl $test_name $arguments 2&gt;@stderr]
+    puts $result
+
+} else {
+    cd tests
+    set test_suite [glob *.test]
+
+    foreach test $test_suite {
+        set result [eval exec $tcl $test $arguments 2&gt;@stderr]
+        set lastline [lindex [split $result &quot;\n&quot;] end]
+
+        if {[lrange [split $lastline &quot;\t&quot;] 1 1] != &quot;Total&quot;} {
+            set lastline [lindex [split $result &quot;\n&quot;] end-2]
+            set errmsg [lindex [split $result &quot;\n&quot;] end]
+        }
+
+        set splitresult [split $lastline &quot;\t&quot;]
+        set total [lindex $splitresult 2]
+        set pass [lindex $splitresult 4]
+        set skip [lindex $splitresult 6]
+        set fail [lindex $splitresult 8]
+
+        # Format output
+        if {$total &lt; 10} { set total &quot;0${total}&quot;}
+        if {$pass &lt; 10} { set pass &quot;0${pass}&quot;}
+        if {$skip &lt; 10} { set skip &quot;0${skip}&quot;}
+        if {$fail &lt; 10} { set fail &quot;0${fail}&quot;}
+
+        # Check for errors.
+        if { $fail != 0 } { set err &quot;yes&quot; }
+
+        set out &quot;&quot;
+        if { ($fail != 0 || $skip != 0) &amp;&amp; $color_out eq &quot;&quot; } {
+            # Color failed tests.
+            append out &quot;\x1b\[1;31mTotal:&quot; $total &quot; Passed:&quot; $pass &quot; Failed:&quot; $fail &quot; Skipped:&quot; $skip &quot;  \x1b\[0m&quot; $test
+        } else {
+            append out &quot;Total:&quot; $total &quot; Passed:&quot; $pass &quot; Failed:&quot; $fail &quot; Skipped:&quot; $skip &quot;  &quot; $test
+        }
+
+        # Print results and constrints for auto-skipped tests.
+        puts $out
+        if { $skip != 0 } {
+            set out &quot;    Constraint: &quot;
+            append out [string trim $errmsg &quot;\t {}&quot;]
+            puts $out
+        }
+        if { $fail != 0 } {
+            set end [expr {[string first $test $result 0] - 1}]
+            puts [string range $result 0 $end]
+        }
+    }
+}
+
+# Return 1 if errors were found.
+if {$err ne &quot;&quot;} { exit 1 }
+
+return 0
</ins></span></pre></div>
<a id="branchesnewhelpsystembasesrcpackage10"></a>
<div class="propset"><h4>Property changes: branches/new-help-system/base/src/package1.0</h4>
<pre class="diff"><span>
</span></pre></div>
<a id="svnignore"></a>
<div class="modfile"><h4>Modified: svn:ignore</h4></div>
<span class="cx">   + pkgIndex.tcl
</span><span class="cx">package_test_autoconf.tcl
</span><a id="branchesnewhelpsystembasesrcpackage10Makefile"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/src/package1.0/Makefile (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/package1.0/Makefile        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/src/package1.0/Makefile        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -15,8 +15,11 @@
</span><span class="cx">         rm -f pkgIndex.tcl
</span><span class="cx"> 
</span><span class="cx"> distclean:: clean
</span><ins>+        rm -f package_test_autoconf.tcl
</ins><span class="cx"> 
</span><span class="cx"> test::
</span><ins>+        -$(prefix)/bin/port sync
+        $(TCLSH) ./tests/test.tcl -nocolor
</ins><span class="cx"> 
</span><span class="cx"> install:: all
</span><span class="cx">         $(INSTALL) -d -o ${DSTUSR} -g ${DSTGRP} -m ${DSTMODE} ${INSTALLDIR}
</span></span></pre></div>
<a id="branchesnewhelpsystembasesrcpackage10package_test_autoconftclinfromrev117083trunkbasesrcpackage10package_test_autoconftclin"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/src/package1.0/package_test_autoconf.tcl.in (from rev 117083, trunk/base/src/package1.0/package_test_autoconf.tcl.in) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/package1.0/package_test_autoconf.tcl.in                                (rev 0)
+++ branches/new-help-system/base/src/package1.0/package_test_autoconf.tcl.in        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,41 @@
</span><ins>+# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4
+# macports-autoconf.tcl.in
+# $Id: macports_autoconf.tcl.in 90070 2012-02-20 21:54:35Z jberry@macports.org $
+#
+# Copyright (c) 2006 - 2009, 2011 The MacPorts Project
+# Copyright (c) 2002 - 2003 Apple 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 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 &quot;AS IS&quot;
+# 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.
+#
+
+namespace eval macports::autoconf {
+    variable macports_tcl_dir &quot;@macports_tcl_dir@&quot;
+    variable prefix &quot;@prefix@&quot;
+}
+
+namespace eval portutil::autoconf {
+    variable hdiutil_path &quot;@HDIUTIL@&quot;
+}
</ins></span></pre></div>
<a id="branchesnewhelpsystembasesrcpackage10portarchivefetchtcl"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/src/package1.0/portarchivefetch.tcl (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/package1.0/portarchivefetch.tcl        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/src/package1.0/portarchivefetch.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -104,7 +104,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     # check if porturl itself points to an archive
</span><del>-    if {[file rootname [file tail $porturl]] == [file rootname [get_portimage_name]] &amp;&amp; [file extension $porturl] != &quot;&quot;} {
</del><ins>+    if {[file rootname [file tail $porturl]] eq [file rootname [get_portimage_name]] &amp;&amp; [file extension $porturl] ne &quot;&quot;} {
</ins><span class="cx">         lappend ret [string range $porturl 0 end-[string length [file tail $porturl]]]:[string range [file extension $porturl] 1 end]
</span><span class="cx">         archive.subdir
</span><span class="cx">     }
</span><span class="lines">@@ -186,15 +186,19 @@
</span><span class="cx">     if {${archivefetch.ignore_sslcert} != &quot;no&quot;} {
</span><span class="cx">         lappend fetch_options &quot;--ignore-ssl-cert&quot;
</span><span class="cx">     }
</span><del>-    if {$portverbose == &quot;yes&quot;} {
-        lappend fetch_options &quot;-v&quot;
</del><ins>+    if {$portverbose eq &quot;yes&quot;} {
+        lappend fetch_options &quot;--progress&quot;
+        lappend fetch_options &quot;builtin&quot;
+    } elseif {[llength [info commands ui_progress_download]] &gt; 0} {
+        lappend fetch_options &quot;--progress&quot;
+        lappend fetch_options &quot;ui_progress_download&quot;
</ins><span class="cx">     }
</span><span class="cx">     set sorted no
</span><span class="cx"> 
</span><span class="cx">     set existing_archive [find_portarchive_path]
</span><span class="cx"> 
</span><span class="cx">     foreach {url_var archive} $archivefetch_urls {
</span><del>-        if {![file isfile ${archivefetch.fulldestpath}/${archive}] &amp;&amp; $existing_archive == &quot;&quot;} {
</del><ins>+        if {![file isfile ${archivefetch.fulldestpath}/${archive}] &amp;&amp; $existing_archive eq &quot;&quot;} {
</ins><span class="cx">             ui_info &quot;$UI_PREFIX [format [msgcat::mc &quot;%s doesn't seem to exist in %s&quot;] $archive ${archivefetch.fulldestpath}]&quot;
</span><span class="cx">             if {![file writable ${archivefetch.fulldestpath}]} {
</span><span class="cx">                 return -code error [format [msgcat::mc &quot;%s must be writable&quot;] ${archivefetch.fulldestpath}]
</span><span class="lines">@@ -213,7 +217,7 @@
</span><span class="cx">             set failed_sites 0
</span><span class="cx">             unset -nocomplain fetched
</span><span class="cx">             foreach site $urlmap($url_var) {
</span><del>-                if {[string index $site end] != &quot;/&quot;} {
</del><ins>+                if {[string index $site end] ne &quot;/&quot;} {
</ins><span class="cx">                     append site &quot;/[option archive.subdir]&quot;
</span><span class="cx">                 } else {
</span><span class="cx">                     append site [option archive.subdir]
</span><span class="lines">@@ -280,7 +284,7 @@
</span><span class="cx">         }
</span><span class="cx">         return 0
</span><span class="cx">     }
</span><del>-    if {[info exists ports_binary_only] &amp;&amp; $ports_binary_only == &quot;yes&quot;} {
</del><ins>+    if {[info exists ports_binary_only] &amp;&amp; $ports_binary_only eq &quot;yes&quot;} {
</ins><span class="cx">         return -code error &quot;archivefetch failed for [option subport] @[option version]_[option revision][option portvariants]&quot;
</span><span class="cx">     } else {
</span><span class="cx">         return 0
</span></span></pre></div>
<a id="branchesnewhelpsystembasesrcpackage10portdmgtcl"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/src/package1.0/portdmg.tcl (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/package1.0/portdmg.tcl        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/src/package1.0/portdmg.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -91,13 +91,13 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     set hdiutil [findBinary hdiutil $portutil::autoconf::hdiutil_path]
</span><del>-    if {[system &quot;$hdiutil create -quiet -fs HFS+ -volname ${imagename} -srcfolder ${pkgpath} ${tmp_image}&quot;] != &quot;&quot;} {
</del><ins>+    if {[system &quot;$hdiutil create -quiet -fs HFS+ -volname ${imagename} -srcfolder ${pkgpath} ${tmp_image}&quot;] ne &quot;&quot;} {
</ins><span class="cx">         return -code error [format [msgcat::mc &quot;Failed to create temporary image: %s&quot;] ${imagename}]
</span><span class="cx">     }
</span><del>-    if {[system &quot;$hdiutil convert ${tmp_image} -format UDCO -o ${final_image} -quiet&quot;] != &quot;&quot;} {
</del><ins>+    if {[system &quot;$hdiutil convert ${tmp_image} -format UDCO -o ${final_image} -quiet&quot;] ne &quot;&quot;} {
</ins><span class="cx">         return -code error [format [msgcat::mc &quot;Failed to convert to final image: %s&quot;] ${final_image}]
</span><span class="cx">     }
</span><del>-    if {[system &quot;$hdiutil internet-enable -quiet -yes ${final_image}&quot;] != &quot;&quot;} {
</del><ins>+    if {[system &quot;$hdiutil internet-enable -quiet -yes ${final_image}&quot;] ne &quot;&quot;} {
</ins><span class="cx">         return -code error [format [msgcat::mc &quot;Failed to internet-enable: %s&quot;] ${final_image}]
</span><span class="cx">     }
</span><span class="cx">     file delete -force &quot;${tmp_image}&quot;
</span></span></pre></div>
<a id="branchesnewhelpsystembasesrcpackage10portdpkgtcl"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/src/package1.0/portdpkg.tcl (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/package1.0/portdpkg.tcl        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/src/package1.0/portdpkg.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -87,7 +87,7 @@
</span><span class="cx">         set controlfd [open [file join ${controlpath} control] w+]
</span><span class="cx"> 
</span><span class="cx">         # Size, in kilobytes, of ${destpath}
</span><del>-           set pkg_installed-size [expr [dirSize ${destpath}] / 1024]
</del><ins>+           set pkg_installed-size [expr {[dirSize ${destpath}] / 1024}]
</ins><span class="cx"> 
</span><span class="cx">         # Create debian dependency list
</span><span class="cx">         if {[info exists dependencies]} {
</span><span class="lines">@@ -97,12 +97,12 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         # Create dpkg version number
</span><del>-        if {[expr [option epoch] != 0]} {
</del><ins>+        if {[option epoch] != 0} {
</ins><span class="cx">                 set pkg_version &quot;[option epoch]:[option version]&quot;
</span><span class="cx">         } else {
</span><span class="cx">                 set pkg_version &quot;[option version]&quot;
</span><span class="cx">         }
</span><del>-        if {[expr [option revision] != 0]} {
</del><ins>+        if {[option revision] != 0} {
</ins><span class="cx">                 append pkg_version &quot;-[option revision]&quot;
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="lines">@@ -146,7 +146,7 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         # An architecture-independent package
</span><del>-        if {$supported_archs == &quot;noarch&quot;} {
</del><ins>+        if {$supported_archs eq &quot;noarch&quot;} {
</ins><span class="cx">                 set pkg_arch &quot;all&quot;
</span><span class="cx">         }
</span><span class="cx"> 
</span></span></pre></div>
<a id="branchesnewhelpsystembasesrcpackage10portmdmgtcl"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/src/package1.0/portmdmg.tcl (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/package1.0/portmdmg.tcl        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/src/package1.0/portmdmg.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -91,13 +91,13 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     set hdiutil [findBinary hdiutil $portutil::autoconf::hdiutil_path]
</span><del>-    if {[system &quot;$hdiutil create -quiet -fs HFS+ -volname ${imagename} -srcfolder ${mpkgpath} ${tmp_image}&quot;] != &quot;&quot;} {
</del><ins>+    if {[system &quot;$hdiutil create -quiet -fs HFS+ -volname ${imagename} -srcfolder ${mpkgpath} ${tmp_image}&quot;] ne &quot;&quot;} {
</ins><span class="cx">         return -code error [format [msgcat::mc &quot;Failed to create temporary image: %s&quot;] ${imagename}]
</span><span class="cx">     }
</span><del>-    if {[system &quot;$hdiutil convert ${tmp_image} -format UDCO -o ${final_image} -quiet&quot;] != &quot;&quot;} {
</del><ins>+    if {[system &quot;$hdiutil convert ${tmp_image} -format UDCO -o ${final_image} -quiet&quot;] ne &quot;&quot;} {
</ins><span class="cx">         return -code error [format [msgcat::mc &quot;Failed to convert to final image: %s&quot;] ${final_image}]
</span><span class="cx">     }
</span><del>-    if {[system &quot;$hdiutil internet-enable -quiet -yes ${final_image}&quot;] != &quot;&quot;} {
</del><ins>+    if {[system &quot;$hdiutil internet-enable -quiet -yes ${final_image}&quot;] ne &quot;&quot;} {
</ins><span class="cx">         return -code error [format [msgcat::mc &quot;Failed to internet-enable: %s&quot;] ${final_image}]
</span><span class="cx">     }
</span><span class="cx">     file delete -force &quot;${tmp_image}&quot;
</span></span></pre></div>
<a id="branchesnewhelpsystembasesrcpackage10portmpkgtcl"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/src/package1.0/portmpkg.tcl (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/package1.0/portmpkg.tcl        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/src/package1.0/portmpkg.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -91,7 +91,7 @@
</span><span class="cx"> 
</span><span class="cx">     foreach depspec $depends {
</span><span class="cx">         set dep [_get_dep_port $depspec]
</span><del>-        if {$dep != &quot;&quot;} {
</del><ins>+        if {$dep ne &quot;&quot;} {
</ins><span class="cx">             eval &quot;lappend result [make_dependency_list $dep $destination]&quot;
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="lines">@@ -122,7 +122,7 @@
</span><span class="cx"> 
</span><span class="cx"> proc portmpkg::epoch_namestr {portepoch} {
</span><span class="cx">     set portepoch_namestr &quot;&quot;
</span><del>-    if {${portepoch} != &quot;0&quot;} {
</del><ins>+    if {${portepoch} != 0} {
</ins><span class="cx">         set portepoch_namestr &quot;${portepoch}_&quot;
</span><span class="cx">     }
</span><span class="cx">     return ${portepoch_namestr}
</span><span class="lines">@@ -130,7 +130,7 @@
</span><span class="cx"> 
</span><span class="cx"> proc portmpkg::revision_namestr {portrevision} {
</span><span class="cx">     set portrevision_namestr &quot;&quot;
</span><del>-    if {${portrevision} != &quot;0&quot;} {
</del><ins>+    if {${portrevision} != 0} {
</ins><span class="cx">         set portrevision_namestr &quot;_${portrevision}&quot;
</span><span class="cx">     }
</span><span class="cx">     return ${portrevision_namestr}
</span><span class="lines">@@ -171,13 +171,13 @@
</span><span class="cx">         set name [lindex $dep 0]
</span><span class="cx">         set epoch [lindex $dep 1]
</span><span class="cx">         set epoch_namestr &quot;&quot;
</span><del>-        if {$epoch != &quot;0&quot;} {
</del><ins>+        if {$epoch != 0} {
</ins><span class="cx">             set epoch_namestr &quot;${epoch}_&quot;
</span><span class="cx">         }
</span><span class="cx">         set vers [lindex $dep 2]
</span><span class="cx">         set rev [lindex $dep 3]
</span><span class="cx">         set rev_namestr &quot;&quot;
</span><del>-        if {$rev != &quot;0&quot;} {
</del><ins>+        if {$rev != 0} {
</ins><span class="cx">             set rev_namestr &quot;_${rev}&quot;
</span><span class="cx">         }
</span><span class="cx">         set mport [lindex $dep 4]
</span><span class="lines">@@ -272,7 +272,7 @@
</span><span class="cx"> proc portmpkg::mpkg_write_info_plist {infofile portname portversion portrevision destination dependencies} {
</span><span class="cx">     set vers [split $portversion &quot;.&quot;]
</span><span class="cx"> 
</span><del>-    if {[string index $destination end] != &quot;/&quot;} {
</del><ins>+    if {[string index $destination end] ne &quot;/&quot;} {
</ins><span class="cx">         append destination /
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre></div>
<a id="branchesnewhelpsystembasesrcpackage10portpkgtcl"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/src/package1.0/portpkg.tcl (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/package1.0/portpkg.tcl        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/src/package1.0/portpkg.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -51,7 +51,7 @@
</span><span class="cx"> default package.resources {${workpath}/pkg_resources}
</span><span class="cx"> default package.scripts  {${workpath}/pkg_scripts}
</span><span class="cx"> # Need productbuild to make flat packages really work
</span><del>-default package.flat     {[expr [vercmp $macosx_deployment_target 10.6] &gt;= 0]}
</del><ins>+default package.flat     {[expr {[vercmp $macosx_deployment_target 10.6] &gt;= 0}]}
</ins><span class="cx"> 
</span><span class="cx"> set_ui_prefix
</span><span class="cx"> 
</span><span class="lines">@@ -113,11 +113,11 @@
</span><span class="cx">     pkg_post_unarchive_deletions portpkg::language
</span><span class="cx"> 
</span><span class="cx">     set portepoch_namestr &quot;&quot;
</span><del>-    if {${portepoch} != &quot;0&quot;} {
</del><ins>+    if {${portepoch} != 0} {
</ins><span class="cx">         set portepoch_namestr &quot;${portepoch}_&quot;
</span><span class="cx">     }
</span><span class="cx">     set portrevision_namestr &quot;&quot;
</span><del>-    if {${portrevision} != &quot;0&quot;} {
</del><ins>+    if {${portrevision} != 0} {
</ins><span class="cx">         set portrevision_namestr &quot;_${portrevision}&quot;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -314,12 +314,12 @@
</span><span class="cx"> 
</span><span class="cx"> proc portpkg::write_welcome_html {filename portname portepoch portversion portrevision long_description description homepage} {
</span><span class="cx">     set fd [open ${filename} w+]
</span><del>-    if {$long_description == &quot;&quot;} {
</del><ins>+    if {$long_description eq &quot;&quot;} {
</ins><span class="cx">         set long_description $description
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     set portname [xml_escape $portname]
</span><del>-    if {$portepoch != &quot;0&quot;} {
</del><ins>+    if {$portepoch != 0} {
</ins><span class="cx">         set portepoch [xml_escape $portepoch]
</span><span class="cx">         set portepoch_str &quot;${portepoch}_&quot;
</span><span class="cx">     } else {
</span><span class="lines">@@ -327,7 +327,7 @@
</span><span class="cx">         set portepoch_str &quot;&quot;
</span><span class="cx">     }
</span><span class="cx">     set portversion [xml_escape $portversion]
</span><del>-    if {$portrevision != &quot;0&quot;} {
</del><ins>+    if {$portrevision != 0} {
</ins><span class="cx">         set portrevision [xml_escape $portrevision]
</span><span class="cx">         set portrevision_str &quot;_${portrevision}&quot;
</span><span class="cx">     } else {
</span><span class="lines">@@ -350,7 +350,7 @@
</span><span class="cx"> &lt;font face=\&quot;Helvetica\&quot;&gt;${long_description}&lt;/font&gt;
</span><span class="cx"> &lt;p&gt;&quot;
</span><span class="cx"> 
</span><del>-    if {$homepage != &quot;&quot;} {
</del><ins>+    if {$homepage ne &quot;&quot;} {
</ins><span class="cx">         puts $fd &quot;&lt;font face=\&quot;Helvetica\&quot;&gt;&lt;a href=\&quot;${homepage}\&quot;&gt;${homepage}&lt;/a&gt;&lt;/font&gt;&lt;p&gt;&quot;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -366,10 +366,10 @@
</span><span class="cx">     if {[catch {set numFiles [llength [split [exec [findBinary lsbom $portutil::autoconf::lsbom_path] -s ${pkgpath}/Contents/Archive.bom] &quot;\n&quot;]]} result]} {
</span><span class="cx">         return -code error [format [msgcat::mc &quot;Reading package bom failed: %s&quot;] $result]
</span><span class="cx">     }
</span><del>-    if {[catch {set compressedSize [expr [dirSize ${pkgpath}] / 1024]} result]} {
</del><ins>+    if {[catch {set compressedSize [expr {[dirSize ${pkgpath}] / 1024}]} result]} {
</ins><span class="cx">         return -code error [format [msgcat::mc &quot;Error determining compressed size: %s&quot;] $result]
</span><span class="cx">     }
</span><del>-    if {[catch {set installedSize [expr [dirSize ${destpath}] / 1024]} result]} {
</del><ins>+    if {[catch {set installedSize [expr {[dirSize ${destpath}] / 1024}]} result]} {
</ins><span class="cx">         return -code error [format [msgcat::mc &quot;Error determining installed size: %s&quot;] $result]
</span><span class="cx">     }
</span><span class="cx">     if {[catch {set infoSize [file size ${pkgpath}/Contents/Info.plist]} result]} {
</span><span class="lines">@@ -399,7 +399,7 @@
</span><span class="cx"> proc portpkg::write_distribution {dfile portname portepoch portversion portrevision} {
</span><span class="cx">     global macosx_deployment_target
</span><span class="cx">     set portname [xml_escape $portname]
</span><del>-    if {$portepoch != &quot;0&quot;} {
</del><ins>+    if {$portepoch != 0} {
</ins><span class="cx">         set portepoch [xml_escape $portepoch]
</span><span class="cx">         set portepoch_str &quot;${portepoch}_&quot;
</span><span class="cx">     } else {
</span><span class="lines">@@ -407,7 +407,7 @@
</span><span class="cx">         set portepoch_str &quot;&quot;
</span><span class="cx">     }
</span><span class="cx">     set portversion [xml_escape $portversion]
</span><del>-    if {$portrevision != &quot;0&quot;} {
</del><ins>+    if {$portrevision != 0} {
</ins><span class="cx">         set portrevision [xml_escape $portrevision]
</span><span class="cx">         set portrevision_str &quot;_${portrevision}&quot;
</span><span class="cx">     } else {
</span><span class="lines">@@ -503,11 +503,11 @@
</span><span class="cx">             # subtracted, otherwise subtract 'a'.  Add 1 to the value
</span><span class="cx">             # so that 'a' and 'A' are mapped to 1, not 0.
</span><span class="cx">             if {$ord &lt; $ord_a} {
</span><del>-                set j [expr $ord - $ord_A + 1]
</del><ins>+                set j [expr {$ord - $ord_A + 1}]
</ins><span class="cx">             } else {
</span><del>-                set j [expr $ord - $ord_a + 1]
</del><ins>+                set j [expr {$ord - $ord_a + 1}]
</ins><span class="cx">             }
</span><del>-            set i [expr 26*$i + $j]
</del><ins>+            set i [expr {26*$i + $j}]
</ins><span class="cx">         }
</span><span class="cx">         lappend vs $i
</span><span class="cx">     }
</span></span></pre></div>
<a id="branchesnewhelpsystembasesrcpackage10portrpmtcl"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/src/package1.0/portrpm.tcl (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/package1.0/portrpm.tcl        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/src/package1.0/portrpm.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -81,7 +81,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     set rpmbuildarch &quot;&quot;
</span><del>-    if {$supported_archs == &quot;noarch&quot;} {
</del><ins>+    if {$supported_archs eq &quot;noarch&quot;} {
</ins><span class="cx">         set rpmbuildarch &quot;--target noarch&quot;
</span><span class="cx">     } elseif {[variant_exists universal] &amp;&amp; [variant_isset universal]} {
</span><span class="cx">         set rpmbuildarch &quot;--target fat&quot;
</span><span class="lines">@@ -227,7 +227,7 @@
</span><span class="cx"> URL: ${homepage}
</span><span class="cx"> BuildRoot: ${destroot}
</span><span class="cx"> AutoReq: no&quot;
</span><del>-    if {[expr ${epoch} != 0]} {
</del><ins>+    if {$epoch != 0} {
</ins><span class="cx">             puts $specfd &quot;Epoch: ${epoch}&quot;
</span><span class="cx">     }
</span><span class="cx">     if {[llength ${dependencies}] != 0} {
</span></span></pre></div>
<a id="branchesnewhelpsystembasesrcpackage10portsrpmtcl"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/src/package1.0/portsrpm.tcl (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/package1.0/portsrpm.tcl        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/src/package1.0/portsrpm.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -224,10 +224,10 @@
</span><span class="cx"> URL: ${homepage}
</span><span class="cx"> BuildRoot: %{_tmppath}/%{name}-%{version}-root
</span><span class="cx"> Source0: ${portname}-Portfile&quot;
</span><del>-    if {$zip != &quot;&quot;} {
</del><ins>+    if {$zip ne &quot;&quot;} {
</ins><span class="cx">         puts $specfd &quot;Source1: $zip&quot;
</span><span class="cx">     }
</span><del>-    if {[expr ${epoch} != 0]} {
</del><ins>+    if {$epoch != 0} {
</ins><span class="cx">             puts $specfd &quot;Epoch: ${epoch}&quot;
</span><span class="cx">     }
</span><span class="cx">     set first 2
</span><span class="lines">@@ -238,7 +238,7 @@
</span><span class="cx">         puts -nonewline $specfd &quot;Source${count}: &quot;
</span><span class="cx">         if {![info exists $fetch_urls]} {
</span><span class="cx">         foreach {url_var distfile}  ${fetch_urls} {
</span><del>-            if {[string equal $distfile $file]} {
</del><ins>+            if {$distfile eq $file} {
</ins><span class="cx">                  global portfetch::$url_var master_sites
</span><span class="cx">                  set site [lindex [set $url_var] 0]
</span><span class="cx">                  set file [portfetch::assemble_url $site $distfile]
</span><span class="lines">@@ -259,7 +259,7 @@
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx">     set wrap_description [word_wrap ${long_description} 72]
</span><del>-    if {$zip != &quot;&quot;} {
</del><ins>+    if {$zip ne &quot;&quot;} {
</ins><span class="cx">         set and &quot;-a 1&quot;
</span><span class="cx">     } else {
</span><span class="cx">         set and &quot;&quot;
</span></span></pre></div>
<a id="branchesnewhelpsystembasesrcpackage10portunarchivetcl"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/src/package1.0/portunarchive.tcl (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/package1.0/portunarchive.tcl        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/src/package1.0/portunarchive.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -71,14 +71,14 @@
</span><span class="cx">     set skipped 0
</span><span class="cx">     if {[check_statefile target org.macports.unarchive $target_state_fd]} {
</span><span class="cx">         return 0
</span><del>-    } elseif {[info exists ports_source_only] &amp;&amp; $ports_source_only == &quot;yes&quot;} {
</del><ins>+    } elseif {[info exists ports_source_only] &amp;&amp; $ports_source_only eq &quot;yes&quot;} {
</ins><span class="cx">         ui_debug &quot;Skipping unarchive ($subport) since source-only is set&quot;
</span><span class="cx">         set skipped 1
</span><span class="cx">     } elseif {[check_statefile target org.macports.destroot $target_state_fd]
</span><span class="cx">               &amp;&amp; [file isdirectory $destroot]} {
</span><span class="cx">         ui_debug &quot;Skipping unarchive ($subport) since destroot completed&quot;
</span><span class="cx">         set skipped 1
</span><del>-    } elseif {[info exists ports_force] &amp;&amp; $ports_force == &quot;yes&quot;} {
</del><ins>+    } elseif {[info exists ports_force] &amp;&amp; $ports_force eq &quot;yes&quot;} {
</ins><span class="cx">         ui_debug &quot;Skipping unarchive ($subport) since force is set&quot;
</span><span class="cx">         set skipped 1
</span><span class="cx">     } else {
</span><span class="lines">@@ -88,7 +88,7 @@
</span><span class="cx">         if {${unarchive.path} != &quot;&quot;} {
</span><span class="cx">             ui_debug &quot;Found [string toupper ${unarchive.type}] archive: ${unarchive.path}&quot;
</span><span class="cx">         } else {
</span><del>-            if {[info exists ports_binary_only] &amp;&amp; $ports_binary_only == &quot;yes&quot;} {
</del><ins>+            if {[info exists ports_binary_only] &amp;&amp; $ports_binary_only eq &quot;yes&quot;} {
</ins><span class="cx">                 return -code error &quot;Archive for ${subport} ${version}_${revision}${portvariants} not found, required when binary-only is set!&quot;
</span><span class="cx">             } else {
</span><span class="cx">                 ui_debug &quot;Skipping unarchive ($subport) since no suitable archive found&quot;
</span></span></pre></div>
<a id="branchesnewhelpsystembasesrcpextlib10Makefilein"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/src/pextlib1.0/Makefile.in (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/pextlib1.0/Makefile.in        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/src/pextlib1.0/Makefile.in        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -32,3 +32,6 @@
</span><span class="cx">         ${TCLSH} tests/symlink.tcl ./${SHLIB_NAME}
</span><span class="cx">         ${TCLSH} tests/unsetenv.tcl ./${SHLIB_NAME}
</span><span class="cx">         ${TCLSH} tests/vercomp.tcl ./${SHLIB_NAME}
</span><ins>+
+distclean::
+        rm -f Makefile
</ins><span class="cx">Property changes on: branches/new-help-system/base/src/pextlib1.0/Makefile.in
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svnmergeinfo"></a>
<div class="modfile"><h4>Modified: svn:mergeinfo</h4></div>
<span class="cx">/branches/gsoc08-privileges/base/src/pextlib1.0/Makefile.in:37343-46937
</span><span class="cx">/branches/gsoc09-logging/base/src/pextlib1.0/Makefile:51231-60371
</span><span class="cx">/branches/gsoc09-logging/base/src/pextlib1.0/Makefile.in:51231-60371
</span><span class="cx">/branches/gsoc11-rev-upgrade/base/src/pextlib1.0/Makefile:78828-88375
</span><span class="cx">/branches/gsoc11-rev-upgrade/base/src/pextlib1.0/Makefile.in:78828-88375
</span><span class="cx">/branches/universal-sanity/base/src/pextlib1.0/Makefile:51872-52323
</span><span class="cx">/branches/universal-sanity/base/src/pextlib1.0/Makefile.in:51872-52323
</span><span class="cx">/branches/variant-descs-14482/base/src/pextlib1.0/Makefile:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
</span><span class="cx">/branches/variant-descs-14482/base/src/pextlib1.0/Makefile.in:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
</span><span class="cx">/trunk/base/src/pextlib1.0/Makefile.in:49341-104698,108155-110831
</span><span class="cx">/users/perry/base-bugs_and_notes/src/pextlib1.0/Makefile:45682-46060
</span><span class="cx">/users/perry/base-bugs_and_notes/src/pextlib1.0/Makefile.in:45682-46060
</span><span class="cx">/users/perry/base-select/src/pextlib1.0/Makefile:44044-44692
</span><span class="cx">/users/perry/base-select/src/pextlib1.0/Makefile.in:44044-44692
</span><span class="cx">   + /branches/gsoc08-privileges/base/src/pextlib1.0/Makefile:37343-46937
</span><span class="cx">/branches/gsoc08-privileges/base/src/pextlib1.0/Makefile.in:37343-46937
</span><span class="cx">/branches/gsoc09-logging/base/src/pextlib1.0/Makefile:51231-60371
</span><span class="cx">/branches/gsoc09-logging/base/src/pextlib1.0/Makefile.in:51231-60371
</span><span class="cx">/branches/gsoc11-rev-upgrade/base/src/pextlib1.0/Makefile:78828-88375
</span><span class="cx">/branches/gsoc11-rev-upgrade/base/src/pextlib1.0/Makefile.in:78828-88375
</span><span class="cx">/branches/gsoc13-tests/src/pextlib1.0/Makefile.in:106692-111324
</span><span class="cx">/branches/universal-sanity/base/src/pextlib1.0/Makefile:51872-52323
</span><span class="cx">/branches/universal-sanity/base/src/pextlib1.0/Makefile.in:51872-52323
</span><span class="cx">/branches/variant-descs-14482/base/src/pextlib1.0/Makefile:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
</span><span class="cx">/branches/variant-descs-14482/base/src/pextlib1.0/Makefile.in:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
</span><span class="cx">/trunk/base/src/pextlib1.0/Makefile.in:49341-104698,108155-117083
</span><span class="cx">/users/perry/base-bugs_and_notes/src/pextlib1.0/Makefile:45682-46060
</span><span class="cx">/users/perry/base-bugs_and_notes/src/pextlib1.0/Makefile.in:45682-46060
</span><span class="cx">/users/perry/base-select/src/pextlib1.0/Makefile:44044-44692
</span><span class="cx">/users/perry/base-select/src/pextlib1.0/Makefile.in:44044-44692
</span><a id="branchesnewhelpsystembasesrcpextlib10Pextlibc"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/src/pextlib1.0/Pextlib.c (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/pextlib1.0/Pextlib.c        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/src/pextlib1.0/Pextlib.c        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -203,7 +203,7 @@
</span><span class="cx"> 
</span><span class="cx">     user = strdup(Tcl_GetString(objv[1]));
</span><span class="cx">     if (isdigit(*(user)))
</span><del>-        pwent = getpwuid(strtol(user, 0, 0));
</del><ins>+        pwent = getpwuid((uid_t)strtol(user, 0, 0));
</ins><span class="cx">     else
</span><span class="cx">         pwent = getpwnam(user);
</span><span class="cx">     free(user);
</span><span class="lines">@@ -230,7 +230,7 @@
</span><span class="cx"> 
</span><span class="cx">     group = strdup(Tcl_GetString(objv[1]));
</span><span class="cx">     if (isdigit(*(group)))
</span><del>-        grent = getgrgid(strtol(group, 0, 0));
</del><ins>+        grent = getgrgid((gid_t)strtol(group, 0, 0));
</ins><span class="cx">     else
</span><span class="cx">         grent = getgrnam(group);
</span><span class="cx">     free(group);
</span><span class="lines">@@ -254,7 +254,7 @@
</span><span class="cx"> 
</span><span class="cx">     cur = MIN_USABLE_UID;
</span><span class="cx"> 
</span><del>-    while (getpwuid(cur) != NULL) {
</del><ins>+    while (getpwuid((uid_t)cur) != NULL) {
</ins><span class="cx">         cur++;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -271,7 +271,7 @@
</span><span class="cx"> 
</span><span class="cx">     cur = MIN_USABLE_GID;
</span><span class="cx"> 
</span><del>-    while (getgrgid(cur) != NULL) {
</del><ins>+    while (getgrgid((gid_t)cur) != NULL) {
</ins><span class="cx">         cur++;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -280,7 +280,7 @@
</span><span class="cx">     return TCL_OK;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-int UmaskCmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc UNUSED, Tcl_Obj *CONST objv[] UNUSED)
</del><ins>+int UmaskCmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
</ins><span class="cx"> {
</span><span class="cx">     Tcl_Obj *tcl_result;
</span><span class="cx">     char *tcl_mask, *p;
</span><span class="lines">@@ -392,7 +392,7 @@
</span><span class="cx">         for (envp = environ; *envp != NULL; envp++) {
</span><span class="cx">             equals = strchr(*envp, '=');
</span><span class="cx">             if (equals != NULL) {
</span><del>-                len = equals - *envp;
</del><ins>+                len = (size_t)(equals - *envp);
</ins><span class="cx">                 Tcl_ListObjAppendElement(interp, tclList, Tcl_NewStringObj(*envp, len));
</span><span class="cx">             }
</span><span class="cx">         }
</span></span></pre></div>
<a id="branchesnewhelpsystembasesrcpextlib10curlc"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/src/pextlib1.0/curl.c (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/pextlib1.0/curl.c        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/src/pextlib1.0/curl.c        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -51,11 +51,12 @@
</span><span class="cx"> 
</span><span class="cx"> /*
</span><span class="cx">  * Some compiled-in constants that we may wish to change later, given more
</span><del>- * empirical data.  These represent &quot;best guess&quot; values for now.
</del><ins>+ * empirical data. These represent &quot;best guess&quot; values for now.
</ins><span class="cx">  */
</span><span class="cx"> #define _CURL_CONNECTION_TIMEOUT        ((long)(30))                /* 30 seconds */
</span><del>-#define _CURL_MINIMUM_XFER_SPEED        ((long)1024)                /* 1Kb/sec */
</del><ins>+#define _CURL_MINIMUM_XFER_SPEED        ((long)1024)                /* 1KB/sec */
</ins><span class="cx"> #define _CURL_MINIMUM_XFER_TIMEOUT        ((long)(60))                /* 1 minute */
</span><ins>+#define _CURL_MINIMUM_PROGRESS_INTERVAL ((double)(0.2)) /* 0.2 seconds */
</ins><span class="cx"> 
</span><span class="cx"> /* ========================================================================= **
</span><span class="cx">  * Definitions
</span><span class="lines">@@ -63,13 +64,30 @@
</span><span class="cx"> #pragma mark Definitions
</span><span class="cx"> 
</span><span class="cx"> /* ------------------------------------------------------------------------- **
</span><ins>+ * Global cURL handle
+ * ------------------------------------------------------------------------- */
+/* we use a single global handle rather than creating and destroying handles to
+ * take advantage of HTTP pipelining, especially to the packages servers. */
+static CURL* theHandle = NULL;
+
+/* ------------------------------------------------------------------------- **
</ins><span class="cx">  * Prototypes
</span><span class="cx">  * ------------------------------------------------------------------------- */
</span><span class="cx"> int SetResultFromCurlErrorCode(Tcl_Interp* interp, CURLcode inErrorCode);
</span><span class="cx"> int CurlFetchCmd(Tcl_Interp* interp, int objc, Tcl_Obj* CONST objv[]);
</span><span class="cx"> int CurlIsNewerCmd(Tcl_Interp* interp, int objc, Tcl_Obj* CONST objv[]);
</span><span class="cx"> int CurlGetSizeCmd(Tcl_Interp* interp, int objc, Tcl_Obj* CONST objv[]);
</span><ins>+int CurlPostCmd(Tcl_Interp* interp, int objc, Tcl_Obj* CONST objv[]);
</ins><span class="cx"> 
</span><ins>+typedef struct {
+        Tcl_Interp *interp;
+        const char *proc;
+        double prevcalltime;
+} tcl_callback_t;
+
+static int CurlProgressHandler(tcl_callback_t *callback, double dltotal, double dlnow, double ultotal, double ulnow);
+static void CurlProgressCleanup(tcl_callback_t *callback);
+
</ins><span class="cx"> void CurlInit(void);
</span><span class="cx"> 
</span><span class="cx"> /* ========================================================================= **
</span><span class="lines">@@ -104,7 +122,7 @@
</span><span class="cx"> /**
</span><span class="cx">  * curl fetch subcommand entry point.
</span><span class="cx">  *
</span><del>- * syntax: curl fetch [-v] [--disable-epsv] [--ignore-ssl-cert] [--remote-time] [-u userpass] [--effective-url lasturlvar] url filename
</del><ins>+ * syntax: curl fetch [--disable-epsv] [--ignore-ssl-cert] [--remote-time] [-u userpass] [--effective-url lasturlvar] [--progress &quot;builtin&quot;|callback] url filename
</ins><span class="cx">  *
</span><span class="cx">  * @param interp                current interpreter
</span><span class="cx">  * @param objc                        number of parameters
</span><span class="lines">@@ -114,7 +132,6 @@
</span><span class="cx"> CurlFetchCmd(Tcl_Interp* interp, int objc, Tcl_Obj* CONST objv[])
</span><span class="cx"> {
</span><span class="cx">         int theResult = TCL_OK;
</span><del>-        CURL* theHandle = NULL;
</del><span class="cx">         FILE* theFile = NULL;
</span><span class="cx">         bool performFailed = false;
</span><span class="cx">         char theErrorString[CURL_ERROR_SIZE];
</span><span class="lines">@@ -126,6 +143,11 @@
</span><span class="cx">                 int remotetime = 0;
</span><span class="cx">                 const char* theUserPassString = NULL;
</span><span class="cx">                 const char* effectiveURLVarName = NULL;
</span><ins>+                tcl_callback_t progressCallback = {
+                        .interp = interp,
+                        .proc = NULL,
+                        .prevcalltime = 0.0
+                };
</ins><span class="cx">                 char* effectiveURL = NULL;
</span><span class="cx">                 char* userAgent = PACKAGE_NAME &quot;/&quot; PACKAGE_VERSION &quot; libcurl/&quot; LIBCURL_VERSION;
</span><span class="cx">                 int optioncrsr;
</span><span class="lines">@@ -145,9 +167,7 @@
</span><span class="cx">                         /* get the option */
</span><span class="cx">                         const char* theOption = Tcl_GetString(objv[optioncrsr]);
</span><span class="cx"> 
</span><del>-                        if (strcmp(theOption, &quot;-v&quot;) == 0) {
-                                noprogress = 0;
-                        } else if (strcmp(theOption, &quot;--disable-epsv&quot;) == 0) {
</del><ins>+                        if (strcmp(theOption, &quot;--disable-epsv&quot;) == 0) {
</ins><span class="cx">                                 useepsv = 0;
</span><span class="cx">                         } else if (strcmp(theOption, &quot;--ignore-ssl-cert&quot;) == 0) {
</span><span class="cx">                                 ignoresslcert = 1;
</span><span class="lines">@@ -189,6 +209,19 @@
</span><span class="cx">                                         theResult = TCL_ERROR;
</span><span class="cx">                                         break;
</span><span class="cx">                                 }
</span><ins>+                        } else if (strcmp(theOption, &quot;--progress&quot;) == 0) {
+                                /* check we also have the parameter */
+                                if (optioncrsr &lt; lastoption) {
+                                        optioncrsr++;
+                                        noprogress = 0;
+                                        progressCallback.proc = Tcl_GetString(objv[optioncrsr]);
+                                } else {
+                                        Tcl_SetResult(interp,
+                                                &quot;curl fetch: --progress option requires a parameter&quot;,
+                                                TCL_STATIC);
+                                        theResult = TCL_ERROR;
+                                        break;
+                                }
</ins><span class="cx">                         } else {
</span><span class="cx">                                 Tcl_ResetResult(interp);
</span><span class="cx">                                 Tcl_AppendResult(interp, &quot;curl fetch: unknown option &quot;, theOption, NULL);
</span><span class="lines">@@ -220,7 +253,7 @@
</span><span class="cx">                 }
</span><span class="cx"> 
</span><span class="cx">                 /* Open the file */
</span><del>-                theFile = fopen( theFilePath, &quot;w&quot; );
</del><ins>+                theFile = fopen(theFilePath, &quot;w&quot;);
</ins><span class="cx">                 if (theFile == NULL) {
</span><span class="cx">                         Tcl_SetResult(interp, strerror(errno), TCL_VOLATILE);
</span><span class="cx">                         theResult = TCL_ERROR;
</span><span class="lines">@@ -228,7 +261,12 @@
</span><span class="cx">                 }
</span><span class="cx"> 
</span><span class="cx">                 /* Create the CURL handle */
</span><del>-                theHandle = curl_easy_init();
</del><ins>+                if (theHandle == NULL) {
+                        /* Re-use existing handle if theHandle isn't NULL */
+                        theHandle = curl_easy_init();
+                }
+                /* If we're re-using a handle, the previous call did ensure to reset it
+                 * to the default state using curl_easy_reset(3) */
</ins><span class="cx"> 
</span><span class="cx">                 /* Setup the handle */
</span><span class="cx">                 theCurlCode = curl_easy_setopt(theHandle, CURLOPT_URL, theURL);
</span><span class="lines">@@ -238,17 +276,17 @@
</span><span class="cx">                 }
</span><span class="cx"> 
</span><span class="cx"> #if LIBCURL_VERSION_NUM &gt;= 0x071304 &amp;&amp; LIBCURL_VERSION_NUM &lt;= 0x071307
</span><del>-        /* FTP_PROXY workaround for Snow Leopard */
-        if (strncmp(theURL, &quot;ftp:&quot;, 4) == 0) {
-            char *ftp_proxy = getenv(&quot;FTP_PROXY&quot;);
-            if (ftp_proxy) {
-                theCurlCode = curl_easy_setopt(theHandle, CURLOPT_PROXY, ftp_proxy);
-                if (theCurlCode != CURLE_OK) {
-                    theResult = SetResultFromCurlErrorCode(interp, theCurlCode);
-                    break;
-                }
-            }
-        }
</del><ins>+                /* FTP_PROXY workaround for Snow Leopard */
+                if (strncmp(theURL, &quot;ftp:&quot;, 4) == 0) {
+                        char *ftp_proxy = getenv(&quot;FTP_PROXY&quot;);
+                        if (ftp_proxy) {
+                                theCurlCode = curl_easy_setopt(theHandle, CURLOPT_PROXY, ftp_proxy);
+                                if (theCurlCode != CURLE_OK) {
+                                        theResult = SetResultFromCurlErrorCode(interp, theCurlCode);
+                                        break;
+                                }
+                        }
+                }
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">                 /* -L option */
</span><span class="lines">@@ -328,6 +366,21 @@
</span><span class="cx">                         break;
</span><span class="cx">                 }
</span><span class="cx"> 
</span><ins>+                /* we want/don't want a custom progress function */
+                if (noprogress == 0 &amp;&amp; strcmp(progressCallback.proc, &quot;builtin&quot;) != 0) {
+                        theCurlCode = curl_easy_setopt(theHandle, CURLOPT_PROGRESSDATA, &amp;progressCallback);
+                        if (theCurlCode != CURLE_OK) {
+                                theResult = SetResultFromCurlErrorCode(interp, theCurlCode);
+                                break;
+                        }
+
+                        theCurlCode = curl_easy_setopt(theHandle, CURLOPT_PROGRESSFUNCTION, CurlProgressHandler);
+                        if (theCurlCode != CURLE_OK) {
+                                theResult = SetResultFromCurlErrorCode(interp, theCurlCode);
+                                break;
+                        }
+                }
+
</ins><span class="cx">                 /* we want/don't want to use epsv */
</span><span class="cx">                 theCurlCode = curl_easy_setopt(theHandle, CURLOPT_FTP_USE_EPSV, useepsv);
</span><span class="cx">                 if (theCurlCode != CURLE_OK) {
</span><span class="lines">@@ -386,8 +439,13 @@
</span><span class="cx">                         break;
</span><span class="cx">                 }
</span><span class="cx"> 
</span><ins>+                /* signal cleanup to the progress callback */
+                if (noprogress == 0 &amp;&amp; strcmp(progressCallback.proc, &quot;builtin&quot;) != 0) {
+                        CurlProgressCleanup(&amp;progressCallback);
+                }
+
</ins><span class="cx">                 /* close the file */
</span><del>-                (void) fclose( theFile );
</del><ins>+                (void) fclose(theFile);
</ins><span class="cx">                 theFile = NULL;
</span><span class="cx"> 
</span><span class="cx"> #if LIBCURL_VERSION_NUM == 0x070d01 /* work around broken Tiger version of cURL */
</span><span class="lines">@@ -404,21 +462,21 @@
</span><span class="cx">                                 theResult = TCL_ERROR;
</span><span class="cx">                                 break;
</span><span class="cx">                         }
</span><del>-                        theFile = fopen( theFilePath, &quot;r&quot;);
</del><ins>+                        theFile = fopen(theFilePath, &quot;r&quot;);
</ins><span class="cx">                         if (theFile == NULL) {
</span><span class="cx">                                 Tcl_SetResult(interp, strerror(errno), TCL_VOLATILE);
</span><span class="cx">                                 theResult = TCL_ERROR;
</span><span class="cx">                                 break;
</span><span class="cx">                         }
</span><del>-                        if ( (p = fgets(buf, BUFSIZ, theFile)) != NULL) {
</del><ins>+                        if ((p = fgets(buf, BUFSIZ, theFile)) != NULL) {
</ins><span class="cx">                                 /* skip stray header escaping into output */
</span><span class="cx">                                 if (strncmp(p, &quot;Last-Modified:&quot;, 14) != 0)
</span><span class="cx">                                         rewind(theFile);
</span><span class="cx">                         }
</span><del>-                        while ( (size = fread(buf, 1, BUFSIZ, theFile)) &gt; 0) {
</del><ins>+                        while ((size = fread(buf, 1, BUFSIZ, theFile)) &gt; 0) {
</ins><span class="cx">                                 fwrite(buf, 1, size, fp);
</span><span class="cx">                         }
</span><del>-                        (void) fclose( theFile );
</del><ins>+                        (void) fclose(theFile);
</ins><span class="cx">                         theFile = NULL;
</span><span class="cx">                         fclose(fp);
</span><span class="cx">                         if (rename(tmp, theFilePath) != 0) {
</span><span class="lines">@@ -449,10 +507,6 @@
</span><span class="cx">                                 (effectiveURL == NULL || theCurlCode != CURLE_OK) ? &quot;&quot; : effectiveURL,
</span><span class="cx">                                 0);
</span><span class="cx">                 }
</span><del>-
-                /* clean up */
-                curl_easy_cleanup( theHandle );
-                theHandle = NULL;
</del><span class="cx">         } while (0);
</span><span class="cx"> 
</span><span class="cx">         if (performFailed) {
</span><span class="lines">@@ -460,11 +514,12 @@
</span><span class="cx">                 theResult = TCL_ERROR;
</span><span class="cx">         }
</span><span class="cx"> 
</span><ins>+        /* reset the connection */
</ins><span class="cx">         if (theHandle != NULL) {
</span><del>-                curl_easy_cleanup( theHandle );
</del><ins>+                curl_easy_reset(theHandle);
</ins><span class="cx">         }
</span><span class="cx">         if (theFile != NULL) {
</span><del>-                fclose( theFile );
</del><ins>+                fclose(theFile);
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         return theResult;
</span><span class="lines">@@ -510,7 +565,7 @@
</span><span class="cx">                         }
</span><span class="cx"> 
</span><span class="cx">                         optioncrsr++;
</span><del>-                }
</del><ins>+                }
</ins><span class="cx"> 
</span><span class="cx">                 if (optioncrsr &lt;= lastoption) {
</span><span class="cx">                         /* something went wrong */
</span><span class="lines">@@ -534,7 +589,7 @@
</span><span class="cx">                 }
</span><span class="cx"> 
</span><span class="cx">                 /* Open the file (dev/null) */
</span><del>-                theFile = fopen( &quot;/dev/null&quot;, &quot;a&quot; );
</del><ins>+                theFile = fopen(&quot;/dev/null&quot;, &quot;a&quot;);
</ins><span class="cx">                 if (theFile == NULL) {
</span><span class="cx">                         Tcl_SetResult(interp, strerror(errno), TCL_VOLATILE);
</span><span class="cx">                         theResult = TCL_ERROR;
</span><span class="lines">@@ -542,7 +597,12 @@
</span><span class="cx">                 }
</span><span class="cx"> 
</span><span class="cx">                 /* Create the CURL handle */
</span><del>-                theHandle = curl_easy_init();
</del><ins>+                if (theHandle == NULL) {
+                        /* Re-use existing handle if theHandle isn't NULL */
+                        theHandle = curl_easy_init();
+                }
+                /* If we're re-using a handle, the previous call did ensure to reset it
+                 * to the default state using curl_easy_reset(3) */
</ins><span class="cx"> 
</span><span class="cx">                 /* Setup the handle */
</span><span class="cx">                 theCurlCode = curl_easy_setopt(theHandle, CURLOPT_URL, theURL);
</span><span class="lines">@@ -655,7 +715,7 @@
</span><span class="cx">                 }
</span><span class="cx"> 
</span><span class="cx">                 /* close the file */
</span><del>-                (void) fclose( theFile );
</del><ins>+                (void) fclose(theFile);
</ins><span class="cx">                 theFile = NULL;
</span><span class="cx"> 
</span><span class="cx">                 /* check everything went fine */
</span><span class="lines">@@ -675,10 +735,6 @@
</span><span class="cx">                                 break;
</span><span class="cx">                         }
</span><span class="cx"> 
</span><del>-                        /* clean up */
-                        curl_easy_cleanup( theHandle );
-                        theHandle = NULL;
-
</del><span class="cx">                         /* compare this with the date provided by user */
</span><span class="cx">                         if (theModDate &lt; -1) {
</span><span class="cx">                                 Tcl_SetResult(interp, &quot;Couldn't get resource modification date&quot;, TCL_STATIC);
</span><span class="lines">@@ -694,8 +750,9 @@
</span><span class="cx">                 }
</span><span class="cx">         } while (0);
</span><span class="cx"> 
</span><ins>+        /* reset the connection */
</ins><span class="cx">         if (theHandle != NULL) {
</span><del>-                curl_easy_cleanup(theHandle);
</del><ins>+                curl_easy_reset(theHandle);
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         if (theFile != NULL) {
</span><span class="lines">@@ -744,7 +801,7 @@
</span><span class="cx">                         }
</span><span class="cx"> 
</span><span class="cx">                         optioncrsr++;
</span><del>-                }
</del><ins>+                }
</ins><span class="cx"> 
</span><span class="cx">                 if (optioncrsr &lt;= lastoption) {
</span><span class="cx">                         /* something went wrong */
</span><span class="lines">@@ -762,7 +819,7 @@
</span><span class="cx">                 theURL = Tcl_GetString(objv[objc - 1]);
</span><span class="cx"> 
</span><span class="cx">                 /* Open the file (dev/null) */
</span><del>-                theFile = fopen( &quot;/dev/null&quot;, &quot;a&quot; );
</del><ins>+                theFile = fopen(&quot;/dev/null&quot;, &quot;a&quot;);
</ins><span class="cx">                 if (theFile == NULL) {
</span><span class="cx">                         Tcl_SetResult(interp, strerror(errno), TCL_VOLATILE);
</span><span class="cx">                         theResult = TCL_ERROR;
</span><span class="lines">@@ -770,7 +827,12 @@
</span><span class="cx">                 }
</span><span class="cx"> 
</span><span class="cx">                 /* Create the CURL handle */
</span><del>-                theHandle = curl_easy_init();
</del><ins>+                if (theHandle == NULL) {
+                        /* Re-use existing handle if theHandle isn't NULL */
+                        theHandle = curl_easy_init();
+                }
+                /* If we're re-using a handle, the previous call did ensure to reset it
+                 * to the default state using curl_easy_reset(3) */
</ins><span class="cx"> 
</span><span class="cx">                 /* Setup the handle */
</span><span class="cx">                 theCurlCode = curl_easy_setopt(theHandle, CURLOPT_URL, theURL);
</span><span class="lines">@@ -878,7 +940,7 @@
</span><span class="cx">                 }
</span><span class="cx"> 
</span><span class="cx">                 /* close the file */
</span><del>-                (void) fclose( theFile );
</del><ins>+                (void) fclose(theFile);
</ins><span class="cx">                 theFile = NULL;
</span><span class="cx"> 
</span><span class="cx">                 theFileSize = 0.0;
</span><span class="lines">@@ -890,17 +952,14 @@
</span><span class="cx">                         break;
</span><span class="cx">                 }
</span><span class="cx"> 
</span><del>-                /* clean up */
-                curl_easy_cleanup( theHandle );
-                theHandle = NULL;
-
</del><span class="cx">                 (void) snprintf(theSizeString, sizeof(theSizeString),
</span><span class="cx">                         &quot;%.0f&quot;, theFileSize);
</span><span class="cx">                 Tcl_SetResult(interp, theSizeString, TCL_VOLATILE);
</span><span class="cx">         } while (0);
</span><span class="cx"> 
</span><ins>+        /* reset the connection */
</ins><span class="cx">         if (theHandle != NULL) {
</span><del>-                curl_easy_cleanup(theHandle);
</del><ins>+                curl_easy_reset(theHandle);
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         if (theFile != NULL) {
</span><span class="lines">@@ -911,6 +970,251 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><ins>+ * curl post postdata url
+ *
+ * syntax: curl post [--user-agent useragentstring] [--progress &quot;builtin&quot;|callback] postdata url
+ *
+ * @param interp                current interpreter
+ * @param objc                        number of parameters
+ * @param objv                        parameters
+ */
+int
+CurlPostCmd(Tcl_Interp* interp, int objc, Tcl_Obj* CONST objv[])
+{
+        int theResult = TCL_OK;
+        CURL* theHandle = NULL;
+        FILE* theFile = NULL;
+
+        do {
+                const char* theURL;
+                const char* thePostData;
+                CURLcode theCurlCode;
+                int noprogress = 1;
+                tcl_callback_t progressCallback = {
+                        .interp = interp,
+                        .proc = NULL,
+                        .prevcalltime = 0.0
+                };
+                char* userAgent = PACKAGE_NAME &quot;/&quot; PACKAGE_VERSION &quot; libcurl/&quot; LIBCURL_VERSION;
+                int optioncrsr;
+                int lastoption;
+
+                /* we might have options and then postdata and the url */
+                /* let's process the options first */
+
+                optioncrsr = 2;
+                lastoption = objc - 3;
+                while (optioncrsr &lt;= lastoption) {
+                        /* get the option */
+                        const char* theOption = Tcl_GetString(objv[optioncrsr]);
+
+                        if (strcmp(theOption, &quot;--user-agent&quot;) == 0) {
+                                /* check we also have the parameter */
+                                if (optioncrsr &lt; lastoption) {
+                                        optioncrsr++;
+                                        userAgent = Tcl_GetString(objv[optioncrsr]);
+                                } else {
+                                        Tcl_SetResult(interp,
+                                                &quot;curl post: --user-agent option requires a parameter&quot;,
+                                                TCL_STATIC);
+                                        theResult = TCL_ERROR;
+                                        break;
+                                }
+                        } else if (strcmp(theOption, &quot;--progress&quot;) == 0) {
+                                /* check we also have the parameter */
+                                if (optioncrsr &lt; lastoption) {
+                                        optioncrsr++;
+                                        noprogress = 0;
+                                        progressCallback.proc = Tcl_GetString(objv[optioncrsr]);
+                                } else {
+                                        Tcl_SetResult(interp,
+                                                &quot;curl post: --progress option requires a parameter&quot;,
+                                                TCL_STATIC);
+                                        theResult = TCL_ERROR;
+                                        break;
+                                }
+                        } else {
+                                Tcl_ResetResult(interp);
+                                Tcl_AppendResult(interp, &quot;curl post: unknown option &quot;, theOption, NULL);
+                                theResult = TCL_ERROR;
+                                break;
+                        }
+
+                        optioncrsr++;
+                }
+
+                if (optioncrsr &lt;= lastoption) {
+                        /* something went wrong */
+                        break;
+                }
+
+                /*        first (second) parameter is -v or the url,
+                        second (third) parameter is the file */
+
+                if (objc &gt;= 4) {
+                        /* Retrieve the url - it is the last parameter */
+                        theURL = Tcl_GetString(objv[objc - 1]);
+
+                        /* Retrieve the post data - it's before the url */
+                        thePostData = Tcl_GetString(objv[objc - 2]);
+                } else {
+                        Tcl_WrongNumArgs(interp, 1, objv, &quot;post [options] postdata file&quot;);
+                        theResult = TCL_ERROR;
+                        break;
+                }
+
+                /* Open the file (dev/null) */
+                theFile = fopen(&quot;/dev/null&quot;, &quot;a&quot;);
+                if (theFile == NULL) {
+                        Tcl_SetResult(interp, strerror(errno), TCL_VOLATILE);
+                        theResult = TCL_ERROR;
+                        break;
+                }
+
+                /* Create the CURL handle */
+                if (theHandle == NULL) {
+                        /* Re-use existing handle if theHandle isn't NULL */
+                        theHandle = curl_easy_init();
+                }
+                /* If we're re-using a handle, the previous call did ensure to reset it
+                 * to the default state using curl_easy_reset(3) */
+
+                /* Setup the handle */
+                theCurlCode = curl_easy_setopt(theHandle, CURLOPT_URL, theURL);
+                if (theCurlCode != CURLE_OK) {
+                        theResult = SetResultFromCurlErrorCode(interp, theCurlCode);
+                        break;
+                }
+
+                /* Specify the POST data */
+                theCurlCode = curl_easy_setopt(theHandle, CURLOPT_POSTFIELDS, thePostData);
+                if (theCurlCode != CURLE_OK) {
+                        theResult = SetResultFromCurlErrorCode(interp, theCurlCode);
+                        break;
+                }
+
+                /* -L option */
+                theCurlCode = curl_easy_setopt(theHandle, CURLOPT_FOLLOWLOCATION, 1);
+                if (theCurlCode != CURLE_OK) {
+                        theResult = SetResultFromCurlErrorCode(interp, theCurlCode);
+                        break;
+                }
+
+                /* --max-redirs option, same default as curl command line */
+                theCurlCode = curl_easy_setopt(theHandle, CURLOPT_MAXREDIRS, 50);
+                if (theCurlCode != CURLE_OK) {
+                        theResult = SetResultFromCurlErrorCode(interp, theCurlCode);
+                        break;
+                }
+
+                /* echo any cookies received on a redirect */
+                theCurlCode = curl_easy_setopt(theHandle, CURLOPT_COOKIEJAR, &quot;/dev/null&quot;);
+                if (theCurlCode != CURLE_OK) {
+                        theResult = SetResultFromCurlErrorCode(interp, theCurlCode);
+                        break;
+                }
+
+                /* -f option */
+                theCurlCode = curl_easy_setopt(theHandle, CURLOPT_FAILONERROR, 1);
+                if (theCurlCode != CURLE_OK) {
+                        theResult = SetResultFromCurlErrorCode(interp, theCurlCode);
+                        break;
+                }
+
+                /* -A option */
+                theCurlCode = curl_easy_setopt(theHandle, CURLOPT_USERAGENT, userAgent);
+                if (theCurlCode != CURLE_OK) {
+                        theResult = SetResultFromCurlErrorCode(interp, theCurlCode);
+                        break;
+                }
+
+                /* set timeout on connections */
+                theCurlCode = curl_easy_setopt(theHandle, CURLOPT_CONNECTTIMEOUT, _CURL_CONNECTION_TIMEOUT);
+                if (theCurlCode != CURLE_OK) {
+                        theResult = SetResultFromCurlErrorCode(interp, theCurlCode);
+                        break;
+                }
+
+                /* set minimum connection speed */
+                theCurlCode = curl_easy_setopt(theHandle, CURLOPT_LOW_SPEED_LIMIT, _CURL_MINIMUM_XFER_SPEED);
+                if (theCurlCode != CURLE_OK) {
+                        theResult = SetResultFromCurlErrorCode(interp, theCurlCode);
+                        break;
+                }
+
+                /* set timeout interval for connections &lt; min xfer speed */
+                theCurlCode = curl_easy_setopt(theHandle, CURLOPT_LOW_SPEED_TIME, _CURL_MINIMUM_XFER_TIMEOUT);
+                if (theCurlCode != CURLE_OK) {
+                        theResult = SetResultFromCurlErrorCode(interp, theCurlCode);
+                        break;
+                }
+
+                /* write to the file */
+                theCurlCode = curl_easy_setopt(theHandle, CURLOPT_WRITEDATA, theFile);
+                if (theCurlCode != CURLE_OK) {
+                        theResult = SetResultFromCurlErrorCode(interp, theCurlCode);
+                        break;
+                }
+
+                /* skip the header data */
+                theCurlCode = curl_easy_setopt(theHandle, CURLOPT_HEADER, 0);
+                if (theCurlCode != CURLE_OK) {
+                        theResult = SetResultFromCurlErrorCode(interp, theCurlCode);
+                        break;
+                }
+
+                /* we want/don't want progress */
+                theCurlCode = curl_easy_setopt(theHandle, CURLOPT_NOPROGRESS, noprogress);
+                if (theCurlCode != CURLE_OK) {
+                        theResult = SetResultFromCurlErrorCode(interp, theCurlCode);
+                        break;
+                }
+
+                /* we want/don't want a custom progress function */
+                if (noprogress == 0 &amp;&amp; strcmp(progressCallback.proc, &quot;builtin&quot;) != 0) {
+                        theCurlCode = curl_easy_setopt(theHandle, CURLOPT_PROGRESSDATA, &amp;progressCallback);
+                        if (theCurlCode != CURLE_OK) {
+                                theResult = SetResultFromCurlErrorCode(interp, theCurlCode);
+                                break;
+                        }
+
+                        theCurlCode = curl_easy_setopt(theHandle, CURLOPT_PROGRESSFUNCTION, CurlProgressHandler);
+                        if (theCurlCode != CURLE_OK) {
+                                theResult = SetResultFromCurlErrorCode(interp, theCurlCode);
+                                break;
+                        }
+                }
+
+                /* actually perform the POST */
+                theCurlCode = curl_easy_perform(theHandle);
+                if (theCurlCode != CURLE_OK) {
+                        theResult = SetResultFromCurlErrorCode(interp, theCurlCode);
+                        break;
+                }
+
+                /* signal cleanup to the progress callback */
+                if (noprogress == 0 &amp;&amp; strcmp(progressCallback.proc, &quot;builtin&quot;) != 0) {
+                        CurlProgressCleanup(&amp;progressCallback);
+                }
+
+                /* close the file */
+                (void) fclose(theFile);
+                theFile = NULL;
+        } while (0);
+
+        /* reset the connection */
+        if (theHandle != NULL) {
+                curl_easy_reset(theHandle);
+        }
+
+        if (theFile != NULL) {
+                fclose(theFile);
+        }
+
+        return theResult;
+}
+
+/**
</ins><span class="cx">  * curl command entry point.
</span><span class="cx">  *
</span><span class="cx">  * @param clientData        custom data (ignored)
</span><span class="lines">@@ -928,11 +1232,12 @@
</span><span class="cx">         typedef enum {
</span><span class="cx">                 kCurlFetch,
</span><span class="cx">                 kCurlIsNewer,
</span><del>-                kCurlGetSize
</del><ins>+                kCurlGetSize,
+                kCurlPost
</ins><span class="cx">         } EOption;
</span><span class="cx"> 
</span><span class="cx">         static const char *options[] = {
</span><del>-                &quot;fetch&quot;, &quot;isnewer&quot;, &quot;getsize&quot;, NULL
</del><ins>+                &quot;fetch&quot;, &quot;isnewer&quot;, &quot;getsize&quot;, &quot;post&quot;, NULL
</ins><span class="cx">         };
</span><span class="cx">         int theResult = TCL_OK;
</span><span class="cx">         EOption theOptionIndex;
</span><span class="lines">@@ -964,6 +1269,9 @@
</span><span class="cx">                 case kCurlGetSize:
</span><span class="cx">                         theResult = CurlGetSizeCmd(interp, objc, objv);
</span><span class="cx">                         break;
</span><ins>+                case kCurlPost:
+                        theResult = CurlPostCmd(interp, objc, objv);
+                        break;
</ins><span class="cx">                 }
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="lines">@@ -979,3 +1287,141 @@
</span><span class="cx"> {
</span><span class="cx">         curl_global_init(CURL_GLOBAL_ALL);
</span><span class="cx"> }
</span><ins>+
+/* ========================================================================= **
+ * Callback function
+ * ========================================================================= */
+#pragma mark -
+#pragma mark Callback function
+static int CurlProgressHandler(
+                tcl_callback_t *callback,
+                double dltotal,
+                double dlnow,
+                double ultotal,
+                double ulnow)
+{
+        if (dltotal == 0.0 &amp;&amp; ultotal == 0.0 &amp;&amp; dlnow == 0.0 &amp;&amp; ulnow == 0.0) {
+                /*
+                 * We have no idea whether this is an up- or download. Do nothing for now.
+                 */
+                return 0;
+        }
+
+        enum {
+                UPLOAD,
+                DOWNLOAD
+        } transferType;
+
+        double total, now, speed, curtime;
+
+        if (dltotal != 0.0 || dlnow != 0.0) {
+                /* This is a download */
+                transferType = DOWNLOAD;
+                total = dltotal;
+                now = dlnow;
+        } else {
+                /* This is an upload */
+                transferType = UPLOAD;
+                total = ultotal;
+                now = ulnow;
+        }
+
+        /* Only send updates once a second */
+        curl_easy_getinfo(theHandle, CURLINFO_TOTAL_TIME, &amp;curtime);
+        if ((curtime - callback-&gt;prevcalltime) &lt; _CURL_MINIMUM_PROGRESS_INTERVAL) {
+                return 0;
+        }
+
+        if (callback-&gt;prevcalltime == 0.0) {
+                /* this is the first time we're calling the callback, call start
+                 * subcommand first */
+
+                /*
+                 * Command string, a space followed &quot;start&quot;, another space and &quot;dl&quot; or
+                 * &quot;ul&quot; plus the trailing \0.
+                 */
+                char startCommandBuffer[strlen(callback-&gt;proc) + (1 + 5) + (1 + 2) + 1];
+                int startLen = 0;
+
+                startLen = snprintf(startCommandBuffer, sizeof(startCommandBuffer), &quot;%s start %s&quot;,
+                                callback-&gt;proc, (transferType == DOWNLOAD) ? &quot;dl&quot; : &quot;ul&quot;);
+                if (startLen &lt; 0 || (size_t) startLen &gt;= sizeof(startCommandBuffer)) {
+                        /* overflow */
+                        fprintf(stderr, &quot;pextlib1.0: buffer overflow in &quot; __FILE__ &quot;:%d. Buffer is: %s\n&quot;, __LINE__, startCommandBuffer);
+                        abort();
+                }
+
+                if (TCL_ERROR == Tcl_EvalEx(callback-&gt;interp, startCommandBuffer, startLen, TCL_EVAL_GLOBAL)) {
+                        fprintf(stderr, &quot;curl progress callback failed: %s\n&quot;, Tcl_GetStringResult(callback-&gt;interp));
+                        return 1;
+                }
+        }
+
+        callback-&gt;prevcalltime = curtime;
+
+        /* Get the average speed from curl */
+        if (transferType == DOWNLOAD) {
+                curl_easy_getinfo(theHandle, CURLINFO_SPEED_DOWNLOAD, &amp;speed);
+        } else {
+                curl_easy_getinfo(theHandle, CURLINFO_SPEED_UPLOAD, &amp;speed);
+        }
+
+        /*
+         * We need the command string, a space and &quot;update&quot;, another space and &quot;dl&quot;
+         * or &quot;ul&quot;, three doubles converted to string (see comment below), plus
+         * a space character for separation per argument, so 3 * (1 + LEN_DOUBLE)
+         * plus one character for the null-byte.
+         */
+        char commandBuffer[strlen(callback-&gt;proc) + (1 + 6) + (1 + 2) + 3 * (1 + 12) + 1];
+        int len = 0;
+
+        /*
+         * Format numbers using % .6g format specifier so we can always be sure
+         * what the total length will be: .6g tells us we're using at most
+         * 6 significant digits; that means 6 characters, another one for
+         * a possible decimal point, another 4 for e+XX where 00 &lt;= XX &lt;= 99 for
+         * exponents, and another one for a possible sign (or &quot; &quot; for positive
+         * numbers). In total, the maximum length will be 12 per double formatted.
+         */
+        len = snprintf(commandBuffer, sizeof(commandBuffer), &quot;%s update %s % .6g % .6g % .6g&quot;,
+                        callback-&gt;proc, (transferType == DOWNLOAD) ? &quot;dl&quot; : &quot;ul&quot;, total, now, speed);
+        if (len &lt; 0 || (size_t) len &gt;= sizeof(commandBuffer)) {
+                /* overflow */
+                fprintf(stderr, &quot;pextlib1.0: buffer overflow in &quot; __FILE__ &quot;:%d. Buffer is: %s\n&quot;, __LINE__, commandBuffer);
+                abort();
+        }
+
+        /*
+         * Execute directly rather than compiling to bytecode first - the script is
+         * likely to change in the next call anyway.
+         */
+        if (TCL_ERROR == Tcl_EvalEx(callback-&gt;interp, commandBuffer, len, TCL_EVAL_GLOBAL)) {
+                fprintf(stderr, &quot;curl progress callback failed: %s\n&quot;, Tcl_GetStringResult(callback-&gt;interp));
+                return 1;
+        }
+
+        return 0;
+}
+
+static void CurlProgressCleanup(
+                tcl_callback_t *callback)
+{
+        /*
+         * Transfer complete, signal the progress callback
+         */
+
+        /*
+         * Command string, a space followed &quot;finish&quot; plus the trailing \0.
+         */
+        char commandBuffer[strlen(callback-&gt;proc) + (1 + 6) + 1];
+        int len = 0;
+
+        len = snprintf(commandBuffer, sizeof(commandBuffer), &quot;%s finish&quot;, callback-&gt;proc);
+        if (len &lt; 0 || (size_t) len &gt;= sizeof(commandBuffer)) {
+                /* overflow */
+                fprintf(stderr, &quot;pextlib1.0: buffer overflow in &quot; __FILE__ &quot;:%d. Buffer is: %s\n&quot;, __LINE__, commandBuffer);
+                abort();
+        }
+
+        Tcl_EvalEx(callback-&gt;interp, commandBuffer, len, TCL_EVAL_GLOBAL);
+}
</ins></span></pre></div>
<a id="branchesnewhelpsystembasesrcpextlib10filemapc"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/src/pextlib1.0/filemap.c (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/pextlib1.0/filemap.c        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/src/pextlib1.0/filemap.c        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -312,7 +312,7 @@
</span><span class="cx">  *
</span><span class="cx">  * @param ioDatabaseBuffer        pointer to the buffer (where the node starts),
</span><span class="cx">  *                                                        updated by this function.
</span><del>- * @param outTree                        on output, a tree in memory.
</del><ins>+ * @param outNode                        on output, a tree in memory.
</ins><span class="cx">  * @param ioBytesLeft                number of bytes remaining in the buffer (updated
</span><span class="cx">  *                                                        by this function).
</span><span class="cx">  */
</span><span class="lines">@@ -467,8 +467,8 @@
</span><span class="cx">  * Save the database to the file.
</span><span class="cx">  * This function saves the header and then calls SaveNode.
</span><span class="cx">  *
</span><del>- * @param inDatabaseFd        file descriptor of the open file (the cursor is reset)
- * @param inTree                tree of the database.
</del><ins>+ * @param inDatabasePath        file descriptor of the open file (the cursor is reset)
+ * @param inTree                        tree of the database.
</ins><span class="cx">  */
</span><span class="cx"> int
</span><span class="cx"> Save(
</span><span class="lines">@@ -930,7 +930,6 @@
</span><span class="cx">  * @param outList                the list to populate with paths.
</span><span class="cx">  * @param inSubpath                the path of the current root.
</span><span class="cx">  * @param inSubpathLen        the length, without the terminator, of the path.
</span><del>- * @return the list of paths which has value for their value.
</del><span class="cx">  */
</span><span class="cx"> void
</span><span class="cx"> ListSubtree(
</span></span></pre></div>
<a id="branchesnewhelpsystembasesrcpextlib10sha2c"></a>
<div class="propset"><h4>Property changes: branches/new-help-system/base/src/pextlib1.0/sha2.c</h4>
<pre class="diff"><span>
</span></pre></div>
<a id="svnmergeinfo"></a>
<div class="modfile"><h4>Modified: svn:mergeinfo</h4></div>
<span class="cx">/branches/gsoc11-rev-upgrade/base/src/pextlib1.0/sha2.c:78828-88375
</span><span class="cx">/branches/universal-sanity/base/src/pextlib1.0/sha2.c:51872-52323
</span><span class="cx">/branches/variant-descs-14482/base/src/pextlib1.0/sha2.c:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
</span><span class="cx">/trunk/base/src/pextlib1.0/sha2.c:57888-90355
</span><span class="cx">/users/perry/base-bugs_and_notes/src/pextlib1.0/sha2.c:45682-46060
</span><span class="cx">/users/perry/base-select/src/pextlib1.0/sha2.c:44044-44692
</span><span class="cx">   + /branches/gsoc08-privileges/base/src/pextlib1.0/sha2.c:37343-46937
</span><span class="cx">/branches/gsoc11-rev-upgrade/base/src/pextlib1.0/sha2.c:78828-88375
</span><span class="cx">/branches/gsoc13-tests/src/pextlib1.0/sha2.c:106692-111324
</span><span class="cx">/branches/universal-sanity/base/src/pextlib1.0/sha2.c:51872-52323
</span><span class="cx">/branches/variant-descs-14482/base/src/pextlib1.0/sha2.c:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
</span><span class="cx">/trunk/base/src/pextlib1.0/sha2.c:57888-117083
</span><span class="cx">/users/perry/base-bugs_and_notes/src/pextlib1.0/sha2.c:45682-46060
</span><span class="cx">/users/perry/base-select/src/pextlib1.0/sha2.c:44044-44692
</span><a id="branchesnewhelpsystembasesrcpextlib10sha2h"></a>
<div class="propset"><h4>Property changes: branches/new-help-system/base/src/pextlib1.0/sha2.h</h4>
<pre class="diff"><span>
</span></pre></div>
<a id="svnmergeinfo"></a>
<div class="modfile"><h4>Modified: svn:mergeinfo</h4></div>
<span class="cx">/branches/gsoc11-rev-upgrade/base/src/pextlib1.0/sha2.h:78828-88375
</span><span class="cx">/branches/universal-sanity/base/src/pextlib1.0/sha2.h:51872-52323
</span><span class="cx">/branches/variant-descs-14482/base/src/pextlib1.0/sha2.h:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
</span><span class="cx">/trunk/base/src/pextlib1.0/sha2.h:57888-90355
</span><span class="cx">/users/perry/base-bugs_and_notes/src/pextlib1.0/sha2.h:45682-46060
</span><span class="cx">/users/perry/base-select/src/pextlib1.0/sha2.h:44044-44692
</span><span class="cx">   + /branches/gsoc08-privileges/base/src/pextlib1.0/sha2.h:37343-46937
</span><span class="cx">/branches/gsoc11-rev-upgrade/base/src/pextlib1.0/sha2.h:78828-88375
</span><span class="cx">/branches/gsoc13-tests/src/pextlib1.0/sha2.h:106692-111324
</span><span class="cx">/branches/universal-sanity/base/src/pextlib1.0/sha2.h:51872-52323
</span><span class="cx">/branches/variant-descs-14482/base/src/pextlib1.0/sha2.h:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
</span><span class="cx">/trunk/base/src/pextlib1.0/sha2.h:57888-117083
</span><span class="cx">/users/perry/base-bugs_and_notes/src/pextlib1.0/sha2.h:45682-46060
</span><span class="cx">/users/perry/base-select/src/pextlib1.0/sha2.h:44044-44692
</span><a id="branchesnewhelpsystembasesrcpextlib10sha256cmdc"></a>
<div class="propset"><h4>Property changes: branches/new-help-system/base/src/pextlib1.0/sha256cmd.c</h4>
<pre class="diff"><span>
</span></pre></div>
<a id="svnmergeinfo"></a>
<div class="modfile"><h4>Modified: svn:mergeinfo</h4></div>
<span class="cx">/branches/gsoc09-logging/base/src/pextlib1.0/sha256cmd.c:51231-60371
</span><span class="cx">/branches/gsoc11-rev-upgrade/base/src/pextlib1.0/sha256cmd.c:78828-88375
</span><span class="cx">/branches/universal-sanity/base/src/pextlib1.0/rmd160cmd.c:51872-52323
</span><span class="cx">/branches/variant-descs-14482/base/src/pextlib1.0/rmd160cmd.c:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
</span><span class="cx">/trunk/base/src/pextlib1.0/sha256cmd.c:57888-90355
</span><span class="cx">/users/perry/base-bugs_and_notes/src/pextlib1.0/rmd160cmd.c:45682-46060
</span><span class="cx">/users/perry/base-select/src/pextlib1.0/rmd160cmd.c:44044-44692
</span><span class="cx">   + /branches/gsoc08-privileges/base/src/pextlib1.0/rmd160cmd.c:37343-46937
</span><span class="cx">/branches/gsoc09-logging/base/src/pextlib1.0/sha256cmd.c:51231-60371
</span><span class="cx">/branches/gsoc11-rev-upgrade/base/src/pextlib1.0/sha256cmd.c:78828-88375
</span><span class="cx">/branches/gsoc13-tests/src/pextlib1.0/sha256cmd.c:106692-111324
</span><span class="cx">/branches/universal-sanity/base/src/pextlib1.0/rmd160cmd.c:51872-52323
</span><span class="cx">/branches/variant-descs-14482/base/src/pextlib1.0/rmd160cmd.c:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
</span><span class="cx">/trunk/base/src/pextlib1.0/sha256cmd.c:57888-117083
</span><span class="cx">/users/perry/base-bugs_and_notes/src/pextlib1.0/rmd160cmd.c:45682-46060
</span><span class="cx">/users/perry/base-select/src/pextlib1.0/rmd160cmd.c:44044-44692
</span><a id="branchesnewhelpsystembasesrcpextlib10sha256cmdh"></a>
<div class="propset"><h4>Property changes: branches/new-help-system/base/src/pextlib1.0/sha256cmd.h</h4>
<pre class="diff"><span>
</span></pre></div>
<a id="svnmergeinfo"></a>
<div class="modfile"><h4>Modified: svn:mergeinfo</h4></div>
<span class="cx">/branches/gsoc09-logging/base/src/pextlib1.0/sha256cmd.h:51231-60371
</span><span class="cx">/branches/gsoc11-rev-upgrade/base/src/pextlib1.0/sha256cmd.h:78828-88375
</span><span class="cx">/branches/universal-sanity/base/src/pextlib1.0/rmd160cmd.h:51872-52323
</span><span class="cx">/branches/variant-descs-14482/base/src/pextlib1.0/rmd160cmd.h:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
</span><span class="cx">/trunk/base/src/pextlib1.0/sha256cmd.h:57888-90355
</span><span class="cx">/users/perry/base-bugs_and_notes/src/pextlib1.0/rmd160cmd.h:45682-46060
</span><span class="cx">/users/perry/base-select/src/pextlib1.0/rmd160cmd.h:44044-44692
</span><span class="cx">   + /branches/gsoc08-privileges/base/src/pextlib1.0/rmd160cmd.h:37343-46937
</span><span class="cx">/branches/gsoc09-logging/base/src/pextlib1.0/sha256cmd.h:51231-60371
</span><span class="cx">/branches/gsoc11-rev-upgrade/base/src/pextlib1.0/sha256cmd.h:78828-88375
</span><span class="cx">/branches/gsoc13-tests/src/pextlib1.0/sha256cmd.h:106692-111324
</span><span class="cx">/branches/universal-sanity/base/src/pextlib1.0/rmd160cmd.h:51872-52323
</span><span class="cx">/branches/variant-descs-14482/base/src/pextlib1.0/rmd160cmd.h:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
</span><span class="cx">/trunk/base/src/pextlib1.0/sha256cmd.h:57888-117083
</span><span class="cx">/users/perry/base-bugs_and_notes/src/pextlib1.0/rmd160cmd.h:45682-46060
</span><span class="cx">/users/perry/base-select/src/pextlib1.0/rmd160cmd.h:44044-44692
</span><a id="branchesnewhelpsystembasesrcpextlib10strsedc"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/src/pextlib1.0/strsed.c (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/pextlib1.0/strsed.c        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/src/pextlib1.0/strsed.c        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -662,7 +662,7 @@
</span><span class="cx"> 
</span><span class="cx">             if (need &gt; 0){
</span><span class="cx">                 more_space(need);
</span><del>-                strncpy(new_str + new_pos, str, need);
</del><ins>+                memmove(new_str + new_pos, str, need);
</ins><span class="cx">                 new_pos += need;
</span><span class="cx">             }
</span><span class="cx"> 
</span><span class="lines">@@ -756,7 +756,7 @@
</span><span class="cx">      *
</span><span class="cx">      */
</span><span class="cx">     more_space(str_len);
</span><del>-    (void) strcpy(new_str + new_pos, str);
</del><ins>+    (void) memmove(new_str + new_pos, str, strlen(str) + 1);
</ins><span class="cx">     RETURN(new_str);
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="branchesnewhelpsystembasesrcpextlib10systemc"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/src/pextlib1.0/system.c (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/pextlib1.0/system.c        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/src/pextlib1.0/system.c        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -178,7 +178,7 @@
</span><span class="cx">     case -1: /* error */
</span><span class="cx">         Tcl_SetResult(interp, strerror(errno), TCL_STATIC);
</span><span class="cx">         return TCL_ERROR;
</span><del>-        break;
</del><ins>+        /*NOTREACHED*/
</ins><span class="cx">     case 0: /* child */
</span><span class="cx">         if (odup) {
</span><span class="cx">             close(fdset[0]);
</span><span class="lines">@@ -196,7 +196,7 @@
</span><span class="cx">         }
</span><span class="cx">         /* change scheduling priority if requested */
</span><span class="cx">         if (oniceval != INT_MAX) {
</span><del>-            if (setpriority(PRIO_PROCESS, getpid(), oniceval) != 0) {
</del><ins>+            if (setpriority(PRIO_PROCESS, (id_t)getpid(), oniceval) != 0) {
</ins><span class="cx">                 /* ignore failure, just continue */
</span><span class="cx">             }
</span><span class="cx">         }
</span><span class="lines">@@ -233,7 +233,7 @@
</span><span class="cx">             execve(&quot;/bin/sh&quot;, args, environ);
</span><span class="cx">         }
</span><span class="cx">         _exit(1);
</span><del>-        break;
</del><ins>+        /*NOTREACHED*/
</ins><span class="cx">     default: /* parent */
</span><span class="cx">         break;
</span><span class="cx">     }
</span><span class="lines">@@ -249,7 +249,7 @@
</span><span class="cx">         if (pdes) {
</span><span class="cx">             while ((buf = fgetln(pdes, &amp;linelen)) != NULL) {
</span><span class="cx">                 char *sbuf;
</span><del>-                int slen;
</del><ins>+                size_t slen;
</ins><span class="cx"> 
</span><span class="cx">                 /*
</span><span class="cx">                 * Allocate enough space to insert a terminating
</span></span></pre></div>
<a id="branchesnewhelpsystembasesrcpextlib10testsfilemaptcl"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/src/pextlib1.0/tests/filemap.tcl (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/pextlib1.0/tests/filemap.tcl        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/src/pextlib1.0/tests/filemap.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -18,8 +18,8 @@
</span><span class="cx">                 puts {![filemap exists testmap &quot;/foo/bar&quot;]}
</span><span class="cx">                 exit 1
</span><span class="cx">         }
</span><del>-        if {[filemap get testmap &quot;/foo/bar&quot;] != &quot;foobar&quot;} {
-                puts {[filemap get testmap &quot;/foo/bar&quot;] != &quot;foobar&quot;}
</del><ins>+        if {[filemap get testmap &quot;/foo/bar&quot;] ne &quot;foobar&quot;} {
+                puts {[filemap get testmap &quot;/foo/bar&quot;] ne &quot;foobar&quot;}
</ins><span class="cx">                 exit 1
</span><span class="cx">         }
</span><span class="cx">         filemap unset testmap &quot;/foo/bar&quot;
</span><span class="lines">@@ -116,8 +116,8 @@
</span><span class="cx">                 puts [filemap get testmap2 &quot;/foobar&quot;]
</span><span class="cx">                 exit 1
</span><span class="cx">         }
</span><del>-        if {[filemap get testmap2 &quot;/bar/bar-3&quot;] != &quot;somevalue&quot;} {
-                puts {[filemap get testmap2 &quot;/bar/bar-3&quot;] != &quot;somevalue&quot;}
</del><ins>+        if {[filemap get testmap2 &quot;/bar/bar-3&quot;] ne &quot;somevalue&quot;} {
+                puts {[filemap get testmap2 &quot;/bar/bar-3&quot;] ne &quot;somevalue&quot;}
</ins><span class="cx">                 puts [filemap get testmap2 &quot;/bar/bar-3&quot;]
</span><span class="cx">                 exit 1
</span><span class="cx">         }
</span></span></pre></div>
<a id="branchesnewhelpsystembasesrcpextlib10testsfstraversetcl"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/src/pextlib1.0/tests/fs-traverse.tcl (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/pextlib1.0/tests/fs-traverse.tcl        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/src/pextlib1.0/tests/fs-traverse.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -85,7 +85,7 @@
</span><span class="cx">         # Test skipping parts of the tree
</span><span class="cx">         set output [list]
</span><span class="cx">         fs-traverse file $root {
</span><del>-            if {[string match */a $file]} {
</del><ins>+            if {[string match &quot;*/a&quot; $file]} {
</ins><span class="cx">                 continue
</span><span class="cx">             }
</span><span class="cx">             lappend output $file
</span><span class="lines">@@ -161,7 +161,7 @@
</span><span class="cx">         # Test to make sure deleting files during traversal works as expected
</span><span class="cx">         set output [list]
</span><span class="cx">         fs-traverse file $root {
</span><del>-            if {[string match */a $file]} {
</del><ins>+            if {[string match &quot;*/a&quot; $file]} {
</ins><span class="cx">                 # use /bin/rm because on 10.3 file delete doesn't work on directories properly
</span><span class="cx">                 exec /bin/rm -rf $file
</span><span class="cx">                 continue
</span></span></pre></div>
<a id="branchesnewhelpsystembasesrcpextlib10tracelibc"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/src/pextlib1.0/tracelib.c (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/pextlib1.0/tracelib.c        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/src/pextlib1.0/tracelib.c        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -63,7 +63,7 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;strlcat.h&quot;
</span><span class="cx"> 
</span><del>-#ifdef __APPLE__
</del><ins>+#ifdef HAVE_TRACEMODE_SUPPORT
</ins><span class="cx"> #ifndef HAVE_STRLCPY
</span><span class="cx"> /* Define strlcpy if it's not available. */
</span><span class="cx"> size_t strlcpy(char *dst, const char *src, size_t size);
</span><span class="lines">@@ -99,14 +99,14 @@
</span><span class="cx"> static void send_file_map(int sock);
</span><span class="cx"> static void dep_check(int sock, char *path);
</span><span class="cx"> static void sandbox_violation(int sock, const char *path);
</span><del>-static void ui_warn(const char *format, ...);
</del><ins>+static void ui_warn(const char *format, ...) __printflike(1, 2);
</ins><span class="cx"> #if 0
</span><del>-static void ui_info(const char *format, ...);
</del><ins>+static void ui_info(const char *format, ...) __printflike(1, 2);
</ins><span class="cx"> #endif
</span><del>-static void ui_error(const char *format, ...);
</del><ins>+static void ui_error(const char *format, ...) __printflike(1, 2);
</ins><span class="cx"> 
</span><span class="cx"> #define MAX_SOCKETS (1024)
</span><del>-#define BUFSIZE     (1024)
</del><ins>+#define BUFSIZE     (4096)
</ins><span class="cx"> 
</span><span class="cx"> /**
</span><span class="cx">  * send a buffer \c buf with the given length \c size to the socket \c sock, by
</span><span class="lines">@@ -140,9 +140,9 @@
</span><span class="cx">  * Different sockets should be used for different ports (and maybe even
</span><span class="cx">  * phases).
</span><span class="cx">  *
</span><del>- * \param[inout] interp the Tcl interpreter
</del><ins>+ * \param[in,out] interp the Tcl interpreter
</ins><span class="cx">  * \param[in] objc the number of parameters
</span><del>- * \param[in] the parameters
</del><ins>+ * \param[in] objv the parameters
</ins><span class="cx">  * \return a Tcl return code
</span><span class="cx">  */
</span><span class="cx"> static int TracelibSetNameCmd(Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
</span><span class="lines">@@ -157,6 +157,9 @@
</span><span class="cx">         return TCL_ERROR;
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    // initialize the depends field, in case we don't actually have any dependencies
+    depends = NULL;
+
</ins><span class="cx">     return TCL_OK;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -169,9 +172,9 @@
</span><span class="cx">  * In variable;
</span><span class="cx">  *  /dev/null\0/dev/tty\0/tmp:\0\0
</span><span class="cx">  *
</span><del>- * \param[inout] interp the Tcl interpreter
</del><ins>+ * \param[in,out] interp the Tcl interpreter
</ins><span class="cx">  * \param[in] objc the number of parameters
</span><del>- * \param[in] the parameters
</del><ins>+ * \param[in] objv the parameters
</ins><span class="cx">  * \return a Tcl return code
</span><span class="cx">  */
</span><span class="cx"> static int TracelibSetSandboxCmd(Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
</span><span class="lines">@@ -309,7 +312,7 @@
</span><span class="cx">     if (!filemap) {
</span><span class="cx">         char *t, * _;
</span><span class="cx"> 
</span><del>-        size_t remaining = 1024;
</del><ins>+        size_t remaining = BUFSIZE;
</ins><span class="cx">         filemap = (char *)malloc(remaining);
</span><span class="cx">         if (!filemap) {
</span><span class="cx">             ui_warn(&quot;send_file_map: memory allocation failed&quot;);
</span><span class="lines">@@ -318,10 +321,12 @@
</span><span class="cx">         t = filemap;
</span><span class="cx"> 
</span><span class="cx"> #       define append_allow(path, resolution) do { strlcpy(t, path, remaining); \
</span><del>-            if (remaining &lt; (strlen(t)+3)) \
</del><ins>+            if (remaining &lt; (strlen(t)+3)) { \
</ins><span class="cx">                 remaining=0; \
</span><del>-            else \
</del><ins>+                fprintf(stderr, &quot;tracelib: insufficient filemap memory\n&quot;); \
+            } else { \
</ins><span class="cx">                 remaining-=strlen(t)+3; \
</span><ins>+            } \
</ins><span class="cx">             t+=strlen(t)+1; \
</span><span class="cx">             *t++=resolution; \
</span><span class="cx">             *t++=0; \
</span><span class="lines">@@ -406,7 +411,7 @@
</span><span class="cx">     reg_error error;
</span><span class="cx"> 
</span><span class="cx">     if (NULL == (reg = registry_for(interp, reg_attached))) {
</span><del>-        ui_error(Tcl_GetStringResult(interp));
</del><ins>+        ui_error(&quot;%s&quot;, Tcl_GetStringResult(interp));
</ins><span class="cx">         /* send unexpected output to make the build fail */
</span><span class="cx">         answer(sock, &quot;#&quot;);
</span><span class="cx">     }
</span><span class="lines">@@ -424,12 +429,12 @@
</span><span class="cx">     /* find the port's name to compare with out list */
</span><span class="cx">     if (!reg_entry_propget(&amp;entry, &quot;name&quot;, &amp;port, &amp;error)) {
</span><span class="cx">         /* send unexpected output to make the build fail */
</span><del>-        ui_error(error.description);
</del><ins>+        ui_error(&quot;%s&quot;, error.description);
</ins><span class="cx">         answer(sock, &quot;#&quot;);
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     /* check our list of dependencies */
</span><del>-    for (t = depends; *t; t += strlen(t) + 1) {
</del><ins>+    for (t = depends; t &amp;&amp; *t; t += strlen(t) + 1) {
</ins><span class="cx">         if (strcmp(t, port) == 0) {
</span><span class="cx">             free(port);
</span><span class="cx">             answer(sock, &quot;+&quot;);
</span><span class="lines">@@ -441,6 +446,7 @@
</span><span class="cx">     answer(sock, &quot;!&quot;);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+__printflike(2, 0)
</ins><span class="cx"> static void ui_msg(const char *severity, const char *format, va_list va) {
</span><span class="cx">     char buf[1024], tclcmd[32];
</span><span class="cx"> 
</span><span class="lines">@@ -456,6 +462,7 @@
</span><span class="cx"> 
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+__printflike(1, 2)
</ins><span class="cx"> static void ui_warn(const char *format, ...) {
</span><span class="cx">     va_list va;
</span><span class="cx"> 
</span><span class="lines">@@ -465,6 +472,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if 0
</span><ins>+__printflike(1, 2)
</ins><span class="cx"> static void ui_info(const char *format, ...) {
</span><span class="cx">     va_list va;
</span><span class="cx"> 
</span><span class="lines">@@ -474,6 +482,7 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+__printflike(1, 2)
</ins><span class="cx"> static void ui_error(const char *format, ...) {
</span><span class="cx">     va_list va;
</span><span class="cx">     va_start(va, format);
</span><span class="lines">@@ -504,7 +513,7 @@
</span><span class="cx">     if (getrlimit(RLIMIT_NOFILE, &amp;rl) == -1) {
</span><span class="cx">         ui_warn(&quot;getrlimit failed (%d), skipping setrlimit&quot;, errno);
</span><span class="cx">     } else {
</span><del>-#if defined(__APPLE__) &amp;&amp; defined(OPEN_MAX)
</del><ins>+#ifdef OPEN_MAX
</ins><span class="cx">         if (rl.rlim_max &gt; OPEN_MAX) {
</span><span class="cx">             rl.rlim_max = OPEN_MAX;
</span><span class="cx">         }
</span><span class="lines">@@ -539,13 +548,10 @@
</span><span class="cx">     return TCL_OK;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-#if HAVE_KQUEUE
</del><span class="cx"> /* create this on heap rather than stack, due to its rather large size */
</span><span class="cx"> static struct kevent res_kevents[MAX_SOCKETS];
</span><del>-#endif
</del><span class="cx"> 
</span><span class="cx"> static int TracelibRunCmd(Tcl_Interp *in) {
</span><del>-#if HAVE_KQUEUE
</del><span class="cx">     struct kevent kev;
</span><span class="cx">     int flags;
</span><span class="cx">     int oldsock;
</span><span class="lines">@@ -759,10 +765,6 @@
</span><span class="cx">     pthread_mutex_unlock(&amp;sock_mutex);
</span><span class="cx"> 
</span><span class="cx">     return TCL_OK;
</span><del>-#else
-    Tcl_SetResult(in, &quot;tracelib not supported on this platform&quot;, TCL_STATIC);
-    return TCL_ERROR;
-#endif
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static int TracelibCleanCmd(Tcl_Interp *interp UNUSED) {
</span><span class="lines">@@ -770,7 +772,6 @@
</span><span class="cx">     cleanuping = 1;
</span><span class="cx">     pthread_mutex_lock(&amp;sock_mutex);
</span><span class="cx">     if (sock != -1) {
</span><del>-        /* shutdown(sock, SHUT_RDWR);*/
</del><span class="cx">         close(sock);
</span><span class="cx">         sock = -1;
</span><span class="cx">     }
</span><span class="lines">@@ -794,9 +795,7 @@
</span><span class="cx">     cleanuping = 1;
</span><span class="cx">     pthread_mutex_lock(&amp;sock_mutex);
</span><span class="cx">     if (sock != -1) {
</span><del>-        int oldsock = sock;
-        /*shutdown(sock, SHUT_RDWR);*/
-        close(oldsock);
</del><ins>+        close(sock);
</ins><span class="cx">         sock = -1;
</span><span class="cx"> 
</span><span class="cx">         if (kq != -1) {
</span><span class="lines">@@ -811,7 +810,7 @@
</span><span class="cx">     return TCL_OK;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static int TracelibSetDeps(Tcl_Interp *interp UNUSED, int objc, Tcl_Obj *CONST objv[]) {
</del><ins>+static int TracelibSetDeps(Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
</ins><span class="cx">     char *t, * d;
</span><span class="cx">     size_t l;
</span><span class="cx">     if (objc != 3) {
</span><span class="lines">@@ -844,7 +843,7 @@
</span><span class="cx">     filemap = 0;
</span><span class="cx">     return TCL_OK;
</span><span class="cx"> }
</span><del>-#endif /* __APPLE__ */
</del><ins>+#endif /* defined(HAVE_TRACEMODE_SUPPORT) */
</ins><span class="cx"> 
</span><span class="cx"> int TracelibCmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
</span><span class="cx">     int result = TCL_OK;
</span><span class="lines">@@ -867,7 +866,7 @@
</span><span class="cx">         return TCL_ERROR;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-#ifdef __APPLE__
</del><ins>+#ifdef HAVE_TRACEMODE_SUPPORT
</ins><span class="cx">     result = Tcl_GetIndexFromObj(interp, objv[1], options, &quot;option&quot;, 0, (int *)&amp;current_option);
</span><span class="cx">     if (result == TCL_OK) {
</span><span class="cx">         switch (current_option) {
</span><span class="lines">@@ -897,10 +896,10 @@
</span><span class="cx">                 break;
</span><span class="cx">         }
</span><span class="cx">     }
</span><del>-#else /* __APPLE__ */
</del><ins>+#else /* defined(HAVE_TRACEMODE_SUPPORT) */
</ins><span class="cx">     Tcl_SetResult(interp, &quot;tracelib not supported on this platform&quot;, TCL_STATIC);
</span><span class="cx">     result = TCL_ERROR;
</span><del>-#endif /* __APPLE__ */
</del><ins>+#endif /* defined(HAVE_TRACEMODE_SUPPORT) */
</ins><span class="cx"> 
</span><span class="cx">     return result;
</span><span class="cx"> }
</span></span></pre></div>
<a id="branchesnewhelpsystembasesrcportporttcl"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/src/port/port.tcl (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/port/port.tcl        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/src/port/port.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -34,6 +34,8 @@
</span><span class="cx"> # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
</span><span class="cx"> # POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> 
</span><ins>+package require term::ansi::send
+
</ins><span class="cx"> source [file join &quot;@macports_tcl_dir@&quot; macports1.0 macports_fastload.tcl]
</span><span class="cx"> package require macports
</span><span class="cx"> package require Pextlib 1.0
</span><span class="lines">@@ -155,7 +157,7 @@
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> # Format an integer representing bytes using given units
</span><del>-proc bytesize {siz {unit {}}} {
</del><ins>+proc bytesize {siz {unit {}} {format {%.3f}}} {
</ins><span class="cx">     if {$unit == {}} {
</span><span class="cx">         if {$siz &gt; 0x40000000} {
</span><span class="cx">             set unit &quot;GiB&quot;
</span><span class="lines">@@ -169,22 +171,22 @@
</span><span class="cx">     }
</span><span class="cx">     switch -- $unit {
</span><span class="cx">         KiB {
</span><del>-            set siz [expr $siz / 1024.0]
</del><ins>+            set siz [expr {$siz / 1024.0}]
</ins><span class="cx">         }
</span><span class="cx">         kB {
</span><del>-            set siz [expr $siz / 1000.0]
</del><ins>+            set siz [expr {$siz / 1000.0}]
</ins><span class="cx">         }
</span><span class="cx">         MiB {
</span><del>-            set siz [expr $siz / 1048576.0]
</del><ins>+            set siz [expr {$siz / 1048576.0}]
</ins><span class="cx">         }
</span><span class="cx">         MB {
</span><del>-            set siz [expr $siz / 1000000.0]
</del><ins>+            set siz [expr {$siz / 1000000.0}]
</ins><span class="cx">         }
</span><span class="cx">         GiB {
</span><del>-            set siz [expr $siz / 1073741824.0]
</del><ins>+            set siz [expr {$siz / 1073741824.0}]
</ins><span class="cx">         }
</span><span class="cx">         GB {
</span><del>-            set siz [expr $siz / 1000000000.0]
</del><ins>+            set siz [expr {$siz / 1000000000.0}]
</ins><span class="cx">         }
</span><span class="cx">         B { }
</span><span class="cx">         default {
</span><span class="lines">@@ -192,8 +194,8 @@
</span><span class="cx">             set unit &quot;B&quot;
</span><span class="cx">         }
</span><span class="cx">     }
</span><del>-    if {[expr round($siz)] != $siz} {
-        set siz [format {%.3f} $siz]
</del><ins>+    if {[expr {round($siz)}] != $siz} {
+        set siz [format $format $siz]
</ins><span class="cx">     }
</span><span class="cx">     return &quot;$siz $unit&quot;
</span><span class="cx"> }
</span><span class="lines">@@ -250,16 +252,16 @@
</span><span class="cx">     set pos {}
</span><span class="cx">     set neg {}
</span><span class="cx">     foreach { key val } $variations {
</span><del>-        if {$val == &quot;+&quot;} {
</del><ins>+        if {$val eq &quot;+&quot;} {
</ins><span class="cx">             lappend pos $key
</span><del>-        } elseif {$val == &quot;-&quot;} {
</del><ins>+        } elseif {$val eq &quot;-&quot;} {
</ins><span class="cx">             lappend neg $key
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     # If there is no version, we have nothing to do
</span><span class="cx">     set composite_version &quot;&quot;
</span><del>-    if {$version != &quot;&quot; || $emptyVersionOkay} {
</del><ins>+    if {$version ne &quot;&quot; || $emptyVersionOkay} {
</ins><span class="cx">         set pos_str &quot;&quot;
</span><span class="cx">         set neg_str &quot;&quot;
</span><span class="cx"> 
</span><span class="lines">@@ -314,7 +316,7 @@
</span><span class="cx">     set ilist [registry::installed $portname $portversion]
</span><span class="cx">     if { [llength $ilist] &gt; 1 } {
</span><span class="cx">         # set portname again since the one we were passed may not have had the correct case
</span><del>-        set portname [lindex [lindex $ilist 0] 0]
</del><ins>+        set portname [lindex $ilist 0 0]
</ins><span class="cx">         ui_notice &quot;The following versions of $portname are currently installed:&quot;
</span><span class="cx">         foreach i [portlist_sortint $ilist] { 
</span><span class="cx">             set iname [lindex $i 0]
</span><span class="lines">@@ -356,12 +358,12 @@
</span><span class="cx">     if {![info exists port(options)]}   { set port(options) [array get global_options] }
</span><span class="cx"> 
</span><span class="cx">     # If neither portname nor url is specified, then default to the current port
</span><del>-    if { $port(url) == &quot;&quot; &amp;&amp; $port(name) == &quot;&quot; } {
</del><ins>+    if { $port(url) eq &quot;&quot; &amp;&amp; $port(name) eq &quot;&quot; } {
</ins><span class="cx">         set url file://.
</span><span class="cx">         set portname [url_to_portname $url]
</span><span class="cx">         set port(url) $url
</span><span class="cx">         set port(name) $portname
</span><del>-        if {$portname == &quot;&quot;} {
</del><ins>+        if {$portname eq &quot;&quot;} {
</ins><span class="cx">             ui_error &quot;A default port name could not be supplied.&quot;
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="lines">@@ -423,7 +425,7 @@
</span><span class="cx">     global private_options
</span><span class="cx">     upvar $nameportlist portlist
</span><span class="cx"> 
</span><del>-    if {[llength $portlist] == 0 &amp;&amp; (![info exists private_options(ports_no_args)] || $private_options(ports_no_args) == &quot;no&quot;)} {
</del><ins>+    if {[llength $portlist] == 0 &amp;&amp; (![info exists private_options(ports_no_args)] || $private_options(ports_no_args) eq &quot;no&quot;)} {
</ins><span class="cx">         if {${is_upgrade} == &quot;yes&quot;} {
</span><span class="cx">             # $&gt; port upgrade outdated
</span><span class="cx">             # Error: No ports matched the given expression
</span><span class="lines">@@ -642,7 +644,7 @@
</span><span class="cx">     set string [split $line &quot; &quot;]
</span><span class="cx">     if {$indentfirstline == 0} {
</span><span class="cx">         set newline &quot;&quot;
</span><del>-        set maxlen [expr $maxlen - [string length $indent]]
</del><ins>+        set maxlen [expr {$maxlen - [string length $indent]}]
</ins><span class="cx">     } else {
</span><span class="cx">         set newline $indent
</span><span class="cx">     }
</span><span class="lines">@@ -657,7 +659,7 @@
</span><span class="cx">             # If indentfirstline is set to 0, reset maxlen to its
</span><span class="cx">             # original length after appending the first line to lines.
</span><span class="cx">             if {$first == 1 &amp;&amp; $indentfirstline == 0} {
</span><del>-                set maxlen [expr $maxlen + [string length $indent]]
</del><ins>+                set maxlen [expr {$maxlen + [string length $indent]}]
</ins><span class="cx">             }
</span><span class="cx">             set first 0
</span><span class="cx">         }
</span><span class="lines">@@ -678,7 +680,7 @@
</span><span class="cx"> # @param maxlen text width (0 defaults to current terminal width)
</span><span class="cx"> # @return wrapped string
</span><span class="cx"> proc wraplabel {label string maxlen {indent &quot;&quot;}} {
</span><del>-    append label &quot;: [string repeat &quot; &quot; [expr [string length $indent] - [string length &quot;$label: &quot;]]]&quot;
</del><ins>+    append label &quot;: [string repeat &quot; &quot; [expr {[string length $indent] - [string length &quot;$label: &quot;]}]]&quot;
</ins><span class="cx">     return &quot;$label[wrap $string $maxlen $indent 0]&quot;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -761,7 +763,7 @@
</span><span class="cx"> proc get_current_port {} {
</span><span class="cx">     set url file://.
</span><span class="cx">     set portname [url_to_portname $url]
</span><del>-    if {$portname == &quot;&quot;} {
</del><ins>+    if {$portname eq &quot;&quot;} {
</ins><span class="cx">         ui_msg &quot;To use the current port, you must be in a port's directory.&quot;
</span><span class="cx">         return [list]
</span><span class="cx">     }
</span><span class="lines">@@ -775,7 +777,7 @@
</span><span class="cx"> proc get_installed_ports { {ignore_active yes} {active yes} } {
</span><span class="cx">     set ilist {}
</span><span class="cx">     if { [catch {set ilist [registry::installed]} result] } {
</span><del>-        if {$result != &quot;Registry error: No ports registered as installed.&quot;} {
</del><ins>+        if {$result ne &quot;Registry error: No ports registered as installed.&quot;} {
</ins><span class="cx">             global errorInfo
</span><span class="cx">             ui_debug &quot;$errorInfo&quot;
</span><span class="cx">             fatal &quot;port installed failed: $result&quot;
</span><span class="lines">@@ -850,7 +852,7 @@
</span><span class="cx">     # Get the list of installed ports
</span><span class="cx">     set ilist {}
</span><span class="cx">     if { [catch {set ilist [registry::installed]} result] } {
</span><del>-        if {$result != &quot;Registry error: No ports registered as installed.&quot;} {
</del><ins>+        if {$result ne &quot;Registry error: No ports registered as installed.&quot;} {
</ins><span class="cx">             global errorInfo
</span><span class="cx">             ui_debug &quot;$errorInfo&quot;
</span><span class="cx">             fatal &quot;port installed failed: $result&quot;
</span><span class="lines">@@ -904,20 +906,20 @@
</span><span class="cx">             # Compare versions, first checking epoch, then version, then revision
</span><span class="cx">             set comp_result 0
</span><span class="cx">             if {$installed_version != $latest_version} {
</span><del>-                set comp_result [expr $installed_epoch - $latest_epoch]
</del><ins>+                set comp_result [expr {$installed_epoch - $latest_epoch}]
</ins><span class="cx">                 if { $comp_result == 0 } {
</span><span class="cx">                     set comp_result [vercmp $installed_version $latest_version]
</span><span class="cx">                 }
</span><span class="cx">             }
</span><span class="cx">             if { $comp_result == 0 } {
</span><del>-                set comp_result [expr $installed_revision - $latest_revision]
</del><ins>+                set comp_result [expr {$installed_revision - $latest_revision}]
</ins><span class="cx">             }
</span><span class="cx">             if {$comp_result == 0} {
</span><span class="cx">                 set regref [registry::open_entry $portname $installed_version $installed_revision $installed_variants $installed_epoch]
</span><span class="cx">                 set os_platform_installed [registry::property_retrieve $regref os_platform]
</span><span class="cx">                 set os_major_installed [registry::property_retrieve $regref os_major]
</span><del>-                if {$os_platform_installed != &quot;&quot; &amp;&amp; $os_platform_installed != 0
-                    &amp;&amp; $os_major_installed != &quot;&quot; &amp;&amp; $os_major_installed != 0
</del><ins>+                if {$os_platform_installed ne &quot;&quot; &amp;&amp; $os_platform_installed != 0
+                    &amp;&amp; $os_major_installed ne &quot;&quot; &amp;&amp; $os_major_installed != 0
</ins><span class="cx">                     &amp;&amp; ($os_platform_installed != ${macports::os_platform} || $os_major_installed != ${macports::os_major})} {
</span><span class="cx">                     set comp_result -1
</span><span class="cx">                 }
</span><span class="lines">@@ -959,7 +961,7 @@
</span><span class="cx"> proc get_ports_with_prop {propname propval} {
</span><span class="cx">     set ilist {}
</span><span class="cx">     if { [catch {set ilist [registry::installed]} result] } {
</span><del>-        if {$result != &quot;Registry error: No ports registered as installed.&quot;} {
</del><ins>+        if {$result ne &quot;Registry error: No ports registered as installed.&quot;} {
</ins><span class="cx">             global errorInfo
</span><span class="cx">             ui_debug &quot;$errorInfo&quot;
</span><span class="cx">             fatal &quot;port installed failed: $result&quot;
</span><span class="lines">@@ -994,7 +996,7 @@
</span><span class="cx"> proc get_leaves_ports {} {
</span><span class="cx">     set ilist {}
</span><span class="cx">     if { [catch {set ilist [registry::installed]} result] } {
</span><del>-        if {$result != &quot;Registry error: No ports registered as installed.&quot;} {
</del><ins>+        if {$result ne &quot;Registry error: No ports registered as installed.&quot;} {
</ins><span class="cx">             global errorInfo
</span><span class="cx">             ui_debug &quot;$errorInfo&quot;
</span><span class="cx">             fatal &quot;port installed failed: $result&quot;
</span><span class="lines">@@ -1004,7 +1006,7 @@
</span><span class="cx">     set results {}
</span><span class="cx">     foreach i $ilist {
</span><span class="cx">         set iname [lindex $i 0]
</span><del>-        if {[registry::list_dependents $iname] == &quot;&quot;} {
</del><ins>+        if {[registry::list_dependents $iname] eq &quot;&quot;} {
</ins><span class="cx">             add_to_portlist results [list name $iname version &quot;[lindex $i 1]_[lindex $i 2]&quot; variants [split_variants [lindex $i 3]]]
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="lines">@@ -1408,7 +1410,7 @@
</span><span class="cx">             # Break up the token, because older Tcl switch doesn't support -matchvar
</span><span class="cx">             regexp {^(\w+):(.*)} $token matchvar selector portname
</span><span class="cx"> 
</span><del>-            set recursive [string equal $selector rdependentof]
</del><ins>+            set recursive [string equal $selector &quot;rdependentof&quot;]
</ins><span class="cx">             add_multiple_ports reslist [get_dependent_ports $portname $recursive]
</span><span class="cx">             
</span><span class="cx">             set el 1
</span><span class="lines">@@ -1421,7 +1423,7 @@
</span><span class="cx">             # Break up the token, because older Tcl switch doesn't support -matchvar
</span><span class="cx">             regexp {^(\w+):(.*)} $token matchvar selector portname
</span><span class="cx"> 
</span><del>-            set recursive [string equal $selector rdepof]
</del><ins>+            set recursive [string equal $selector &quot;rdepof&quot;]
</ins><span class="cx">             add_multiple_ports reslist [get_dep_ports $portname $recursive]
</span><span class="cx">             
</span><span class="cx">             set el 1
</span><span class="lines">@@ -1446,7 +1448,7 @@
</span><span class="cx">         ^\\w+:.+            { # Handle a url by trying to open it as a port and mapping the name
</span><span class="cx">             advance
</span><span class="cx">             set name [url_to_portname $token]
</span><del>-            if {$name != &quot;&quot;} {
</del><ins>+            if {$name ne &quot;&quot;} {
</ins><span class="cx">                 parsePortSpec version requested_variants options
</span><span class="cx">                 add_to_portlist reslist [list url $token \
</span><span class="cx">                   name $name \
</span><span class="lines">@@ -1487,7 +1489,7 @@
</span><span class="cx">     parsePortSpec version variants options $remainder
</span><span class="cx">     
</span><span class="cx">     array unset overrides
</span><del>-    if {$version != &quot;&quot;} { set overrides(version) $version }
</del><ins>+    if {$version ne &quot;&quot;} { set overrides(version) $version }
</ins><span class="cx">     if {[array size variants]} {
</span><span class="cx">         # we always record the requested variants separately,
</span><span class="cx">         # but requested ones always override existing ones
</span><span class="lines">@@ -1645,7 +1647,7 @@
</span><span class="cx">             if {[string match &quot;*/*&quot; $portname]} {
</span><span class="cx">                 set url &quot;file://$portname&quot;
</span><span class="cx">                 set name [url_to_portname $url 1]
</span><del>-                if { $name != &quot;&quot; } {
</del><ins>+                if { $name ne &quot;&quot; } {
</ins><span class="cx">                     # We mapped the url to valid port
</span><span class="cx">                     set porturl $url
</span><span class="cx">                     set portname $name
</span><span class="lines">@@ -1696,10 +1698,10 @@
</span><span class="cx">     set opt $remainder
</span><span class="cx">     set adv 0
</span><span class="cx">     set consumed 0
</span><del>-    for {set firstTime 1} {$opt != &quot;&quot; || [moreargs]} {set firstTime 0} {
</del><ins>+    for {set firstTime 1} {$opt ne &quot;&quot; || [moreargs]} {set firstTime 0} {
</ins><span class="cx">     
</span><span class="cx">         # Refresh opt as needed
</span><del>-        if {$opt == &quot;&quot;} {
</del><ins>+        if {$opt eq &quot;&quot;} {
</ins><span class="cx">             if {$adv} advance
</span><span class="cx">             set opt [lookahead]
</span><span class="cx">             set adv 1
</span><span class="lines">@@ -1717,14 +1719,14 @@
</span><span class="cx">             set sepPos [string first &quot;/&quot; $opt]
</span><span class="cx">             if {$sepPos &gt;= 0} {
</span><span class="cx">                 # Version terminated by &quot;/&quot; to disambiguate -variant from part of version
</span><del>-                set portversion [string range $opt 0 [expr $sepPos-1]]
-                set opt [string range $opt [expr $sepPos+1] end]
</del><ins>+                set portversion [string range $opt 0 [expr {$sepPos - 1}]]
+                set opt [string range $opt [expr {$sepPos + 1}] end]
</ins><span class="cx">             } else {
</span><span class="cx">                 # Version terminated by &quot;+&quot;, or else is complete
</span><span class="cx">                 set sepPos [string first &quot;+&quot; $opt]
</span><span class="cx">                 if {$sepPos &gt;= 0} {
</span><span class="cx">                     # Version terminated by &quot;+&quot;
</span><del>-                    set portversion [string range $opt 0 [expr $sepPos-1]]
</del><ins>+                    set portversion [string range $opt 0 [expr {$sepPos - 1}]]
</ins><span class="cx">                     set opt [string range $opt $sepPos end]
</span><span class="cx">                 } else {
</span><span class="cx">                     # Unterminated version
</span><span class="lines">@@ -1745,7 +1747,7 @@
</span><span class="cx">             } elseif {[regexp {^([-+])([[:alpha:]_]+[\w\.]*)} $opt match sign variant] == 1} {
</span><span class="cx">                 # It's a variant
</span><span class="cx">                 set portvariants($variant) $sign
</span><del>-                set opt [string range $opt [expr [string length $variant]+1] end]
</del><ins>+                set opt [string range $opt [expr {[string length $variant] + 1}] end]
</ins><span class="cx">                 set consumed 1
</span><span class="cx">             } else {
</span><span class="cx">                 # Not an option we recognize, so break from port option processing
</span><span class="lines">@@ -1793,7 +1795,7 @@
</span><span class="cx"> 
</span><span class="cx">         set ret &quot;Usage: &quot;
</span><span class="cx">         set len [string length $action]
</span><del>-        append ret [wrap &quot;$action$cmds$args&quot; 0 [string repeat &quot; &quot; [expr 8 + $len]] 0]
</del><ins>+        append ret [wrap &quot;$action$cmds$args&quot; 0 [string repeat &quot; &quot; [expr {8 + $len}]] 0]
</ins><span class="cx">         append ret &quot;\n&quot;
</span><span class="cx"> 
</span><span class="cx">         return $ret
</span><span class="lines">@@ -1912,8 +1914,8 @@
</span><span class="cx">             set portdir [file split [macports::getportdir $porturl]]
</span><span class="cx">             set lsize [llength $portdir]
</span><span class="cx">             set portdir \
</span><del>-                [file join [lindex $portdir [expr $lsize - 2]] \
-                           [lindex $portdir [expr $lsize - 1]]]
</del><ins>+                [file join [lindex $portdir [expr {$lsize - 2}]] \
+                           [lindex $portdir [expr {$lsize - 1}]]]
</ins><span class="cx">             if {[catch {mportsearch $portdir no exact portdir} result]} {
</span><span class="cx">                 ui_debug &quot;$::errorInfo&quot;
</span><span class="cx">                 break_softcontinue &quot;Portdir $portdir not found&quot; 1 status
</span><span class="lines">@@ -1989,7 +1991,7 @@
</span><span class="cx">         array unset portinfo
</span><span class="cx">         # If we have a url, use that, since it's most specific
</span><span class="cx">         # otherwise try to map the portname to a url
</span><del>-        if {$porturl == &quot;&quot; || $index_only} {
</del><ins>+        if {$porturl eq &quot;&quot; || $index_only} {
</ins><span class="cx">         # Verify the portname, getting portinfo to map to a porturl
</span><span class="cx">             if {[catch {mportlookup $portname} result]} {
</span><span class="cx">                 ui_debug &quot;$::errorInfo&quot;
</span><span class="lines">@@ -2097,7 +2099,7 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         # Interpret a convenient field abbreviation
</span><del>-        if {[info exists options(ports_info_depends)] &amp;&amp; $options(ports_info_depends) == &quot;yes&quot;} {
</del><ins>+        if {[info exists options(ports_info_depends)] &amp;&amp; $options(ports_info_depends) eq &quot;yes&quot;} {
</ins><span class="cx">             array unset options ports_info_depends
</span><span class="cx">             set options(ports_info_depends_fetch) yes
</span><span class="cx">             set options(ports_info_depends_extract) yes
</span><span class="lines">@@ -2249,7 +2251,7 @@
</span><span class="cx">                 }
</span><span class="cx">             } 
</span><span class="cx">             #End of special pretty-print formatting for certain fields
</span><del>-            if [info exists list_map($ropt)] {
</del><ins>+            if {[info exists list_map($ropt)]} {
</ins><span class="cx">                 set field [join $inf $subfield_sep]
</span><span class="cx">             } else {
</span><span class="cx">                 set field $inf
</span><span class="lines">@@ -2267,10 +2269,10 @@
</span><span class="cx">             }
</span><span class="cx">             lappend fields_tried $label
</span><span class="cx">             if {$pretty_print} {
</span><del>-                if {![string length $field]} {
</del><ins>+                if {$field eq &quot;&quot;} {
</ins><span class="cx">                     continue
</span><span class="cx">                 }
</span><del>-                if {![string length $label]} {
</del><ins>+                if {$label eq &quot;&quot;} {
</ins><span class="cx">                     set wrap_len 0
</span><span class="cx">                     if {[info exists pretty_wrap($ropt)]} {
</span><span class="cx">                         set wrap_len $pretty_wrap($ropt)
</span><span class="lines">@@ -2424,7 +2426,7 @@
</span><span class="cx">     foreach filename $portlist {
</span><span class="cx">         set file [file normalize $filename]
</span><span class="cx">         if {[file exists $file] || ![catch {file type $file}]} {
</span><del>-            if {![file isdirectory $file] || [file type $file] == &quot;link&quot;} {
</del><ins>+            if {![file isdirectory $file] || [file type $file] eq &quot;link&quot;} {
</ins><span class="cx">                 set port [registry::file_registered $file]
</span><span class="cx">                 if { $port != 0 } {
</span><span class="cx">                     puts &quot;$file is provided by: $port&quot;
</span><span class="lines">@@ -2457,7 +2459,7 @@
</span><span class="cx"> 
</span><span class="cx">             set i [lindex $ilist 0]
</span><span class="cx">             set regref [registry::entry open $portname [lindex $i 1] [lindex $i 2] [lindex $i 3] [lindex $i 5]]
</span><del>-            if {[$regref installtype] == &quot;image&quot; &amp;&amp; [registry::run_target $regref activate [array get options]]} {
</del><ins>+            if {[$regref installtype] eq &quot;image&quot; &amp;&amp; [registry::run_target $regref activate [array get options]]} {
</ins><span class="cx">                 continue
</span><span class="cx">             }
</span><span class="cx">         }
</span><span class="lines">@@ -2491,9 +2493,9 @@
</span><span class="cx">             set iversion [lindex $i 1]
</span><span class="cx">             set irevision [lindex $i 2]
</span><span class="cx">             set ivariants [lindex $i 3]
</span><del>-            if {$composite_version == &quot;&quot; || $composite_version == &quot;${iversion}_${irevision}${ivariants}&quot;} {
</del><ins>+            if {$composite_version eq &quot;&quot; || $composite_version == &quot;${iversion}_${irevision}${ivariants}&quot;} {
</ins><span class="cx">                 set regref [registry::entry open $portname $iversion $irevision $ivariants [lindex $i 5]]
</span><del>-                if {[$regref installtype] == &quot;image&quot; &amp;&amp; [registry::run_target $regref deactivate [array get options]]} {
</del><ins>+                if {[$regref installtype] eq &quot;image&quot; &amp;&amp; [registry::run_target $regref deactivate [array get options]]} {
</ins><span class="cx">                     continue
</span><span class="cx">                 }
</span><span class="cx">             }
</span><span class="lines">@@ -2652,7 +2654,7 @@
</span><span class="cx">         return 1
</span><span class="cx">     }
</span><span class="cx">     # set or unset?
</span><del>-    set val [string equal $action setrequested]
</del><ins>+    set val [string equal $action &quot;setrequested&quot;]
</ins><span class="cx">     foreachport $portlist {
</span><span class="cx">         set composite_version [composite_version $portversion [array get variations]]
</span><span class="cx">         if {![catch {set ilist [registry::installed $portname $composite_version]} result]} {
</span><span class="lines">@@ -2713,7 +2715,7 @@
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> proc action_version { action portlist opts } {
</span><del>-    if ![macports::ui_isset ports_quiet] {
</del><ins>+    if {![macports::ui_isset ports_quiet]} {
</ins><span class="cx">         puts -nonewline &quot;Version: &quot;
</span><span class="cx">     }
</span><span class="cx">     puts [macports::version]
</span><span class="lines">@@ -2722,7 +2724,7 @@
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> proc action_platform { action portlist opts } {
</span><del>-    if ![macports::ui_isset ports_quiet] {
</del><ins>+    if {![macports::ui_isset ports_quiet]} {
</ins><span class="cx">         puts -nonewline &quot;Platform: &quot;
</span><span class="cx">     }
</span><span class="cx">     puts &quot;${macports::os_platform} ${macports::os_major} ${macports::os_arch}&quot;
</span><span class="lines">@@ -2759,15 +2761,15 @@
</span><span class="cx">                 set index 0
</span><span class="cx">             }
</span><span class="cx">             # set portname again since the one we were passed may not have had the correct case
</span><del>-            set portname [lindex [lindex $ilist $index] 0]
-            set iversion [lindex [lindex $ilist $index] 1]
-            set irevision [lindex [lindex $ilist $index] 2]
-            set ivariants [lindex [lindex $ilist $index] 3]
</del><ins>+            set portname [lindex $ilist $index 0]
+            set iversion [lindex $ilist $index 1]
+            set irevision [lindex $ilist $index 2]
+            set ivariants [lindex $ilist $index 3]
</ins><span class="cx">         }
</span><span class="cx">         
</span><span class="cx">         set deplist [registry::list_dependents $portname $iversion $irevision $ivariants]
</span><span class="cx">         if { [llength $deplist] &gt; 0 } {
</span><del>-            if {$action == &quot;rdependents&quot;} {
</del><ins>+            if {$action eq &quot;rdependents&quot;} {
</ins><span class="cx">                 set toplist $deplist
</span><span class="cx">                 while 1 {
</span><span class="cx">                     set newlist {}
</span><span class="lines">@@ -2877,8 +2879,8 @@
</span><span class="cx">             set portdir [file split [macports::getportdir $porturl]]
</span><span class="cx">             set lsize [llength $portdir]
</span><span class="cx">             set portdir \
</span><del>-                [file join [lindex $portdir [expr $lsize - 2]] \
-                           [lindex $portdir [expr $lsize - 1]]]
</del><ins>+                [file join [lindex $portdir [expr {$lsize - 2}]] \
+                           [lindex $portdir [expr {$lsize - 1}]]]
</ins><span class="cx">             if {[catch {mportsearch $portdir no exact portdir} result]} {
</span><span class="cx">                 ui_debug &quot;$::errorInfo&quot;
</span><span class="cx">                 break_softcontinue &quot;Portdir $portdir not found&quot; 1 status
</span><span class="lines">@@ -2932,7 +2934,7 @@
</span><span class="cx">         # get list of direct deps
</span><span class="cx">         foreach type $deptypes {
</span><span class="cx">             if {[info exists portinfo($type)]} {
</span><del>-                if {$action == &quot;rdeps&quot; || [macports::ui_isset ports_verbose]} {
</del><ins>+                if {$action eq &quot;rdeps&quot; || [macports::ui_isset ports_verbose]} {
</ins><span class="cx">                     foreach dep $portinfo($type) {
</span><span class="cx">                         lappend deplist $dep
</span><span class="cx">                     }
</span><span class="lines">@@ -2941,7 +2943,7 @@
</span><span class="cx">                         lappend deplist [lindex [split $dep :] end]
</span><span class="cx">                     }
</span><span class="cx">                 }
</span><del>-                if {$action == &quot;deps&quot;} {
</del><ins>+                if {$action eq &quot;deps&quot;} {
</ins><span class="cx">                     set label &quot;$labeldict($type) Dependencies&quot;
</span><span class="cx">                     lappend deps_output [wraplabel $label [join $deplist &quot;, &quot;] 0 [string repeat &quot; &quot; 22]]
</span><span class="cx">                     incr ndeps [llength $deplist]
</span><span class="lines">@@ -2959,7 +2961,7 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         puts -nonewline $separator
</span><del>-        if {$action == &quot;deps&quot;} {
</del><ins>+        if {$action eq &quot;deps&quot;} {
</ins><span class="cx">             if {$ndeps == 0} {
</span><span class="cx">                 ui_notice &quot;$portname @${version}_${revision}${variants} has no dependencies.&quot;
</span><span class="cx">             } else {
</span><span class="lines">@@ -3130,7 +3132,7 @@
</span><span class="cx">     set restrictedList 0
</span><span class="cx">     set ilist {}
</span><span class="cx">     
</span><del>-    if { [llength $portlist] || (![info exists private_options(ports_no_args)] || $private_options(ports_no_args) == &quot;no&quot;)} {
</del><ins>+    if { [llength $portlist] || (![info exists private_options(ports_no_args)] || $private_options(ports_no_args) eq &quot;no&quot;)} {
</ins><span class="cx">         set restrictedList 1
</span><span class="cx">         foreachport $portlist {
</span><span class="cx">             set composite_version [composite_version $portversion [array get variations]]
</span><span class="lines">@@ -3144,7 +3146,7 @@
</span><span class="cx">         }
</span><span class="cx">     } else {
</span><span class="cx">         if { [catch {set ilist [registry::installed]} result] } {
</span><del>-            if {$result != &quot;Registry error: No ports registered as installed.&quot;} {
</del><ins>+            if {$result ne &quot;Registry error: No ports registered as installed.&quot;} {
</ins><span class="cx">                 global errorInfo
</span><span class="cx">                 ui_debug &quot;$errorInfo&quot;
</span><span class="cx">                 ui_error &quot;port installed failed: $result&quot;
</span><span class="lines">@@ -3171,10 +3173,10 @@
</span><span class="cx">                 set os_platform [registry::property_retrieve $regref os_platform]
</span><span class="cx">                 set os_major [registry::property_retrieve $regref os_major]
</span><span class="cx">                 set archs [registry::property_retrieve $regref archs]
</span><del>-                if {$os_platform != 0 &amp;&amp; $os_platform != &quot;&quot; &amp;&amp; $os_major != 0 &amp;&amp; $os_major != &quot;&quot;} {
</del><ins>+                if {$os_platform != 0 &amp;&amp; $os_platform ne &quot;&quot; &amp;&amp; $os_major != 0 &amp;&amp; $os_major ne &quot;&quot;} {
</ins><span class="cx">                     append extra &quot; platform='$os_platform $os_major'&quot;
</span><span class="cx">                 }
</span><del>-                if {$archs != 0 &amp;&amp; $archs != &quot;&quot;} {
</del><ins>+                if {$archs != 0 &amp;&amp; $archs ne &quot;&quot;} {
</ins><span class="cx">                     append extra &quot; archs='$archs'&quot;
</span><span class="cx">                 }
</span><span class="cx">             }
</span><span class="lines">@@ -3201,7 +3203,7 @@
</span><span class="cx">     # If port names were supplied, limit ourselves to those ports, else check all installed ports
</span><span class="cx">     set ilist {}
</span><span class="cx">     set restrictedList 0
</span><del>-    if { [llength $portlist] || (![info exists private_options(ports_no_args)] || $private_options(ports_no_args) == &quot;no&quot;)} {
</del><ins>+    if { [llength $portlist] || (![info exists private_options(ports_no_args)] || $private_options(ports_no_args) eq &quot;no&quot;)} {
</ins><span class="cx">         set restrictedList 1
</span><span class="cx">         foreach portspec $portlist {
</span><span class="cx">             array set port $portspec
</span><span class="lines">@@ -3217,7 +3219,7 @@
</span><span class="cx">         }
</span><span class="cx">     } else {
</span><span class="cx">         if { [catch {set ilist [registry::installed]} result] } {
</span><del>-            if {$result != &quot;Registry error: No ports registered as installed.&quot;} {
</del><ins>+            if {$result ne &quot;Registry error: No ports registered as installed.&quot;} {
</ins><span class="cx">                 global errorInfo
</span><span class="cx">                 ui_debug &quot;$errorInfo&quot;
</span><span class="cx">                 ui_error &quot;port installed failed: $result&quot;
</span><span class="lines">@@ -3274,10 +3276,10 @@
</span><span class="cx">             }
</span><span class="cx">             
</span><span class="cx">             # Compare versions, first checking epoch, then version, then revision
</span><del>-            set epoch_comp_result [expr $installed_epoch - $latest_epoch]
</del><ins>+            set epoch_comp_result [expr {$installed_epoch - $latest_epoch}]
</ins><span class="cx">             set comp_result [vercmp $installed_version $latest_version]
</span><span class="cx">             if { $comp_result == 0 } {
</span><del>-                set comp_result [expr $installed_revision - $latest_revision]
</del><ins>+                set comp_result [expr {$installed_revision - $latest_revision}]
</ins><span class="cx">             }
</span><span class="cx">             set reason &quot;&quot;
</span><span class="cx">             if {$epoch_comp_result != 0 &amp;&amp; $installed_version != $latest_version} {
</span><span class="lines">@@ -3289,8 +3291,8 @@
</span><span class="cx">                 set regref [registry::open_entry $portname $installed_version $installed_revision [lindex $i 3] $installed_epoch]
</span><span class="cx">                 set os_platform_installed [registry::property_retrieve $regref os_platform]
</span><span class="cx">                 set os_major_installed [registry::property_retrieve $regref os_major]
</span><del>-                if {$os_platform_installed != &quot;&quot; &amp;&amp; $os_platform_installed != 0
-                    &amp;&amp; $os_major_installed != &quot;&quot; &amp;&amp; $os_major_installed != 0
</del><ins>+                if {$os_platform_installed ne &quot;&quot; &amp;&amp; $os_platform_installed != 0
+                    &amp;&amp; $os_major_installed ne &quot;&quot; &amp;&amp; $os_major_installed != 0
</ins><span class="cx">                     &amp;&amp; ($os_platform_installed != ${macports::os_platform} || $os_major_installed != ${macports::os_major})} {
</span><span class="cx">                     set comp_result -1
</span><span class="cx">                     set reason { (platform $os_platform_installed $os_major_installed != ${macports::os_platform} ${macports::os_major})}
</span><span class="lines">@@ -3354,7 +3356,7 @@
</span><span class="cx">     foreachport $portlist {
</span><span class="cx">         if { ![catch {set ilist [registry::installed $portname]} result] } {
</span><span class="cx">             # set portname again since the one we were passed may not have had the correct case
</span><del>-            set portname [lindex [lindex $ilist 0] 0]
</del><ins>+            set portname [lindex $ilist 0 0]
</ins><span class="cx">         }
</span><span class="cx">         set files [registry::port_registered $portname]
</span><span class="cx">         if { $files != 0 } {
</span><span class="lines">@@ -3377,17 +3379,17 @@
</span><span class="cx"> 
</span><span class="cx"> # expand abbreviations of size units
</span><span class="cx"> proc complete_size_units {units} {
</span><del>-    if {$units == &quot;K&quot; || $units == &quot;Ki&quot;} {
</del><ins>+    if {$units eq &quot;K&quot; || $units eq &quot;Ki&quot;} {
</ins><span class="cx">         return &quot;KiB&quot;
</span><del>-    } elseif {$units == &quot;k&quot;} {
</del><ins>+    } elseif {$units eq &quot;k&quot;} {
</ins><span class="cx">         return &quot;kB&quot;
</span><del>-    } elseif {$units == &quot;Mi&quot;} {
</del><ins>+    } elseif {$units eq &quot;Mi&quot;} {
</ins><span class="cx">         return &quot;MiB&quot;
</span><del>-    } elseif {$units == &quot;M&quot;} {
</del><ins>+    } elseif {$units eq &quot;M&quot;} {
</ins><span class="cx">         return &quot;MB&quot;
</span><del>-    } elseif {$units == &quot;Gi&quot;} {
</del><ins>+    } elseif {$units eq &quot;Gi&quot;} {
</ins><span class="cx">         return &quot;GiB&quot;
</span><del>-    } elseif {$units == &quot;G&quot;} {
</del><ins>+    } elseif {$units eq &quot;G&quot;} {
</ins><span class="cx">         return &quot;GB&quot;
</span><span class="cx">     } else {
</span><span class="cx">         return $units
</span><span class="lines">@@ -3411,17 +3413,17 @@
</span><span class="cx">             if { [llength $files] &gt; 0 } {
</span><span class="cx">                 foreach file $files {
</span><span class="cx">                     catch {
</span><del>-                        set space [expr $space + [file size $file] ]
</del><ins>+                        set space [expr {$space + [file size $file]}]
</ins><span class="cx">                     }
</span><span class="cx">                 }
</span><del>-                if {![info exists options(ports_space_total)] || $options(ports_space_total) != &quot;yes&quot;} {
</del><ins>+                if {![info exists options(ports_space_total)] || $options(ports_space_total) ne &quot;yes&quot;} {
</ins><span class="cx">                     set msg &quot;[bytesize $space $units] $portname&quot;
</span><span class="cx">                     if { $portversion != {} } {
</span><span class="cx">                         append msg &quot; @$portversion&quot;
</span><span class="cx">                     }
</span><span class="cx">                     puts $msg
</span><span class="cx">                 }
</span><del>-                set spaceall [expr $space + $spaceall]
</del><ins>+                set spaceall [expr {$space + $spaceall}]
</ins><span class="cx">             } else {
</span><span class="cx">                 puts stderr &quot;Port $portname does not contain any file or is not active.&quot;
</span><span class="cx">             }
</span><span class="lines">@@ -3429,7 +3431,7 @@
</span><span class="cx">             puts stderr &quot;Port $portname is not installed.&quot;
</span><span class="cx">         }
</span><span class="cx">     }
</span><del>-    if {[llength $portlist] &gt; 1 || ([info exists options(ports_space_total)] &amp;&amp; $options(ports_space_total) == &quot;yes&quot;)} {
</del><ins>+    if {[llength $portlist] &gt; 1 || ([info exists options(ports_space_total)] &amp;&amp; $options(ports_space_total) eq &quot;yes&quot;)} {
</ins><span class="cx">         puts &quot;[bytesize $spaceall $units] total&quot;
</span><span class="cx">     }
</span><span class="cx">     return 0
</span><span class="lines">@@ -3558,7 +3560,7 @@
</span><span class="cx"> proc action_search { action portlist opts } {
</span><span class="cx">     global private_options global_options
</span><span class="cx">     set status 0
</span><del>-    if {![llength $portlist] &amp;&amp; [info exists private_options(ports_no_args)] &amp;&amp; $private_options(ports_no_args) == &quot;yes&quot;} {
</del><ins>+    if {![llength $portlist] &amp;&amp; [info exists private_options(ports_no_args)] &amp;&amp; $private_options(ports_no_args) eq &quot;yes&quot;} {
</ins><span class="cx">         ui_error &quot;You must specify a search pattern&quot;
</span><span class="cx">         return 1
</span><span class="cx">     }
</span><span class="lines">@@ -3566,7 +3568,7 @@
</span><span class="cx">     # Copy global options as we are going to modify the array
</span><span class="cx">     array set options [array get global_options]
</span><span class="cx"> 
</span><del>-    if {[info exists options(ports_search_depends)] &amp;&amp; $options(ports_search_depends) == &quot;yes&quot;} {
</del><ins>+    if {[info exists options(ports_search_depends)] &amp;&amp; $options(ports_search_depends) eq &quot;yes&quot;} {
</ins><span class="cx">         array unset options ports_search_depends
</span><span class="cx">         set options(ports_search_depends_fetch) yes
</span><span class="cx">         set options(ports_search_depends_extract) yes
</span><span class="lines">@@ -3583,7 +3585,7 @@
</span><span class="cx">     foreach { option } [array names options ports_search_*] {
</span><span class="cx">         set opt [string range $option 13 end]
</span><span class="cx"> 
</span><del>-        if { $options($option) != &quot;yes&quot; } {
</del><ins>+        if { $options($option) ne &quot;yes&quot; } {
</ins><span class="cx">             continue
</span><span class="cx">         }
</span><span class="cx">         switch -- $opt {
</span><span class="lines">@@ -3619,7 +3621,7 @@
</span><span class="cx"> 
</span><span class="cx">         set searchstring $portname
</span><span class="cx">         set matchstyle $filter_matchstyle
</span><del>-        if {$matchstyle == &quot;none&quot;} {
</del><ins>+        if {$matchstyle eq &quot;none&quot;} {
</ins><span class="cx">             # Guess if the given string was a glob expression, if not do a substring search
</span><span class="cx">             if {[string first &quot;*&quot; $portname] == -1 &amp;&amp; [string first &quot;?&quot; $portname] == -1} {
</span><span class="cx">                 set searchstring &quot;*$portname*&quot;
</span><span class="lines">@@ -3670,7 +3672,7 @@
</span><span class="cx">                 puts $portinfo(name)
</span><span class="cx">             } else {
</span><span class="cx">                 if {[info exists options(ports_search_line)]
</span><del>-                        &amp;&amp; $options(ports_search_line) == &quot;yes&quot;} {
</del><ins>+                        &amp;&amp; $options(ports_search_line) eq &quot;yes&quot;} {
</ins><span class="cx">                     # check for ports without category, e.g. replaced_by stubs
</span><span class="cx">                     if {[info exists portinfo(categories)]} {
</span><span class="cx">                         puts &quot;$portinfo(name)\t$portinfo(version)\t$portinfo(categories)\t$portinfo(description)&quot;
</span><span class="lines">@@ -3700,7 +3702,7 @@
</span><span class="cx">             ui_notice &quot;No match for $portname found&quot;
</span><span class="cx">         } elseif {[llength $res] &gt; 1} {
</span><span class="cx">             if {(![info exists global_options(ports_search_line)]
</span><del>-                    || $global_options(ports_search_line) != &quot;yes&quot;)} {
</del><ins>+                    || $global_options(ports_search_line) ne &quot;yes&quot;)} {
</ins><span class="cx">                 ui_notice &quot;\nFound [llength $res] ports.&quot;
</span><span class="cx">             }
</span><span class="cx">         }
</span><span class="lines">@@ -3720,12 +3722,12 @@
</span><span class="cx">     set status 0
</span><span class="cx">     
</span><span class="cx">     # Default to list all ports if no portnames are supplied
</span><del>-    if { ![llength $portlist] &amp;&amp; [info exists private_options(ports_no_args)] &amp;&amp; $private_options(ports_no_args) == &quot;yes&quot;} {
</del><ins>+    if { ![llength $portlist] &amp;&amp; [info exists private_options(ports_no_args)] &amp;&amp; $private_options(ports_no_args) eq &quot;yes&quot;} {
</ins><span class="cx">         add_to_portlist portlist [list name &quot;-all-&quot;]
</span><span class="cx">     }
</span><span class="cx">     
</span><span class="cx">     foreachport $portlist {
</span><del>-        if {$portname == &quot;-all-&quot;} {
</del><ins>+        if {$portname eq &quot;-all-&quot;} {
</ins><span class="cx">            if {[catch {set res [mportlistall]} result]} {
</span><span class="cx">                 global errorInfo
</span><span class="cx">                 ui_debug &quot;$errorInfo&quot;
</span><span class="lines">@@ -3763,13 +3765,13 @@
</span><span class="cx">         if {![macports::ui_isset ports_quiet]} {
</span><span class="cx">             set opts {}
</span><span class="cx">             foreach { key value } [array get options] {
</span><del>-                if ![info exists global_options($key)] {
</del><ins>+                if {![info exists global_options($key)]} {
</ins><span class="cx">                     lappend opts &quot;$key=$value&quot;
</span><span class="cx">                 }
</span><span class="cx">             }
</span><span class="cx"> 
</span><span class="cx">             set composite_version [composite_version $portversion [array get variations] 1]
</span><del>-            if { $composite_version != &quot;&quot; } {
</del><ins>+            if { $composite_version ne &quot;&quot; } {
</ins><span class="cx">                 set ver_field &quot;@$composite_version&quot;
</span><span class="cx">             } else {
</span><span class="cx">                 set ver_field &quot;&quot;
</span><span class="lines">@@ -3797,7 +3799,7 @@
</span><span class="cx">     foreachport $portlist {
</span><span class="cx">         array unset portinfo
</span><span class="cx">         # If we have a url, use that, since it's most specific, otherwise try to map the portname to a url
</span><del>-        if {$porturl == &quot;&quot;} {
</del><ins>+        if {$porturl eq &quot;&quot;} {
</ins><span class="cx">         
</span><span class="cx">             # Verify the portname, getting portinfo to map to a porturl
</span><span class="cx">             if {[catch {set res [mportlookup $portname]} result]} {
</span><span class="lines">@@ -3839,7 +3841,7 @@
</span><span class="cx">                     # may want stuff from it as well, like TERM.
</span><span class="cx">                     array unset env_save; array set env_save [array get env]
</span><span class="cx">                     array unset env *
</span><del>-                    if {${macports::macosx_version} == &quot;10.5&quot;} {
</del><ins>+                    if {${macports::macosx_version} eq &quot;10.5&quot;} {
</ins><span class="cx">                         unsetenv *
</span><span class="cx">                     }
</span><span class="cx">                     array set env [array get boot_env]
</span><span class="lines">@@ -3859,7 +3861,7 @@
</span><span class="cx">                     }
</span><span class="cx">                     
</span><span class="cx">                     # Use a reasonable canned default if no editor specified or set in env
</span><del>-                    if { $editor == &quot;&quot; } { set editor &quot;/usr/bin/vi&quot; }
</del><ins>+                    if { $editor eq &quot;&quot; } { set editor &quot;/usr/bin/vi&quot; }
</ins><span class="cx">                     
</span><span class="cx">                     # Invoke the editor
</span><span class="cx">                     if {[catch {eval exec &gt;@stdout &lt;@stdin 2&gt;@stderr $editor {$portfile}} result]} {
</span><span class="lines">@@ -3870,7 +3872,7 @@
</span><span class="cx">                     
</span><span class="cx">                     # Restore internal MacPorts environment
</span><span class="cx">                     array unset env *
</span><del>-                    if {${macports::macosx_version} == &quot;10.5&quot;} {
</del><ins>+                    if {${macports::macosx_version} eq &quot;10.5&quot;} {
</ins><span class="cx">                         unsetenv *
</span><span class="cx">                     }
</span><span class="cx">                     array set env [array get env_save]
</span><span class="lines">@@ -3923,7 +3925,7 @@
</span><span class="cx">                     }
</span><span class="cx"> 
</span><span class="cx">                     # If not available, get the homepage for the port by opening the Portfile
</span><del>-                    if {$homepage == &quot;&quot; &amp;&amp; ![catch {set ctx [mportopen $porturl]} result]} {
</del><ins>+                    if {$homepage eq &quot;&quot; &amp;&amp; ![catch {set ctx [mportopen $porturl]} result]} {
</ins><span class="cx">                         array set portinfo [mportinfo $ctx]
</span><span class="cx">                         if {[info exists portinfo(homepage)]} {
</span><span class="cx">                             set homepage $portinfo(homepage)
</span><span class="lines">@@ -3932,7 +3934,7 @@
</span><span class="cx">                     }
</span><span class="cx"> 
</span><span class="cx">                     # Try to open a browser to the homepage for the given port
</span><del>-                    if { $homepage != &quot;&quot; } {
</del><ins>+                    if { $homepage ne &quot;&quot; } {
</ins><span class="cx">                         if {[catch {system &quot;${macports::autoconf::open_path} '$homepage'&quot;} result]} {
</span><span class="cx">                             global errorInfo
</span><span class="cx">                             ui_debug &quot;$errorInfo&quot;
</span><span class="lines">@@ -3973,14 +3975,14 @@
</span><span class="cx">     if {[require_portlist portlist]} {
</span><span class="cx">         return 1
</span><span class="cx">     }
</span><del>-    if {($action == &quot;install&quot; || $action == &quot;archive&quot;) &amp;&amp; [prefix_unwritable] &amp;&amp; ![macports::global_option_isset ports_dryrun]} {
</del><ins>+    if {($action eq &quot;install&quot; || $action eq &quot;archive&quot;) &amp;&amp; [prefix_unwritable] &amp;&amp; ![macports::global_option_isset ports_dryrun]} {
</ins><span class="cx">         return 1
</span><span class="cx">     }
</span><span class="cx">     foreachport $portlist {
</span><span class="cx">         array unset portinfo
</span><span class="cx">         # If we have a url, use that, since it's most specific
</span><span class="cx">         # otherwise try to map the portname to a url
</span><del>-        if {$porturl == &quot;&quot;} {
</del><ins>+        if {$porturl eq &quot;&quot;} {
</ins><span class="cx">             # Verify the portname, getting portinfo to map to a porturl
</span><span class="cx">             if {[catch {set res [mportlookup $portname]} result]} {
</span><span class="cx">                 global errorInfo
</span><span class="lines">@@ -4001,7 +4003,7 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         # use existing variants iff none were explicitly requested
</span><del>-        if {[array get requested_variations] == &quot;&quot; &amp;&amp; [array get variations] != &quot;&quot;} {
</del><ins>+        if {[array get requested_variations] eq &quot;&quot; &amp;&amp; [array get variations] ne &quot;&quot;} {
</ins><span class="cx">             array unset requested_variations
</span><span class="cx">             array set requested_variations [array get variations]
</span><span class="cx">         }
</span><span class="lines">@@ -4020,13 +4022,13 @@
</span><span class="cx">             set options(ports_version_glob) $portversion
</span><span class="cx">         }
</span><span class="cx">         # if installing, mark the port as explicitly requested
</span><del>-        if {$action == &quot;install&quot;} {
</del><ins>+        if {$action eq &quot;install&quot;} {
</ins><span class="cx">             if {![info exists options(ports_install_unrequested)]} {
</span><span class="cx">                 set options(ports_requested) 1
</span><span class="cx">             }
</span><span class="cx">             # we actually activate as well
</span><span class="cx">             set target activate
</span><del>-        } elseif {$action == &quot;archive&quot;} {
</del><ins>+        } elseif {$action eq &quot;archive&quot;} {
</ins><span class="cx">             set target install
</span><span class="cx">         } else {
</span><span class="cx">             set target $action
</span><span class="lines">@@ -4059,7 +4061,7 @@
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx">     
</span><del>-    if {$status == 0 &amp;&amp; $action == &quot;install&quot; &amp;&amp; ![macports::global_option_isset ports_dryrun]} {
</del><ins>+    if {$status == 0 &amp;&amp; $action eq &quot;install&quot; &amp;&amp; ![macports::global_option_isset ports_dryrun]} {
</ins><span class="cx">         array set options $opts
</span><span class="cx">         if {![info exists options(ports_nodeps)] &amp;&amp; ![info exists options(ports_install_no-rev-upgrade)] &amp;&amp; ${macports::revupgrade_autorun}} {
</span><span class="cx">             set status [action_revupgrade $action $portlist $opts]
</span><span class="lines">@@ -4366,9 +4368,9 @@
</span><span class="cx">     while {[moreargs]} {
</span><span class="cx">         set arg [lookahead]
</span><span class="cx">         
</span><del>-        if {[string index $arg 0] != &quot;-&quot;} {
</del><ins>+        if {[string index $arg 0] ne &quot;-&quot;} {
</ins><span class="cx">             break
</span><del>-        } elseif {[string index $arg 1] == &quot;-&quot;} {
</del><ins>+        } elseif {[string index $arg 1] eq &quot;-&quot;} {
</ins><span class="cx">             # Process long arguments
</span><span class="cx">             switch -- $arg {
</span><span class="cx">                 -- { # This is the options terminator; do no further option processing
</span><span class="lines">@@ -4386,8 +4388,8 @@
</span><span class="cx">                         }
</span><span class="cx">                         return -code error &quot;\&quot;port ${action} --${key}\&quot; is ambiguous: \n  port ${action} [join $errlst &quot;\n  port ${action} &quot;]&quot;
</span><span class="cx">                     }
</span><del>-                    set key   [lindex [lindex $kopts 0] 0]
-                    set kargc [lindex [lindex $kopts 0] 1]
</del><ins>+                    set key   [lindex $kopts 0 0]
+                    set kargc [lindex $kopts 0 1]
</ins><span class="cx">                     if {$kargc == 0} {
</span><span class="cx">                         set global_options(ports_${action}_${key}) yes
</span><span class="cx">                     } else {
</span><span class="lines">@@ -4395,10 +4397,10 @@
</span><span class="cx">                         while {[moreargs] &amp;&amp; $kargc &gt; 0} {
</span><span class="cx">                             advance
</span><span class="cx">                             lappend args [lookahead]
</span><del>-                            set kargc [expr $kargc - 1]
</del><ins>+                            set kargc [expr {$kargc - 1}]
</ins><span class="cx">                         }
</span><span class="cx">                         if {$kargc &gt; 0} {
</span><del>-                            return -code error &quot;--${key} expects [expr $kargc + [llength $args]] parameters!&quot;
</del><ins>+                            return -code error &quot;--${key} expects [expr {$kargc + [llength $args]}] parameters!&quot;
</ins><span class="cx">                         }
</span><span class="cx">                         set global_options(ports_${action}_${key}) $args
</span><span class="cx">                     }
</span><span class="lines">@@ -4670,7 +4672,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     # Decide how to do completion based on where we are in the string
</span><del>-    set prefix [string range $text 0 [expr $start - 1]]
</del><ins>+    set prefix [string range $text 0 [expr {$start - 1}]]
</ins><span class="cx">     
</span><span class="cx">     # If only whitespace characters preceed us, or if the
</span><span class="cx">     # previous non-whitespace character was a ;, then we're
</span><span class="lines">@@ -4688,7 +4690,7 @@
</span><span class="cx">     upvar $linename line
</span><span class="cx">     
</span><span class="cx">     set line &quot;&quot;
</span><del>-    while { $line == &quot;&quot; } {
</del><ins>+    while { $line eq &quot;&quot; } {
</ins><span class="cx"> 
</span><span class="cx">         if {$use_readline} {
</span><span class="cx">             set len [readline read -attempted_completion attempt_completion line $prompt]
</span><span class="lines">@@ -4704,7 +4706,7 @@
</span><span class="cx">         
</span><span class="cx">         set line [string trim $line]
</span><span class="cx"> 
</span><del>-        if { $use_readline &amp;&amp; $line != &quot;&quot; } {
</del><ins>+        if { $use_readline &amp;&amp; $line ne &quot;&quot; } {
</ins><span class="cx">             rl_history add $line
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="lines">@@ -4719,7 +4721,7 @@
</span><span class="cx">     # Initialize readline
</span><span class="cx">     set isstdin [string match $in &quot;stdin&quot;]
</span><span class="cx">     set name &quot;port&quot;
</span><del>-    set use_readline [expr $isstdin &amp;&amp; [readline init $name]]
</del><ins>+    set use_readline [expr {$isstdin &amp;&amp; [readline init $name]}]
</ins><span class="cx">     set history_file [file normalize &quot;${macports::macports_user_dir}/history&quot;]
</span><span class="cx"> 
</span><span class="cx">     # Read readline history
</span><span class="lines">@@ -4787,7 +4789,7 @@
</span><span class="cx">     # For each file in the command list, process commands
</span><span class="cx">     # in the file
</span><span class="cx">     foreach file $filelist {
</span><del>-        if {$file == &quot;-&quot;} {
</del><ins>+        if {$file eq &quot;-&quot;} {
</ins><span class="cx">             set in stdin
</span><span class="cx">         } else {
</span><span class="cx">             if {[catch {set in [open $file]} result]} {
</span><span class="lines">@@ -4797,7 +4799,7 @@
</span><span class="cx"> 
</span><span class="cx">         set exit_status [process_command_file $in]
</span><span class="cx"> 
</span><del>-        if {$in != &quot;stdin&quot;} {
</del><ins>+        if {$in ne &quot;stdin&quot;} {
</ins><span class="cx">             close $in
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="lines">@@ -4810,7 +4812,229 @@
</span><span class="cx">     return $exit_status
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+##
+# Progress callback for generic operations executed by macports 1.0.
+#
+# @param action
+#        One of &quot;start&quot;, &quot;update&quot;, &quot;intermission&quot; or &quot;finish&quot;, where start will
+#        be called before any number of update calls, interrupted by any number
+#        of intermission calls (called because other output is being produced),
+#        followed by one call to finish.
+# @param args
+#        A list of variadic args that differ for each action.
+#        For &quot;start&quot;: empty.
+#        For &quot;update&quot;: contains the arguments $cur and $total where $cur is the
+#        current number of units processed and $total is the total number of
+#        units to be processed.
+#        For &quot;intermission&quot;: empty.
+#        For &quot;finish&quot;: empty.
+proc port_progress_generic {action args} {
+    global _port_progress_starttime _port_progress_display_bar
+    switch -nocase -- $action {
+        start {
+            set _port_progress_starttime [clock milliseconds]
+            set _port_progress_display_bar no
+        }
+        update {
+            # the for loop is a simple hack because Tcl 8.4 doesn't have
+            # lassign
+            foreach {now total} $args {
+                if {${_port_progress_display_bar} ne yes} {
+                    # check whether we should show a progress bar for this transfer
+                    if {[expr {[clock milliseconds] - ${_port_progress_starttime}}] &gt; 500 &amp;&amp; ($total == 0 || [expr {$now / $total}] &lt; 0.5)} {
+                        # wait 500ms, then, if we don't know the total or we're
+                        # not past 50% yet, display a progress bar.
+                        set _port_progress_display_bar yes
+                    }
+                }
+                if {${_port_progress_display_bar} eq yes} {
+                    set barprefix &quot;      &quot;
+                    if {$total != 0} {
+                        progress_bar $now $total 20 $barprefix
+                    } else {
+                        unprogress_bar $now 20 $barprefix
+                    }
+                }
+            }
+        }
+        intermission -
+        finish {
+            # erase to start of line
+            ::term::ansi::send::esol
+            # return cursor to start of line
+            puts -nonewline &quot;\r&quot;
+            flush stdout
+        }
+    }
</ins><span class="cx"> 
</span><ins>+    return 0
+}
+
+
+##
+# Progress callback for downloads executed by macports 1.0.
+#
+# This is essentially a cURL progress callback.
+#
+# @param action
+#        One of &quot;start&quot;, &quot;update&quot; or &quot;finish&quot;, where start will be called
+#        before any number of update calls, followed by one call to finish.
+# @param args
+#        A list of variadic args that differ for each action.
+#        For &quot;start&quot;: contains a single argument &quot;ul&quot; or &quot;dl&quot; indicating
+#        whether this is an up- or download.
+#        For &quot;update&quot;: contains the arguments (&quot;ul&quot;|&quot;dl&quot;) total now speed where
+#        ul/dl are as for start, and total, now and speed are doubles
+#        indicating the total transfer size, currently transferred amount and
+#        average speed per second in bytes.
+#        For &quot;finish&quot;: empty.
+proc port_progress_download {action args} {
+    global _port_progress_starttime _port_progress_display_bar
+    switch -nocase -- $action {
+        start {
+            set _port_progress_starttime [clock milliseconds]
+            set _port_progress_display_bar no
+        }
+        update {
+            # the for loop is a simple hack because Tcl 8.4 doesn't have
+            # lassign
+            foreach {type total now speed} $args {
+                if {${_port_progress_display_bar} ne yes} {
+                    # check whether we should show a progress bar for this transfer
+                    if {[expr {[clock milliseconds] - ${_port_progress_starttime}}] &gt; 500 &amp;&amp; ($total == 0 || [expr {$now / $total}] &lt; 0.5)} {
+                        # wait 500ms, then, if we don't know the total or we're
+                        # not past 50% yet, display a progress bar.
+                        set _port_progress_display_bar yes
+                    }
+                }
+                if {${_port_progress_display_bar} eq yes} {
+                    set barprefix &quot;      &quot;
+                    if {$total != 0} {
+                        set barsuffix [format &quot;        speed: %-13s&quot; &quot;[bytesize $speed {} &quot;%.1f&quot;]/s&quot;]
+                        progress_bar $now $total 20 $barprefix $barsuffix
+                    } else {
+                        set barsuffix [format &quot; %-10s     speed: %-13s&quot; [bytesize $now {} &quot;%6.1f&quot;] &quot;[bytesize $speed {} &quot;%.1f&quot;]/s&quot;]
+                        unprogress_bar $now 20 $barprefix $barsuffix
+                    }
+                }
+            }
+        }
+        finish {
+            # erase to start of line
+            ::term::ansi::send::esol
+            # return cursor to start of line
+            puts -nonewline &quot;\r&quot;
+            flush stdout
+        }
+    }
+
+    return 0
+}
+
+##
+# Draw a progress bar using unicode block drawing characters
+#
+# @param current
+#        the current progress value
+# @param total
+#        the progress value representing 100%
+# @param halfwidth
+#        the half width in characters of the progress bar
+# @param prefix
+#        prefix to be printed in front of the progress bar
+# @param suffix
+#        suffix to be printed after the progress bar
+proc progress_bar {current total halfwidth {prefix &quot;&quot;} {suffix &quot;&quot;}} {
+    # we use 8 different states per character, so let's multiply the width by
+    # 8 and map the percentage to this range
+    set percent [expr {(double($current) * 100 / double($total))}]
+    set progress [expr {int(round(($current * $halfwidth * 8) / $total))}]
+    set fullfields [expr {int($progress / 8)}]
+    set remainder [expr {$progress % 8}]
+
+    # clear the current line
+    set progressbar &quot;&quot;
+    for {set i 0} {$i &lt; $fullfields} {incr i} {
+        # U+2588 FULL BLOCK doesn't match the other blocks in some fonts :/
+        # Use two half blocks instead
+        # Since we use two chars here, make sure to remove a space for each of
+        # those used!
+        append progressbar &quot;\u258c\u258c&quot;
+    }
+
+    if {$remainder == 0 &amp;&amp; $fullfields &lt; $halfwidth} {
+        append progressbar &quot; &quot;
+    } elseif {$remainder == 1} {
+        # U+258F LEFT ONE EIGHTH BLOCK
+        append progressbar &quot;\u258f&quot;
+    } elseif {$remainder == 2} {
+        # U+258E LEFT ONE QUARTER BLOCK
+        append progressbar &quot;\u258e&quot;
+    } elseif {$remainder == 3} {
+        # U+258D LEFT THREE EIGHTHS BLOCK
+        append progressbar &quot;\u258d&quot;
+    } elseif {$remainder == 4} {
+        # U+258C LEFT HALF BLOCK
+        append progressbar &quot;\u258c&quot;
+    } elseif {$remainder == 5} {
+        # U+258B LEFT FIVE EIGHTHS BLOCK
+        append progressbar &quot;\u258b&quot;
+    } elseif {$remainder == 6} {
+        # U+258A LEFT THREE QUARTERS BLOCK
+        append progressbar &quot;\u258a&quot;
+    } elseif {$remainder == 7} {
+        # U+2589 LEFT SEVEN EIGHTHS BLOCK
+        append progressbar &quot;\u2589&quot;
+    }
+
+    for {set i [expr {[string length $progressbar]}]} {$i &lt; [expr {2 * $halfwidth}]} {incr i} {
+        append progressbar &quot; &quot;
+    }
+    set percentagesuffix [format &quot; %5.1f %%&quot; $percent]
+
+    puts -nonewline &quot;\r${prefix}\[${progressbar}\]${percentagesuffix}${suffix}&quot;
+    flush stdout
+}
+
+##
+# Draw a progress indicator
+#
+# @param current
+#        the number of bytes currently downloaded
+# @param halfwidth
+#        the half width in characters of the progress indicator
+# @param prefix
+#        prefix to be printed in front of the progress indicator
+# @param suffix
+#        suffix to be printed after the progress indicator
+proc unprogress_bar {current halfwidth {prefix &quot;&quot;} {suffix &quot;&quot;}} {
+    global _port_progress_unprogressbar_state
+
+    set numstates 4
+
+    if {![info exists _port_progress_unprogressbar_state]} {
+        set _port_progress_unprogressbar_state 0
+    } else {
+        set _port_progress_unprogressbar_state [expr {(${_port_progress_unprogressbar_state} + 1) % $numstates}]
+    }
+
+    # clear the current line
+    set progressbar &quot;&quot;
+
+    for {set i 0} {$i &lt; [expr {2 * $halfwidth}]} {incr i} {
+        if {[expr $i % $numstates] == ${_port_progress_unprogressbar_state}} {
+            # U+2022 BULLET
+            append progressbar &quot;\u2022&quot;
+        } else {
+            append progressbar &quot; &quot;
+        }
+    }
+
+    puts -nonewline &quot;\r${prefix}\[${progressbar}\]${suffix}&quot;
+    flush stdout
+}
+
+
</ins><span class="cx"> ##########################################
</span><span class="cx"> # Main
</span><span class="cx"> ##########################################
</span><span class="lines">@@ -4846,7 +5070,7 @@
</span><span class="cx"> # If we've been invoked as portf, then the first argument is assumed
</span><span class="cx"> # to be the name of a command file (i.e., there is an implicit -F
</span><span class="cx"> # before any arguments).
</span><del>-if {[moreargs] &amp;&amp; $cmdname == &quot;portf&quot;} {
</del><ins>+if {[moreargs] &amp;&amp; $cmdname eq &quot;portf&quot;} {
</ins><span class="cx">     lappend ui_options(ports_commandfiles) [lookahead]
</span><span class="cx">     advance
</span><span class="cx"> }
</span><span class="lines">@@ -4858,6 +5082,11 @@
</span><span class="cx">     exit 1
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+if {[isatty stdout] &amp;&amp; (![info exists ui_options(ports_quiet)] || $ui_options(ports_quiet) ne &quot;yes&quot;)} {
+    set ui_options(progress_download) port_progress_download
+    set ui_options(progress_generic)  port_progress_generic
+}
+
</ins><span class="cx"> # Get arguments remaining after option processing
</span><span class="cx"> set remaining_args [lrange $cmd_argv $cmd_argn end]
</span><span class="cx"> 
</span><span class="lines">@@ -4865,7 +5094,7 @@
</span><span class="cx"> # interactive mode
</span><span class="cx"> if { [llength $remaining_args] == 0 &amp;&amp; ![info exists ui_options(ports_commandfiles)] } {
</span><span class="cx">     lappend ui_options(ports_commandfiles) -
</span><del>-} elseif {[lookahead] == &quot;selfupdate&quot; || [lookahead] == &quot;sync&quot;} {
</del><ins>+} elseif {[lookahead] eq &quot;selfupdate&quot; || [lookahead] eq &quot;sync&quot;} {
</ins><span class="cx">     # tell mportinit not to tell the user they should selfupdate
</span><span class="cx">     set ui_options(ports_no_old_index_warning) 1
</span><span class="cx"> }
</span></span></pre></div>
<a id="branchesnewhelpsystembasesrcportportindextcl"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/src/port/portindex.tcl (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/port/portindex.tcl        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/src/port/portindex.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -39,7 +39,7 @@
</span><span class="cx">            ui_options port_options save_prefix keepkeys
</span><span class="cx"> 
</span><span class="cx">     # try to reuse the existing entry if it's still valid
</span><del>-    if {$full_reindex != &quot;1&quot; &amp;&amp; [info exists qindex([string tolower [file tail $portdir]])]} {
</del><ins>+    if {$full_reindex != 1 &amp;&amp; [info exists qindex([string tolower [file tail $portdir]])]} {
</ins><span class="cx">         try {
</span><span class="cx">             set mtime [file mtime [file join $directory $portdir Portfile]]
</span><span class="cx">             if {$oldmtime &gt;= $mtime} {
</span><span class="lines">@@ -102,12 +102,12 @@
</span><span class="cx"> 
</span><span class="cx">         foreach availkey [array names portinfo] {
</span><span class="cx">             # store list of subports for top-level ports only
</span><del>-            if {![info exists keepkeys($availkey)] &amp;&amp; $availkey != &quot;subports&quot;} {
</del><ins>+            if {![info exists keepkeys($availkey)] &amp;&amp; $availkey ne &quot;subports&quot;} {
</ins><span class="cx">                 unset portinfo($availkey)
</span><span class="cx">             }
</span><span class="cx">         }
</span><span class="cx">         set output [array get portinfo]
</span><del>-        set len [expr [string length $output] + 1]
</del><ins>+        set len [expr {[string length $output] + 1}]
</ins><span class="cx">         puts $fd [list $portinfo(name) $len]
</span><span class="cx">         puts $fd $output
</span><span class="cx">         set mtime [file mtime [file join $directory $portdir Portfile]]
</span><span class="lines">@@ -138,7 +138,7 @@
</span><span class="cx">                     }
</span><span class="cx">                 }
</span><span class="cx">                 set output [array get portinfo]
</span><del>-                set len [expr [string length $output] + 1]
</del><ins>+                set len [expr {[string length $output] + 1}]
</ins><span class="cx">                 puts $fd [list $portinfo(name) $len]
</span><span class="cx">                 puts $fd $output
</span><span class="cx">             }
</span><span class="lines">@@ -146,7 +146,7 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-if {[expr $argc &gt; 8]} {
</del><ins>+if {$argc &gt; 8} {
</ins><span class="cx">     print_usage
</span><span class="cx">     exit 1
</span><span class="cx"> }
</span><span class="lines">@@ -155,23 +155,23 @@
</span><span class="cx">     set arg [lindex $argv $i]
</span><span class="cx">     switch -regex -- $arg {
</span><span class="cx">         {^-.+} {
</span><del>-            if {$arg == &quot;-d&quot;} { # Turn on debug output
</del><ins>+            if {$arg eq &quot;-d&quot;} { # Turn on debug output
</ins><span class="cx">                 set ui_options(ports_debug) yes
</span><del>-            } elseif {$arg == &quot;-o&quot;} { # Set output directory
</del><ins>+            } elseif {$arg eq &quot;-o&quot;} { # Set output directory
</ins><span class="cx">                 incr i
</span><span class="cx">                 set outdir [file join [pwd] [lindex $argv $i]]
</span><del>-            } elseif {$arg == &quot;-p&quot;} { # Set platform
</del><ins>+            } elseif {$arg eq &quot;-p&quot;} { # Set platform
</ins><span class="cx">                 incr i
</span><span class="cx">                 set platlist [split [lindex $argv $i] _]
</span><span class="cx">                 set os_platform [lindex $platlist 0]
</span><span class="cx">                 set os_major [lindex $platlist 1]
</span><span class="cx">                 set os_arch [lindex $platlist 2]
</span><del>-                if {$os_platform == &quot;macosx&quot;} {
</del><ins>+                if {$os_platform eq &quot;macosx&quot;} {
</ins><span class="cx">                     lappend port_options os.subplatform $os_platform os.universal_supported yes
</span><span class="cx">                     set os_platform darwin
</span><span class="cx">                 }
</span><span class="cx">                 lappend port_options os.platform $os_platform os.major $os_major os.arch $os_arch
</span><del>-            } elseif {$arg == &quot;-f&quot;} { # Completely rebuild index
</del><ins>+            } elseif {$arg eq &quot;-f&quot;} { # Completely rebuild index
</ins><span class="cx">                 set full_reindex 1
</span><span class="cx">             } else {
</span><span class="cx">                 puts stderr &quot;Unknown option: $arg&quot;
</span><span class="lines">@@ -249,6 +249,6 @@
</span><span class="cx"> file mtime $outpath $newest
</span><span class="cx"> mports_generate_quickindex $outpath
</span><span class="cx"> puts &quot;\nTotal number of ports parsed:\t$stats(total)\
</span><del>-      \nPorts successfully parsed:\t[expr $stats(total) - $stats(failed)]\
</del><ins>+      \nPorts successfully parsed:\t[expr {$stats(total) - $stats(failed)}]\
</ins><span class="cx">       \nPorts failed:\t\t\t$stats(failed)\
</span><span class="cx">       \nUp-to-date ports skipped:\t$stats(skipped)\n&quot;
</span></span></pre></div>
<a id="branchesnewhelpsystembasesrcportportmirrortcl"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/src/port/portmirror.tcl (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/port/portmirror.tcl        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/src/port/portmirror.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -82,7 +82,7 @@
</span><span class="cx">     puts &quot;Usage: $argv0&quot;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-if {[expr $argc &gt; 0]} {
</del><ins>+if {$argc &gt; 0} {
</ins><span class="cx">     print_usage
</span><span class="cx">     exit 1
</span><span class="cx"> }
</span></span></pre></div>
<a id="branchesnewhelpsystembasesrcport10"></a>
<div class="propset"><h4>Property changes: branches/new-help-system/base/src/port1.0</h4>
<pre class="diff"><span>
</span></pre></div>
<a id="svnignore"></a>
<div class="modfile"><h4>Modified: svn:ignore</h4></div>
<span class="cx">pkgIndex.tcl
</span><span class="cx">   + port_autoconf.tcl
</span><span class="cx">port_test_autoconf.tcl
</span><span class="cx">pkgIndex.tcl
</span><a id="branchesnewhelpsystembasesrcport10Makefile"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/src/port1.0/Makefile (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/port1.0/Makefile        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/src/port1.0/Makefile        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -23,7 +23,7 @@
</span><span class="cx">         rm -f pkgIndex.tcl
</span><span class="cx"> 
</span><span class="cx"> distclean:: clean
</span><del>-        rm -f port_autoconf.tcl
</del><ins>+        rm -f port_autoconf.tcl port_test_autoconf.tcl
</ins><span class="cx"> 
</span><span class="cx"> install:: all
</span><span class="cx">         $(INSTALL) -d -o ${DSTUSR} -g ${DSTGRP} -m ${DSTMODE} ${INSTALLDIR}
</span><span class="lines">@@ -33,6 +33,4 @@
</span><span class="cx">         $(INSTALL) -o ${DSTUSR} -g ${DSTGRP} -m 444 pkgIndex.tcl ${INSTALLDIR}
</span><span class="cx"> 
</span><span class="cx"> test::
</span><del>-        ${TCLSH} tests/portutil.tcl ${macports_tcl_dir}
-        ${TCLSH} tests/portdestroot.tcl ${macports_tcl_dir}
-        ${TCLSH} tests/portfetch.tcl ${macports_tcl_dir}
</del><ins>+        $(TCLSH) ./tests/test.tcl -nocolor
</ins></span></pre></div>
<a id="branchesnewhelpsystembasesrcport10fetch_commontcl"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/src/port1.0/fetch_common.tcl (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/port1.0/fetch_common.tcl        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/src/port1.0/fetch_common.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -48,7 +48,7 @@
</span><span class="cx"> # percent-encode all characters in str that are not unreserved in URIs
</span><span class="cx"> proc portfetch::percent_encode {str} {
</span><span class="cx">     set outstr &quot;&quot;
</span><del>-    while {[string length $str] &gt; 0} {
</del><ins>+    while {$str ne &quot;&quot;} {
</ins><span class="cx">         set char [string index $str 0]
</span><span class="cx">         set str [string range $str 1 end]
</span><span class="cx">         switch -- $char {
</span><span class="lines">@@ -75,7 +75,7 @@
</span><span class="cx"> # Given a site url and the name of the distfile, assemble url and
</span><span class="cx"> # return it.
</span><span class="cx"> proc portfetch::assemble_url {site distfile} {
</span><del>-    if {[string index $site end] != &quot;/&quot;} {
</del><ins>+    if {[string index $site end] ne &quot;/&quot;} {
</ins><span class="cx">         append site /
</span><span class="cx">     }
</span><span class="cx">     return &quot;${site}[percent_encode ${distfile}]&quot;
</span><span class="lines">@@ -106,11 +106,11 @@
</span><span class="cx">         # tag will be after the last colon after the
</span><span class="cx">         # first slash after the ://
</span><span class="cx">         set lastcolon [string last : $element]
</span><del>-        set aftersep [expr [string first : $element] + 3]
</del><ins>+        set aftersep [expr {[string first : $element] + 3}]
</ins><span class="cx">         set firstslash [string first / $element $aftersep]
</span><span class="cx">         if {$firstslash != -1 &amp;&amp; $firstslash &lt; $lastcolon} {
</span><del>-            set mirror_tag [string range $element [expr $lastcolon + 1] end]
-            set element [string range $element 0 [expr $lastcolon - 1]]
</del><ins>+            set mirror_tag [string range $element [expr {$lastcolon + 1}] end]
+            set element [string range $element 0 [expr {$lastcolon - 1}]]
</ins><span class="cx">         } else {
</span><span class="cx">             set mirror_tag &quot;&quot;
</span><span class="cx">         }
</span><span class="lines">@@ -122,9 +122,9 @@
</span><span class="cx">             set mirror_tag &quot;&quot;
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        if {$mirror_tag == &quot;mirror&quot;} {
</del><ins>+        if {$mirror_tag eq &quot;mirror&quot;} {
</ins><span class="cx">             set thesubdir ${dist_subdir}
</span><del>-        } elseif {$subdir == &quot;&quot; &amp;&amp; $mirror_tag != &quot;nosubdir&quot;} {
</del><ins>+        } elseif {$subdir eq &quot;&quot; &amp;&amp; $mirror_tag ne &quot;nosubdir&quot;} {
</ins><span class="cx">             set thesubdir ${name}
</span><span class="cx">         } else {
</span><span class="cx">             set thesubdir ${subdir}
</span><span class="lines">@@ -192,10 +192,10 @@
</span><span class="cx">         # add in the global, fallback and user-defined mirrors for each tag
</span><span class="cx">         foreach site $site_list {
</span><span class="cx">             if {[regexp {([a-zA-Z]+://.+/?):([0-9A-Za-z_-]+)$} $site match site tag] &amp;&amp; ![info exists extras_added($tag)]} {
</span><del>-                if {$sglobal != &quot;&quot;} {
</del><ins>+                if {$sglobal ne &quot;&quot;} {
</ins><span class="cx">                     set site_list [concat $site_list [mirror_sites $sglobal $tag &quot;&quot; $mirrorfile]]
</span><span class="cx">                 }
</span><del>-                if {$sfallback != &quot;&quot;} {
</del><ins>+                if {$sfallback ne &quot;&quot;} {
</ins><span class="cx">                     set site_list [concat $site_list [mirror_sites $sfallback $tag &quot;&quot; $mirrorfile]]
</span><span class="cx">                 }
</span><span class="cx">                 if {[info exists env($senv)]} {
</span><span class="lines">@@ -247,7 +247,7 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         foreach site $urllist {
</span><del>-            if {[string range $site 0 6] == &quot;file://&quot;} {
</del><ins>+            if {[string range $site 0 6] eq &quot;file://&quot;} {
</ins><span class="cx">                 set pingtimes(localhost) 0
</span><span class="cx">                 continue
</span><span class="cx">             }
</span><span class="lines">@@ -299,7 +299,7 @@
</span><span class="cx"> 
</span><span class="cx">         set pinglist {}
</span><span class="cx">         foreach site $urllist {
</span><del>-            if {[string range $site 0 6] == &quot;file://&quot;} {
</del><ins>+            if {[string range $site 0 6] eq &quot;file://&quot;} {
</ins><span class="cx">                 set host localhost
</span><span class="cx">             } else {
</span><span class="cx">                 regexp $hostregex $site -&gt; host
</span><span class="lines">@@ -343,6 +343,6 @@
</span><span class="cx"> proc portfetch::check_dns {} {
</span><span class="cx">     # check_broken_dns returns true at most once, so we don't have to worry about spamming this message
</span><span class="cx">     if {[check_broken_dns]} {
</span><del>-        ui_warn &quot;Your DNS servers incorrectly claim to know the address of nonexistent hosts. This may cause checksum mismatches for some ports.&quot;
</del><ins>+        ui_warn &quot;Your DNS servers incorrectly claim to know the address of nonexistent hosts. This may cause checksum mismatches for some ports. See this page for more information: &lt;https://trac.macports.org/wiki/MisbehavingServers&gt;&quot;
</ins><span class="cx">     }
</span><span class="cx"> }
</span></span></pre></div>
<a id="branchesnewhelpsystembasesrcport10port_test_autoconftclinfromrev117083trunkbasesrcport10port_test_autoconftclin"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/src/port1.0/port_test_autoconf.tcl.in (from rev 117083, trunk/base/src/port1.0/port_test_autoconf.tcl.in) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/port1.0/port_test_autoconf.tcl.in                                (rev 0)
+++ branches/new-help-system/base/src/port1.0/port_test_autoconf.tcl.in        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,37 @@
</span><ins>+# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4
+# macports-autoconf.tcl.in
+# $Id: macports_autoconf.tcl.in 90070 2012-02-20 21:54:35Z jberry@macports.org $
+#
+# Copyright (c) 2006 - 2009, 2011 The MacPorts Project
+# Copyright (c) 2002 - 2003 Apple 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 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 &quot;AS IS&quot;
+# 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.
+#
+
+namespace eval macports::autoconf {
+    variable macports_tcl_dir &quot;@macports_tcl_dir@&quot;
+    variable prefix &quot;@prefix@&quot;
+}
</ins></span></pre></div>
<a id="branchesnewhelpsystembasesrcport10portactivatetcl"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/src/port1.0/portactivate.tcl (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/port1.0/portactivate.tcl        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/src/port1.0/portactivate.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -43,6 +43,7 @@
</span><span class="cx"> target_provides ${org.macports.activate} activate
</span><span class="cx"> target_requires ${org.macports.activate} main archivefetch fetch checksum extract patch configure build destroot install
</span><span class="cx"> target_prerun ${org.macports.activate} portactivate::activate_start
</span><ins>+target_postrun ${org.macports.activate} portactivate::activate_finish
</ins><span class="cx"> 
</span><span class="cx"> namespace eval portactivate {
</span><span class="cx"> }
</span><span class="lines">@@ -97,10 +98,18 @@
</span><span class="cx">         ui_notice &quot;&quot;
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    return 0
+}
+
+proc portactivate::activate_finish {args} {
+    global subport startupitem.autostart UI_PREFIX
+
+    # Do this _after_ activate_main, because post-activate hooks might create
+    # the files needed for this
</ins><span class="cx">     if {[tbool startupitem.autostart]} {
</span><del>-        ui_notice &quot;$UI_PREFIX [format [msgcat::mc &quot;Loading %s&quot;] [option subport]]&quot;
</del><ins>+        ui_notice &quot;$UI_PREFIX [format [msgcat::mc &quot;Loading %s&quot;] $subport]&quot;
</ins><span class="cx">         if {[eval_targets &quot;load&quot;]} {
</span><del>-            ui_error [format [msgcat::mc &quot;Failed to load %s&quot;] [option subport]]
</del><ins>+            ui_error [format [msgcat::mc &quot;Failed to load %s&quot;] $subport]
</ins><span class="cx">             return 1
</span><span class="cx">         }
</span><span class="cx">     }
</span></span></pre></div>
<a id="branchesnewhelpsystembasesrcport10portbuildtcl"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/src/port1.0/portbuild.tcl (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/port1.0/portbuild.tcl        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/src/port1.0/portbuild.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -69,12 +69,12 @@
</span><span class="cx">     if {!${build.type.add_deps}} {
</span><span class="cx">         return
</span><span class="cx">     }
</span><del>-    if {[option build.type] == &quot;bsd&quot; &amp;&amp; [option os.platform] == &quot;darwin&quot;} {
</del><ins>+    if {[option build.type] eq &quot;bsd&quot; &amp;&amp; [option os.platform] eq &quot;darwin&quot;} {
</ins><span class="cx">         ui_debug &quot;build.type is BSD, adding bin:bsdmake:bsdmake build dependency&quot;
</span><span class="cx">         depends_build-delete bin:bsdmake:bsdmake
</span><span class="cx">         depends_build-append bin:bsdmake:bsdmake
</span><span class="cx">     }
</span><del>-    if {[option build.type] == &quot;gnu&quot; &amp;&amp; [option os.platform] == &quot;freebsd&quot;} {
</del><ins>+    if {[option build.type] eq &quot;gnu&quot; &amp;&amp; [option os.platform] eq &quot;freebsd&quot;} {
</ins><span class="cx">         ui_debug &quot;build.type is GNU, adding bin:gmake:gmake build dependency&quot;
</span><span class="cx">         depends_build-delete bin:gmake:gmake
</span><span class="cx">         depends_build-append bin:gmake:gmake
</span><span class="lines">@@ -87,23 +87,23 @@
</span><span class="cx"> default build.type.add_deps yes
</span><span class="cx"> 
</span><span class="cx"> proc portbuild::build_getmaketype {args} {
</span><del>-    if {[option build.type] == &quot;default&quot;} {
</del><ins>+    if {[option build.type] eq &quot;default&quot;} {
</ins><span class="cx">         return [findBinary make $portutil::autoconf::make_path]
</span><span class="cx">     }
</span><span class="cx">     switch -exact -- [option build.type] {
</span><span class="cx">         bsd {
</span><del>-            if {[option os.platform] == &quot;darwin&quot;} {
</del><ins>+            if {[option os.platform] eq &quot;darwin&quot;} {
</ins><span class="cx">                 return [findBinary bsdmake $portutil::autoconf::bsdmake_path]
</span><del>-            } elseif {[option os.platform] == &quot;freebsd&quot;} {
</del><ins>+            } elseif {[option os.platform] eq &quot;freebsd&quot;} {
</ins><span class="cx">                 return [findBinary make $portutil::autoconf::make_path]
</span><span class="cx">             } else {
</span><span class="cx">                 return [findBinary pmake $portutil::autoconf::bsdmake_path]
</span><span class="cx">             }
</span><span class="cx">         }
</span><span class="cx">         gnu {
</span><del>-            if {[option os.platform] == &quot;darwin&quot;} {
</del><ins>+            if {[option os.platform] eq &quot;darwin&quot;} {
</ins><span class="cx">                 return [findBinary gnumake $portutil::autoconf::gnumake_path]
</span><del>-            } elseif {[option os.platform] == &quot;linux&quot;} {
</del><ins>+            } elseif {[option os.platform] eq &quot;linux&quot;} {
</ins><span class="cx">                 return [findBinary make $portutil::autoconf::make_path]
</span><span class="cx">             } else {
</span><span class="cx">                 return [findBinary gmake $portutil::autoconf::gnumake_path]
</span><span class="lines">@@ -111,12 +111,12 @@
</span><span class="cx">         }
</span><span class="cx">         pbx -
</span><span class="cx">         xcode {
</span><del>-            if {[option os.platform] != &quot;darwin&quot;} {
</del><ins>+            if {[option os.platform] ne &quot;darwin&quot;} {
</ins><span class="cx">                 return -code error &quot;[format [msgcat::mc &quot;This port requires 'xcodebuild', which is not available on %s.&quot;] [option os.platform]]&quot;
</span><span class="cx">             }
</span><span class="cx"> 
</span><span class="cx">             global xcodebuildcmd
</span><del>-            if {$xcodebuildcmd != &quot;none&quot;} {
</del><ins>+            if {$xcodebuildcmd ne &quot;none&quot;} {
</ins><span class="cx">                 return $xcodebuildcmd
</span><span class="cx">             } else {
</span><span class="cx">                 return -code error &quot;xcodebuild was not found on this system!&quot;
</span><span class="lines">@@ -140,7 +140,7 @@
</span><span class="cx">             ui_warn &quot;defaulting to $jobs jobs, consider setting buildmakejobs to a nonzero value in macports.conf&quot;
</span><span class="cx">         }
</span><span class="cx">         if {[info exists memsize] &amp;&amp; $jobs &gt; $memsize / 1000000000 + 1} {
</span><del>-            set jobs [expr $memsize / 1000000000 + 1]
</del><ins>+            set jobs [expr {$memsize / 1000000000 + 1}]
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx">     if {![string is integer -strict $jobs] || $jobs &lt;= 1} {
</span><span class="lines">@@ -150,8 +150,8 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> proc portbuild::build_getargs {args} {
</span><del>-    if {(([option build.type] == &quot;default&quot; &amp;&amp; [option os.platform] != &quot;freebsd&quot;) || \
-         ([option build.type] == &quot;gnu&quot;)) \
</del><ins>+    if {(([option build.type] eq &quot;default&quot; &amp;&amp; [option os.platform] ne &quot;freebsd&quot;) || \
+         ([option build.type] eq &quot;gnu&quot;)) \
</ins><span class="cx">         &amp;&amp; [regexp &quot;^(/\\S+/|)(g|gnu|)make(\\s+.*|)$&quot; [option build.cmd]]} {
</span><span class="cx">         # Print &quot;Entering directory&quot; lines for better log debugging
</span><span class="cx">         return &quot;-w [option build.target]&quot;
</span></span></pre></div>
<a id="branchesnewhelpsystembasesrcport10portchecksumtcl"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/src/port1.0/portchecksum.tcl (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/port1.0/portchecksum.tcl        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/src/port1.0/portchecksum.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -53,13 +53,13 @@
</span><span class="cx"> set_ui_prefix
</span><span class="cx"> 
</span><span class="cx"> # The list of the types of checksums we know.
</span><del>-set checksum_types &quot;md5 sha1 rmd160 sha256&quot;
</del><ins>+set checksum_types [list md5 sha1 rmd160 sha256 size]
</ins><span class="cx"> 
</span><span class="cx"> # The number of types we know.
</span><span class="cx"> set checksum_types_count [llength $checksum_types]
</span><span class="cx"> 
</span><span class="cx"> # types to recommend if none are specified in the portfile
</span><del>-set default_checksum_types {rmd160 sha256}
</del><ins>+set default_checksum_types [list rmd160 sha256]
</ins><span class="cx"> 
</span><span class="cx"> # Using global all_dist_files, parse the checksums and store them into the
</span><span class="cx"> # global array checksums_array.
</span><span class="lines">@@ -82,8 +82,8 @@
</span><span class="cx">     set nb_checksum [llength $checksums_str]
</span><span class="cx"> 
</span><span class="cx">     if {[llength $all_dist_files] == 1
</span><del>-        &amp;&amp; [expr $nb_checksum % 2] == 0
-        &amp;&amp; [expr $nb_checksum / 2] &lt;= $checksum_types_count
</del><ins>+        &amp;&amp; [expr {$nb_checksum % 2}] == 0
+        &amp;&amp; [expr {$nb_checksum / 2}] &lt;= $checksum_types_count
</ins><span class="cx">         &amp;&amp; [lsearch -exact $checksum_types [lindex $checksums_str 0]] &gt;= 0} {
</span><span class="cx">         # Convert to format #2
</span><span class="cx">         set checksums_str [linsert $checksums_str 0 [lindex $all_dist_files 0]]
</span><span class="lines">@@ -185,6 +185,15 @@
</span><span class="cx">     return [sha256 file $file]
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+# calc_size
+#
+# Get the size of the given file.
+# Return the size.
+#
+proc portchecksum::calc_size {file} {
+    return [file size $file]
+}
+
</ins><span class="cx"> # checksum_start
</span><span class="cx"> #
</span><span class="cx"> # Target prerun procedure; simply prints a message about what we're doing.
</span><span class="lines">@@ -226,7 +235,7 @@
</span><span class="cx"> 
</span><span class="cx">     # if everything is fine with the syntax, keep on and check the checksum of
</span><span class="cx">     # the distfiles.
</span><del>-    if {[parse_checksums $checksums_str] == &quot;yes&quot;} {
</del><ins>+    if {[parse_checksums $checksums_str] eq &quot;yes&quot;} {
</ins><span class="cx">         set distpath [option distpath]
</span><span class="cx"> 
</span><span class="cx">         foreach distfile $all_dist_files {
</span><span class="lines">@@ -264,7 +273,11 @@
</span><span class="cx">                 foreach {type sum} $portfile_checksums {
</span><span class="cx">                     set calculated_sum [calc_$type $fullpath]
</span><span class="cx">                     lappend sums [format &quot;%-8s%s&quot; $type $calculated_sum]
</span><del>-                    if {[string equal $sum $calculated_sum]} {
</del><ins>+
+                    # Used for regression testing
+                    ui_debug &quot;[format [msgcat::mc &quot;Calculated (%s) is %s&quot;] $type $calculated_sum]&quot;
+
+                    if {$sum eq $calculated_sum} {
</ins><span class="cx">                         ui_debug &quot;[format [msgcat::mc &quot;Correct (%s) checksum for %s&quot;] $type $distfile]&quot;
</span><span class="cx">                     } else {
</span><span class="cx">                         ui_error &quot;[format [msgcat::mc &quot;Checksum (%s) mismatch for %s&quot;] $type $distfile]&quot;
</span></span></pre></div>
<a id="branchesnewhelpsystembasesrcport10portcleantcl"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/src/port1.0/portclean.tcl (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/port1.0/portclean.tcl        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/src/port1.0/portclean.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -67,26 +67,26 @@
</span><span class="cx">         ui_warn &quot;Only cleaning in ~/.macports; insufficient privileges for standard locations&quot;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if {[info exists ports_clean_all] &amp;&amp; $ports_clean_all == &quot;yes&quot; || \
-        [info exists ports_clean_dist] &amp;&amp; $ports_clean_dist == &quot;yes&quot;} {
</del><ins>+    if {[info exists ports_clean_all] &amp;&amp; $ports_clean_all eq &quot;yes&quot; || \
+        [info exists ports_clean_dist] &amp;&amp; $ports_clean_dist eq &quot;yes&quot;} {
</ins><span class="cx">         ui_info &quot;$UI_PREFIX [format [msgcat::mc &quot;Removing distfiles for %s&quot;] [option subport]]&quot;
</span><span class="cx">         clean_dist
</span><span class="cx">     }
</span><del>-    if {([info exists ports_clean_all] &amp;&amp; $ports_clean_all == &quot;yes&quot; || \
-        [info exists ports_clean_archive] &amp;&amp; $ports_clean_archive == &quot;yes&quot;)
</del><ins>+    if {([info exists ports_clean_all] &amp;&amp; $ports_clean_all eq &quot;yes&quot; || \
+        [info exists ports_clean_archive] &amp;&amp; $ports_clean_archive eq &quot;yes&quot;)
</ins><span class="cx">         &amp;&amp; !$usealtworkpath} {
</span><span class="cx">         ui_info &quot;$UI_PREFIX [format [msgcat::mc &quot;Removing temporary archives for %s&quot;] [option subport]]&quot;
</span><span class="cx">         clean_archive
</span><span class="cx">     }
</span><del>-    if {[info exists ports_clean_all] &amp;&amp; $ports_clean_all == &quot;yes&quot; || \
-        [info exists ports_clean_work] &amp;&amp; $ports_clean_work == &quot;yes&quot; || \
-        [info exists ports_clean_archive] &amp;&amp; $ports_clean_archive == &quot;yes&quot; || \
-        [info exists ports_clean_dist] &amp;&amp; $ports_clean_dist == &quot;yes&quot; || \
-        !([info exists ports_clean_logs] &amp;&amp; $ports_clean_logs == &quot;yes&quot;)} {
</del><ins>+    if {[info exists ports_clean_all] &amp;&amp; $ports_clean_all eq &quot;yes&quot; || \
+        [info exists ports_clean_work] &amp;&amp; $ports_clean_work eq &quot;yes&quot; || \
+        [info exists ports_clean_archive] &amp;&amp; $ports_clean_archive eq &quot;yes&quot; || \
+        [info exists ports_clean_dist] &amp;&amp; $ports_clean_dist eq &quot;yes&quot; || \
+        !([info exists ports_clean_logs] &amp;&amp; $ports_clean_logs eq &quot;yes&quot;)} {
</ins><span class="cx">          ui_info &quot;$UI_PREFIX [format [msgcat::mc &quot;Removing work directory for %s&quot;] [option subport]]&quot;
</span><span class="cx">          clean_work
</span><span class="cx">     }
</span><del>-    if {(([info exists ports_clean_logs] &amp;&amp; $ports_clean_logs == &quot;yes&quot;) || ($keeplogs == &quot;no&quot;))
</del><ins>+    if {(([info exists ports_clean_logs] &amp;&amp; $ports_clean_logs eq &quot;yes&quot;) || ($keeplogs eq &quot;no&quot;))
</ins><span class="cx">         &amp;&amp; !$usealtworkpath} {
</span><span class="cx">         clean_logs
</span><span class="cx">     }
</span><span class="lines">@@ -165,7 +165,7 @@
</span><span class="cx">     # or if user forces us to
</span><span class="cx">     set dirlist [list]
</span><span class="cx">     if {$dist_subdir != $name} {
</span><del>-        if {!([info exists ports_force] &amp;&amp; $ports_force == &quot;yes&quot;)
</del><ins>+        if {!([info exists ports_force] &amp;&amp; $ports_force eq &quot;yes&quot;)
</ins><span class="cx">             &amp;&amp; [file isdirectory $distpath]
</span><span class="cx">             &amp;&amp; [llength [readdir $distpath]] &gt; 0} {
</span><span class="cx">             ui_warn [format [msgcat::mc &quot;Distfiles directory '%s' may contain distfiles needed for other ports, use the -f flag to force removal&quot; ] $distpath]
</span><span class="lines">@@ -291,7 +291,7 @@
</span><span class="cx">             # delete anything ending in .TMP since those are incomplete and
</span><span class="cx">             # thus can't be checked and aren't useful anyway.
</span><span class="cx">             set archivetype [string range [file extension $path] 1 end]
</span><del>-            if {[file isfile $path] &amp;&amp; ($archivetype == &quot;TMP&quot;
</del><ins>+            if {[file isfile $path] &amp;&amp; ($archivetype eq &quot;TMP&quot;
</ins><span class="cx">                 || [extract_archive_metadata $path $archivetype portname] == $subport)} {
</span><span class="cx">                 ui_debug &quot;Removing archive: $path&quot;
</span><span class="cx">                 if {[catch {delete $path} result]} {
</span></span></pre></div>
<a id="branchesnewhelpsystembasesrcport10portconfiguretcl"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/src/port1.0/portconfigure.tcl (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/port1.0/portconfigure.tcl        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/src/port1.0/portconfigure.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -1,7 +1,7 @@
</span><span class="cx"> # -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4
</span><span class="cx"> # $Id$
</span><span class="cx"> #
</span><del>-# Copyright (c) 2007 - 2013 The MacPorts Project
</del><ins>+# Copyright (c) 2007 - 2014 The MacPorts Project
</ins><span class="cx"> # Copyright (c) 2007 Markus W. Weissmann &lt;mww@macports.org&gt;
</span><span class="cx"> # Copyright (c) 2002 - 2003 Apple Inc.
</span><span class="cx"> # All rights reserved.
</span><span class="lines">@@ -51,9 +51,11 @@
</span><span class="cx"> default configure.nice      {${buildnicevalue}}
</span><span class="cx"> default configure.dir       {${worksrcpath}}
</span><span class="cx"> default autoreconf.dir      {${worksrcpath}}
</span><del>-default autoreconf.pre_args {--install}
</del><ins>+default autoreconf.args     {{--install --verbose}}
</ins><span class="cx"> default autoconf.dir        {${worksrcpath}}
</span><ins>+default autoconf.args       {--verbose}
</ins><span class="cx"> default automake.dir        {${worksrcpath}}
</span><ins>+default automake.args       {--verbose}
</ins><span class="cx"> default xmkmf.cmd           xmkmf
</span><span class="cx"> default xmkmf.dir           {${worksrcpath}}
</span><span class="cx"> default use_configure       yes
</span><span class="lines">@@ -74,8 +76,8 @@
</span><span class="cx">     global ${type}.cmd option_defaults
</span><span class="cx"> 
</span><span class="cx">     if {![info exists ${type}.cmd] || (
</span><del>-        ([info exists option_defaults(${type}.cmd)] &amp;&amp; [set ${type}.cmd] == $option_defaults(${type}.cmd)) ||
-        (![info exists option_defaults(${type}.cmd)] &amp;&amp; [set ${type}.cmd] == &quot;${type}&quot;)
</del><ins>+        ([info exists option_defaults(${type}.cmd)] &amp;&amp; [set ${type}.cmd] eq $option_defaults(${type}.cmd)) ||
+        (![info exists option_defaults(${type}.cmd)] &amp;&amp; [set ${type}.cmd] eq ${type})
</ins><span class="cx">         )} {
</span><span class="cx">             eval [linsert $dep 0 depends_build-append]
</span><span class="cx">     }
</span><span class="lines">@@ -92,7 +94,7 @@
</span><span class="cx">         xmkmf       port:imake
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if {[string equal ${action} &quot;set&quot;]} {
</del><ins>+    if {$action eq &quot;set&quot;} {
</ins><span class="cx">         switch $option {
</span><span class="cx">             autoreconf.cmd  -
</span><span class="cx">             automake.cmd    -
</span><span class="lines">@@ -139,7 +141,7 @@
</span><span class="cx"> default configure.cxxflags      {${configure.optflags}}
</span><span class="cx"> default configure.objcflags     {${configure.optflags}}
</span><span class="cx"> default configure.objcxxflags   {${configure.optflags}}
</span><del>-default configure.cppflags      {-I${prefix}/include}
</del><ins>+default configure.cppflags      {-isystem${prefix}/include}
</ins><span class="cx"> default configure.ldflags       {&quot;-L${prefix}/lib -Wl,-headerpad_max_install_names&quot;}
</span><span class="cx"> default configure.libs          {}
</span><span class="cx"> default configure.fflags        {${configure.optflags}}
</span><span class="lines">@@ -160,10 +162,12 @@
</span><span class="cx"> default configure.pkg_config        {}
</span><span class="cx"> default configure.pkg_config_path   {}
</span><span class="cx"> 
</span><del>-options configure.build_arch configure.ld_archflags configure.sdkroot
</del><ins>+options configure.build_arch configure.ld_archflags \
+        configure.sdk_version configure.sdkroot
</ins><span class="cx"> default configure.build_arch    {[portconfigure::choose_supported_archs ${build_arch}]}
</span><span class="cx"> default configure.ld_archflags  {[portconfigure::configure_get_ld_archflags]}
</span><del>-default configure.sdkroot       {[portconfigure::configure_get_sdkroot]}
</del><ins>+default configure.sdk_version   {$macosx_sdk_version}
+default configure.sdkroot       {[portconfigure::configure_get_sdkroot ${configure.sdk_version}]}
</ins><span class="cx"> foreach tool {cc cxx objc objcxx f77 f90 fc} {
</span><span class="cx">     options configure.${tool}_archflags
</span><span class="cx">     default configure.${tool}_archflags  &quot;\[portconfigure::configure_get_archflags $tool\]&quot;
</span><span class="lines">@@ -227,7 +231,7 @@
</span><span class="cx">         {^macports-llvm-gcc-4\.2$}          {MacPorts LLVM-GCC 4.2}
</span><span class="cx">     }
</span><span class="cx">     foreach {re fmt} $valid_compilers {
</span><del>-        if {[set matches [regexp -inline $re $compiler]] ne {}} {
</del><ins>+        if {[set matches [regexp -inline $re $compiler]] ne &quot;&quot;} {
</ins><span class="cx">             set compiler_name [eval [linsert [lrange $matches 1 end] 0 format $fmt]]
</span><span class="cx">             break
</span><span class="cx">         }
</span><span class="lines">@@ -242,10 +246,10 @@
</span><span class="cx">     if {${configure.ccache}} {
</span><span class="cx">         # Create ccache directory with correct permissions with root privileges
</span><span class="cx">         elevateToRoot &quot;configure ccache&quot;
</span><del>-        if [catch {
</del><ins>+        if {[catch {
</ins><span class="cx">                 file mkdir ${ccache_dir}
</span><span class="cx">                 file attributes ${ccache_dir} -owner ${macportsuser} -permissions 0755
</span><del>-            } result] {
</del><ins>+            } result]} {
</ins><span class="cx">             ui_warn &quot;ccache_dir ${ccache_dir} could not be created; disabling ccache: $result&quot;
</span><span class="cx">             set configure.ccache no
</span><span class="cx">         }
</span><span class="lines">@@ -253,9 +257,9 @@
</span><span class="cx"> 
</span><span class="cx">         # Initialize ccache directory with the given maximum size
</span><span class="cx">         if {${configure.ccache}} {
</span><del>-            if [catch {
</del><ins>+            if {[catch {
</ins><span class="cx">                 exec ccache -M ${ccache_size} &gt;/dev/null
</span><del>-            } result] {
</del><ins>+            } result]} {
</ins><span class="cx">                 ui_warn &quot;ccache_dir ${ccache_dir} could not be initialized; disabling ccache: $result&quot;
</span><span class="cx">                 set configure.ccache no
</span><span class="cx">             }
</span><span class="lines">@@ -268,16 +272,16 @@
</span><span class="cx"> # universal_archs
</span><span class="cx"> proc portconfigure::choose_supported_archs {archs} {
</span><span class="cx">     global supported_archs
</span><del>-    if {$supported_archs == &quot;&quot;} {
</del><ins>+    if {$supported_archs eq &quot;&quot;} {
</ins><span class="cx">         return $archs
</span><span class="cx">     }
</span><span class="cx">     set ret {}
</span><span class="cx">     foreach arch $archs {
</span><span class="cx">         if {[lsearch -exact $supported_archs $arch] != -1} {
</span><span class="cx">             set add_arch $arch
</span><del>-        } elseif {$arch == &quot;x86_64&quot; &amp;&amp; [lsearch -exact $supported_archs &quot;i386&quot;] != -1} {
</del><ins>+        } elseif {$arch eq &quot;x86_64&quot; &amp;&amp; [lsearch -exact $supported_archs &quot;i386&quot;] != -1} {
</ins><span class="cx">             set add_arch &quot;i386&quot;
</span><del>-        } elseif {$arch == &quot;ppc64&quot; &amp;&amp; [lsearch -exact $supported_archs &quot;ppc&quot;] != -1} {
</del><ins>+        } elseif {$arch eq &quot;ppc64&quot; &amp;&amp; [lsearch -exact $supported_archs &quot;ppc&quot;] != -1} {
</ins><span class="cx">             set add_arch &quot;ppc&quot;
</span><span class="cx">         } else {
</span><span class="cx">             continue
</span><span class="lines">@@ -297,14 +301,14 @@
</span><span class="cx">         set flags &quot;-m64&quot;
</span><span class="cx">     } elseif {[tbool configure.m32]} {
</span><span class="cx">         set flags &quot;-m32&quot;
</span><del>-    } elseif {${configure.build_arch} != &quot;&quot;} {
</del><ins>+    } elseif {${configure.build_arch} ne &quot;&quot;} {
</ins><span class="cx">         if {[arch_flag_supported ${configure.compiler}] &amp;&amp;
</span><span class="cx">             [regexp {^(?:cc|cxx|objc|objcxx)$} $tool]
</span><span class="cx">         } then {
</span><span class="cx">             set flags &quot;-arch ${configure.build_arch}&quot;
</span><del>-        } elseif {${configure.build_arch} == &quot;x86_64&quot; || ${configure.build_arch} == &quot;ppc64&quot;} {
</del><ins>+        } elseif {${configure.build_arch} eq &quot;x86_64&quot; || ${configure.build_arch} eq &quot;ppc64&quot;} {
</ins><span class="cx">             set flags &quot;-m64&quot;
</span><del>-        } elseif {${configure.compiler} != &quot;gcc-3.3&quot;} {
</del><ins>+        } elseif {${configure.compiler} ne &quot;gcc-3.3&quot;} {
</ins><span class="cx">             set flags &quot;-m32&quot;
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="lines">@@ -317,32 +321,32 @@
</span><span class="cx"> # ld directly. So we punt and let portfiles deal with that case.
</span><span class="cx"> proc portconfigure::configure_get_ld_archflags {args} {
</span><span class="cx">     global configure.build_arch configure.compiler
</span><del>-    if {${configure.build_arch} != &quot;&quot; &amp;&amp; [arch_flag_supported ${configure.compiler}]} {
</del><ins>+    if {${configure.build_arch} ne &quot;&quot; &amp;&amp; [arch_flag_supported ${configure.compiler}]} {
</ins><span class="cx">         return &quot;-arch ${configure.build_arch}&quot;
</span><span class="cx">     } else {
</span><span class="cx">         return &quot;&quot;
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-proc portconfigure::configure_get_sdkroot {} {
-    global developer_dir macosx_deployment_target macosx_version xcodeversion os.arch os.platform
-    if {${os.platform} == &quot;darwin&quot; &amp;&amp; ($macosx_deployment_target != $macosx_version
-        || (${os.arch} == &quot;powerpc&quot; &amp;&amp; $macosx_version == &quot;10.4&quot; &amp;&amp; [variant_exists universal] &amp;&amp; [variant_isset universal]))} {
</del><ins>+proc portconfigure::configure_get_sdkroot {sdk_version} {
+    global developer_dir macosx_version xcodeversion os.arch os.platform
+    if {${os.platform} eq &quot;darwin&quot; &amp;&amp; ($sdk_version ne $macosx_version
+        || (${os.arch} eq &quot;powerpc&quot; &amp;&amp; $macosx_version eq &quot;10.4&quot; &amp;&amp; [variant_exists universal] &amp;&amp; [variant_isset universal]))} {
</ins><span class="cx">         if {[vercmp $xcodeversion 4.3] &lt; 0} {
</span><del>-            set sdks_dir &quot;${developer_dir}/SDKs&quot;
</del><ins>+            set sdks_dir ${developer_dir}/SDKs
</ins><span class="cx">         } else {
</span><del>-            set sdks_dir &quot;${developer_dir}/Platforms/MacOSX.platform/Developer/SDKs&quot;
</del><ins>+            set sdks_dir ${developer_dir}/Platforms/MacOSX.platform/Developer/SDKs
</ins><span class="cx">         }
</span><del>-        if {$macosx_deployment_target == &quot;10.4&quot;} {
-            set sdk &quot;${sdks_dir}/MacOSX10.4u.sdk&quot;
</del><ins>+        if {$sdk_version eq &quot;10.4&quot;} {
+            set sdk ${sdks_dir}/MacOSX10.4u.sdk
</ins><span class="cx">         } else {
</span><del>-            set sdk &quot;${sdks_dir}/MacOSX${macosx_deployment_target}.sdk&quot;
</del><ins>+            set sdk ${sdks_dir}/MacOSX${sdk_version}.sdk
</ins><span class="cx">         }
</span><span class="cx">         if {[file exists $sdk]} {
</span><span class="cx">             return $sdk
</span><span class="cx">         }
</span><span class="cx">     }
</span><del>-    return &quot;&quot;
</del><ins>+    return {}
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> # internal function to determine the &quot;-arch xy&quot; flags for the compiler
</span><span class="lines">@@ -350,7 +354,7 @@
</span><span class="cx">     global configure.universal_archs
</span><span class="cx">     set flags &quot;&quot;
</span><span class="cx">     foreach arch ${configure.universal_archs} {
</span><del>-        if {$flags == &quot;&quot;} {
</del><ins>+        if {$flags eq &quot;&quot;} {
</ins><span class="cx">             set flags &quot;-arch $arch&quot;
</span><span class="cx">         } else {
</span><span class="cx">             append flags &quot; -arch $arch&quot;
</span><span class="lines">@@ -374,18 +378,15 @@
</span><span class="cx">     return [regexp {^gcc-4|llvm|apple|clang} $compiler]
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-# Mapping from compiler names to compiler ports, for private use by
-# compiler_port_name. Do not access directly.
-set portconfigure::valid_compiler_ports {
-    {^apple-gcc-(\d+)\.(\d+)$}                          {apple-gcc%s%s}
-    {^macports-clang-(\d+\.\d+)$}                       {clang-%s}
-    {^macports-dragonegg-(\d+\.\d+)(-gcc-\d+\.\d+)?$}   {dragonegg-%s%s}
-    {^macports-(llvm-)?gcc-(\d+)\.(\d+)$}               {%sgcc%s%s}
-}
-
</del><span class="cx"> proc portconfigure::compiler_port_name {compiler} {
</span><del>-    foreach {re fmt} $portconfigure::valid_compiler_ports {
-        if {[set matches [regexp -inline $re $compiler]] ne {}} {
</del><ins>+    set valid_compiler_ports {
+        {^apple-gcc-(\d+)\.(\d+)$}                          {apple-gcc%s%s}
+        {^macports-clang-(\d+\.\d+)$}                       {clang-%s}
+        {^macports-dragonegg-(\d+\.\d+)(-gcc-\d+\.\d+)?$}   {dragonegg-%s%s}
+        {^macports-(llvm-)?gcc-(\d+)\.(\d+)$}               {%sgcc%s%s}
+    }
+    foreach {re fmt} $valid_compiler_ports {
+        if {[set matches [regexp -inline $re $compiler]] ne &quot;&quot;} {
</ins><span class="cx">             return [eval [linsert [lrange $matches 1 end] 0 format $fmt]]
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="lines">@@ -393,12 +394,12 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> proc portconfigure::compiler_is_port {compiler} {
</span><del>-    return [expr {[portconfigure::compiler_port_name ${compiler}] != &quot;&quot;}]
</del><ins>+    return [expr {[portconfigure::compiler_port_name ${compiler}] ne &quot;&quot;}]
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> # internal function to determine the default compiler
</span><span class="cx"> proc portconfigure::configure_get_default_compiler {args} {
</span><del>-    if {[option compiler.whitelist] != {}} {
</del><ins>+    if {[option compiler.whitelist] ne &quot;&quot;} {
</ins><span class="cx">         set search_list [option compiler.whitelist]
</span><span class="cx">     } else {
</span><span class="cx">         set search_list [option compiler.fallback]
</span><span class="lines">@@ -424,21 +425,19 @@
</span><span class="cx"> 
</span><span class="cx"> # internal function to choose compiler fallback list based on platform
</span><span class="cx"> proc portconfigure::get_compiler_fallback {} {
</span><del>-    global xcodeversion macosx_deployment_target default_compilers
</del><ins>+    global xcodeversion macosx_deployment_target default_compilers configure.sdkroot
</ins><span class="cx">     if {[info exists default_compilers]} {
</span><span class="cx">         return $default_compilers
</span><del>-    } elseif {$xcodeversion == &quot;none&quot; || $xcodeversion == &quot;&quot;} {
</del><ins>+    } elseif {$xcodeversion eq &quot;none&quot; || $xcodeversion eq &quot;&quot;} {
</ins><span class="cx">         return {cc}
</span><del>-    } elseif {[vercmp $xcodeversion 4.6] &gt;= 0} {
</del><ins>+    } elseif {[vercmp $xcodeversion 5.0] &gt;= 0} {
</ins><span class="cx">         return {clang macports-llvm-gcc-4.2 apple-gcc-4.2 macports-clang-3.3}
</span><span class="cx">     } elseif {[vercmp $xcodeversion 4.2] &gt;= 0} {
</span><span class="cx">         return {clang llvm-gcc-4.2 apple-gcc-4.2 macports-clang-3.3}
</span><span class="cx">     } elseif {[vercmp $xcodeversion 4.0] &gt;= 0} {
</span><span class="cx">         return {llvm-gcc-4.2 clang gcc-4.2 macports-clang-3.3 apple-gcc-4.2}
</span><span class="cx">     } elseif {[vercmp $xcodeversion 3.2] &gt;= 0} {
</span><del>-        if {$macosx_deployment_target == &quot;10.4&quot;} {
-            # It's not the deployment target that is the issue, it's the
-            # 10.4u SDK which base chooses if the deployment_target is set
</del><ins>+        if {[string match *10.4u* ${configure.sdkroot}]} {
</ins><span class="cx">             return {gcc-4.0}
</span><span class="cx">         } else {
</span><span class="cx">             return {gcc-4.2 clang llvm-gcc-4.2 macports-clang-3.3 macports-llvm-gcc-4.2 apple-gcc-4.2 gcc-4.0}
</span><span class="lines">@@ -446,7 +445,7 @@
</span><span class="cx">     } elseif {[vercmp $xcodeversion 3.0] &gt;= 0} {
</span><span class="cx">         return {gcc-4.2 apple-gcc-4.2 gcc-4.0 macports-clang-3.3}
</span><span class="cx">     } else {
</span><del>-        return {gcc-4.0 apple-gcc-4.2 gcc-3.3 macports-clang-3.3}
</del><ins>+        return {apple-gcc-4.2 gcc-4.0 gcc-3.3 macports-clang-3.3}
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -477,7 +476,7 @@
</span><span class="cx"> # internal function to find correct compilers
</span><span class="cx"> proc portconfigure::configure_get_compiler {type {compiler {}}} {
</span><span class="cx">     global configure.compiler prefix
</span><del>-    if {$compiler == {}} {
</del><ins>+    if {$compiler eq &quot;&quot;} {
</ins><span class="cx">         set compiler ${configure.compiler}
</span><span class="cx">     }
</span><span class="cx">     # Tcl 8.4's switch doesn't support -matchvar.
</span><span class="lines">@@ -487,7 +486,7 @@
</span><span class="cx">             objc    { return ${prefix}/bin/gcc-apple${suffix} }
</span><span class="cx">             cxx     -
</span><span class="cx">             objcxx  {
</span><del>-                if {$suffix == &quot;-4.2&quot;} {
</del><ins>+                if {$suffix eq &quot;-4.2&quot;} {
</ins><span class="cx">                     return ${prefix}/bin/g++-apple${suffix}
</span><span class="cx">                 }
</span><span class="cx">             }
</span><span class="lines">@@ -523,7 +522,7 @@
</span><span class="cx">             cpp     { return [find_developer_tool llvm-cpp-4.2] }
</span><span class="cx">         }
</span><span class="cx">     } elseif {[regexp {^macports-clang(-\d+\.\d+)?$} $compiler -&gt; suffix]} {
</span><del>-        if {$suffix ne {}} {
</del><ins>+        if {$suffix ne &quot;&quot;} {
</ins><span class="cx">             set suffix &quot;-mp${suffix}&quot;
</span><span class="cx">         }
</span><span class="cx">         switch $type {
</span><span class="lines">@@ -534,7 +533,7 @@
</span><span class="cx">         }
</span><span class="cx">     } elseif {[regexp {^macports-dragonegg(-\d+\.\d+)(?:-gcc(-\d+\.\d+))?$} $compiler \
</span><span class="cx">                 -&gt; infix suffix]} {
</span><del>-        if {$suffix ne {}} {
</del><ins>+        if {$suffix ne &quot;&quot;} {
</ins><span class="cx">             set suffix &quot;-mp${suffix}&quot;
</span><span class="cx">         }
</span><span class="cx">         switch $type {
</span><span class="lines">@@ -548,7 +547,7 @@
</span><span class="cx">             f90     { return ${prefix}/bin/dragonegg${infix}-gfortran${suffix} }
</span><span class="cx">         }
</span><span class="cx">     } elseif {[regexp {^macports-gcc(-\d+\.\d+)?$} $compiler -&gt; suffix]} {
</span><del>-        if {$suffix ne {}} {
</del><ins>+        if {$suffix ne &quot;&quot;} {
</ins><span class="cx">             set suffix &quot;-mp${suffix}&quot;
</span><span class="cx">         }
</span><span class="cx">         switch $type {
</span><span class="lines">@@ -707,12 +706,12 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         # https://trac.macports.org/ticket/34221
</span><del>-        if {${os.platform} == &quot;darwin&quot; &amp;&amp; ${os.major} == 12} {
</del><ins>+        if {${os.platform} eq &quot;darwin&quot; &amp;&amp; ${os.major} == 12} {
</ins><span class="cx">             append_to_environment_value configure &quot;__CFPREFERENCES_AVOID_DAEMON&quot; 1
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         # add SDK flags if cross-compiling (or universal on ppc tiger)
</span><del>-        if {${configure.sdkroot} != &quot;&quot;} {
</del><ins>+        if {${configure.sdkroot} ne &quot;&quot;} {
</ins><span class="cx">             foreach env_var {CPPFLAGS CFLAGS CXXFLAGS OBJCFLAGS OBJCXXFLAGS} {
</span><span class="cx">                 append_to_environment_value configure $env_var -isysroot ${configure.sdkroot}
</span><span class="cx">             }
</span><span class="lines">@@ -732,17 +731,17 @@
</span><span class="cx">             eval [linsert ${configure.universal_args} 0 configure.pre_args-append]
</span><span class="cx">         } else {
</span><span class="cx">             foreach env_var {CFLAGS CXXFLAGS OBJCFLAGS OBJCXXFLAGS FFLAGS F90FLAGS FCFLAGS LDFLAGS} {
</span><del>-                if {${configure.march} != {}} {
</del><ins>+                if {${configure.march} ne &quot;&quot;} {
</ins><span class="cx">                     append_to_environment_value configure $env_var -march=${configure.march}
</span><span class="cx">                 }
</span><del>-                if {${configure.mtune} != {}} {
</del><ins>+                if {${configure.mtune} ne &quot;&quot;} {
</ins><span class="cx">                     append_to_environment_value configure $env_var -mtune=${configure.mtune}
</span><span class="cx">                 }
</span><span class="cx">             }
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         # Add flags to specify C++ STL implementation
</span><del>-        if {${configure.cxx_stdlib} ne {} &amp;&amp; [string match *clang* [option configure.cxx]]} {
</del><ins>+        if {${configure.cxx_stdlib} ne &quot;&quot; &amp;&amp; [string match &quot;*clang*&quot; [option configure.cxx]]} {
</ins><span class="cx">             append_to_environment_value configure CXXFLAGS -stdlib=${configure.cxx_stdlib}
</span><span class="cx">             append_to_environment_value configure OBJCXXFLAGS -stdlib=${configure.cxx_stdlib}
</span><span class="cx">         }
</span></span></pre></div>
<a id="branchesnewhelpsystembasesrcport10portdestroottcl"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/src/port1.0/portdestroot.tcl (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/port1.0/portdestroot.tcl        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/src/port1.0/portdestroot.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -93,8 +93,8 @@
</span><span class="cx"> set_ui_prefix
</span><span class="cx"> 
</span><span class="cx"> proc portdestroot::destroot_getargs {args} {
</span><del>-    if {(([option build.type] == &quot;default&quot; &amp;&amp; [option os.platform] != &quot;freebsd&quot;) || \
-         ([option build.type] == &quot;gnu&quot;)) \
</del><ins>+    if {(([option build.type] eq &quot;default&quot; &amp;&amp; [option os.platform] ne &quot;freebsd&quot;) || \
+         ([option build.type] eq &quot;gnu&quot;)) \
</ins><span class="cx">         &amp;&amp; [regexp &quot;^(/\\S+/|)(g|gnu|)make(\\s+.*|)$&quot; [option destroot.cmd]]} {
</span><span class="cx">         # Print &quot;Entering directory&quot; lines for better log debugging
</span><span class="cx">         return &quot;-w [option destroot.target]&quot;
</span><span class="lines">@@ -163,7 +163,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     foreach fileToDelete {share/info/dir lib/charset.alias} {
</span><del>-        if [file exists &quot;${destroot}${prefix}/${fileToDelete}&quot;] {
</del><ins>+        if {[file exists &quot;${destroot}${prefix}/${fileToDelete}&quot;]} {
</ins><span class="cx">             ui_debug &quot;Deleting stray ${fileToDelete} file.&quot;
</span><span class="cx">             file delete &quot;${destroot}${prefix}/${fileToDelete}&quot;
</span><span class="cx">         }
</span><span class="lines">@@ -172,7 +172,7 @@
</span><span class="cx">     # Prevent overlinking due to glibtool .la files: https://trac.macports.org/ticket/38010
</span><span class="cx">     ui_debug &quot;Fixing glibtool .la files in destroot for ${subport}&quot;
</span><span class="cx">     fs-traverse -depth fullpath ${destroot} {
</span><del>-        if {[file extension $fullpath] == &quot;.la&quot; &amp;&amp; [file type $fullpath] == &quot;file&quot;} {
</del><ins>+        if {[file extension $fullpath] eq &quot;.la&quot; &amp;&amp; [file type $fullpath] eq &quot;file&quot;} {
</ins><span class="cx">             # Make sure it is from glibtool ... &quot;a libtool library file&quot; will appear in the first line
</span><span class="cx">             if {![catch {set fp [open $fullpath]}]} {
</span><span class="cx">                 if {[gets $fp line] &gt; 0 &amp;&amp; [string first &quot;a libtool library file&quot; $line] != -1} {
</span><span class="lines">@@ -201,7 +201,7 @@
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx">     fs-traverse -depth dir ${destroot} {
</span><del>-        if {[file type $dir] == &quot;directory&quot;} {
</del><ins>+        if {[file type $dir] eq &quot;directory&quot;} {
</ins><span class="cx">             catch {file delete $dir}
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="lines">@@ -221,18 +221,18 @@
</span><span class="cx">     set gzip [findBinary gzip ${portutil::autoconf::gzip_path}]
</span><span class="cx">     set gunzip &quot;$gzip -d&quot;
</span><span class="cx">     set bunzip2 &quot;[findBinary bzip2 ${portutil::autoconf::bzip2_path}] -d&quot;
</span><del>-    if {[file isdirectory ${manpath}] &amp;&amp; [file type ${manpath}] == &quot;directory&quot;} {
</del><ins>+    if {[file isdirectory ${manpath}] &amp;&amp; [file type ${manpath}] eq &quot;directory&quot;} {
</ins><span class="cx">         ui_info &quot;$UI_PREFIX [format [msgcat::mc &quot;Compressing man pages for %s&quot;] ${subport}]&quot;
</span><span class="cx">         set found 0
</span><span class="cx">         set manlinks [list]
</span><span class="cx">         foreach mandir [readdir &quot;${manpath}&quot;] {
</span><span class="cx">             if {![regexp {^(cat|man)(.)$} ${mandir} match ignore manindex]} { continue }
</span><span class="cx">             set mandirpath [file join ${manpath} ${mandir}]
</span><del>-            if {[file isdirectory ${mandirpath}] &amp;&amp; [file type ${mandirpath}] == &quot;directory&quot;} {
</del><ins>+            if {[file isdirectory ${mandirpath}] &amp;&amp; [file type ${mandirpath}] eq &quot;directory&quot;} {
</ins><span class="cx">                 ui_debug &quot;Scanning ${mandir}&quot;
</span><span class="cx">                 foreach manfile [readdir ${mandirpath}] {
</span><span class="cx">                     set manfilepath [file join ${mandirpath} ${manfile}]
</span><del>-                    if {[file isfile ${manfilepath}] &amp;&amp; [file type ${manfilepath}] == &quot;file&quot;} {
</del><ins>+                    if {[file isfile ${manfilepath}] &amp;&amp; [file type ${manfilepath}] eq &quot;file&quot;} {
</ins><span class="cx">                         if {[regexp &quot;^(.*\[.\]${manindex}\[a-z\]*)\[.\]gz\$&quot; ${manfile} gzfile manfile]} {
</span><span class="cx">                             set found 1
</span><span class="cx">                             system &quot;cd ${manpath} &amp;&amp; \
</span><span class="lines">@@ -258,7 +258,7 @@
</span><span class="cx">                                 file attributes ${gzmanfilepath} -permissions $desired
</span><span class="cx">                             }
</span><span class="cx">                         }
</span><del>-                    } elseif {[file type ${manfilepath}] == &quot;link&quot;} {
</del><ins>+                    } elseif {[file type ${manfilepath}] eq &quot;link&quot;} {
</ins><span class="cx">                         lappend manlinks [file join ${mandir} ${manfile}]
</span><span class="cx">                     }
</span><span class="cx">                 }
</span><span class="lines">@@ -336,14 +336,14 @@
</span><span class="cx">                             set mtree_violation &quot;yes&quot;
</span><span class="cx">                         }
</span><span class="cx">                     }
</span><del>-                } elseif {[string equal -length [expr [string length $dfile] + 1] $dfile/ $prefix]} {
</del><ins>+                } elseif {[string equal -length [expr {[string length $dfile] + 1}] $dfile/ $prefix]} {
</ins><span class="cx">                     # we've found a subpath of our prefix
</span><span class="cx">                     lpush pathsToCheck $dfile
</span><span class="cx">                 } else {
</span><span class="cx">                     set dir_allowed no
</span><span class="cx">                     # these files are (at least potentially) outside of the prefix
</span><span class="cx">                     foreach dir &quot;$applications_dir $frameworks_dir /Library/LaunchAgents /Library/LaunchDaemons /Library/StartupItems&quot; {
</span><del>-                        if {[string equal -length [expr [string length $dfile] + 1] $dfile/ $dir]} {
</del><ins>+                        if {[string equal -length [expr {[string length $dfile] + 1}] $dfile/ $dir]} {
</ins><span class="cx">                             # it's a prefix of one of the allowed paths
</span><span class="cx">                             set dir_allowed yes
</span><span class="cx">                             break
</span></span></pre></div>
<a id="branchesnewhelpsystembasesrcport10portdistchecktcl"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/src/port1.0/portdistcheck.tcl (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/port1.0/portdistcheck.tcl        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/src/port1.0/portdistcheck.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -61,7 +61,7 @@
</span><span class="cx">     ui_debug &quot;Portfile modification date is [clock format $port_moddate]&quot;
</span><span class="cx"> 
</span><span class="cx">     set curl_options {}
</span><del>-    if [tbool fetch.ignore_sslcert] {
</del><ins>+    if {[tbool fetch.ignore_sslcert]} {
</ins><span class="cx">         lappend curl_options &quot;--ignore-ssl-cert&quot;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -127,13 +127,13 @@
</span><span class="cx">                 set size $totalsize
</span><span class="cx">                 set humansize &quot;${size}&quot;
</span><span class="cx">             } elseif {$totalsize &lt; 1024*1024} {
</span><del>-                set size [expr $totalsize / 1024.0]
</del><ins>+                set size [expr {$totalsize / 1024.0}]
</ins><span class="cx">                 set humansize [format &quot;%.1fK&quot; $size]
</span><span class="cx">             } elseif {$totalsize &lt; 1024*1024*1024} {
</span><del>-                set size [expr $totalsize / (1024.0*1024.0)]
</del><ins>+                set size [expr {$totalsize / (1024.0*1024.0)}]
</ins><span class="cx">                 set humansize [format &quot;%.1fM&quot; $size]
</span><span class="cx">             } else {
</span><del>-                set size [expr $totalsize / (1024.0*1024.0*1024.0)]
</del><ins>+                set size [expr {$totalsize / (1024.0*1024.0*1024.0)}]
</ins><span class="cx">                 set humansize [format &quot;%.1fG&quot; $size]
</span><span class="cx">             }
</span><span class="cx">             ui_msg &quot;$subport: $humansize&quot;
</span></span></pre></div>
<a id="branchesnewhelpsystembasesrcport10portdistfilestcl"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/src/port1.0/portdistfiles.tcl (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/port1.0/portdistfiles.tcl        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/src/port1.0/portdistfiles.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -57,8 +57,8 @@
</span><span class="cx">            portdbpath dist_subdir all_dist_files
</span><span class="cx">     
</span><span class="cx">     # give up on ports that do not provide URLs
</span><del>-    if {(![info exists master_sites] || $master_sites == &quot;{}&quot;)
-        &amp;&amp; (![info exists patchfiles] || ![info exists patch_sites] || $patch_sites == &quot;{}&quot;)} {
</del><ins>+    if {(![info exists master_sites] || $master_sites eq &quot;{}&quot;)
+        &amp;&amp; (![info exists patchfiles] || ![info exists patch_sites] || $patch_sites eq &quot;{}&quot;)} {
</ins><span class="cx">         return 0
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -81,7 +81,7 @@
</span><span class="cx">         ui_msg &quot;\[$distfile\] [file join $portdbpath distfiles $dist_subdir $distfile]&quot;
</span><span class="cx"> 
</span><span class="cx">         # print checksums if available
</span><del>-        if {$result == &quot;yes&quot; &amp;&amp; [array get checksums_array $distfile] != &quot;&quot;} {
</del><ins>+        if {$result eq &quot;yes&quot; &amp;&amp; [array get checksums_array $distfile] ne &quot;&quot;} {
</ins><span class="cx">             foreach {type sum} $checksums_array($distfile) {
</span><span class="cx">                 ui_msg &quot; $type: $sum&quot;
</span><span class="cx">             }
</span></span></pre></div>
<a id="branchesnewhelpsystembasesrcport10portextracttcl"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/src/port1.0/portextract.tcl (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/port1.0/portextract.tcl        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/src/port1.0/portextract.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -75,7 +75,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> proc portextract::extract_start {args} {
</span><del>-    global UI_PREFIX extract.dir extract.mkdir use_bzip2 use_lzma use_xz use_zip use_7z use_dmg
</del><ins>+    global UI_PREFIX extract.dir extract.mkdir use_bzip2 use_lzma use_xz use_zip use_7z use_lzip use_dmg
</ins><span class="cx"> 
</span><span class="cx">     ui_notice &quot;$UI_PREFIX [format [msgcat::mc &quot;Extracting %s&quot;] [option subport]]&quot;
</span><span class="cx"> 
</span><span class="lines">@@ -103,6 +103,10 @@
</span><span class="cx">         option extract.cmd [binaryInPath &quot;7za&quot;]
</span><span class="cx">         option extract.pre_args x
</span><span class="cx">         option extract.post_args &quot;&quot;
</span><ins>+    } elseif {[tbool use_lzip]} {
+        option extract.cmd [binaryInPath &quot;lzip&quot;]
+        option extract.pre_args &quot;-dc&quot;
+        #option extract.post_args &quot;&quot;
</ins><span class="cx">     } elseif {[tbool use_dmg]} {
</span><span class="cx">         global distname extract.cmd
</span><span class="cx">         set dmg_mount [mkdtemp &quot;/tmp/mports.XXXXXXXX&quot;]
</span></span></pre></div>
<a id="branchesnewhelpsystembasesrcport10portfetchtcl"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/src/port1.0/portfetch.tcl (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/port1.0/portfetch.tcl        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/src/port1.0/portfetch.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -48,7 +48,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> # define options: distname master_sites
</span><del>-options master_sites patch_sites extract.suffix distfiles patchfiles use_bzip2 use_lzma use_xz use_zip use_7z use_dmg dist_subdir \
</del><ins>+options master_sites patch_sites extract.suffix distfiles patchfiles use_bzip2 use_lzma use_xz use_zip use_7z use_lzip use_dmg dist_subdir \
</ins><span class="cx">     fetch.type fetch.user fetch.password fetch.use_epsv fetch.ignore_sslcert \
</span><span class="cx">     master_sites.mirror_subdir patch_sites.mirror_subdir \
</span><span class="cx">     bzr.url bzr.revision \
</span><span class="lines">@@ -128,6 +128,7 @@
</span><span class="cx"> option_proc use_xz    portfetch::set_extract_type
</span><span class="cx"> option_proc use_zip   portfetch::set_extract_type
</span><span class="cx"> option_proc use_7z    portfetch::set_extract_type
</span><ins>+option_proc use_lzip  portfetch::set_extract_type
</ins><span class="cx"> option_proc use_dmg   portfetch::set_extract_type
</span><span class="cx"> 
</span><span class="cx"> option_proc fetch.type portfetch::set_fetch_type
</span><span class="lines">@@ -155,6 +156,10 @@
</span><span class="cx">                 set extract.suffix .7z
</span><span class="cx">                 depends_extract-append bin:7za:p7zip
</span><span class="cx">             }
</span><ins>+            use_lzip {
+                set extract.suffix .tar.lz
+                depends_extract-append bin:lzip:lzip
+            }
</ins><span class="cx">             use_dmg {
</span><span class="cx">                 set extract.suffix .dmg
</span><span class="cx">             }
</span><span class="lines">@@ -165,7 +170,7 @@
</span><span class="cx"> proc portfetch::set_fetch_type {option action args} {
</span><span class="cx">     global os.platform os.major
</span><span class="cx">     if {[string equal ${action} &quot;set&quot;]} {
</span><del>-        if {$args != &quot;standard&quot;} {
</del><ins>+        if {$args ne &quot;standard&quot;} {
</ins><span class="cx">             distfiles
</span><span class="cx">         }
</span><span class="cx">         switch $args {
</span><span class="lines">@@ -225,7 +230,7 @@
</span><span class="cx">                 set distsite [getdisttag $file]
</span><span class="cx">                 set file [getdistname $file]
</span><span class="cx">                 lappend all_dist_files $file
</span><del>-                if {$distsite != &quot;&quot;} {
</del><ins>+                if {$distsite ne &quot;&quot;} {
</ins><span class="cx">                     lappend fetch_urls $distsite $file
</span><span class="cx">                 } elseif {[info exists patch_sites]} {
</span><span class="cx">                     lappend fetch_urls patch_sites $file
</span><span class="lines">@@ -248,7 +253,7 @@
</span><span class="cx">                 set distsite [getdisttag $file]
</span><span class="cx">                 set file [getdistname $file]
</span><span class="cx">                 lappend all_dist_files $file
</span><del>-                if {$distsite != &quot;&quot;} {
</del><ins>+                if {$distsite ne &quot;&quot;} {
</ins><span class="cx">                     lappend fetch_urls $distsite $file
</span><span class="cx">                 } else {
</span><span class="cx">                     lappend fetch_urls master_sites $file
</span><span class="lines">@@ -385,7 +390,7 @@
</span><span class="cx">     }
</span><span class="cx">     regexp {(.*://)?([[:alnum:].-]+)(:(\d+))?} $proxy_str - - proxy_host - proxy_port
</span><span class="cx">     set ret &quot;--config-option servers:global:http-proxy-host=${proxy_host}&quot;
</span><del>-    if {$proxy_port != &quot;&quot;} {
</del><ins>+    if {$proxy_port ne &quot;&quot;} {
</ins><span class="cx">         append ret &quot; --config-option servers:global:http-proxy-port=${proxy_port}&quot;
</span><span class="cx">     }
</span><span class="cx">     return $ret
</span><span class="lines">@@ -496,8 +501,12 @@
</span><span class="cx">     if {${fetch.remote_time} != &quot;no&quot;} {
</span><span class="cx">         lappend fetch_options &quot;--remote-time&quot;
</span><span class="cx">     }
</span><del>-    if {$portverbose == &quot;yes&quot;} {
-        lappend fetch_options &quot;-v&quot;
</del><ins>+    if {$portverbose eq &quot;yes&quot;} {
+        lappend fetch_options &quot;--progress&quot;
+        lappend fetch_options &quot;builtin&quot;
+    } elseif {[llength [info commands ui_progress_download]] &gt; 0} {
+        lappend fetch_options &quot;--progress&quot;
+        lappend fetch_options &quot;ui_progress_download&quot;
</ins><span class="cx">     }
</span><span class="cx">     set sorted no
</span><span class="cx"> 
</span></span></pre></div>
<a id="branchesnewhelpsystembasesrcport10portinstalltcl"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/src/port1.0/portinstall.tcl (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/port1.0/portinstall.tcl        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/src/port1.0/portinstall.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -238,7 +238,7 @@
</span><span class="cx">     array set ourvariations $PortInfo(active_variants)
</span><span class="cx">     set vlist [lsort -ascii [array names ourvariations]]
</span><span class="cx">     foreach v $vlist {
</span><del>-        if {$ourvariations($v) == &quot;+&quot;} {
</del><ins>+        if {$ourvariations($v) eq &quot;+&quot;} {
</ins><span class="cx">             puts $fd &quot;@portvariant +${v}&quot;
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="lines">@@ -263,7 +263,7 @@
</span><span class="cx">     # also save the contents for our own use later
</span><span class="cx">     set installPlist {}
</span><span class="cx">     fs-traverse -depth fullpath $destpath {
</span><del>-        if {[file type $fullpath] == &quot;directory&quot;} {
</del><ins>+        if {[file type $fullpath] eq &quot;directory&quot;} {
</ins><span class="cx">             continue
</span><span class="cx">         }
</span><span class="cx">         set relpath [strsed $fullpath &quot;s|^$destpath/||&quot;]
</span><span class="lines">@@ -310,13 +310,13 @@
</span><span class="cx">     os.platform os.major portarchivetype installPlist
</span><span class="cx"> 
</span><span class="cx">     set oldpwd [pwd]
</span><del>-    if {$oldpwd == &quot;&quot;} {
</del><ins>+    if {$oldpwd eq &quot;&quot;} {
</ins><span class="cx">         set oldpwd $portpath
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     set location [get_portimage_path]
</span><span class="cx">     set archive_path [find_portarchive_path]
</span><del>-    if {$archive_path != &quot;&quot;} {
</del><ins>+    if {$archive_path ne &quot;&quot;} {
</ins><span class="cx">         set install_dir [file dirname $location]
</span><span class="cx">         file mkdir $install_dir
</span><span class="cx">         file rename -force $archive_path $install_dir
</span><span class="lines">@@ -336,7 +336,7 @@
</span><span class="cx">         if {[info exists $deplist]} {
</span><span class="cx">             foreach dep [set $deplist] {
</span><span class="cx">                 set dep_portname [_get_dep_port $dep]
</span><del>-                if {$dep_portname != &quot;&quot;} {
</del><ins>+                if {$dep_portname ne &quot;&quot;} {
</ins><span class="cx">                     lappend dep_portnames $dep_portname
</span><span class="cx">                 }
</span><span class="cx">             }
</span><span class="lines">@@ -356,7 +356,7 @@
</span><span class="cx">         $regref os_major ${os.major}
</span><span class="cx">         $regref archs [get_canonical_archs]
</span><span class="cx">         # Trick to have a portable GMT-POSIX epoch-based time.
</span><del>-        $regref date [expr [clock scan now -gmt true] - [clock scan &quot;1970-1-1 00:00:00&quot; -gmt true]]
</del><ins>+        $regref date [expr {[clock scan now -gmt true] - [clock scan &quot;1970-1-1 00:00:00&quot; -gmt true]}]
</ins><span class="cx">         if {[info exists negated_variants]} {
</span><span class="cx">             $regref negated_variants $negated_variants
</span><span class="cx">         }
</span></span></pre></div>
<a id="branchesnewhelpsystembasesrcport10portlinttcl"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/src/port1.0/portlint.tcl (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/port1.0/portlint.tcl        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/src/port1.0/portlint.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -138,7 +138,7 @@
</span><span class="cx">             if {$nitpick} {
</span><span class="cx">                 seek $f -1 end
</span><span class="cx">                 set last [read $f 1]
</span><del>-                if {![string match &quot;\n&quot; $last]} {
</del><ins>+                if {&quot;\n&quot; ne $last} {
</ins><span class="cx">                     ui_warn &quot;Line $lineno has missing newline (at end of file)&quot;
</span><span class="cx">                     incr warnings
</span><span class="cx">                 }
</span><span class="lines">@@ -153,12 +153,12 @@
</span><span class="cx">             incr errors
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        if {($require_after == &quot;PortSystem&quot; || $require_after == &quot;PortGroup&quot;) &amp;&amp; \
</del><ins>+        if {($require_after eq &quot;PortSystem&quot; || $require_after eq &quot;PortGroup&quot;) &amp;&amp; \
</ins><span class="cx">             [string match &quot;PortGroup*&quot; $line]} {
</span><span class="cx">             set require_blank false
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        if {$nitpick &amp;&amp; $require_blank &amp;&amp; ($line != &quot;&quot;)} {
</del><ins>+        if {$nitpick &amp;&amp; $require_blank &amp;&amp; ($line ne &quot;&quot;)} {
</ins><span class="cx">             ui_warn &quot;Line $lineno should be a newline (after $require_after)&quot;
</span><span class="cx">             incr warnings
</span><span class="cx">         }
</span><span class="lines">@@ -204,7 +204,7 @@
</span><span class="cx">             set require_after &quot;PortSystem&quot;
</span><span class="cx">         }
</span><span class="cx">         if {[string match &quot;PortGroup*&quot; $line]} {
</span><del>-            regexp {PortGroup\s+([a-z0-9_]+)\s+([0-9.]+)} $line -&gt; portgroup portgroupversion
</del><ins>+            regexp {PortGroup\s+([A-Za-z0-9_]+)\s+([0-9.]+)} $line -&gt; portgroup portgroupversion
</ins><span class="cx">             if {![info exists portgroup]} {
</span><span class="cx">                 ui_error &quot;Line $lineno has unrecognized PortGroup&quot;
</span><span class="cx">                 incr errors
</span><span class="lines">@@ -228,7 +228,7 @@
</span><span class="cx">         if {[string match &quot;long_description*&quot; $line]} {
</span><span class="cx">             set in_description true
</span><span class="cx">         }
</span><del>-        if {$in_description &amp;&amp; ([string range $line end end] != &quot;\\&quot;)} {
</del><ins>+        if {$in_description &amp;&amp; ([string range $line end end] ne &quot;\\&quot;)} {
</ins><span class="cx">             set in_description false
</span><span class="cx">             #set require_blank true
</span><span class="cx">             #set require_after &quot;long_description&quot;
</span><span class="lines">@@ -245,7 +245,7 @@
</span><span class="cx">         
</span><span class="cx">         if {[string match &quot;platform\[ \t\]*&quot; $line]} {
</span><span class="cx">             regexp {platform\s+(?:\w+\s+(?:\w+\s+)?)?(\w+)} $line -&gt; platform_arch
</span><del>-            if {$platform_arch == &quot;ppc&quot;} {
</del><ins>+            if {$platform_arch eq &quot;ppc&quot;} {
</ins><span class="cx">                 ui_error &quot;Arch 'ppc' in platform on line $lineno should be 'powerpc'&quot;
</span><span class="cx">                 incr errors
</span><span class="cx">             }
</span><span class="lines">@@ -271,7 +271,8 @@
</span><span class="cx">     
</span><span class="cx">             if {!$hashline
</span><span class="cx">                     &amp;&amp; ![regexp {^\s*PortSystem|^\s*PortGroup|^\s*version} $line]
</span><del>-                    &amp;&amp; ![regexp {^\s*[a-z0-9]+\.setup} $line]
</del><ins>+                    &amp;&amp; ![regexp {^\s*[A-Za-z0-9_]+\.setup} $line]
+                    &amp;&amp; ![regexp {^\s*license} $line]
</ins><span class="cx">                     &amp;&amp; [string first [option version] $line] != -1} {
</span><span class="cx">                 ui_warn &quot;Line $lineno seems to hardcode the version number, consider using \${version} instead&quot;
</span><span class="cx">                 incr warnings
</span><span class="lines">@@ -284,7 +285,16 @@
</span><span class="cx">                     set hashline false
</span><span class="cx">             }
</span><span class="cx">         }
</span><del>-            
</del><ins>+
+        # Check for hardcoded paths
+        if {!$hashline
+                &amp;&amp; $name ne &quot;MacPorts&quot;
+                &amp;&amp; [string match &quot;*/opt/local*&quot; $line]
+                &amp;&amp; ![regexp {^\s*reinplace} $line]
+                &amp;&amp; ![regexp {^\s*system.*\Wsed\W} $line]} {
+            ui_error &quot;Line $lineno hardcodes /opt/local, use \${prefix} instead&quot;
+        }
+
</ins><span class="cx">         ### TODO: more checks to Portfile syntax
</span><span class="cx"> 
</span><span class="cx">         incr lineno
</span><span class="lines">@@ -324,7 +334,7 @@
</span><span class="cx"> 
</span><span class="cx">     foreach req_var $lint_required {
</span><span class="cx"> 
</span><del>-        if {$req_var == &quot;master_sites&quot;} {
</del><ins>+        if {$req_var eq &quot;master_sites&quot;} {
</ins><span class="cx">             if {${fetch.type} != &quot;standard&quot;} {
</span><span class="cx">                 ui_info &quot;OK: $req_var not required for fetch.type ${fetch.type}&quot;
</span><span class="cx">                 continue
</span><span class="lines">@@ -391,7 +401,7 @@
</span><span class="cx">     foreach variant $all_variants {
</span><span class="cx">         set variantname [ditem_key $variant name] 
</span><span class="cx">         set variantdesc [lindex [ditem_key $variant description] 0]
</span><del>-        if {![info exists variantname] || $variantname == &quot;&quot;} {
</del><ins>+        if {![info exists variantname] || $variantname eq &quot;&quot;} {
</ins><span class="cx">             ui_error &quot;Variant number $variantnumber does not have a name&quot;
</span><span class="cx">             incr errors
</span><span class="cx">         } else {
</span><span class="lines">@@ -404,18 +414,18 @@
</span><span class="cx">                 set name_ok false
</span><span class="cx">             }
</span><span class="cx"> 
</span><del>-            if {![info exists variantdesc] || $variantdesc == &quot;&quot;} {
</del><ins>+            if {![info exists variantdesc] || $variantdesc eq &quot;&quot;} {
</ins><span class="cx">                 # don't warn about missing descriptions for global variants
</span><span class="cx">                 if {[lsearch -exact $local_variants $variantname] != -1 &amp;&amp;
</span><del>-                    [variant_desc $porturl $variantname] == &quot;&quot;} {
</del><ins>+                    [variant_desc $porturl $variantname] eq &quot;&quot;} {
</ins><span class="cx">                     ui_warn &quot;Variant $variantname does not have a description&quot;
</span><span class="cx">                     incr warnings
</span><span class="cx">                     set desc_ok false
</span><del>-                } elseif {$variantdesc == &quot;&quot;} {
</del><ins>+                } elseif {$variantdesc eq &quot;&quot;} {
</ins><span class="cx">                     set variantdesc &quot;(pre-defined variant)&quot;
</span><span class="cx">                 }
</span><span class="cx">             } else {
</span><del>-                if {[variant_desc $porturl $variantname] != &quot;&quot;} {
</del><ins>+                if {[variant_desc $porturl $variantname] ne &quot;&quot;} {
</ins><span class="cx">                     ui_warn &quot;Variant $variantname overrides global description&quot;
</span><span class="cx">                     incr warnings
</span><span class="cx">                 }
</span><span class="lines">@@ -460,7 +470,7 @@
</span><span class="cx">             ui_debug &quot;$errorInfo&quot;
</span><span class="cx">             continue
</span><span class="cx">         }
</span><del>-        if {$res == &quot;&quot;} {
</del><ins>+        if {$res eq &quot;&quot;} {
</ins><span class="cx">             ui_error &quot;Unknown dependency: $dep&quot;
</span><span class="cx">             incr errors
</span><span class="cx">         } else {
</span><span class="lines">@@ -499,19 +509,19 @@
</span><span class="cx">                 $addr == &quot;openmaintainer@macports.org&quot;} {
</span><span class="cx">             ui_warn &quot;Using full email address for no/open maintainer&quot;
</span><span class="cx">             incr warnings
</span><del>-        } elseif [regexp &quot;^(.+)@macports.org$&quot; $addr -&gt; localpart] {
</del><ins>+        } elseif {[regexp &quot;^(.+)@macports.org$&quot; $addr -&gt; localpart]} {
</ins><span class="cx">             ui_warn &quot;Maintainer email address for $localpart includes @macports.org&quot;
</span><span class="cx">             incr warnings
</span><span class="cx">         } elseif {$addr == &quot;darwinports@opendarwin.org&quot;} {
</span><span class="cx">             ui_warn &quot;Using legacy email address for no/open maintainer&quot;
</span><span class="cx">             incr warnings
</span><del>-        } elseif [regexp &quot;^(.+)@(.+)$&quot; $addr -&gt; localpart domain] {
</del><ins>+        } elseif {[regexp &quot;^(.+)@(.+)$&quot; $addr -&gt; localpart domain]} {
</ins><span class="cx">             ui_warn &quot;Maintainer email address should be obfuscated as $domain:$localpart&quot;
</span><span class="cx">             incr warnings
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if {$license == &quot;unknown&quot;} {
</del><ins>+    if {$license eq &quot;unknown&quot;} {
</ins><span class="cx">         ui_warn &quot;no license set&quot;
</span><span class="cx">         incr warnings
</span><span class="cx">     } else {
</span><span class="lines">@@ -537,7 +547,7 @@
</span><span class="cx">                         # if the last character of license name is a number or plus sign
</span><span class="cx">                         # then a hyphen is missing
</span><span class="cx">                         set license_end [string index $subtest end]
</span><del>-                        if {[string equal &quot;+&quot; $license_end] || [string is integer -strict $license_end]} {
</del><ins>+                        if {&quot;+&quot; eq $license_end || [string is integer -strict $license_end]} {
</ins><span class="cx">                             ui_error &quot;invalid license '${test}': missing hyphen before version&quot;
</span><span class="cx">                         }
</span><span class="cx">                     }
</span><span class="lines">@@ -591,7 +601,7 @@
</span><span class="cx">         set refcount  [lindex [set ${deprecated_options_name}($option)] 1]
</span><span class="cx"> 
</span><span class="cx">         if {$refcount &gt; 0} {
</span><del>-            if {$newoption != &quot;&quot;} {
</del><ins>+            if {$newoption ne &quot;&quot;} {
</ins><span class="cx">                 ui_warn &quot;Using deprecated option '$option', superseded by '$newoption'&quot;
</span><span class="cx">             } else {
</span><span class="cx">                 ui_warn &quot;Using deprecated option '$option'&quot;
</span><span class="lines">@@ -612,22 +622,22 @@
</span><span class="cx"> 
</span><span class="cx">     set svn_cmd &quot;&quot;
</span><span class="cx">     catch {set svn_cmd [findBinary svn]}
</span><del>-    if {$svn_cmd != &quot;&quot; &amp;&amp; ([file exists $portpath/.svn] || ![catch {exec $svn_cmd info $portpath &gt; /dev/null 2&gt;@1}])} {
</del><ins>+    if {$svn_cmd ne &quot;&quot; &amp;&amp; ([file exists $portpath/.svn] || ![catch {exec $svn_cmd info $portpath &gt; /dev/null 2&gt;@1}])} {
</ins><span class="cx">         ui_debug &quot;Checking svn properties&quot;
</span><del>-        if [catch {exec $svn_cmd propget svn:keywords $portfile 2&gt;@1} output] {
</del><ins>+        if {[catch {exec $svn_cmd propget svn:keywords $portfile 2&gt;@1} output]} {
</ins><span class="cx">             ui_warn &quot;Unable to check for svn:keywords property: $output&quot;
</span><span class="cx">         } else {
</span><span class="cx">             ui_debug &quot;Property svn:keywords is \&quot;$output\&quot;, should be \&quot;Id\&quot;&quot;
</span><del>-            if {$output != &quot;Id&quot;} {
</del><ins>+            if {$output ne &quot;Id&quot;} {
</ins><span class="cx">                 ui_error &quot;Missing subversion property on Portfile, please execute: svn ps svn:keywords Id Portfile&quot;
</span><span class="cx">                 incr errors
</span><span class="cx">             }
</span><span class="cx">         }
</span><del>-        if [catch {exec $svn_cmd propget svn:eol-style $portfile 2&gt;@1} output] {
</del><ins>+        if {[catch {exec $svn_cmd propget svn:eol-style $portfile 2&gt;@1} output]} {
</ins><span class="cx">             ui_warn &quot;Unable to check for svn:eol-style property: $output&quot;
</span><span class="cx">         } else {
</span><span class="cx">             ui_debug &quot;Property svn:eol-style is \&quot;$output\&quot;, should be \&quot;native\&quot;&quot;
</span><del>-            if {$output != &quot;native&quot;} {
</del><ins>+            if {$output ne &quot;native&quot;} {
</ins><span class="cx">                 ui_error &quot;Missing subversion property on Portfile, please execute: svn ps svn:eol-style native Portfile&quot;
</span><span class="cx">                 incr errors
</span><span class="cx">             }
</span></span></pre></div>
<a id="branchesnewhelpsystembasesrcport10portlivechecktcl"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/src/port1.0/portlivecheck.tcl (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/port1.0/portlivecheck.tcl        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/src/port1.0/portlivecheck.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -77,7 +77,7 @@
</span><span class="cx">     ui_debug &quot;Port (livecheck) version is ${livecheck.version}&quot;
</span><span class="cx"> 
</span><span class="cx">     set curl_options {}
</span><del>-    if [tbool livecheck.ignore_sslcert] {
</del><ins>+    if {[tbool livecheck.ignore_sslcert]} {
</ins><span class="cx">         lappend curl_options &quot;--ignore-ssl-cert&quot;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -99,7 +99,7 @@
</span><span class="cx">                 if {[regexp &quot;^($available_types)(?::(\[^:\]+))?&quot; ${master_site} _ site subdir]} {
</span><span class="cx">                     set subdirs [split $subdir /]
</span><span class="cx">                     if {[llength $subdirs] &gt; 1} {
</span><del>-                        if {[lindex $subdirs 0] == &quot;project&quot;} {
</del><ins>+                        if {[lindex $subdirs 0] eq &quot;project&quot;} {
</ins><span class="cx">                             set subdir [lindex $subdirs 1]
</span><span class="cx">                         } else {
</span><span class="cx">                             set subdir &quot;&quot;
</span></span></pre></div>
<a id="branchesnewhelpsystembasesrcport10portloadtcl"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/src/port1.0/portload.tcl (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/port1.0/portload.tcl        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/src/port1.0/portload.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -53,7 +53,7 @@
</span><span class="cx">     set launchctl_path ${portutil::autoconf::launchctl_path}
</span><span class="cx"> 
</span><span class="cx">     foreach { path } &quot;/Library/${startupitem.location}/${startupitem.plist}&quot; {
</span><del>-        if {[string length $launchctl_path] == 0} {
</del><ins>+        if {$launchctl_path eq &quot;&quot;} {
</ins><span class="cx">             return -code error [format [msgcat::mc &quot;launchctl command was not found by configure&quot;]]
</span><span class="cx">         } elseif {![file exists $path]} {
</span><span class="cx">             return -code error [format [msgcat::mc &quot;Launchd plist %s was not found&quot;] $path]
</span></span></pre></div>
<a id="branchesnewhelpsystembasesrcport10portmaintcl"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/src/port1.0/portmain.tcl (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/port1.0/portmain.tcl        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/src/port1.0/portmain.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -80,12 +80,12 @@
</span><span class="cx"> default subbuildpath {[portmain::get_subbuildpath]}
</span><span class="cx"> proc portmain::get_subbuildpath {} {
</span><span class="cx">     global portpath portbuildpath subport
</span><del>-    if {$subport != &quot;&quot;} {
</del><ins>+    if {$subport ne &quot;&quot;} {
</ins><span class="cx">         set subdir $subport
</span><span class="cx">     } else {
</span><span class="cx">         set subdir [file tail $portpath]
</span><span class="cx">     }
</span><del>-    return [file join $portbuildpath $subdir]
</del><ins>+    return [file normalize [file join $portbuildpath $subdir]]
</ins><span class="cx"> }
</span><span class="cx"> default workpath {[getportworkpath_from_buildpath $subbuildpath]}
</span><span class="cx"> default prefix /opt/local
</span><span class="lines">@@ -120,7 +120,7 @@
</span><span class="cx"> default os.endian {$os_endian}
</span><span class="cx"> 
</span><span class="cx"> set macosx_version_text {}
</span><del>-if {[option os.platform] == &quot;darwin&quot;} {
</del><ins>+if {[option os.platform] eq &quot;darwin&quot;} {
</ins><span class="cx">     set macosx_version_text &quot;(Mac OS X ${macosx_version}) &quot;
</span><span class="cx"> }
</span><span class="cx"> ui_debug &quot;OS [option os.platform]/[option os.version] ${macosx_version_text}arch [option os.arch]&quot;
</span><span class="lines">@@ -128,7 +128,7 @@
</span><span class="cx"> default universal_variant {${use_configure}}
</span><span class="cx"> 
</span><span class="cx"> # sub-platforms of darwin
</span><del>-if {[option os.platform] == &quot;darwin&quot;} {
</del><ins>+if {[option os.platform] eq &quot;darwin&quot;} {
</ins><span class="cx">     if {[file isdirectory /System/Library/Frameworks/Carbon.framework]} {
</span><span class="cx">         default os.subplatform macosx
</span><span class="cx">         # we're on Mac OS X and can therefore build universal
</span><span class="lines">@@ -159,16 +159,16 @@
</span><span class="cx">     # set global variable indicating to other functions to use ~/.macports as well
</span><span class="cx">     set usealtworkpath yes
</span><span class="cx"> 
</span><del>-    default worksymlink {[file join ${altprefix}${portpath} work]}
-    default distpath {[file join ${altprefix}${portdbpath} distfiles ${dist_subdir}]}
</del><ins>+    default worksymlink {[file normalize [file join ${altprefix}${portpath} work]]}
+    default distpath {[file normalize [file join ${altprefix}${portdbpath} distfiles ${dist_subdir}]]}
</ins><span class="cx">     set portbuildpath &quot;${altprefix}${portbuildpath}&quot;
</span><span class="cx"> 
</span><span class="cx">     ui_debug &quot;Going to use alternate build prefix: $altprefix&quot;
</span><span class="cx">     ui_debug &quot;workpath = $workpath&quot;
</span><span class="cx"> } else {
</span><span class="cx">     set usealtworkpath no
</span><del>-    default worksymlink {[file join $portpath work]}
-    default distpath {[file join $portdbpath distfiles ${dist_subdir}]}
</del><ins>+    default worksymlink {[file normalize [file join $portpath work]]}
+    default distpath {[file normalize [file join $portdbpath distfiles ${dist_subdir}]]}
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> # end gsoc08-privileges
</span></span></pre></div>
<a id="branchesnewhelpsystembasesrcport10portmirrortcl"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/src/port1.0/portmirror.tcl (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/port1.0/portmirror.tcl        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/src/port1.0/portmirror.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -58,7 +58,7 @@
</span><span class="cx">     set mirror_filemap_path [file join $portdbpath distfiles_mirror.db]
</span><span class="cx">     if {![info exists mirror_filemap]
</span><span class="cx">         &amp;&amp; [info exists ports_mirror_new]
</span><del>-        &amp;&amp; $ports_mirror_new == &quot;yes&quot;
</del><ins>+        &amp;&amp; $ports_mirror_new eq &quot;yes&quot;
</ins><span class="cx">         &amp;&amp; [file exists $mirror_filemap_path]} {
</span><span class="cx">         # Trash the map file if it existed.
</span><span class="cx">         file delete -force $mirror_filemap_path
</span></span></pre></div>
<a id="branchesnewhelpsystembasesrcport10portpatchtcl"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/src/port1.0/portpatch.tcl (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/port1.0/portpatch.tcl        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/src/port1.0/portpatch.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -72,7 +72,7 @@
</span><span class="cx">     global UI_PREFIX usealtworkpath altprefix
</span><span class="cx"> 
</span><span class="cx">     # First make sure that patchfiles exists and isn't stubbed out.
</span><del>-    if {![exists patchfiles] || [option patchfiles] == &quot;&quot;} {
</del><ins>+    if {![exists patchfiles] || [option patchfiles] eq &quot;&quot;} {
</ins><span class="cx">         return 0
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre></div>
<a id="branchesnewhelpsystembasesrcport10portsandboxtcl"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/src/port1.0/portsandbox.tcl (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/port1.0/portsandbox.tcl        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/src/port1.0/portsandbox.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -35,7 +35,7 @@
</span><span class="cx"> 
</span><span class="cx"> options portsandbox_supported portsandbox_active portsandbox_profile
</span><span class="cx"> default portsandbox_supported {[file executable $portutil::autoconf::sandbox_exec_path]}
</span><del>-default portsandbox_active {[expr $portsandbox_supported &amp;&amp; $sandbox_enable]}
</del><ins>+default portsandbox_active {[expr {$portsandbox_supported &amp;&amp; $sandbox_enable}]}
</ins><span class="cx"> default portsandbox_profile {}
</span><span class="cx"> 
</span><span class="cx"> # set up a suitable profile to pass to sandbox-exec, based on the target
</span></span></pre></div>
<a id="branchesnewhelpsystembasesrcport10portstartupitemtcl"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/src/port1.0/portstartupitem.tcl (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/port1.0/portstartupitem.tcl        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/src/port1.0/portstartupitem.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -231,12 +231,12 @@
</span><span class="cx">     puts ${item} &quot;LOGFILE=\&quot;${startupitem.logfile}\&quot;&quot;
</span><span class="cx">     puts ${item} &quot;EXECUTABLE=\&quot;${startupitem.executable}\&quot;&quot;
</span><span class="cx">     puts ${item} &quot;&quot;
</span><del>-    puts ${item} &quot;HAVE_STARTCMDS=[expr [llength ${startupitem.start}] ? &quot;true&quot; : &quot;false&quot;]&quot;
-    puts ${item} &quot;HAVE_STOPCMDS=[expr [llength ${startupitem.stop}] ? &quot;true&quot; : &quot;false&quot;]&quot;
-    puts ${item} &quot;HAVE_RESTARTCMDS=[expr [llength ${startupitem.restart}] ? &quot;true&quot; : &quot;false&quot;]&quot;
</del><ins>+    puts ${item} &quot;HAVE_STARTCMDS=[expr {[llength ${startupitem.start}] ? &quot;true&quot; : &quot;false&quot;}]&quot;
+    puts ${item} &quot;HAVE_STOPCMDS=[expr {[llength ${startupitem.stop}] ? &quot;true&quot; : &quot;false&quot;}]&quot;
+    puts ${item} &quot;HAVE_RESTARTCMDS=[expr {[llength ${startupitem.restart}] ? &quot;true&quot; : &quot;false&quot;}]&quot;
</ins><span class="cx">     puts ${item} &quot;DELETE_PIDFILE=${createPidFile}&quot;
</span><span class="cx">     puts ${item} &quot;CREATE_PIDFILE=${deletePidFile}&quot;
</span><del>-    puts ${item} &quot;LOG_EVENTS=[expr [tbool ${startupitem.logevents}] ? &quot;true&quot; : &quot;false&quot;]&quot;
</del><ins>+    puts ${item} &quot;LOG_EVENTS=[expr {[tbool ${startupitem.logevents}] ? &quot;true&quot; : &quot;false&quot;}]&quot;
</ins><span class="cx">     puts ${item} &quot;&quot;
</span><span class="cx"> 
</span><span class="cx">     # Emit the init lines
</span><span class="lines">@@ -600,7 +600,7 @@
</span><span class="cx">     
</span><span class="cx">     puts ${plist} &quot;&lt;key&gt;Debug&lt;/key&gt;&lt;false/&gt;&quot;
</span><span class="cx">     puts ${plist} &quot;&lt;key&gt;Disabled&lt;/key&gt;&lt;true/&gt;&quot;
</span><del>-    if {$macosx_deployment_target != &quot;10.4&quot;} {
</del><ins>+    if {$macosx_deployment_target ne &quot;10.4&quot;} {
</ins><span class="cx">         puts ${plist} &quot;&lt;key&gt;KeepAlive&lt;/key&gt;&lt;true/&gt;&quot;
</span><span class="cx">     } else {
</span><span class="cx">         puts ${plist} &quot;&lt;key&gt;OnDemand&lt;/key&gt;&lt;false/&gt;&quot;
</span></span></pre></div>
<a id="branchesnewhelpsystembasesrcport10porttracetcl"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/src/port1.0/porttrace.tcl (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/port1.0/porttrace.tcl        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/src/port1.0/porttrace.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -40,7 +40,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> proc porttrace::trace_start {workpath} {
</span><del>-    global os.platform developer_dir
</del><ins>+    global os.platform developer_dir macportsuser
</ins><span class="cx">     if {${os.platform} == &quot;darwin&quot;} {
</span><span class="cx">         if {[catch {package require Thread} error]} {
</span><span class="cx">             ui_warn &quot;trace requires Tcl Thread package ($error)&quot;
</span><span class="lines">@@ -87,17 +87,25 @@
</span><span class="cx">             /tmp \
</span><span class="cx">             /private/tmp \
</span><span class="cx">             /var/tmp \
</span><del>-            /var/folders \
</del><span class="cx">             /private/var/tmp \
</span><ins>+            /var/folders \
+            /private/var/folders \
</ins><span class="cx">             /var/empty \
</span><span class="cx">             /private/var/empty \
</span><del>-            /private/var/folders \
</del><ins>+            /var/run \
+            /private/var/run \
+            /var/db/xcode_select_link \
+            /private/var/db/xcode_select_link \
+            /var/db/mds \
+            /private/var/db/mds \
+            [file normalize ~${macportsuser}/Library/Preferences/com.apple.dt.Xcode.plist] \
+            &quot;$env(HOME)/Library/Preferences/com.apple.dt.Xcode.plist&quot; \
+            /Library/Caches/com.apple.Xcode \
</ins><span class="cx">             /dev \
</span><span class="cx">             /etc/passwd \
</span><span class="cx">             /etc/groups \
</span><span class="cx">             /etc/localtime \
</span><span class="cx">             [file normalize ${developer_dir}/../..] \
</span><del>-            /Library/Caches/com.apple.Xcode \
</del><span class="cx">             &quot;$env(HOME)/.ccache&quot;]
</span><span class="cx">             if {[info exists env(TMPDIR)]} {
</span><span class="cx">                 lappend trace_sandbox $env(TMPDIR)
</span><span class="lines">@@ -119,23 +127,9 @@
</span><span class="cx"> # Enable the fence.
</span><span class="cx"> # Only done for targets that should only happen in the sandbox.
</span><span class="cx"> proc porttrace::trace_enable_fence {} {
</span><del>-    global env trace_sandboxbounds
-    set env(DARWINTRACE_SANDBOX_BOUNDS) $trace_sandboxbounds
</del><span class="cx">     tracelib enablefence
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-# Disable the fence.
-# Unused yet.
-proc porttrace::trace_disable_fence {} {
-    global env macosx_version
-    if [info exists env(DARWINTRACE_SANDBOX_BOUNDS)] {
-        unset env(DARWINTRACE_SANDBOX_BOUNDS)
-        if {$macosx_version == &quot;10.5&quot;} {
-            unsetenv DARWINTRACE_SANDBOX_BOUNDS
-        }
-    }
-}
-
</del><span class="cx"> # Check the list of ports.
</span><span class="cx"> # Output a warning for every port the trace revealed a dependency on
</span><span class="cx"> # that isn't included in portslist
</span><span class="lines">@@ -178,7 +172,7 @@
</span><span class="cx">         global env trace_fifo macosx_version
</span><span class="cx">         foreach var {DYLD_INSERT_LIBRARIES DYLD_FORCE_FLAT_NAMESPACE DARWINTRACE_LOG DARWINTRACE_SANDBOX_BOUNDS} {
</span><span class="cx">             array unset env $var
</span><del>-            if {$macosx_version == &quot;10.5&quot;} {
</del><ins>+            if {$macosx_version eq &quot;10.5&quot;} {
</ins><span class="cx">                 unsetenv $var
</span><span class="cx">             }
</span><span class="cx">         }
</span><span class="lines">@@ -278,12 +272,12 @@
</span><span class="cx"> 
</span><span class="cx">         # Skip empty lines.
</span><span class="cx">         if {$line_length &gt; 0} {
</span><del>-            set path_start [expr [string first &quot;\t&quot; $theline] + 1]
-            set op [string range $theline 0 [expr $path_start - 2]]
-            set path [string range $theline $path_start [expr $line_length - 1]]
</del><ins>+            set path_start [expr {[string first &quot;\t&quot; $theline] + 1}]
+            set op [string range $theline 0 [expr {$path_start - 2}]]
+            set path [string range $theline $path_start [expr {$line_length - 1}]]
</ins><span class="cx"> 
</span><span class="cx">             # open/execve
</span><del>-            if {$op == &quot;open&quot; || $op == &quot;execve&quot;} {
</del><ins>+            if {$op eq &quot;open&quot; || $op eq &quot;execve&quot;} {
</ins><span class="cx">                 # Only work on files.
</span><span class="cx">                 if {[file isfile $path]} {
</span><span class="cx">                     # Did we process the file yet?
</span><span class="lines">@@ -307,7 +301,7 @@
</span><span class="cx">                         catch {filemap set trace_filemap $path $port}
</span><span class="cx">                     }
</span><span class="cx">                 }
</span><del>-            } elseif {$op == &quot;sandbox_violation&quot;} {
</del><ins>+            } elseif {$op eq &quot;sandbox_violation&quot;} {
</ins><span class="cx">                 lappend sandbox_violation_list $path
</span><span class="cx">             }
</span><span class="cx">         }
</span></span></pre></div>
<a id="branchesnewhelpsystembasesrcport10portunloadtcl"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/src/port1.0/portunload.tcl (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/port1.0/portunload.tcl        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/src/port1.0/portunload.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -53,7 +53,7 @@
</span><span class="cx">     set launchctl_path ${portutil::autoconf::launchctl_path}
</span><span class="cx"> 
</span><span class="cx">     foreach { path } &quot;/Library/${startupitem.location}/${startupitem.plist}&quot; {
</span><del>-        if {[string length $launchctl_path] == 0} {
</del><ins>+        if {$launchctl_path eq &quot;&quot;} {
</ins><span class="cx">             return -code error [format [msgcat::mc &quot;launchctl command was not found by configure&quot;]]
</span><span class="cx">         } elseif {![file exists $path]} {
</span><span class="cx">             return -code error [format [msgcat::mc &quot;Launchd plist %s was not found&quot;] $path]
</span></span></pre></div>
<a id="branchesnewhelpsystembasesrcport10portutiltcl"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/src/port1.0/portutil.tcl (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/port1.0/portutil.tcl        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/src/port1.0/portutil.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -114,6 +114,23 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> ##
</span><ins>+# Handle option-prepend
+#
+# @param option name of the option
+# @param args arguments
+proc handle_option-prepend {option args} {
+    global $option user_options option_procs
+
+    if {![info exists user_options($option)]} {
+        if {[info exists $option]} {
+            set $option [concat $args [set $option]]
+        } else {
+            set $option $args
+        }
+    }
+}
+
+##
</ins><span class="cx"> # Handle option-delete
</span><span class="cx"> #
</span><span class="cx"> # @param option name of the option
</span><span class="lines">@@ -162,7 +179,7 @@
</span><span class="cx">             set deprecated_options(${option}-replace) [list ${option}-strsed 0]
</span><span class="cx">         }
</span><span class="cx">         set refcount [lindex $deprecated_options(${option}-replace) 1]
</span><del>-        lset deprecated_options(${option}-replace) 1 [expr $refcount + 1]
</del><ins>+        lset deprecated_options(${option}-replace) 1 [expr {$refcount + 1}]
</ins><span class="cx">         return [eval handle_option-strsed $option $args]
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -188,6 +205,7 @@
</span><span class="cx">     foreach option $args {
</span><span class="cx">         interp alias {} $option {} handle_option $option
</span><span class="cx">         interp alias {} $option-append {} handle_option-append $option
</span><ins>+        interp alias {} $option-prepend {} handle_option-prepend $option
</ins><span class="cx">         interp alias {} $option-delete {} handle_option-delete $option
</span><span class="cx">         interp alias {} $option-strsed {} handle_option-strsed $option
</span><span class="cx">         interp alias {} $option-replace {} handle_option-replace $option
</span><span class="lines">@@ -234,15 +252,15 @@
</span><span class="cx">     set refcount  [lindex $deprecated_options($option) 1]
</span><span class="cx">     global $newoption
</span><span class="cx"> 
</span><del>-    if {$newoption == &quot;&quot;} {
</del><ins>+    if {$newoption eq &quot;&quot;} {
</ins><span class="cx">         ui_warn &quot;Port $subport using deprecated option \&quot;$option\&quot;.&quot;
</span><span class="cx">         return
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     # Increment reference counter
</span><del>-    lset deprecated_options($option) 1 [expr $refcount + 1]
</del><ins>+    lset deprecated_options($option) 1 [expr {$refcount + 1}]
</ins><span class="cx"> 
</span><del>-    if {$action != &quot;read&quot;} {
</del><ins>+    if {$action ne &quot;read&quot;} {
</ins><span class="cx">         $newoption [set $option]
</span><span class="cx">     } else {
</span><span class="cx">         $option [set $newoption]
</span><span class="lines">@@ -366,12 +384,12 @@
</span><span class="cx">     set command_suffix &quot;&quot;
</span><span class="cx"> 
</span><span class="cx">     if {[llength $args] &gt; 0} {
</span><del>-        if {[lindex $args 0] == &quot;-notty&quot;} {
</del><ins>+        if {[lindex $args 0] eq &quot;-notty&quot;} {
</ins><span class="cx">             set notty &quot;-notty&quot;
</span><span class="cx">             set args [lrange $args 1 end]
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        if {[lindex $args 0] == &quot;-varprefix&quot;} {
</del><ins>+        if {[lindex $args 0] eq &quot;-varprefix&quot;} {
</ins><span class="cx">             set varprefix [lindex $args 1]
</span><span class="cx">             set args [lrange $args 2 end]
</span><span class="cx">         }
</span><span class="lines">@@ -417,7 +435,7 @@
</span><span class="cx"> 
</span><span class="cx">     # Prepare nice value change
</span><span class="cx">     set nice &quot;&quot;
</span><del>-    if {[info exists ${varprefix}.nice] &amp;&amp; [set ${varprefix}.nice] != &quot;&quot;} {
</del><ins>+    if {[info exists ${varprefix}.nice] &amp;&amp; [set ${varprefix}.nice] ne &quot;&quot;} {
</ins><span class="cx">         set nice &quot;-nice [set ${varprefix}.nice]&quot;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -443,7 +461,7 @@
</span><span class="cx"> 
</span><span class="cx">     # Restore the environment.
</span><span class="cx">     array unset env *
</span><del>-    if {$macosx_version == &quot;10.5&quot;} {
</del><ins>+    if {$macosx_version eq &quot;10.5&quot;} {
</ins><span class="cx">         unsetenv *
</span><span class="cx">     }
</span><span class="cx">     array set env [array get saved_env]
</span><span class="lines">@@ -511,10 +529,10 @@
</span><span class="cx">             # args is a list of strings/list
</span><span class="cx">             foreach arg $args {
</span><span class="cx">                 # Strip trailing empty lines
</span><del>-                if {[string index $arg 0] == &quot;\n&quot;} {
</del><ins>+                if {[string index $arg 0] eq &quot;\n&quot;} {
</ins><span class="cx">                     set arg [string range $arg 1 end]
</span><span class="cx">                 }
</span><del>-                if {[string index $arg end] == &quot;\n&quot;} {
</del><ins>+                if {[string index $arg end] eq &quot;\n&quot;} {
</ins><span class="cx">                     set arg [string range $arg 0 end-1]
</span><span class="cx">                 }
</span><span class="cx"> 
</span><span class="lines">@@ -522,13 +540,13 @@
</span><span class="cx">                 set indent &quot;&quot;
</span><span class="cx">                 for {set i 0} {$i &lt; [string length $arg]} {incr i} {
</span><span class="cx">                     set c [string index $arg $i]
</span><del>-                    if {$c != &quot; &quot; &amp;&amp; $c != &quot;\t&quot;} {
</del><ins>+                    if {$c ne &quot; &quot; &amp;&amp; $c ne &quot;\t&quot;} {
</ins><span class="cx">                         break
</span><span class="cx">                     }
</span><span class="cx">                     append indent $c
</span><span class="cx">                 }
</span><span class="cx">                 # Remove indent on first line
</span><del>-                set arg [string replace $arg 0 [expr $i - 1]]
</del><ins>+                set arg [string replace $arg 0 [expr {$i - 1}]]
</ins><span class="cx">                 # Remove indent on each other line
</span><span class="cx">                 set arg [string map &quot;\&quot;\n$indent\&quot; \&quot;\n\&quot;&quot; $arg]
</span><span class="cx"> 
</span><span class="lines">@@ -563,7 +581,7 @@
</span><span class="cx">         return -code error &quot;Malformed variant specification&quot;
</span><span class="cx">     }
</span><span class="cx">     set code [lindex $args end]
</span><del>-    set args [lrange $args 0 [expr $len - 2]]
</del><ins>+    set args [lrange $args 0 [expr {$len - 2}]]
</ins><span class="cx"> 
</span><span class="cx">     set ditem [variant_new &quot;temp-variant&quot;]
</span><span class="cx"> 
</span><span class="lines">@@ -611,7 +629,7 @@
</span><span class="cx">         set vdesc [join [ditem_key $ditem description]]
</span><span class="cx"> 
</span><span class="cx">         # read global variant description, if none given
</span><del>-        if {$vdesc == &quot;&quot;} {
</del><ins>+        if {$vdesc eq &quot;&quot;} {
</ins><span class="cx">             set vdesc [variant_desc $porturl $variant_provides]
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="lines">@@ -650,7 +668,7 @@
</span><span class="cx"> proc variant_isset {name} {
</span><span class="cx">     global variations
</span><span class="cx"> 
</span><del>-    if {[info exists variations($name)] &amp;&amp; $variations($name) == &quot;+&quot;} {
</del><ins>+    if {[info exists variations($name)] &amp;&amp; $variations($name) eq &quot;+&quot;} {
</ins><span class="cx">         return 1
</span><span class="cx">     }
</span><span class="cx">     return 0
</span><span class="lines">@@ -713,7 +731,7 @@
</span><span class="cx">                 incr lineno
</span><span class="cx">                 set name [lindex $line 0]
</span><span class="cx">                 set desc [lindex $line 1]
</span><del>-                if {$name != &quot;&quot; &amp;&amp; $desc != &quot;&quot;} {
</del><ins>+                if {$name ne &quot;&quot; &amp;&amp; $desc ne &quot;&quot;} {
</ins><span class="cx">                     set variant_descs_global(${descfile}_$name) $desc
</span><span class="cx">                 } else {
</span><span class="cx">                     ui_warn &quot;Invalid variant description in $descfile at line $lineno&quot;
</span><span class="lines">@@ -763,7 +781,7 @@
</span><span class="cx">     }
</span><span class="cx">     set code [lindex $args end]
</span><span class="cx">     set os [lindex $args 0]
</span><del>-    set args [lrange $args 1 [expr $len - 2]]
</del><ins>+    set args [lrange $args 1 [expr {$len - 2}]]
</ins><span class="cx"> 
</span><span class="cx">     foreach arg $args {
</span><span class="cx">         if {[regexp {(^[0-9]+$)} $arg match result]} {
</span><span class="lines">@@ -846,7 +864,7 @@
</span><span class="cx">     foreach {key value} [array get env_array] {
</span><span class="cx">         lappend env_list $key='$value'
</span><span class="cx">     }
</span><del>-    return [join $env_list]
</del><ins>+    return &quot;\n[join [lsort $env_list] &quot;\n&quot;]&quot;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> ########### Distname utility functions ###########
</span><span class="lines">@@ -952,6 +970,8 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     foreach file $files {
</span><ins>+        global UI_PREFIX
+
</ins><span class="cx">         # if $file is an absolute path already, file join will just return the
</span><span class="cx">         # absolute path, otherwise it is $dir/$file
</span><span class="cx">         set file [file join $dir $file]
</span><span class="lines">@@ -970,7 +990,7 @@
</span><span class="cx"> 
</span><span class="cx">         set cmdline $portutil::autoconf::sed_command
</span><span class="cx">         if {$extended} {
</span><del>-            if {$portutil::autoconf::sed_ext_flag == &quot;N/A&quot;} {
</del><ins>+            if {$portutil::autoconf::sed_ext_flag eq &quot;N/A&quot;} {
</ins><span class="cx">                 ui_debug &quot;sed extended regexp not available&quot;
</span><span class="cx">                 return -code error &quot;reinplace sed(1) too old&quot;
</span><span class="cx">             }
</span><span class="lines">@@ -979,22 +999,23 @@
</span><span class="cx">         if {$suppress} {
</span><span class="cx">             lappend cmdline -n
</span><span class="cx">         }
</span><del>-        set cmdline [concat $cmdline [list $pattern &lt; $file &gt;@ $tmpfd]]
-        if {$locale != &quot;&quot;} {
</del><ins>+        set cmdline [concat $cmdline [list $pattern &lt; $file &gt;@ $tmpfd 2&gt;@stderr]]
+        if {$locale ne &quot;&quot;} {
</ins><span class="cx">             set env(LC_CTYPE) $locale
</span><span class="cx">         }
</span><ins>+        ui_info &quot;$UI_PREFIX [format [msgcat::mc &quot;Patching %s: %s&quot;] [file tail $file] $pattern]&quot;
</ins><span class="cx">         ui_debug &quot;Executing reinplace: $cmdline&quot;
</span><span class="cx">         if {[catch {eval exec $cmdline} error]} {
</span><span class="cx">             global errorInfo
</span><span class="cx">             ui_debug &quot;$errorInfo&quot;
</span><span class="cx">             ui_error &quot;reinplace: $error&quot;
</span><span class="cx">             file delete &quot;$tmpfile&quot;
</span><del>-            if {$locale != &quot;&quot;} {
</del><ins>+            if {$locale ne &quot;&quot;} {
</ins><span class="cx">                 if {$oldlocale_exists} {
</span><span class="cx">                     set env(LC_CTYPE) $oldlocale
</span><span class="cx">                 } else {
</span><span class="cx">                     unset env(LC_CTYPE)
</span><del>-                    if {$macosx_version == &quot;10.5&quot;} {
</del><ins>+                    if {$macosx_version eq &quot;10.5&quot;} {
</ins><span class="cx">                         unsetenv LC_CTYPE
</span><span class="cx">                     }
</span><span class="cx">                 }
</span><span class="lines">@@ -1003,12 +1024,12 @@
</span><span class="cx">             return -code error &quot;reinplace sed(1) failed&quot;
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        if {$locale != &quot;&quot;} {
</del><ins>+        if {$locale ne &quot;&quot;} {
</ins><span class="cx">             if {$oldlocale_exists} {
</span><span class="cx">                 set env(LC_CTYPE) $oldlocale
</span><span class="cx">             } else {
</span><span class="cx">                 unset env(LC_CTYPE)
</span><del>-                if {$macosx_version == &quot;10.5&quot;} {
</del><ins>+                if {$macosx_version eq &quot;10.5&quot;} {
</ins><span class="cx">                     unsetenv LC_CTYPE
</span><span class="cx">                 }
</span><span class="cx">             }
</span><span class="lines">@@ -1045,20 +1066,15 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> # delete
</span><del>-# file delete -force by itself doesn't handle directories properly
-# on systems older than Tiger. Let's recurse using fs-traverse instead.
</del><ins>+# Wrapper for file delete -force
</ins><span class="cx"> proc delete {args} {
</span><del>-    ui_debug &quot;delete: $args&quot;
-    fs-traverse -depth file $args {
-        file delete -force -- $file
-        continue
-    }
</del><ins>+    eval file delete -force -- $args
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> # touch
</span><span class="cx"> # mimics the BSD touch command
</span><span class="cx"> proc touch {args} {
</span><del>-    while {[string match -* [lindex $args 0]]} {
</del><ins>+    while {[string match &quot;-*&quot; [lindex $args 0]]} {
</ins><span class="cx">         set arg [string range [lindex $args 0] 1 end]
</span><span class="cx">         set args [lrange $args 1 end]
</span><span class="cx">         switch -- $arg {
</span><span class="lines">@@ -1069,7 +1085,7 @@
</span><span class="cx">             t {
</span><span class="cx">                 set narg [lindex $args 0]
</span><span class="cx">                 set args [lrange $args 1 end]
</span><del>-                if {[string length $narg] == 0} {
</del><ins>+                if {$narg eq &quot;&quot;} {
</ins><span class="cx">                     return -code error &quot;touch: option requires an argument -- $arg&quot;
</span><span class="cx">                 }
</span><span class="cx">                 set options($arg) $narg
</span><span class="lines">@@ -1082,7 +1098,7 @@
</span><span class="cx"> 
</span><span class="cx">     # parse the r/t options
</span><span class="cx">     if {[info exists options(rt)]} {
</span><del>-        if {[string equal $options(rt) r]} {
</del><ins>+        if {$options(rt) eq &quot;r&quot;} {
</ins><span class="cx">             # -r
</span><span class="cx">             # get atime/mtime from the file
</span><span class="cx">             if {[file exists $options(r)]} {
</span><span class="lines">@@ -1097,9 +1113,9 @@
</span><span class="cx">             # turn it into a CCyymmdd hhmmss
</span><span class="cx">             set timespec {^(?:(\d\d)?(\d\d))?(\d\d)(\d\d)(\d\d)(\d\d)(?:\.(\d\d))?$}
</span><span class="cx">             if {[regexp $timespec $options(t) {} CC YY MM DD hh mm SS]} {
</span><del>-                if {[string length $YY] == 0} {
</del><ins>+                if {$YY eq &quot;&quot;} {
</ins><span class="cx">                     set year [clock format [clock seconds] -format %Y]
</span><del>-                } elseif {[string length $CC] == 0} {
</del><ins>+                } elseif {$CC eq &quot;&quot;} {
</ins><span class="cx">                     if {$YY &gt;= 69 &amp;&amp; $YY &lt;= 99} {
</span><span class="cx">                         set year 19$YY
</span><span class="cx">                     } else {
</span><span class="lines">@@ -1108,7 +1124,7 @@
</span><span class="cx">                 } else {
</span><span class="cx">                     set year $CC$YY
</span><span class="cx">                 }
</span><del>-                if {[string length $SS] == 0} {
</del><ins>+                if {$SS eq &quot;&quot;} {
</ins><span class="cx">                     set SS 00
</span><span class="cx">                 }
</span><span class="cx">                 set atime [clock scan &quot;$year$MM$DD $hh$mm$SS&quot;]
</span><span class="lines">@@ -1149,13 +1165,38 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> # copy
</span><ins>+# Wrapper for file copy
</ins><span class="cx"> proc copy {args} {
</span><span class="cx">     eval file copy $args
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> # move
</span><ins>+# Wrapper for file rename that handles case-only renames
</ins><span class="cx"> proc move {args} {
</span><del>-    eval file rename $args
</del><ins>+    set options {}
+    while {[string match &quot;-*&quot; [lindex $args 0]]} {
+        set arg [string range [lindex $args 0] 1 end]
+        set args [lreplace $args 0 0]
+        switch -- $arg {
+            force {append options -$arg}
+            - break
+            default {return -code error &quot;move: illegal option -- $arg&quot;}
+        }
+    }
+    if {[llength $args] == 2} {
+        set oldname [lindex $args 0]
+        set newname [lindex $args 1]
+        if {[string equal -nocase $oldname $newname] &amp;&amp; $oldname ne $newname} {
+            # case-only rename
+            set tempdir [mkdtemp ${oldname}-XXXXXXXX]
+            set tempname $tempdir/[file tail $oldname]
+            file rename $options -- $oldname $tempname
+            file rename $options -- $tempname $newname
+            delete $tempdir
+            return
+        }
+    }
+    eval file rename $options -- $args
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> # ln
</span><span class="lines">@@ -1163,7 +1204,7 @@
</span><span class="cx"> # ln [-f] [-h] [-s] [-v] source_file [target_file]
</span><span class="cx"> # ln [-f] [-h] [-s] [-v] source_file ... target_dir
</span><span class="cx"> proc ln {args} {
</span><del>-    while {[string match -* [lindex $args 0]]} {
</del><ins>+    while {[string match &quot;-*&quot; [lindex $args 0]]} {
</ins><span class="cx">         set arg [string range [lindex $args 0] 1 end]
</span><span class="cx">         if {[string length $arg] &gt; 1} {
</span><span class="cx">             set remainder -[string range $arg 1 end]
</span><span class="lines">@@ -1189,7 +1230,7 @@
</span><span class="cx">         set files $args
</span><span class="cx">         set target ./
</span><span class="cx">     } else {
</span><del>-        set files [lrange $args 0 [expr [llength $args] - 2]]
</del><ins>+        set files [lrange $args 0 [expr {[llength $args] - 2}]]
</ins><span class="cx">         set target [lindex $args end]
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -1316,11 +1357,11 @@
</span><span class="cx">     set env(HOME) &quot;${workpath}/.home&quot;
</span><span class="cx">     set env(TMPDIR) &quot;${workpath}/.tmp&quot;
</span><span class="cx"> 
</span><del>-    if {[ditem_key $ditem state] != &quot;no&quot;} {
</del><ins>+    if {[ditem_key $ditem state] ne &quot;no&quot;} {
</ins><span class="cx">         set target_state_fd [open_statefile]
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if {$procedure != &quot;&quot;} {
</del><ins>+    if {$procedure ne &quot;&quot;} {
</ins><span class="cx">         set targetname [ditem_key $ditem name]
</span><span class="cx">         set target [ditem_key $ditem provides]
</span><span class="cx">         portsandbox::set_profile $target
</span><span class="lines">@@ -1339,14 +1380,14 @@
</span><span class="cx">         if {$result == 0} {
</span><span class="cx">             # Skip the step if required and explain why through ui_debug.
</span><span class="cx">             # check if the step was already done (as mentioned in the state file)
</span><del>-            if {[ditem_key $ditem state] != &quot;no&quot;
</del><ins>+            if {[ditem_key $ditem state] ne &quot;no&quot;
</ins><span class="cx">                     &amp;&amp; [check_statefile target $targetname $target_state_fd]} {
</span><span class="cx">                 ui_debug &quot;Skipping completed $targetname ($portname)&quot;
</span><span class="cx">                 set skipped 1
</span><span class="cx">             }
</span><span class="cx"> 
</span><span class="cx">             # Of course, if this is a dry run, don't do the task:
</span><del>-            if {[info exists ports_dryrun] &amp;&amp; $ports_dryrun == &quot;yes&quot;} {
</del><ins>+            if {[info exists ports_dryrun] &amp;&amp; $ports_dryrun eq &quot;yes&quot;} {
</ins><span class="cx">                 # only one message per portname
</span><span class="cx">                 if {$portname != $ports_dry_last_skipped} {
</span><span class="cx">                     ui_notice &quot;For $portname: skipping $targetname (dry run)&quot;
</span><span class="lines">@@ -1378,15 +1419,21 @@
</span><span class="cx">                 #start tracelib
</span><span class="cx">                 if {($result ==0
</span><span class="cx">                   &amp;&amp; [info exists ports_trace]
</span><del>-                  &amp;&amp; $ports_trace == &quot;yes&quot;
-                  &amp;&amp; $target != &quot;clean&quot;)} {
</del><ins>+                  &amp;&amp; $ports_trace eq &quot;yes&quot;
+                  &amp;&amp; $target ne &quot;clean&quot;
+                  &amp;&amp; $target ne &quot;uninstall&quot;)} {
+                    # uninstall will open a portfile from registry and call
+                    # deactivate and uninstall there; if we enable trace mode
+                    # for the first level the two trace threads will conflict
+                    # and cause a deadlock.
</ins><span class="cx">                     porttrace::trace_start $workpath
</span><span class="cx"> 
</span><span class="cx">                     # Enable the fence to prevent any creation/modification
</span><span class="cx">                     # outside the sandbox.
</span><del>-                    if {$target != &quot;activate&quot;
-                      &amp;&amp; $target != &quot;archive&quot;
-                      &amp;&amp; $target != &quot;install&quot;} {
</del><ins>+                    if {$target ne &quot;activate&quot;
+                      &amp;&amp; $target ne &quot;deactivate&quot;
+                      &amp;&amp; $target ne &quot;archive&quot;
+                      &amp;&amp; $target ne &quot;install&quot;} {
</ins><span class="cx">                         porttrace::trace_enable_fence
</span><span class="cx">                     }
</span><span class="cx"> 
</span><span class="lines">@@ -1425,7 +1472,7 @@
</span><span class="cx">                     # Gather the dependencies for deptypes
</span><span class="cx">                     foreach deptype $deptypes {
</span><span class="cx">                         # Add to the list of dependencies if the option exists and isn't empty.
</span><del>-                        if {[info exists PortInfo($deptype)] &amp;&amp; $PortInfo($deptype) != &quot;&quot;} {
</del><ins>+                        if {[info exists PortInfo($deptype)] &amp;&amp; $PortInfo($deptype) ne &quot;&quot;} {
</ins><span class="cx">                             set depends [concat $depends $PortInfo($deptype)]
</span><span class="cx">                         }
</span><span class="cx">                     }
</span><span class="lines">@@ -1438,7 +1485,7 @@
</span><span class="cx"> 
</span><span class="cx">                         # If portname is empty, the dependency is already satisfied by other means,
</span><span class="cx">                         # for example a bin: dependency on a file not installed by MacPorts
</span><del>-                        if {$name != &quot;&quot;} {
</del><ins>+                        if {$name ne &quot;&quot;} {
</ins><span class="cx">                             if {[lsearch -exact $deplist $name] == -1} {
</span><span class="cx">                                 lappend deplist $name
</span><span class="cx">                                 set deplist [recursive_collect_deps $name $deplist]
</span><span class="lines">@@ -1447,7 +1494,7 @@
</span><span class="cx">                     }
</span><span class="cx"> 
</span><span class="cx">                     # Add ccache port for access to ${prefix}/bin/ccache binary
</span><del>-                    if [option configure.ccache] {
</del><ins>+                    if {[option configure.ccache]} {
</ins><span class="cx">                         lappend deplist ccache
</span><span class="cx">                     }
</span><span class="cx"> 
</span><span class="lines">@@ -1485,20 +1532,12 @@
</span><span class="cx">                         if {$result != 0} { break }
</span><span class="cx">                     }
</span><span class="cx">                 }
</span><del>-                # Execute post-run procedure
-                if {[ditem_contains $ditem postrun] &amp;&amp; $result == 0} {
-                    set postrun [ditem_key $ditem postrun]
-                    ui_debug &quot;Executing $postrun&quot;
-                    set result [catch {eval $postrun $targetname} errstr]
-                    # Save variables in order to re-throw the same error code.
-                    set errcode $::errorCode
-                    set errinfo $::errorInfo
-                }
</del><span class="cx"> 
</span><span class="cx">                 # Check dependencies &amp; file creations outside workpath.
</span><span class="cx">                 if {[info exists ports_trace]
</span><del>-                  &amp;&amp; $ports_trace == &quot;yes&quot;
-                  &amp;&amp; $target!=&quot;clean&quot;} {
</del><ins>+                  &amp;&amp; $ports_trace eq &quot;yes&quot;
+                  &amp;&amp; $target ne &quot;clean&quot;
+                  &amp;&amp; $target ne &quot;uninstall&quot;} {
</ins><span class="cx"> 
</span><span class="cx">                     tracelib closesocket
</span><span class="cx"> 
</span><span class="lines">@@ -1507,6 +1546,17 @@
</span><span class="cx">                     # End of trace.
</span><span class="cx">                     porttrace::trace_stop
</span><span class="cx">                 }
</span><ins>+
+                # Execute post-run procedure
+                if {[ditem_contains $ditem postrun] &amp;&amp; $result == 0} {
+                    set postrun [ditem_key $ditem postrun]
+                    ui_debug &quot;Executing $postrun&quot;
+                    set result [catch {eval $postrun $targetname} errstr]
+                    # Save variables in order to re-throw the same error code.
+                    set errcode $::errorCode
+                    set errinfo $::errorInfo
+                }
+
</ins><span class="cx">                 # $oldpwd is deleted while uninstalling a port, changing back
</span><span class="cx">                 # _will_ fail
</span><span class="cx">                 catch {_cd $oldpwd}
</span><span class="lines">@@ -1530,8 +1580,8 @@
</span><span class="cx">             # - this step is not to always be performed
</span><span class="cx">             # - this step must be written to file
</span><span class="cx">             if {$skipped == 0
</span><del>-          &amp;&amp; [ditem_key $ditem runtype] != &quot;always&quot;
-          &amp;&amp; [ditem_key $ditem state] != &quot;no&quot;} {
</del><ins>+          &amp;&amp; [ditem_key $ditem runtype] ne &quot;always&quot;
+          &amp;&amp; [ditem_key $ditem state] ne &quot;no&quot;} {
</ins><span class="cx">             write_statefile target $targetname $target_state_fd
</span><span class="cx">             }
</span><span class="cx">         } else {
</span><span class="lines">@@ -1546,14 +1596,14 @@
</span><span class="cx">         set result 1
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if {[ditem_key $ditem state] != &quot;no&quot;} {
</del><ins>+    if {[ditem_key $ditem state] ne &quot;no&quot;} {
</ins><span class="cx">         close $target_state_fd
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     set env(HOME) $savedhome
</span><span class="cx">     if {[info exists env(TMPDIR)]} {
</span><span class="cx">         unset env(TMPDIR)
</span><del>-        if {$macosx_version == &quot;10.5&quot;} {
</del><ins>+        if {$macosx_version eq &quot;10.5&quot;} {
</ins><span class="cx">             unsetenv TMPDIR
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="lines">@@ -1589,10 +1639,10 @@
</span><span class="cx">     # the statefile will likely be autocleaned away after install,
</span><span class="cx">     # so special-case already-completed install and activate
</span><span class="cx">     if {[registry_exists $subport $version $revision $portvariants]} {
</span><del>-        if {$target == &quot;install&quot;} {
</del><ins>+        if {$target eq &quot;install&quot;} {
</ins><span class="cx">             ui_debug &quot;Skipping $target ($subport) since this port is already installed&quot;
</span><span class="cx">             return 0
</span><del>-        } elseif {$target == &quot;activate&quot;} {
</del><ins>+        } elseif {$target eq &quot;activate&quot;} {
</ins><span class="cx">             set regref [registry_open $subport $version $revision $portvariants &quot;&quot;]
</span><span class="cx">             if {[registry_prop_retr $regref active] != 0} {
</span><span class="cx">                 # Something to close the registry entry may be called here, if it existed.
</span><span class="lines">@@ -1610,13 +1660,13 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     # Select the subset of targets under $target
</span><del>-    if {$target != &quot;&quot;} {
</del><ins>+    if {$target ne &quot;&quot;} {
</ins><span class="cx">         set matches [dlist_search $dlist provides $target]
</span><span class="cx"> 
</span><span class="cx">         if {[llength $matches] &gt; 0} {
</span><span class="cx">             set dlist [dlist_append_dependents $dlist [lindex $matches 0] [list]]
</span><span class="cx">             # Special-case 'all'
</span><del>-        } elseif {$target != &quot;all&quot;} {
</del><ins>+        } elseif {$target ne &quot;all&quot;} {
</ins><span class="cx">             ui_error &quot;unknown target: $target&quot;
</span><span class="cx">             return 1
</span><span class="cx">         }
</span><span class="lines">@@ -1911,9 +1961,9 @@
</span><span class="cx">         set ignored 0
</span><span class="cx">         foreach flavor [ditem_key $ditem provides] {
</span><span class="cx">             if {[info exists upvariations($flavor)]} {
</span><del>-                if {$upvariations($flavor) == &quot;+&quot;} {
</del><ins>+                if {$upvariations($flavor) eq &quot;+&quot;} {
</ins><span class="cx">                     incr pros
</span><del>-                } elseif {$upvariations($flavor) == &quot;-&quot;} {
</del><ins>+                } elseif {$upvariations($flavor) eq &quot;-&quot;} {
</ins><span class="cx">                     incr cons
</span><span class="cx">                 }
</span><span class="cx">             } else {
</span><span class="lines">@@ -2069,14 +2119,14 @@
</span><span class="cx">         set ditems [dlist_append_dependents $targets [lindex $ditems 0] [list]]
</span><span class="cx">     }
</span><span class="cx">     foreach d $ditems {
</span><del>-        if {[ditem_key $d state] != &quot;no&quot;} {
</del><ins>+        if {[ditem_key $d state] ne &quot;no&quot;} {
</ins><span class="cx">             # At least one matching target requires the state file
</span><span class="cx">             set statereq 1
</span><span class="cx">             break
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx">     if { $statereq &amp;&amp;
</span><del>-        !([info exists ports_force] &amp;&amp; $ports_force == &quot;yes&quot;)} {
</del><ins>+        !([info exists ports_force] &amp;&amp; $ports_force eq &quot;yes&quot;)} {
</ins><span class="cx"> 
</span><span class="cx">         set state_fd [open_statefile]
</span><span class="cx"> 
</span><span class="lines">@@ -2084,7 +2134,7 @@
</span><span class="cx">         if {[check_statefile_variants variations oldvariations $state_fd]} {
</span><span class="cx">             ui_error &quot;Requested variants \&quot;[canonicalize_variants [array get variations]]\&quot; do not match original selection \&quot;[canonicalize_variants [array get oldvariations]]\&quot;.\nPlease use the same variants again, perform 'port clean [option subport]' or specify the force option (-f).&quot;
</span><span class="cx">             set result 1
</span><del>-        } elseif {!([info exists ports_dryrun] &amp;&amp; $ports_dryrun == &quot;yes&quot;)} {
</del><ins>+        } elseif {!([info exists ports_dryrun] &amp;&amp; $ports_dryrun eq &quot;yes&quot;)} {
</ins><span class="cx">             # Write variations out to the statefile
</span><span class="cx">             foreach key [array names variations *] {
</span><span class="cx">                 write_statefile variant $variations($key)$key $state_fd
</span><span class="lines">@@ -2139,7 +2189,7 @@
</span><span class="cx">     foreach target $args {
</span><span class="cx">         set origproc [ditem_key $ditem procedure]
</span><span class="cx">         set ident [ditem_key $ditem name]
</span><del>-        if {[info commands $target] == &quot;&quot;} {
</del><ins>+        if {[info commands $target] eq &quot;&quot;} {
</ins><span class="cx">             proc $target {args} &quot;
</span><span class="cx">                 variable proc_index
</span><span class="cx">                 set proc_index \[llength \[ditem_key $ditem proc\]\]
</span><span class="lines">@@ -2235,7 +2285,6 @@
</span><span class="cx">                 set PortInfo(vinfo) {}
</span><span class="cx">             }
</span><span class="cx">             array set vinfo $PortInfo(vinfo)
</span><del>-
</del><span class="cx">             foreach v $value {
</span><span class="cx">                 if {[regexp {([-+])([-A-Za-z0-9_]+)} $v whole val variant] &amp;&amp; ![info exists variations($variant)]} {
</span><span class="cx">                     # Retrieve the information associated with this variant.
</span><span class="lines">@@ -2265,9 +2314,9 @@
</span><span class="cx"> proc handle_add_users {} {
</span><span class="cx">     set cur &quot;&quot;
</span><span class="cx">     foreach val [option add_users] {
</span><del>-        if {[string match *=* $val] &amp;&amp; $cur != &quot;&quot;} {
</del><ins>+        if {[string match &quot;*=*&quot; $val] &amp;&amp; $cur ne &quot;&quot;} {
</ins><span class="cx">             set split_arg [split $val =]
</span><del>-            if {[lindex $split_arg 0] == &quot;group&quot;} {
</del><ins>+            if {[lindex $split_arg 0] eq &quot;group&quot;} {
</ins><span class="cx">                 set groupname [lindex $split_arg 1]
</span><span class="cx">                 addgroup $groupname
</span><span class="cx">                 lappend args($cur) gid=[existsgroup $groupname]
</span><span class="lines">@@ -2314,22 +2363,74 @@
</span><span class="cx"> 
</span><span class="cx">     if {${os.platform} eq &quot;darwin&quot;} {
</span><span class="cx">         set dscl [findBinary dscl $portutil::autoconf::dscl_path]
</span><del>-        exec $dscl . -create /Users/${name} UniqueID ${uid}
</del><ins>+        set failed? 0
+        try {
+            exec $dscl . -create /Users/${name} UniqueID ${uid} 2&gt;@stderr
</ins><span class="cx"> 
</span><del>-        # These are implicitly added on Mac OSX Lion.  AuthenticationAuthority
-        # causes the user to be visible in the Users &amp; Groups Preference Pane,
-        # and the others are just noise, so delete them.
-        # https://trac.macports.org/ticket/30168
-        exec $dscl . -delete /Users/${name} AuthenticationAuthority
-        exec $dscl . -delete /Users/${name} PasswordPolicyOptions
-        exec $dscl . -delete /Users/${name} dsAttrTypeNative:KerberosKeys
-        exec $dscl . -delete /Users/${name} dsAttrTypeNative:ShadowHashData
</del><ins>+            # These are implicitly added on Mac OSX Lion.  AuthenticationAuthority
+            # causes the user to be visible in the Users &amp; Groups Preference Pane,
+            # and the others are just noise, so delete them.
+            # https://trac.macports.org/ticket/30168
+            exec $dscl . -delete /Users/${name} AuthenticationAuthority 2&gt;@stderr
+            exec $dscl . -delete /Users/${name} PasswordPolicyOptions 2&gt;@stderr
+            exec $dscl . -delete /Users/${name} dsAttrTypeNative:KerberosKeys 2&gt;@stderr
+            exec $dscl . -delete /Users/${name} dsAttrTypeNative:ShadowHashData 2&gt;@stderr
</ins><span class="cx"> 
</span><del>-        exec $dscl . -create /Users/${name} RealName ${realname}
-        exec $dscl . -create /Users/${name} Password ${passwd}
-        exec $dscl . -create /Users/${name} PrimaryGroupID ${gid}
-        exec $dscl . -create /Users/${name} NFSHomeDirectory ${home}
-        exec $dscl . -create /Users/${name} UserShell ${shell}
</del><ins>+            exec $dscl . -create /Users/${name} RealName ${realname} 2&gt;@stderr
+            exec $dscl . -create /Users/${name} Password ${passwd} 2&gt;@stderr
+            exec $dscl . -create /Users/${name} PrimaryGroupID ${gid} 2&gt;@stderr
+            exec $dscl . -create /Users/${name} NFSHomeDirectory ${home} 2&gt;@stderr
+            exec $dscl . -create /Users/${name} UserShell ${shell} 2&gt;@stderr
+        } catch {{CHILDKILLED *} eCode eMessage} {
+            # the foreachs are a simple workaround for Tcl 8.4, which doesn't
+            # seem to have lassign
+            foreach {- pid sigName msg} $eCode {
+                ui_error &quot;dscl($pid) was killed by $sigName: $msg&quot;
+                ui_debug &quot;dscl printed: $eMessage&quot;
+            }
+
+            set failed? 1
+        } catch {{CHILDSTATUS *} eCode eMessage} {
+            foreach {- pid code} $eCode {
+                ui_error &quot;dscl($pid) termined with an exit status of $code&quot;
+                ui_debug &quot;dscl printed: $eMessage&quot;
+            }
+            
+            set failed? 1
+        } catch {{POSIX *} eCode eMessage} {
+            foreach {- errName msg} {
+                ui_error &quot;failed to execute $dscl: $errName: $msg&quot;
+                ui_debug &quot;dscl printed: $eMessage&quot;
+            }
+
+            set failed? 1
+        } finally {
+            if {${failed?}} {
+                # creating the user properly failed and we're bailing out
+                # anyway, try to delete the half-created user to revert to the
+                # state before the error
+                ui_debug &quot;Attempting to clean up failed creation of user $name&quot;
+                try {
+                    exec $dscl . -delete /Users/${name} 2&gt;@stderr
+                } catch {{CHILDKILLED *} eCode eMessage} {
+                    foreach {- pid sigName msg} {
+                        ui_warn &quot;dscl($pid) was killed by $sigName: $msg while trying to clean up failed creation of user $name.&quot;
+                        ui_debug &quot;dscl printed: $eMessage&quot;
+                    }
+                } catch {{CHILDSTATUS *} eCode eMessage} {
+                    # ignoring childstatus failure, because that probably means
+                    # the first call failed and the user wasn't even created
+                } catch {{POSIX *} eCode eMessage} {
+                    foreach {- errName msg} {
+                        ui_warn &quot;failed to execute $dscl: $errName: $msg while trying to clean up failed creation of user $name.&quot;
+                        ui_debug &quot;dscl printed: $eMessage&quot;
+                    }
+                }
+
+                # and raise an error to abort
+                error &quot;dscl failed to create required user $name.&quot;
+            }
+        }
</ins><span class="cx">     } else {
</span><span class="cx">         # XXX adduser is only available for darwin, add more support here
</span><span class="cx">         ui_warn &quot;adduser is not implemented on ${os.platform}.&quot;
</span><span class="lines">@@ -2370,11 +2471,63 @@
</span><span class="cx"> 
</span><span class="cx">     if {${os.platform} eq &quot;darwin&quot;} {
</span><span class="cx">         set dscl [findBinary dscl $portutil::autoconf::dscl_path]
</span><del>-        exec $dscl . -create /Groups/${name} Password ${passwd}
-        exec $dscl . -create /Groups/${name} RealName ${realname}
-        exec $dscl . -create /Groups/${name} PrimaryGroupID ${gid}
-        if {${users} ne &quot;&quot;} {
-            exec $dscl . -create /Groups/${name} GroupMembership ${users}
</del><ins>+        set failed? 0
+        try {
+            exec $dscl . -create /Groups/${name} Password ${passwd}
+            exec $dscl . -create /Groups/${name} RealName ${realname}
+            exec $dscl . -create /Groups/${name} PrimaryGroupID ${gid}
+            if {${users} ne &quot;&quot;} {
+                exec $dscl . -create /Groups/${name} GroupMembership ${users}
+            }
+        } catch {{CHILDKILLED *} eCode eMessage} {
+            # the foreachs are a simple workaround for Tcl 8.4, which doesn't
+            # seem to have lassign
+            foreach {- pid sigName msg} $eCode {
+                ui_error &quot;dscl($pid) was killed by $sigName: $msg&quot;
+                ui_debug &quot;dscl printed: $eMessage&quot;
+            }
+
+            set failed? 1
+        } catch {{CHILDSTATUS *} eCode eMessage} {
+            foreach {- pid code} $eCode {
+                ui_error &quot;dscl($pid) termined with an exit status of $code&quot;
+                ui_debug &quot;dscl printed: $eMessage&quot;
+            }
+            
+            set failed? 1
+        } catch {{POSIX *} eCode eMessage} {
+            foreach {- errName msg} {
+                ui_error &quot;failed to execute $dscl: $errName: $msg&quot;
+                ui_debug &quot;dscl printed: $eMessage&quot;
+            }
+
+            set failed? 1
+        } finally {
+            if {${failed?}} {
+                # creating the user properly failed and we're bailing out
+                # anyway, try to delete the half-created user to revert to the
+                # state before the error
+                ui_debug &quot;Attempting to clean up failed creation of group $name&quot;
+                try {
+                    exec $dscl . -delete /Groups/${name} 2&gt;@stderr
+                } catch {{CHILDKILLED *} eCode eMessage} {
+                    foreach {- pid sigName msg} {
+                        ui_warn &quot;dscl($pid) was killed by $sigName: $msg while trying to clean up failed creation of group $name.&quot;
+                        ui_debug &quot;dscl printed: $eMessage&quot;
+                    }
+                } catch {{CHILDSTATUS *} eCode eMessage} {
+                    # ignoring childstatus failure, because that probably means
+                    # the first call failed and the user wasn't even created
+                } catch {{POSIX *} eCode eMessage} {
+                    foreach {- errName msg} {
+                        ui_warn &quot;failed to execute $dscl: $errName: $msg while trying to clean up failed creation of group $name.&quot;
+                        ui_debug &quot;dscl printed: $eMessage&quot;
+                    }
+                }
+
+                # and raise an error to abort
+                error &quot;dscl failed to create required group $name.&quot;
+            }
</ins><span class="cx">         }
</span><span class="cx">     } else {
</span><span class="cx">         # XXX addgroup is only available for darwin, add more support here
</span><span class="lines">@@ -2422,6 +2575,7 @@
</span><span class="cx"> 
</span><span class="cx">     if {[file exists $groupFile]} {
</span><span class="cx">         uplevel &quot;source $groupFile&quot;
</span><ins>+        ui_debug &quot;Sourcing PortGroup $group $version from $groupFile&quot;
</ins><span class="cx">     } else {
</span><span class="cx">         ui_warn &quot;PortGroup ${group} ${version} could not be located. ${group}-${version}.tcl does not exist.&quot;
</span><span class="cx">     }
</span><span class="lines">@@ -2446,7 +2600,7 @@
</span><span class="cx"> # return path where a newly created image/archive for this port will be stored
</span><span class="cx"> proc get_portimage_path {} {
</span><span class="cx">     global portdbpath subport
</span><del>-    return [file join ${portdbpath} software ${subport} [get_portimage_name]]
</del><ins>+    return [file normalize [file join ${portdbpath} software ${subport} [get_portimage_name]]]
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> # return list of archive types that we can extract
</span><span class="lines">@@ -2607,7 +2761,7 @@
</span><span class="cx">         close $fd
</span><span class="cx">         file delete -force $tempdir
</span><span class="cx">     }
</span><del>-    if {$metadata_type == &quot;contents&quot;} {
</del><ins>+    if {$metadata_type eq &quot;contents&quot;} {
</ins><span class="cx">         set contents {}
</span><span class="cx">         set ignore 0
</span><span class="cx">         set sep [file separator]
</span><span class="lines">@@ -2623,7 +2777,7 @@
</span><span class="cx">             }
</span><span class="cx">         }
</span><span class="cx">         return $contents
</span><del>-    } elseif {$metadata_type == &quot;portname&quot;} {
</del><ins>+    } elseif {$metadata_type eq &quot;portname&quot;} {
</ins><span class="cx">         foreach line [split $raw_contents \n] {
</span><span class="cx">             if {[lindex $line 0] == &quot;@portname&quot;} {
</span><span class="cx">                 return [lindex $line 1]
</span><span class="lines">@@ -2688,7 +2842,7 @@
</span><span class="cx">     set archs &quot;&quot;
</span><span class="cx">     set base_arch &quot;&quot;
</span><span class="cx">     foreach arch ${configure.universal_archs} {
</span><del>-        if [file exists &quot;${base}/${arch}&quot;] {
</del><ins>+        if {[file exists &quot;${base}/${arch}&quot;]} {
</ins><span class="cx">             set archs [concat ${archs} ${arch}]
</span><span class="cx">             set base_arch ${arch}
</span><span class="cx">         }
</span><span class="lines">@@ -2812,7 +2966,7 @@
</span><span class="cx">         }
</span><span class="cx">     } else {
</span><span class="cx">         # not root, so can't set owner/group
</span><del>-        set permissions [lindex $attributes [expr [lsearch $attributes &quot;-permissions&quot;] + 1]]
</del><ins>+        set permissions [lindex $attributes [expr {[lsearch $attributes &quot;-permissions&quot;] + 1}]]
</ins><span class="cx">         file attributes $file -permissions $permissions
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="lines">@@ -2865,7 +3019,7 @@
</span><span class="cx"> 
</span><span class="cx"> proc validate_macportsuser {} {
</span><span class="cx">     global macportsuser
</span><del>-    if {[getuid] == 0 &amp;&amp; $macportsuser != &quot;root&quot; &amp;&amp; 
</del><ins>+    if {[getuid] == 0 &amp;&amp; $macportsuser ne &quot;root&quot; &amp;&amp; 
</ins><span class="cx">         ([existsuser $macportsuser] == 0 || [existsgroup $macportsuser] == 0 )} {
</span><span class="cx">         ui_warn &quot;configured user/group $macportsuser does not exist, will build as root&quot;
</span><span class="cx">         set macportsuser &quot;root&quot;
</span><span class="lines">@@ -2906,7 +3060,7 @@
</span><span class="cx"> 
</span><span class="cx">     set i [string first . $depline]
</span><span class="cx">     if {$i &lt; 0} {set i [string length $depline]}
</span><del>-    set depname [string range $depline 0 [expr $i - 1]]
</del><ins>+    set depname [string range $depline 0 [expr {$i - 1}]]
</ins><span class="cx">     set depversion [string range $depline $i end]
</span><span class="cx">     regsub {\.} $depversion {\.} depversion
</span><span class="cx">     if {${os.platform} == &quot;darwin&quot;} {
</span><span class="lines">@@ -2942,7 +3096,7 @@
</span><span class="cx"> 
</span><span class="cx">     regexp {^(.*)/(.*?)$} &quot;$fullname&quot; match search_path depregex
</span><span class="cx"> 
</span><del>-    if {[string index $search_path 0] != &quot;/&quot;} {
</del><ins>+    if {[string index $search_path 0] ne &quot;/&quot;} {
</ins><span class="cx">         # Prepend prefix if not an absolute path
</span><span class="cx">         set search_path &quot;${prefix}/${search_path}&quot;
</span><span class="cx">     }
</span><span class="lines">@@ -2973,7 +3127,7 @@
</span><span class="cx">             set depfile [_pathtest $depspec 1]
</span><span class="cx">         }
</span><span class="cx">     }
</span><del>-    if {$depfile == &quot;&quot;} {
</del><ins>+    if {$depfile eq &quot;&quot;} {
</ins><span class="cx">         return $portname
</span><span class="cx">     } else {
</span><span class="cx">         set theport [registry_file_registered $depfile]
</span><span class="lines">@@ -2988,7 +3142,7 @@
</span><span class="cx"> # returns the list of archs that the port is targeting
</span><span class="cx"> proc get_canonical_archs {} {
</span><span class="cx">     global supported_archs os.arch configure.build_arch configure.universal_archs
</span><del>-    if {$supported_archs == &quot;noarch&quot;} {
</del><ins>+    if {$supported_archs eq &quot;noarch&quot;} {
</ins><span class="cx">         return &quot;noarch&quot;
</span><span class="cx">     } elseif {[variant_exists universal] &amp;&amp; [variant_isset universal]} {
</span><span class="cx">         return [lsort -ascii ${configure.universal_archs}]
</span><span class="lines">@@ -3006,7 +3160,7 @@
</span><span class="cx">             return -code error &quot;archflags do not exist for tool '$tool'&quot;
</span><span class="cx">         }
</span><span class="cx">     } else {
</span><del>-        if {$tool == &quot;cc&quot;} {
</del><ins>+        if {$tool eq &quot;cc&quot;} {
</ins><span class="cx">             set tool c
</span><span class="cx">         }
</span><span class="cx">         if {[catch {option configure.universal_${tool}flags} flags]} {
</span><span class="lines">@@ -3019,7 +3173,7 @@
</span><span class="cx"> # check that the selected archs are supported
</span><span class="cx"> proc check_supported_archs {} {
</span><span class="cx">     global supported_archs build_arch universal_archs configure.build_arch configure.universal_archs subport
</span><del>-    if {$supported_archs == &quot;noarch&quot;} {
</del><ins>+    if {$supported_archs eq &quot;noarch&quot;} {
</ins><span class="cx">         return 0
</span><span class="cx">     } elseif {[variant_exists universal] &amp;&amp; [variant_isset universal]} {
</span><span class="cx">         if {[llength ${configure.universal_archs}] &gt; 1 || $universal_archs == ${configure.universal_archs}} {
</span><span class="lines">@@ -3028,7 +3182,7 @@
</span><span class="cx">             ui_error &quot;$subport cannot be installed for the configured universal_archs '$universal_archs' because it only supports the arch(s) '$supported_archs'.&quot;
</span><span class="cx">             return 1
</span><span class="cx">         }
</span><del>-    } elseif {$build_arch == &quot;&quot; || ${configure.build_arch} != &quot;&quot;} {
</del><ins>+    } elseif {$build_arch eq &quot;&quot; || ${configure.build_arch} != &quot;&quot;} {
</ins><span class="cx">         return 0
</span><span class="cx">     }
</span><span class="cx">     ui_error &quot;$subport cannot be installed for the configured build_arch '$build_arch' because it only supports the arch(s) '$supported_archs'.&quot;
</span><span class="lines">@@ -3039,7 +3193,7 @@
</span><span class="cx"> proc _check_xcode_version {} {
</span><span class="cx">     global os.subplatform macosx_version xcodeversion
</span><span class="cx"> 
</span><del>-    if {${os.subplatform} == &quot;macosx&quot;} {
</del><ins>+    if {${os.subplatform} eq &quot;macosx&quot;} {
</ins><span class="cx">         switch $macosx_version {
</span><span class="cx">             10.4 {
</span><span class="cx">                 set min 2.0
</span><span class="lines">@@ -3059,15 +3213,20 @@
</span><span class="cx">             10.7 {
</span><span class="cx">                 set min 4.1
</span><span class="cx">                 set ok 4.1
</span><del>-                set rec 4.6.2
</del><ins>+                set rec 4.6.3
</ins><span class="cx">             }
</span><del>-            default {
</del><ins>+            10.8 {
</ins><span class="cx">                 set min 4.4
</span><span class="cx">                 set ok 4.4
</span><del>-                set rec 4.6.2
</del><ins>+                set rec 4.6.3
</ins><span class="cx">             }
</span><ins>+            default {
+                set min 5.0.1
+                set ok 5.0.1
+                set rec 5.0.1
+            }
</ins><span class="cx">         }
</span><del>-        if {$xcodeversion == &quot;none&quot;} {
</del><ins>+        if {$xcodeversion eq &quot;none&quot;} {
</ins><span class="cx">             ui_warn &quot;Xcode does not appear to be installed; most ports will likely fail to build.&quot;
</span><span class="cx">             if {[file exists &quot;/Applications/Install Xcode.app&quot;]} {
</span><span class="cx">                 ui_warn &quot;You downloaded Xcode from the Mac App Store but didn't install it. Run \&quot;Install Xcode\&quot; in the /Applications folder.&quot;
</span><span class="lines">@@ -3079,16 +3238,38 @@
</span><span class="cx">             ui_warn &quot;The installed version of Xcode (${xcodeversion}) is known to cause problems. Version $rec or later is recommended on Mac OS X ${macosx_version}.&quot;
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        # Xcode 4.3 requires the command-line utilities package to be
-        # installed. 
-        if {[vercmp $xcodeversion 4.3] &gt;= 0 ||
-            ($xcodeversion == &quot;none&quot; &amp;&amp; [file exists &quot;/Applications/Xcode.app&quot;])} {
-            if {![file exists &quot;/usr/bin/make&quot;]} {
-                ui_warn &quot;The Command Line Tools for Xcode don't appear to be installed; most ports will likely fail to build.&quot;
-                ui_warn &quot;See http://guide.macports.org/chunked/installing.xcode.html for more information.&quot;
</del><ins>+        # Xcode 4.3 and above requires the command-line utilities package to be installed. 
+        if {[vercmp $xcodeversion 4.3] &gt;= 0 || ($xcodeversion eq &quot;none&quot; &amp;&amp; [file exists &quot;/Applications/Xcode.app&quot;])} {
+            if {[vercmp $macosx_version 10.9] &gt;= 0} {
+                # on Mavericks, /usr/bin/make might always installed as a shim into the command line tools installer.
+                # Let's check for /Library/Developer/CommandLineTools, installed by the
+                # com.apple.pkg.CLTools_Executables package.
+                set cltpath &quot;/Library/Developer/CommandLineTools&quot;
+            } else {
+                set cltpath &quot;/&quot;
</ins><span class="cx">             }
</span><ins>+
+            # Check whether /usr/include and /usr/bin/make exist and tell users to install the command line tools, if they don't
+            if {   ![file isdirectory [file join $cltpath usr include]]
+                || ![file executable  [file join $cltpath usr bin make]]} {
+                ui_warn &quot;The Xcode Command Line Tools don't appear to be installed; most ports will likely fail to build.&quot;
+                if {[vercmp $macosx_version 10.9] &gt;= 0} {
+                    ui_warn &quot;Install them by running `xcode-select --install'.&quot;
+                } else {
+                    ui_warn &quot;You can install them from Xcode's Preferences in the Downloads section.&quot;
+                    ui_warn &quot;See http://guide.macports.org/chunked/installing.xcode.html#installing.xcode.lion.43 for more information.&quot;
+                }
+            }
+
+            # Check whether users have agreed to the Xcode license agreement
+            catch {exec [findBinary xcrun $portutil::autoconf::xcrun_path] clang 2&gt;@1} output
+            set output [join [lrange [split $output &quot;\n&quot;] 0 end-1] &quot;\n&quot;]
+            if {[string match -nocase &quot;*license*&quot; $output]} {
+                ui_error &quot;It seems you have not accepted the Xcode license; most ports will fail to build.&quot;
+                ui_error &quot;Agree to the license by opening Xcode or running `sudo xcodebuild -license'.&quot;
+                return 1
+            }
</ins><span class="cx">         }
</span><del>-        
</del><span class="cx">     }
</span><span class="cx">     return 0
</span><span class="cx"> }
</span><span class="lines">@@ -3106,13 +3287,13 @@
</span><span class="cx">         return 0
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if {[find_portarchive_path] != &quot;&quot;} {
</del><ins>+    if {[find_portarchive_path] ne &quot;&quot;} {
</ins><span class="cx">         set archive_available_result 1
</span><span class="cx">         return 1
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     set archiverootname [file rootname [get_portimage_name]]
</span><del>-    if {[file rootname [file tail $porturl]] == $archiverootname &amp;&amp; [file extension $porturl] != &quot;&quot;} {
</del><ins>+    if {[file rootname [file tail $porturl]] eq $archiverootname &amp;&amp; [file extension $porturl] ne &quot;&quot;} {
</ins><span class="cx">         set archive_available_result 1
</span><span class="cx">         return 1
</span><span class="cx">     }
</span><span class="lines">@@ -3134,7 +3315,7 @@
</span><span class="cx">     # look for and strip off any tag, which will start with the first colon after the
</span><span class="cx">     # first slash after the ://
</span><span class="cx">     set lastcolon [string last : $sites_entry]
</span><del>-    set aftersep [expr [string first : $sites_entry] + 3]
</del><ins>+    set aftersep [expr {[string first : $sites_entry] + 3}]
</ins><span class="cx">     set firstslash [string first / $sites_entry $aftersep]
</span><span class="cx">     if {$firstslash != -1 &amp;&amp; $firstslash &lt; $lastcolon} {
</span><span class="cx">         incr lastcolon -1
</span><span class="lines">@@ -3142,7 +3323,7 @@
</span><span class="cx">     } else {
</span><span class="cx">         set site $sites_entry
</span><span class="cx">     }
</span><del>-    if {[string index $site end] != &quot;/&quot;} {
</del><ins>+    if {[string index $site end] ne &quot;/&quot;} {
</ins><span class="cx">         append site &quot;/[option archive.subdir]&quot;
</span><span class="cx">     } else {
</span><span class="cx">         append site [option archive.subdir]
</span></span></pre></div>
<a id="branchesnewhelpsystembasesrcport10testsPortfilefromrev117083trunkbasesrcport10testsPortfile"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/src/port1.0/tests/Portfile (from rev 117083, trunk/base/src/port1.0/tests/Portfile) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/port1.0/tests/Portfile                                (rev 0)
+++ branches/new-help-system/base/src/port1.0/tests/Portfile        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,55 @@
</span><ins>+# $Id: Portfile 85472 2011-10-14 01:52:18Z dports@macports.org $
+
+PortSystem              1.0
+
+name                    fondu
+version                 060102
+revision                1
+platforms               darwin
+categories              print
+license                 BSD
+maintainers             nomaintainer
+homepage                http://fondu.sourceforge.net/
+master_sites            http://fondu.sourceforge.net/
+
+description             A set of programs to interconvert between Mac font \
+                        formats and pfb, ttf, otf and bdf files on UNIX.
+
+long_description        Dealing with Mac fonts is hard on other operating \
+                        systems because Mac fonts are stored in the resource \
+                        fork, and other operating systems do not support \
+                        this concept. Fondu will extract the resource fork \
+                        from either a MacBinary file or a BinHex file. Ufond \
+                        will create a resource fork inside a MacBinary file.
+
+checksums               md5 e20861beacddc1ab392bef7813641bf8
+extract.suffix          .tgz
+distfiles               ${name}_src-${version}${extract.suffix}
+
+patchfiles
+
+patch {
+    foreach patch $patchfiles {
+        set fd [open ${portpath}/files/${patch} r]
+        set var [gets $fd]
+        close $fd
+        set fd [open ${workpath}/${distname}/test_patch w+]
+        puts $fd $var
+        close $fd
+    }
+}
+
+post-patch {
+    reinplace &quot;s|^CFLAGS = -g \$(WFLAGS)|CFLAGS = -g \$(WFLAGS) ${configure.cppflags} ${configure.cflags} ${configure.ldflags} [get_canonical_archflags]|g&quot; ${worksrcpath}/Makefile.in
+}
+
+configure.args          --bindir=${prefix}/bin \
+                        --mandir=${prefix}/share/man
+
+post-destroot {
+    eval xinstall -m 644 [glob ${worksrcpath}/*.1] ${destroot}${prefix}/share/man/man1/
+}
+
+test {
+    file delete -force $worksrcpath/README
+}
</ins></span></pre></div>
<a id="branchesnewhelpsystembasesrcport10testscommontcl"></a>
<div class="delfile"><h4>Deleted: branches/new-help-system/base/src/port1.0/tests/common.tcl (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/port1.0/tests/common.tcl        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/src/port1.0/tests/common.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -1,18 +0,0 @@
</span><del>-proc test_equal {statement value} {
-    uplevel 1 &quot;\
-        puts -nonewline {checking if $statement == \&quot;$value\&quot;... }
-        if {\[catch {
-                set actual $statement
-                if {\$actual == \[subst {$value}\]} { \n\
-                    puts yes
-                } else { \n\
-                    puts \&quot;no (was \$actual)\&quot; \n\
-                    exit 1 \n\
-                } \n\
-            } msg\]} { \n\
-                puts \&quot;caught error: \$msg\&quot; \n\
-                exit 1 \n\
-            }&quot;
-}
-
-
</del></span></pre></div>
<a id="branchesnewhelpsystembasesrcport10testslibrarytclfromrev117083trunkbasesrcport10testslibrarytcl"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/src/port1.0/tests/library.tcl (from rev 117083, trunk/base/src/port1.0/tests/library.tcl) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/port1.0/tests/library.tcl                                (rev 0)
+++ branches/new-help-system/base/src/port1.0/tests/library.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,65 @@
</span><ins>+##
+# This is basically a copy of macports::worker_init, but without using
+# sub-interpreters
+proc macports_worker_init {} {
+    interp alias {} _cd {} cd
+    proc PortSystem {version} {
+        package require port $version
+    }
+    # Clearly separate slave interpreters and the master interpreter.
+    interp alias {} mport_exec      {} mportexec
+    interp alias {} mport_open      {} mportopen
+    interp alias {} mport_close     {} mportclose
+    interp alias {} mport_lookup    {} mportlookup
+    interp alias {} mport_info      {} mportinfo
+    # Export some utility functions defined here.
+    interp alias {} macports_create_thread          {} macports::create_thread
+    interp alias {} getportworkpath_from_buildpath  {} macports::getportworkpath_from_buildpath
+    interp alias {} getportresourcepath             {} macports::getportresourcepath
+    interp alias {} getportlogpath                  {} macports::getportlogpath
+    interp alias {} getdefaultportresourcepath      {} macports::getdefaultportresourcepath
+    interp alias {} getprotocol                     {} macports::getprotocol
+    interp alias {} getportdir                      {} macports::getportdir
+    interp alias {} findBinary                      {} macports::findBinary
+    interp alias {} binaryInPath                    {} macports::binaryInPath
+    # New Registry/Receipts stuff
+    interp alias {} registry_new                    {} registry::new_entry
+    interp alias {} registry_open                   {} registry::open_entry
+    interp alias {} registry_write                  {} registry::write_entry
+    interp alias {} registry_prop_store             {} registry::property_store
+    interp alias {} registry_prop_retr              {} registry::property_retrieve
+    interp alias {} registry_exists                 {} registry::entry_exists
+    interp alias {} registry_exists_for_name        {} registry::entry_exists_for_name
+    interp alias {} registry_activate               {} portimage::activate
+    interp alias {} registry_deactivate             {} portimage::deactivate
+    interp alias {} registry_deactivate_composite   {} portimage::deactivate_composite
+    interp alias {} registry_uninstall              {} registry_uninstall::uninstall
+    interp alias {} registry_register_deps          {} registry::register_dependencies
+    interp alias {} registry_fileinfo_for_index     {} registry::fileinfo_for_index
+    interp alias {} registry_fileinfo_for_file      {} registry::fileinfo_for_file
+    interp alias {} registry_bulk_register_files    {} registry::register_bulk_files
+    interp alias {} registry_active                 {} registry::active
+    interp alias {} registry_file_registered        {} registry::file_registered
+    interp alias {} registry_port_registered        {} registry::port_registered
+    interp alias {} registry_list_depends           {} registry::list_depends
+    # deferred options processing.
+    interp alias {} getoption {} macports::getoption
+    # ping cache
+    interp alias {} get_pingtime {} macports::get_pingtime
+    interp alias {} set_pingtime {} macports::set_pingtime
+    # archive_sites.conf handling
+    interp alias {} get_archive_sites_conf_values {} macports::get_archive_sites_conf_values
+    foreach opt $macports::portinterp_options {
+        if {![info exists $opt]} {
+            global macports::$opt
+            set ::$opt macports::$opt
+        }
+        if {[info exists $opt]} {
+            set system_options($opt) $opt
+            set ::$opt $opt
+        }
+    }
+
+    # We don't need to handle portinterp_deferred_options, they're
+    # automatically handled correctly.
+}
</ins></span></pre></div>
<a id="branchesnewhelpsystembasesrcport10testsportactivatetestfromrev117083trunkbasesrcport10testsportactivatetest"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/src/port1.0/tests/portactivate.test (from rev 117083, trunk/base/src/port1.0/tests/portactivate.test) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/port1.0/tests/portactivate.test                                (rev 0)
+++ branches/new-help-system/base/src/port1.0/tests/portactivate.test        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,107 @@
</span><ins>+# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
+
+package require tcltest 2
+namespace import tcltest::*
+
+set pwd [file dirname [file normalize $argv0]]
+
+source ../port_test_autoconf.tcl
+source $macports::autoconf::macports_tcl_dir/macports1.0/macports_fastload.tcl
+package require macports 1.0
+
+array set ui_options {}
+#set ui_options(ports_debug)   yes
+#set ui_options(ports_verbose) yes
+mportinit ui_options
+
+package require portactivate 1.0
+package require registry 1.0
+source ./library.tcl
+macports_worker_init
+
+
+test activate_start {
+    Activate start unit test.
+    Requires root for setting euid.
+} -constraints {
+    root
+} -setup {
+    # file writable $prefix is used to determine whether privilege escalation
+    # is needed, so set prefix to a directory unwritable for this user
+    set prefix /usr/bin
+
+    # elevateToRoot uses $euid and $egid as the IDs to set
+    set euid 0
+    set egid 0
+
+} -body {
+    # drop privileges; the code won't attempt to elevate privileges without
+    # that
+    seteuid 333
+    if {[catch {portactivate::activate_start args}] != 0} {
+        return &quot;FAIL: couldn't elevate privileges&quot;
+    }
+
+    # when uid == 0 and euid == 0, the code will not attempt to elevate
+    # privileges
+    seteuid 0
+    if {[catch {portactivate::activate_start args}] != 0} {
+        return &quot;FAIL: couldn't elevate privileges&quot;
+    }
+    return &quot;Activate_start successful.&quot;
+} -result &quot;Activate_start successful.&quot;
+
+
+test activate_main {
+    Activate main unit test.
+} -constraints {
+    root
+} -setup {
+    set destpath $pwd/work/destroot
+    set portbuildpath $pwd
+    set portdbpath $pwd/dbpath
+    set portpath $pwd
+
+    set mport [mportopen file://.]
+
+    # set $version var
+    set workername [ditem_key $mport workername]
+
+    # portinstall setup
+    interp alias {} _cd {} cd
+
+    # hide all output. Deactivate this for debugging!
+    set oldchannels [array get macports::channels]
+    set macports::channels(msg)    {}
+    set macports::channels(notice) {}
+
+    if {[$workername eval eval_targets install] != 0} {
+        return &quot;FAIL: port install failed&quot;
+    }
+
+} -body {
+    if {[$workername eval eval_targets activate] != 0} {
+        return &quot;FAIL: cannot activate port after install&quot;
+    }
+    if {[$workername eval eval_targets deactivate] != 0} {
+        return &quot;FAIL: cannot deactivate port&quot;
+    }
+    if {[$workername eval eval_targets activate] != 0} {
+        return &quot;FAIL: cannot activate port after deactivate&quot;
+    }
+    return &quot;Port activate successful.&quot;
+
+} -cleanup {
+    if {[$workername eval eval_targets uninstall] != 0} {
+        return &quot;FAIL: uninstall failed&quot;
+    }
+    if {[$workername eval eval_targets clean] != 0} {
+        return &quot;FAIL: clean failed&quot;
+    }
+    array set macports::channels $oldchannels
+
+    mportclose $mport
+} -result &quot;Port activate successful.&quot;
+
+
+cleanupTests
</ins></span></pre></div>
<a id="branchesnewhelpsystembasesrcport10testsportchecksumtestfromrev117083trunkbasesrcport10testsportchecksumtest"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/src/port1.0/tests/portchecksum.test (from rev 117083, trunk/base/src/port1.0/tests/portchecksum.test) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/port1.0/tests/portchecksum.test                                (rev 0)
+++ branches/new-help-system/base/src/port1.0/tests/portchecksum.test        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,148 @@
</span><ins>+# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
+
+package require tcltest 2
+namespace import tcltest::*
+
+set pwd [file dirname [file normalize $argv0]]
+
+source ../port_test_autoconf.tcl
+source $macports::autoconf::macports_tcl_dir/macports1.0/macports_fastload.tcl
+package require macports 1.0
+
+array set ui_options {}
+#set ui_options(ports_debug)   yes
+#set ui_options(ports_verbose) yes
+mportinit ui_options
+
+package require portchecksum 1.0
+
+
+test parse_checksum {
+    Parse checksum unit test.
+} -body {
+    set all_dist_files {file file2}
+    set checksums_str {file md5 1111 file2 sha1 3333}
+
+    set res [portchecksum::parse_checksums $checksums_str]
+    if {$res != &quot;yes&quot;} {return &quot;FAIL: error in checksum parse&quot;}
+    if {$checksums_array(file) != &quot;md5 1111&quot;} {
+           return &quot;FAIL: invalid file options&quot;
+    }
+    if {$checksums_array(file2) != &quot;sha1 3333&quot;} {
+           return &quot;FAIL: invalid file options&quot;
+    }
+    return &quot;Parse checksum successful.&quot;
+} -result &quot;Parse checksum successful.&quot;
+
+
+test calc_md5 {
+    Calculate md5 unit test. Based on a file it creates.
+} -body {
+    set fd [open $pwd/file w+]
+    puts $fd &quot;test.file&quot;
+    close $fd
+
+    set res [portchecksum::calc_md5 $pwd/file]
+    if {$res != &quot;9f70ecc1095ff10df81be6b5f218328d&quot;} {
+           return &quot;FAIL: unexpected md5&quot;
+    }
+    return &quot;Calc md5 successful.&quot;
+
+} -cleanup {
+    file delete -force $pwd/file
+} -result &quot;Calc md5 successful.&quot;
+
+
+test calc_sha1 {
+    Calculate sha1 unit test.
+} -body {
+    set fd [open $pwd/file w+]
+    puts $fd &quot;test.file&quot;
+    close $fd
+
+    set res [portchecksum::calc_sha1 $pwd/file]
+    if {$res != &quot;5560df60ff202ca8b8c3dcf51ad650b78e859261&quot;} {
+           return &quot;FAIL: unexpected sha1&quot;
+    }
+    return &quot;Calc sha1 successful.&quot;
+
+} -cleanup {
+    file delete -force $pwd/file
+} -result &quot;Calc sha1 successful.&quot;
+
+
+test calc_rmd160 {
+    Calculate rmd160 unit test.
+} -body {
+    set fd [open $pwd/file w+]
+    puts $fd &quot;test.file&quot;
+    close $fd
+
+    set res [portchecksum::calc_rmd160 $pwd/file]
+    if {$res != &quot;5aee5d12fe536e2e288e9f1daafd84f1bc17c3e6&quot;} {
+           return &quot;FAIL: unexpected rmd160&quot;
+    }
+    return &quot;Calc rmd160 successful.&quot;
+
+} -cleanup {
+    file delete -force $pwd/file
+} -result &quot;Calc rmd160 successful.&quot;
+
+
+test calc_sha256 {
+    Calculate sha256 unit test.
+} -body {
+    set fd [open $pwd/file w+]
+    puts $fd &quot;test.file&quot;
+    close $fd
+
+    set res [portchecksum::calc_sha256 $pwd/file]
+    if {$res != &quot;2f686816f2a80e8efcc4ef40ac4e898d27ce4205a61ee422d56f8c5e8b46612e&quot;} {
+           return &quot;FAIL: unexpected sha1&quot;
+    }
+    return &quot;Calc sha256 successful.&quot;
+
+} -cleanup {
+    file delete -force $pwd/file
+} -result &quot;Calc sha256 successful.&quot;
+
+
+# test checksum_start
+
+
+test checksum_main {
+    Checksum main unit test. Checks for empty files.
+} -body {
+    set all_dist_files {file file2}
+    set checksum.skip yes
+
+    if {[portchecksum::checksum_main] != 0} {
+           return &quot;FAIL: checksum not skipped&quot;
+    }
+
+    set checksum.skip no
+    set distpath $pwd/dpath
+    set usealtworkpath no
+    set altprefix prefix
+
+    file mkdir $distpath
+    close [open $distpath/file w]
+    close [open $distpath/file2 w]
+    array set checksums_array {
+           file {md5 d41d8cd98f00b204e9800998ecf8427e}
+           file2 {sha1 da39a3ee5e6b4b0d3255bfef95601890afd80709}
+    }
+
+    if {[portchecksum::checksum_main] != 0} {
+           return &quot;FAIL: incorrect checksum&quot;
+    }
+    return &quot;Checksum main successful.&quot;
+
+} -cleanup {
+    file delete -force $distpath
+    file delete -force file
+    file delete -force file2
+} -result &quot;Checksum main successful.&quot;
+
+
+cleanupTests
</ins></span></pre></div>
<a id="branchesnewhelpsystembasesrcport10testsportcleantestfromrev117083trunkbasesrcport10testsportcleantest"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/src/port1.0/tests/portclean.test (from rev 117083, trunk/base/src/port1.0/tests/portclean.test) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/port1.0/tests/portclean.test                                (rev 0)
+++ branches/new-help-system/base/src/port1.0/tests/portclean.test        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,213 @@
</span><ins>+# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
+
+package require tcltest 2
+namespace import tcltest::*
+
+set pwd [file dirname [file normalize $argv0]]
+
+source ../port_test_autoconf.tcl
+source $macports::autoconf::macports_tcl_dir/macports1.0/macports_fastload.tcl
+package require macports 1.0
+
+array set ui_options {}
+#set ui_options(ports_debug)   yes
+#set ui_options(ports_verbose) yes
+mportinit ui_options
+
+package require portclean 1.0
+source ../port_autoconf.tcl
+source ./library.tcl
+macports_worker_init
+
+
+test clean_start {
+    Clean start unit test.
+} -constraints {
+    root
+} -body {
+    set prefix /opt/local
+    seteuid 333
+    if {[catch {clean_start args}] != 1} {
+       return &quot;FAIL: couldn't elevate privileges&quot;
+    }
+    seteuid 0
+    return &quot;Clean_start successful.&quot;
+} -result &quot;Clean_start successful.&quot;
+
+
+# test clean_main
+
+
+test clean_dist {
+    Clean distfiles unit test.
+} -body {
+    set usealtworkpath no
+    set ports_force yes
+    set portdbpath $pwd/dbpath
+    set altprefix /tmp/altprefix
+    set dist_subdir subdir
+    set name subdir_name
+    set distpath $pwd/distpath
+    lappend distfiles $distpath/dist_file
+    lappend distfiles $distpath/dist_file2
+    set patchpath $pwd/patchpath
+    lappend patchfiles $patchpath/patch_file
+    lappend patchfiles $patchpath/patch_file2
+
+    # create files
+    file mkdir $distpath
+    close [open $distpath/dist_file w+]
+    close [open $distpath/dist_file2 w+]
+    file mkdir $altprefix$distpath
+    close [open $altprefix$distpath/dist_file2 w+]
+    file mkdir $portdbpath/distfiles/$dist_subdir
+    close [open $portdbpath/distfiles/$dist_subdir/subdir_file w+]
+    close [open $portdbpath/distfiles/$dist_subdir/subdir_$name w+]
+
+    # create patch files
+    file mkdir $patchpath
+    close [open $patchpath/patch_file2 w+]
+    file mkdir $altprefix$patchpath
+    close [open $altprefix$patchpath/patch_file2 w+]
+
+    portclean::clean_dist
+
+    if {[file exists $distpath/dist_file]} {
+       return &quot;FAIL: distfile not removed&quot;
+    }
+    if {[file exists $distpath/dist_file2]} {
+       return &quot;FAIL: distfile not removed&quot;
+    }
+    if {[file exists $altprefix$distpath/dist_file2]} {
+       return &quot;FAIL: alt distfile not removed&quot;
+    }
+    if {[file exists $patchpath/patch_file2]} {
+       return &quot;FAIL: patchfile not removed&quot;
+    }
+    if {[file exists $altprefix$patchpath/patch_file2]} {
+       return &quot;FAIL: alt patchfile not removed&quot;
+    }
+    if {[file exists $portdbpath/distfiles/$dist_subdir]} {
+       return &quot;FAIL: distfiles dir not removed&quot;
+    }
+
+    return &quot;Clean distfiles successful.&quot;
+
+} -cleanup {
+    file delete -force $distpath
+    file delete -force $portdbpath
+    file delete -force $patchpath
+    file delete -force $altprefix
+
+} -result &quot;Clean distfiles successful.&quot;
+
+
+test clean_work {
+    Clean work unit test.
+} -constraints {
+    root
+} -body {
+    set usealtworkpath no
+    set altprefix $pwd/prefix
+    set portpath portpath
+    set subbuildpath /subbuild
+    set worksymlink $pwd/symlink
+
+    # create files
+    file mkdir $subbuildpath
+    close [open $subbuildpath/test.work w+]
+    file mkdir $altprefix/subbuild
+    close [open $altprefix/subbuild/test.work w+]
+    close [open $altprefix/$portpath w+]
+    file link -symbolic $worksymlink $subbuildpath
+
+    portclean::clean_work
+
+    if {[file exists $subbuildpath]} {
+       return &quot;FAIL: buildpath not removed&quot;
+    }
+    if {[file exists $altprefix/subbuild]} {
+       return &quot;FAIL: subbuild not removed&quot;
+    }
+    if {[file exists $worksymlink]} {
+       return &quot;FAIL: symlink not removed&quot;
+    }
+    if {[file exists $altprefix$portpath]} {
+       return &quot;FAIL: port dir in alt prefix not removed&quot;
+    }
+
+    return &quot;Clean work successful.&quot;
+
+} -cleanup {
+    file delete -force $subbuildpath
+    file delete -force $altprefix
+    file delete -force $worksymlink
+
+} -result &quot;Clean work successful.&quot;
+
+
+test clean_logs {
+    Clean logs unit test.
+} -constraints {
+    root
+} -body {
+    set portpath $pwd/portpath
+    set logpath [getportlogpath $portpath]
+    set subport $logpath/subport
+
+    # create files
+    file mkdir $subport
+    close [open $subport/test.log w+]
+
+    portclean::clean_logs
+
+    if {[file exists $subport]} {
+       return &quot;FAIL: log dir not removed&quot;
+    }
+    return &quot;Clean logs successful.&quot;
+
+} -cleanup {
+    file delete -force $portpath
+    file delete -force $subport
+
+} -result &quot;Clean logs successful.&quot;
+
+
+test clean_archive {
+    Clean archive unit test.
+} -body {
+    set subport subport
+    set portdbpath $pwd/dbpath
+
+    file mkdir $portdbpath/incoming
+    close [open $portdbpath/incoming/test.clean w+]
+    close [open $portdbpath/incoming/subport-1_0.0.0.0.TMP w+]
+
+    # create zip
+    set fd [open $pwd/+CONTENTS w+]
+    puts $fd &quot;@portname subport&quot;
+    close $fd
+    exec zip $portdbpath/incoming/subport-2_0.0.0.0.zip +CONTENTS
+
+    portclean::clean_archive
+
+    if {[file exists $portdbpath/incoming/subport-1_0.0.0.0.TMP]} {
+       return &quot;FAIL: .TMP file not removed&quot;
+    }
+    if {![file exists $portdbpath/incoming/test.clean]} {
+       return &quot;FAIL: removed unrelated file&quot;
+    }
+    if {[file exists $portdbpath/incoming/subport-2_0.0.0.0.zip]} {
+       return &quot;FAIL: zip archive not removed&quot;
+    }
+
+    return &quot;Clean archive successful.&quot;
+
+} -cleanup {
+    file delete -force $pwd/+CONTENTS
+    file delete -force $portdbpath
+
+} -result &quot;Clean archive successful.&quot;
+
+
+cleanupTests
</ins></span></pre></div>
<a id="branchesnewhelpsystembasesrcport10testsportdeactivatetestfromrev117083trunkbasesrcport10testsportdeactivatetest"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/src/port1.0/tests/portdeactivate.test (from rev 117083, trunk/base/src/port1.0/tests/portdeactivate.test) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/port1.0/tests/portdeactivate.test                                (rev 0)
+++ branches/new-help-system/base/src/port1.0/tests/portdeactivate.test        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,104 @@
</span><ins>+# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
+
+package require tcltest 2
+namespace import tcltest::*
+
+set pwd [file dirname [file normalize $argv0]]
+
+source ../port_test_autoconf.tcl
+source $macports::autoconf::macports_tcl_dir/macports1.0/macports_fastload.tcl
+package require macports 1.0
+
+array set ui_options {}
+#set ui_options(ports_debug)   yes
+#set ui_options(ports_verbose) yes
+mportinit ui_options
+
+package require portdeactivate 1.0
+package require registry 1.0
+source ./library.tcl
+macports_worker_init
+
+
+test activate_start {
+    Deactivate start unit test.
+    Requires root for setting euid.
+} -constraints {
+    root
+} -setup {
+    # file writable $prefix is used to determine whether privilege escalation
+    # is needed, so set prefix to a directory unwritable for this user
+    set prefix /usr/bin
+
+    # elevateToRoot uses $euid and $egid as the IDs to set
+    set euid 0
+    set egid 0
+
+} -body {
+    # drop privileges; the code won't attempt to elevate privileges without
+    # that
+    seteuid 333
+    if {[catch {portdeactivate::deactivate_start args}] != 0} {
+        return &quot;FAIL: couldn't elevate privileges&quot;
+    }
+
+    # when uid == 0 and euid == 0, the code will not attempt to elevate
+    # privileges
+    seteuid 0
+    if {[catch {portdeactivate::deactivate_start args}] != 0} {
+        return &quot;FAIL: couldn't elevate privileges&quot;
+    }
+    return &quot;Deactivate_start successful.&quot;
+} -result &quot;Deactivate_start successful.&quot;
+
+
+test deactivate_main {
+    Deactivate main unit test.
+} -constraints {
+    root
+} -setup {
+    set destpath $pwd/work/destroot
+    set portbuildpath $pwd
+    set portdbpath $pwd/dbpath
+    set portpath $pwd
+
+    set mport [mportopen file://.]
+
+    # set $version var
+    set workername [ditem_key $mport workername]
+
+    # portinstall setup
+    interp alias {} _cd {} cd
+
+    # hide all output. Deactivate this for debugging!
+    set oldchannels [array get macports::channels]
+    set macports::channels(msg)    {}
+    set macports::channels(notice) {}
+
+    if {[$workername eval eval_targets install] != 0} {
+        return &quot;FAIL: port install failed&quot;
+    }
+
+} -body {
+    if {[$workername eval eval_targets activate] != 0} {
+        return &quot;FAIL: cannot activate port after install&quot;
+    }
+    if {[$workername eval eval_targets deactivate] != 0} {
+        return &quot;FAIL: cannot deactivate port after activate&quot;
+    }
+    return &quot;Port deactivate successful.&quot;
+
+} -cleanup {
+    if {[$workername eval eval_targets uninstall] != 0} {
+        return &quot;FAIL: uninstall failed&quot;
+    }
+    if {[$workername eval eval_targets clean] != 0} {
+        return &quot;FAIL: clean failed&quot;
+    }
+    array set macports::channels $oldchannels
+
+    mportclose $mport
+} -result &quot;Port deactivate successful.&quot;
+
+
+cleanupTests
</ins></span></pre></div>
<a id="branchesnewhelpsystembasesrcport10testsportdependstestfromrev117083trunkbasesrcport10testsportdependstest"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/src/port1.0/tests/portdepends.test (from rev 117083, trunk/base/src/port1.0/tests/portdepends.test) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/port1.0/tests/portdepends.test                                (rev 0)
+++ branches/new-help-system/base/src/port1.0/tests/portdepends.test        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,39 @@
</span><ins>+# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
+
+package require tcltest 2
+namespace import tcltest::*
+
+set pwd [file dirname [file normalize $argv0]]
+
+source ../port_test_autoconf.tcl
+source $macports::autoconf::macports_tcl_dir/macports1.0/macports_fastload.tcl
+package require macports 1.0
+
+array set ui_options {}
+#set ui_options(ports_debug)   yes
+#set ui_options(ports_verbose) yes
+mportinit ui_options
+
+package require portdepends 1.0
+
+
+test validate_depends_options {
+    Validate depends unit test.
+} -body {
+    set res [catch {portdepends::validate_depends_options target set {lib:test.val:value}}]
+    if {$res != 0} {return &quot;FAIL: value lib:test.val:value not accepted&quot;}
+    set res [catch {portdepends::validate_depends_options target set {bin:test.val:value}}]
+    if {$res != 0} {return &quot;FAIL: value bin:test.val:value not accepted&quot;}
+    set res [catch {portdepends::validate_depends_options target set {path:test:value}}]
+    if {$res != 0} {return &quot;FAIL: value path:test:value not accepted&quot;}
+    set res [catch {portdepends::validate_depends_options target set {port:test3}}]
+    if {$res != 0} {return &quot;FAIL: value port:test3 not accepted&quot;}
+    set res [catch {portdepends::validate_depends_options target set {lib:test}}]
+    if {$res != 1} {return &quot;FAIL: invalid options lib:test accepted&quot;}
+    return &quot;Validate depends successful.&quot;
+} -result &quot;Validate depends successful.&quot;
+
+# test validate_depends_options_new
+
+
+cleanupTests
</ins></span></pre></div>
<a id="branchesnewhelpsystembasesrcport10testsportdestroottcl"></a>
<div class="delfile"><h4>Deleted: branches/new-help-system/base/src/port1.0/tests/portdestroot.tcl (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/port1.0/tests/portdestroot.tcl        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/src/port1.0/tests/portdestroot.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -1,40 +0,0 @@
</span><del>-source [file join [lindex $argv 0] macports1.0 macports_fastload.tcl]
-package require macports
-mportinit
-
-source [file dirname [info script]]/../portdestroot.tcl
-source [file dirname [info script]]/common.tcl
-
-namespace eval tests {
-
-proc &quot;when destroot cmd is not gmake no -w argument is added&quot; {} {
-    global build.type build.cmd destroot.cmd destroot.target
-
-    set build.type &quot;gnu&quot;
-    set build.cmd &quot;gmake&quot;
-    set destroot.cmd &quot;_destroot_cmd_&quot;
-    set destroot.target &quot;_target_&quot;
-
-    test_equal {[portdestroot::destroot_getargs]} &quot;_target_&quot;
-}
-
-proc &quot;when destroot cmd is gmake a -w argument is added&quot; {} {
-    global build.type build.cmd destroot.cmd destroot.target
-
-    set build.type &quot;gnu&quot;
-    set build.cmd &quot;_build_cmd_&quot;
-    set destroot.cmd &quot;gmake&quot;
-    set destroot.target &quot;_target_&quot;
-
-    test_equal {[portdestroot::destroot_getargs]} &quot;-w _target_&quot;
-}
-
-
-# run all tests
-foreach proc [info procs *] {
-    puts &quot;* ${proc}&quot;
-    $proc
-}
-
-# namespace eval tests
-}
</del></span></pre></div>
<a id="branchesnewhelpsystembasesrcport10testsportdistchecktestfromrev117083trunkbasesrcport10testsportdistchecktest"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/src/port1.0/tests/portdistcheck.test (from rev 117083, trunk/base/src/port1.0/tests/portdistcheck.test) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/port1.0/tests/portdistcheck.test                                (rev 0)
+++ branches/new-help-system/base/src/port1.0/tests/portdistcheck.test        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,50 @@
</span><ins>+# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
+
+package require tcltest 2
+namespace import tcltest::*
+
+set pwd [file dirname [file normalize $argv0]]
+
+source ../port_test_autoconf.tcl
+source $macports::autoconf::macports_tcl_dir/macports1.0/macports_fastload.tcl
+package require macports 1.0
+
+array set ui_options {}
+#set ui_options(ports_debug)   yes
+#set ui_options(ports_verbose) yes
+mportinit ui_options
+
+package require portdistcheck 1.0
+source ./library.tcl
+macports_worker_init
+
+
+test distcheck_main {
+    Distcheck main unit test.
+} -setup {
+    set portpath $pwd
+    set filespath $pwd/files
+
+    set name cocot
+    set subport $name
+    set distname cocot-20080315
+    set porturl &quot;http://distfiles.macports.org/cocot/&quot;
+    set master_sites $porturl
+    set extract.suffix .tar.bz2
+
+} -body {
+    set fetch.type standard
+    set distcheck.type moddate
+    if {[portdistcheck::distcheck_main] != &quot;&quot;} {
+        return &quot;FAIL: unable to download or check file, type moddate&quot;
+    }
+    set distcheck.type filesize
+    if {[portdistcheck::distcheck_main] != &quot;&quot;} {
+        return &quot;FAIL: unable to download or check file, type filesize&quot;
+    }
+
+    return &quot;Distcheck main successful.&quot;
+} -result &quot;Distcheck main successful.&quot;
+
+
+cleanupTests
</ins></span></pre></div>
<a id="branchesnewhelpsystembasesrcport10testsportfetchtcl"></a>
<div class="delfile"><h4>Deleted: branches/new-help-system/base/src/port1.0/tests/portfetch.tcl (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/port1.0/tests/portfetch.tcl        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/src/port1.0/tests/portfetch.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -1,58 +0,0 @@
</span><del>-source [file join [lindex $argv 0] macports1.0 macports_fastload.tcl]
-package require macports
-mportinit
-
-set scriptdir [file dirname [info script]]
-source ${scriptdir}/../portfetch.tcl
-source ${scriptdir}/common.tcl
-
-namespace eval tests {
-
-proc &quot;mirror tags are parsed correctly&quot; {} {
-    global distfiles master_sites name dist_subdir filespath scriptdir
-
-    set name test
-    set filespath $scriptdir
-    set dist_subdir tset
-    set portfetch::mirror_sites::sites(macports_test) {
-        http://distfiles.macports.org/:mirror
-        http://distfiles2.macports.org:80/:mirror
-        http://distfiles3.macports.org:80/
-        http://distfiles4.macports.org:80/some/subdir/
-        http://distfiles5.macports.org:80/some/subdir/:mirror
-    }
-    set distfiles test.tar.bz2
-    set master_sites macports_test
-    set fetch_urls {}
-    portfetch::checksites [list master_sites {}] &quot;&quot;
-    portfetch::checkdistfiles fetch_urls
-
-    global portfetch::urlmap
-    foreach {url_var distfile} $fetch_urls {
-        if {![info exists urlmap($url_var)]} {
-            set urlmap($url_var) $urlmap(master_sites)
-        }
-        foreach site $urlmap($url_var) {
-            set file_url [portfetch::assemble_url $site $distfile]
-            lappend all_file_urls $file_url
-        }
-    }
-    set all_file_urls [lsort $all_file_urls]
-
-    set expected [list http://distfiles.macports.org/tset/test.tar.bz2 \
-                       http://distfiles2.macports.org:80/tset/test.tar.bz2 \
-                       http://distfiles3.macports.org:80/test/test.tar.bz2 \
-                       http://distfiles4.macports.org:80/some/subdir/test/test.tar.bz2 \
-                       http://distfiles5.macports.org:80/some/subdir/tset/test.tar.bz2]
-
-    test_equal {$all_file_urls} {$expected}
-}
-
-# run all tests
-foreach proc [info procs *] {
-    puts &quot;* ${proc}&quot;
-    $proc
-}
-
-# namespace eval tests
-}
</del></span></pre></div>
<a id="branchesnewhelpsystembasesrcport10testsportinstalltestfromrev117083trunkbasesrcport10testsportinstalltest"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/src/port1.0/tests/portinstall.test (from rev 117083, trunk/base/src/port1.0/tests/portinstall.test) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/port1.0/tests/portinstall.test                                (rev 0)
+++ branches/new-help-system/base/src/port1.0/tests/portinstall.test        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,183 @@
</span><ins>+# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
+
+package require tcltest 2
+namespace import tcltest::*
+
+set pwd [file dirname [file normalize $argv0]]
+
+source ../port_test_autoconf.tcl
+source $macports::autoconf::macports_tcl_dir/macports1.0/macports_fastload.tcl
+package require macports 1.0
+
+array set ui_options {}
+#set ui_options(ports_debug)   yes
+#set ui_options(ports_verbose) yes
+mportinit ui_options
+
+package require portinstall 1.0
+source ../../registry2.0/portuninstall.tcl
+source ../port_autoconf.tcl
+source ./library.tcl
+macports_worker_init
+
+
+# Set env vars
+set os.platform darwin
+set macosx_version 10.8
+set os_version 12
+set os_arch i386
+set os.major 10
+set supported_archs {}
+set configure.build_arch build_arch
+set portarchivetype tgz
+
+set subport fondu
+set version 3.0
+set revision 2
+
+
+test install_start {
+    Install start unit test.
+} -constraints {
+    root
+} -setup {
+    set portvariants {var1}
+    set prefix prefix
+    set add_users no
+
+} -body {
+    if {[catch {portinstall::install_start}] != 0} {
+        return &quot;FAIL: problem with install start&quot;
+    }
+    return &quot;Install start successful.&quot;
+} -result &quot;Install start successful.&quot;
+
+
+test create_archive {
+    Create archive unit test.
+} -constraints {
+    root
+} -setup {
+    set destpath $pwd/work/destroot
+    set portbuildpath $pwd
+    set portdbpath $pwd/dbpath
+    set portpath $pwd
+    set create /dev/null
+
+    # destroot setup
+    file mkdir $pwd/$subport
+    set mport [mportopen file://.]
+
+    # set $version var
+    set workername [ditem_key $mport workername]
+
+    # run destroot
+    if {[$workername eval eval_targets destroot] != 0} {
+        return &quot;FAIL: destroot failed&quot;
+    }
+
+    # portinstall setup
+    interp alias {} _cd {} cd
+
+    # hide all output. Deactivate this for debugging!
+    set oldchannels [array get macports::channels]
+    set macports::channels(msg)    {}
+    set macports::channels(notice) {}
+
+    if {[$workername eval eval_targets install] != 0} {
+        return &quot;FAIL: port install failed&quot;
+    }
+
+} -body {
+    if {[catch {$workername eval portinstall::create_archive $create tgz}] != 0} {
+        return &quot;FAIL: cannot create archive&quot;
+    }
+    return &quot;Create archive successful.&quot;
+
+} -cleanup {
+    if {[$workername eval eval_targets uninstall] != 0} {
+        return &quot;FAIL: uninstall failed&quot;
+    }
+    if {[$workername eval eval_targets clean] != 0} {
+        return &quot;FAIL: clean failed&quot;
+    }
+    array set macports::channels $oldchannels
+    mportclose $mport
+
+    file delete -force $pwd/$subport
+    file delete -force $portdbpath
+    file delete -force $pwd/work
+
+} -result &quot;Create archive successful.&quot;
+
+
+# test extract_contents
+
+
+test install_main {
+    Install main unit test.
+} -constraints {
+    root
+
+} -setup {
+    set workpath $pwd/work
+    set portpath $pwd
+    set portdbpath $pwd/dbpath
+    set portbuildpath $pwd
+    set destpath $pwd/work/destroot
+    set portvariants {+var1}
+    
+    set epoch i386
+    set compiler.cpath /usr/bin/gcc
+    set compiler.library_path /usr/lib
+
+    # destroot setup
+    file mkdir $pwd/$subport
+    set mport [mportopen file://.]
+
+    if {[eval_variants variations] != 0} {
+        mportclose $mport
+        error &quot;Error evaluating variants&quot;
+    }
+
+    # set $version var
+    set workername [ditem_key $mport workername]
+
+    # run destroot
+    if {[$workername eval eval_targets destroot] != 0} {
+        return &quot;FAIL: destroot failed&quot;
+    }
+
+    # portinstall setup
+    interp alias {} _cd {} cd
+
+    # hide all output. Deactivate this for debugging!
+    set oldchannels [array get macports::channels]
+    set macports::channels(msg)    {}
+    set macports::channels(notice) {}
+
+} -body {
+    if {[$workername eval eval_targets install] != 0} {
+        return &quot;FAIL: cannot install port&quot;
+    }
+    return &quot;Install main successful.&quot;
+
+} -cleanup {
+    if {[$workername eval eval_targets uninstall] != 0} {
+        return &quot;FAIL: uninstall failed&quot;
+    }
+    if {[$workername eval eval_targets clean] != 0} {
+        return &quot;FAIL: clean failed&quot;
+    }
+    array set macports::channels $oldchannels
+
+    mportclose $mport
+
+    file delete -force $pwd/$subport
+    file delete -force $portdbpath
+    file delete -force $pwd/work
+
+} -result &quot;Install main successful.&quot;
+
+
+cleanupTests
</ins></span></pre></div>
<a id="branchesnewhelpsystembasesrcport10testsportloadtestfromrev117083trunkbasesrcport10testsportloadtest"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/src/port1.0/tests/portload.test (from rev 117083, trunk/base/src/port1.0/tests/portload.test) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/port1.0/tests/portload.test                                (rev 0)
+++ branches/new-help-system/base/src/port1.0/tests/portload.test        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,61 @@
</span><ins>+# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
+
+package require tcltest 2
+namespace import tcltest::*
+
+set pwd [file dirname [file normalize $argv0]]
+
+source ../port_test_autoconf.tcl
+source $macports::autoconf::macports_tcl_dir/macports1.0/macports_fastload.tcl
+package require macports 1.0
+
+array set ui_options {}
+#set ui_options(ports_debug)   yes
+#set ui_options(ports_verbose) yes
+mportinit ui_options
+
+package require portload 1.0
+source ../port_autoconf.tcl
+
+
+test load_main {
+    Load main unit test.
+} -constraints {
+    root
+
+} -setup {
+    set path /Library/test/files
+    file mkdir $path
+
+    # Create dummy plist
+    set fd [open $path/file.plist w+]
+    puts $fd &quot;\&lt;?xml version=\&quot;1.0\&quot; encoding=\&quot;UTF-8\&quot;?\&gt;&quot;
+    puts $fd &quot;\&lt;!DOCTYPE plist PUBLIC \&quot;-//Apple//DTD PLIST 1.0//EN\&quot; \&quot;http://www.apple.com/DTDs/PropertyList-1.0.dtd\&quot;\&gt;&quot;
+    puts $fd &quot;\&lt;plist version=\&quot;1.0\&quot;\&gt;&quot;
+    puts $fd &quot;\&lt;dict\&gt;&quot;
+    puts $fd &quot;\&lt;key\&gt;Label\&lt;/key\&gt;&quot;
+    puts $fd &quot;\&lt;string\&gt;org.test.load\&lt;/string\&gt;&quot;
+    puts $fd &quot;\&lt;key\&gt;ProgramArguments\&lt;/key\&gt;&quot;
+    puts $fd &quot;\&lt;array\&gt;\&lt;string\&gt;/bin/ls\&lt;/string\&gt;\&lt;/array\&gt;&quot;
+    puts $fd &quot;\&lt;/dict\&gt;&quot;
+    puts $fd &quot;\&lt;/plist\&gt;&quot;
+    close $fd
+
+} -body {
+    set launchctl_path ${portutil::autoconf::launchctl_path}
+    set startupitem.location test
+    set startupitem.plist files/file.plist
+
+    if {[portload::load_main] != &quot;&quot;} {
+        return &quot;FAIL: unable to load plist&quot;
+    }
+    return &quot;Load successful.&quot;
+
+} -cleanup {
+    exec $launchctl_path unload -w $path 2&gt;@stderr
+    file delete -force /Library/test
+
+} -result &quot;Load successful.&quot;
+
+
+cleanupTests
</ins></span></pre></div>
<a id="branchesnewhelpsystembasesrcport10testsportmaintestfromrev117083trunkbasesrcport10testsportmaintest"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/src/port1.0/tests/portmain.test (from rev 117083, trunk/base/src/port1.0/tests/portmain.test) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/port1.0/tests/portmain.test                                (rev 0)
+++ branches/new-help-system/base/src/port1.0/tests/portmain.test        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,53 @@
</span><ins>+# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
+
+package require tcltest 2
+namespace import tcltest::*
+
+set pwd [file dirname [file normalize $argv0]]
+
+source ../port_test_autoconf.tcl
+source $macports::autoconf::macports_tcl_dir/macports1.0/macports_fastload.tcl
+package require macports 1.0
+
+array set ui_options {}
+#set ui_options(ports_debug)   yes
+#set ui_options(ports_verbose) yes
+mportinit ui_options
+
+source ./library.tcl
+macports_worker_init
+package require portmain 1.0
+
+
+# Set testing vars
+set os_platform darwin
+set macosx_version 10.8
+set os_version 12
+set os_arch i386
+set portpath .
+set portbuildpath ./build
+
+
+test get_default_subport {
+    Get default subport unit test.
+} -body {
+    set portpath path/port/subport
+    if {[portmain::get_default_subport] != &quot;subport&quot;} {
+        return &quot;FAIL: wrong subport&quot;
+    }
+    return &quot;Get default subport successful.&quot;
+} -result &quot;Get default subport successful.&quot;
+
+
+test get_subbuildpath {
+    Get subbuildpath unit test.
+} -body {
+    set portpath path/port/subport
+    if {[portmain::get_subbuildpath] != [file normalize &quot;./build/subport&quot;]} {
+        return &quot;FAIL: wrong subbuildpath&quot;
+    }
+    return &quot;Get subbuild path successful.&quot;
+} -result &quot;Get subbuild path successful.&quot;
+
+
+cleanupTests
</ins></span></pre></div>
<a id="branchesnewhelpsystembasesrcport10testsportpatchtestfromrev117083trunkbasesrcport10testsportpatchtest"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/src/port1.0/tests/portpatch.test (from rev 117083, trunk/base/src/port1.0/tests/portpatch.test) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/port1.0/tests/portpatch.test                                (rev 0)
+++ branches/new-help-system/base/src/port1.0/tests/portpatch.test        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,78 @@
</span><ins>+# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
+
+package require tcltest 2
+namespace import tcltest::*
+
+set pwd [file dirname [file normalize $argv0]]
+
+source ../port_test_autoconf.tcl
+source $macports::autoconf::macports_tcl_dir/macports1.0/macports_fastload.tcl
+package require macports 1.0
+
+array set ui_options {}
+#set ui_options(ports_debug)   yes
+#set ui_options(ports_verbose) yes
+mportinit ui_options
+
+package require portpatch
+source ../port_autoconf.tcl
+source ./library.tcl
+macports_worker_init
+
+
+test build_getpatchtype {
+    Get patch type unit test.
+} -body {
+    set res [portpatch::build_getpatchtype]
+    if {$res != $portutil::autoconf::patch_path} {
+        return &quot;FAIL: wrong path&quot;
+    }
+    return &quot;Get patch type successful.&quot;
+} -result &quot;Get patch type successful.&quot;
+
+
+test patch_main {
+    Patch main unit test.
+} -constraints {
+    root
+} -setup {
+    set macosx_version 12
+
+    set subport fondu
+    set filespath $pwd/files
+    set distpath $pwd/dist
+    set usealtworkpath yes
+    set altprefix prefix
+
+    set workpath $pwd/work
+    set worksrcpath $workpath/src
+    set compiler.cpath /usr/bin/gcc
+    set compiler.library_path /usr/lib
+    set macosx_deployment_target $pwd/deploy_target
+
+    file mkdir $filespath
+    set fd [open $filespath/file.diff w+]
+    puts $fd &quot;first line should get to the workpath&quot;
+    close $fd
+
+    set mport [mportopen file://.]
+    set workername [ditem_key $mport workername]
+    $workername eval &quot;set patchfiles {file.diff}&quot;
+
+} -body {
+    if {[$workername eval eval_targets patch]} {
+        return &quot;FAIL: cannot run patch&quot;
+    }
+    if {![file exists $pwd/work/fondu-060102/test_patch]} {
+        return &quot;FAIL: missing patched file&quot;
+    }
+    return &quot;Patch successful.&quot;
+
+} -cleanup {
+    file delete -force $filespath
+    file delete -force $pwd/work
+
+} -result &quot;Patch successful.&quot;
+
+
+cleanupTests
</ins></span></pre></div>
<a id="branchesnewhelpsystembasesrcport10testsporttesttestfromrev117083trunkbasesrcport10testsporttesttest"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/src/port1.0/tests/porttest.test (from rev 117083, trunk/base/src/port1.0/tests/porttest.test) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/port1.0/tests/porttest.test                                (rev 0)
+++ branches/new-help-system/base/src/port1.0/tests/porttest.test        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,71 @@
</span><ins>+# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
+
+package require tcltest 2
+namespace import tcltest::*
+
+set pwd [file dirname [file normalize $argv0]]
+
+source ../port_test_autoconf.tcl
+source $macports::autoconf::macports_tcl_dir/macports1.0/macports_fastload.tcl
+package require macports 1.0
+
+array set ui_options {}
+#set ui_options(ports_debug)   yes
+#set ui_options(ports_verbose) yes
+mportinit ui_options
+
+source ./library.tcl
+macports_worker_init
+package require port 1.0
+package require registry 1.0
+
+
+# test test_start
+
+test test_main {
+    Test main unit test.
+} -constraints {
+    root
+} -setup {
+    set destpath $pwd/work/destroot
+    set portbuildpath $pwd
+    set portdbpath $pwd/dbpath
+    set portpath $pwd
+
+    set mport [mportopen file://.]
+
+    # set $version var
+    set workername [ditem_key $mport workername]
+
+    # portinstall setup
+    interp alias {} _cd {} cd
+
+    # hide all output. Deactivate this for debugging!
+    set oldchannels [array get macports::channels]
+    set macports::channels(msg)    {}
+    set macports::channels(notice) {}
+
+    if {[$workername eval eval_targets install] != 0} {
+        return &quot;FAIL: port install failed&quot;
+    }
+
+} -body {
+    if {[$workername eval eval_targets test] != 0} {
+        return &quot;FAIL: test target failed&quot;
+    }
+
+    return &quot;Test main successful.&quot;
+
+} -cleanup {
+    if {[$workername eval eval_targets uninstall] != 0} {
+        return &quot;FAIL: uninstall failed&quot;
+    }
+    if {[$workername eval eval_targets clean] != 0} {
+        return &quot;FAIL: clean failed&quot;
+    }
+    file delete -force $pwd/work
+
+} -result &quot;Test main successful.&quot;
+
+
+cleanupTests
</ins></span></pre></div>
<a id="branchesnewhelpsystembasesrcport10testsportuninstalltestfromrev117083trunkbasesrcport10testsportuninstalltest"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/src/port1.0/tests/portuninstall.test (from rev 117083, trunk/base/src/port1.0/tests/portuninstall.test) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/port1.0/tests/portuninstall.test                                (rev 0)
+++ branches/new-help-system/base/src/port1.0/tests/portuninstall.test        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,95 @@
</span><ins>+# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
+
+package require tcltest 2
+namespace import tcltest::*
+
+set pwd [file dirname [file normalize $argv0]]
+
+source ../port_test_autoconf.tcl
+source $macports::autoconf::macports_tcl_dir/macports1.0/macports_fastload.tcl
+package require macports 1.0
+
+array set ui_options {}
+#set ui_options(ports_debug)   yes
+#set ui_options(ports_verbose) yes
+mportinit ui_options
+
+package require portinstall 1.0
+source ../../registry2.0/portuninstall.tcl
+source ../port_autoconf.tcl
+source ./library.tcl
+macports_worker_init
+
+set subport fondu
+set version 3.0
+set revision 2
+
+
+# test uninstall_start
+
+
+test uninstall_main {
+    Uninstall main unit test.
+} -constraints {
+    root
+
+} -setup {
+    set workpath $pwd/work
+    set portpath $pwd
+    set portdbpath $pwd/dbpath
+    set portbuildpath $pwd
+    set destpath $pwd/work/destroot
+    set portvariants {+var1}
+
+    set epoch i386
+    set compiler.cpath /usr/bin/gcc
+    set compiler.library_path /usr/lib
+
+    # destroot setup
+    file mkdir $pwd/$subport
+    set mport [mportopen file://.]
+
+    if {[eval_variants variations] != 0} {
+        mportclose $mport
+        error &quot;Error evaluating variants&quot;
+    }
+
+    # set $version var
+    set workername [ditem_key $mport workername]
+
+    # run destroot
+    if {[$workername eval eval_targets destroot] != 0} {
+        return &quot;FAIL: destroot failed&quot;
+    }
+
+    # portinstall setup
+    interp alias {} _cd {} cd
+
+    # hide all output. Deactivate this for debugging!
+    set oldchannels [array get macports::channels]
+    set macports::channels(msg)    {}
+    set macports::channels(notice) {}
+    
+    if {[$workername eval eval_targets install] != 0} {
+        return &quot;FAIL: cannot install port&quot;
+    }
+
+} -body {
+    if {[$workername eval eval_targets uninstall] != 0} {
+        return &quot;FAIL: uninstall failed&quot;
+    }
+    return &quot;Uninstall main successful.&quot;
+
+} -cleanup {
+    if {[$workername eval eval_targets clean] != 0} {
+        return &quot;FAIL: clean failed&quot;
+    }
+    
+    file delete -force $pwd/$subport
+    file delete -force $portdbpath
+    file delete -force $pwd/work
+
+} -result &quot;Uninstall main successful.&quot;
+
+
+cleanupTests
</ins></span></pre></div>
<a id="branchesnewhelpsystembasesrcport10testsportutiltcl"></a>
<div class="delfile"><h4>Deleted: branches/new-help-system/base/src/port1.0/tests/portutil.tcl (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/port1.0/tests/portutil.tcl        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/src/port1.0/tests/portutil.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -1,217 +0,0 @@
</span><del>-# Test file for Pextlib's fs-traverse
-# Requires r/w access to /tmp
-# MacPorts must be installed for this to work
-
-source [file join [lindex $argv 0] macports1.0 macports_fastload.tcl]
-package require macports
-mportinit
-
-# load the current copy of portutil instead of the installed one
-source [file dirname [info script]]/../portutil.tcl
-
-# end boilerplate
-
-namespace eval tests {
-
-proc test_delete {} {
-    set root &quot;/tmp/macports-portutil-delete&quot;
-    # use file delete -force to kill the test directory if it already exists
-    # yeah I realize this will fail on 10.3 if it already exists. oh well.
-    file delete -force $root
-    
-    try {
-        mtree $root {
-            a               directory
-            a/a             file
-            a/b             file
-            a/c             directory
-            a/c/a           file
-            a/c/b           {link ../b}
-            a/c/c           {link ../../b}
-            a/c/d           directory
-            a/c/d/a         file
-            a/c/d/b         directory
-            a/c/d/c         file
-            a/d             file
-            b               directory
-            b/a             file
-            b/b             {link q}
-            b/c             directory
-            b/c/a           file
-            b/c/b           file
-            b/d             file
-        }
-        
-        # test deleting a symlink
-        delete $root/a/c/b
-        
-        if {[file exists $root/a/c/b] || ![file exists $root/a/b]} {
-            error &quot;delete (symlink) failed&quot;
-        }
-        
-        # test multiple args
-        delete $root/a $root/b
-        
-        if {[file exists $root/a] || [file exists $root/b]} {
-            error &quot;delete (multiple args) failed&quot;
-        }
-    } finally {
-        file delete -force $root
-    }
-}
-
-proc test_depends_lib-delete {} {
-    # tests depends_lib-delete
-    # actually tests all option-deletes
-    # but the bug was originally documented with depends_lib
-    
-    # depends_lib is intended to work from within a worker thread
-    # so we shall oblige
-    set workername [interp create]
-    macports::worker_init $workername {} {} [macports::getportbuildpath {}] {} {}
-    $workername alias scriptname info script
-    set body {
-        # load the current copy of portutil instead of the installed one
-        source [file dirname [scriptname]]/../portutil.tcl
-        package require port
-        
-        depends_lib port:foo port:bar port:blah
-        depends_lib-delete port:blah port:bar
-        array get PortInfo
-    }
-    if {[catch {$workername eval $body} result]} {
-        interp delete $workername
-        error $result $::errorInfo $::errorCode
-    } else {
-        interp delete $workername
-    }
-    array set temp $result
-    if {$temp(depends_lib) ne &quot;port:foo&quot;} {
-        error &quot;depends_lib-delete did not delete properly&quot;
-    }
-}
-
-proc test_touch {} {
-    set root &quot;/tmp/macports-portutil-touch&quot;
-    file delete -force $root
-    
-    try {
-        touch -c $root
-        if {[file exists $root]} { error &quot;touch failed&quot; }
-    
-        touch $root
-        if {![file exists $root]} { error &quot;touch failed&quot; }
-    
-        touch -a -t 199912010001.01 $root
-        if {[file atime $root] != [clock scan 19991201T000101]} { error &quot;touch failed&quot; }
-        if {[file mtime $root] == [clock scan 19991201T000101]} { error &quot;touch failed&quot; }
-    
-        touch -m -t 200012010001.01 $root
-        if {[file atime $root] == [clock scan 20001201T000101]} { error &quot;touch failed&quot; }
-        if {[file mtime $root] != [clock scan 20001201T000101]} { error &quot;touch failed&quot; }
-    
-        touch -a -m -t 200112010001.01 $root
-        if {[file atime $root] != [clock scan 20011201T000101]} { error &quot;touch failed&quot; }
-        if {[file mtime $root] != [clock scan 20011201T000101]} { error &quot;touch failed&quot; }
-    
-        touch -r ~ $root
-        if {[file atime $root] != [file atime ~]} { error &quot;touch failed&quot; }
-        if {[file mtime $root] != [file mtime ~]} { error &quot;touch failed&quot; }
-    } finally {
-        file delete -force $root
-    }
-}
-
-proc test_ln {} {
-    set root &quot;/tmp/macports-portutil-ln&quot;
-    file delete -force $root
-    
-    file mkdir $root
-    try {
-        close [open $root/a w]
-        ln -s a $root/b
-        if {[catch {file type $root/b}] || [file type $root/b] ne &quot;link&quot;} {
-            set message &quot;ln failed: &quot;
-            if {[catch {file type $root/b}]} {
-                append message &quot;symlink not created&quot;
-            } elseif {[file type $root/b] ne &quot;link&quot;} {
-                append message &quot;created [file type $root/b], expected link&quot;
-            }
-            error $message
-        }
-    
-        close [open $root/c w]
-        if {![catch {ln -s c $root/b}]} { error &quot;ln failed&quot; }
-    
-        ln -s -f c $root/b
-        if {[catch {file type $root/b}] || [file type $root/b] ne &quot;link&quot;} { error &quot;ln failed&quot; }
-    
-        file delete $root/b
-    
-        ln $root/a $root/b
-        if {[catch {file type $root/b}] || [file type $root/b] ne &quot;file&quot;} { error &quot;ln failed&quot; }
-    
-        file delete $root/b
-        file mkdir $root/dir
-        ln -s dir $root/b
-        ln -s a $root/b
-        if {[catch {file type $root/dir/a}] || [file type $root/dir/a] ne &quot;link&quot;} { error &quot;ln failed&quot; }
-        file delete $root/dir/a
-    
-        ln -s -f -h a $root/b
-        if {[catch {file type $root/b}] || [file type $root/b] ne &quot;link&quot; || [file readlink $root/b] ne &quot;a&quot;} { error &quot;ln failed&quot; }
-    
-        cd $root/dir
-        ln -s ../c
-        if {[catch {file type $root/dir/c}] || [file type $root/dir/c] ne &quot;link&quot;} { error &quot;ln failed&quot; }
-    
-        ln -s foobar $root/d
-        if {[catch {file type $root/d}] || [file type $root/d] ne &quot;link&quot; || [file readlink $root/d] ne &quot;foobar&quot;} { error &quot;ln failed&quot; }
-        
-        ln -s -f -h z $root/dir
-        if {[catch {file type $root/dir/z}] || [file type $root/dir/z] ne &quot;link&quot;} { error &quot;ln failed&quot; }
-        
-        # test combined flags
-        ln -sf q $root/dir
-        if {[catch {file type $root/dir/q}] || [file type $root/dir/q] ne &quot;link&quot;} { error &quot;ln failed&quot; }
-    } finally {
-        file delete -force $root
-    }
-}
-
-# Create a filesystem hierarchy based on the given specification
-# The mtree spec consists of name/type pairings, where type can be
-# one of directory, file or link. If type is link, it must be a
-# two-element list containing the path as the second element
-proc mtree {root spec} {
-    foreach {entry typelist} $spec {
-        set type [lindex $typelist 0]
-        set link [lindex $typelist 1]
-        set file [file join $root $entry]
-        switch $type {
-            directory {
-                file mkdir $file
-            }
-            file {
-                # touch
-                close [open $file w]
-            }
-            link {
-                # file link doesn't let you link to files that don't exist
-                # so lets farm out to /bin/ln
-                exec /bin/ln -s $link $file
-            }
-            default {
-                return -code error &quot;Unknown file map type: $typelist&quot;
-            }
-        }
-    }
-}
-
-# run all tests
-foreach proc [info procs test_*] {
-    $proc
-}
-
-# namespace eval tests
-}
</del></span></pre></div>
<a id="branchesnewhelpsystembasesrcport10testsportutiltestfromrev117083trunkbasesrcport10testsportutiltest"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/src/port1.0/tests/portutil.test (from rev 117083, trunk/base/src/port1.0/tests/portutil.test) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/port1.0/tests/portutil.test                                (rev 0)
+++ branches/new-help-system/base/src/port1.0/tests/portutil.test        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,856 @@
</span><ins>+# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
+
+package require tcltest 2
+namespace import tcltest::*
+
+source ../../macports1.0/macports_fastload.tcl
+
+set pwd [file dirname [file normalize $argv0]]
+
+source ../port_test_autoconf.tcl
+source $macports::autoconf::macports_tcl_dir/macports1.0/macports_fastload.tcl
+package require macports 1.0
+
+array set ui_options {}
+#set ui_options(ports_debug)   yes
+#set ui_options(ports_verbose) yes
+mportinit ui_options
+
+source ./library.tcl
+macports_worker_init
+
+package require registry 1.0
+package require registry2 2.0
+package require Pextlib 1.0
+package require macports_dlist 1.0
+package require macports_util 1.0
+package require msgcat
+package require porttrace 1.0
+
+proc init {} {
+    global macports::registry.path
+
+    set db_path [file join ${registry.path} registry registry.db]
+    set db_exists [file exists $db_path]
+    #registry::active
+}
+
+proc init_eval_targets {} {
+    global os_platform os_version os_arch macosx_version pwd
+    global version mport portpath portbuildpath
+
+    set os_platform darwin
+    set macosx_version 10.8
+    set os_version 11
+    set os_arch i386
+    set portpath .
+    set portbuildpath ./build
+
+    # vars for target_run
+    global portdbpath usealtworkpath
+    set usealtworkpath no
+    set portdbpath $pwd/
+    set workpath $pwd/work
+    set altprefix &quot;&quot;
+
+
+    set mport [mportopen file://.]
+
+    proc getportbuildpath {id {portname &quot;&quot;}} {
+        global portdbpath
+        regsub {://} $id {.} port_path
+        regsub -all {/} $port_path {_} port_path
+        return [file join $portdbpath build $port_path $portname]
+    }
+
+    proc getportworkpath_from_buildpath {portbuildpath} {
+        return [file join $portbuildpath work]
+    }
+
+    proc getportworkpath_from_portdir {portpath {portname &quot;&quot;}} {
+        return [getportworkpath_from_buildpath [getportbuildpath $portpath $portname]]
+    }
+
+    source $pwd/../portutil.tcl
+    source $pwd/../portmain.tcl
+
+    #variant provides code requires aaa
+}
+
+
+# Create a filesystem hierarchy based on the given specification
+# The mtree spec consists of name/type pairings, where type can be
+# one of directory, file or link. If type is link, it must be a
+# two-element list containing the path as the second element
+proc mtree {root spec} {
+    foreach {entry typelist} $spec {
+        set type [lindex $typelist 0]
+        set link [lindex $typelist 1]
+        set file [file join $root $entry]
+        switch $type {
+            directory {
+                file mkdir $file
+            }
+            file {
+                # touch
+                close [open $file w]
+            }
+            link {
+                # file link doesn't let you link to files that don't exist
+                # so lets farm out to /bin/ln
+                exec /bin/ln -sf $link $file
+            }
+            default {
+                return -code return &quot;Unknown file map type: $typelist&quot;
+            }
+        }
+    }
+}
+
+
+test option {
+    Option unit test. Tcl 'set' functionality.
+} -body {
+    if {[option MP macports] != &quot;macports&quot;} {return &quot;FAIL: var not set correctly&quot;}
+    if {$MP != &quot;macports&quot;} {return &quot;FAIL: var not set&quot;}
+    return &quot;Option successful.&quot;
+} -result &quot;Option successful.&quot;
+
+
+test exists {
+    Exists unit test. Checks for existance of a Portfile option.
+} -body {
+    set vara a
+    if {[exists vara] != 1} {return &quot;FAIL: option exists but not detected&quot;}
+    if {[exists varb] != 0} {return &quot;FAIL: option detected although missing&quot;}
+    return &quot;Exists successful.&quot;
+} -result &quot;Exists successful.&quot;
+
+
+test handle_option {
+    Handle_option unit test.
+} -body {
+    if {[handle_option vara a] != &quot;a&quot;} {return &quot;FAIL: unable to set var&quot;}
+    return &quot;Handle_option successful.&quot;
+} -result &quot;Handle_option successful.&quot;
+
+
+test handle_option-append {
+    Handle_option append unit test.
+} -body {
+    set user_options {vara varb}
+    handle_option-append user_options varc
+    if {[lsearch $user_options varc] &lt; 0} {return &quot;FAIL: var not appended&quot;}
+    if {[lsearch $user_options vard] &gt;= 0} {return &quot;FAIL: unappended var found&quot;}
+    return &quot;Handle_option-append successful.&quot;
+} -result &quot;Handle_option-append successful.&quot;
+
+
+test handle_option-delete {
+    Handle_option delete unit test.
+} -body {
+    set user_options {vara varb}
+    handle_option-delete user_options varb
+    if {[lsearch $user_options varb] &gt; 0} {return &quot;FAIL: var not deleted&quot;}
+    if {[lsearch $user_options vara] &lt; 0} {return &quot;FAIL: var not found&quot;}
+    return &quot;Handle_option-delete successful.&quot;
+} -result &quot;Handle_option-delete successful.&quot;
+
+
+test handle_option-strsed {
+    Handle_option strsed unit test.
+} -body {
+    unset user_options
+    array set user_options { opt options }
+    if {[handle_option-strsed opt b] != &quot;&quot;} {return &quot;FAIL: invalid result&quot;}
+    return &quot;Handle_option-strsed successful.&quot;
+} -result &quot;Handle_option-strsed successful.&quot;
+
+
+# test handle_option-replace # deprecated
+
+
+test options {
+    Options unit test.
+} -body {
+    options date
+    if {[date macports] != &quot;macports&quot;} {return &quot;FAIL: incorect options&quot;}
+    return &quot;Options successful.&quot;
+} -result &quot;Options successful.&quot;
+
+
+# test options::export #
+# test options_export #
+# test handle_deprecated_option #
+# test get_deprecated_options #
+# test option_deprecate
+# test option_proc
+# test option_proc_trace #
+# test commands
+# test command_string #
+# test command_exec #
+# test default
+# test default_check #
+# test handle_option_string
+# test variant
+# test variant_isset
+# test variant_set
+# test variant_remove_ditem #
+# test variant_exists
+# test load_variant_desc_file
+# test variant_desc
+# test platform
+# test subport
+
+# test parse_environment #
+# test append_to_environment_value #
+# test append_list_to_environment_value #
+# test environment_array_to_string #
+
+
+test getdisttag {
+    Get dist tag unit test.
+} -body {
+    set tag [getdisttag distfile.tar.gz:tag1]
+    if {$tag != &quot;tag1&quot;} {return &quot;FAIL: invalid tag detected&quot;}
+    set tag [getdisttag distfile.tar.gz:tag1:tag2]
+    if {$tag != &quot;tag2&quot;} {return &quot;FAIL: invalid last tag&quot;}
+    set tag [getdisttag distfile.tar.gz]
+    if {$tag != &quot;&quot;} {return &quot;FAIL: detected unexistent tag&quot;}
+    return &quot;Getdisttag successful.&quot;
+} -result &quot;Getdisttag successful.&quot;
+
+
+test getdistname {
+    Get dist tag unit test.
+} -body {
+    set tag [getdistname distfile.tar.gz:tag1]
+    if {$tag != &quot;distfile.tar.gz&quot;} {return &quot;FAIL: invalid name detected&quot;}
+    set tag [getdistname distfile.gz::tag1]
+    if {$tag != &quot;distfile.gz:&quot;} {return &quot;FAIL: invalid name&quot;}
+    return &quot;Getdistname successful.&quot;
+} -result &quot;Getdistname successful.&quot;
+
+
+test tbool {
+    Tbool unit test. Check if variable is in calling namespace.
+} -setup {
+    set vara &quot;yes&quot;
+    set varb no
+} -body {
+    if {[tbool vara] == 0} { return &quot;FAIL: var not true&quot; }
+    if {[tbool varb] != 0} { return &quot;FAIL: var not false&quot; }
+    if {[tbool var] != 0} { return &quot;FAIL: var should not be here&quot; }
+    return &quot;tbool successful.&quot;
+} -result &quot;tbool successful.&quot;
+
+
+test ldelete {
+    Ldelete unit test. Remove one value from list.
+} -setup {
+    set list {a b a}
+    set empty {}
+} -body {
+    if {[ldelete $list b] != {a a}} { return &quot;FAIL: element not deleted&quot; }
+    if {[ldelete $list a] != {b a}} { return &quot;FAIL: first element not removed&quot; }
+    if {[ldelete $empty a] != {}} { return &quot;FAIL: list was empty&quot; }
+    return &quot;ldelete successful.&quot;
+} -result &quot;ldelete successful.&quot;
+
+
+test reinplace {
+    Reinplace  unit test. &quot;Sed in place&quot; functionality.
+} -setup {
+    global macportsuser
+    set macportsuser macports
+
+    set root &quot;/tmp/macports-portutil-reinplace&quot;
+    file delete -force $root
+
+    set workpath $root
+    set worksrcpath $root
+    set file $root/file
+    source ../port_autoconf.tcl
+
+    file mkdir $root
+    set fs [open $file w+]
+    puts $fs &quot;Macports reinplace unit test?&quot;
+    close $fs
+
+    set second $root/dir
+    file mkdir $second
+    file copy -force $root/file $second/file
+
+} -body {
+    reinplace s/Macports/MacPorts/1 $file
+    catch {set f [open $file r]}
+    set cont [read -nonewline $f]
+    if { $cont != &quot;MacPorts reinplace unit test?&quot; } {
+        return &quot;FAIL: reinplace no args.&quot;
+    }
+    close $f
+
+    reinplace -E s/test?/testing/1 $file
+    catch {set f [open $file r]}
+    set cont [read -nonewline $f]
+    if { $cont != &quot;MacPorts reinplace unit testing?&quot; } {
+        return &quot;FAIL: reinplace (-E) extended regex.&quot;
+    }
+    close $f
+
+    reinplace -W $second s/Macports/MP/1 file
+    catch {set f [open $second/file r]}
+    set cont [read -nonewline $f]
+    if { $cont != &quot;MP reinplace unit test?&quot; } {
+        return &quot;FAIL: reinplace (-W) relative path.&quot;
+    }
+    close $f
+
+    reinplace -n s/unit/testing/1 $file
+    catch {set f [open $file r]}
+    set cont [read -nonewline $f]
+    if { $cont != &quot;&quot; } {
+        return &quot;FAIL: reinplace (-n) suppress output.&quot;
+    }
+    close $f
+
+    return &quot;Reinplace successful.&quot;
+
+} -cleanup {
+    file delete -force $root
+} -result &quot;Reinplace successful.&quot;
+
+
+test delete {
+    Delete unit test.
+} -setup {
+    set root &quot;/tmp/macports-portutil-delete&quot;
+    file delete -force $root
+
+    try {
+        mtree $root {
+            a               directory
+            a/a             file
+            a/b             file
+            a/c             directory
+            a/c/a           file
+            a/c/b           {link ../b}
+            a/c/c           {link ../../b}
+            a/c/d           directory
+            a/c/d/a         file
+            a/c/d/b         directory
+            a/c/d/c         file
+            a/d             file
+            b               directory
+            b/a             file
+            b/b             {link q}
+            b/c             directory
+            b/c/a           file
+            b/c/b           file
+            b/d             file
+        }
+    }
+
+} -body {
+    delete $root/a/c/b
+    if {[file exists $root/a/c/b] || ![file exists $root/a/b]} {
+        return &quot;FAIL: delete with single args.&quot;
+    }
+
+    delete $root/a $root/b
+    if {[file exists $root/a] || [file exists $root/b]} {
+        return &quot;FAIL: delete with multiple args.&quot;&quot;
+    }
+    return &quot;Files deleted.&quot;
+
+} -cleanup {
+    file delete -force $root
+} -result &quot;Files deleted.&quot;
+
+
+test touch {
+    Touch unit test.
+} -setup {
+    set root &quot;/tmp/macports-portutil-touch&quot;
+    file delete -force $root
+} -body {
+    touch -c $root
+    if {[file exists $root]} { return &quot;FAIL: touch unsuccessful&quot; }
+
+    touch $root
+    if {![file exists $root]} { return &quot;FAIL: touch unsuccessful&quot; }
+    return &quot;Files successfully touched.&quot;
+
+} -cleanup {
+    file delete -force $root
+} -result &quot;Files successfully touched.&quot;
+
+
+test ln {
+    ln unit test.
+} -setup {
+    set oldpwd [pwd]
+    set root &quot;/tmp/macports-portutil-ln&quot;
+    file delete -force $root
+    file mkdir $root
+} -body {
+    close [open $root/a w]
+    ln -s a $root/b
+    if {[catch {file type $root/b}]} { return &quot;FAIL: symlink not created.&quot; }
+    if {[file type $root/b] ne &quot;link&quot;} { return &quot;FAIL: expected link.&quot; }
+
+    close [open $root/c w]
+    if {![catch {ln -s c $root/b}]} { return &quot;FAIL: ln not created.&quot; }
+
+    ln -s -f c $root/b
+    if {[catch {file type $root/b}] || [file type $root/b] ne &quot;link&quot;} {
+        return &quot;FAIL: ln failed.&quot;
+    }
+    file delete $root/b
+
+    ln $root/a $root/b
+    if {[catch {file type $root/b}] || [file type $root/b] ne &quot;file&quot;} {
+         return &quot;FAIL: ln failed.&quot;
+     }
+    file delete $root/b
+
+    file mkdir $root/dir
+    ln -s dir $root/b
+    ln -s a $root/b
+    if {[catch {file type $root/dir/a}] || [file type $root/dir/a] ne &quot;link&quot;} {
+        return &quot;FAIL: directory ln failed.&quot;
+    }
+    file delete $root/dir/a
+
+    ln -s -f -h a $root/b
+    if {[catch {file type $root/b}] || [file type $root/b] ne &quot;link&quot; || [file readlink $root/b] ne &quot;a&quot;} {
+        return &quot;FAIL: readlink error.&quot;
+    }
+
+    cd $root/dir
+    ln -s ../c
+    if {[catch {file type $root/dir/c}] || [file type $root/dir/c] ne &quot;link&quot;} {
+        return &quot;FAIL: ln failed.&quot;
+    }
+
+    ln -s foobar $root/d
+    if {[catch {file type $root/d}] || [file type $root/d] ne &quot;link&quot; || [file readlink $root/d] ne &quot;foobar&quot;} {
+        return &quot;FAIL: readlink error.&quot;
+    }
+
+    ln -s -f -h z $root/dir
+    if {[catch {file type $root/dir/z}] || [file type $root/dir/z] ne &quot;link&quot;} {
+        return &quot;FAIL: ln failed.&quot;
+    }
+
+    ln -sf q $root/dir
+    if {[catch {file type $root/dir/q}] || [file type $root/dir/q] ne &quot;link&quot;} {
+        return &quot;FAIL: error combined ln flags.&quot;
+    }
+    return &quot;Files successfully linked.&quot;
+
+} -cleanup {
+    cd $oldpwd
+    file delete -force $root
+} -result &quot;Files successfully linked.&quot;
+
+test makeuserproc {
+    Make user proc unit test.
+} -setup {
+    global MP
+    set MP macports
+} -body {
+    makeuserproc test-proc &quot;\{ if \{ \$MP == \&quot;macports\&quot; \} \{return \&quot;works\&quot;\} \}&quot;
+    set res [test-proc]
+    if { $res != &quot;works&quot; } { return &quot;FAIL: global var not set in proc&quot; }
+    return &quot;Make user proc successful.&quot;
+
+} -result &quot;Make user proc successful.&quot;
+
+
+# test backup -
+# test lipo -
+
+
+test unobscure_maintainers {
+    Unobscure maintainers unit test.
+} -body {
+    set list { port }
+    if { [unobscure_maintainers $list] != &quot;port@macports.org&quot; } {
+        return &quot;FAIL: invalid maintainer name&quot;
+    }
+    set list { google.com:port }
+    if { [unobscure_maintainers $list] != &quot;port@google.com&quot; } {
+        return &quot;FAIL: invalid maintainer name&quot;
+    }
+
+    set list { port@google.com }
+    if { [unobscure_maintainers $list] != &quot;port@google.com&quot; } {
+        return &quot;FAIL: invalid maintainer name&quot;
+    }
+    return &quot;unobscure_maintainers successful.&quot;
+} -result &quot;unobscure_maintainers successful.&quot;
+
+
+# test target_run
+# test recursive_collect_deps
+
+
+test eval_targets {
+    Evaluate targets unit test.
+} -setup {
+    init_eval_targets
+    set patchfiles {file.diff}
+
+    file mkdir $filespath
+    set fd [open $filespath/file.diff w+]
+    puts $fd &quot;first line should get to the workpath&quot;
+    close $fd
+
+    # sets up PortInfo array
+    if {[eval_variants variations] != 0} {
+        mportclose $mport
+        error &quot;Error evaluating variants&quot;
+    }
+
+    set epoch $PortInfo(epoch)
+    set revision $PortInfo(revision)
+
+    # messy work just to get $version
+    set workername [ditem_key $mport workername]
+
+} -body {
+    if {[$workername eval catch {eval_targets macport}] != 1} {
+        return &quot;FAIL: invalid target detected&quot;
+    }
+    if {[$workername eval eval_targets checksum] != 0} {
+        return &quot;FAIL: valid target not detected&quot;
+    }
+    return &quot;Eval_targets successful.&quot;
+
+} -cleanup {
+    mportclose $mport
+    file delete -force $filespath
+    file delete -force work
+
+} -result &quot;Eval_targets successful.&quot;
+
+
+test get_statefile_value {
+    Get statefile value unit test.
+    Depends on line in statefile &quot;target: org.macports.fetch&quot;.
+} -body {
+    set fd [open $pwd/statefile r]
+
+    set res [catch {get_statefile_value target $fd result}]
+    if {$res != 0 || $result != &quot;org.macports.fetch&quot;} {
+        return &quot;FAIL: invalid value&quot;
+    }
+    return &quot;Get statefile value successful.&quot;
+} -result &quot;Get statefile value successful.&quot;
+
+
+test check_statefile {
+    Check statefile unit test.
+} -body {
+    set fd [open $pwd/statefile r]
+    set res [check_statefile target org.macports.patch $fd]
+    if {$res != 1} {return &quot;FAIL: target not found&quot;}
+
+    set res [check_statefile target org.macports.port $fd]
+    if {$res != 0} {return &quot;FAIL: invalid target found&quot;}
+    close $fd
+    return &quot;Check_statefile successful.&quot;
+} -result &quot;Check_statefile successful.&quot;
+
+
+test write_statefile {
+    Write statefile unit test.
+} -body {
+    set fd [open $pwd/test.statefile w+]
+    write_statefile variant universal $fd
+    set res [check_statefile variant universal $fd]
+    if {$res != 1} {return &quot;FAIL: variant not set&quot;}
+    close $fd
+    return &quot;Write_statefile successful.&quot;
+
+} -cleanup {
+    file delete -force $pwd/test.statefile
+} -result &quot;Write_statefile successful.&quot;
+
+
+test check_statefile_variants {
+    Check statefile unit test.
+} -setup {
+    array set variations {
+    target org.macports.fetch
+    target org.macports.checksum
+    }
+    array set oldvariations {
+    target org.macports.fetch
+    target org.macports.checksum
+    }
+    array set oldvariations_fail {
+    target org.macports.patch
+    }
+    set fd [open $pwd/statefile r]
+
+} -body {
+    set res [check_statefile_variants variations oldvariations $fd]
+    if {$res != 0} {return &quot;FAIL: invalid variant&quot;}
+    set res [check_statefile_variants variations oldvariations_fail $fd]
+    if {$res != 1} {return &quot;FAIL: invalid variant&quot;}
+    close $fd
+    return &quot;Check statefile successful.&quot;
+
+} -result &quot;Check statefile successful.&quot;
+
+
+test choose_variants {
+    Choose variants unit test.
+} -setup {
+    init_eval_targets
+    array set variations { fondu + }
+    array set variations_neg { fondu - }
+    array set variations_not { fondu a }
+
+} -body {
+    set res [choose_variants $mport variations]
+    if {[lindex $res 1] != &quot;&quot; &amp;&amp; [lindex $res 0] != &quot;ditem_1&quot;} {
+        return &quot;FAIL: invalid variations&quot;
+    }
+    set res [choose_variants $mport variations_neg]
+    if {[lindex $res 0] != &quot;&quot; &amp;&amp; [lindex $res 1] != &quot;ditem_1&quot;} {
+        return &quot;FAIL: invalid variations&quot;
+    }
+    set res [choose_variants $mport variations_not]
+    if {[lindex $res 0] != &quot;&quot; &amp;&amp; [lindex $res 1] != &quot;&quot;} {
+        return &quot;FAIL: invalid variations&quot;
+    }
+    return &quot;Choose variant successful.&quot;
+} -result &quot;Choose variant successful.&quot;
+
+
+test variant_run {
+    Variant run unit test. Executes proc with same name as variant.
+} -setup {
+    proc variant-var {} { set var test }
+    set ditem [variant_new var]
+    set name [ditem_key $ditem name]
+
+} -body {
+    if {[catch {variant_run $ditem}] != 0} {
+        return &quot;FAIL: unable to run variant name proc&quot;
+    }
+    return &quot;Variant run successful.&quot;
+} -cleanup {
+    mportclose $mport
+    file delete -force work
+} -result &quot;Variant run successful.&quot;
+
+
+test canonicalize_variants {
+    Canonicalize_variants unit test.
+} -body {
+    set arr {c + b - d +}
+    if {[canonicalize_variants $arr +] != &quot;+c+d&quot;} {
+        return &quot;FAIL: incorrect string&quot;
+    }
+    if {[canonicalize_variants $arr -] != &quot;-b&quot;} {
+        return &quot;FAIL: incorrect string&quot;
+    }
+    return &quot;Canonicalize variants successful.&quot;
+} -result &quot;Canonicalize variants successful.&quot;
+
+
+# test eval_variants
+# test check_variants
+
+
+test universal_setup {
+    Universal setup unit test.
+} -body {
+    set use_configure 0
+    set ditem [variant_new new-variant]
+
+    if {[catch {universal_setup}] != 0} {
+        return &quot;FAIL: universal variant not set&quot;
+    }
+    return &quot;Universal_setup successful.&quot;
+} -result &quot;Universal_setup successful.&quot;
+
+
+# Covered by eval_targets.
+# test target_new #
+# test target_provides #
+# test target_requires #
+# test target_uses #
+# test target_deplist #
+# test target_prerun #
+# test target_postrun #
+# test target_runtype #
+# test target_state #
+# test target_init #
+
+
+test variant_new {
+    Variant new unit test.
+} -body {
+    set ditem [variant_new new-variant]
+    if {[ditem_key $ditem name] != &quot;new-variant&quot;} {
+        return &quot;FAIL: error building new variant&quot;
+    }
+    return &quot;Variant new successful.&quot;
+} -result &quot;Variant new successful.&quot;
+
+
+test handle_default_variants {
+    Handle default variants unit test.
+} -body {
+    array set variations {
+        target.run org.macports.checksum
+    }
+
+    set res [handle_default_variants target set {+org -org2}]
+
+    if {[lindex $PortInfo(vinfo) 0] != &quot;org&quot; || [lindex $PortInfo(vinfo) 1] != &quot;is_default +&quot;} {
+        return &quot;FAIL: default variant not set&quot;
+    }
+    if {[lindex $PortInfo(vinfo) 2] != &quot;org2&quot; || [lindex $PortInfo(vinfo) 3] != &quot;is_default -&quot;} {
+        return &quot;FAIL: nondefault variant not set&quot;
+    }
+
+    return &quot;Handle default variant successful.&quot;
+} -result &quot;Handle default variant successful.&quot;
+
+
+# test handle_add_users #
+# test adduser #
+# test addgroup #
+
+
+test dirSize {
+    Directory size unit test.
+    This test is dependent on the statefile in the tests dir.
+    Expected file size is 155.
+} -body {
+    global pwd
+    file mkdir $pwd/test.dir
+    file copy -force $pwd/statefile $pwd/test.dir
+    if {[dirSize $pwd/test.dir] != 155} {
+        return &quot;FAIL: wrong dir size&quot;
+    }
+    return &quot;Directory size calculated successfully.&quot;
+
+} -cleanup {
+    file delete -force $pwd/test.dir
+} -result &quot;Directory size calculated successfully.&quot;
+
+
+test set_ui_prefix {
+    Set_ui unit test. Assumes default: &quot;---&gt; &quot;.
+} -body {
+    set env(UI_PREFIX) MacPorts
+    set_ui_prefix
+    if {$UI_PREFIX != &quot;MacPorts&quot;} {return &quot;FAIL: incorrect prefix&quot;}
+
+    unset env(UI_PREFIX)
+    set_ui_prefix
+    if {$UI_PREFIX != &quot;---&gt; &quot;} {return &quot;FAIL; default prefix not set&quot;}
+    return &quot;Set_ui_prefix successful.&quot;
+} -result &quot;Set_ui_prefix successful.&quot;
+
+
+# test PortGroup
+
+
+test get_portimage_name {
+    Get portimage name unit test.
+} -body {
+    set os.platform darwin
+    set version 1.0
+    set os.major 10
+    set revision 2
+    set configure.build_arch no
+    set portarchivetype tgz
+    set subport testport
+    set portvariants {var1}
+    set supported_archs {}
+
+    set res [get_portimage_name]
+    if {$res != &quot;testport-1.0_2var1.darwin_10.no.tgz&quot;} {
+        return &quot;FAIL: invalid portimage_name&quot;
+    }
+    return &quot;Get portimage_name successful.&quot;
+} -result &quot;Get portimage_name successful.&quot;
+
+
+test get_portimage_path {
+    Get portimage path unit test. Calls get_portimage_name.
+} -body {
+    set os.platform darwin
+    set portdbpath dbpath
+    set subport subport
+    set revision 2
+    set portvariants {var1}
+    set supported_archs {}
+
+    set res [get_portimage_path]
+    if {$res != [file normalize &quot;dbpath/software/subport/subport-1.0_2var1.darwin_10.no.tgz&quot;]} {
+        return &quot;FAIL: invalid portimage_path&quot;
+    }
+    return &quot;Get portimage_path successful.&quot;
+} -result &quot;Get portimage_path successful.&quot;
+
+
+test supportedArchiveTypes {
+    Supported archive types unit test.
+    Only tests xar, zip, cpio.
+} -body {
+    set archives [supportedArchiveTypes]
+
+    foreach archive $archives {
+        if {$archive == &quot;xar&quot; &amp;&amp; ![file exists ${portutil::autoconf::xar_path}]} {
+            return &quot;FAIL: xar detected but inexistent&quot;
+        }
+        if {$archive == &quot;zip&quot; &amp;&amp; ![file exists ${portutil::autoconf::zip_path}]} {
+            return &quot;FAIL: zip detected but inexistent&quot;
+        }
+        if {$archive == &quot;cpio&quot; &amp;&amp; ![file exists ${portutil::autoconf::cpio_path}]} {
+            return &quot;FAIL: cpio detected but inexistent&quot;
+        }
+    }
+    return &quot;Supported archives successful.&quot;
+} -result &quot;Supported archives successful.&quot;
+
+
+# test find_portarchie_path
+# test archiveTypeIsSupported
+# test extract_archive_metadata
+
+# test merge_lipo
+# test merge_cpp
+# test merge_file
+# test merge
+# test quotemeta
+# test chown
+# test chownAsRoot
+# test fileAttrsAsRoot
+# test elevateToRoot
+# test dropPrivileges
+# test validate_macportsuser
+
+# test _libtest
+# test _bintest
+# test _pathtest
+# test _get_dep_port
+# test get_canonical_archs
+# test get_canonical_archflags
+# test check_supported_archs
+
+
+# test _check_xcode_version
+# test _archive_available
+
+
+cleanupTests
</ins></span></pre></div>
<a id="branchesnewhelpsystembasesrcport10testsstatefilefromrev117083trunkbasesrcport10testsstatefile"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/src/port1.0/tests/statefile (from rev 117083, trunk/base/src/port1.0/tests/statefile) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/port1.0/tests/statefile                                (rev 0)
+++ branches/new-help-system/base/src/port1.0/tests/statefile        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,6 @@
</span><ins>+version: 3
+target: org.macports.fetch
+target: org.macports.checksum
+target: org.macports.extract
+target: org.macports.patch
+target: org.macports.configure
</ins></span></pre></div>
<a id="branchesnewhelpsystembasesrcport10teststesttclfromrev117083trunkbasesrcport10teststesttcl"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/src/port1.0/tests/test.tcl (from rev 117083, trunk/base/src/port1.0/tests/test.tcl) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/port1.0/tests/test.tcl                                (rev 0)
+++ branches/new-help-system/base/src/port1.0/tests/test.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,131 @@
</span><ins>+# Global vars
+set arguments &quot;&quot;
+set test_name &quot;&quot;
+set color_out &quot;&quot;
+set tcl &quot;&quot;
+set err &quot;&quot;
+
+# Get tclsh path.
+set autoconf ../../Mk/macports.autoconf.mk
+set fp [open $autoconf r]
+while {[gets $fp line] != -1} {
+    if {[string match &quot;TCLSH*&quot; $line] != 0} {
+        set tcl [lrange [split $line &quot; &quot;] 1 1]
+    }
+}
+
+proc print_help {arg} {
+    if { $arg eq &quot;tests&quot; } {
+        puts &quot;The list of available tests is:&quot;
+        cd tests
+        set test_suite [glob *.test]
+        foreach test $test_suite {
+            puts [puts -nonewline &quot;  &quot;]$test
+        }
+    } else {
+        puts &quot;Usage: tclsh test.tcl \[-debug level\] \[-t test\] \[-l\]\n&quot;
+        puts &quot;  -debug LVL : sets the level of printed debug info \[0-3\]&quot;
+        puts &quot;  -t TEST    : run a specific test&quot;
+        puts &quot;  -nocolor   : disable color output (for automatic testing)&quot;
+        puts &quot;  -l         : print the list of available tests&quot;
+        puts &quot;  -h, -help  : print this message\n&quot;
+    }
+}
+
+# Process args
+foreach arg $argv {
+    if { $arg eq &quot;-h&quot; || $arg eq &quot;-help&quot; } {
+        print_help &quot;&quot;
+        exit 0
+    } elseif { $arg eq &quot;-debug&quot; } {
+        set index [expr {[lsearch $argv $arg] + 1}]
+        set level [lindex $argv $index]
+        if { $level &gt;= 0 &amp;&amp; $level &lt;= 3 } {
+            append arguments &quot;-debug &quot; $level
+        } else {
+            puts &quot;Invalid debug level.&quot;
+            exit 1
+        }
+    } elseif { $arg eq &quot;-t&quot; } {
+        set index [expr {[lsearch $argv $arg] + 1}]
+        set test_name [lindex $argv $index]
+        set no 0
+        cd tests
+        set test_suite [glob *.test]
+        foreach test $test_suite {
+            if { $test_name != $test } {
+                set no [expr {$no + 1}]
+            }
+        }
+        if { $no == [llength $test_suite] } {
+            print_help tests
+            exit 1
+        }
+    } elseif { $arg eq &quot;-l&quot; } {
+        print_help tests
+        exit 0
+    } elseif { $arg eq &quot;-nocolor&quot; } {
+        set color_out &quot;no&quot;
+    }
+}
+
+
+# Run tests
+if { $test_name ne &quot;&quot;} {
+    set result [eval exec $tcl $test_name $arguments 2&gt;@stderr]
+    puts $result
+
+} else {
+    cd tests
+    set test_suite [glob *.test]
+
+    foreach test $test_suite {
+        set result [eval exec $tcl $test $arguments 2&gt;@stderr]
+        set lastline [lindex [split $result &quot;\n&quot;] end]
+
+        if {[lrange [split $lastline &quot;\t&quot;] 1 1] != &quot;Total&quot;} {
+            set lastline [lindex [split $result &quot;\n&quot;] end-2]
+            set errmsg [lindex [split $result &quot;\n&quot;] end]
+        }
+
+        set splitresult [split $lastline &quot;\t&quot;]
+        set total [lindex $splitresult 2]
+        set pass [lindex $splitresult 4]
+        set skip [lindex $splitresult 6]
+        set fail [lindex $splitresult 8]
+
+        # Format output
+        if {$total &lt; 10} { set total &quot;0${total}&quot;}
+        if {$pass &lt; 10} { set pass &quot;0${pass}&quot;}
+        if {$skip &lt; 10} { set skip &quot;0${skip}&quot;}
+        if {$fail &lt; 10} { set fail &quot;0${fail}&quot;}
+
+        # Check for errors.
+        if { $fail != 0 } { set err &quot;yes&quot; }
+
+        set out &quot;&quot;
+        if { ($fail != 0 || $skip != 0) &amp;&amp; $color_out eq &quot;&quot; } {
+            # Color failed tests.
+            append out &quot;\x1b\[1;31mTotal:&quot; $total &quot; Passed:&quot; $pass &quot; Failed:&quot; $fail &quot; Skipped:&quot; $skip &quot;  \x1b\[0m&quot; $test
+        } else {
+            append out &quot;Total:&quot; $total &quot; Passed:&quot; $pass &quot; Failed:&quot; $fail &quot; Skipped:&quot; $skip &quot;  &quot; $test
+        }
+
+        # Print results and constrints for auto-skipped tests.
+        puts $out
+        if { $skip != 0 } {
+            set out &quot;    Constraint: &quot;
+            append out [string trim $errmsg &quot;\t {}&quot;]
+            puts $out
+        }
+        if { $fail != 0 } {
+            set end [expr {[string first $test $result 0] - 1}]
+            puts [string range $result 0 $end]
+        }
+    }
+}
+
+# Return 1 if errors were found.
+if {$err ne &quot;&quot;} { exit 1 }
+
+return 0
</ins></span></pre></div>
<a id="branchesnewhelpsystembasesrcprogramsdaemondomainc"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/src/programs/daemondo/main.c (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/programs/daemondo/main.c        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/src/programs/daemondo/main.c        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -116,6 +116,7 @@
</span><span class="cx"> int                                    restartWait                           = 3;              // Default wait during restart is 3 seconds
</span><span class="cx"> 
</span><span class="cx"> 
</span><ins>+__printflike(1, 2)
</ins><span class="cx"> void
</span><span class="cx"> LogMessage(const char* fmt, ...)
</span><span class="cx"> {
</span><span class="lines">@@ -514,7 +515,7 @@
</span><span class="cx">             LogMessage(&quot;Unable to launch process %s.\n&quot;, argv[0]);
</span><span class="cx">             _exit(1);
</span><span class="cx">         }
</span><del>-        break;
</del><ins>+        /*NOTREACHED*/
</ins><span class="cx">     
</span><span class="cx">     case -1:
</span><span class="cx">         // error starting child process
</span><span class="lines">@@ -1226,7 +1227,7 @@
</span><span class="cx">         case ':':
</span><span class="cx">             printf(&quot;Option error: missing argument for option %s\n&quot;, longopts[optindex].name);
</span><span class="cx">             exit(1);
</span><del>-            break;
</del><ins>+            /*NOTREACHED*/
</ins><span class="cx">             
</span><span class="cx">         case 's':
</span><span class="cx">             if (startArgs)
</span><span class="lines">@@ -1326,7 +1327,7 @@
</span><span class="cx">         case 'h':
</span><span class="cx">             DoHelp();
</span><span class="cx">             exit(0);
</span><del>-            break;
</del><ins>+            /*NOTREACHED*/
</ins><span class="cx">             
</span><span class="cx">         case 'l':
</span><span class="cx">             if (label != NULL)
</span></span></pre></div>
<a id="branchesnewhelpsystembasesrcregistry20portimagetcl"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/src/registry2.0/portimage.tcl (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/registry2.0/portimage.tcl        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/src/registry2.0/portimage.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -66,7 +66,7 @@
</span><span class="cx"> 
</span><span class="cx"> # takes a composite version spec rather than separate version,revision,variants
</span><span class="cx"> proc activate_composite {name {v &quot;&quot;} {optionslist &quot;&quot;}} {
</span><del>-    if {$v == &quot;&quot;} {
</del><ins>+    if {$v eq &quot;&quot;} {
</ins><span class="cx">         return [activate $name &quot;&quot; &quot;&quot; 0 $optionslist]
</span><span class="cx">     } elseif {[registry::decode_spec $v version revision variants]} {
</span><span class="cx">         return [activate $name $version $revision $variants $optionslist]
</span><span class="lines">@@ -107,19 +107,19 @@
</span><span class="cx">         # if another version of this port is active, deactivate it first
</span><span class="cx">         set current [registry::entry installed $name]
</span><span class="cx">         foreach i $current {
</span><del>-            if { ![string equal $specifier &quot;[$i version]_[$i revision][$i variants]&quot;] } {
</del><ins>+            if { $specifier ne &quot;[$i version]_[$i revision][$i variants]&quot; } {
</ins><span class="cx">                 lappend todeactivate $i
</span><span class="cx">             }
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         # this shouldn't be possible
</span><del>-        if { ![string equal [$requested installtype] &quot;image&quot;] } {
</del><ins>+        if { [$requested installtype] ne &quot;image&quot; } {
</ins><span class="cx">             return -code error &quot;Image error: ${name} @${specifier} not installed as an image.&quot;
</span><span class="cx">         }
</span><span class="cx">         if {![::file isfile $location]} {
</span><span class="cx">             return -code error &quot;Image error: Can't find image file $location&quot;
</span><span class="cx">         }
</span><del>-        if { [string equal [$requested state] &quot;installed&quot;] } {
</del><ins>+        if {[$requested state] eq &quot;installed&quot;} {
</ins><span class="cx">             return -code error &quot;Image error: ${name} @${specifier} is already active.&quot;
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="lines">@@ -137,7 +137,7 @@
</span><span class="cx"> 
</span><span class="cx"> # takes a composite version spec rather than separate version,revision,variants
</span><span class="cx"> proc deactivate_composite {name {v &quot;&quot;} {optionslist &quot;&quot;}} {
</span><del>-    if {$v == &quot;&quot;} {
</del><ins>+    if {$v eq &quot;&quot;} {
</ins><span class="cx">         return [deactivate $name &quot;&quot; &quot;&quot; 0 $optionslist]
</span><span class="cx">     } elseif {[registry::decode_spec $v version revision variants]} {
</span><span class="cx">         return [deactivate $name $version $revision $variants $optionslist]
</span><span class="lines">@@ -162,7 +162,7 @@
</span><span class="cx">         set registry_open yes
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if { [string equal $name &quot;&quot;] } {
</del><ins>+    if {$name eq &quot;&quot;} {
</ins><span class="cx">         throw registry::image-error &quot;Registry error: Please specify the name of the port.&quot;
</span><span class="cx">     }
</span><span class="cx">     set ilist [registry::entry installed $name]
</span><span class="lines">@@ -175,10 +175,10 @@
</span><span class="cx">     set name [$requested name]
</span><span class="cx">     set specifier &quot;[$requested version]_[$requested revision][$requested variants]&quot;
</span><span class="cx"> 
</span><del>-    if {$version != &quot;&quot; &amp;&amp; ($version != [$requested version] ||
-        ($revision != &quot;&quot; &amp;&amp; ($revision != [$requested revision] || $variants != [$requested variants])))} {
</del><ins>+    if {$version ne &quot;&quot; &amp;&amp; ($version != [$requested version] ||
+        ($revision ne &quot;&quot; &amp;&amp; ($revision != [$requested revision] || $variants != [$requested variants])))} {
</ins><span class="cx">         set v $version
</span><del>-        if {$revision != &quot;&quot;} {
</del><ins>+        if {$revision ne &quot;&quot;} {
</ins><span class="cx">             append v _${revision}${variants}
</span><span class="cx">         }
</span><span class="cx">         return -code error &quot;Active version of $name is not $v but ${specifier}.&quot;
</span><span class="lines">@@ -186,11 +186,11 @@
</span><span class="cx"> 
</span><span class="cx">     ui_msg &quot;$UI_PREFIX [format [msgcat::mc &quot;Deactivating %s @%s&quot;] $name $specifier]&quot;
</span><span class="cx"> 
</span><del>-    if { ![string equal [$requested installtype] &quot;image&quot;] } {
</del><ins>+    if { [$requested installtype] ne &quot;image&quot; } {
</ins><span class="cx">         return -code error &quot;Image error: ${name} @${specifier} not installed as an image.&quot;
</span><span class="cx">     }
</span><span class="cx">     # this shouldn't be possible
</span><del>-    if { [$requested state] != &quot;installed&quot; } {
</del><ins>+    if { [$requested state] ne &quot;installed&quot; } {
</ins><span class="cx">         return -code error &quot;Image error: ${name} @${specifier} is not active.&quot;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -207,12 +207,12 @@
</span><span class="cx"> 
</span><span class="cx">     set searchkeys $name
</span><span class="cx">     set composite_spec &quot;&quot;
</span><del>-    if {$version != &quot;&quot;} {
</del><ins>+    if {$version ne &quot;&quot;} {
</ins><span class="cx">         lappend searchkeys $version
</span><span class="cx">         set composite_spec $version
</span><span class="cx">         # restriction imposed by underlying registry API (see entry.c):
</span><span class="cx">         # if a revision is specified, so must variants be
</span><del>-        if {$revision != &quot;&quot;} {
</del><ins>+        if {$revision ne &quot;&quot;} {
</ins><span class="cx">             lappend searchkeys $revision $variants
</span><span class="cx">             append composite_spec _${revision}${variants}
</span><span class="cx">         }
</span><span class="lines">@@ -226,7 +226,7 @@
</span><span class="cx">             set iversion [$i version]
</span><span class="cx">             set irevision [$i revision]
</span><span class="cx">             set ivariants [$i variants]
</span><del>-            if { [$i state] == &quot;installed&quot; } {
</del><ins>+            if { [$i state] eq &quot;installed&quot; } {
</ins><span class="cx">                 ui_msg &quot;$UI_PREFIX [format [msgcat::mc &quot;    %s @%s_%s%s (active)&quot;] $iname $iversion $irevision $ivariants]&quot;
</span><span class="cx">             } else {
</span><span class="cx">                 ui_msg &quot;$UI_PREFIX [format [msgcat::mc &quot;    %s @%s_%s%s&quot;] $iname $iversion $irevision $ivariants]&quot;
</span><span class="lines">@@ -236,7 +236,7 @@
</span><span class="cx">     } elseif { [llength $ilist] == 1 } {
</span><span class="cx">         return [lindex $ilist 0]
</span><span class="cx">     }
</span><del>-    if {$composite_spec != &quot;&quot;} {
</del><ins>+    if {$composite_spec ne &quot;&quot;} {
</ins><span class="cx">         set composite_spec &quot; @${composite_spec}&quot;
</span><span class="cx">     }
</span><span class="cx">     throw registry::invalid &quot;Registry error: ${name}${composite_spec} is not installed.&quot;
</span><span class="lines">@@ -469,7 +469,7 @@
</span><span class="cx">                     }
</span><span class="cx">                 }
</span><span class="cx"> 
</span><del>-                if {$owner != &quot;replaced&quot;} {
</del><ins>+                if {$owner ne &quot;replaced&quot;} {
</ins><span class="cx">                     if { [string is true -strict $force] } {
</span><span class="cx">                         # if we're forcing the activation, then we move any existing
</span><span class="cx">                         # files to a backup file, both in the filesystem and in the
</span><span class="lines">@@ -559,7 +559,7 @@
</span><span class="cx">         }
</span><span class="cx">         # reactivate deactivated ports
</span><span class="cx">         foreach entry [array names todeactivate] {
</span><del>-            if {[$entry state] == &quot;imaged&quot; &amp;&amp; ($noexec || ![registry::run_target $entry activate &quot;&quot;])} {
</del><ins>+            if {[$entry state] eq &quot;imaged&quot; &amp;&amp; ($noexec || ![registry::run_target $entry activate &quot;&quot;])} {
</ins><span class="cx">                 activate [$entry name] [$entry version] [$entry revision] [$entry variants] [list ports_activate_no-exec $noexec]
</span><span class="cx">             }
</span><span class="cx">         }
</span><span class="lines">@@ -580,10 +580,10 @@
</span><span class="cx">         ui_debug &quot;$dstfile does not exist&quot;
</span><span class="cx">         return
</span><span class="cx">     }
</span><del>-    if { $filetype == &quot;link&quot; } {
</del><ins>+    if { $filetype eq &quot;link&quot; } {
</ins><span class="cx">         ui_debug &quot;deactivating link: $dstfile&quot;
</span><span class="cx">         file delete -- $dstfile
</span><del>-    } elseif { $filetype == &quot;directory&quot; } {
</del><ins>+    } elseif { $filetype eq &quot;directory&quot; } {
</ins><span class="cx">         # 0 item means empty.
</span><span class="cx">         if { [llength [readdir $dstfile]] == 0 } {
</span><span class="cx">             variable precious_dirs
</span><span class="lines">@@ -606,7 +606,7 @@
</span><span class="cx">     set files [list]
</span><span class="cx"> 
</span><span class="cx">     foreach file $imagefiles {
</span><del>-        if { [::file exists $file] || (![catch {::file type $file}] &amp;&amp; [::file type $file] == &quot;link&quot;) } {
</del><ins>+        if { [::file exists $file] || (![catch {::file type $file}] &amp;&amp; [::file type $file] eq &quot;link&quot;) } {
</ins><span class="cx">             # Normalize the file path to avoid removing the intermediate
</span><span class="cx">             # symlinks (remove the empty directories instead)
</span><span class="cx">             # Remark: paths in the registry may be not normalized.
</span></span></pre></div>
<a id="branchesnewhelpsystembasesrcregistry20portuninstalltcl"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/src/registry2.0/portuninstall.tcl (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/registry2.0/portuninstall.tcl        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/src/registry2.0/portuninstall.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -43,7 +43,7 @@
</span><span class="cx"> 
</span><span class="cx"> # takes a composite version spec rather than separate version,revision,variants
</span><span class="cx"> proc uninstall_composite {portname {v &quot;&quot;} {optionslist &quot;&quot;}} {
</span><del>-    if {$v == &quot;&quot;} {
</del><ins>+    if {$v eq &quot;&quot;} {
</ins><span class="cx">         return [uninstall $portname &quot;&quot; &quot;&quot; 0 $optionslist]
</span><span class="cx">     } elseif {[registry::decode_spec $v version revision variants]} {
</span><span class="cx">         return [uninstall $portname $version $revision $variants $optionslist]
</span><span class="lines">@@ -75,12 +75,12 @@
</span><span class="cx"> 
</span><span class="cx">     set searchkeys $portname
</span><span class="cx">     set composite_spec &quot;&quot;
</span><del>-    if {$version != &quot;&quot;} {
</del><ins>+    if {$version ne &quot;&quot;} {
</ins><span class="cx">         lappend searchkeys $version
</span><span class="cx">         set composite_spec $version
</span><span class="cx">         # restriction imposed by underlying registry API (see entry.c):
</span><span class="cx">         # if a revision is specified, so must variants be
</span><del>-        if {$revision != &quot;&quot;} {
</del><ins>+        if {$revision ne &quot;&quot;} {
</ins><span class="cx">             lappend searchkeys $revision $variants
</span><span class="cx">             append composite_spec _${revision}${variants}
</span><span class="cx">         }
</span><span class="lines">@@ -92,7 +92,7 @@
</span><span class="cx">         ui_msg &quot;$UI_PREFIX [msgcat::mc &quot;The following versions of $portname are currently installed:&quot;]&quot;
</span><span class="cx">         foreach i [portlist_sortint $ilist] {
</span><span class="cx">             set ispec &quot;[$i version]_[$i revision][$i variants]&quot;
</span><del>-            if { [string equal [$i state] installed] } {
</del><ins>+            if {[$i state] eq &quot;installed&quot;} {
</ins><span class="cx">                 ui_msg &quot;$UI_PREFIX [format [msgcat::mc &quot;    %s @%s (active)&quot;] [$i name] $ispec]&quot;
</span><span class="cx">             } else {
</span><span class="cx">                 ui_msg &quot;$UI_PREFIX [format [msgcat::mc &quot;    %s @%s&quot;] [$i name] $ispec]&quot;
</span><span class="lines">@@ -106,7 +106,7 @@
</span><span class="cx">         set variants [$port variants]
</span><span class="cx">         set composite_spec &quot;${version}_${revision}${variants}&quot;
</span><span class="cx">     } else {
</span><del>-        if {$composite_spec != &quot;&quot;} {
</del><ins>+        if {$composite_spec ne &quot;&quot;} {
</ins><span class="cx">             set composite_spec &quot; @${composite_spec}&quot;
</span><span class="cx">         }
</span><span class="cx">         throw registry::invalid &quot;Registry error: ${portname}${composite_spec} not registered as installed&quot;
</span><span class="lines">@@ -122,7 +122,7 @@
</span><span class="cx">         }
</span><span class="cx">         foreach depport [$port dependents] {
</span><span class="cx">             # make sure it's still installed, since a previous dep uninstall may have removed it
</span><del>-            if {[registry::entry exists $depport] &amp;&amp; ([$depport state] == &quot;imaged&quot; || [$depport state] == &quot;installed&quot;)} {
</del><ins>+            if {[registry::entry exists $depport] &amp;&amp; ([$depport state] eq &quot;imaged&quot; || [$depport state] eq &quot;installed&quot;)} {
</ins><span class="cx">                 if {[info exists options(ports_uninstall_no-exec)] || ![registry::run_target $depport uninstall $optionslist]} {
</span><span class="cx">                     registry_uninstall::uninstall [$depport name] [$depport version] [$depport revision] [$depport variants] $optionslist
</span><span class="cx">                 }
</span><span class="lines">@@ -137,7 +137,7 @@
</span><span class="cx">         registry::check_dependents $port ${uninstall.force} &quot;uninstall&quot;
</span><span class="cx">     }
</span><span class="cx">     # if it's active, deactivate it
</span><del>-    if { [string equal [$port state] installed] } {
</del><ins>+    if {[$port state] eq &quot;installed&quot;} {
</ins><span class="cx">         if {[info exists options(ports_dryrun)] &amp;&amp; [string is true -strict $options(ports_dryrun)]} {
</span><span class="cx">             ui_msg &quot;For $portname @${composite_spec}: skipping deactivate (dry run)&quot;
</span><span class="cx">         } else {
</span></span></pre></div>
<a id="branchesnewhelpsystembasesrcregistry20receipt_flattcl"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/src/registry2.0/receipt_flat.tcl (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/registry2.0/receipt_flat.tcl        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/src/registry2.0/receipt_flat.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -88,7 +88,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     # Might as well bail out early if no file to match
</span><del>-    if {![string length $matchfile]} {
</del><ins>+    if {$matchfile eq &quot;&quot;} {
</ins><span class="cx">                 return &quot;&quot;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -117,8 +117,8 @@
</span><span class="cx">         if { ![::file isdirectory $receipt_path] } {
</span><span class="cx">                 set receipt_file [get_head_entry_receipt_path $name $version]
</span><span class="cx">                 
</span><del>-                if {![string length $receipt_file]} {
-                        if { $version != &quot;&quot; } {
</del><ins>+                if {$receipt_file eq &quot;&quot;} {
+                        if { $version ne &quot;&quot; } {
</ins><span class="cx">                                 return -code error &quot;Registry error: ${name} @${version}_${revision}${variants} not registered as installed.&quot;
</span><span class="cx">                         } else {
</span><span class="cx">                                 return -code error &quot;Registry error: ${name} not registered as installed.&quot;
</span><span class="lines">@@ -126,13 +126,13 @@
</span><span class="cx">                 }
</span><span class="cx">                 
</span><span class="cx">                 # Extract the version from the path.
</span><del>-                if { $version == &quot;&quot; } {
</del><ins>+                if { $version eq &quot;&quot; } {
</ins><span class="cx">                         set theFileName [::file tail $receipt_file]
</span><span class="cx">                         regexp &quot;^$name-(.*)\$&quot; $theFileName match version
</span><span class="cx">                 }
</span><span class="cx">         } else {
</span><span class="cx">                 # If version wasn't specified, find out the version number.
</span><del>-                if { $version == &quot;&quot; } {
</del><ins>+                if { $version eq &quot;&quot; } {
</ins><span class="cx">                         # xxx: We really should have had the 
</span><span class="cx">                         # version given to us.  How should we handle this?
</span><span class="cx">                         set x [glob -nocomplain -directory ${receipt_path} *]
</span><span class="lines">@@ -451,9 +451,9 @@
</span><span class="cx"> 
</span><span class="cx">         set query_path [::file join ${macports::registry.path} receipts]
</span><span class="cx">         
</span><del>-        if { $name == &quot;&quot; } {
</del><ins>+        if { $name eq &quot;&quot; } {
</ins><span class="cx">                 set query_path [::file join ${query_path} *]
</span><del>-                if { $version == &quot;&quot; } {
</del><ins>+                if { $version eq &quot;&quot; } {
</ins><span class="cx">                         set query_path [::file join ${query_path} *]
</span><span class="cx">                 }
</span><span class="cx">                 # [PG] Huh?
</span><span class="lines">@@ -472,7 +472,7 @@
</span><span class="cx">                 }
</span><span class="cx">             }
</span><span class="cx">                 set query_path [::file join ${query_path} ${name}]
</span><del>-                if { $version != &quot;&quot; } {
</del><ins>+                if { $version ne &quot;&quot; } {
</ins><span class="cx">                         set query_path [::file join ${query_path} ${version}]
</span><span class="cx">                 } else {
</span><span class="cx">                         set query_path [::file join ${query_path} *]
</span><span class="lines">@@ -495,7 +495,7 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         # append the ports in old HEAD format.
</span><del>-        if { $name == &quot;&quot; } {
</del><ins>+        if { $name eq &quot;&quot; } {
</ins><span class="cx">                 set query_path [::file join ${macports::registry.path} receipts *]
</span><span class="cx">         } else {
</span><span class="cx">                 set query_path [::file join ${macports::registry.path} receipts ${name}-*]
</span><span class="lines">@@ -506,7 +506,7 @@
</span><span class="cx"> 
</span><span class="cx">             # Remark: these regexes do not always work.
</span><span class="cx">                    set theName &quot;&quot;
</span><del>-            if { $name == &quot;&quot; } {
</del><ins>+            if { $name eq &quot;&quot; } {
</ins><span class="cx">                         regexp {^(.*)-(.*)$} $theFileName match theName version
</span><span class="cx">             } else {
</span><span class="cx">                         regexp &quot;^($name)-(.*)\$&quot; $theFileName match theName version
</span><span class="lines">@@ -662,7 +662,7 @@
</span><span class="cx"> 
</span><span class="cx">         open_file_map
</span><span class="cx"> 
</span><del>-        if { [::file type $file] == &quot;link&quot; } {
</del><ins>+        if { [::file type $file] eq &quot;link&quot; } {
</ins><span class="cx">                 ui_debug &quot;Adding link to file_map: $file for: $port&quot;
</span><span class="cx">         } else {
</span><span class="cx">                 ui_debug &quot;Adding file to file_map: $file for: $port&quot;
</span><span class="lines">@@ -684,7 +684,7 @@
</span><span class="cx"> 
</span><span class="cx">         foreach f $files {
</span><span class="cx">                 set file [lindex $f 0]
</span><del>-                if { [::file type $file] == &quot;link&quot; } {
</del><ins>+                if { [::file type $file] eq &quot;link&quot; } {
</ins><span class="cx">                         ui_debug &quot;Adding link to file_map: $file for: $port&quot;
</span><span class="cx">                 } else {
</span><span class="cx">                         ui_debug &quot;Adding file to file_map: $file for: $port&quot;
</span><span class="lines">@@ -828,7 +828,7 @@
</span><span class="cx">     set dep_map $new_map
</span><span class="cx">     
</span><span class="cx">     set newlen [llength $dep_map]
</span><del>-    set diff [expr $oldlen - $newlen]
</del><ins>+    set diff [expr {$oldlen - $newlen}]
</ins><span class="cx">     ui_debug &quot;New dep_map has $newlen entries&quot;
</span><span class="cx">     ui_info &quot;Removed $diff duplicate entries from the dependency map&quot;
</span><span class="cx"> }
</span></span></pre></div>
<a id="branchesnewhelpsystembasesrcregistry20receipt_sqlitetcl"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/src/registry2.0/receipt_sqlite.tcl (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/registry2.0/receipt_sqlite.tcl        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/src/registry2.0/receipt_sqlite.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -44,7 +44,7 @@
</span><span class="cx"> 
</span><span class="cx"> # return list of active ports, or active version of port 'name' if specified
</span><span class="cx"> proc active {name} {
</span><del>-    if {$name != &quot;&quot;} {
</del><ins>+    if {$name ne &quot;&quot;} {
</ins><span class="cx">         set ports [registry::entry installed $name]
</span><span class="cx">     } else {
</span><span class="cx">         set ports [registry::entry installed]
</span><span class="lines">@@ -87,7 +87,7 @@
</span><span class="cx"> #
</span><span class="cx"> proc file_registered {file} {
</span><span class="cx">     set port [registry::entry owner $file]
</span><del>-        if {$port != &quot;&quot;} {
</del><ins>+        if {$port ne &quot;&quot;} {
</ins><span class="cx">                 return [$port name]
</span><span class="cx">         } else {
</span><span class="cx">                 return 0
</span><span class="lines">@@ -164,9 +164,9 @@
</span><span class="cx"> # version for example, so we don't attempt to split up the composite version
</span><span class="cx"> # into its components, we just compare the whole thing.
</span><span class="cx"> proc installed {{name &quot;&quot;} {version &quot;&quot;}} {
</span><del>-        if { $name == &quot;&quot; &amp;&amp; $version == &quot;&quot; } {
</del><ins>+        if { $name eq &quot;&quot; &amp;&amp; $version eq &quot;&quot; } {
</ins><span class="cx">             set ports [registry::entry imaged]
</span><del>-        } elseif { $name != &quot;&quot; &amp;&amp; $version == &quot;&quot;} {
</del><ins>+        } elseif { $name ne &quot;&quot; &amp;&amp; $version eq &quot;&quot;} {
</ins><span class="cx">             set ports [registry::entry imaged $name]
</span><span class="cx">         } else {
</span><span class="cx">             set ports {}
</span><span class="lines">@@ -197,7 +197,7 @@
</span><span class="cx">         set rlist [list]
</span><span class="cx">         set searchcmd &quot;registry::entry search&quot;
</span><span class="cx">     foreach key {name version revision} {
</span><del>-        if {[set $key] != &quot;&quot;} {
</del><ins>+        if {[set $key] ne &quot;&quot;} {
</ins><span class="cx">             append searchcmd &quot; $key [set $key]&quot;
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="lines">@@ -221,7 +221,7 @@
</span><span class="cx">         set rlist [list]
</span><span class="cx">         set searchcmd &quot;registry::entry search&quot;
</span><span class="cx">     foreach key {name version revision} {
</span><del>-        if {[set $key] != &quot;&quot;} {
</del><ins>+        if {[set $key] ne &quot;&quot;} {
</ins><span class="cx">             append searchcmd &quot; $key [set $key]&quot;
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="lines">@@ -251,9 +251,9 @@
</span><span class="cx">         $regref location $props(location)
</span><span class="cx">         $regref state $props(state)
</span><span class="cx">         $regref installtype $props(installtype)
</span><del>-        if {$props(installtype) == &quot;image&quot;} {
</del><ins>+        if {$props(installtype) eq &quot;image&quot;} {
</ins><span class="cx">             $regref map $props(imagefiles)
</span><del>-            if {$props(state) == &quot;installed&quot;} {
</del><ins>+            if {$props(state) eq &quot;installed&quot;} {
</ins><span class="cx">                 if {[llength $props(imagefiles)] != [llength $props(files)]} {
</span><span class="cx">                     # deal with this mess, just drop the extras...
</span><span class="cx">                     set i 0
</span><span class="cx">Property changes on: branches/new-help-system/base/src/registry2.0/receipt_sqlite.tcl
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svnmergeinfo"></a>
<div class="modfile"><h4>Modified: svn:mergeinfo</h4></div>
<span class="cx">/branches/gsoc09-logging/base/src/registry1.0/receipt_sqlite.tcl:51231-60371
</span><span class="cx">/branches/gsoc11-rev-upgrade/base/src/registry2.0/receipt_sqlite.tcl:78828-88375
</span><span class="cx">/branches/universal-sanity/base/src/registry1.0/receipt_sqlite.tcl:51872-52323
</span><span class="cx">/branches/variant-descs-14482/base/src/registry1.0/receipt_sqlite.tcl:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
</span><span class="cx">/trunk/base/src/registry2.0/receipt_sqlite.tcl:57889-90355
</span><span class="cx">/users/perry/base-bugs_and_notes/src/registry1.0/receipt_sqlite.tcl:45682-46060
</span><span class="cx">/users/perry/base-select/src/registry1.0/receipt_sqlite.tcl:44044-44692
</span><span class="cx">   + /branches/gsoc08-privileges/base/src/registry1.0/receipt_sqlite.tcl:37343-46937
</span><span class="cx">/branches/gsoc09-logging/base/src/registry1.0/receipt_sqlite.tcl:51231-60371
</span><span class="cx">/branches/gsoc11-rev-upgrade/base/src/registry2.0/receipt_sqlite.tcl:78828-88375
</span><span class="cx">/branches/gsoc13-tests/src/registry2.0/receipt_sqlite.tcl:106692-111324
</span><span class="cx">/branches/universal-sanity/base/src/registry1.0/receipt_sqlite.tcl:51872-52323
</span><span class="cx">/branches/variant-descs-14482/base/src/registry1.0/receipt_sqlite.tcl:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
</span><span class="cx">/trunk/base/src/registry2.0/receipt_sqlite.tcl:57889-117083
</span><span class="cx">/users/perry/base-bugs_and_notes/src/registry1.0/receipt_sqlite.tcl:45682-46060
</span><span class="cx">/users/perry/base-select/src/registry1.0/receipt_sqlite.tcl:44044-44692
</span><a id="branchesnewhelpsystembasesrcregistry20registrytcl"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/src/registry2.0/registry.tcl (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/registry2.0/registry.tcl        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/src/registry2.0/registry.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -156,10 +156,10 @@
</span><span class="cx">     }
</span><span class="cx">     
</span><span class="cx">     if { [llength $rlist] &lt; 1 } {
</span><del>-        if { $name == &quot;&quot; } {
</del><ins>+        if { $name eq &quot;&quot; } {
</ins><span class="cx">             return -code error &quot;Registry error: No ports registered as installed.&quot;
</span><span class="cx">         } else {
</span><del>-            if { $version == &quot;&quot; } {
</del><ins>+            if { $version eq &quot;&quot; } {
</ins><span class="cx">                 return -code error &quot;Registry error: $name not registered as installed.&quot;
</span><span class="cx">             } else {
</span><span class="cx">                 return -code error &quot;Registry error: $name $version not registered as installed.&quot;
</span><span class="lines">@@ -196,7 +196,7 @@
</span><span class="cx">     }
</span><span class="cx">         
</span><span class="cx">         if { [llength $rlist] &lt; 1 } {
</span><del>-                if { $name == &quot;&quot; } {
</del><ins>+                if { $name eq &quot;&quot; } {
</ins><span class="cx">                         return -code error &quot;Registry error: No ports registered as active.&quot;
</span><span class="cx">                 } else {
</span><span class="cx">                         return -code error &quot;Registry error: $name not registered as installed &amp; active.&quot;
</span><span class="lines">@@ -320,7 +320,7 @@
</span><span class="cx">     # (we won't store the md5 of the target of links since it's meaningless
</span><span class="cx">     # and $statvar(mode) tells us that links are links).
</span><span class="cx">     if {![catch {file lstat $fname statvar}]} {
</span><del>-        if {[::file isfile $fname] &amp;&amp; [::file type $fname] != &quot;link&quot;} {
</del><ins>+        if {[::file isfile $fname] &amp;&amp; [::file type $fname] ne &quot;link&quot;} {
</ins><span class="cx">             if {[catch {md5 file $fname} md5sum] == 0} {
</span><span class="cx">                 # Create a line that matches md5(1)'s output
</span><span class="cx">                 # for backwards compatibility
</span><span class="lines">@@ -346,7 +346,7 @@
</span><span class="cx"> 
</span><span class="cx">         set rval [list]
</span><span class="cx">         foreach file $flist {
</span><del>-                if {[string index $file 0] != &quot;/&quot;} {
</del><ins>+                if {[string index $file 0] ne &quot;/&quot;} {
</ins><span class="cx">                         set file [::file join $prefix $file]
</span><span class="cx">                 }
</span><span class="cx">                 lappend rval [fileinfo_for_file $file]
</span><span class="lines">@@ -405,10 +405,10 @@
</span><span class="cx">         set lockfd [::open $lockpath w]
</span><span class="cx">     }
</span><span class="cx">     if {[catch {flock $lockfd -exclusive -noblock} result]} {
</span><del>-        if {$result == &quot;EAGAIN&quot;} {
</del><ins>+        if {$result eq &quot;EAGAIN&quot;} {
</ins><span class="cx">             ui_msg &quot;Waiting for lock on $lockpath&quot;
</span><span class="cx">             flock $lockfd -exclusive
</span><del>-        } elseif {$result == &quot;EOPNOTSUPP&quot;} {
</del><ins>+        } elseif {$result eq &quot;EOPNOTSUPP&quot;} {
</ins><span class="cx">             # Locking not supported, just return
</span><span class="cx">             ui_debug &quot;flock not supported, not locking registry&quot;
</span><span class="cx">         } else {
</span><span class="lines">@@ -457,7 +457,7 @@
</span><span class="cx">         set installtype [receipt_flat::property_retrieve $iref installtype]
</span><span class="cx">         lappend proplist installtype $installtype
</span><span class="cx">         set location [receipt_flat::property_retrieve $iref location]
</span><del>-        if {$location == &quot;0&quot;} {
</del><ins>+        if {$location == 0} {
</ins><span class="cx">             set location [receipt_flat::property_retrieve $iref imagedir]
</span><span class="cx">         }
</span><span class="cx">         set contents [receipt_flat::property_retrieve $iref contents]
</span><span class="lines">@@ -466,7 +466,7 @@
</span><span class="cx">         foreach f $contents {
</span><span class="cx">             set fullpath [lindex $f 0]
</span><span class="cx">             # strip image dir from start
</span><del>-            if {[string range $fullpath 0 [expr $idlen - 1]] == $location} {
</del><ins>+            if {[string range $fullpath 0 [expr {$idlen - 1}]] == $location} {
</ins><span class="cx">                 set path [string range $fullpath $idlen [string length $fullpath]]
</span><span class="cx">             } else {
</span><span class="cx">                 set path $fullpath
</span></span></pre></div>
<a id="branchesnewhelpsystembasesrcregistry20registry_utiltcl"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/src/registry2.0/registry_util.tcl (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/registry2.0/registry_util.tcl        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/src/registry2.0/registry_util.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -63,14 +63,14 @@
</span><span class="cx"> ## @param [in] force if true, continue even if there are dependents
</span><span class="cx"> proc check_dependents {port force {action &quot;uninstall/deactivate&quot;}} {
</span><span class="cx">     global UI_PREFIX
</span><del>-    if {[$port state] == &quot;installed&quot; || [llength [registry::entry imaged [$port name]]] == 1} {
</del><ins>+    if {[$port state] eq &quot;installed&quot; || [llength [registry::entry imaged [$port name]]] == 1} {
</ins><span class="cx">         # Check if any installed ports depend on this one
</span><span class="cx">         set deplist [$port dependents]
</span><del>-        if {$action == &quot;deactivate&quot;} {
</del><ins>+        if {$action eq &quot;deactivate&quot;} {
</ins><span class="cx">             set active_deplist {}
</span><span class="cx">             # Check if any active ports depend on this one
</span><span class="cx">             foreach p $deplist {
</span><del>-                if {[$p state] == &quot;installed&quot;} {
</del><ins>+                if {[$p state] eq &quot;installed&quot;} {
</ins><span class="cx">                     lappend active_deplist $p
</span><span class="cx">                 }
</span><span class="cx">             }
</span><span class="lines">@@ -94,7 +94,7 @@
</span><span class="cx"> ## @return   true if successful, false otherwise
</span><span class="cx"> proc run_target {port target options} {
</span><span class="cx">     set portspec &quot;[$port name] @[$port version]_[$port revision][$port variants]&quot;
</span><del>-    if {[$port portfile] == &quot;&quot;} {
</del><ins>+    if {[$port portfile] eq &quot;&quot;} {
</ins><span class="cx">         ui_debug &quot;no portfile in registry for $portspec&quot;
</span><span class="cx">         return 0
</span><span class="cx">     }
</span><span class="lines">@@ -107,12 +107,12 @@
</span><span class="cx">             ui_warn &quot;Failed to execute portfile from registry for $portspec&quot;
</span><span class="cx">             switch $target {
</span><span class="cx">                 activate {
</span><del>-                    if {[$port state] == &quot;installed&quot;} {
</del><ins>+                    if {[$port state] eq &quot;installed&quot;} {
</ins><span class="cx">                         return 1
</span><span class="cx">                     }
</span><span class="cx">                 }
</span><span class="cx">                 deactivate {
</span><del>-                    if {[$port state] == &quot;imaged&quot;} {
</del><ins>+                    if {[$port state] eq &quot;imaged&quot;} {
</ins><span class="cx">                         return 1
</span><span class="cx">                     }
</span><span class="cx">                 }
</span><span class="lines">@@ -124,7 +124,7 @@
</span><span class="cx">             }
</span><span class="cx">         } else {
</span><span class="cx">             global macports::keeplogs
</span><del>-            if {(![info exists keeplogs] || !$keeplogs) &amp;&amp; $target != &quot;activate&quot;} {
</del><ins>+            if {(![info exists keeplogs] || !$keeplogs) &amp;&amp; $target ne &quot;activate&quot;} {
</ins><span class="cx">                 catch {mportexec $mport clean}
</span><span class="cx">             }
</span><span class="cx">             mportclose_installed $mport
</span></span></pre></div>
<a id="branchesnewhelpsystembasesrcregistry20testsentrytcl"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/src/registry2.0/tests/entry.tcl (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/registry2.0/tests/entry.tcl        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/src/registry2.0/tests/entry.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -7,11 +7,12 @@
</span><span class="cx">     load $pextlibname
</span><span class="cx"> 
</span><span class="cx">     # totally lame that file delete won't do it
</span><del>-        eval exec rm -f [glob -nocomplain test.db*]
</del><ins>+    eval exec rm -f [glob -nocomplain test.db*]
</ins><span class="cx"> 
</span><span class="cx">     # can't create registry in some brain-dead place or in protected place
</span><span class="cx">     test_throws {registry::open /some/brain/dead/place} registry::cannot-init
</span><del>-    test_throws {registry::open /etc/macports_test_prot~} registry::cannot-init
</del><ins>+    # This would actually work when testing with sudo :(
+    #test_throws {registry::open /etc/macports_test_prot~} registry::cannot-init
</ins><span class="cx"> 
</span><span class="cx">     # can't use registry before it's opened
</span><span class="cx">     test_throws {registry::write {}} registry::misuse
</span></span></pre></div>
<a id="branchesnewhelpsystembasesrcregistry20utilc"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/src/registry2.0/util.c (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/registry2.0/util.c        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/src/registry2.0/util.c        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -49,7 +49,7 @@
</span><span class="cx">  * objects of a similar nature.
</span><span class="cx">  */
</span><span class="cx"> char* unique_name(Tcl_Interp* interp, char* prefix, int* lower_bound) {
</span><del>-    int result_size = strlen(prefix) + TCL_INTEGER_SPACE + 1;
</del><ins>+    size_t result_size = strlen(prefix) + TCL_INTEGER_SPACE + 1;
</ins><span class="cx">     char* result = malloc(result_size);
</span><span class="cx">     Tcl_CmdInfo info;
</span><span class="cx">     int i;
</span><span class="lines">@@ -243,7 +243,7 @@
</span><span class="cx"> int recast(void* userdata, cast_function* fn, void* castcalldata,
</span><span class="cx">         free_function* del, void*** outv, void** inv, int inc,
</span><span class="cx">         reg_error* errPtr) {
</span><del>-    void** result = malloc(inc*sizeof(void*));
</del><ins>+    void** result = malloc((size_t)inc*sizeof(void*));
</ins><span class="cx">     int i;
</span><span class="cx">     if (!result) {
</span><span class="cx">         return 0;
</span></span></pre></div>
<a id="branchesnewhelpsystembasesrcupgrade_sources_conf_defaulttcl"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/src/upgrade_sources_conf_default.tcl (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/src/upgrade_sources_conf_default.tcl        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/src/upgrade_sources_conf_default.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -58,7 +58,7 @@
</span><span class="cx">                      }
</span><span class="cx">                   }
</span><span class="cx">                }
</span><del>-               if {$svnCmd == &quot;&quot;} {
</del><ins>+               if {$svnCmd eq &quot;&quot;} {
</ins><span class="cx">                   puts &quot;WARNING: Unable to check svn URL for '$filepath' because no svn command could be found; please manually verify $sourcesConf!&quot;
</span><span class="cx">                   continue
</span><span class="cx">                }
</span></span></pre></div>
<a id="branchesnewhelpsystembasetestsMakefile"></a>
<div class="delfile"><h4>Deleted: branches/new-help-system/base/tests/Makefile (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/tests/Makefile        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/tests/Makefile        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -1,86 +0,0 @@
</span><del>-include ../Mk/macports.autoconf.mk
-
-TESTS?=checksums-1 svn-and-patchsites envvariables site-tags trace universal universal-2 xcodeversion dependencies-c dependencies-d dependencies-e case-insensitive-deactivate variants statefile-version1 statefile-version1-outdated statefile-version2 statefile-version2-outdated statefile-version2-invalid statefile-unknown-version
-
-PWD=$(shell pwd)
-
-.PHONY: all clean install test PortIndex
-
-all::
-
-/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/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/macports/receipts/
-        mkdir -p /tmp/macports-tests/opt/local/var/macports/registry/
-        mkdir -p /tmp/macports-tests/opt/local/var/macports/build/
-        ln -s $(datadir)/macports /tmp/macports-tests/opt/local/share/
-        ln -s $(PWD)/test /tmp/macports-tests/ports/
-        cp sources.conf /tmp/macports-tests/opt/local/etc/macports/
-
-/tmp/macports-tests/ports/PortIndex: /tmp/macports-tests/opt/local/etc/macports/sources.conf PortIndex
-        cp PortIndex PortIndex.quick /tmp/macports-tests/ports/
-
-PortIndex:
-        $(bindir)/portindex
-
-clean::
-        rm -rf /tmp/macports-tests/
-        rm -f PortIndex PortIndex.quick
-        for testname in $(TESTS); do \
-                rm -f test/$$testname/{output,output.sed,difference,work}; \
-        done
-
-$(bindir)/port:
-        @echo &quot;Please install MacPorts before running these tests&quot;
-        @exit 1
-
-# Run all tests
-# Use TESTS to choose which tests to run
-# For example: make test TESTS=&quot;checkums-1 universal&quot;
-test:: clean /tmp/macports-tests/ports/PortIndex /tmp/macports-tests/opt/local/etc/macports/sources.conf
-        @num=0; \
-        success=0; \
-        for testname in $(TESTS); do\
-                subdir=test/$$testname; \
-                echo ===\&gt; test ${DIRPRFX}$$subdir; \
-                if [ -e $$subdir/Makefile ]; then \
-                        ( cd $$subdir &amp;&amp; \
-                                $(MAKE) DIRPRFX=${DIRPRFX}$$subdir/ PORTSRC=$(PWD)/test-macports.conf test) &amp;&amp; \
-                        success=$$(( success + 1 )); \
-                else \
-                        ( cd $$subdir &amp;&amp; \
-                                PORTSRC=$(PWD)/test-macports.conf $(bindir)/port clean &gt; /dev/null &amp;&amp; \
-                                PORTSRC=$(PWD)/test-macports.conf $(bindir)/port test &gt; output 2&gt;&amp;1 \
-                                        || ([ -e error_expected ] || (cat output; exit 1)) &amp;&amp; \
-                        sed -e &quot;s|${PWD}|PWD|g&quot; &lt; output &gt; output.sed &amp;&amp; \
-                        diff -u master output.sed 2&gt;&amp;1 | tee difference &amp;&amp; \
-                        if [ -s difference ]; then \
-                                exit 1; \
-                        else \
-                                rm -f difference output.sed; \
-                        fi) &amp;&amp; \
-                        success=$$(( success + 1 )); \
-                        if [ -n &quot;`PORTSRC=$(PWD)/test-macports.conf $(bindir)/port -q echo installed`&quot; ]; then \
-                            PORTSRC=$(PWD)/test-macports.conf $(bindir)/port -f clean --all installed &gt; /dev/null &amp;&amp; \
-                            PORTSRC=$(PWD)/test-macports.conf $(bindir)/port -f uninstall installed &gt; /dev/null; \
-                        fi; \
-                fi; \
-                num=$$(( num + 1 )); \
-        done; \
-        echo ===\&gt; $$success of $$num tests passed.
-        @rm -rf /tmp/macports-tests/
-        @rm -f PortIndex PortIndex.quick
-
-# Run specific test
-# Prepend the directory name with &quot;test-&quot; and use it as target
-# For example: make test-checksums-1
-test-%:
-        $(MAKE) TESTS=&quot;$(@:test-%=%)&quot; test
-
-install::
-
-distclean:: clean
</del></span></pre></div>
<a id="branchesnewhelpsystembasetestsMakefilefromrev117083trunkbasetestsMakefile"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/tests/Makefile (from rev 117083, trunk/base/tests/Makefile) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/tests/Makefile                                (rev 0)
+++ branches/new-help-system/base/tests/Makefile        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,14 @@
</span><ins>+include ../Mk/macports.autoconf.mk
+
+all:: ../Mk/macports.autoconf.mk
+
+install::
+
+# Run all regression tests
+# tclsh test.tcl -h for more options.
+test::
+        $(TCLSH) test.tcl -nocolor
+
+clean::
+
+distclean:: clean
</ins></span></pre></div>
<a id="branchesnewhelpsystembaseteststestcaseinsensitivedeactivateDESCRIPTIONfromrev117083trunkbaseteststestcaseinsensitivedeactivateDESCRIPTION"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/tests/test/case-insensitive-deactivate/DESCRIPTION (from rev 117083, trunk/base/tests/test/case-insensitive-deactivate/DESCRIPTION) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/tests/test/case-insensitive-deactivate/DESCRIPTION                                (rev 0)
+++ branches/new-help-system/base/tests/test/case-insensitive-deactivate/DESCRIPTION        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+This test checks for case-insensitive port names. From Portfile.in it
+generates a Portfile which is installed with a lowercase name (casesensitive)
+and uninstalled with a CamelCase name (CaseSensitivE). The install/uninstall
+is verified by the existance/absence of the '/tmp/macports-tests/opt/local/var/test/case'
+file.
+
+There are 2 test cases. One to install a port and the other to uninstall.
+
+See ticket #11759,
+https://trac.macports.org/ticket/11759
</ins></span></pre></div>
<a id="branchesnewhelpsystembaseteststestcaseinsensitivedeactivateMakefile"></a>
<div class="delfile"><h4>Deleted: branches/new-help-system/base/tests/test/case-insensitive-deactivate/Makefile (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/tests/test/case-insensitive-deactivate/Makefile        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/tests/test/case-insensitive-deactivate/Makefile        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -1,31 +0,0 @@
</span><del>-include ../../../Mk/macports.autoconf.mk
-
-# see test-macports.conf for the value of prefix
-TESTFILE=/tmp/macports-tests/opt/local/var/test/case
-TESTPORT1=casesensitive
-TESTPORT2=CaseSensitivE
-
-.PHONY: test
-
-$(bindir)/port:
-        @echo &quot;Please install MacPorts before running this test&quot;
-        @exit 1
-
-test:
-        @echo port install $(TESTPORT1)
-        @sed 's/@name@/$(TESTPORT1)/' Portfile.in &gt; Portfile
-        @PORTSRC=$(PORTSRC) $(bindir)/port install &gt; output 2&gt;&amp;1 || (cat output; exit 1)
-        @if [ ! -f $(TESTFILE) ]; then \
-                echo &quot;FAILED: File should exist after install: $(TESTFILE)&quot; &amp;&amp; exit 1; \
-        fi
-        @echo port uninstall $(TESTPORT2)
-        @sed 's/@name@/$(TESTPORT2)/' Portfile.in &gt; Portfile
-        @PORTSRC=$(PORTSRC) $(bindir)/port uninstall &gt; output 2&gt;&amp;1 || (cat output; exit 1)
-        @if [ -f $(TESTFILE) ]; then \
-                rm $(TESTFILE); \
-                echo &quot;FAILED: File should NOT exist after uninstall: $(TESTFILE)&quot; &amp;&amp; exit 1; \
-        else \
-                echo &quot;SUCCESS!&quot;; \
-        fi
-        rm Portfile
-        rm output
</del></span></pre></div>
<a id="branchesnewhelpsystembaseteststestcaseinsensitivedeactivatetesttclfromrev117083trunkbaseteststestcaseinsensitivedeactivatetesttcl"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/tests/test/case-insensitive-deactivate/test.tcl (from rev 117083, trunk/base/tests/test/case-insensitive-deactivate/test.tcl) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/tests/test/case-insensitive-deactivate/test.tcl                                (rev 0)
+++ branches/new-help-system/base/tests/test/case-insensitive-deactivate/test.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,61 @@
</span><ins>+package require tcltest 2
+namespace import tcltest::*
+
+source [file dirname $argv0]/../library.tcl
+
+makeFile &quot;&quot; &quot;Portfile&quot;
+makeFile &quot;&quot; $output_file
+makeDirectory $work_dir
+set path [file dirname [file normalize $argv0]]
+
+set testfile &quot;/tmp/macports-tests/opt/local/var/test/case&quot;
+set testport1 &quot;casesensitive&quot;
+set testport2 &quot;CaseSensitivE&quot;
+
+load_variables $path
+set_dir
+port_index
+
+proc test_exists {} {
+    global path testfile testport1
+
+    exec sed &quot;s/@name@/$testport1/&quot; $path/Portfile.in &gt; Portfile
+    port_install
+
+    if {[file exists $testfile]} {
+        return &quot;Port installed.&quot;
+    } else {
+        return &quot;File missing.&quot;
+    }
+}
+
+proc test_not_exists {} {
+    global path testfile testport2
+
+    exec sed &quot;s/@name@/$testport2/&quot; $path/Portfile.in &gt; Portfile
+    port_uninstall
+
+    if {[file exists $testfile]} {
+        return &quot;File still exists.&quot;
+    } else {
+        return &quot;Port uninstalled.&quot;
+    }
+}
+
+
+# Test cases.
+test file_installed {
+    Regression test for file installed correctly.
+} -body {
+    test_exists
+} -result &quot;Port installed.&quot;
+
+test file_uninstalled {
+    Regression test for file uninstalled correctly.
+} -body {
+    test_not_exists
+} -result &quot;Port uninstalled.&quot;
+
+
+cleanup
+cleanupTests
</ins></span></pre></div>
<a id="branchesnewhelpsystembaseteststestchecksums1DESCRIPTIONfromrev117083trunkbaseteststestchecksums1DESCRIPTION"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/tests/test/checksums-1/DESCRIPTION (from rev 117083, trunk/base/tests/test/checksums-1/DESCRIPTION) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/tests/test/checksums-1/DESCRIPTION                                (rev 0)
+++ branches/new-help-system/base/tests/test/checksums-1/DESCRIPTION        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,7 @@
</span><ins>+This test evaluates the checksum values of an empty file against the expected
+ones. These are taken from the output of the 'port -d test' command, by
+searching a line that beging with the string &quot;debug: calculated&quot;.
+
+There are 3 test cases, one for each checksum used. The port command must
+return the calculated checksums in debug mode, with the form: &quot;DEBUG:
+Calculated (_checksum-name_) &quot; for the test to work.
</ins></span></pre></div>
<a id="branchesnewhelpsystembaseteststestchecksums1Portfile"></a>
<div class="modfile"><h4>Modified: branches/new-help-system/base/tests/test/checksums-1/Portfile (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/tests/test/checksums-1/Portfile        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/tests/test/checksums-1/Portfile        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -32,4 +32,4 @@
</span><span class="cx"> 
</span><span class="cx"> test {
</span><span class="cx">         # test is actually running checksum target
</span><del>-}
</del><span class="cx">\ No newline at end of file
</span><ins>+}
</ins></span></pre></div>
<a id="branchesnewhelpsystembaseteststestchecksums1master"></a>
<div class="delfile"><h4>Deleted: branches/new-help-system/base/tests/test/checksums-1/master (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/tests/test/checksums-1/master        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/tests/test/checksums-1/master        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -1,6 +0,0 @@
</span><del>----&gt;  Fetching distfiles for checksum
----&gt;  Verifying checksums for checksum
----&gt;  Extracting checksum
----&gt;  Configuring checksum
----&gt;  Building checksum
----&gt;  Testing checksum
</del></span></pre></div>
<a id="branchesnewhelpsystembaseteststestchecksums1testtclfromrev117083trunkbaseteststestchecksums1testtcl"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/tests/test/checksums-1/test.tcl (from rev 117083, trunk/base/tests/test/checksums-1/test.tcl) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/tests/test/checksums-1/test.tcl                                (rev 0)
+++ branches/new-help-system/base/tests/test/checksums-1/test.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,46 @@
</span><ins>+package require tcltest 2
+namespace import tcltest::*
+
+source [file dirname $argv0]/../library.tcl
+
+makeFile &quot;&quot; $output_file
+makeDirectory $work_dir
+set path [file dirname [file normalize $argv0]]
+
+initial_setup
+
+proc get_checksum {type} {
+    global path output_file
+
+    append string &quot;debug: calculated (&quot; $type &quot;)*&quot;
+    set line [get_line $path/$output_file $string]
+    set result [lrange [split $line &quot; &quot;] 4 4]
+
+    return $result
+}
+
+
+# Test cases
+test md5_checksum {
+    Regression test for MD5 Checksum.
+} -body {
+    get_checksum md5
+} -result &quot;d41d8cd98f00b204e9800998ecf8427e&quot;
+
+
+test sha1_checksum {
+    Regression test for SHA1 Checksum.
+} -body {
+    get_checksum sha1
+} -result &quot;da39a3ee5e6b4b0d3255bfef95601890afd80709&quot;
+
+
+test rmd160_checksum {
+    Regression test for RMD160 Checksum.
+} -body {
+    get_checksum rmd160
+} -result &quot;9c1185a5c5e9fc54612808977ee8f548b2258d31&quot;
+
+
+cleanup
+cleanupTests
</ins></span></pre></div>
<a id="branchesnewhelpsystembaseteststestdependenciesaDESCRIPTIONfromrev117083trunkbaseteststestdependenciesaDESCRIPTION"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/tests/test/dependencies-a/DESCRIPTION (from rev 117083, trunk/base/tests/test/dependencies-a/DESCRIPTION) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/tests/test/dependencies-a/DESCRIPTION                                (rev 0)
+++ branches/new-help-system/base/tests/test/dependencies-a/DESCRIPTION        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+This test makes sure a dependency added in a variant block
+(this is selected as default variant) is considered.
+
+There is 1 test case.
</ins></span></pre></div>
<a id="branchesnewhelpsystembaseteststestdependenciesatesttclfromrev117083trunkbaseteststestdependenciesatesttcl"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/tests/test/dependencies-a/test.tcl (from rev 117083, trunk/base/tests/test/dependencies-a/test.tcl) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/tests/test/dependencies-a/test.tcl                                (rev 0)
+++ branches/new-help-system/base/tests/test/dependencies-a/test.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,27 @@
</span><ins>+package require tcltest 2
+namespace import tcltest::*
+
+source [file dirname $argv0]/../library.tcl
+
+makeFile &quot;&quot; $output_file
+makeDirectory $work_dir
+set path [file dirname [file normalize $argv0]]
+
+proc dep-a {} {
+    global path output_file
+
+    initial_setup
+
+    set err &quot;error*&quot;
+    set line [get_line $output_file $err]
+    return $line
+}
+
+test dependencies-a {
+    Regression test for dependencies-a.
+} -body {
+    dep-a
+} -result -1
+
+cleanup
+cleanupTests
</ins></span></pre></div>
<a id="branchesnewhelpsystembaseteststestdependenciesbDESCRIPTIONfromrev117083trunkbaseteststestdependenciesbDESCRIPTION"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/tests/test/dependencies-b/DESCRIPTION (from rev 117083, trunk/base/tests/test/dependencies-b/DESCRIPTION) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/tests/test/dependencies-b/DESCRIPTION                                (rev 0)
+++ branches/new-help-system/base/tests/test/dependencies-b/DESCRIPTION        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+This test does nothing. (or: ensures a port without dependencies really
+doesn't have any)
+
+There is 1 test case.
</ins></span></pre></div>
<a id="branchesnewhelpsystembaseteststestdependenciesbtesttclfromrev117083trunkbaseteststestdependenciesbtesttcl"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/tests/test/dependencies-b/test.tcl (from rev 117083, trunk/base/tests/test/dependencies-b/test.tcl) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/tests/test/dependencies-b/test.tcl                                (rev 0)
+++ branches/new-help-system/base/tests/test/dependencies-b/test.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,28 @@
</span><ins>+package require tcltest 2
+namespace import tcltest::*
+
+source [file dirname $argv0]/../library.tcl
+
+makeFile &quot;&quot; $output_file
+makeDirectory $work_dir
+set path [file dirname [file normalize $argv0]]
+
+proc dep-b {} {
+    global path output_file
+
+    initial_setup
+
+    set err &quot;error*&quot;
+    set line [get_line $output_file $err]
+    return $line
+}
+
+test dependencies-b {
+    Regression test for dependencies-b.
+} -body {
+    dep-b
+} -result -1
+
+
+cleanup
+cleanupTests
</ins></span></pre></div>
<a id="branchesnewhelpsystembaseteststestdependenciescDESCRIPTIONfromrev117083trunkbaseteststestdependenciescDESCRIPTION"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/tests/test/dependencies-c/DESCRIPTION (from rev 117083, trunk/base/tests/test/dependencies-c/DESCRIPTION) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/tests/test/dependencies-c/DESCRIPTION                                (rev 0)
+++ branches/new-help-system/base/tests/test/dependencies-c/DESCRIPTION        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+This test does the same as dependencies-a, but due to the transitive
+nature of dependencies, also tests what dependencies-a has already tested.
+
+There is 1 test case.
</ins></span></pre></div>
<a id="branchesnewhelpsystembaseteststestdependenciescmaster"></a>
<div class="delfile"><h4>Deleted: branches/new-help-system/base/tests/test/dependencies-c/master (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/tests/test/dependencies-c/master        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/tests/test/dependencies-c/master        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -1,26 +0,0 @@
</span><del>----&gt;  Computing dependencies for dependencies-c
----&gt;  Dependencies to be installed: dependencies-a dependencies-b
----&gt;  Fetching distfiles for dependencies-b
----&gt;  Verifying checksums for dependencies-b
----&gt;  Extracting dependencies-b
----&gt;  Configuring dependencies-b
----&gt;  Building dependencies-b
----&gt;  Staging dependencies-b into destroot
----&gt;  Installing dependencies-b @1_0
----&gt;  Activating dependencies-b @1_0
----&gt;  Cleaning dependencies-b
----&gt;  Fetching distfiles for dependencies-a
----&gt;  Verifying checksums for dependencies-a
----&gt;  Extracting dependencies-a
----&gt;  Configuring dependencies-a
----&gt;  Building dependencies-a
----&gt;  Staging dependencies-a into destroot
----&gt;  Installing dependencies-a @1_0+i_want_b
----&gt;  Activating dependencies-a @1_0+i_want_b
----&gt;  Cleaning dependencies-a
----&gt;  Fetching distfiles for dependencies-c
----&gt;  Verifying checksums for dependencies-c
----&gt;  Extracting dependencies-c
----&gt;  Configuring dependencies-c
----&gt;  Building dependencies-c
----&gt;  Testing dependencies-c
</del></span></pre></div>
<a id="branchesnewhelpsystembaseteststestdependenciesctesttclfromrev117083trunkbaseteststestdependenciesctesttcl"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/tests/test/dependencies-c/test.tcl (from rev 117083, trunk/base/tests/test/dependencies-c/test.tcl) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/tests/test/dependencies-c/test.tcl                                (rev 0)
+++ branches/new-help-system/base/tests/test/dependencies-c/test.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,28 @@
</span><ins>+package require tcltest 2
+namespace import tcltest::*
+
+source [file dirname $argv0]/../library.tcl
+
+makeFile &quot;&quot; $output_file
+makeDirectory $work_dir
+set path [file dirname [file normalize $argv0]]
+
+proc dep-c {} {
+    global path output_file
+
+    initial_setup
+
+    set err &quot;error*&quot;
+    set line [get_line $output_file $err]
+    return $line
+}
+
+test dependencies-c {
+    Regression test for dependencies-c.
+} -body {
+    dep-c
+} -result -1
+
+
+cleanup
+cleanupTests
</ins></span></pre></div>
<a id="branchesnewhelpsystembaseteststestdependenciesdDESCRIPTIONfromrev117083trunkbaseteststestdependenciesdDESCRIPTION"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/tests/test/dependencies-d/DESCRIPTION (from rev 117083, trunk/base/tests/test/dependencies-d/DESCRIPTION) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/tests/test/dependencies-d/DESCRIPTION                                (rev 0)
+++ branches/new-help-system/base/tests/test/dependencies-d/DESCRIPTION        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+This test checks for an invalid dependency specification. The &quot;depends&quot; option
+tested in this test apparently was never implemented.
+
+There is 1 test case.
</ins></span></pre></div>
<a id="branchesnewhelpsystembaseteststestdependenciesdmaster"></a>
<div class="delfile"><h4>Deleted: branches/new-help-system/base/tests/test/dependencies-d/master (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/tests/test/dependencies-d/master        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/tests/test/dependencies-d/master        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -1,28 +0,0 @@
</span><del>-Warning: depends option is not handled yet
-Warning: depends option is not handled yet
----&gt;  Computing dependencies for dependencies-d
----&gt;  Dependencies to be installed: dependencies-a dependencies-b
----&gt;  Fetching distfiles for dependencies-b
----&gt;  Verifying checksums for dependencies-b
----&gt;  Extracting dependencies-b
----&gt;  Configuring dependencies-b
----&gt;  Building dependencies-b
----&gt;  Staging dependencies-b into destroot
----&gt;  Installing dependencies-b @1_0
----&gt;  Activating dependencies-b @1_0
----&gt;  Cleaning dependencies-b
----&gt;  Fetching distfiles for dependencies-a
----&gt;  Verifying checksums for dependencies-a
----&gt;  Extracting dependencies-a
----&gt;  Configuring dependencies-a
----&gt;  Building dependencies-a
----&gt;  Staging dependencies-a into destroot
----&gt;  Installing dependencies-a @1_0+i_want_b
----&gt;  Activating dependencies-a @1_0+i_want_b
----&gt;  Cleaning dependencies-a
----&gt;  Fetching distfiles for dependencies-d
----&gt;  Verifying checksums for dependencies-d
----&gt;  Extracting dependencies-d
----&gt;  Configuring dependencies-d
----&gt;  Building dependencies-d
----&gt;  Testing dependencies-d
</del></span></pre></div>
<a id="branchesnewhelpsystembaseteststestdependenciesdtesttclfromrev117083trunkbaseteststestdependenciesdtesttcl"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/tests/test/dependencies-d/test.tcl (from rev 117083, trunk/base/tests/test/dependencies-d/test.tcl) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/tests/test/dependencies-d/test.tcl                                (rev 0)
+++ branches/new-help-system/base/tests/test/dependencies-d/test.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,28 @@
</span><ins>+package require tcltest 2
+namespace import tcltest::*
+
+source [file dirname $argv0]/../library.tcl
+
+makeFile &quot;&quot; $output_file
+makeDirectory $work_dir
+set path [file dirname [file normalize $argv0]]
+
+proc dep-d {} {
+    global path output_file
+
+    initial_setup
+
+    set err &quot;error*&quot;
+    set line [get_line $output_file $err]
+    return $line
+}
+
+test dependencies-d {
+    Regression test for dependencies-d.
+} -body {
+    dep-d
+} -result -1
+
+
+cleanup
+cleanupTests
</ins></span></pre></div>
<a id="branchesnewhelpsystembaseteststestdependencieseDESCRIPTIONfromrev117083trunkbaseteststestdependencieseDESCRIPTION"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/tests/test/dependencies-e/DESCRIPTION (from rev 117083, trunk/base/tests/test/dependencies-e/DESCRIPTION) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/tests/test/dependencies-e/DESCRIPTION                                (rev 0)
+++ branches/new-help-system/base/tests/test/dependencies-e/DESCRIPTION        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+This test checks whether unknown dependencies correctly fail. There should be
+an error saying that the requested dependencies do not exist.
+
+There is 1 test case.
</ins></span></pre></div>
<a id="branchesnewhelpsystembaseteststestdependencieseerror_expected"></a>
<div class="delfile"><h4>Deleted: branches/new-help-system/base/tests/test/dependencies-e/error_expected ( => )</h4>
<pre class="diff"><span>
<span class="info">Deleted: branches/new-help-system/base/tests/test/dependencies-e/master
===================================================================
</span><del>--- branches/new-help-system/base/tests/test/dependencies-e/master        2014-02-15 12:19:10 UTC (rev 117083)
</del><ins>+++ branches/new-help-system/base/tests/test/dependencies-e/master        2014-02-15 14:35:04 UTC (rev 117084)
</ins><span class="lines">@@ -1,5 +0,0 @@
</span><del>----&gt;  Computing dependencies for dependencies-e
-Error: Dependency 'docbook-xml-4.1.2' not found.
-To report a bug, follow the instructions in the guide:
-    http://guide.macports.org/#project.tickets
-Error: Processing of port dependencies-e failed
</del></span></pre></div>
<a id="branchesnewhelpsystembaseteststestdependenciesetesttclfromrev117083trunkbaseteststestdependenciesetesttcl"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/tests/test/dependencies-e/test.tcl (from rev 117083, trunk/base/tests/test/dependencies-e/test.tcl) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/tests/test/dependencies-e/test.tcl                                (rev 0)
+++ branches/new-help-system/base/tests/test/dependencies-e/test.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,28 @@
</span><ins>+package require tcltest 2
+namespace import tcltest::*
+
+source [file dirname $argv0]/../library.tcl
+
+makeFile &quot;&quot; $output_file
+makeDirectory $work_dir
+set path [file dirname [file normalize $argv0]]
+
+proc dep-e {} {
+    global path output_file
+
+    initial_setup
+
+    set err &quot;error: dependency 'docbook-xml-4.1.2' not found*&quot;
+    set line [get_line $output_file $err]
+    return $line
+}
+
+test dependencies-e {
+    Regression test for dependencies-e.
+} -body {
+    dep-e
+} -result &quot;error: dependency 'docbook-xml-4.1.2' not found.&quot;
+
+
+cleanup
+cleanupTests
</ins></span></pre></div>
<a id="branchesnewhelpsystembaseteststestenvvariablesDESCRIPTIONfromrev117083trunkbaseteststestenvvariablesDESCRIPTION"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/tests/test/envvariables/DESCRIPTION (from rev 117083, trunk/base/tests/test/envvariables/DESCRIPTION) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/tests/test/envvariables/DESCRIPTION                                (rev 0)
+++ branches/new-help-system/base/tests/test/envvariables/DESCRIPTION        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+This test ensures that variables set in the environment are available in the
+Portfile. The test runs an 'exec sh' command that exports two variables (ENVA
+and ENVB) and checks weather they get in the output file or not.
</ins></span></pre></div>
<a id="branchesnewhelpsystembaseteststestenvvariablesMakefile"></a>
<div class="delfile"><h4>Deleted: branches/new-help-system/base/tests/test/envvariables/Makefile (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/tests/test/envvariables/Makefile        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/tests/test/envvariables/Makefile        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -1,18 +0,0 @@
</span><del>-include ../../../Mk/macports.autoconf.mk
-
-.PHONY: test
-
-$(bindir)/port:
-        @echo &quot;Please install MacPorts before running this test&quot;
-        @exit 1
-
-test:
-        @PORTSRC=$(PORTSRC) $(bindir)/port clean &gt; /dev/null
-        @sh -c &quot;export ENVA=A ; export ENVB=B; \
-                export PORTSRC=$(PORTSRC); $(bindir)/port test&quot; &gt; output 2&gt;&amp;1 || (cat output; exit 1)
-        @diff -u master output 2&gt;&amp;1 | tee difference
-        @if [ -s difference ]; then \
-                exit 1; \
-        else \
-                rm -f difference; \
-        fi
</del></span></pre></div>
<a id="branchesnewhelpsystembaseteststestenvvariablesmaster"></a>
<div class="delfile"><h4>Deleted: branches/new-help-system/base/tests/test/envvariables/master (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/tests/test/envvariables/master        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/tests/test/envvariables/master        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -1,8 +0,0 @@
</span><del>----&gt;  Fetching distfiles for envvariables
----&gt;  Verifying checksums for envvariables
----&gt;  Extracting envvariables
----&gt;  Configuring envvariables
----&gt;  Building envvariables
----&gt;  Testing envvariables
-A
-B
</del></span></pre></div>
<a id="branchesnewhelpsystembaseteststestenvvariablestesttclfromrev117083trunkbaseteststestenvvariablestesttcl"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/tests/test/envvariables/test.tcl (from rev 117083, trunk/base/tests/test/envvariables/test.tcl) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/tests/test/envvariables/test.tcl                                (rev 0)
+++ branches/new-help-system/base/tests/test/envvariables/test.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,39 @@
</span><ins>+package require tcltest 2
+namespace import tcltest::*
+
+source [file dirname $argv0]/../library.tcl
+
+makeFile &quot;&quot; $output_file
+makeDirectory $work_dir
+set path [file dirname [file normalize $argv0]]
+
+
+# Initial setup
+load_variables $path
+set_dir
+port_index
+port_clean $path
+
+proc envvar_test {} {
+    global output_file path portsrc bindir
+
+    # Build helping string
+    set string &quot;export ENVA=A; export ENVB=B; &quot;
+    append string &quot;export PORTSRC=${portsrc}; &quot;
+    append string &quot;${bindir}/port test&quot;
+
+    exec sh -c $string &gt; output
+    set line [get_line $path/$output_file &quot;a&quot;]
+    set line2 [get_line $path/$output_file &quot;b&quot;]
+    return $line$line2
+}
+
+test envvariables {
+    Regression test for Environment Variables.
+} -body {
+    envvar_test
+} -result &quot;ab&quot;
+
+
+cleanup
+cleanupTests
</ins></span></pre></div>
<a id="branchesnewhelpsystembaseteststestlibrarytclfromrev117083trunkbaseteststestlibrarytcl"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/tests/test/library.tcl (from rev 117083, trunk/base/tests/test/library.tcl) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/tests/test/library.tcl                                (rev 0)
+++ branches/new-help-system/base/tests/test/library.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,172 @@
</span><ins>+set autoconf [file dirname $argv0]/../../../Mk/macports.autoconf.mk
+eval ::tcltest::configure $::argv
+
+set output_file &quot;output&quot;
+set work_dir &quot;work&quot;
+
+# Set of procs used for testing.
+
+# Sets $bindir variable from macports.autoconf.mk
+# autogenerated file.
+proc load_variables {pwd} {
+    global autoconf bindir datadir portsrc cpwd
+
+    if { ![file exists $autoconf] } {
+        puts &quot;ERROR: $autoconf does not exist.&quot;
+        exit 1
+    }
+
+    set cpwd [file dirname [file dirname $pwd]]
+
+    set line [get_line $autoconf &quot;prefix*&quot;]
+    set prefix [lrange [split $line &quot; &quot;] 1 1]
+
+    set line [get_line $autoconf &quot;bindir*&quot;]
+    set bin [lrange [split $line &quot;/&quot;] 1 1]
+
+    set bindir ${prefix}/${bin}
+    set datadir ${prefix}/share
+    set portsrc ${cpwd}/test-macports.conf
+
+}
+
+proc cleanup {} {
+    global cpwd
+
+    file delete -force /tmp/macports-tests
+    file delete -force ${cpwd}/PortIndex ${cpwd}/PortIndex.quick
+}
+
+# Sets initial directories
+proc set_dir {} {
+    global datadir cpwd
+
+    cleanup
+
+    file mkdir /tmp/macports-tests/ports \
+               /tmp/macports-tests/opt/local/etc/macports \
+               /tmp/macports-tests/opt/local/share \
+               /tmp/macports-tests/opt/local/var/macports/receipts \
+               /tmp/macports-tests/opt/local/var/macports/registry \
+               /tmp/macports-tests/opt/local/var/macports/build
+
+    file link -symbolic /tmp/macports-tests/opt/local/share/macports $datadir/macports
+    file link -symbolic /tmp/macports-tests/ports/test $cpwd/test
+}
+
+# Run portindex
+proc port_index {} {
+    global bindir datadir cpwd
+
+    # Move up 2 level to run portindex.
+    set path [pwd]
+    cd ../..
+    # Avoid warning about ports tree being old
+    exec sh -c {touch */*/Portfile}
+
+    exec ${bindir}/portindex 2&gt;@1
+
+    file copy ${cpwd}/sources.conf /tmp/macports-tests/opt/local/etc/macports/
+    file copy ${cpwd}/PortIndex ${cpwd}/PortIndex.quick /tmp/macports-tests/ports/
+
+    cd $path
+}
+
+# Executes port clean.
+proc port_clean {pwd} {
+    global bindir datadir portsrc
+
+    set back [pwd]
+    cd $pwd
+
+    catch {exec env PORTSRC=${portsrc} ${bindir}/port clean 2&gt;@1}
+    cd $back
+}
+
+# Runs the portfile.
+proc port_run {pwd} {
+    global bindir datadir portsrc
+
+    set back [pwd]
+    cd $pwd
+
+    set result [catch {exec env PORTSRC=${portsrc} ${bindir}/port -d test &gt;&amp;output} ]
+    cd $back
+    return $result
+}
+
+# Runs port trace.
+proc port_trace {pwd} {
+    global bindir datadir portsrc
+
+    set back [pwd]
+    cd $pwd
+
+    set result [catch {exec env PORTSRC=${portsrc} ${bindir}/port -t test &gt;&amp;output 2&gt;@1} ]
+    cd $back
+    return $result
+}
+
+# Installs new portfile.
+proc port_install {} {
+    global bindir portsrc
+
+    set result [catch {exec env PORTSRC=${portsrc} ${bindir}/port install &gt; output 2&gt;@1} ]
+}
+
+# Run configure command.
+proc port_config {pwd} {
+    global path bindir portsrc
+
+    set result [catch {exec env PORTSRC=${portsrc} ${bindir}/port configure 2&gt;@1} ]
+}
+
+# Run desroot command.
+proc port_desroot {pwd} {
+    global path bindir portsrc work_dir output_file
+
+    file copy -force ${path}/statefile ${work_dir}/.macports.statefile-unknown-version.state
+    if { [exec id -u] == 0 } {
+        exec chown macports ${work_dir}/.macports.statefile-unknown-version.state
+    }
+    set result [catch {exec env PORTSRC=${portsrc} ${bindir}/port destroot &gt;$output_file 2&gt;@1} ]
+}
+
+# Uninstalls portfile.
+proc port_uninstall {} {
+    global bindir portsrc
+
+    set result [catch {exec env PORTSRC=${portsrc} ${bindir}/port uninstall &gt; output 2&gt;@1} ]
+}
+
+# Returns the line containint a given string
+# from a given file, or -1 if nothing is found.
+proc get_line {filename lookup} {
+    set fp [open $filename r]
+
+    while {[gets $fp line] != -1} {
+        set line [string tolower $line]
+
+        if {[string match $lookup $line] != 0} {
+            close $fp
+            return $line
+        }
+    }
+    return -1
+}
+
+# This proc contains all the steps necesary
+# to install a port and save the output to a file.
+# Needed for the majority of regression tests.
+proc initial_setup {} {
+    global output_file work_dir path
+
+    makeFile &quot;&quot; $output_file
+    makeDirectory $work_dir
+
+    load_variables $path
+    set_dir
+    port_index
+    port_clean $path
+    port_run $path
+}
</ins></span></pre></div>
<a id="branchesnewhelpsystembaseteststestsitetagsDESCRIPTIONfromrev117083trunkbaseteststestsitetagsDESCRIPTION"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/tests/test/site-tags/DESCRIPTION (from rev 117083, trunk/base/tests/test/site-tags/DESCRIPTION) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/tests/test/site-tags/DESCRIPTION                                (rev 0)
+++ branches/new-help-system/base/tests/test/site-tags/DESCRIPTION        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+This test checks if MacPorts can fetch files from different URLs for the
+specified tags.
+
+There is 1 test case that looks for errors in the output file.
</ins></span></pre></div>
<a id="branchesnewhelpsystembaseteststestsitetagsmaster"></a>
<div class="delfile"><h4>Deleted: branches/new-help-system/base/tests/test/site-tags/master (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/tests/test/site-tags/master        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/tests/test/site-tags/master        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -1,8 +0,0 @@
</span><del>----&gt;  Fetching distfiles for site-tags
----&gt;  Attempting to fetch app-bm.tar.gz from http://www.douglas.stebila.ca/files/code/vim/app/
----&gt;  Attempting to fetch doc.tar.gz from http://www.douglas.stebila.ca/files/code/vim/doc/
----&gt;  Verifying checksums for site-tags
----&gt;  Extracting site-tags
----&gt;  Configuring site-tags
----&gt;  Building site-tags
----&gt;  Testing site-tags
</del></span></pre></div>
<a id="branchesnewhelpsystembaseteststestsitetagstesttclfromrev117083trunkbaseteststestsitetagstesttcl"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/tests/test/site-tags/test.tcl (from rev 117083, trunk/base/tests/test/site-tags/test.tcl) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/tests/test/site-tags/test.tcl                                (rev 0)
+++ branches/new-help-system/base/tests/test/site-tags/test.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,32 @@
</span><ins>+package require tcltest 2
+namespace import tcltest::*
+
+source [file dirname $argv0]/../library.tcl
+
+makeFile &quot;&quot; $output_file
+makeDirectory $work_dir
+set path [file dirname [file normalize $argv0]]
+
+proc sitetag {} {
+    global output_file path
+
+    initial_setup
+
+    set err &quot;error*&quot;
+    set line [get_line $output_file $err]
+    if {$line == -1} {
+        return &quot;No errors found.&quot;
+    } else {
+        return &quot;Errors found in the output file.&quot;
+    }
+}
+
+test site-tags {
+    Regression test for site-tags.
+} -body {
+    sitetag
+} -result &quot;No errors found.&quot;
+
+
+cleanup
+cleanupTests
</ins></span></pre></div>
<a id="branchesnewhelpsystembaseteststeststatefileunknownversionDESCRIPTIONfromrev117083trunkbaseteststeststatefileunknownversionDESCRIPTION"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/tests/test/statefile-unknown-version/DESCRIPTION (from rev 117083, trunk/base/tests/test/statefile-unknown-version/DESCRIPTION) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/tests/test/statefile-unknown-version/DESCRIPTION                                (rev 0)
+++ branches/new-help-system/base/tests/test/statefile-unknown-version/DESCRIPTION        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,5 @@
</span><ins>+This test checks that version 3 is not accepted. MacPorts keeps track 
+of the build process (and which steps have been completed) in a statefile.
+
+There are 2 test cases, one for the warnings and another that checks for the
+staging into destroot.
</ins></span></pre></div>
<a id="branchesnewhelpsystembaseteststeststatefileunknownversionMakefile"></a>
<div class="delfile"><h4>Deleted: branches/new-help-system/base/tests/test/statefile-unknown-version/Makefile (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/tests/test/statefile-unknown-version/Makefile        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/tests/test/statefile-unknown-version/Makefile        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -1,15 +0,0 @@
</span><del>-include ../../../Mk/macports.autoconf.mk
-
-.PHONY: test
-
-$(bindir)/port:
-        @echo &quot;Please install MacPorts before running this test&quot;
-        @exit 1
-
-test:
-        @PORTSRC=$(PORTSRC) $(bindir)/port configure &gt;/dev/null 2&gt;&amp;1
-        @cp statefile work/.macports.statefile-unknown-version.state
-        @PORTSRC=$(PORTSRC) $(bindir)/port destroot &gt;output 2&gt;&amp;1 || (cat output; exit 1)
-        @diff -u master output || (echo &quot;statfile version 3 was accepted, although it shouldn't (this is a hacky test, which might also fail if you change the number of pahses)&quot;; exit 1)
-        @PORTSRC=$(PORTSRC) $(bindir)/port clean &gt;/dev/null 2&gt;&amp;1
-        @rm output
</del></span></pre></div>
<a id="branchesnewhelpsystembaseteststeststatefileunknownversionmaster"></a>
<div class="delfile"><h4>Deleted: branches/new-help-system/base/tests/test/statefile-unknown-version/master (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/tests/test/statefile-unknown-version/master        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/tests/test/statefile-unknown-version/master        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -1,18 +0,0 @@
</span><del>-Warning: Unsupported statefile version '3'
-Warning: Please run 'port selfupdate' to update to the latest version of MacPorts
-Warning: Unsupported statefile version '3'
-Warning: Please run 'port selfupdate' to update to the latest version of MacPorts
-Warning: Unsupported statefile version '3'
-Warning: Please run 'port selfupdate' to update to the latest version of MacPorts
-Warning: Unsupported statefile version '3'
-Warning: Please run 'port selfupdate' to update to the latest version of MacPorts
-Warning: Unsupported statefile version '3'
-Warning: Please run 'port selfupdate' to update to the latest version of MacPorts
-Warning: Unsupported statefile version '3'
-Warning: Please run 'port selfupdate' to update to the latest version of MacPorts
-Warning: Unsupported statefile version '3'
-Warning: Please run 'port selfupdate' to update to the latest version of MacPorts
----&gt;  Building statefile-unknown-version
-Warning: Unsupported statefile version '3'
-Warning: Please run 'port selfupdate' to update to the latest version of MacPorts
----&gt;  Staging statefile-unknown-version into destroot
</del></span></pre></div>
<a id="branchesnewhelpsystembaseteststeststatefileunknownversiontesttclfromrev117083trunkbaseteststeststatefileunknownversiontesttcl"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/tests/test/statefile-unknown-version/test.tcl (from rev 117083, trunk/base/tests/test/statefile-unknown-version/test.tcl) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/tests/test/statefile-unknown-version/test.tcl                                (rev 0)
+++ branches/new-help-system/base/tests/test/statefile-unknown-version/test.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,45 @@
</span><ins>+package require tcltest 2
+namespace import tcltest::*
+
+source [file dirname $argv0]/../library.tcl
+
+makeFile &quot;&quot; $output_file
+set path [file dirname [file normalize $argv0]]
+
+# Initial setup
+load_variables $path
+set_dir
+port_index
+port_config $path
+port_desroot $path
+port_clean $path
+
+proc state_unknown {warn} {
+    global path output_file
+
+    if {$warn ne &quot;no&quot;} {
+        set msg &quot;warning*&quot;
+    } else {
+        set msg &quot;*staging*destroot*&quot;
+    }
+
+    set line [get_line $path/$output_file $msg]
+    return $line
+}
+
+test warning_check {
+    Regression test for statefile-unknown warnings.
+} -body {
+    state_unknown yes
+} -result &quot;warning: unsupported statefile version '3'&quot;
+
+test output_check {
+    Regression test for statefile-unknown output.
+} -body {
+    state_unknown no
+} -result &quot;---&gt;  staging statefile-unknown-version into destroot&quot;
+
+removeFile $work_dir
+
+cleanup
+cleanupTests
</ins></span></pre></div>
<a id="branchesnewhelpsystembaseteststeststatefileversion1DESCRIPTIONfromrev117083trunkbaseteststeststatefileversion1DESCRIPTION"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/tests/test/statefile-version1/DESCRIPTION (from rev 117083, trunk/base/tests/test/statefile-version1/DESCRIPTION) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/tests/test/statefile-version1/DESCRIPTION                                (rev 0)
+++ branches/new-help-system/base/tests/test/statefile-version1/DESCRIPTION        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,5 @@
</span><ins>+This test checks that a non-outdated statefile version doesn't trigger a
+rebuild.
+
+There are 2 test cases, one that makes sure the statefile doesn't get
+discarded and another that looks for staging into destroot.
</ins></span></pre></div>
<a id="branchesnewhelpsystembaseteststeststatefileversion1Makefile"></a>
<div class="delfile"><h4>Deleted: branches/new-help-system/base/tests/test/statefile-version1/Makefile (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/tests/test/statefile-version1/Makefile        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/tests/test/statefile-version1/Makefile        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -1,15 +0,0 @@
</span><del>-include ../../../Mk/macports.autoconf.mk
-
-.PHONY: test
-
-$(bindir)/port:
-        @echo &quot;Please install MacPorts before running this test&quot;
-        @exit 1
-
-test:
-        @PORTSRC=$(PORTSRC) $(bindir)/port configure &gt;/dev/null 2&gt;&amp;1
-        @cp statefile work/.macports.statefile-version1.state
-        @PORTSRC=$(PORTSRC) $(bindir)/port destroot &gt;output 2&gt;&amp;1 || (cat output; exit 1)
-        @diff -u master output || (echo &quot;statefile version 1 wasn't outdated but still triggered a rebuild&quot;; exit 1)
-        @PORTSRC=$(PORTSRC) $(bindir)/port clean &gt;/dev/null 2&gt;&amp;1
-        @rm output
</del></span></pre></div>
<a id="branchesnewhelpsystembaseteststeststatefileversion1master"></a>
<div class="delfile"><h4>Deleted: branches/new-help-system/base/tests/test/statefile-version1/master (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/tests/test/statefile-version1/master        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/tests/test/statefile-version1/master        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -1,2 +0,0 @@
</span><del>----&gt;  Building statefile-version1
----&gt;  Staging statefile-version1 into destroot
</del></span></pre></div>
<a id="branchesnewhelpsystembaseteststeststatefileversion1testtclfromrev117083trunkbaseteststeststatefileversion1testtcl"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/tests/test/statefile-version1/test.tcl (from rev 117083, trunk/base/tests/test/statefile-version1/test.tcl) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/tests/test/statefile-version1/test.tcl                                (rev 0)
+++ branches/new-help-system/base/tests/test/statefile-version1/test.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,45 @@
</span><ins>+package require tcltest 2
+namespace import tcltest::*
+
+source [file dirname $argv0]/../library.tcl
+
+makeFile &quot;&quot; $output_file
+makeDirectory $work_dir
+set path [file dirname [file normalize $argv0]]
+
+
+# Initial setup
+load_variables $path
+set_dir
+port_index
+port_config $path
+port_desroot $path
+port_clean $path
+
+proc statefile_v1 {warn} {
+    global path output_file
+
+    if {$warn ne &quot;no&quot;} {
+        set msg &quot;*discarding previous state*&quot;
+    } else {
+        set msg &quot;*staging*destroot*&quot;
+    }
+    set line [get_line $path/$output_file $msg]
+    return $line
+}
+
+test warning_check {
+    Regression test for statefile-version1.
+} -body {
+    statefile_v1 yes
+} -result &quot;-1&quot;
+
+test output_check {
+    Regression test for statefile-version1.
+} -body {
+    statefile_v1 no
+} -result &quot;---&gt;  staging statefile-version1 into destroot&quot;
+
+
+cleanup
+cleanupTests
</ins></span></pre></div>
<a id="branchesnewhelpsystembaseteststeststatefileversion1outdatedDESCRIPTIONfromrev117083trunkbaseteststeststatefileversion1outdatedDESCRIPTION"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/tests/test/statefile-version1-outdated/DESCRIPTION (from rev 117083, trunk/base/tests/test/statefile-version1-outdated/DESCRIPTION) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/tests/test/statefile-version1-outdated/DESCRIPTION                                (rev 0)
+++ branches/new-help-system/base/tests/test/statefile-version1-outdated/DESCRIPTION        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+This test checks that an outdated statefile will cause a fresh build.
+
+There are 2 test cases, one that ensures the statefile gets discarded and another
+that ensures staging into destroot.
</ins></span></pre></div>
<a id="branchesnewhelpsystembaseteststeststatefileversion1outdatedMakefile"></a>
<div class="delfile"><h4>Deleted: branches/new-help-system/base/tests/test/statefile-version1-outdated/Makefile (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/tests/test/statefile-version1-outdated/Makefile        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/tests/test/statefile-version1-outdated/Makefile        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -1,16 +0,0 @@
</span><del>-include ../../../Mk/macports.autoconf.mk
-
-.PHONY: test
-
-$(bindir)/port:
-        @echo &quot;Please install MacPorts before running this test&quot;
-        @exit 1
-
-test:
-        @PORTSRC=$(PORTSRC) $(bindir)/port configure &gt;/dev/null 2&gt;&amp;1
-        @cp statefile work/.macports.statefile-version1-outdated.state
-        @touch -t 197001010000.09 work/.macports.statefile-version1-outdated.state
-        @PORTSRC=$(PORTSRC) $(bindir)/port destroot &gt;output 2&gt;&amp;1 || (cat output; exit 1)
-        @diff -u master output || (echo &quot;statfile version 1 was outdated but didn't cause a fresh build&quot;; exit 1)
-        @PORTSRC=$(PORTSRC) $(bindir)/port clean &gt;/dev/null 2&gt;&amp;1
-        @rm output
</del></span></pre></div>
<a id="branchesnewhelpsystembaseteststeststatefileversion1outdatedmaster"></a>
<div class="delfile"><h4>Deleted: branches/new-help-system/base/tests/test/statefile-version1-outdated/master (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/tests/test/statefile-version1-outdated/master        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/tests/test/statefile-version1-outdated/master        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -1,7 +0,0 @@
</span><del>-Portfile changed since last build; discarding previous state.
----&gt;  Fetching distfiles for statefile-version1-outdated
----&gt;  Verifying checksums for statefile-version1-outdated
----&gt;  Extracting statefile-version1-outdated
----&gt;  Configuring statefile-version1-outdated
----&gt;  Building statefile-version1-outdated
----&gt;  Staging statefile-version1-outdated into destroot
</del></span></pre></div>
<a id="branchesnewhelpsystembaseteststeststatefileversion1outdatedtesttclfromrev117083trunkbaseteststeststatefileversion1outdatedtesttcl"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/tests/test/statefile-version1-outdated/test.tcl (from rev 117083, trunk/base/tests/test/statefile-version1-outdated/test.tcl) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/tests/test/statefile-version1-outdated/test.tcl                                (rev 0)
+++ branches/new-help-system/base/tests/test/statefile-version1-outdated/test.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,47 @@
</span><ins>+package require tcltest 2
+namespace import tcltest::*
+
+source [file dirname $argv0]/../library.tcl
+
+makeFile &quot;&quot; $output_file
+set path [file dirname [file normalize $argv0]]
+
+# Initial setup
+load_variables $path
+set_dir
+port_index
+port_config $path
+file copy -force $path/statefile $work_dir/.macports.statefile-version1-outdated.state
+exec touch -t 197001010000.09 $work_dir/.macports.statefile-version1-outdated.state
+port_desroot $path
+port_clean $path
+
+proc state_v1 {warn} {
+    global path output_file
+
+    if {$warn ne &quot;no&quot;} {
+        set msg &quot;*discarding previous state*&quot;
+    } else {
+        set msg &quot;*staging*destroot*&quot;
+    }
+
+    set line [get_line $path/$output_file $msg]
+    return $line
+}
+
+test warning_check {
+    Regression test for statefile-v1-outdated discard prev version.
+} -body {
+    state_v1 yes
+} -result &quot;portfile changed since last build; discarding previous state.&quot;
+
+test output_check {
+    Regression test for statefile-v1-outdated output.
+} -body {
+    state_v1 no
+} -result &quot;---&gt;  staging statefile-version1-outdated into destroot&quot;
+
+removeDirectory $work_dir
+
+cleanup
+cleanupTests
</ins></span></pre></div>
<a id="branchesnewhelpsystembaseteststeststatefileversion2DESCRIPTIONfromrev117083trunkbaseteststeststatefileversion2DESCRIPTION"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/tests/test/statefile-version2/DESCRIPTION (from rev 117083, trunk/base/tests/test/statefile-version2/DESCRIPTION) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/tests/test/statefile-version2/DESCRIPTION                                (rev 0)
+++ branches/new-help-system/base/tests/test/statefile-version2/DESCRIPTION        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,5 @@
</span><ins>+This test checks that a non-outdated statefile version doesn't trigger a
+rebuild.
+
+There are 2 test cases, one that makes sure the statefile doesn't get
+discarded and another that looks for staging into destroot.
</ins></span></pre></div>
<a id="branchesnewhelpsystembaseteststeststatefileversion2Makefile"></a>
<div class="delfile"><h4>Deleted: branches/new-help-system/base/tests/test/statefile-version2/Makefile (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/tests/test/statefile-version2/Makefile        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/tests/test/statefile-version2/Makefile        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -1,16 +0,0 @@
</span><del>-include ../../../Mk/macports.autoconf.mk
-
-.PHONY: test
-
-$(bindir)/port:
-        @echo &quot;Please install MacPorts before running this test&quot;
-        @exit 1
-
-test:
-        @PORTSRC=$(PORTSRC) $(bindir)/port configure &gt;/dev/null 2&gt;&amp;1
-        @cp statefile work/.macports.statefile-version2.state
-        @sed -i'' -E &quot;s/@CHECKSUM@/`openssl dgst -sha256 Portfile | awk '{print $$2}'`/&quot; work/.macports.statefile-version2.state
-        @PORTSRC=$(PORTSRC) $(bindir)/port destroot &gt;output 2&gt;&amp;1 || (cat output; exit 1)
-        @diff -u master output || (echo &quot;statefile version 2 wasn't outdated, but still triggered a rebuild&quot;; exit 1)
-        @PORTSRC=$(PORTSRC) $(bindir)/port clean &gt;/dev/null 2&gt;&amp;1
-        @rm output
</del></span></pre></div>
<a id="branchesnewhelpsystembaseteststeststatefileversion2master"></a>
<div class="delfile"><h4>Deleted: branches/new-help-system/base/tests/test/statefile-version2/master (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/tests/test/statefile-version2/master        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/tests/test/statefile-version2/master        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -1,2 +0,0 @@
</span><del>----&gt;  Building statefile-version2
----&gt;  Staging statefile-version2 into destroot
</del></span></pre></div>
<a id="branchesnewhelpsystembaseteststeststatefileversion2testtclfromrev117083trunkbaseteststeststatefileversion2testtcl"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/tests/test/statefile-version2/test.tcl (from rev 117083, trunk/base/tests/test/statefile-version2/test.tcl) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/tests/test/statefile-version2/test.tcl                                (rev 0)
+++ branches/new-help-system/base/tests/test/statefile-version2/test.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,48 @@
</span><ins>+package require tcltest 2
+namespace import tcltest::*
+
+source [file dirname $argv0]/../library.tcl
+
+makeFile &quot;&quot; $output_file
+makeDirectory $work_dir
+set path [file dirname [file normalize $argv0]]
+
+
+# Initial setup
+load_variables $path
+set_dir
+port_index
+port_config $path
+file copy -force $path/statefile $work_dir/.macports.statefile-version2.state
+exec sed -i'' -E &quot;s/@CHECKSUM@/`openssl dgst -sha256 Portfile | \
+    awk '{print \$\$2}'`/&quot; $work_dir/.macports.statefile-version2.state
+port_desroot $path
+port_clean $path
+
+proc statefile_v2 {arg} {
+    global path output_file
+
+    if {$arg ne &quot;no&quot;} {
+        set msg &quot;*discarding previous state*&quot;
+    } else {
+        set msg &quot;*staging*destroot*&quot;
+    }
+    set line [get_line $path/$output_file $msg]
+    return $line
+}
+
+test statefile-v2-discard {
+    Regression test for statefile-version2 no discard.
+} -body {
+    statefile_v2 yes
+} -result &quot;-1&quot;
+
+test statefile-v2 {
+    Regression test for statefile-version2.
+} -body {
+    statefile_v2 no
+} -result &quot;---&gt;  staging statefile-version2 into destroot&quot;
+
+
+cleanup
+cleanupTests
</ins></span></pre></div>
<a id="branchesnewhelpsystembaseteststeststatefileversion2invalidDESCRIPTIONfromrev117083trunkbaseteststeststatefileversion2invalidDESCRIPTION"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/tests/test/statefile-version2-invalid/DESCRIPTION (from rev 117083, trunk/base/tests/test/statefile-version2-invalid/DESCRIPTION) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/tests/test/statefile-version2-invalid/DESCRIPTION                                (rev 0)
+++ branches/new-help-system/base/tests/test/statefile-version2-invalid/DESCRIPTION        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,5 @@
</span><ins>+This test checks that statefile version 2 without checksum field will cause a
+warning message. MacPorts should never deal with a broken statefile.
+
+There are 2 test cases, one that ensures a warning message gets thrown and
+another that ensures staging into destroot.
</ins></span></pre></div>
<a id="branchesnewhelpsystembaseteststeststatefileversion2invalidMakefile"></a>
<div class="delfile"><h4>Deleted: branches/new-help-system/base/tests/test/statefile-version2-invalid/Makefile (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/tests/test/statefile-version2-invalid/Makefile        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/tests/test/statefile-version2-invalid/Makefile        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -1,15 +0,0 @@
</span><del>-include ../../../Mk/macports.autoconf.mk
-
-.PHONY: test
-
-$(bindir)/port:
-        @echo &quot;Please install MacPorts before running this test&quot;
-        @exit 1
-
-test:
-        @PORTSRC=$(PORTSRC) $(bindir)/port configure &gt;/dev/null 2&gt;&amp;1
-        @cp statefile work/.macports.statefile-version2-invalid.state
-        @PORTSRC=$(PORTSRC) $(bindir)/port destroot &gt;output 2&gt;&amp;1 || (cat output; exit 1)
-        @diff -u master output || (echo &quot;statefile version 2 without checksum field didn't cause a warning&quot;; exit 1)
-        @PORTSRC=$(PORTSRC) $(bindir)/port clean &gt;/dev/null 2&gt;&amp;1
-        @rm output
</del></span></pre></div>
<a id="branchesnewhelpsystembaseteststeststatefileversion2invalidmaster"></a>
<div class="delfile"><h4>Deleted: branches/new-help-system/base/tests/test/statefile-version2-invalid/master (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/tests/test/statefile-version2-invalid/master        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/tests/test/statefile-version2-invalid/master        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -1,8 +0,0 @@
</span><del>-Warning: Statefile has version 2 but didn't contain a checksum
-Portfile changed since last build; discarding previous state.
----&gt;  Fetching distfiles for statefile-version2-invalid
----&gt;  Verifying checksums for statefile-version2-invalid
----&gt;  Extracting statefile-version2-invalid
----&gt;  Configuring statefile-version2-invalid
----&gt;  Building statefile-version2-invalid
----&gt;  Staging statefile-version2-invalid into destroot
</del></span></pre></div>
<a id="branchesnewhelpsystembaseteststeststatefileversion2invalidtesttclfromrev117083trunkbaseteststeststatefileversion2invalidtesttcl"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/tests/test/statefile-version2-invalid/test.tcl (from rev 117083, trunk/base/tests/test/statefile-version2-invalid/test.tcl) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/tests/test/statefile-version2-invalid/test.tcl                                (rev 0)
+++ branches/new-help-system/base/tests/test/statefile-version2-invalid/test.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,46 @@
</span><ins>+package require tcltest 2
+namespace import tcltest::*
+
+source [file dirname $argv0]/../library.tcl
+
+makeFile &quot;&quot; $output_file
+set path [file dirname [file normalize $argv0]]
+
+# Initial setup
+load_variables $path
+set_dir
+port_index
+port_config $path
+file copy -force $path/statefile $work_dir/.macports.statefile-version2-invalid.state
+port_desroot $path
+port_clean $path
+
+proc state_v2_invalid {warn} {
+    global path output_file
+
+    if {$warn ne &quot;no&quot;} {
+        set msg &quot;*warning*checksum*&quot;
+    } else {
+        set msg &quot;*staging*destroot*&quot;
+    }
+
+    set line [get_line $path/$output_file $msg]
+    return $line
+}
+
+test warning_check {
+    Regression test for statefile-v2-invalid discard prev version.
+} -body {
+    state_v2_invalid yes
+} -result &quot;warning: statefile has version 2 but didn't contain a checksum&quot;
+
+test output_check {
+    Regression test for statefile-v2-invalid output.
+} -body {
+    state_v2_invalid no
+} -result &quot;---&gt;  staging statefile-version2-invalid into destroot&quot;
+
+removeDirectory $work_dir
+
+cleanup
+cleanupTests
</ins></span></pre></div>
<a id="branchesnewhelpsystembaseteststeststatefileversion2outdatedDESCRIPTIONfromrev117083trunkbaseteststeststatefileversion2outdatedDESCRIPTION"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/tests/test/statefile-version2-outdated/DESCRIPTION (from rev 117083, trunk/base/tests/test/statefile-version2-outdated/DESCRIPTION) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/tests/test/statefile-version2-outdated/DESCRIPTION                                (rev 0)
+++ branches/new-help-system/base/tests/test/statefile-version2-outdated/DESCRIPTION        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+This test checks that an outdated statefile will cause a fresh build.
+
+There are 2 test cases, one that ensures the statefile gets discarded and another
+that ensures staging into destroot.
</ins></span></pre></div>
<a id="branchesnewhelpsystembaseteststeststatefileversion2outdatedMakefile"></a>
<div class="delfile"><h4>Deleted: branches/new-help-system/base/tests/test/statefile-version2-outdated/Makefile (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/tests/test/statefile-version2-outdated/Makefile        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/tests/test/statefile-version2-outdated/Makefile        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -1,15 +0,0 @@
</span><del>-include ../../../Mk/macports.autoconf.mk
-
-.PHONY: test
-
-$(bindir)/port:
-        @echo &quot;Please install MacPorts before running this test&quot;
-        @exit 1
-
-test:
-        @PORTSRC=$(PORTSRC) $(bindir)/port configure &gt;/dev/null 2&gt;&amp;1
-        @cp statefile work/.macports.statefile-version2-outdated.state
-        @PORTSRC=$(PORTSRC) $(bindir)/port destroot &gt;output 2&gt;&amp;1 || (cat output; exit 1)
-        @diff -u master output || (echo &quot;statefile version 2 was outdated but didn't cause a fresh build&quot;; exit 1)
-        @PORTSRC=$(PORTSRC) $(bindir)/port clean &gt;/dev/null 2&gt;&amp;1
-        @rm output
</del></span></pre></div>
<a id="branchesnewhelpsystembaseteststeststatefileversion2outdatedmaster"></a>
<div class="delfile"><h4>Deleted: branches/new-help-system/base/tests/test/statefile-version2-outdated/master (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/tests/test/statefile-version2-outdated/master        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/tests/test/statefile-version2-outdated/master        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -1,7 +0,0 @@
</span><del>-Portfile changed since last build; discarding previous state.
----&gt;  Fetching distfiles for statefile-version2-outdated
----&gt;  Verifying checksums for statefile-version2-outdated
----&gt;  Extracting statefile-version2-outdated
----&gt;  Configuring statefile-version2-outdated
----&gt;  Building statefile-version2-outdated
----&gt;  Staging statefile-version2-outdated into destroot
</del></span></pre></div>
<a id="branchesnewhelpsystembaseteststeststatefileversion2outdatedtesttclfromrev117083trunkbaseteststeststatefileversion2outdatedtesttcl"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/tests/test/statefile-version2-outdated/test.tcl (from rev 117083, trunk/base/tests/test/statefile-version2-outdated/test.tcl) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/tests/test/statefile-version2-outdated/test.tcl                                (rev 0)
+++ branches/new-help-system/base/tests/test/statefile-version2-outdated/test.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,46 @@
</span><ins>+package require tcltest 2
+namespace import tcltest::*
+
+source [file dirname $argv0]/../library.tcl
+
+makeFile &quot;&quot; $output_file
+set path [file dirname [file normalize $argv0]]
+
+# Initial setup
+load_variables $path
+set_dir
+port_index
+port_config $path
+file copy -force $path/statefile $work_dir/.macports.statefile-version2-outdated.state
+port_desroot $path
+port_clean $path
+
+proc state_v2_out {warn} {
+    global path output_file
+
+    if {$warn ne &quot;no&quot; } {
+        set msg &quot;*discarding previous state*&quot;
+    } else {
+        set msg &quot;*staging*destroot*&quot;
+    }
+
+    set line [get_line $path/$output_file $msg]
+    return $line
+}
+
+test warning_check {
+    Regression test for statefile-v2-outdated discard prev version.
+} -body {
+    state_v2_out yes
+} -result &quot;portfile changed since last build; discarding previous state.&quot;
+
+test output_check {
+    Regression test for statefile-v2-outdated output.
+} -body {
+    state_v2_out no
+} -result &quot;---&gt;  staging statefile-version2-outdated into destroot&quot;
+
+removeDirectory $work_dir
+
+cleanup
+cleanupTests
</ins></span></pre></div>
<a id="branchesnewhelpsystembaseteststestsvnandpatchsitesDESCRIPTIONfromrev117083trunkbaseteststestsvnandpatchsitesDESCRIPTION"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/tests/test/svn-and-patchsites/DESCRIPTION (from rev 117083, trunk/base/tests/test/svn-and-patchsites/DESCRIPTION) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/tests/test/svn-and-patchsites/DESCRIPTION                                (rev 0)
+++ branches/new-help-system/base/tests/test/svn-and-patchsites/DESCRIPTION        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+This test checks fetching using svn and downloading of patchfiles from
+the URL given by patch_sites.
+
+There is 1 test case which looks for errors in the output file.
</ins></span></pre></div>
<a id="branchesnewhelpsystembaseteststestsvnandpatchsitesmaster"></a>
<div class="delfile"><h4>Deleted: branches/new-help-system/base/tests/test/svn-and-patchsites/master (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/tests/test/svn-and-patchsites/master        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/tests/test/svn-and-patchsites/master        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -1,7 +0,0 @@
</span><del>----&gt;  Fetching distfiles for svn-and-patchsites
----&gt;  Attempting to fetch patch-1.5.14.dgc.xlabel_ext.9 from http://home.uchicago.edu/~dgc/sw/mutt/
----&gt;  Verifying checksums for svn-and-patchsites
----&gt;  Extracting svn-and-patchsites
----&gt;  Configuring svn-and-patchsites
----&gt;  Building svn-and-patchsites
----&gt;  Testing svn-and-patchsites
</del></span></pre></div>
<a id="branchesnewhelpsystembaseteststestsvnandpatchsitestesttclfromrev117083trunkbaseteststestsvnandpatchsitestesttcl"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/tests/test/svn-and-patchsites/test.tcl (from rev 117083, trunk/base/tests/test/svn-and-patchsites/test.tcl) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/tests/test/svn-and-patchsites/test.tcl                                (rev 0)
+++ branches/new-help-system/base/tests/test/svn-and-patchsites/test.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,29 @@
</span><ins>+package require tcltest 2
+namespace import tcltest::*
+
+source [file dirname $argv0]/../library.tcl
+set path [file dirname [file normalize $argv0]]
+
+initial_setup
+
+proc svn-patch {} {
+    global output_file path
+
+    set svn &quot;error*&quot;
+    set line [get_line $path/$output_file $svn]
+    if {$line == -1} {
+        return &quot;No error found.&quot;
+    } else {
+        return &quot;Errors found in output file.&quot;
+    }
+}
+
+test svn-patchsites {
+    Regression test for svn-and-patchsites.
+} -body {
+    svn-patch
+} -result &quot;No error found.&quot;
+
+
+cleanup
+cleanupTests
</ins></span></pre></div>
<a id="branchesnewhelpsystembaseteststesttraceDESCRIPTIONfromrev117083trunkbaseteststesttraceDESCRIPTION"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/tests/test/trace/DESCRIPTION (from rev 117083, trunk/base/tests/test/trace/DESCRIPTION) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/tests/test/trace/DESCRIPTION                                (rev 0)
+++ branches/new-help-system/base/tests/test/trace/DESCRIPTION        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+This test checks the 'port -t' command which creates a virtual sandbox by a 
+mechanism known from Linux as library LD_PRELOADing.
+
+There is 1 test case, which looks for errors in the output file.
</ins></span></pre></div>
<a id="branchesnewhelpsystembaseteststesttracetesttclfromrev117083trunkbaseteststesttracetesttcl"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/tests/test/trace/test.tcl (from rev 117083, trunk/base/tests/test/trace/test.tcl) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/tests/test/trace/test.tcl                                (rev 0)
+++ branches/new-help-system/base/tests/test/trace/test.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,57 @@
</span><ins>+package require tcltest 2
+namespace import tcltest::*
+
+source [file dirname $argv0]/../library.tcl
+
+makeFile &quot;&quot; $output_file
+makeDirectory $work_dir
+set path [file dirname [file normalize $argv0]]
+
+load_variables $path
+
+proc test_trace {} {
+    global path autoconf output_file
+
+    set line [get_line $autoconf &quot;runusr*&quot;]
+    set user [lrange [split $line &quot; &quot;] 1 1]
+
+    set_dir
+    port_index
+    port_clean $path
+
+
+    makeDirectory ../tracetesttmp
+    file attributes ../tracetesttmp -owner $user
+    exec sudo -u $user touch  ../tracetesttmp/delete-trace
+    exec sudo -u $user touch ../tracetesttmp/rename-trace
+    exec sudo -u $user mkdir ../tracetesttmp/rmdir-trace
+    file delete -force /tmp/hello-trace
+    file attributes /usr/include/unistd.h -owner $user
+    file link -symbolic /tmp/link-trace2 /usr/include/unistd.h
+    exec chown -h $user /tmp/link-trace2
+
+    port_trace $path
+    
+    #file delete -force /tmp/link-trace2
+    file delete -force /tmp/hello-trace
+
+    set err &quot;error*&quot;
+    set line [get_line $path/$output_file $err]
+    if { $line == -1 } {
+        return &quot;No errors found.&quot;
+    } else {
+        return $line
+    }
+}
+
+test trace {
+    Regression test for trace.
+} -constraints {
+    root
+} -body {
+    test_trace
+} -result &quot;No errors found.&quot;
+
+
+cleanup
+cleanupTests
</ins></span></pre></div>
<a id="branchesnewhelpsystembaseteststestuniversalDESCRIPTIONfromrev117083trunkbaseteststestuniversalDESCRIPTION"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/tests/test/universal/DESCRIPTION (from rev 117083, trunk/base/tests/test/universal/DESCRIPTION) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/tests/test/universal/DESCRIPTION                                (rev 0)
+++ branches/new-help-system/base/tests/test/universal/DESCRIPTION        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,7 @@
</span><ins>+This test checks the handling of the universal variant in MacPorts base.
+Every port should have an universal variant unless 'universal_variant no' is
+specified.
+
+There are 2 test cases. One for universal variant set and another for no
+universal variant. For each test a specific Portfile is generated from the
+Port.in file.
</ins></span></pre></div>
<a id="branchesnewhelpsystembaseteststestuniversalMakefile"></a>
<div class="delfile"><h4>Deleted: branches/new-help-system/base/tests/test/universal/Makefile (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/tests/test/universal/Makefile        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/tests/test/universal/Makefile        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -1,17 +0,0 @@
</span><del>-include ../../../Mk/macports.autoconf.mk
-
-.PHONY: test
-
-$(bindir)/port:
-        @echo &quot;Please install MacPorts before running this test&quot;
-        @exit 1
-
-test:
-        @PORTSRC=$(PORTSRC) $(bindir)/port clean &gt; /dev/null
-        @sh -c &quot;export PORTSRC=$(PORTSRC); $(bindir)/port info --variants&quot; &gt; output 2&gt;&amp;1 || (cat output; exit 1)
-        @diff -u master output 2&gt;&amp;1 | tee difference
-        @if [ -s difference ]; then \
-                exit 1; \
-        else \
-                rm -f difference; \
-        fi
</del></span></pre></div>
<a id="branchesnewhelpsystembaseteststestuniversalPortfile"></a>
<div class="delfile"><h4>Deleted: branches/new-help-system/base/tests/test/universal/Portfile (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/tests/test/universal/Portfile        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/tests/test/universal/Portfile        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -1,23 +0,0 @@
</span><del>-# $Id$
-
-PortSystem 1.0
-name                universal
-version                1
-categories        test
-maintainers        pguyot@kallisys.net
-description        Test port for universal variant
-homepage        http://www.macports.org/
-platforms        darwin
-
-long_description ${description}
-
-distfiles
-configure        {}
-build                {}
-destroot        {
-        system &quot;touch ${destroot}${prefix}/lib/${name}&quot;
-}
-
-test                {}
-
-default_variants +universal
</del></span></pre></div>
<a id="branchesnewhelpsystembaseteststestuniversalPortfileinfromrev117083trunkbaseteststestuniversalPortfilein"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/tests/test/universal/Portfile.in (from rev 117083, trunk/base/tests/test/universal/Portfile.in) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/tests/test/universal/Portfile.in                                (rev 0)
+++ branches/new-help-system/base/tests/test/universal/Portfile.in        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,18 @@
</span><ins>+# $Id$
+PortSystem 1.0
+name            universal
+version         1
+categories      test
+maintainers     pguyot@kallisys.net
+description     Test port for universal variant
+homepage        http://www.macports.org/
+platforms       darwin
+long_description ${description}
+distfiles
+configure       {}
+build           {}
+destroot        {
+        system &quot;touch ${destroot}${prefix}/lib/${name}&quot;
+}
+test            {}
+@option@
</ins></span></pre></div>
<a id="branchesnewhelpsystembaseteststestuniversalmaster"></a>
<div class="delfile"><h4>Deleted: branches/new-help-system/base/tests/test/universal/master (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/tests/test/universal/master        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/tests/test/universal/master        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -1 +0,0 @@
</span><del>-variants: universal
</del></span></pre></div>
<a id="branchesnewhelpsystembaseteststestuniversaltesttclfromrev117083trunkbaseteststestuniversaltesttcl"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/tests/test/universal/test.tcl (from rev 117083, trunk/base/tests/test/universal/test.tcl) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/tests/test/universal/test.tcl                                (rev 0)
+++ branches/new-help-system/base/tests/test/universal/test.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,53 @@
</span><ins>+package require tcltest 2
+namespace import tcltest::*
+
+source [file dirname $argv0]/../library.tcl
+
+makeFile &quot;&quot; &quot;Portfile&quot;
+makeFile &quot;&quot; $output_file
+makeDirectory $work_dir
+set path [file dirname [file normalize $argv0]]
+
+# Initial setup
+load_variables $path
+set_dir
+port_index
+
+proc univ_test {opt} {
+    global output_file path portsrc bindir
+
+    # Modify Porfile.in for variants.
+    if {$opt ne &quot;yes&quot;} {
+        # No universal variant
+        exec sed &quot;s/@option@/universal_variant\ no/&quot; $path/Portfile.in &gt; Portfile
+    } else {
+        # Add universal variant
+        exec sed &quot;s/@option@/default_variants\ +universal/&quot; $path/Portfile.in &gt; Portfile
+    }
+    port_clean $path
+
+    # Build helping string
+    set string &quot;export PORTSRC=${portsrc} ; ${bindir}/port info --variants&quot;
+
+    exec sh -c $string &gt; output 2&gt;@1
+    set var &quot;variants:*&quot;
+    set line [get_line $path/$output_file $var]
+    return $line
+}
+
+
+test universal {
+    Regression test for universal variant.
+} -body {
+    univ_test &quot;yes&quot;
+} -result &quot;variants: universal&quot;
+
+test nouniversal {
+    Regression test for no universal variant.
+} -body {
+    univ_test &quot;no&quot;
+} -result &quot;variants: &quot;
+
+
+cleanup
+cleanupTests
</ins></span></pre></div>
<a id="branchesnewhelpsystembaseteststestvariantsDESCRIPTIONfromrev117083trunkbaseteststestvariantsDESCRIPTION"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/tests/test/variants/DESCRIPTION (from rev 117083, trunk/base/tests/test/variants/DESCRIPTION) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/tests/test/variants/DESCRIPTION                                (rev 0)
+++ branches/new-help-system/base/tests/test/variants/DESCRIPTION        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+This test checks the variants feature in general.
+
+There is 1 test case.
</ins></span></pre></div>
<a id="branchesnewhelpsystembaseteststestvariantsmaster"></a>
<div class="delfile"><h4>Deleted: branches/new-help-system/base/tests/test/variants/master (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/tests/test/variants/master        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/tests/test/variants/master        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -1,8 +0,0 @@
</span><del>-Utopia variant -- 2
-Utopia variant -- 2
----&gt;  Fetching distfiles for variants
----&gt;  Verifying checksums for variants
----&gt;  Extracting variants
----&gt;  Configuring variants
----&gt;  Building variants
----&gt;  Testing variants
</del></span></pre></div>
<a id="branchesnewhelpsystembaseteststestvariantstesttclfromrev117083trunkbaseteststestvariantstesttcl"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/tests/test/variants/test.tcl (from rev 117083, trunk/base/tests/test/variants/test.tcl) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/tests/test/variants/test.tcl                                (rev 0)
+++ branches/new-help-system/base/tests/test/variants/test.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,26 @@
</span><ins>+package require tcltest 2
+namespace import tcltest::*
+
+source [file dirname $argv0]/../library.tcl
+set path [file dirname [file normalize $argv0]]
+
+initial_setup
+
+proc var_check {} {
+    global output_file path
+
+    set var &quot;utopia variant*&quot;
+    set line [get_line $path/$output_file $var]
+    return $line
+}
+
+
+test variants {
+    Regression test for variants.
+} -body {
+    var_check
+} -result &quot;utopia variant -- 2&quot;
+
+
+cleanup
+cleanupTests
</ins></span></pre></div>
<a id="branchesnewhelpsystembaseteststestxcodeversionDESCRIPTIONfromrev117083trunkbaseteststestxcodeversionDESCRIPTION"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/tests/test/xcodeversion/DESCRIPTION (from rev 117083, trunk/base/tests/test/xcodeversion/DESCRIPTION) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/tests/test/xcodeversion/DESCRIPTION                                (rev 0)
+++ branches/new-help-system/base/tests/test/xcodeversion/DESCRIPTION        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+This test checks the Xcode version. MacPorts needs at least Xcode 2.1.
+
+There are 2 test cases, one for the Xcode version and another to check the
+xcodebuild path.
</ins></span></pre></div>
<a id="branchesnewhelpsystembaseteststestxcodeversionmaster"></a>
<div class="delfile"><h4>Deleted: branches/new-help-system/base/tests/test/xcodeversion/master (117083 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/tests/test/xcodeversion/master        2014-02-15 12:19:10 UTC (rev 117083)
+++ branches/new-help-system/base/tests/test/xcodeversion/master        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -1,8 +0,0 @@
</span><del>----&gt;  Fetching distfiles for xcodeversion
----&gt;  Verifying checksums for xcodeversion
----&gt;  Extracting xcodeversion
----&gt;  Configuring xcodeversion
----&gt;  Building xcodeversion
----&gt;  Testing xcodeversion
-xcodeversion &gt;= 2.1
-xcodebuildcmd = /usr/bin/xcodebuild
</del></span></pre></div>
<a id="branchesnewhelpsystembaseteststestxcodeversiontesttclfromrev117083trunkbaseteststestxcodeversiontesttcl"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/tests/test/xcodeversion/test.tcl (from rev 117083, trunk/base/tests/test/xcodeversion/test.tcl) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/tests/test/xcodeversion/test.tcl                                (rev 0)
+++ branches/new-help-system/base/tests/test/xcodeversion/test.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,39 @@
</span><ins>+package require tcltest 2
+namespace import tcltest::*
+
+source [file dirname $argv0]/../library.tcl
+set path [file dirname [file normalize $argv0]]
+
+initial_setup
+
+proc xcode_ver {} {
+    global output_file path
+
+    set xcode &quot;xcodeversion*&quot;
+    set line [get_line $path/$output_file $xcode]
+    return $line
+}
+
+proc xcode_binpath {} {
+    global output_file path
+
+    set xcode &quot;xcodebuildcmd*&quot;
+    set line [get_line $path/$output_file $xcode]
+    return $line
+}
+
+test envvariables {
+    Regression test for XCode version.
+} -body {
+    xcode_ver
+} -result &quot;xcodeversion &gt;= 2.1&quot;
+
+test xcode_path {
+    Regression test for XCode path.
+} -body {
+    xcode_binpath
+} -result &quot;xcodebuildcmd = /usr/bin/xcodebuild&quot;
+
+
+cleanup
+cleanupTests
</ins></span></pre></div>
<a id="branchesnewhelpsystembaseteststesttclfromrev117083trunkbaseteststesttcl"></a>
<div class="copfile"><h4>Copied: branches/new-help-system/base/tests/test.tcl (from rev 117083, trunk/base/tests/test.tcl) (0 => 117084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/new-help-system/base/tests/test.tcl                                (rev 0)
+++ branches/new-help-system/base/tests/test.tcl        2014-02-15 14:35:04 UTC (rev 117084)
</span><span class="lines">@@ -0,0 +1,143 @@
</span><ins>+set test_suite {
+    case-insensitive-deactivate
+    checksums-1
+    dependencies-a
+    dependencies-b
+    dependencies-c
+    dependencies-d
+    dependencies-e
+    envvariables
+    site-tags
+    statefile-unknown-version
+    statefile-version1
+    statefile-version1-outdated
+    statefile-version2
+    statefile-version2-invalid
+    statefile-version2-outdated
+    svn-and-patchsites
+    trace
+    universal
+    variants
+    xcodeversion
+}
+set arguments &quot;&quot;
+set test_name &quot;&quot;
+set color_out &quot;&quot;
+set tcl &quot;&quot;
+set err &quot;&quot;
+
+# Get tclsh path.
+set autoconf ../Mk/macports.autoconf.mk
+set fp [open $autoconf r]
+while {[gets $fp line] != -1} {
+    if {[string match &quot;TCLSH*&quot; $line] != 0} {
+        set tcl [lrange [split $line &quot; &quot;] 1 1]
+    }
+}
+
+proc print_help {arg} {
+    if { $arg eq &quot;tests&quot; } {
+        puts &quot;The list of available tests is:&quot;
+        foreach test $::test_suite {
+            puts [puts -nonewline &quot;  &quot;]$test
+        }
+    } else {
+        puts &quot;Usage: tclsh test.tcl \[-debug level\] \[-t test\] \[-l\]\n&quot;
+        puts &quot;  -debug LVL : sets the level of printed debug info \[0-3\]&quot;
+        puts &quot;  -t TEST    : run a specific test&quot;
+        puts &quot;  -nocolor   : disable color output (for automatic testing)&quot;
+        puts &quot;  -l         : print the list of available tests&quot;
+        puts &quot;  -h, -help  : print this message\n&quot;
+    }
+}
+
+# Process args
+foreach arg $argv {
+    if { $arg eq &quot;-h&quot; || $arg eq &quot;-help&quot; } {
+        print_help &quot;&quot;
+        exit 0
+    } elseif { $arg eq &quot;-debug&quot; } {
+        set index [expr {[lsearch $argv $arg] + 1}]
+        set level [lindex $argv $index]
+        if { $level &gt;= 0 &amp;&amp; $level &lt;= 3 } {
+            append arguments &quot;-debug &quot; $level
+        } else {
+            puts &quot;Invalid debug level.&quot;
+            exit 1
+        }
+    } elseif { $arg eq &quot;-t&quot; } {
+        set index [expr {[lsearch $argv $arg] + 1}]
+        set test_name [lindex $argv $index]
+        set no 0
+        foreach test $test_suite {
+            if { $test_name != $test } {
+                set no [expr {$no + 1}]
+            }
+        }
+        if { $no == [llength $test_suite] } {
+            print_help tests
+            exit 1
+        }
+    } elseif { $arg eq &quot;-l&quot; } {
+        print_help tests
+        exit 0
+    } elseif { $arg eq &quot;-nocolor&quot; } {
+        set color_out &quot;no&quot;
+    }
+}
+
+
+# Run tests
+if {$test_name ne &quot;&quot;} {
+    cd test/$test_name
+
+    set result [eval exec $tcl test.tcl $arguments 2&gt;@stderr]
+    puts $result
+
+} else {
+    foreach test $test_suite {
+        cd test/$test
+    
+        set result [eval exec $tcl test.tcl $arguments 2&gt;@stderr]
+        set lastline [lindex [split $result &quot;\n&quot;] end]
+
+        if {[lrange [split $lastline &quot;\t&quot;] 1 1] != &quot;Total&quot;} {
+            set lastline [lindex [split $result &quot;\n&quot;] end-2]
+            set errmsg [lindex [split $result &quot;\n&quot;] end]
+        }
+
+        set splitresult [split $lastline &quot;\t&quot;]
+        set total [lindex $splitresult 2]
+        set pass [lindex $splitresult 4]
+        set skip [lindex $splitresult 6]
+        set fail [lindex $splitresult 8]
+
+        # Check for errors.
+        if { $fail != 0 } { set err &quot;yes&quot; }
+
+        set out &quot;&quot;
+        if { ($fail != 0 || $skip != 0) &amp;&amp; $color_out eq &quot;&quot; } {
+            # Color failed tests.
+            append out &quot;\x1b\[1;31mTotal:&quot; $total &quot; Passed:&quot; $pass &quot; Failed:&quot; $fail &quot; Skipped:&quot; $skip &quot;  \x1b\[0m&quot; $test
+        } else {
+            append out &quot;Total:&quot; $total &quot; Passed:&quot; $pass &quot; Failed:&quot; $fail &quot; Skipped:&quot; $skip &quot;  &quot; $test
+        }
+
+        # Print results and constrints for auto-skipped tests.
+        puts $out
+        if { $skip != 0 } {
+            set out &quot;    Constraint: &quot;
+            append out [string trim $errmsg &quot;\t {}&quot;]
+            puts $out
+        }
+    
+        cd ../..
+    }
+}
+
+# Return 1 if errors were found.
+if {$err ne &quot;&quot;} {
+    exit 1
+}
+
+return 0
</ins></span></pre>
</div>
</div>

</body>
</html>