<!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 "move" 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 "-prepend" command for Portfile options (similar to existing
+ "-append" 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 "https://trac.macports.org/wiki/Tests".
</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 "x$UNIVERSAL_ARCHS" = "x"; then
</span><span class="cx"> case "$MACOSX_VERSION" in
</span><ins>+ 10.1[[0-9]]*)
+ UNIVERSAL_ARCHS="x86_64 i386"
+ ;;
</ins><span class="cx"> 10.[[0-5]]*)
</span><span class="cx"> UNIVERSAL_ARCHS="i386 ppc"
</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="$UNIVERSAL_ARCHFLAGS -arch $arch"
+ 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 "x$as_dir" != "x$prefix/bin" &&
-                        test "x$as_dir" != "x$prefix/sbin"; then
-                        if test -z "$newPATH"; then
-                                newPATH=$as_dir
-                        else
-                                newPATH=$newPATH$PATH_SEPARATOR$as_dir
-                        fi
-                fi
</del><ins>+                case "$as_dir" in
+                        $prefix/*)
+                                ;
+                        *)
+                                if test -z "$newPATH"; 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"${OS_PLATFORM}" != "xdarwin"; then
+                        AC_MSG_RESULT([not darwin, no])
+                        TRACEMODE_SUPPORT=0
+                elif test x"${ac_cv_func_kqueue}" != "xyes"; then
+                        AC_MSG_RESULT([kqueue() not available, no])
+                        TRACEMODE_SUPPORT=0
+                elif test x"${ac_cv_func_kevent}" != "xyes"; then
+                        AC_MSG_RESULT([kevent() not available, no])
+                        TRACEMODE_SUPPORT=0
+                else
+                        AC_EGREP_CPP(yes_have_ev_receipt, [
+                                #include <sys/types.h>
+                                #include <sys/event.h>
+                                #include <sys/time.h>
+                                #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 "x$as_dir" != "x$prefix/bin" &&
-                        test "x$as_dir" != "x$prefix/sbin"; then
-                        if test -z "$newPATH"; then
-                                newPATH=$as_dir
-                        else
-                                newPATH=$newPATH$PATH_SEPARATOR$as_dir
-                        fi
-                fi
</del><ins>+                case "$as_dir" in
+                        $prefix/*)
+                                ;
+                        *)
+                                if test -z "$newPATH"; 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 "$MACOSX_VERSION" 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 $? "This version of Mac OS X is not supported
</span><span class="cx"> Please upgrade at http://store.apple.com/" "$LINENO" 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 "$as_me:${as_lineno-$LINENO}: WARNING: This version of Mac OS X is out of date" >&5
</span><span class="cx"> $as_echo "$as_me: WARNING: This version of Mac OS X is out of date" >&2;}
</span><span class="cx"> { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Please run Software Update to update it" >&5
</span><span class="cx"> $as_echo "$as_me: WARNING: Please run Software Update to update it" >&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 "$as_me:${as_lineno-$LINENO}: WARNING: Please consider upgrading as some ports fail compiling" >&5
</span><span class="cx"> $as_echo "$as_me: WARNING: Please consider upgrading as some ports fail compiling" >&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 >&5'
</span><span class="cx"> ac_compiler_gnu=$ac_cv_c_compiler_gnu
</span><span class="cx"> if test -n "$ac_tool_prefix"; then
</span><del>- # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
-set dummy ${ac_tool_prefix}gcc; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_CC+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # 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 "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_CC="${ac_tool_prefix}gcc"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
-$as_echo "$CC" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$ac_cv_prog_CC"; then
- ac_ct_CC=$CC
- # Extract the first word of "gcc", so it can be a program name with args.
-set dummy gcc; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_CC+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if test -n "$ac_ct_CC"; then
- ac_cv_prog_ac_ct_CC="$ac_ct_CC" # 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 "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_ac_ct_CC="gcc"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_CC=$ac_cv_prog_ac_ct_CC
-if test -n "$ac_ct_CC"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
-$as_echo "$ac_ct_CC" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
- if test "x$ac_ct_CC" = x; then
- CC=""
- else
- case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
- CC=$ac_ct_CC
- fi
-else
- CC="$ac_cv_prog_CC"
-fi
-
-if test -z "$CC"; then
- if test -n "$ac_tool_prefix"; then
- # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
-set dummy ${ac_tool_prefix}cc; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_CC+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # 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 "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_CC="${ac_tool_prefix}cc"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
-$as_echo "$CC" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
- fi
-fi
-if test -z "$CC"; then
- # Extract the first word of "cc", so it can be a program name with args.
-set dummy cc; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_CC+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # 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 "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
- ac_prog_rejected=yes
- continue
- fi
- ac_cv_prog_CC="cc"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
-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="$as_dir/$ac_word${1+' '}$@"
- fi
-fi
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
-$as_echo "$CC" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$CC"; then
- if test -n "$ac_tool_prefix"; 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 "$ac_tool_prefix$ac_prog", 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 "$CC"; 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 "$ac_prog", 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 "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
</span><span class="cx"> $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
</span><span class="cx"> as_fn_error $? "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 >&5'
</span><span class="cx"> ac_compiler_gnu=$ac_cv_objc_compiler_gnu
</span><span class="cx"> if test -n "$ac_tool_prefix"; 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 "$ac_tool_prefix$ac_prog", 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 "$OBJC"; 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 "$ac_prog", 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 "x$UNIVERSAL_ARCHS" = "x"; then
</span><span class="cx"> case "$MACOSX_VERSION" in
</span><ins>+ 10.1[0-9]*)
+ UNIVERSAL_ARCHS="x86_64 i386"
+ ;;
</ins><span class="cx"> 10.[0-5]*)
</span><span class="cx"> UNIVERSAL_ARCHS="i386 ppc"
</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="$UNIVERSAL_ARCHFLAGS -arch $arch"
+ done
+
</ins><span class="cx"> { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Universal CPU architectures" >&5
</span><span class="cx"> $as_echo_n "checking for Universal CPU architectures... " >&6; }
</span><span class="cx"> { $as_echo "$as_me:${as_lineno-$LINENO}: result: $UNIVERSAL_ARCHS" >&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 "ac_cv_header_$ac_header" | $as_tr_sh`
</span><span class="cx"> ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
</span><span class="lines">@@ -8844,7 +8669,9 @@
</span><span class="cx"> INCLUDES="-I.. -I. $INCLUDES"
</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 "ac_cv_func_$ac_func" | $as_tr_sh`
</span><span class="cx"> ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
</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 "$as_me:${as_lineno-$LINENO}: checking for Tcl target platform" >&5
+$as_echo_n "checking for Tcl target platform... " >&6; }
+ OS_PLATFORM=`echo 'puts -nonewline [string tolower \$tcl_platform(os)]' | $TCLSH`
+ OS_MAJOR=`echo 'puts -nonewline [lindex [split \$tcl_platform(osVersion) .] 0]' | $TCLSH`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OS_PLATFORM $OS_MAJOR" >&5
+$as_echo "$OS_PLATFORM $OS_MAJOR" >&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 "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+
+                { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether trace mode is supported on this platform" >&5
+$as_echo_n "checking whether trace mode is supported on this platform... " >&6; }
+                if test x"${OS_PLATFORM}" != "xdarwin"; then
+                        { $as_echo "$as_me:${as_lineno-$LINENO}: result: not darwin, no" >&5
+$as_echo "not darwin, no" >&6; }
+                        TRACEMODE_SUPPORT=0
+                elif test x"${ac_cv_func_kqueue}" != "xyes"; then
+                        { $as_echo "$as_me:${as_lineno-$LINENO}: result: kqueue() not available, no" >&5
+$as_echo "kqueue() not available, no" >&6; }
+                        TRACEMODE_SUPPORT=0
+                elif test x"${ac_cv_func_kevent}" != "xyes"; then
+                        { $as_echo "$as_me:${as_lineno-$LINENO}: result: kevent() not available, no" >&5
+$as_echo "kevent() not available, no" >&6; }
+                        TRACEMODE_SUPPORT=0
+                else
+                        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+                                #include <sys/types.h>
+                                #include <sys/event.h>
+                                #include <sys/time.h>
+                                #ifdef EV_RECEIPT
+                                yes_have_ev_receipt
+                                #endif
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "yes_have_ev_receipt" >/dev/null 2>&1; then :
+
+                                { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+                                TRACEMODE_SUPPORT=1
+
+$as_echo "#define HAVE_TRACEMODE_SUPPORT 1" >>confdefs.h
+
+
+else
+
+                                { $as_echo "$as_me:${as_lineno-$LINENO}: result: EV_RECEIPT not available, no" >&5
+$as_echo "EV_RECEIPT not available, no" >&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="$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"
</del><ins>+ac_config_files="$ac_config_files Doxyfile Makefile Mk/macports.autoconf.mk doc/base.mtree doc/macosx.mtree doc/macports.conf doc/prefix.mtree doc/pubkeys.conf portmgr/freebsd/Makefile setupenv.bash src/Makefile src/machista1.0/Makefile src/macports1.0/macports_autoconf.tcl src/macports1.0/macports_test_autoconf.tcl src/macports1.0/macports_fastload.tcl src/package1.0/package_test_autoconf.tcl src/pextlib1.0/Makefile src/port1.0/port_autoconf.tcl src/port1.0/port_test_autoconf.tcl src/programs/Makefile src/registry2.0/registry_autoconf.tcl"
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx"> ac_config_files="$ac_config_files src/pkg_mkindex.sh"
</span><span class="lines">@@ -10851,9 +10756,12 @@
</span><span class="cx"> "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
</span><span class="cx"> "src/machista1.0/Makefile") CONFIG_FILES="$CONFIG_FILES src/machista1.0/Makefile" ;;
</span><span class="cx"> "src/macports1.0/macports_autoconf.tcl") CONFIG_FILES="$CONFIG_FILES src/macports1.0/macports_autoconf.tcl" ;;
</span><ins>+ "src/macports1.0/macports_test_autoconf.tcl") CONFIG_FILES="$CONFIG_FILES src/macports1.0/macports_test_autoconf.tcl" ;;
</ins><span class="cx"> "src/macports1.0/macports_fastload.tcl") CONFIG_FILES="$CONFIG_FILES src/macports1.0/macports_fastload.tcl" ;;
</span><ins>+ "src/package1.0/package_test_autoconf.tcl") CONFIG_FILES="$CONFIG_FILES src/package1.0/package_test_autoconf.tcl" ;;
</ins><span class="cx"> "src/pextlib1.0/Makefile") CONFIG_FILES="$CONFIG_FILES src/pextlib1.0/Makefile" ;;
</span><span class="cx"> "src/port1.0/port_autoconf.tcl") CONFIG_FILES="$CONFIG_FILES src/port1.0/port_autoconf.tcl" ;;
</span><ins>+ "src/port1.0/port_test_autoconf.tcl") CONFIG_FILES="$CONFIG_FILES src/port1.0/port_test_autoconf.tcl" ;;
</ins><span class="cx"> "src/programs/Makefile") CONFIG_FILES="$CONFIG_FILES src/programs/Makefile" ;;
</span><span class="cx"> "src/registry2.0/registry_autoconf.tcl") CONFIG_FILES="$CONFIG_FILES src/registry2.0/registry_autoconf.tcl" ;;
</span><span class="cx"> "src/pkg_mkindex.sh") CONFIG_FILES="$CONFIG_FILES src/pkg_mkindex.sh" ;;
</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 "$MACOSX_VERSION" 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="-I.. -I. $INCLUDES"
</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"> .\" portfile.7
</span><span class="cx"> .\"
</span><del>-.\" Copyright (c) 2004-2013 The MacPorts Project
</del><ins>+.\" Copyright (c) 2004-2014 The MacPorts Project
</ins><span class="cx"> .\" Copyright (c) 2002-2003 Apple Inc.
</span><span class="cx"> .\" All rights reserved.
</span><span class="cx"> .\"
</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"> .\" 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 &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) == "" || $values(last_mod_date) != $mod_date } {
</del><ins>+                                if { $values(last_mod_date) eq "" || $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 != "" } {
</del><ins>+                        if { $post ne "" } {
</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] == "--create-tables"} {
</del><ins>+ if {[lindex $argv 0] eq "--create-tables"} {
</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="8_powerpc 8_i386 9_powerpc 9_i386 10_i386 11_i386 12_i386"
</del><ins>+PLATFORMS="8_powerpc 8_i386 9_powerpc 9_i386 10_i386 11_i386 12_i386 13_i386"
</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)] && [string length $portInfo($dependencyType)] > 0} {
</del><ins>+ if {[info exists portInfo($dependencyType)] && $portInfo($dependencyType) ne ""} {
</ins><span class="cx"> foreach dependency $portInfo($dependencyType) {
</span><span class="cx"> set afterColon [expr {[string last ":" $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 && [regexp {[0-9.+]+} [string range $license [expr $dash + 1] end]]} {
- return [string range $license 0 [expr $dash - 1]]
</del><ins>+ if {$dash != -1 && [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 "AS IS"
</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 "Debug: "
- }
- error {
-         return "Error: "
- }
- warn {
-         return "Warning: "
- }
- default {
-         return ""
- }
- }
</del><ins>+        switch $priority {
+                debug {
+                        return "Debug: "
+                }
+                error {
+                        return "Error: "
+                }
+                warn {
+                        return "Warning: "
+                }
+                default {
+                        return ""
+                }
+        }
</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] && [string length $logfd] > 0 } {
</del><ins>+        if {[info exists logfd] && $logfd ne ""} {
</ins><span class="cx">                 return {$logfd}
</span><del>-        } elseif {$message(priority) != "debug"} {
</del><ins>+        } elseif {$message(priority) ne "debug"} {
</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 "$result."
</span><span class="cx">                 puts "Have you initialized the build system? Use the -i flag:"
</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 "Internal error: $name missing some portinfo keys"
</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)] && ${anyplatform_flag} != "true"} {
</span><span class="lines">@@ -555,7 +555,7 @@
</span><span class="cx">                 }
</span><span class="cx">
</span><span class="cx">                 ui_silent "Package build for $portinfo(name) succeeded"
</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 ""
</span><span class="cx">
</span><span class="cx">         foreach {binary port} $requiredports {
</span><del>-                if {[find_binary $binary] == ""} {
</del><ins>+                if {[find_binary $binary] eq ""} {
</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] >= 0 } {
</del><ins>+                if {[lsearch -exact $port $rundeps] >= 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 ""
</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 "$errorInfo"
</span><span class="lines">@@ -718,8 +718,8 @@
</span><span class="cx">                 }
</span><span class="cx">                 ui_msg "Done."
</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 "Fatal error: $result."
</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 "Internal error: $name missing some portinfo keys"
</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 "lappend depends $portinfo(depends_run)" }
</span><span class="cx">                 if {[info exists portinfo(depends_lib)]} { eval "lappend depends $portinfo(depends_lib)" }
</span><del>-                if {$includeBuildDeps == "true" && [info exists portinfo(depends_build)]} {
</del><ins>+                if {$includeBuildDeps == "true" && [info exists portinfo(depends_build)]} {
</ins><span class="cx">                         eval "lappend depends $portinfo(depends_build)"
</span><span class="cx">                 }
</span><del>-                if {$includeBuildDeps == "true" && [info exists portinfo(depends_fetch)]} {
</del><ins>+                if {$includeBuildDeps == "true" && [info exists portinfo(depends_fetch)]} {
</ins><span class="cx">                         eval "lappend depends $portinfo(depends_fetch)"
</span><span class="cx">                 }
</span><del>-                if {$includeBuildDeps == "true" && [info exists portinfo(depends_extract)]} {
</del><ins>+                if {$includeBuildDeps == "true" && [info exists portinfo(depends_extract)]} {
</ins><span class="cx">                         eval "lappend depends $portinfo(depends_extract)"
</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 "AS IS"
</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 == "XFree86"} { return {} }
</span><del>-        
</del><ins>+
</ins><span class="cx">         if {[catch {set res [mportsearch "^$portname\$"]} error]} {
</span><span class="cx">                 puts stderr "Internal error: port search failed: $error"
</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 "lappend depends $portinfo(depends_run)" }
</span><span class="cx">                 if {[info exists portinfo(depends_lib)]} { eval "lappend depends $portinfo(depends_lib)" }
</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 "lappend dependencies $result"
</span><span class="cx">                         }
</span><span class="cx">                 }
</span><del>-                
</del><ins>+
</ins><span class="cx">                 set pkgname "${portname}-${portversion}.pkg"
</span><span class="cx">                 lappend dependencies $pkgname
</span><span class="cx">                 set pkgpath "${basepath}/${category}/${pkgname}"
</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 == ""} {
-        set long_description $description
- }
</del><ins>+        set fd [open ${filename} w+]
+        if {$long_description eq ""} {
+                set long_description $description
+        }
</ins><span class="cx">
</span><span class="cx"> puts $fd "
</span><span class="cx"> <html lang=\"en\">
</span><span class="lines">@@ -137,15 +137,15 @@
</span><span class="cx"> <font face=\"Helvetica\">${long_description}</font>
</span><span class="cx"> <p>"
</span><span class="cx">
</span><del>- if {$homepage != ""} {
-        puts $fd "<font face=\"Helvetica\">${homepage}</font><p>"
- }
</del><ins>+        if {$homepage ne ""} {
+                puts $fd "<font face=\"Helvetica\">${homepage}</font><p>"
+        }
</ins><span class="cx">
</span><del>- puts $fd "<font face=\"Helvetica\">This installer guides you through the steps necessary to install ${portname} ${portversion} for Mac OS X. To get started, click Continue.</font>
</del><ins>+        puts $fd "<font face=\"Helvetica\">This installer guides you through the steps necessary to install ${portname} ${portversion} for Mac OS X. To get started, click Continue.</font>
</ins><span class="cx"> </body>
</span><span class="cx"> </html>"
</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 "."]
</span><del>-        
-        if {[string index $destination end] != "/"} {
</del><ins>+
+        if {[string index $destination end] ne "/"} {
</ins><span class="cx">                 append destination /
</span><span class="cx">         }
</span><del>-        
</del><ins>+
</ins><span class="cx">         set depxml ""
</span><span class="cx">         foreach dep $dependencies {
</span><span class="cx">                 append depxml "<dict>
</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 "$argv0: $args"
- exit
</del><ins>+        global argv0
+        puts stderr "$argv0: $args"
+        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 "Failed to initialize ports system, $result"
- exit 1
</del><ins>+        puts "Failed to initialize ports system, $result"
+        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 ".*"
</del><ins>+        lappend argv ".*"
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> foreach pname $argv {
</span><ins>+        if {[catch {set res [mportsearch "^${pname}\$"]} result]} {
+                puts "port search failed: $result"
+                exit 1
+        }
</ins><span class="cx">
</span><del>-if {[catch {set res [mportsearch "^${pname}\$"]} result]} {
-        puts "port search failed: $result"
-        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 "Internal error: no porturl for $name"
+                        continue
+                }
</ins><span class="cx">
</span><del>-        if {![info exists portinfo(porturl)]} {
-                puts stderr "Internal error: no porturl for $name"
-                continue
-        }
-        
-        set pkgbase "/darwinports/pkgs/"
-        set mpkgbase "/darwinports/mpkgs/"
-        set porturl $portinfo(porturl)
-        set prefix "/opt/local"
</del><ins>+                set pkgbase "/darwinports/pkgs/"
+                set mpkgbase "/darwinports/mpkgs/"
+                set porturl $portinfo(porturl)
+                set prefix "/opt/local"
</ins><span class="cx">
</span><del>-        # Skip up-to-date packages
-        if {[regsub {^file://} $portinfo(porturl) "" portpath]} {
-                if {[info exists portinfo(name)] &&
-                        [info exists portinfo(version)] &&
-                        [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] && ([file mtime ${mpkgfile}] > [file mtime ${portpath}/Portfile])} {
-                                puts stderr "Skipping ${portname}-${portversion}; meta-package is up to date."
-                                continue
</del><ins>+                # Skip up-to-date packages
+                if {[regsub {^file://} $portinfo(porturl) "" portpath]} {
+                        if {[info exists portinfo(name)] &&
+                                [info exists portinfo(version)] &&
+                                [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] && ([file mtime ${mpkgfile}] > [file mtime ${portpath}/Portfile])} {
+                                        puts stderr "Skipping ${portname}-${portversion}; meta-package is up to date."
+                                        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 ""
-        set portversion ""
-        set description ""
-        set long_description ""
-        set homepage ""
-        set category ""
</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 "meta-packaging ${category}/${portname}-${portversion}"
</del><ins>+                # Building the mpkg:
+                # - create an mpkg skeleton
+                # - copy dependent pkgs into Contents/Resources directory
</ins><span class="cx">
</span><del>-        set mpkgpath "${mpkgbase}/${category}/${portname}-${portversion}.mpkg"
</del><ins>+                set portname ""
+                set portversion ""
+                set description ""
+                set long_description ""
+                set homepage ""
+                set category ""
</ins><span class="cx">
</span><del>-        if {[catch {system "mkdir -p -m 0755 ${mpkgpath}/Contents/Resources"} error]} {
-                puts stderr "Internal error: $error"
-        }
-        
-        # 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 "${mpkgpath}/Contents/Resources/"]
-        if {$result == -1} {
-                puts stderr "aborting; one or more dependencies was missing."
-                if {[catch {system "rm -R ${mpkgpath}"} 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 "meta-packaging ${category}/${portname}-${portversion}"
+
+                set mpkgpath "${mpkgbase}/${category}/${portname}-${portversion}.mpkg"
+
+                if {[catch {system "mkdir -p -m 0755 ${mpkgpath}/Contents/Resources"} error]} {
</ins><span class="cx">                         puts stderr "Internal error: $error"
</span><span class="cx">                 }
</span><del>-                continue
-        } else {
-                set result [lsort -uniq $result]
-                eval "lappend dependencies $result"
-        }
-        
-        #
-        # 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 ""
-        } 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 "${mpkgpath}/Contents/Resources/"]
+                if {$result == -1} {
+                        puts stderr "aborting; one or more dependencies was missing."
+                        if {[catch {system "rm -R ${mpkgpath}"} error]} {
+                                puts stderr "Internal error: $error"
+                        }
+                        continue
+                } else {
+                        set result [lsort -uniq $result]
+                        eval "lappend dependencies $result"
+                }
+
+                #
+                # 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 ""
+                        } 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 "AS IS"
</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) == "yes"} {
-         return 1
</del><ins>+        global ui_options
+        if {[info exists ui_options($val)]} {
+                if {$ui_options($val) eq "yes"} {
+                        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 "DEBUG: "
- }
- error {
-         return "Error: "
- }
- warn {
-         return "Warning: "
- }
- default {
-         return ""
- }
- }
</del><ins>+        switch $priority {
+                debug {
+                        return "DEBUG: "
+                }
+                error {
+                        return "Error: "
+                }
+                warn {
+                        return "Warning: "
+                }
+                default {
+                        return ""
+                }
+        }
</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] > 0 } {
-        log_message $logfd $message
- }
</del><ins>+        global logfd
+        if {$logfd ne ""} {
+                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 "^$portname\$"]} error]} {
</span><span class="cx">                 global errorInfo
</span><span class="cx">                 ui_debug "$errorInfo"
</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 "Internal error: $name missing some portinfo keys"
</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 "lappend depends $portinfo(depends_run)" }
</span><span class="cx">                 if {[info exists portinfo(depends_lib)]} { eval "lappend depends $portinfo(depends_lib)" }
</span><del>-                if {$includeBuildDeps != "" && [info exists portinfo(depends_build)]} {
</del><ins>+                if {$includeBuildDeps ne "" && [info exists portinfo(depends_build)]} {
</ins><span class="cx">                         eval "lappend depends $portinfo(depends_build)"
</span><span class="cx">                 }
</span><del>-                if {$includeBuildDeps != "" && [info exists portinfo(depends_fetch)]} {
</del><ins>+                if {$includeBuildDeps ne "" && [info exists portinfo(depends_fetch)]} {
</ins><span class="cx">                         eval "lappend depends $portinfo(depends_fetch)"
</span><span class="cx">                 }
</span><del>-                if {$includeBuildDeps != "" && [info exists portinfo(depends_extract)]} {
</del><ins>+                if {$includeBuildDeps ne "" && [info exists portinfo(depends_extract)]} {
</ins><span class="cx">                         eval "lappend depends $portinfo(depends_extract)"
</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 "installing binary: $pkgpath"
</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 "$argv0: $args"
- exit
</del><ins>+        global argv0
+        puts stderr "$argv0: $args"
+        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 "Failed to initialize ports system, $result"
- exit 1
</del><ins>+        puts "Failed to initialize ports system, $result"
+        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 "^${pname}\$"]} result]} {
+                puts "port search failed: $result"
+                exit 1
+        }
</ins><span class="cx">
</span><del>-if {[catch {set res [mportsearch "^${pname}\$"]} result]} {
-        puts "port search failed: $result"
-        exit 1
-}
</del><ins>+        set logpath "/darwinports/logs"
+        set logfd ""
</ins><span class="cx">
</span><del>-set logpath "/darwinports/logs"
-set logfd ""
</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 "Internal error: no porturl for $name"
+                        continue
+                }
</ins><span class="cx">
</span><del>-        if {![info exists portinfo(porturl)]} {
-                puts stderr "Internal error: no porturl for $name"
-                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) "" portpath]} {
-                if {[info exists portinfo(name)] &&
-                        [info exists portinfo(version)] &&
-                        [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] && ([file mtime ${pkgfile}] > [file mtime ${portpath}/Portfile])} {
-                                puts stderr "Skipping ${portname}-${portversion}; package is up to date."
-                                continue
</del><ins>+                # Skip up-to-date packages
+                if {[regsub {^file://} $portinfo(porturl) "" portpath]} {
+                        if {[info exists portinfo(name)] &&
+                                [info exists portinfo(version)] &&
+                                [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] && ([file mtime ${pkgfile}] > [file mtime ${portpath}/Portfile])} {
+                                        puts stderr "Skipping ${portname}-${portversion}; package is up to date."
+                                        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 "removing /opt/local"
-        #unset ui_options(ports_verbose)
-        if {[catch {system "rm -Rf /opt/local"} error]} {
-                puts stderr "Internal error: $error"
-        }
-        if {[catch {system "rm -Rf /usr/X11R6"} error]} {
-                puts stderr "Internal error: $error"
-        }
-        if {[catch {system "rm -Rf /etc/X11"} error]} {
-                puts stderr "Internal error: $error"
-        }
-        if {[catch {system "rm -Rf /etc/fonts"} error]} {
-                puts stderr "Internal error: $error"
-        }
-        if {[catch {system "cd $env(HOME)/darwinports && make && make install"} error]} {
-                puts stderr "Internal error: $error"
-        }
-        if {[catch {system "rmdir /opt/local/var/db/dports/distfiles"} error]} {
-                puts stderr "Internal error: $error"
-        }
-        if {[catch {system "ln -s /darwinports/distfiles /opt/local/var/db/dports/distfiles"} error]} {
-                puts stderr "Internal error: $error"
-        }
-        #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] > 0} {
-                close $logfd
-                set logfd ""
-        }
-        #if {[file readable $logfilename]} {
-        #        if {[catch {system "<$logfilename /usr/sbin/sendmail -t"} error]} {
-        #                puts stderr "Internal error: $error"
-        #        }
-        #}
</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 "removing /opt/local"
+                #unset ui_options(ports_verbose)
+                if {[catch {system "rm -Rf /opt/local"} error]} {
+                        puts stderr "Internal error: $error"
+                }
+                if {[catch {system "rm -Rf /usr/X11R6"} error]} {
+                        puts stderr "Internal error: $error"
+                }
+                if {[catch {system "rm -Rf /etc/X11"} error]} {
+                        puts stderr "Internal error: $error"
+                }
+                if {[catch {system "rm -Rf /etc/fonts"} error]} {
+                        puts stderr "Internal error: $error"
+                }
+                if {[catch {system "cd $env(HOME)/darwinports && make && make install"} error]} {
+                        puts stderr "Internal error: $error"
+                }
+                if {[catch {system "rmdir /opt/local/var/db/dports/distfiles"} error]} {
+                        puts stderr "Internal error: $error"
+                }
+                if {[catch {system "ln -s /darwinports/distfiles /opt/local/var/db/dports/distfiles"} error]} {
+                        puts stderr "Internal error: $error"
+                }
+                #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 ""} {
+                        close $logfd
+                        set logfd ""
+                }
+                #if {[file readable $logfilename]} {
+                #        if {[catch {system "<$logfilename /usr/sbin/sendmail -t"} error]} {
+                #                puts stderr "Internal error: $error"
+                #        }
+                #}
</ins><span class="cx">
</span><del>-        set lint_errors {}
-        set portname ""
-        set portversion ""
-        set description ""
-        set category ""
</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 "missing name key"
-                set valid 0
-        } else {
-                set portname $portinfo(name)
-        }
-        
-        if {![info exists portinfo(description)]} {
-                lappend lint_errors "missing description key"
-                set valid 0
-        } else {
-                set description $portinfo(description)
-        }
-        
-        if {![info exists portinfo(version)]} {
-                lappend lint_errors "missing version key"
-                set valid 0
-        } else {
-                set portversion $portinfo(version)
-        }
-        
-        if {![info exists portinfo(categories)]} {
-                lappend lint_errors "missing categories key"
-                set valid 0
-        } else {
-                set category [lindex $portinfo(categories) 0]
-        }
-        
-        if {![info exists portinfo(maintainers)]} {
-                append lint_errors "missing maintainers key"
-                set valid 0
-                set maintainers kevin@opendarwin.org
-        } else {
-                set maintainers $portinfo(maintainers)
-        }
-        
-        pkg_ui_log "To: [join $maintainers {, }]"
-        pkg_ui_log "From: donotreply@opendarwin.org"
-        pkg_ui_log "Subject: MacPorts $portinfo(name)-$portinfo(version) build failure"
-        pkg_ui_log ""
-        pkg_ui_log "The following is a transcript produced by the MacPorts automated build "
-        pkg_ui_log "system. You are receiving this email because you are listed as a maintainer "
-        pkg_ui_log "of this port, which has failed the automated packaging process. Please update "
-        pkg_ui_log "the port as soon as possible."
-        pkg_ui_log ""
-        pkg_ui_log ""
-        pkg_ui_log "Thank you,"
-        pkg_ui_log "The MacPorts Team"
-        pkg_ui_log ""
-        pkg_ui_log "================================================================================"
-        pkg_ui_log ""
</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 ""
+                set portversion ""
+                set description ""
+                set category ""
+
+                if {![info exists portinfo(name)]} {
+                        lappend lint_errors "missing name key"
+                        set valid 0
+                } else {
+                        set portname $portinfo(name)
</ins><span class="cx">                 }
</span><del>-        }
</del><span class="cx">
</span><del>-        ui_msg "packaging ${category}/${portname}-${portversion}"
</del><ins>+                if {![info exists portinfo(description)]} {
+                        lappend lint_errors "missing description key"
+                        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 "lappend depends $portinfo(depends_run)" }
-        #if {[info exists portinfo(depends_lib)]} { eval "lappend depends $portinfo(depends_lib)" }
-        #if {[info exists portinfo(depends_build)]} { eval "lappend depends $portinfo(depends_build)" }
-        #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 "missing version key"
+                        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 "missing categories key"
+                        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 "$errorInfo"
-         ui_error "Internal error: unable to open port: $result"
-         continue
-        }        
-        if {[catch {set result [mportexec $workername pkg]} result] ||
-                $result == 1} {
-                global errorInfo
-                ui_debug "$errorInfo"
-         ui_error "port package failed: $result"
-                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 "missing maintainers key"
+                        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 "To: [join $maintainers {, }]"
+                pkg_ui_log "From: donotreply@opendarwin.org"
+                pkg_ui_log "Subject: MacPorts $portinfo(name)-$portinfo(version) build failure"
+                pkg_ui_log ""
+                pkg_ui_log "The following is a transcript produced by the MacPorts automated build                 "
+                pkg_ui_log "system. You are receiving this email because you are listed as a maintainer        "
+                pkg_ui_log "of this port, which has failed the automated packaging process. Please update        "
+                pkg_ui_log "the port as soon as possible."
+                pkg_ui_log ""
+                pkg_ui_log ""
+                pkg_ui_log "Thank you,"
+                pkg_ui_log "The MacPorts Team"
+                pkg_ui_log ""
+                pkg_ui_log "================================================================================"
+                pkg_ui_log ""
</ins><span class="cx">
</span><del>-        # We made it to the end. We can delete the log file.
-        close $logfd
-        set logfd ""
-        file delete ${logpath}/${name}.log
-}
</del><ins>+                if {!$valid} {
+                        foreach error $lint_errors {
+                                ui_error $error
+                        }
+                }
</ins><span class="cx">
</span><ins>+                ui_msg "packaging ${category}/${portname}-${portversion}"
+
+                # Install binary dependencies if we can, to speed things up.
+                #set depends {}
+                #if {[info exists portinfo(depends_run)]} { eval "lappend depends $portinfo(depends_run)" }
+                #if {[info exists portinfo(depends_lib)]} { eval "lappend depends $portinfo(depends_lib)" }
+                #if {[info exists portinfo(depends_build)]} { eval "lappend depends $portinfo(depends_build)" }
+                #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 "$errorInfo"
+                        ui_error "Internal error: unable to open port: $result"
+                        continue
+                }
+                if {[catch {set result [mportexec $workername pkg]} result] ||
+                        $result == 1} {
+                        global errorInfo
+                        ui_debug "$errorInfo"
+                        ui_error "port package failed: $result"
+                        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 ""
+                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 "AS IS"
</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) == "yes"} {
-         return 1
</del><ins>+        global ui_options
+        if {[info exists ui_options($val)]} {
+                if {$ui_options($val) eq "yes"} {
+                        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) "/darwinports/rpms"
</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 "DEBUG: "
- }
- error {
-         return "Error: "
- }
- warn {
-         return "Warning: "
- }
- default {
-         return ""
- }
- }
</del><ins>+        switch $priority {
+                debug {
+                        return "DEBUG: "
+                }
+                error {
+                        return "Error: "
+                }
+                warn {
+                        return "Warning: "
+                }
+                default {
+                        return ""
+                }
+        }
</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] > 0 } {
-        log_message $logfd $message
- }
</del><ins>+        global logfd
+        if {$logfd ne ""} {
+                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 "^$portname\$"]} error]} {
</span><span class="cx">                 global errorInfo
</span><span class="cx">                 ui_debug "$errorInfo"
</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 "Internal error: $name missing some portinfo keys"
</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 "lappend depends $portinfo(depends_run)" }
</span><span class="cx">                 if {[info exists portinfo(depends_lib)]} { eval "lappend depends $portinfo(depends_lib)" }
</span><del>-                if {$includeBuildDeps != "" && [info exists portinfo(depends_build)]} {
</del><ins>+                if {$includeBuildDeps ne "" && [info exists portinfo(depends_build)]} {
</ins><span class="cx">                         eval "lappend depends $portinfo(depends_build)"
</span><span class="cx">                 }
</span><del>-                if {$includeBuildDeps != "" && [info exists portinfo(depends_fetch)]} {
</del><ins>+                if {$includeBuildDeps ne "" && [info exists portinfo(depends_fetch)]} {
</ins><span class="cx">                         eval "lappend depends $portinfo(depends_fetch)"
</span><span class="cx">                 }
</span><del>-                if {$includeBuildDeps != "" && [info exists portinfo(depends_extract)]} {
</del><ins>+                if {$includeBuildDeps ne "" && [info exists portinfo(depends_extract)]} {
</ins><span class="cx">                         eval "lappend depends $portinfo(depends_extract)"
</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 "$argv0: $args"
- exit
</del><ins>+        global argv0
+        puts stderr "$argv0: $args"
+        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 "Failed to initialize ports system, $result"
- exit 1
</del><ins>+        puts "Failed to initialize ports system, $result"
+        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 "^${pname}\$"]} result]} {
+                puts "port search failed: $result"
+                exit 1
+        }
</ins><span class="cx">
</span><del>-if {[catch {set allpackages [mportsearch "^${pname}\$"]} result]} {
-        puts "port search failed: $result"
-        exit 1
-}
</del><ins>+        set logpath "/darwinports/logs"
+        set logfd ""
</ins><span class="cx">
</span><del>-set logpath "/darwinports/logs"
-set logfd ""
</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 "foo $portinfo(porturl)"
</ins><span class="cx">
</span><del>-        #ui_msg "foo $portinfo(porturl)"
</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 "Internal error: no porturl for $name"
+                        continue
+                }
+                if {![info exists portinfo(revision)]} {
+                        set portinfo(revision) 0
+                }
</ins><span class="cx">
</span><del>-        if {![info exists portinfo(porturl)]} {
-                puts stderr "Internal error: no porturl for $name"
-                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) "" portpath]} {
+                        if {[info exists portinfo(name)] &&
+                                [info exists portinfo(version)] &&
+                                [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) "" portpath]} {
-                if {[info exists portinfo(name)] &&
-                        [info exists portinfo(version)] &&
-                        [info exists portinfo(revision)]} {
-                        set portname $portinfo(name)
-                        set portversion $portinfo(version)
-                        set revision $portinfo(revision)
-
-                        foreach dir {"/opt/local/src/apple/RPMS" "/usr/src/apple/RPMS" "/darwinports/rpms/RPMS"} {
-                                foreach arch {"ppc" "i386" "fat"} {
-                                        set rpmpath "${dir}/${arch}/${portname}-${portversion}-${revision}.${arch}.rpm"
-                                        #ui_msg "trying ${rpmpath}"
-                                        if {[file readable $rpmpath] && ([file mtime ${rpmpath}] >= [file mtime ${portpath}/Portfile])} {
-                                                puts stderr "-> skipping ${portname}-${portversion}; package is up to date."
-                                                set exit_loop true
</del><ins>+                                foreach dir {"/opt/local/src/apple/RPMS" "/usr/src/apple/RPMS" "/darwinports/rpms/RPMS"} {
+                                        foreach arch {"ppc" "i386" "fat"} {
+                                                set rpmpath "${dir}/${arch}/${portname}-${portversion}-${revision}.${arch}.rpm"
+                                                #ui_msg "trying ${rpmpath}"
+                                                if {[file readable $rpmpath] && ([file mtime ${rpmpath}] >= [file mtime ${portpath}/Portfile])} {
+                                                        puts stderr "-> skipping ${portname}-${portversion}; package is up to date."
+                                                        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) "" portpath]} {
+                        if {[info exists portinfo(name)] &&
+                                [info exists portinfo(version)] &&
+                                [info exists portinfo(revision)]} {
+                                set portname $portinfo(name)
+                                set portversion $portinfo(version)
+                                set revision $portinfo(revision)
+
+                                set logfilepath "${logpath}/${portname}.log"
+                                if {[file readable ${logfilepath}] && ([file mtime ${logfilepath}] > [file mtime ${portpath}/Portfile])} {
+                                        puts stderr "-> skipping ${portname}-${portversion}; package failed, but has not changed."
+                                        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) "" portpath]} {
-                if {[info exists portinfo(name)] &&
-                        [info exists portinfo(version)] &&
-                        [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 "${logpath}/${portname}.log"
-                        if {[file readable ${logfilepath}] && ([file mtime ${logfilepath}] > [file mtime ${portpath}/Portfile])} {
-                                puts stderr "-> skipping ${portname}-${portversion}; package failed, but has not changed."
-                                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 ""
+                foreach dir {"/opt/local/src/apple/RPMS" "/usr/src/apple/RPMS" "/darwinports/rpms/RPMS"} {
+                        foreach arch {"ppc" "i386" "fat"} {
+                                set remove_files "${remove_files} '${dir}/${arch}/'*.rpm"
</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 "rpm -q --queryformat='%{name} ' -p ${remove_files} | xargs rpm -e || true"
</ins><span class="cx">
</span><del>-        set remove_files ""
-        foreach dir {"/opt/local/src/apple/RPMS" "/usr/src/apple/RPMS" "/darwinports/rpms/RPMS"} {
-                foreach arch {"ppc" "i386" "fat"} {
-                        set remove_files "${remove_files} '${dir}/${arch}/'*.rpm"
</del><ins>+                ui_msg "->         Removing /opt/local"
+                #unset ui_options(ports_verbose)
+                if {[catch {system "rm -Rf /opt/local"} error]} {
+                        puts stderr "Internal error: $error"
</ins><span class="cx">                 }
</span><del>-        }
-        system "rpm -q --queryformat='%{name} ' -p ${remove_files} | xargs rpm -e || true"
</del><ins>+                # this is bad on pure darwin :)
+                #if {[catch {system "rm -Rf /usr/X11R6"} error]} {
+                #        puts stderr "Internal error: $error"
+                #}
+                #if {[catch {system "rm -Rf /etc/X11"} error]} {
+                #        puts stderr "Internal error: $error"
+                #}
+                #if {[catch {system "rm -Rf /etc/fonts"} error]} {
+                #        puts stderr "Internal error: $error"
+                #}
+                ui_msg "->         Installing MacPorts"
+                if {[catch {system "cd $env(HOME)/darwinports && make && make install"} error]} {
+                        puts stderr "Internal error: $error"
+                }
+                if {[catch {system "rmdir /opt/local/var/db/dports/distfiles"} error]} {
+                        puts stderr "Internal error: $error"
+                }
+                if {[catch {system "ln -s /darwinports/distfiles /opt/local/var/db/dports/distfiles"} error]} {
+                        puts stderr "Internal error: $error"
+                }
+                #set ui_options(ports_verbose) yes
</ins><span class="cx">
</span><del>-        ui_msg "-> Removing /opt/local"
-        #unset ui_options(ports_verbose)
-        if {[catch {system "rm -Rf /opt/local"} error]} {
-                puts stderr "Internal error: $error"
-        }
-        # this is bad on pure darwin :)
-        #if {[catch {system "rm -Rf /usr/X11R6"} error]} {
-        #        puts stderr "Internal error: $error"
-        #}
-        #if {[catch {system "rm -Rf /etc/X11"} error]} {
-        #        puts stderr "Internal error: $error"
-        #}
-        #if {[catch {system "rm -Rf /etc/fonts"} error]} {
-        #        puts stderr "Internal error: $error"
-        #}
-        ui_msg "-> Installing MacPorts"
-        if {[catch {system "cd $env(HOME)/darwinports && make && make install"} error]} {
-                puts stderr "Internal error: $error"
-        }
-        if {[catch {system "rmdir /opt/local/var/db/dports/distfiles"} error]} {
-                puts stderr "Internal error: $error"
-        }
-        if {[catch {system "ln -s /darwinports/distfiles /opt/local/var/db/dports/distfiles"} error]} {
-                puts stderr "Internal error: $error"
-        }
-        #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 ""} {
+                        close $logfd
+                        set logfd ""
+                }
+                #if {[file readable $logfilename]} {
+                #        if {[catch {system "<$logfilename /usr/sbin/sendmail -t"} error]} {
+                #                puts stderr "Internal error: $error"
+                #        }
+                #}
</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] > 0} {
-                close $logfd
-                set logfd ""
-        }
-        #if {[file readable $logfilename]} {
-        #        if {[catch {system "<$logfilename /usr/sbin/sendmail -t"} error]} {
-        #                puts stderr "Internal error: $error"
-        #        }
-        #}
</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 ""
+                set portversion ""
+                set description ""
+                set category ""
</ins><span class="cx">
</span><del>-        set lint_errors {}
-        set portname ""
-        set portversion ""
-        set description ""
-        set category ""
</del><ins>+                if {![info exists portinfo(name)]} {
+                        lappend lint_errors "missing name key"
+                        set valid 0
+                } else {
+                        set portname $portinfo(name)
+                }
</ins><span class="cx">
</span><del>-        if {![info exists portinfo(name)]} {
-                lappend lint_errors "missing name key"
-                set valid 0
-        } else {
-                set portname $portinfo(name)
-        }
-        
-        if {![info exists portinfo(description)]} {
-                lappend lint_errors "missing description key"
-                set valid 0
-        } else {
-                set description $portinfo(description)
-        }
-        
-        if {![info exists portinfo(version)]} {
-                lappend lint_errors "missing version key"
-                set valid 0
-        } else {
-                set portversion $portinfo(version)
-        }
-        
-        if {![info exists portinfo(categories)]} {
-                lappend lint_errors "missing categories key"
-                set valid 0
-        } else {
-                set category [lindex $portinfo(categories) 0]
-        }
-        
-        if {![info exists portinfo(maintainers)]} {
-                append lint_errors "missing maintainers key"
-                set valid 0
-                set maintainers kevin@opendarwin.org
-        } else {
-                set maintainers $portinfo(maintainers)
-        }
-        
-        pkg_ui_log "To: [join $maintainers {, }]"
-        pkg_ui_log "From: donotreply@opendarwin.org"
-        pkg_ui_log "Subject: MacPorts $portinfo(name)-$portinfo(version) build failure"
-        pkg_ui_log ""
-        pkg_ui_log "The following is a transcript produced by the MacPorts automated build "
-        pkg_ui_log "system. You are receiving this email because you are listed as a maintainer "
-        pkg_ui_log "of this port, which has failed the automated packaging process. Please update "
-        pkg_ui_log "the port as soon as possible."
-        pkg_ui_log ""
-        pkg_ui_log ""
-        pkg_ui_log "Thank you,"
-        pkg_ui_log "The MacPorts Team"
-        pkg_ui_log ""
-        pkg_ui_log "================================================================================"
-        pkg_ui_log ""
</del><ins>+                if {![info exists portinfo(description)]} {
+                        lappend lint_errors "missing description key"
+                        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 "missing version key"
+                        set valid 0
+                } else {
+                        set portversion $portinfo(version)
</ins><span class="cx">                 }
</span><del>-        }
</del><span class="cx">
</span><del>-        ui_msg "--> Packaging ${category}/${portname}-${portversion}"
</del><ins>+                if {![info exists portinfo(categories)]} {
+                        lappend lint_errors "missing categories key"
+                        set valid 0
+                } else {
+                        set category [lindex $portinfo(categories) 0]
+                }
</ins><span class="cx">
</span><del>-        foreach prebuild {"ccache" "rpm" "unzip"} {
-                if {![file exists /bin/${prebuild}] && ![file exists /usr/bin/${prebuild}]} {
-                        ui_msg "---> Pre-installing ${prebuild}"
-                        if {[catch {set search [mportsearch "^${prebuild}\$"]} error]} {
-                                global errorInfo
-                                ui_debug "$errorInfo"
-                                ui_error "Internal error: port search ${prebuild} failed: $error"
</del><ins>+                if {![info exists portinfo(maintainers)]} {
+                        append lint_errors "missing maintainers key"
+                        set valid 0
+                        set maintainers kevin@opendarwin.org
+                } else {
+                        set maintainers $portinfo(maintainers)
+                }
+
+                pkg_ui_log "To: [join $maintainers {, }]"
+                pkg_ui_log "From: donotreply@opendarwin.org"
+                pkg_ui_log "Subject: MacPorts $portinfo(name)-$portinfo(version) build failure"
+                pkg_ui_log ""
+                pkg_ui_log "The following is a transcript produced by the MacPorts automated build                 "
+                pkg_ui_log "system. You are receiving this email because you are listed as a maintainer        "
+                pkg_ui_log "of this port, which has failed the automated packaging process. Please update        "
+                pkg_ui_log "the port as soon as possible."
+                pkg_ui_log ""
+                pkg_ui_log ""
+                pkg_ui_log "Thank you,"
+                pkg_ui_log "The MacPorts Team"
+                pkg_ui_log ""
+                pkg_ui_log "================================================================================"
+                pkg_ui_log ""
+
+                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 "$errorInfo"
-                                ui_error "Internal error: unable to install ${prebuild}... exiting"
-                                exit 1
</del><ins>+                }
+
+                ui_msg "--> Packaging ${category}/${portname}-${portversion}"
+
+                foreach prebuild {"ccache" "rpm" "unzip"} {
+                        if {![file exists /bin/${prebuild}] && ![file exists /usr/bin/${prebuild}]} {
+                                ui_msg "---> Pre-installing ${prebuild}"
+                                if {[catch {set search [mportsearch "^${prebuild}\$"]} error]} {
+                                        global errorInfo
+                                        ui_debug "$errorInfo"
+                                        ui_error "Internal error: port search ${prebuild} failed: $error"
+                                }
+                                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 "$errorInfo"
+                                        ui_error "Internal error: unable to install ${prebuild}... exiting"
+                                        exit 1
+                                }
+                                if {[catch {set result [mportexec $workername activate]} result] ||
+                                        $result == 1} {
+                                        global errorInfo
+                                        ui_debug "$errorInfo"
+                                        ui_error "installation of ${prebuild} failed: $result"
+                                        mportclose $workername
+                                        exit 1
+                                }
</ins><span class="cx">                         }
</span><del>-                        if {[catch {set result [mportexec $workername activate]} result] ||
-                                $result == 1} {
-                                global errorInfo
-                                ui_debug "$errorInfo"
-                                ui_error "installation of ${prebuild} failed: $result"
-                                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 "$errorInfo"
-         ui_error "Internal error: unable to open port: $result"
-         continue
-        }
-        if {[catch {set result [mportexec $workername rpmpackage]} result] ||
-                $result == 1} {
-                global errorInfo
-                ui_debug "$errorInfo"
-         ui_error "port package failed: $result"
</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 "$errorInfo"
+                        ui_error "Internal error: unable to open port: $result"
+                        continue
+                }
+                if {[catch {set result [mportexec $workername rpmpackage]} result] ||
+                        $result == 1} {
+                        global errorInfo
+                        ui_debug "$errorInfo"
+                        ui_error "port package failed: $result"
+                        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 ""
+                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 ""
-        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 <inttypes.h> 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 <libkern/OSAtomic.h> 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 <openssl/sha.h> 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 <paths.h> 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 <sha.h> header file. */
</span><span class="cx"> #undef HAVE_SHA_H
</span><span class="cx">
</span><ins>+/* Define to 1 if you have the <spawn.h> header file. */
+#undef HAVE_SPAWN_H
+
</ins><span class="cx"> /* Define to 1 if you have the <sqlite3ext.h> 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 <sys/wait.h> 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 <unistd.h> 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 & S_IWUSR)) {
- can_write = 0;
- }
- } else if (sb.st_gid == getgid()) {
- if (!(sb.st_mode & S_IWGRP)) {
- can_write = 0;
- }
- } else if (!(sb.st_mode & S_IWOTH) && 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("ATTACH DATABASE '%q' AS registry", 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. "1.4.1"
</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. "1.4.2"
</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 < B; 0 if A = B; 1 if A > 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 < 0)
</span><del>- lengthA = strlen(versionA);
</del><ins>+ lengthA = (int)strlen(versionA);
</ins><span class="cx"> if (lengthB < 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 && !strncmp(versionA, versionB, lengthA))
</del><ins>+        if(lengthA == lengthB && !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 <pguyot@kallisys.net>,
+ * 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. ("Apple") 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 "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL 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 "darwintrace.h"
+
+#include <errno.h>
+#include <sys/syscall.h>
+#include <unistd.h>
+
+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("access(%s) = %d\n", 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 <pguyot@kallisys.net>,
+ * 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. ("Apple") 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 "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL 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 "darwintrace.h"
+
+#include <stdio.h>
+#include <sys/syscall.h>
+#include <unistd.h>
+
+/**
+ * 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 && 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 <config.h>
-#endif
</del><ins>+#define DARWINTRACE_USE_PRIVATE_API 1
+#include "darwintrace.h"
</ins><span class="cx">
</span><del>-#if HAVE_SYS_CDEFS_H
-#include <sys/cdefs.h>
</del><ins>+#ifdef HAVE_LIBKERN_OSATOMIC_H
+#include <libkern/OSAtomic.h>
</ins><span class="cx"> #endif
</span><span class="cx">
</span><del>-#if defined(_DARWIN_FEATURE_64_BIT_INODE) && !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 ""
-#undef _DARWIN_FEATURE_64_BIT_INODE
-#endif
-
-#ifdef HAVE_CRT_EXTERNS_H
-#include <crt_externs.h>
-#endif
-
-#ifdef HAVE_SYS_PATHS_H
-#include <sys/paths.h>
-#endif
-
-#include <ctype.h>
-#include <dirent.h>
-#include <dlfcn.h>
</del><span class="cx"> #include <errno.h>
</span><del>-#include <fcntl.h>
</del><span class="cx"> #include <pthread.h>
</span><del>-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
</del><span class="cx"> #include <string.h>
</span><ins>+#include <sys/attr.h>
</ins><span class="cx"> #include <sys/param.h>
</span><span class="cx"> #include <sys/socket.h>
</span><span class="cx"> #include <sys/stat.h>
</span><span class="lines">@@ -81,6 +54,14 @@
</span><span class="cx"> #include <sys/un.h>
</span><span class="cx"> #include <unistd.h>
</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 "../pextlib1.0/strlcat.c"
</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.
- * \: -> :
- * \\ -> \
- */
-
-/*
- * 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"> * <operation> :: '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__>=199901L
-# define debug_printf(format, ...) \
-        fprintf(stderr, "darwintrace[%d]: " 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("darwintrace: pthread_setspecific");
-                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("darwintrace: pthread_setspecific");
</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, "/") == 0) {
</del><ins>+        if (prefix[0] == '\0' || (prefix[0] == '/' && 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 && (p == s));
</span><del>-        return (p == 0 && (s == '/' || s == '\0'));
</del><ins>+        return (p == '\0' && (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 && (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("darwintrace: strdup");\
-                        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("darwintrace: malloc");
-                        abort();
-                }
-                snprintf(result, size, "%s=%s", name, val);
-                if (size > 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("DYLD_INSERT_LIBRARIES", __env_dyld_insert_libraries);
-        char *dyld_force_flat_namespace_ptr = __darwintrace_alloc_env("DYLD_FORCE_FLAT_NAMESPACE", __env_dyld_force_flat_namespace);
-        char *darwintrace_log_ptr = __darwintrace_alloc_env("DARWINTRACE_LOG", __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, "DYLD_INSERT_LIBRARIES=")) {
-                        val = dyld_insert_libraries_ptr;
-                        dyld_insert_libraries_ptr = NULL;
-                } else if (__darwintrace_strbeginswith(val, "DYLD_FORCE_FLAT_NAMESPACE=")) {
-                        val = dyld_force_flat_namespace_ptr;
-                        dyld_force_flat_namespace_ptr = NULL;
-                } else if (__darwintrace_strbeginswith(val, "DARWINTRACE_LOG=")) {
-                        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, "darwintrace: illegal state in dfa in " __FILE__ ":%d\n", __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, "darwintrace: unsupported state REPLACEPATH in dfa in " __FILE__ ":%d\n", __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 && 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__ && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 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 "No 64-bit compare and swap primitive available on 64-bit OS."
+#        endif
+#else
+#        ifdef HAVE_OSATOMICCOMPAREANDSWAP32
+#                define CAS(old, new, mem) OSAtomicCompareAndSwap32((int32_t) (old), (int32_t) (new), (volatile int32_t *) (mem))
+#        else
+#                error "No 32-bit compare and swap primitive available."
+#        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("filemap\t", (uint32_t) strlen("filemap\t"), 1);
</span><del>-        } while (!__sync_bool_compare_and_swap(&filemap, NULL, newfilemap));
</del><ins>+        } while (!CAS(NULL, newfilemap, &filemap));
</ins><span class="cx">
</span><span class="cx"> #if DARWINTRACE_DEBUG && 0
</span><span class="cx">         for (__darwintrace_filemap_iterator_init(&it);
</span><del>-         (path = __darwintrace_filemap_iter(&command, &replacement, &it));) {
-                debug_printf("filemap: {cmd=%d, path=%-120s, replacement=%s}\n", command, path, (command == 1) ? replacement : "-");
</del><ins>+         (path = __darwintrace_filemap_iter(&command, &it));) {
+                debug_printf("filemap: {cmd=%d, path=%s}\n", 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 > 0) && (strncmp(path, "/.vol/", 6) == 0)) {
-                        if (fcntl(fd, F_GETPATH, somepath) != -1) {
</del><ins>+#if defined(__APPLE__) && defined(ATTR_CMN_FULLPATH) && 0
+                if (false && strncmp(path, "/.vol/", 6) == 0) {
+                        // path in VOLFS, try to get inode -> 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, &attrlist, attrbuf, sizeof(attrbuf), FSOPT_NOFOLLOW))) {
+                                perror("darwintrace: getattrlist");
+                                // ignore and just print the /.vol/ path
+                        } else {
+                                attrreference_t *nameAttrRef = (attrreference_t *) (attrbuf + sizeof(uint32_t));
+                                strlcpy(pathbuf, ((char *) nameAttrRef) + nameAttrRef->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("darwintrace: getcwd");
</span><span class="cx">                                 abort();
</span><span class="cx">                         }
</span><span class="cx">
</span><del>-                        strlcat(somepath, "/", sizeof(somepath));
-                        strlcat(somepath, path, sizeof(somepath));
</del><ins>+                        strlcat(pathbuf, "/", 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), "%s\t%s", op, somepath);
</del><ins>+        size = snprintf(logbuffer, sizeof(logbuffer), "%s\t%s", 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 "foo//bar" to "foo/bar"
- */
-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 > rsrclen && 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, &st)) {
</del><ins>+        if (-1 == lstat(path, &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, "darwintrace: unexpected answer from tracelib: '%c' (0x%x)\n", *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("dependency_check: %s returned %d\n", 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] == '/' && 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("darwintrace: getcwd");
-                        abort();
</del><ins>+        if ((flags & DT_ALLOWDIR) > 0) {
+                struct stat st;
+                if (-1 != lstat(path, &st) && S_ISDIR(st.st_mode)) {
+                        return true;
</ins><span class="cx">                 }
</span><del>-                strlcat(lpath, "/", 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(&strpos, "/");
-                if (curpos == NULL) {
-                        /* reached the end of the path */
-                        break;
-                } else if (*curpos == '\0') {
-                        /* empty entry, ignore */
-                        continue;
-                } else if (strcmp(curpos, ".") == 0) {
-                        /* no-op directory, ignore */
-                        continue;
-                } else if (strcmp(curpos, "..") == 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, "/");
-                normpos++;
-                strcat(normpos, curpos);
-        }
-        if (*normalizedpath == '\0') {
-                strcat(normalizedpath, "/");
-        }
-
-        /* 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(&filemap_it);
</span><del>-         (t = __darwintrace_filemap_iter(&command, &replacementpath, &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(&command, &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("sandbox_violation", 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 & DT_REPORT) > 0) {
+                                                                __darwintrace_log_op("sandbox_violation", path);
+                                                        }
+                                                        return true;
</ins><span class="cx">                                                 case 0:
</span><del>-                                                        /* file belongs to a foreign port, deny access */
-                                                        if (report)
-                                                                __darwintrace_log_op("sandbox_violation", normalizedpath, 0);
-                                                        return 0;
</del><ins>+                                                        // file belongs to a foreign port, deny access
+                                                        if ((flags & DT_REPORT) > 0) {
+                                                                __darwintrace_log_op("sandbox_violation", path);
+                                                        }
+                                                        return false;
</ins><span class="cx">                                         }
</span><span class="cx">                                 default:
</span><span class="cx">                                         fprintf(stderr, "darwintrace: error: unexpected byte in file map: `%x'\n", *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("sandbox_violation", normalizedpath, 0);
-        return 0;
</del><ins>+        if ((flags & DT_REPORT) > 0) {
+                __darwintrace_log_op("sandbox_violation", 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("open(%s)\n", path);
-
-        *newpath = '\0';
-        if (!__darwintrace_is_in_sandbox(path, newpath, true)) {
-                debug_printf("open %s was forbidden\n", path);
-                errno = ((flags & O_CREAT) > 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("readlink(%s)\n", 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("darwintrace: getcwd");
+                        abort();
+                }
</ins><span class="cx">
</span><del>-        return readlink(path, buf, bufsiz);
-#undef readlink
-}
</del><ins>+                char *writableToken = normPath + 1;
+                while ((idx = strcspn(writableToken, "/")) > 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("execve(%s)\n", 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 -> mp-gcc-4.8, both "gcc_select" and
-         * "gcc48" 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, &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 > 0) {
-                        char buffer[MAXPATHLEN + 1];
-                        ssize_t bytes_read;
</del><ins>+                // copy path after the CWD into the buffer and normalize it
+                if (numComponents > 0) {
+                        path_component_t *lastComponent = pathComponents + (numComponents - 1);
+                        dst = lastComponent->start + lastComponent->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 > 2 && buffer[0] == '#' && 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 < buffer_end && isblank(*interp)) {
-                                        ++interp;
-                                }
-                                /* found interpreter (or ran out of data); skip until next
-                                 * whitespace, then terminate the string */
-                                if (interp < buffer_end) {
-                                        char *interp_end = interp;
-                                        strsep(&interp_end, " \t");
-                                }
</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, "/")) > 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] == '.' && (token[1] == '\0' || token[1] == '/')) {
+                        // reference to current directory, ignore
+                } else if (token[0] == '.' && token[1] == '.' && (token[2] == '\0' || token[2] == '/')) {
+                        // walk up one directory, but not if it's the last one, because /.. -> /
+                        if (numComponents > 0) {
+                                numComponents--;
+                                if (numComponents > 0) {
+                                        // move dst back to the previous entry
+                                        path_component_t *lastComponent = pathComponents + (numComponents - 1);
+                                        dst = lastComponent->start + lastComponent->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 && dtsock != __darwintrace_close_sock) {
-                        errno = EBADF;
-                        return -1;
</del><ins>+                // Add the slashes and the terminating \0
+                for (size_t i = 0; i < 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("dup2(%d, %d)\n", filedes, filedes2);
-        if (stream && 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 & 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("moving __darwintrace FD from %d to %d\n", fileno(stream), new_darwintrace_fd);
-                __darwintrace_close();
-                if (NULL == (new_stream = fdopen(new_darwintrace_fd, "a+"))) {
-                        perror("darwintrace: fdopen");
-                        abort();
</del><ins>+                if (++loopCount >= 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("unlink %s was forbidden\n", path);
-                errno = ENOENT;
-                return -1;
-        }
-
-        if (*newpath) {
-                path = newpath;
-        }
-
-        debug_printf("unlink %s was allowed\n", 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, &st)) {
-                        if (errno == ENOENT) {
-                                /* directory doesn't exist yet */
-                                debug_printf("mkdir was forbidden at %s\n", path);
-                                errno = EACCES;
-                                return -1;
</del><ins>+                //debug_printf("checking for symlink: %s\n", normPath);
+                if (lstat(normPath, &st) != -1 && 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("mkdir was allowed at %s\n", 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("darwintrace: readlink");
+                                abort();
+                        }
+                        link[linksize] = '\0';
+                        //debug_printf("readlink(%s) = %s\n", 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("removing directory %s was forbidden\n", 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 > 0) {
+                                        numComponents--;
+                                        if (numComponents > 0) {
+                                                // move dst back to the previous entry
+                                                path_component_t *lastComponent = pathComponents + (numComponents - 1);
+                                                dst = lastComponent->start + lastComponent->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("rmdir %s was allowed\n", path);
</del><ins>+                        while ((idx = strcspn(token, "/")) > 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] == '.' && (token[1] == '\0' || token[1] == '/')) {
+                                        // reference to current directory, ignore
+                                } else if (token[0] == '.' && token[1] == '.' && (token[2] == '\0' || token[2] == '/')) {
+                                        // walk up one directory, but not if it's the last one, because /.. -> /
+                                        if (numComponents > 0) {
+                                                numComponents--;
+                                                if (numComponents > 0) {
+                                                        // move dst back to the previous entry
+                                                        path_component_t *lastComponent = pathComponents + (numComponents - 1);
+                                                        dst = lastComponent->start + lastComponent->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("renaming from %s was forbidden\n", from);
-                errno = ENOENT;
-                return -1;
-        }
-        if (!__darwintrace_is_in_sandbox(to, NULL, true)) {
-                debug_printf("renaming to %s was forbidden\n", to);
-                errno = EACCES;
-                return -1;
-        }
</del><ins>+                                        // advance destination
+                                        dst += idx + 1;
+                                }
</ins><span class="cx">
</span><del>-        debug_printf("renaming from %s to %s was allowed\n", 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("stat(%s)\n", path);
-        if (-1 == (result = stat(path, sb))) {
-                return -1;
-        }
-
-        if (S_ISDIR(sb->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) && !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("stat64(%s)\n", path);
-        if (-1 == (result = stat64(path, sb))) {
-                return -1;
-        }
-
-        if (S_ISDIR(sb->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) && !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("lstat(%s)\n", path);
-        if (-1 == (result = lstat(path, sb))) {
-                return -1;
-        }
-
-        if (S_ISDIR(sb->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) && !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("lstat64(%s)\n", path);
-        if (-1 == (result = lstat64(path, sb))) {
-                return -1;
-        }
-
-        if (S_ISDIR(sb->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) && !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 < sz;) {
-                struct dirent64 *dent = (struct dirent64 *)(((char *) buf) + offset);
-                dirname[dnamelen] = '\0';
-                strcat(dirname, dent->d_name);
-                if (!__darwintrace_is_in_sandbox(dirname, NULL, false)) {
-                        debug_printf("__getdirentries64: filtered %s\n", dirname);
-                        dent->d_ino = 0;
-                } else {
-                        debug_printf("__getdirentries64: allowed %s\n", dirname);
</del><ins>+                                if (token[idx] == '\0') {
+                                        break;
+                                }
+                                token += idx + 1;
+                        }
</ins><span class="cx">                 }
</span><del>-                offset += dent->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 < sz;) {
-                struct dirent32 *dent = (struct dirent32 *)(buf + offset);
-                dirname[dnamelen] = '\0';
-                strcat(dirname, dent->d_name);
-                if (!__darwintrace_is_in_sandbox(dirname, NULL, false)) {
-                        debug_printf("getdirentries: filtered %s\n", dirname);
-                        dent->d_ino = 0;
-                } else {
-                        debug_printf("getdirentries: allowed %s\n", dirname);
-                }
-                offset += dent->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("access(%s, %d)\n", path, amode);
-
-        if (-1 == lstat(path, &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 <pguyot@kallisys.net>,
+ * 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. ("Apple") 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 "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL 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 <config.h>
+#endif
+
+#include <pthread.h>
+#include <stdbool.h>
+#include <stdio.h>
+
+/**
+ * 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
+ * "darwintrace" 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, "darwintrace[%d:%p]: " format, getpid(), (void *) pthread_self(), __VA_ARGS__); \
+                        fflush(__darwintrace_stderr); \
+                }
+#else
+# define debug_printf(...)
+#endif
+
+enum {
+        DT_REPORT = 1 << 0,
+        DT_ALLOWDIR = 1 << 1,
+        DT_FOLLOWSYMS = 1 << 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 <errno.h>
+#include <stdlib.h>
+
+/**
+ * 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("darwintrace: pthread_setspecific");
+                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 <pguyot@kallisys.net>,
+ * 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. ("Apple") 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 "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL 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 "darwintrace.h"
+
+#include <fcntl.h>
+#include <stdio.h>
+#include <sys/syscall.h>
+#include <unistd.h>
+
+/**
+ * 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 && 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, "a+"))) {
+                        perror("darwintrace: fdopen");
+                        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 <pguyot@kallisys.net>,
+ * 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. ("Apple") 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 "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL 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 "darwintrace.h"
+
+#include <errno.h>
+#include <sys/stat.h>
+#include <sys/syscall.h>
+#include <unistd.h>
+
+#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, &st) && 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("mkdir(%s) = %d\n", 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 <pguyot@kallisys.net>,
+ * 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. ("Apple") 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 "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL 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 "darwintrace.h"
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stdarg.h>
+#include <sys/syscall.h>
+#include <unistd.h>
+
+/**
+ * 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 & O_CREAT) > 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("open(%s) = %d\n", 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 <pguyot@kallisys.net>,
+ * 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. ("Apple") 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 "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL 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 "darwintrace.h"
+
+#include <ctype.h>
+#include <dlfcn.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/param.h>
+#include <sys/syscall.h>
+#include <sys/types.h>
+#include <sys/uio.h>
+#include <unistd.h>
+
+#if defined(HAVE_SPAWN_H) && defined(HAVE_POSIX_SPAWN)
+#include <spawn.h>
+#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("darwintrace: malloc");\
+                                abort();\
+                        }\
+                        strcpy(variable, #name);\
+                        strcat(variable, "=");\
+                        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("DARWINTRACE_DEBUG");
+        if (debugpath) {
+                __darwintrace_stderr = fopen(debugpath, "a+");
+        } 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 && (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, "DYLD_INSERT_LIBRARIES=")) {
+                        val = dyld_insert_libraries_ptr;
+                        dyld_insert_libraries_ptr = NULL;
+                } else if (__darwintrace_strbeginswith(val, "DYLD_FORCE_FLAT_NAMESPACE=")) {
+                        val = dyld_force_flat_namespace_ptr;
+                        dyld_force_flat_namespace_ptr = NULL;
+                } else if (__darwintrace_strbeginswith(val, "DARWINTRACE_LOG=")) {
+                        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 <= 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 > 2 && buffer[0] == '#' && buffer[1] == '!') {
+                char *interp = buffer + 2;
+
+                /* skip past leading whitespace */
+                while (interp < buffer_end && isblank(*interp)) {
+                        ++interp;
+                }
+                /* found interpreter (or ran out of data); skip until next
+                 * whitespace, then terminate the string */
+                if (interp < buffer_end) {
+                        char *interp_end = interp;
+                        strsep(&interp_end, " \t");
+                }
+
+                /* 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("execve(%s) = ?\n", 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("execve(%s) = %d\n", path, result);
+
+        return result;
+#undef execve
+}
+
+#if defined(HAVE_SPAWN_H) && defined(HAVE_POSIX_SPAWN)
+// Let's save some typing work...
+typedef int (*posix_spawn_t)(
+                        pid_t *restrict,
+                        const char *restrict,
+                        const posix_spawn_file_actions_t *,
+                        const posix_spawnattr_t *restrict,
+                        char *const *restrict,
+                        char *const *restrict);
+/**
+ * Wrapper for \c posix_spawn(2). Denies access and simulates the file does not
+ * exist, if it's outside the sandbox. Also checks for potential interpreters
+ * using \c check_interpreter.
+ */
+int posix_spawn(pid_t *restrict pid, const char *restrict path, const posix_spawn_file_actions_t *file_actions,
+                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
+                                && posix_spawnattr_getflags(attrp, &attrflags) == 0
+                                && (attrflags & POSIX_SPAWN_SETEXEC) > 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("execve(%s) = ?\n", 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, "posix_spawn");
+                        }
+                        // call the original posix_spawn function, but restore environment
+                        char **newenv = restore_env(envp);
+                        result = prev_posix_spawn(pid, path, file_actions, attrp, argv, newenv);
+                        free(newenv);
+                }
+        }
+
+        debug_printf("posix_spawn(%s) = %d\n", 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 <pguyot@kallisys.net>,
+ * 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. ("Apple") 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 "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL 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 "darwintrace.h"
+
+#include <errno.h>
+#include <sys/dirent.h>
+#include <sys/param.h>
+#include <sys/syscall.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <string.h>
+
+/**
+ * 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 < sz;) {
+                struct dirent64 *dent = (struct dirent64 *)(((char *) buf) + offset);
+                dirname[dnamelen] = '\0';
+                strcat(dirname, dent->d_name);
+                if (!__darwintrace_is_in_sandbox(dirname, DT_ALLOWDIR)) {
+                        debug_printf("__getdirentries64: filtered %s\n", dirname);
+                        dent->d_ino = 0;
+                } else {
+                        debug_printf("__getdirentries64: allowed %s\n", dirname);
+                }
+                offset += dent->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 < sz;) {
+                struct dirent32 *dent = (struct dirent32 *)(buf + offset);
+                dirname[dnamelen] = '\0';
+                strcat(dirname, dent->d_name);
+                if (!__darwintrace_is_in_sandbox(dirname, DT_ALLOWDIR)) {
+                        debug_printf("getdirentries: filtered %s\n", dirname);
+                        dent->d_ino = 0;
+                } else {
+                        debug_printf("getdirentries: allowed %s\n", dirname);
+                }
+                offset += dent->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 <pguyot@kallisys.net>,
+ * 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. ("Apple") 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 "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL 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 "darwintrace.h"
+
+#include <errno.h>
+#include <sys/syscall.h>
+#include <unistd.h>
+#include <unistd.h>
+
+/**
+ * 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("readlink(%s) = %d\n", 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 <pguyot@kallisys.net>,
+ * 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. ("Apple") 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 "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL 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 "darwintrace.h"
+
+#include <errno.h>
+#include <stdio.h>
+#include <sys/syscall.h>
+#include <unistd.h>
+
+/**
+ * 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("rename(%s, %s) = %d\n", 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 <pguyot@kallisys.net>,
+ * 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. ("Apple") 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 "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL 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 "darwintrace.h"
+
+#include <errno.h>
+#include <sys/syscall.h>
+#include <unistd.h>
+#include <unistd.h>
+
+/**
+ * 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("rmdir(%s) = %d\n", 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 <pguyot@kallisys.net>,
+ * 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. ("Apple") 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 "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL 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 "darwintrace.h"
+
+#include <errno.h>
+#include <sys/syscall.h>
+#include <unistd.h>
+
+// 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("stat(%s) = %d\n", 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("stat64(%s) = %d\n", 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("lstat(%s) = %d\n", 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("lstat64(%s) = %d\n", 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 <pguyot@kallisys.net>,
+ * 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. ("Apple") 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 "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL 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 "darwintrace.h"
+
+#include <errno.h>
+#include <sys/syscall.h>
+#include <unistd.h>
+#include <unistd.h>
+
+/**
+ * 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("unlink(%s) = %d\n", 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 == "image"} {
</del><ins>+ if {$installtype eq "image"} {
</ins><span class="cx"> set location [registry::property_retrieve $iref location]
</span><del>- if {$location == "0"} {
</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 ""
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if {$location == "" || ![file isfile $location]} {
</del><ins>+ if {$location eq "" || ![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 == "" || $archs == "0"} {
</del><ins>+ if {$archs eq "" || $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 "${iname}-${iversion}_${irevision}${ivariants}.${macports::os_platform}_${macports::os_major}.[join $archs -].${archivetype}"
</span><span class="cx"> ui_msg "Processing ${counter} of ${installed_len}: ${archivename}"
</span><del>- if {$installtype == "image"} {
</del><ins>+ if {$installtype eq "image"} {
</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 == "" || ![file isdirectory $location]} {
</del><ins>+ if {$location eq "" || ![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 == "image" && [file isdirectory $location]} {
</del><ins>+ } elseif {$installtype eq "image" && [file isdirectory $location]} {
</ins><span class="cx"> # create archive from image dir
</span><span class="cx"> system -W $location "$tarcmd -cjf $newlocation * > ${targetdir}/error.log 2>&1"
</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 == "direct"} {
</del><ins>+ if {$installtype eq "direct"} {
</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 "Deleting ${counter} of ${archived_len}: ${location}"
</span><del>- if {$location != "" && [file isdirectory $location]} {
</del><ins>+ if {$location ne "" && [file isdirectory $location]} {
</ins><span class="cx"> if {[catch {file delete -force $location} result]} {
</span><span class="cx"> ui_warn "Failed to delete ${location}: $result"
</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 <config.h>
+
</ins><span class="cx"> #include <stdbool.h>
</span><span class="cx"> #include <stdio.h>
</span><span class="cx"> #include <stdlib.h>
</span><span class="lines">@@ -41,6 +43,7 @@
</span><span class="cx">
</span><span class="cx"> #include <err.h>
</span><span class="cx"> #include <string.h>
</span><ins>+#include <strings.h>
</ins><span class="cx">
</span><span class="cx"> #ifdef __MACH__
</span><span class="cx"> #include <mach-o/fat.h>
</span><span class="lines">@@ -338,15 +341,21 @@
</span><span class="cx"> mat->mat_arch = swap32(header->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->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 < 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->cmdsize);
</del><ins>+ cmdsize = swap32(cmd->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 > 0) {
</span><span class="cx"> err >>= 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 */ "Success",
</span><span class="cx"> /* 0x01 */ "Error opening or reading file",
</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 != "NULL"} {
</del><ins>+                while {$a ne "NULL"} {
</ins><span class="cx">                         puts "        Architecture: [$a cget -mat_arch]"
</span><span class="cx">                         puts "                 install name: [$a cget -mat_install_name]"
</span><span class="cx">                         puts "                 current version: [machista::format_dylib_version [$a cget -mat_version]]"
</span><span class="cx">                         puts "                compatibility version: [machista::format_dylib_version [$a cget -mat_comp_version]]"
</span><span class="cx">         
</span><span class="cx">                         set l [$a cget -mat_loadcmds]
</span><del>-                        while {$l != "NULL"} {
</del><ins>+                        while {$l ne "NULL"} {
</ins><span class="cx">                                 puts "                        [$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]])"
</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 :<port>\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"
</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 "Endian"
</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 "darwin" && [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 "sw_vers exists but running it failed: $result"
+ }
</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 "Current platform \"$os_platform $os_major\" does not match expected platform \"$macports::autoconf::os_platform $macports::autoconf::os_major\""
+ ui_error "If you upgraded your OS, please follow the migration instructions: https://trac.macports.org/wiki/Migration"
+ return -code error "OS platform mismatch"
+ }
+
</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 "darwin" && $os_major < 13} {
</del><ins>+ if {$os_platform eq "darwin" && $os_major >= 13} {
+ set macports::cxx_stdlib libc++
+ } elseif {$os_platform eq "darwin"} {
</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 "Library directory '$libpath' must exist"
</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 "darwin" && [vercmp [info tclversion] 8.5] >= 0 && ![file exists [file join $portdbpath .nohide]] && [file writable $portdbpath] && [file attributes $portdbpath -hidden] == 0} {
+ if {[catch {file attributes $portdbpath -hidden yes} result]} {
+ ui_debug "error setting hidden flag for $portdbpath: $result"
+ }
+ }
+
</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)] && [file writable $env($var)] &&
</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 "$macports::ui_prefix Fetching port $url"
</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 "--progress builtin"
+ } elseif {[info exists macports::ui_options(progress_download)]} {
+ set progressflag "--progress ${macports::ui_options(progress_download)}"
</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 "Port remote fetch failed: $result"
</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 "Can't install $portinfo(name) because conflicting ports are installed: $conflictlist"
</del><ins>+ return -code error "Can't install $portinfo(name) because conflicting ports are active: $conflictlist"
</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 {} && [file exists ${portdir}/.git]} {
</del><ins>+ } elseif {$git_cmd ne {} && ![catch {exec sh -c "cd ${portdir} && $git_cmd rev-parse --is-inside-work-tree"} result]} {
</ins><span class="cx"> # determine what type of git repository this is
</span><del>- if {![catch {exec sh -c "$git_cmd --git-dir=${portdir}/.git config --local --get svn-remote.svn.url"} result]} {
</del><ins>+ if {![catch {exec sh -c "cd ${portdir} && $git_cmd config --local --get svn-remote.svn.url"} result]} {
</ins><span class="cx"> set git_action "svn rebase"
</span><span class="cx"> } else {
</span><span class="cx"> set git_action "pull --rebase"
</span><span class="cx"> }
</span><del>- set git_commandline "$git_cmd --git-dir=${portdir}/.git --work-tree=${portdir} $git_action"
</del><ins>+ set git_commandline "pushd $portdir ; $git_cmd $git_action ; popd"
</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 "--progress builtin"
+ } elseif {[info exists macports::ui_options(progress_download)]} {
+ set progressflag "--progress ${macports::ui_options(progress_download)}"
</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 "Fetching $source failed ($error)"
</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)] && !$dep_portinfo(installs_libs)} {
</span><span class="cx"> set check_archs 0
</span><ins>+ if {$skipSatisfied && $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 && $already_installed && !$is_revupgrade}]]
</del><ins>+ set status [_upgrade_dependencies portinfo depscache variationslist options [expr {$will_build && $already_installed}]]
</ins><span class="cx"> if {$status != 0 && $status != 2 && ![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 "Skipping uninstall $newname @${version_in_tree}_${revision_in_tree}$portinfo(canonical_active_variants) (dry run)"
</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] && [isatty stdout]}]
</del><ins>+ set fancy_output [expr {![macports::ui_isset ports_debug] && [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 > 0} {
</span><span class="cx"> registry::write {
</span><span class="cx"> try {
</span><del>- ui_msg -nonewline "$macports::ui_prefix Updating database of binaries"
</del><ins>+ ui_msg "$macports::ui_prefix Updating database of binaries"
</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 < 10000 || $i % 10 == 1 || $i == $files_count} {
- ui_msg -nonewline "\r$macports::ui_prefix Updating database of binaries: [expr {($i * 1000 / $files_count) / 10.0}]%"
- flush stdout
</del><ins>+ if {$files_count < 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 "Error determining file type of `$fpath': $fileIsBinaryError"
</span><span class="cx"> ui_warn "A file belonging to the `[[registry::entry owner $fpath] name]' port is missing or unreadable. Consider reinstalling it."
</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 > 0} {
</span><del>- ui_msg -nonewline "$macports::ui_prefix Scanning binaries for linking errors"
</del><ins>+ ui_msg "$macports::ui_prefix Scanning binaries for linking errors"
</ins><span class="cx"> set handle [machista::create_handle]
</span><span class="cx"> if {$handle eq {NULL}} {
</span><span class="cx"> error "Error creating libmachista handle"
</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 < 10000 || $i % 10 == 1 || $i == $binary_count} {
- ui_msg -nonewline "\r$macports::ui_prefix Scanning binaries for linking errors: [expr {($i * 1000 / $binary_count) / 10.0}]%"
- flush stdout
</del><ins>+ if {$binary_count < 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 "Error parsing file ${bpath}: [machista::strerror $returncode]"
</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 "Error parsing file ${bpath}: [machista::strerror $returncode]"
</span><span class="cx"> }
</span><span class="lines">@@ -4398,7 +4456,7 @@
</span><span class="cx"> set portname <unknown-port>
</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 "ID load command in ${bpath}, arch [machista::get_arch_name [$architecture cget -mat_arch]] (belonging to port $portname) contains relative path"
</span><span class="cx"> } elseif {![file exists $idloadcmdpath]} {
</span><span class="lines">@@ -4409,7 +4467,7 @@
</span><span class="cx"> set portname <unknown-port>
</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 "ID load command in ${bpath}, arch [machista::get_arch_name [$architecture cget -mat_arch]] refers to non-existant file $idloadcmdpath"
</span><span class="cx"> ui_warn "This is probably a bug in the $portname port and might cause problems in libraries linking against this file"
</span><span class="lines">@@ -4426,7 +4484,7 @@
</span><span class="cx"> set portname <unknown-port>
</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 "ID load command in ${bpath}, arch [machista::get_arch_name [$architecture cget -mat_arch]] refers to file ${idloadcmdpath}, which is a different file"
</span><span class="cx"> ui_warn "This is probably a bug in the $portname port and might cause problems in libraries linking against this file"
</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} == "/usr/lib/libstdc++.6.dylib" && ${macports::cxx_stdlib} == "libc++") ||
+ (${filepath} == "/usr/lib/libc++.1.dylib" && ${macports::cxx_stdlib} == "libstdc++")} {
+
+ if {$fancy_output} {
+ $revupgrade_progress intermission
+ }
+ ui_warn "${bpath} uses ${filepath} as C++ standard library although macports::cxx_stdlib is set to ${macports::cxx_stdlib}."
+ }
+
</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 "Could not open ${filepath}: [machista::strerror $libreturncode] (referenced from $bpath)"
</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] && [$loadcommand cget -mlt_comp_version] > [$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 "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]]"
</span><span class="cx"> ui_debug "Marking $bpath as broken"
</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) > 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) > 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 "@XAR@"
</span><span class="cx"> variable xcode_select_path "@XCODE_SELECT@"
</span><span class="cx"> variable xcodebuild_path "@XCODEBUILD@"
</span><ins>+ variable os_platform "@OS_PLATFORM@"
+ variable os_major "@OS_MAJOR@"
</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 != ""} {
</del><ins>+        if {$testcond ne ""} {
</ins><span class="cx">                 foreach ditem $dlist {
</span><span class="cx">                         if {[eval "expr \[\$testcond \$ditem\] == 1"]} {
</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 "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+namespace eval macports::autoconf {
+ variable macports_tcl_dir "@macports_tcl_dir@"
+ variable prefix "@prefix@"
+}
</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] && [string is integer -strict [string range $idx 4 end]]} {
- set i [expr $size - 1 - [string range $idx 4 end]]
</del><ins>+ } elseif {[string match "end-*" $idx] && [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 < 0 || $i >= $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 "s|^CFLAGS = -g \$(WFLAGS)|CFLAGS = -g \$(WFLAGS) ${configure.cppflags} ${configure.cflags} ${configure.ldflags} [get_canonical_archflags]|g" ${worksrcpath}/Makefile.in
+}
+
+configure.args --bindir=${prefix}/bin \
+ --mandir=${prefix}/share/man
+
+post-destroot {
+ eval xinstall -m 644 [glob ${worksrcpath}/*.1] ${destroot}${prefix}/share/man/man1/
+}
+
+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 "portdbpath $pwd/tmpdir/var/macports"
+puts $fd "prefix $pwd/tmpdir"
+puts $fd "variants_conf $pwd/tmpdir/variants.conf"
+puts $fd "sources_conf $pwd/sources.conf"
+puts $fd "applications_dir $pwd/tmpdir/Applications"
+puts $fd "frameworks_dir $pwd/tmpdir/Library/Frameworks"
+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 "FAIL: cannot run mportclose"
+ }
+ if {[ditem_key $mport workername] != ""} {
+ return "FAIL: port not closed"
+ }
+ return "Mport close successful."
+} -cleanup {
+ catch {mportclose $mport}
+} -result "Mport close successful."
+
+
+test mportinfo {
+ Mport info uni test.
+} -setup {
+ set mport [mportopen file://.]
+} -body {
+ set res [mportinfo $mport]
+ if {[lindex $res 2] != "canonical_active_variants"} {
+ return "FAIL: cannot get ::PortInfo"
+ }
+ return "Mport info successful."
+} -cleanup {
+ mportclose $mport
+} -result "Mport info successful."
+
+
+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 ""}} {
+ 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 ""}} {
+ 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 "Error evaluating variants"
+ }
+
+ # set $version var
+ set workername [ditem_key $mport workername]
+
+ # run destroot
+ $workername eval eval_targets destroot
+
+ # portinstall setup
+ interp alias {} _cd {} cd
+ set macosx_deployment_target $pwd/deploy_target
+ file mkdir $pwd/$subport
+ file link -symbolic $pwd/$subport/work $pwd/work
+
+ if {[catch {portinstall::install_main}] != 0} {
+ return "FAIL: cannot install port"
+ }
+
+ set variants {}
+ set options {}
+
+} -body {
+ set res [mportopen_installed $subport $version $revision $variants $options]
+ if {![string match "ditem_*" $res]} {
+ return "FAIL: installed port not opened"
+ }
+
+ if {[catch {mportclose_installed $res}] != 0} {
+ return "FAIL: cannot close port"
+ }
+ if {[catch {mportclose_installed $res}] != 1} {
+ return "FAIL: installed port not closed"
+ }
+ return "Installed port open successful."
+
+} -cleanup {
+ if {[catch {portuninstall::uninstall_main}] != 0} {
+ return "FAIL: cannot install port"
+ }
+ mportclose $mport
+
+ file delete -force $pwd/work
+ file delete -force $pwd/$subport
+} -result "Installed port open successful."
+
+
+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 "FAIL: set option not detected"
+ }
+ if {[macports::ui_isset port] != 0} {
+ return "FAIL: unset option detected"
+ }
+ return "ui_isset successful."
+} -result "ui_isset successful."
+
+
+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 "FAIL: set option not detected"
+ }
+ if {[macports::global_option_isset port] != 0} {
+ return "FAIL: unset option detected"
+ }
+ return "Global option isset successful."
+} -result "Global option isset successful."
+
+
+test init_logging {
+ Init logging unit test.
+} -constraints {
+ root
+} -setup {
+ set mport [mportopen file://.]
+} -body {
+ if {[macports::init_logging $mport] != 0} {
+ return "FAIL: incorrect channels"
+ }
+ if {$macports::channels(any) != "stdout debuglog"} {
+ return "FAIL: incorrect channels(any)"
+ }
+ if {$macports::channels(debug) != "debuglog"} {
+ return "FAIL: incorrect channels(debug)"
+ }
+ return "Init logging successful."
+} -cleanup {
+ mportclose $mport
+} -result "Init logging successful."
+
+
+test ch_logging {
+ Channel logging unit test. Assumes main.log filename.
+} -constraints {
+ root
+} -setup {
+ set mport [mportopen file://.]
+
+ set 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 "FAIL: channels not set"
+ }
+ if {![file exists $logname]} {
+ return "FAIL: logname dir missing"
+ }
+ if {![file exists $logname/main.log]} {
+ return "FAIL: main.log missing"
+ }
+ return "Channel logging successful."
+
+} -cleanup {
+ mportclose $mport
+} -result "Channel logging successful."
+
+
+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 "FAIL: cannot push log"
+ }
+ if {[lindex $::logstack 0] != [list $::debuglog $::debuglogname]} {
+ return "FAIL: incorrect logstack"
+ }
+ return "Push log successful."
+} -cleanup {
+ mportclose $mport
+} -result "Push log successful."
+
+
+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 "FAIL: cannot push log"
+ }
+} -body {
+ macports::pop_log
+ if {$::debuglog != $::logstack} {
+        return "FAIL: cannot pop log"
+ }
+ return "Pop log successful."
+} -cleanup {
+ unset ::logenabled
+ unset ::logstack
+ unset ::debuglog
+ mportclose $mport
+ file delete -force $pwd/log
+ file delete -force $pwd/logstack
+} -result "Pop log successful."
+
+
+test set_phase {
+ Set phase unit test.
+} -body {
+ set res [set_phase test]
+ if {$macports::current_phase != "test"} {
+        return "FAIL: phase not set"
+ }
+ return "Set phase successful."
+} -result "Set phase successful."
+
+
+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 != "prefixargs\n"} {
+        return "FAIL: wrong message"
+ }
+ 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 != "prefixarg"} {
+        return "FAIL: wrong message"
+ }
+ close $fd2
+
+ return "UI message successful."
+} -cleanup {
+ file delete -force $pwd/log
+ file delete -force $pwd/message
+} -result "UI message successful."
+
+
+# test ui_init
+
+
+test ui_prefix_default {
+ UI prefix default unit test.
+} -body {
+ if {[macports::ui_prefix_default debug] ne {DEBUG: }} {
+        return "FAIL: wrong prefix"
+ }
+ if {[macports::ui_prefix_default error] ne {Error: }} {
+        return "FAIL: wrong prefix"
+ }
+ if {[macports::ui_prefix_default warn] ne {Warning: }} {
+        return "FAIL: wrong prefix"
+ }
+ if {[macports::ui_prefix_default default] ne {}} {
+        return "FAIL: wrong prefix"
+ }
+ return "UI prefix default successful."
+} -result "UI prefix default successful."
+
+
+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 "FAIL: stderr not set"
+ }
+ if {[macports::ui_channels_default info] ne {stdout}} {
+        return "FAIL: stdout not set"
+ }
+ if {[macports::ui_channels_default notice] ne {}} {
+        return "FAIL: channel not set"
+ }
+ if {[macports::ui_channels_default msg] ne {stdout}} {
+        return "FAIL: channel not set"
+ }
+ if {[macports::ui_channels_default warn] ne {stderr}} {
+        return "FAIL: channel not set"
+ }
+ if {[macports::ui_channels_default error] ne {stderr}} {
+        return "FAIL: channel not set"
+ }
+ if {[macports::ui_channels_default default] ne {stdout}} {
+        return "FAIL: channel not set"
+ }
+ return "UI channels default successful."
+} -result "UI channels default successful."
+
+
+test ui_warn_once {
+ UI warn once unit test.
+} -body {
+ set res [ui_warn_once 0 test]
+ if {$macports::warning_done(0) != 1} {
+        return "FAIL: warning flag not set"
+ }
+ return "UI warn once successful."
+} -result "UI warn once successful."
+
+
+# Replace puts to catch errors
+# test puts
+
+
+test findBinary {
+ Find binary unit test.
+} -body {
+ if {[macports::findBinary pwd ls] != "/bin/pwd"} {
+ return "FAIL: wrong binary"
+ }
+ if {[macports::findBinary pwd /bin/ls] != "/bin/ls"} {
+ return "FAIL: wrong binary"
+ }
+ return "Find binary successful."
+} -result "Find binary successful."
+
+
+test binaryInPath {
+ Binary in path unit test.
+} -body {
+ if {[catch {macports::binaryInPath zz}] != 1} {
+ return "FAIL: invalid binary found"
+ }
+ if {[macports::binaryInPath ls] != "/bin/ls"} {
+ return "FAIL: wrong binary found"
+ }
+ return "Binary in path successful."
+} -result "Binary in path successful."
+
+
+test getoption {
+ Get option unit test.
+} -body {
+ set macports::test macports
+ if {[macports::getoption test] != "macports"} {
+        return "FAIL: cannot get option"
+ }
+ return "Get option successful."
+} -result "Get option successful."
+
+
+test setxcodeinfo {
+ Set XCode info unit test.
+} -constraints {
+ root
+} -setup {
+ unset macports::xcodeversion
+} -body {
+ if {[macports::setxcodeinfo a b c] != ""} {
+ return "FAIL: xcode binary not found"
+ }
+ if {![info exists macports::xcodeversion]} {
+ return "FAIL: xcodeversion unset"
+ }
+ return "Set XCode version successful."
+} -result "Set XCode version successful."
+
+
+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] != ""} {
+ return "FAIL: cannot set dev dir"
+ }
+ if {![info exists macports::developer_dir]} {
+ return "FAIL: developer_dir var no set"
+ }
+ return "Set developer dir successful."
+} -result "Set developer dir successful."
+
+
+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 "FAIL: valid dir not detected"
+ }
+ return "Valid dev dir successful."
+} -result "Valid dev dir successful."
+
+
+# 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] != ""} {
+ return "FAIL: errors occured"
+ }
+
+ set res ""
+ append res "host1 \{test " $time "\}"
+ set fd [open $macports::portdbpath/pingtimes r]
+
+ if {[gets $fd] != $res} {
+ return "FAIL: wrong value saved"
+ }
+ close $fd
+ return "Mportshutdown successful."
+
+} -cleanup {
+ file delete -force $macports::portdbpath
+} -result "Mportshutdown successful."
+
+
+test copy_xcode_plist {
+ Copy xcode plist unit test.
+} -constraints {
+ root
+} -body {
+ set target $pwd/target
+
+ if {[macports::copy_xcode_plist $target] != ""} {
+ return "FAIL: cannot copy xcode plist"
+ }
+ if {![file exists $target/Library/Preferences/com.apple.dt.Xcode.plist]} {
+ return "FAIL: missing plist file"
+ }
+ return "Copy xcode plist successful."
+} -cleanup {
+ file delete -force $target
+} -result "Copy xcode plist successful."
+
+
+test worker_init {
+ Worker init unit test.
+} -setup {
+ set name [interp create]
+ set portpath $pwd/portpath
+ set porturl http://www.macports.org
+ set portbuildpath $pwd/build
+ set options {a b}
+ set variations {1 2}
+} -body {
+ macports::worker_init $name $portpath $porturl $portbuildpath $options $variations
+ if {$name != "interp0"} {
+ return "FAIL: wrong workername"
+ }
+ if {[$name eval source Portfile] != "yes"} {
+ return "FAIL: cannot load Portfile"
+ }
+ if {[$name eval findBinary ls] != "/bin/ls"} {
+ return "FAIL: alias not created"
+ }
+ if {[$name eval return \$os_arch] != "i386"} {
+ return "FAIL: var not set"
+ }
+ return "Worker init successful."
+} -result "Worker init successful."
+
+
+test create_thread {
+ Create thread unit test.
+} -body {
+ unset macports::portinterp_options
+ set macports::portinterp_options {a b}
+
+ set res [macports::create_thread]
+ if {![string match "tid0x*" $res]} {
+ return "FAIL: cannot create thread"
+ }
+ return "Create thread successful."
+} -result "Create thread successful."
+
+
+test get_tar_flags {
+ Get tar flags unit test.
+} -body {
+ if {[macports::get_tar_flags .tbz2] != "-j"} {
+        return "FAIL: wrong flaga (-j)"
+ }
+ if {[macports::get_tar_flags .tgz] != "-z"} {
+        return "FAIL: wrong flaga (-z)"
+ }
+ return "Get tar flags successful."
+} -result "Get tar flags successful."
+
+
+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 != "${pwd}/portdbpath/portdirs/fondu-060102_1"} {
+        return "FAIL: cannot fetch port"
+ }
+ return "Fetch port successful."
+} -cleanup {
+ file delete -force $pwd/portdbpath
+} -result "Fetch port successful."
+
+
+test getprotocol {
+ Get protocol unit test.
+} -body {
+ if {[macports::getprotocol http://www.macports.org] != "http"} {
+ return "FAIL: wrong protocol"
+ }
+ return "Get protocol successful."
+} -result "Get protocol successful."
+
+
+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 != "${pwd}/portdbpath/portdirs/fondu_src-060102"} {
+        return "FAIL: invalid port directory"
+ }
+
+ set url file://${pwd}/local_file
+ if {[macports::getportdir $url] != "${pwd}/local_file"} {
+        return "FAIL: invalid local port directory"
+ }
+ return "Get port dir successful."
+} -cleanup {
+ file delete -force $pwd/portdbpath
+ file delete -force $pwd/local_file
+} -result "Get port dir successful."
+
+
+test getportresourcepath {
+ Get port resource path. Doesn't check for 'file' protocol.
+} -body {
+ set macports::portdbpath $pwd/portdbpath
+ set url "http://packages.macports.org/fondu/fondu-060102_1.darwin_12.x86_64.tbz2"
+ set 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 "" yes] != $default_path} {
+ return "FAIL: wrong resource path"
+ }
+ if {[macports::getportresourcepath $url "" no] != $fallback_path} {
+ return "FAIL: wrong fallback path"
+ }
+ if {[macports::getportresourcepath $url "test" no] != "${fallback_path}/test"} {
+ return "FAIL: wrong fallback path with subdir"
+ }
+
+ return "Get resource path successful."
+} -result "Get resource path successful."
+
+
+test getdefaultportresourcepath {
+ Get default port resource path unit test.
+} -body {
+ set path test/path
+ set macports::sources_default file://$pwd
+ if {[macports::getdefaultportresourcepath $path] != "${pwd}/_resources/${path}"} {
+ return "FAIL: wrong file res path"
+ }
+
+ 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 "FAIL: wrong http res path"
+ }
+ return "Default res path successful."
+} -result "Default res path successful."
+
+
+# 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 " "] 3]
+ }
+
+ global res
+ set res ""
+} -body {
+ mporttraverse test_proc $pwd/porttree
+ if {$res != "8547285472"} {
+ return "FAIL: porttree not traversed"
+ }
+ return "Mport traverse successful."
+} -cleanup {
+ file delete -force $pwd/porttree
+} -result "Mport traverse successful."
+
+
+# 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 "srcs\n"
+ close $f1
+ close $f2
+ close $f3
+
+ set fd [open $macports::prefix/etc/select/group/base w+]
+ puts $fd "a\nb"
+ close $fd
+} -body {
+ if {[mportselect list group] != {file1 file2}} {
+ return "FAIL: files not listed"
+ }
+ if {[mportselect set group file1] != ""} {
+ reutrn "FAIL: cannot set links"
+ }
+ if {![file exists $macports::prefix/a]} {
+ return "FAIL: link not created"
+ }
+ if {[mportselect show group] != "file1"} {
+ return "FAIL: file not selected"
+ }
+ return "Mport select successful."
+
+} -cleanup {
+ file delete -force $macports::prefix
+} -result "Mport select successful."
+
+
+test gettmpdir {
+ Get tmp dir unit test.
+} -body {
+ global env
+ set env(TMPDIR) temporal
+ if {[macports::gettmpdir] != "temporal"} {
+ return "FAIL: set temp dir not detected"
+ }
+ unset env(TMPDIR)
+ if {[macports::gettmpdir] != "/tmp"} {
+ return "FAIL: default value not set"
+ }
+ return "Get tmp dir successful."
+} -result "Get tmp dir successful."
+
+
+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 "FAIL: major:12 arch:i386 arch:ppc* not detected"
+ }
+ if {[macports::arch_runnable ppc64] != no} {
+ return "FAIL: major:12 arch:i386 arch:ppc64 not detected"
+ }
+ set macports::os_major 7
+ set macports::os_arch i386
+ set macports::os_platform darwin
+ if {[macports::arch_runnable x86_64] != no} {
+ return "FAIL: major:7 arch:i386 arch:x86_64 not detected"
+ }
+ set macports::os_major 12
+ set macports::os_arch i386
+ set macports::os_platform darwin
+ if {[macports::arch_runnable x86_64] != yes} {
+ return "FAIL: major:12 arch:i386 arch:x86_64 not detected"
+ }
+ return "Arch runnable successful."
+} -result "Arch runnable successful."
+
+
+# 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 "FAIL: application dir not detected"
+ }
+ set macports::prefix prefix
+ if {[macports::path_is_in_prefix prefix/test/port] != yes} {
+ return "FAIL: prefix not detected"
+ }
+ if {[macports::path_is_in_prefix test/port] != no} {
+ return "FAIL: no prefix detected"
+ }
+ return "Path prefix successful."
+} -result "Path prefix successful."
+
+
+test revupgrade_handle_special_paths {
+ Revupgrade handle special paths unit test.
+} -body {
+ set res [macports::revupgrade_handle_special_paths fname test_path]
+ if {$res != "test_path"} {
+ return "FAIL: wrong path"
+ }
+ set res [macports::revupgrade_handle_special_paths fname @loader_path/test_load]
+ if {$res != "./test_load"} {
+ return "FAIL: wrong load path"
+ }
+ return "Revupgrade handle special path successful."
+} -result "Revupgrade handle special path successful."
+
+
+# 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] != "MacPorts"} {
+ return "FAIL: wrong ping time"
+ }
+ if {[macports::get_pingtime macports_blacklist] != -1} {
+ return "FAIL: wrong time for blacklisted host"
+ }
+ if {[macports::get_pingtime macports_pref] != 1} {
+ return "FAIL: wrong time for preferred host"
+ }
+ return "Get ping time successful."
+} -result "Get ping time successful."
+
+
+test set_pingtime {
+ Set ping time unit test.
+} -body {
+ set macports::ping_cache(macports) {}
+ if {[lindex [macports::set_pingtime macports 007] 0] != 007} {
+ return "FAIL: ping time not set"
+ }
+ return "Set ping time successful."
+} -result "Set ping time successful."
+
+
+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 "name fondu"
+ puts $fd "urls macports.org"
+ puts $fd "type tgz"
+ close $fd
+
+ set macports::autoconf::macports_conf_path $pwd/archive_sites
+
+} -body {
+ set res [macports::get_archive_sites_conf_values]
+ if {[lindex [split $res " "] 1] != "macports.org:nosubdir"} {
+ return "FAIL: name not set"
+ }
+ if {[lindex [split $res " "] 3] != "tgz"} {
+ return "FAIL: wrong type set"
+ }
+
+ set macports::archive_sites_conf_values {a b c}
+ if {[macports::get_archive_sites_conf_values] != {a b c}} {
+ return "FAIL: wrong result for bad conf file"
+ }
+ return "Get archive sites conf values successful."
+
+} -cleanup {
+ file delete -force $pwd/archive_sites
+} -result "Get archive sites conf values successful."
+
+
+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 <kevin@opendarwin.org>
-
-# Test suite for macports_dlist package.
-
-#lappend auto_path .
-#package require macports_dlist 1.0
-source macports_dlist.tcl
-
-puts ""
-puts "Testing ditem"
-
-puts -nonewline "Checking ditem_create... "
-if {[catch {ditem_create} ditem] || $ditem == ""} {
-        puts "failed: $ditem"
-} else {
-        puts "ok"
-}
-
-puts -nonewline "Checking ditem_key... "
-if {[catch {ditem_key $ditem provides "foo"} value] || $value != "foo"} {
-        puts "failed: $value"
-} else {
-        puts "ok"
-}
-
-puts -nonewline "Checking ditem_append... "
-if {[catch {ditem_append $ditem provides "bar"} value] || $value != {foo bar}} {
-        puts "failed: $value"
-} else {
-        puts "ok"
-}
-
-puts -nonewline "Checking ditem_contains... "
-set value2 ""
-if {[catch {ditem_contains $ditem provides "foo"} value] || $value != 1 ||
-        [catch {ditem_contains $ditem provides "zzz"} value2] || $value2 != 0} {
-        puts "failed: ${value}\n${value2}"
-} else {
-        puts "ok"
-}
-
-puts ""
-puts "Testing dlist"
-
-puts -nonewline "Checking dlist_search... "
-if {[catch {dlist_search [list $ditem] provides "bar"} value] || $value != $ditem} {
-        puts "failed: $value"
-} else {
-        puts "ok"
-}
-
-puts -nonewline "Checking dlist_has_pending... "
-if {[catch {dlist_has_pending [list $ditem] "foo"} value] || $value != 1} {
-        puts "failed: $value"
-} else {
-        puts "ok"
-}
-
-puts -nonewline "Checking dlist_count_unmet... "
-array set status [list foo 1 bar 0]
-if {[catch {dlist_count_unmet [list] status "foo"} value] || $value != 0 ||
-        [catch {dlist_count_unmet [list] status "bar"} value2] || $value2 != 1} {
-        puts "failed: ${value}\n${value2}"
-} else {
-        puts "ok"
-}
-
-# 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 "Checking dlist_get_next... "
-if {[catch {dlist_get_next [list $A $B $C] status} value] || $value != $C} {
-        puts "failed: ${value}"
-} else {
-        puts "ok"
-}
-
-puts -nonewline "Checking dlist_eval... "
-proc handler {ditem} { puts -nonewline "[ditem_key $ditem provides] " }
-if {[catch {dlist_eval [list $A $B $C] {} handler} value] || $value != {}} {
-        puts "failed: ${value}"
-} else {
-        puts "ok"
-}
-
-puts -nonewline "Checking dlist_append_dependents... "
-if {[catch {dlist_append_dependents [list $A $B $C] $B {}} value] || $value != [list $B $C]} {
-        puts "failed: ${value}"
-} else {
-        puts "ok"
-}
-
-
</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 "FAIL: correct dlist not matched"
+ }
+ if {[dlist_match_multi $mport $crit2] != ""} {
+ return "FAIL: incorrect dlist matched"
+ }
+ return "dlist match successful."
+} -cleanup {
+ mportclose $mport
+} -result "dlist match successful."
+
+
+test dlist_search {
+ Dlist search unit test.
+} -setup {
+ set mport [mportopen file://.]
+} -body {
+ if {[dlist_search $mport provides fondu] != $mport} {
+ return "FAIL: matching item not found"
+ }
+ if {[dlist_search $mport provides fondu2] != ""} {
+ return "FAIL: wrong item detected"
+ }
+ return "dlist successful."
+} -cleanup {
+ mportclose $mport
+} -result "dlist successful."
+
+
+test dlist_delete {
+ Dlist delete unit test.
+} -setup {
+ set mport [mportopen file://.]
+ set dlist [list]
+ lappend dlist $mport
+} -body {
+ if {[dlist_delete dlist $mport] != ""} {
+ return "FAIL: cannot run dlist_delete"
+ }
+ if {$dlist != ""} {
+ return "FAIL: port not removed from list"
+ }
+ return "Dlist delete successful."
+} -cleanup {
+ mportclose $mport
+} -result "Dlist delete successful."
+
+
+test dlist_has_pending {
+ Dlist has pending unit test.
+} -setup {
+ set mport [mportopen file://.]
+} -body {
+ if {[dlist_has_pending $mport fondu] != 1} {
+ return "FAIL: not detected"
+ }
+ if {[dlist_has_pending $mport provides] != 0} {
+ return "FAIL: incorrect detected"
+ }
+ return "dlist pending successful."
+} -cleanup {
+ mportclose $mport
+} -result "dlist pending successful."
+
+
+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 "FAIL: wrong unmet number"
+ }
+ return "count unmet successful."
+} -cleanup {
+ mportclose $mport
+} -result "count unmet successful."
+
+
+# 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 "FAIL: wrong depends"
+ }
+ return "Append depends successful."
+} -cleanup {
+ mportclose $mport
+} -result "Append depends successful."
+
+
+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 "FAIL: wrong dlist"
+ }
+ return "dlist get next successful."
+} -cleanup {
+ mportclose $mport
+} -result "dlist get next successful."
+
+
+test dlist_eval {
+ Dlist eval unit test.
+} -setup {
+ set mport [mportopen file://.]
+ proc cond {arg} {
+ if {[string match "ditem_*" $arg] != 0} {
+ return 0
+ } else {
+ return 1
+ }
+ }
+ proc handler {arg} {}
+} -body {
+ if {[dlist_eval $mport cond handler] != ""} {
+ return "FAIL: wrong value returned"
+ }
+ return "dlist eval successful."
+} -cleanup {
+ mportclose $mport
+} -result "dlist eval successful."
+
+
+test ditem_create {
+ Ditem create unit test.
+} -body {
+ set res [macports_dlist::ditem_create]
+ if {[string match "ditem_*" $res] == 0} {
+        return "FAIL: ditem not created"
+ }
+ if {[info exists macports_dlist::$res] != 1} {
+        return "FAIL: array not set"
+ }
+ return "Create ditem successful."
+} -result "Create ditem successful."
+
+
+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 "FAIL: array not deleted"
+ }
+ return "Ditem delete successful."
+} -result "Ditem delete successful."
+
+
+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] != "macports test"} {
+        return "FAIL ditem key not set"
+ }
+ return "Ditem key successful."
+} -cleanup {
+ macports_dlist::ditem_delete $res
+} -result "Ditem key successful."
+
+
+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] != "macports {test test2}"} {
+        return "FAIL: ditem key not appended"
+ }
+ return "Ditem key append successful."
+} -cleanup {
+ macports_dlist::ditem_delete $res
+} -result "Ditem key append successful."
+
+
+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] != "macports test"} {
+        return "FAIL: ditem key not unique"
+ }
+ return "Ditem append unique successful."
+} -cleanup {
+ macports_dlist::ditem_delete $res
+} -result "Ditem append unique successful."
+
+
+test ditem_contains {
+ Ditem contains unit test.
+} -setup {
+ set mport [mportopen file://.]
+} -body {
+ if {[ditem_contains $mport provides] != 1} {
+ return "FAIL: valid key not detected"
+ }
+ if {[ditem_contains $mport wants] != 0} {
+ return "FAIL: invalid key detected"
+ }
+ return "ditem contains successful."
+} -cleanup {
+ mportclose $mport
+} -result "ditem contains successful."
+
+
+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 <eridius@macports.org>
-
-source ./macports_util.tcl
-
-array set options {t 0 w 0}
-
-set ::traceNest ""
-set ::traceSquelch 0
-set ::traceSquelchNest ""
-proc dotrace {args} {
- global traceNest options
- flush stdout
- set command [lindex $args 0]
- if {$options(w) > 0} {
- # trim command to 1 line
- if {[llength [set lines [split $command "\n"]]] > 1} {
- set command "[lindex $lines 0] [ansi fg-blue]...[ansi reset]"
- }
- }
- set op [lindex $args end]
- switch $op {
- enter { append traceNest "#" }
- enterstep { append traceNest "+" }
- }
- switch $op {
- enter {
- puts stderr "[ansi fg-yellow inverse]$traceNest>[ansi reset] $command"
- set ::traceSquelch 0
- }
- enterstep {
- if {!$::traceSquelch} {
- puts stderr "[ansi fg-yellow]$traceNest>[ansi reset] $command"
- if {[llength [info procs [lindex [split $command] 0]]] > 0} {
- # it's a proc, lets start squelching
- set ::traceSquelch 1
- set ::traceSquelchNest $::traceNest
- }
- }
- }
- leave -
- leavestep {
- if {$op eq "leavestep" && $::traceSquelch && $::traceNest eq $::traceSquelchNest} {
- set ::traceSquelch 0
- }
- if {$op eq "leave" || !$::traceSquelch} {
- set code [lindex $args 1]
- set result [lindex $args 2]
- if {$options(w) > 0} {
- # trim result just like command
- if {[llength [set lines [split $result "\n"]]] > 1} {
- set result "[lindex $lines 0] [ansi fg-blue]...[ansi reset]"
- }
- }
- if {$op eq "leave"} {
- set prefix "[ansi fg-blue inverse]$traceNest"
- } else {
- set prefix "[ansi fg-blue]$traceNest"
- }
- if {$code != 0} {
- puts stderr "$prefix =\[$code\]>[ansi reset] $result"
- } else {
- puts stderr "$prefix =>[ansi reset] $result"
- }
- }
- }
- }
- switch $op {
- leave -
- leavestep {
- set traceNest [string range $traceNest 0 end-1]
- }
- }
-}
-while {[llength $argv] > 0} {
- set arg [lshift argv]
- if {$arg eq "--"} {
- break
- } elseif {[string match -* $arg]} {
- set arg [string range $arg 1 end]
- while {[string length $arg] > 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 "Unknown option: -$opt"
- }
- }
- }
- } else {
- lunshift argv $arg
- break
- }
-}
-if {$options(t) > 0} {
- set ops {enter leave}
- if {$options(t) > 1} {
- lappend ops enterstep leavestep
- }
- set util_list {ldindex lpop lpush lshift lunshift try throw}
- if {[llength $argv] > 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 "wrong # args: should be \"ansi code ...\""
- }
- set colors {}
- foreach code $args {
- lappend colors $kAnsiTable($code)
- }
- return "\033\[[join $colors ";"]m"
-}
-
-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 "-error" && $err == 1} {
- if {[llength $args] > 0} {
- set errCode [lindex $args 0]
- if {$errCode == $savedErrorCode} {
- if {[llength $args] > 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 "-return" && $err == 2} {
- if {[llength $args] > 0} {
- set errMsg [lindex $args 0]
- if {$errMsg == $value} {
- set code expected
- } else {
- set code error
- }
- } else {
- set code expected
- }
- } elseif {$expected eq "-break" && $err == 3} {
- set code expected
- } else {
- set code error
- }
- } elseif {$value == $expected} {
- set code correct
- } else {
- set code wrong
- }
- if {$code eq "error"} {
- append value "\n$savedErrorInfo"
- }
- puts "[state $code]$name =[if {$err != 0} {format \[$err\]}]> $value[ansi reset]"
-}
-
-proc var {name expected} {
- set exists [uplevel 1 info exists [list $name]]
- if {!$exists} {
- set value "does not exist"
- if {$expected eq "-unset"} {
- 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 "[state $code]$name: $value[ansi reset]"
-}
-
-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 {"4 5" 6} 7} 8 9}
-
- var vars::ary(zero) {1 {2 3 {"4 5" 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 "vars::foo": 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 "vars::foo": 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) "this is a test"} {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 "foo bar" 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) "this is a test"} {{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 "throw ?type? ?message? ?info?"}
- 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 "random error"
- }
- } -error NONE "random error"
- block {try-finally} {
- try {
- error "try-finally error"
- } finally {
- set myVar "finally clause worked"
- }
- } -error NONE "try-finally error"
- var myVar "finally clause worked"
- block {try-finally-error} {
- try {
- error "try-finally error"
- } finally {
- error "finally error"
- }
- } -error NONE "finally error"
- block {try-catch} {
- try {
- error "try-catch error"
- } catch NONE {
- format "catch clause worked"
- }
- } "catch clause worked"
- block {try-catch-throw} {
- try {
- error "try-catch error"
- } catch NONE {
- set myVar "thrown"
- throw
- }
- } -error NONE "try-catch error" ;# really should test errorInfo but that's messy
- var myVar "thrown"
- unset myVar
- block {try-catch-finally} {
- try {
- error "try-catch-finally error"
- } catch NONE {
- set myVar "thrown"
- throw
- } finally {
- lappend myVar "finally"
- }
- } -error NONE "try-catch-finally error"
- var myVar "thrown finally"
- block {try-catch-all} {
- try {
- error "this is a test"
- } catch * {
- format "catch-all worked"
- }
- } "catch-all worked"
- block {try-catch-return} {
- try {
- error "this is a test"
- } catch * {
- return "catch-return worked"
- }
- } -return "catch-return worked"
- block {try-catch-break} {
- try {
- error "this is a test"
- } catch * {
- break
- }
- } -break
- block {try-catch-multiple} {
- try {
- error "this is a test"
- } catch POSIX {
- error "POSIX catch"
- } catch * {
- format "catch-all"
- }
- } "catch-all"
- unset myVar
- block {try-catch-multiple-finally} {
- try {
- error "this is a test"
- } catch * {
- lappend myVar "catch-all 1"
- } catch * {
- lappend myVar "catch-all 2"
- } finally {
- lappend myVar "finally"
- }
- } [list {catch-all 1}]
- var myVar [list "catch-all 1" "finally"]
- block {try-catch-types} {
- try {
- error "try-catch-types error" {} {MYERR arg1 arg2}
- } catch POSIX {
- error "POSIX catch"
- } catch {{MY* arg*} code} {
- format "caught code $code"
- }
- } "caught code MYERR arg1 arg2"
- block {try-catch-vars} {
- try {
- error "random error"
- } catch {* code msg info} {
- set list {}
- if {$code eq "NONE"} {
- lappend list "code: correct"
- }
- if {$msg eq "random error"} {
- lappend list "msg: correct"
- }
- if {[string match "random error\n*" $info]} {
- lappend list "info: probably correct"
- }
- join $list ", "
- }
- } "code: correct, msg: correct, info: probably correct"
- block {try-break-catch} {
- try {
- break
- } catch {*} {
- error "catch triggered"
- }
- } -break
-
- # ensure the stack is sound
- var ::_trycatch::catchStack {}
- }
-} result]]} {
- puts ""
- puts "error: $result"
- puts "code: $err"
- 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 "FAIL: no wrap around method"
+ }
+ if {[test_proc arg] != "arg"} {
+ return "FAIL: no wrap around method"
+ }
+ return "Method wrap successful."
+} -result "Method wrap successful."
+
+
+test ldindex {
+ Ldindex unit test.
+} -body {
+ set list {0 1 2 3}
+ if {[ldindex list 1] != 1} {
+ return "FAIL: element not poped"
+ }
+ if {$list != {0 2 3}} {
+ return "FAIL: wrong list remaining"
+ }
+ if {[catch {ldindex list 4}] != 1} {
+ return "FAIL: error not detected"
+ }
+ if {[ldindex list] != {0 2 3}} {
+ return "FAIL: not all elements poped"
+ }
+ if {$list != ""} {
+ return "FAIL: list not emptied"
+ }
+ return "ldindex successful."
+} -result "ldindex successful."
+
+
+test lpop {
+ Lpop unit test.
+} -body {
+ set list {0 1 2}
+ if {[lpop list] != 2} {
+ return "FAIL: element not poped"
+ }
+ if {$list != {0 1}} {
+ return "FAIL: wrong element poped"
+ }
+ return "lpop successful."
+} -result "lpop successful."
+
+
+test lpush {
+ Lpush unit test.
+} -body {
+ set list {0 1}
+ if {[lpush list 2] != {0 1 2}} {
+ return "FAIL: element not appended"
+ }
+ if {[lpush list 3 4] != {0 1 2 3 4}} {
+ return "FAIL: multiple elements not appended"
+ }
+ if {[lpush list1 0] != 0} {
+ return "FAIL: list not created"
+ }
+ return "lpop successful."
+} -result "lpop successful."
+
+
+test lshift {
+ Lshift unit test.
+} -body {
+ set list {0 1 2}
+ set list1 {}
+
+ if {[lshift list] != 0} {
+ return "FAIL: wrong element poped"
+ }
+ if {$list != {1 2}} {
+ return "FAIL: wrong list remaining"
+ }
+ if {[lshift list1] != ""} {
+ return "FAIL: empty list not detected"
+ }
+ return "lshift successful."
+} -result "lshift successful."
+
+
+test lunshift {
+ Lunshift unit test.
+} -body {
+ set list {3 4}
+
+ if {[lunshift list 2] != {2 3 4}} {
+ return "FAIL: element not inserted"
+ }
+ if {[lunshift list 0 1] != {0 1 2 3 4}} {
+ return "FAIL: multiple elements not inserted"
+ }
+ if {[lunshift list2 0] != 0} {
+ return "FAIL: list not created"
+ }
+ return "lunshift successful."
+} -result "lunshift successful."
+
+
+
+test throw {
+ Throw unit test.
+} -setup {
+ proc test_proc {arg} {
+ catch {throw $arg} res
+ return $res
+ }
+} -body {
+ if {[test_proc {7 msg info}] != "error: 7 msg info"} {
+ return "FAIL: wrong error returneed"
+ }
+ if {[catch {test_proc ""}] != 0} {
+ return "FAIL: wrong value returned"
+ }
+ return "throw successful."
+} -result "throw successful."
+
+
+test try {
+ Try unit test.
+} -setup {
+ proc test_proc {} {try {return 7} catch * {return 6}}
+ proc test_proc2 {} {try {error "msg" "info" 3} catch * {return 6}}
+} -body {
+ if {[test_proc] != 7} {
+ return "FAIL: try clause not working"
+ }
+ if {[test_proc2] != 6} {
+ reutrn "FAIL: catch clause not working"
+ }
+ if {[catch {try}] != 1} {
+ return "FAIL: no args err not detected"
+ }
+ return "try successful."
+} -result "try successful."
+
+
+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 "file://" entry.
+#
+# Example: file:///Users/landonf/misc/MacPorts/ports
+#
+# To prevent a source from synchronizing when `port sync` is used,
+# append "[nosync]" 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, "file://" URLs must come before other URLs.
+# A list of rsync mirrors is available at
+# https://trac.macports.org/wiki/Mirrors#Portfiles.
+#
+# If an "rsync://" 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
+# "[default]", even if switched from the default "rsync://" 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 ""
+set test_name ""
+set color_out ""
+set tcl ""
+set err ""
+
+# Get tclsh path.
+set autoconf ../../Mk/macports.autoconf.mk
+set fp [open $autoconf r]
+while {[gets $fp line] != -1} {
+ if {[string match "TCLSH*" $line] != 0} {
+ set tcl [lrange [split $line " "] 1 1]
+ }
+}
+
+proc print_help {arg} {
+ if { $arg eq "tests" } {
+ puts "The list of available tests is:"
+        cd tests
+        set test_suite [glob *.test]
+ foreach test $test_suite {
+ puts [puts -nonewline " "]$test
+ }
+ } else {
+ puts "Usage: tclsh test.tcl \[-debug level\] \[-t test\] \[-l\]\n"
+ puts " -debug LVL : sets the level of printed debug info \[0-3\]"
+ puts " -t TEST : run a specific test"
+ puts " -nocolor : disable color output (for automatic testing)"
+ puts " -l : print the list of available tests"
+ puts " -h, -help : print this message\n"
+ }
+}
+
+# Process args
+foreach arg $argv {
+ if { $arg eq "-h" || $arg eq "-help" } {
+ print_help ""
+ exit 0
+ } elseif { $arg eq "-debug" } {
+ set index [expr {[lsearch $argv $arg] + 1}]
+ set level [lindex $argv $index]
+ if { $level >= 0 && $level <= 3 } {
+ append arguments "-debug " $level
+ } else {
+ puts "Invalid debug level."
+ exit 1
+ }
+ } elseif { $arg eq "-t" } {
+ set index [expr {[lsearch $argv $arg] + 1}]
+ set test_name [lindex $argv $index]
+ set no 0
+        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 "-l" } {
+ print_help tests
+ exit 0
+ } elseif { $arg eq "-nocolor" } {
+ set color_out "no"
+ }
+}
+
+
+# Run tests
+if { $test_name ne ""} {
+ set result [eval exec $tcl $test_name $arguments 2>@stderr]
+ puts $result
+
+} else {
+ cd tests
+ set test_suite [glob *.test]
+
+ foreach test $test_suite {
+ set result [eval exec $tcl $test $arguments 2>@stderr]
+        set lastline [lindex [split $result "\n"] end]
+
+        if {[lrange [split $lastline "\t"] 1 1] != "Total"} {
+         set lastline [lindex [split $result "\n"] end-2]
+         set errmsg [lindex [split $result "\n"] end]
+        }
+
+        set splitresult [split $lastline "\t"]
+ set total [lindex $splitresult 2]
+ set pass [lindex $splitresult 4]
+ set skip [lindex $splitresult 6]
+ set fail [lindex $splitresult 8]
+
+        # Format output
+        if {$total < 10} { set total "0${total}"}
+        if {$pass < 10} { set pass "0${pass}"}
+        if {$skip < 10} { set skip "0${skip}"}
+        if {$fail < 10} { set fail "0${fail}"}
+
+ # Check for errors.
+ if { $fail != 0 } { set err "yes" }
+
+ set out ""
+ if { ($fail != 0 || $skip != 0) && $color_out eq "" } {
+ # Color failed tests.
+ append out "\x1b\[1;31mTotal:" $total " Passed:" $pass " Failed:" $fail " Skipped:" $skip " \x1b\[0m" $test
+ } else {
+ append out "Total:" $total " Passed:" $pass " Failed:" $fail " Skipped:" $skip " " $test
+ }
+
+ # Print results and constrints for auto-skipped tests.
+ puts $out
+ if { $skip != 0 } {
+ set out " Constraint: "
+ append out [string trim $errmsg "\t {}"]
+ puts $out
+ }
+        if { $fail != 0 } {
+         set end [expr {[string first $test $result 0] - 1}]
+         puts [string range $result 0 $end]
+        }
+ }
+}
+
+# Return 1 if errors were found.
+if {$err ne ""} { exit 1 }
+
+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 "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+namespace eval macports::autoconf {
+ variable macports_tcl_dir "@macports_tcl_dir@"
+ variable prefix "@prefix@"
+}
+
+namespace eval portutil::autoconf {
+ variable hdiutil_path "@HDIUTIL@"
+}
</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]] && [file extension $porturl] != ""} {
</del><ins>+ if {[file rootname [file tail $porturl]] eq [file rootname [get_portimage_name]] && [file extension $porturl] ne ""} {
</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} != "no"} {
</span><span class="cx"> lappend fetch_options "--ignore-ssl-cert"
</span><span class="cx"> }
</span><del>- if {$portverbose == "yes"} {
- lappend fetch_options "-v"
</del><ins>+ if {$portverbose eq "yes"} {
+ lappend fetch_options "--progress"
+ lappend fetch_options "builtin"
+ } elseif {[llength [info commands ui_progress_download]] > 0} {
+ lappend fetch_options "--progress"
+ lappend fetch_options "ui_progress_download"
</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}] && $existing_archive == ""} {
</del><ins>+ if {![file isfile ${archivefetch.fulldestpath}/${archive}] && $existing_archive eq ""} {
</ins><span class="cx"> ui_info "$UI_PREFIX [format [msgcat::mc "%s doesn't seem to exist in %s"] $archive ${archivefetch.fulldestpath}]"
</span><span class="cx"> if {![file writable ${archivefetch.fulldestpath}]} {
</span><span class="cx"> return -code error [format [msgcat::mc "%s must be writable"] ${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] != "/"} {
</del><ins>+ if {[string index $site end] ne "/"} {
</ins><span class="cx"> append site "/[option archive.subdir]"
</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] && $ports_binary_only == "yes"} {
</del><ins>+ if {[info exists ports_binary_only] && $ports_binary_only eq "yes"} {
</ins><span class="cx"> return -code error "archivefetch failed for [option subport] @[option version]_[option revision][option portvariants]"
</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 "$hdiutil create -quiet -fs HFS+ -volname ${imagename} -srcfolder ${pkgpath} ${tmp_image}"] != ""} {
</del><ins>+ if {[system "$hdiutil create -quiet -fs HFS+ -volname ${imagename} -srcfolder ${pkgpath} ${tmp_image}"] ne ""} {
</ins><span class="cx"> return -code error [format [msgcat::mc "Failed to create temporary image: %s"] ${imagename}]
</span><span class="cx"> }
</span><del>- if {[system "$hdiutil convert ${tmp_image} -format UDCO -o ${final_image} -quiet"] != ""} {
</del><ins>+ if {[system "$hdiutil convert ${tmp_image} -format UDCO -o ${final_image} -quiet"] ne ""} {
</ins><span class="cx"> return -code error [format [msgcat::mc "Failed to convert to final image: %s"] ${final_image}]
</span><span class="cx"> }
</span><del>- if {[system "$hdiutil internet-enable -quiet -yes ${final_image}"] != ""} {
</del><ins>+ if {[system "$hdiutil internet-enable -quiet -yes ${final_image}"] ne ""} {
</ins><span class="cx"> return -code error [format [msgcat::mc "Failed to internet-enable: %s"] ${final_image}]
</span><span class="cx"> }
</span><span class="cx"> file delete -force "${tmp_image}"
</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 "[option epoch]:[option version]"
</span><span class="cx">         } else {
</span><span class="cx">                 set pkg_version "[option version]"
</span><span class="cx">         }
</span><del>-        if {[expr [option revision] != 0]} {
</del><ins>+        if {[option revision] != 0} {
</ins><span class="cx">                 append pkg_version "-[option revision]"
</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 == "noarch"} {
</del><ins>+        if {$supported_archs eq "noarch"} {
</ins><span class="cx">                 set pkg_arch "all"
</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 "$hdiutil create -quiet -fs HFS+ -volname ${imagename} -srcfolder ${mpkgpath} ${tmp_image}"] != ""} {
</del><ins>+ if {[system "$hdiutil create -quiet -fs HFS+ -volname ${imagename} -srcfolder ${mpkgpath} ${tmp_image}"] ne ""} {
</ins><span class="cx"> return -code error [format [msgcat::mc "Failed to create temporary image: %s"] ${imagename}]
</span><span class="cx"> }
</span><del>- if {[system "$hdiutil convert ${tmp_image} -format UDCO -o ${final_image} -quiet"] != ""} {
</del><ins>+ if {[system "$hdiutil convert ${tmp_image} -format UDCO -o ${final_image} -quiet"] ne ""} {
</ins><span class="cx"> return -code error [format [msgcat::mc "Failed to convert to final image: %s"] ${final_image}]
</span><span class="cx"> }
</span><del>- if {[system "$hdiutil internet-enable -quiet -yes ${final_image}"] != ""} {
</del><ins>+ if {[system "$hdiutil internet-enable -quiet -yes ${final_image}"] ne ""} {
</ins><span class="cx"> return -code error [format [msgcat::mc "Failed to internet-enable: %s"] ${final_image}]
</span><span class="cx"> }
</span><span class="cx"> file delete -force "${tmp_image}"
</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 != ""} {
</del><ins>+ if {$dep ne ""} {
</ins><span class="cx"> eval "lappend result [make_dependency_list $dep $destination]"
</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 ""
</span><del>- if {${portepoch} != "0"} {
</del><ins>+ if {${portepoch} != 0} {
</ins><span class="cx"> set portepoch_namestr "${portepoch}_"
</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 ""
</span><del>- if {${portrevision} != "0"} {
</del><ins>+ if {${portrevision} != 0} {
</ins><span class="cx"> set portrevision_namestr "_${portrevision}"
</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 ""
</span><del>- if {$epoch != "0"} {
</del><ins>+ if {$epoch != 0} {
</ins><span class="cx"> set epoch_namestr "${epoch}_"
</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 ""
</span><del>- if {$rev != "0"} {
</del><ins>+ if {$rev != 0} {
</ins><span class="cx"> set rev_namestr "_${rev}"
</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 "."]
</span><span class="cx">
</span><del>- if {[string index $destination end] != "/"} {
</del><ins>+ if {[string index $destination end] ne "/"} {
</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] >= 0]}
</del><ins>+default package.flat {[expr {[vercmp $macosx_deployment_target 10.6] >= 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 ""
</span><del>- if {${portepoch} != "0"} {
</del><ins>+ if {${portepoch} != 0} {
</ins><span class="cx"> set portepoch_namestr "${portepoch}_"
</span><span class="cx"> }
</span><span class="cx"> set portrevision_namestr ""
</span><del>- if {${portrevision} != "0"} {
</del><ins>+ if {${portrevision} != 0} {
</ins><span class="cx"> set portrevision_namestr "_${portrevision}"
</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 == ""} {
</del><ins>+ if {$long_description eq ""} {
</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 != "0"} {
</del><ins>+ if {$portepoch != 0} {
</ins><span class="cx"> set portepoch [xml_escape $portepoch]
</span><span class="cx"> set portepoch_str "${portepoch}_"
</span><span class="cx"> } else {
</span><span class="lines">@@ -327,7 +327,7 @@
</span><span class="cx"> set portepoch_str ""
</span><span class="cx"> }
</span><span class="cx"> set portversion [xml_escape $portversion]
</span><del>- if {$portrevision != "0"} {
</del><ins>+ if {$portrevision != 0} {
</ins><span class="cx"> set portrevision [xml_escape $portrevision]
</span><span class="cx"> set portrevision_str "_${portrevision}"
</span><span class="cx"> } else {
</span><span class="lines">@@ -350,7 +350,7 @@
</span><span class="cx"> <font face=\"Helvetica\">${long_description}</font>
</span><span class="cx"> <p>"
</span><span class="cx">
</span><del>- if {$homepage != ""} {
</del><ins>+ if {$homepage ne ""} {
</ins><span class="cx"> puts $fd "<font face=\"Helvetica\"><a href=\"${homepage}\">${homepage}</a></font><p>"
</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] "\n"]]} result]} {
</span><span class="cx"> return -code error [format [msgcat::mc "Reading package bom failed: %s"] $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 "Error determining compressed size: %s"] $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 "Error determining installed size: %s"] $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 != "0"} {
</del><ins>+ if {$portepoch != 0} {
</ins><span class="cx"> set portepoch [xml_escape $portepoch]
</span><span class="cx"> set portepoch_str "${portepoch}_"
</span><span class="cx"> } else {
</span><span class="lines">@@ -407,7 +407,7 @@
</span><span class="cx"> set portepoch_str ""
</span><span class="cx"> }
</span><span class="cx"> set portversion [xml_escape $portversion]
</span><del>- if {$portrevision != "0"} {
</del><ins>+ if {$portrevision != 0} {
</ins><span class="cx"> set portrevision [xml_escape $portrevision]
</span><span class="cx"> set portrevision_str "_${portrevision}"
</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 < $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 ""
</span><del>- if {$supported_archs == "noarch"} {
</del><ins>+ if {$supported_archs eq "noarch"} {
</ins><span class="cx"> set rpmbuildarch "--target noarch"
</span><span class="cx"> } elseif {[variant_exists universal] && [variant_isset universal]} {
</span><span class="cx"> set rpmbuildarch "--target fat"
</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"
</span><del>- if {[expr ${epoch} != 0]} {
</del><ins>+ if {$epoch != 0} {
</ins><span class="cx">          puts $specfd "Epoch: ${epoch}"
</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"
</span><del>- if {$zip != ""} {
</del><ins>+ if {$zip ne ""} {
</ins><span class="cx"> puts $specfd "Source1: $zip"
</span><span class="cx"> }
</span><del>- if {[expr ${epoch} != 0]} {
</del><ins>+ if {$epoch != 0} {
</ins><span class="cx">          puts $specfd "Epoch: ${epoch}"
</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 "Source${count}: "
</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 != ""} {
</del><ins>+ if {$zip ne ""} {
</ins><span class="cx"> set and "-a 1"
</span><span class="cx"> } else {
</span><span class="cx"> set and ""
</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] && $ports_source_only == "yes"} {
</del><ins>+ } elseif {[info exists ports_source_only] && $ports_source_only eq "yes"} {
</ins><span class="cx"> ui_debug "Skipping unarchive ($subport) since source-only is set"
</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"> && [file isdirectory $destroot]} {
</span><span class="cx"> ui_debug "Skipping unarchive ($subport) since destroot completed"
</span><span class="cx"> set skipped 1
</span><del>- } elseif {[info exists ports_force] && $ports_force == "yes"} {
</del><ins>+ } elseif {[info exists ports_force] && $ports_force eq "yes"} {
</ins><span class="cx"> ui_debug "Skipping unarchive ($subport) since force is set"
</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} != ""} {
</span><span class="cx"> ui_debug "Found [string toupper ${unarchive.type}] archive: ${unarchive.path}"
</span><span class="cx"> } else {
</span><del>- if {[info exists ports_binary_only] && $ports_binary_only == "yes"} {
</del><ins>+ if {[info exists ports_binary_only] && $ports_binary_only eq "yes"} {
</ins><span class="cx"> return -code error "Archive for ${subport} ${version}_${revision}${portvariants} not found, required when binary-only is set!"
</span><span class="cx"> } else {
</span><span class="cx"> ui_debug "Skipping unarchive ($subport) since no suitable archive found"
</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 "best guess" values for now.
</del><ins>+ * empirical data. These represent "best guess" 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 "builtin"|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 "/" PACKAGE_VERSION " libcurl/" 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, "-v") == 0) {
-                                noprogress = 0;
-                        } else if (strcmp(theOption, "--disable-epsv") == 0) {
</del><ins>+                        if (strcmp(theOption, "--disable-epsv") == 0) {
</ins><span class="cx">                                 useepsv = 0;
</span><span class="cx">                         } else if (strcmp(theOption, "--ignore-ssl-cert") == 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, "--progress") == 0) {
+                                /* check we also have the parameter */
+                                if (optioncrsr < lastoption) {
+                                        optioncrsr++;
+                                        noprogress = 0;
+                                        progressCallback.proc = Tcl_GetString(objv[optioncrsr]);
+                                } else {
+                                        Tcl_SetResult(interp,
+                                                "curl fetch: --progress option requires a parameter",
+                                                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, "curl fetch: unknown option ", 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, "w" );
</del><ins>+                theFile = fopen(theFilePath, "w");
</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 >= 0x071304 && LIBCURL_VERSION_NUM <= 0x071307
</span><del>- /* FTP_PROXY workaround for Snow Leopard */
- if (strncmp(theURL, "ftp:", 4) == 0) {
- char *ftp_proxy = getenv("FTP_PROXY");
- 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, "ftp:", 4) == 0) {
+                        char *ftp_proxy = getenv("FTP_PROXY");
+                        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 && strcmp(progressCallback.proc, "builtin") != 0) {
+                        theCurlCode = curl_easy_setopt(theHandle, CURLOPT_PROGRESSDATA, &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 && strcmp(progressCallback.proc, "builtin") != 0) {
+                        CurlProgressCleanup(&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, "r");
</del><ins>+                        theFile = fopen(theFilePath, "r");
</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, "Last-Modified:", 14) != 0)
</span><span class="cx">                                         rewind(theFile);
</span><span class="cx">                         }
</span><del>-                        while ( (size = fread(buf, 1, BUFSIZ, theFile)) > 0) {
</del><ins>+                        while ((size = fread(buf, 1, BUFSIZ, theFile)) > 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) ? "" : 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 <= 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( "/dev/null", "a" );
</del><ins>+                theFile = fopen("/dev/null", "a");
</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 < -1) {
</span><span class="cx">                                 Tcl_SetResult(interp, "Couldn't get resource modification date", 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 <= 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( "/dev/null", "a" );
</del><ins>+                theFile = fopen("/dev/null", "a");
</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">                         "%.0f", 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 "builtin"|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 "/" PACKAGE_VERSION " libcurl/" 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 <= lastoption) {
+                        /* get the option */
+                        const char* theOption = Tcl_GetString(objv[optioncrsr]);
+
+                        if (strcmp(theOption, "--user-agent") == 0) {
+                                /* check we also have the parameter */
+                                if (optioncrsr < lastoption) {
+                                        optioncrsr++;
+                                        userAgent = Tcl_GetString(objv[optioncrsr]);
+                                } else {
+                                        Tcl_SetResult(interp,
+                                                "curl post: --user-agent option requires a parameter",
+                                                TCL_STATIC);
+                                        theResult = TCL_ERROR;
+                                        break;
+                                }
+                        } else if (strcmp(theOption, "--progress") == 0) {
+                                /* check we also have the parameter */
+                                if (optioncrsr < lastoption) {
+                                        optioncrsr++;
+                                        noprogress = 0;
+                                        progressCallback.proc = Tcl_GetString(objv[optioncrsr]);
+                                } else {
+                                        Tcl_SetResult(interp,
+                                                "curl post: --progress option requires a parameter",
+                                                TCL_STATIC);
+                                        theResult = TCL_ERROR;
+                                        break;
+                                }
+                        } else {
+                                Tcl_ResetResult(interp);
+                                Tcl_AppendResult(interp, "curl post: unknown option ", theOption, NULL);
+                                theResult = TCL_ERROR;
+                                break;
+                        }
+
+                        optioncrsr++;
+                }
+
+                if (optioncrsr <= lastoption) {
+                        /* something went wrong */
+                        break;
+                }
+
+                /*        first (second) parameter is -v or the url,
+                        second (third) parameter is the file */
+
+                if (objc >= 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, "post [options] postdata file");
+                        theResult = TCL_ERROR;
+                        break;
+                }
+
+                /* Open the file (dev/null) */
+                theFile = fopen("/dev/null", "a");
+                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, "/dev/null");
+                if (theCurlCode != CURLE_OK) {
+                        theResult = SetResultFromCurlErrorCode(interp, theCurlCode);
+                        break;
+                }
+
+                /* -f option */
+                theCurlCode = curl_easy_setopt(theHandle, CURLOPT_FAILONERROR, 1);
+                if (theCurlCode != CURLE_OK) {
+                        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 < 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 && strcmp(progressCallback.proc, "builtin") != 0) {
+                        theCurlCode = curl_easy_setopt(theHandle, CURLOPT_PROGRESSDATA, &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 && strcmp(progressCallback.proc, "builtin") != 0) {
+                        CurlProgressCleanup(&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>-                "fetch", "isnewer", "getsize", NULL
</del><ins>+                "fetch", "isnewer", "getsize", "post", 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 && ultotal == 0.0 && dlnow == 0.0 && 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, &curtime);
+        if ((curtime - callback->prevcalltime) < _CURL_MINIMUM_PROGRESS_INTERVAL) {
+                return 0;
+        }
+
+        if (callback->prevcalltime == 0.0) {
+                /* this is the first time we're calling the callback, call start
+                 * subcommand first */
+
+                /*
+                 * Command string, a space followed "start", another space and "dl" or
+                 * "ul" plus the trailing \0.
+                 */
+                char startCommandBuffer[strlen(callback->proc) + (1 + 5) + (1 + 2) + 1];
+                int startLen = 0;
+
+                startLen = snprintf(startCommandBuffer, sizeof(startCommandBuffer), "%s start %s",
+                                callback->proc, (transferType == DOWNLOAD) ? "dl" : "ul");
+                if (startLen < 0 || (size_t) startLen >= sizeof(startCommandBuffer)) {
+                        /* overflow */
+                        fprintf(stderr, "pextlib1.0: buffer overflow in " __FILE__ ":%d. Buffer is: %s\n", __LINE__, startCommandBuffer);
+                        abort();
+                }
+
+                if (TCL_ERROR == Tcl_EvalEx(callback->interp, startCommandBuffer, startLen, TCL_EVAL_GLOBAL)) {
+                        fprintf(stderr, "curl progress callback failed: %s\n", Tcl_GetStringResult(callback->interp));
+                        return 1;
+                }
+        }
+
+        callback->prevcalltime = curtime;
+
+        /* Get the average speed from curl */
+        if (transferType == DOWNLOAD) {
+                curl_easy_getinfo(theHandle, CURLINFO_SPEED_DOWNLOAD, &speed);
+        } else {
+                curl_easy_getinfo(theHandle, CURLINFO_SPEED_UPLOAD, &speed);
+        }
+
+        /*
+         * We need the command string, a space and "update", another space and "dl"
+         * or "ul", 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->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 <= XX <= 99 for
+         * exponents, and another one for a possible sign (or " " for positive
+         * numbers). In total, the maximum length will be 12 per double formatted.
+         */
+        len = snprintf(commandBuffer, sizeof(commandBuffer), "%s update %s % .6g % .6g % .6g",
+                        callback->proc, (transferType == DOWNLOAD) ? "dl" : "ul", total, now, speed);
+        if (len < 0 || (size_t) len >= sizeof(commandBuffer)) {
+                /* overflow */
+                fprintf(stderr, "pextlib1.0: buffer overflow in " __FILE__ ":%d. Buffer is: %s\n", __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->interp, commandBuffer, len, TCL_EVAL_GLOBAL)) {
+                fprintf(stderr, "curl progress callback failed: %s\n", Tcl_GetStringResult(callback->interp));
+                return 1;
+        }
+
+        return 0;
+}
+
+static void CurlProgressCleanup(
+                tcl_callback_t *callback)
+{
+        /*
+         * Transfer complete, signal the progress callback
+         */
+
+        /*
+         * Command string, a space followed "finish" plus the trailing \0.
+         */
+        char commandBuffer[strlen(callback->proc) + (1 + 6) + 1];
+        int len = 0;
+
+        len = snprintf(commandBuffer, sizeof(commandBuffer), "%s finish", callback->proc);
+        if (len < 0 || (size_t) len >= sizeof(commandBuffer)) {
+                /* overflow */
+                fprintf(stderr, "pextlib1.0: buffer overflow in " __FILE__ ":%d. Buffer is: %s\n", __LINE__, commandBuffer);
+                abort();
+        }
+
+        Tcl_EvalEx(callback->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 > 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("/bin/sh", 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, &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 "/foo/bar"]}
</span><span class="cx">                 exit 1
</span><span class="cx">         }
</span><del>-        if {[filemap get testmap "/foo/bar"] != "foobar"} {
-                puts {[filemap get testmap "/foo/bar"] != "foobar"}
</del><ins>+        if {[filemap get testmap "/foo/bar"] ne "foobar"} {
+                puts {[filemap get testmap "/foo/bar"] ne "foobar"}
</ins><span class="cx">                 exit 1
</span><span class="cx">         }
</span><span class="cx">         filemap unset testmap "/foo/bar"
</span><span class="lines">@@ -116,8 +116,8 @@
</span><span class="cx">                 puts [filemap get testmap2 "/foobar"]
</span><span class="cx">                 exit 1
</span><span class="cx">         }
</span><del>-        if {[filemap get testmap2 "/bar/bar-3"] != "somevalue"} {
-                puts {[filemap get testmap2 "/bar/bar-3"] != "somevalue"}
</del><ins>+        if {[filemap get testmap2 "/bar/bar-3"] ne "somevalue"} {
+                puts {[filemap get testmap2 "/bar/bar-3"] ne "somevalue"}
</ins><span class="cx">                 puts [filemap get testmap2 "/bar/bar-3"]
</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 "*/a" $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 "*/a" $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 "strlcat.h"
</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("send_file_map: memory allocation failed");
</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 < (strlen(t)+3)) \
</del><ins>+ if (remaining < (strlen(t)+3)) { \
</ins><span class="cx"> remaining=0; \
</span><del>- else \
</del><ins>+ fprintf(stderr, "tracelib: insufficient filemap memory\n"); \
+ } 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("%s", Tcl_GetStringResult(interp));
</ins><span class="cx"> /* send unexpected output to make the build fail */
</span><span class="cx"> answer(sock, "#");
</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(&entry, "name", &port, &error)) {
</span><span class="cx"> /* send unexpected output to make the build fail */
</span><del>- ui_error(error.description);
</del><ins>+ ui_error("%s", error.description);
</ins><span class="cx"> answer(sock, "#");
</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 && *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, "+");
</span><span class="lines">@@ -441,6 +446,7 @@
</span><span class="cx"> answer(sock, "!");
</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, &rl) == -1) {
</span><span class="cx"> ui_warn("getrlimit failed (%d), skipping setrlimit", errno);
</span><span class="cx"> } else {
</span><del>-#if defined(__APPLE__) && defined(OPEN_MAX)
</del><ins>+#ifdef OPEN_MAX
</ins><span class="cx"> if (rl.rlim_max > 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(&sock_mutex);
</span><span class="cx">
</span><span class="cx"> return TCL_OK;
</span><del>-#else
- Tcl_SetResult(in, "tracelib not supported on this platform", 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(&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(&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, "option", 0, (int *)&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, "tracelib not supported on this platform", 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 "@macports_tcl_dir@" 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 > 0x40000000} {
</span><span class="cx"> set unit "GiB"
</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 "B"
</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 "$siz $unit"
</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 == "+"} {
</del><ins>+ if {$val eq "+"} {
</ins><span class="cx"> lappend pos $key
</span><del>- } elseif {$val == "-"} {
</del><ins>+ } elseif {$val eq "-"} {
</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 ""
</span><del>- if {$version != "" || $emptyVersionOkay} {
</del><ins>+ if {$version ne "" || $emptyVersionOkay} {
</ins><span class="cx"> set pos_str ""
</span><span class="cx"> set neg_str ""
</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] > 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 "The following versions of $portname are currently installed:"
</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) == "" && $port(name) == "" } {
</del><ins>+ if { $port(url) eq "" && $port(name) eq "" } {
</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 == ""} {
</del><ins>+ if {$portname eq ""} {
</ins><span class="cx"> ui_error "A default port name could not be supplied."
</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 && (![info exists private_options(ports_no_args)] || $private_options(ports_no_args) == "no")} {
</del><ins>+ if {[llength $portlist] == 0 && (![info exists private_options(ports_no_args)] || $private_options(ports_no_args) eq "no")} {
</ins><span class="cx"> if {${is_upgrade} == "yes"} {
</span><span class="cx"> # $> 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 " "]
</span><span class="cx"> if {$indentfirstline == 0} {
</span><span class="cx"> set newline ""
</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 && $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 ""}} {
</span><del>- append label ": [string repeat " " [expr [string length $indent] - [string length "$label: "]]]"
</del><ins>+ append label ": [string repeat " " [expr {[string length $indent] - [string length "$label: "]}]]"
</ins><span class="cx"> return "$label[wrap $string $maxlen $indent 0]"
</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 == ""} {
</del><ins>+ if {$portname eq ""} {
</ins><span class="cx"> ui_msg "To use the current port, you must be in a port's directory."
</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 != "Registry error: No ports registered as installed."} {
</del><ins>+ if {$result ne "Registry error: No ports registered as installed."} {
</ins><span class="cx"> global errorInfo
</span><span class="cx"> ui_debug "$errorInfo"
</span><span class="cx"> fatal "port installed failed: $result"
</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 != "Registry error: No ports registered as installed."} {
</del><ins>+ if {$result ne "Registry error: No ports registered as installed."} {
</ins><span class="cx"> global errorInfo
</span><span class="cx"> ui_debug "$errorInfo"
</span><span class="cx"> fatal "port installed failed: $result"
</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 != "" && $os_platform_installed != 0
- && $os_major_installed != "" && $os_major_installed != 0
</del><ins>+ if {$os_platform_installed ne "" && $os_platform_installed != 0
+ && $os_major_installed ne "" && $os_major_installed != 0
</ins><span class="cx"> && ($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 != "Registry error: No ports registered as installed."} {
</del><ins>+ if {$result ne "Registry error: No ports registered as installed."} {
</ins><span class="cx"> global errorInfo
</span><span class="cx"> ui_debug "$errorInfo"
</span><span class="cx"> fatal "port installed failed: $result"
</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 != "Registry error: No ports registered as installed."} {
</del><ins>+ if {$result ne "Registry error: No ports registered as installed."} {
</ins><span class="cx"> global errorInfo
</span><span class="cx"> ui_debug "$errorInfo"
</span><span class="cx"> fatal "port installed failed: $result"
</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] == ""} {
</del><ins>+ if {[registry::list_dependents $iname] eq ""} {
</ins><span class="cx"> add_to_portlist results [list name $iname version "[lindex $i 1]_[lindex $i 2]" 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 "rdependentof"]
</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 "rdepof"]
</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 != ""} {
</del><ins>+ if {$name ne ""} {
</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 != ""} { set overrides(version) $version }
</del><ins>+ if {$version ne ""} { 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 "*/*" $portname]} {
</span><span class="cx"> set url "file://$portname"
</span><span class="cx"> set name [url_to_portname $url 1]
</span><del>- if { $name != "" } {
</del><ins>+ if { $name ne "" } {
</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 != "" || [moreargs]} {set firstTime 0} {
</del><ins>+ for {set firstTime 1} {$opt ne "" || [moreargs]} {set firstTime 0} {
</ins><span class="cx">
</span><span class="cx"> # Refresh opt as needed
</span><del>- if {$opt == ""} {
</del><ins>+ if {$opt eq ""} {
</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 "/" $opt]
</span><span class="cx"> if {$sepPos >= 0} {
</span><span class="cx"> # Version terminated by "/" 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 "+", or else is complete
</span><span class="cx"> set sepPos [string first "+" $opt]
</span><span class="cx"> if {$sepPos >= 0} {
</span><span class="cx"> # Version terminated by "+"
</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 "Usage: "
</span><span class="cx"> set len [string length $action]
</span><del>- append ret [wrap "$action$cmds$args" 0 [string repeat " " [expr 8 + $len]] 0]
</del><ins>+ append ret [wrap "$action$cmds$args" 0 [string repeat " " [expr {8 + $len}]] 0]
</ins><span class="cx"> append ret "\n"
</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 "$::errorInfo"
</span><span class="cx"> break_softcontinue "Portdir $portdir not found" 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 == "" || $index_only} {
</del><ins>+ if {$porturl eq "" || $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 "$::errorInfo"
</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)] && $options(ports_info_depends) == "yes"} {
</del><ins>+ if {[info exists options(ports_info_depends)] && $options(ports_info_depends) eq "yes"} {
</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 ""} {
</ins><span class="cx"> continue
</span><span class="cx"> }
</span><del>- if {![string length $label]} {
</del><ins>+ if {$label eq ""} {
</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] == "link"} {
</del><ins>+ if {![file isdirectory $file] || [file type $file] eq "link"} {
</ins><span class="cx"> set port [registry::file_registered $file]
</span><span class="cx"> if { $port != 0 } {
</span><span class="cx"> puts "$file is provided by: $port"
</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] == "image" && [registry::run_target $regref activate [array get options]]} {
</del><ins>+ if {[$regref installtype] eq "image" && [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 == "" || $composite_version == "${iversion}_${irevision}${ivariants}"} {
</del><ins>+ if {$composite_version eq "" || $composite_version == "${iversion}_${irevision}${ivariants}"} {
</ins><span class="cx"> set regref [registry::entry open $portname $iversion $irevision $ivariants [lindex $i 5]]
</span><del>- if {[$regref installtype] == "image" && [registry::run_target $regref deactivate [array get options]]} {
</del><ins>+ if {[$regref installtype] eq "image" && [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 "setrequested"]
</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 "Version: "
</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 "Platform: "
</span><span class="cx"> }
</span><span class="cx"> puts "${macports::os_platform} ${macports::os_major} ${macports::os_arch}"
</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] > 0 } {
</span><del>- if {$action == "rdependents"} {
</del><ins>+ if {$action eq "rdependents"} {
</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 "$::errorInfo"
</span><span class="cx"> break_softcontinue "Portdir $portdir not found" 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 == "rdeps" || [macports::ui_isset ports_verbose]} {
</del><ins>+ if {$action eq "rdeps" || [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 == "deps"} {
</del><ins>+ if {$action eq "deps"} {
</ins><span class="cx"> set label "$labeldict($type) Dependencies"
</span><span class="cx"> lappend deps_output [wraplabel $label [join $deplist ", "] 0 [string repeat " " 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 == "deps"} {
</del><ins>+ if {$action eq "deps"} {
</ins><span class="cx"> if {$ndeps == 0} {
</span><span class="cx"> ui_notice "$portname @${version}_${revision}${variants} has no dependencies."
</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) == "no")} {
</del><ins>+ if { [llength $portlist] || (![info exists private_options(ports_no_args)] || $private_options(ports_no_args) eq "no")} {
</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 != "Registry error: No ports registered as installed."} {
</del><ins>+ if {$result ne "Registry error: No ports registered as installed."} {
</ins><span class="cx"> global errorInfo
</span><span class="cx"> ui_debug "$errorInfo"
</span><span class="cx"> ui_error "port installed failed: $result"
</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 && $os_platform != "" && $os_major != 0 && $os_major != ""} {
</del><ins>+ if {$os_platform != 0 && $os_platform ne "" && $os_major != 0 && $os_major ne ""} {
</ins><span class="cx"> append extra " platform='$os_platform $os_major'"
</span><span class="cx"> }
</span><del>- if {$archs != 0 && $archs != ""} {
</del><ins>+ if {$archs != 0 && $archs ne ""} {
</ins><span class="cx"> append extra " archs='$archs'"
</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) == "no")} {
</del><ins>+ if { [llength $portlist] || (![info exists private_options(ports_no_args)] || $private_options(ports_no_args) eq "no")} {
</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 != "Registry error: No ports registered as installed."} {
</del><ins>+ if {$result ne "Registry error: No ports registered as installed."} {
</ins><span class="cx"> global errorInfo
</span><span class="cx"> ui_debug "$errorInfo"
</span><span class="cx"> ui_error "port installed failed: $result"
</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 ""
</span><span class="cx"> if {$epoch_comp_result != 0 && $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 != "" && $os_platform_installed != 0
- && $os_major_installed != "" && $os_major_installed != 0
</del><ins>+ if {$os_platform_installed ne "" && $os_platform_installed != 0
+ && $os_major_installed ne "" && $os_major_installed != 0
</ins><span class="cx"> && ($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 == "K" || $units == "Ki"} {
</del><ins>+ if {$units eq "K" || $units eq "Ki"} {
</ins><span class="cx"> return "KiB"
</span><del>- } elseif {$units == "k"} {
</del><ins>+ } elseif {$units eq "k"} {
</ins><span class="cx"> return "kB"
</span><del>- } elseif {$units == "Mi"} {
</del><ins>+ } elseif {$units eq "Mi"} {
</ins><span class="cx"> return "MiB"
</span><del>- } elseif {$units == "M"} {
</del><ins>+ } elseif {$units eq "M"} {
</ins><span class="cx"> return "MB"
</span><del>- } elseif {$units == "Gi"} {
</del><ins>+ } elseif {$units eq "Gi"} {
</ins><span class="cx"> return "GiB"
</span><del>- } elseif {$units == "G"} {
</del><ins>+ } elseif {$units eq "G"} {
</ins><span class="cx"> return "GB"
</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] > 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) != "yes"} {
</del><ins>+ if {![info exists options(ports_space_total)] || $options(ports_space_total) ne "yes"} {
</ins><span class="cx"> set msg "[bytesize $space $units] $portname"
</span><span class="cx"> if { $portversion != {} } {
</span><span class="cx"> append msg " @$portversion"
</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 "Port $portname does not contain any file or is not active."
</span><span class="cx"> }
</span><span class="lines">@@ -3429,7 +3431,7 @@
</span><span class="cx"> puts stderr "Port $portname is not installed."
</span><span class="cx"> }
</span><span class="cx"> }
</span><del>- if {[llength $portlist] > 1 || ([info exists options(ports_space_total)] && $options(ports_space_total) == "yes")} {
</del><ins>+ if {[llength $portlist] > 1 || ([info exists options(ports_space_total)] && $options(ports_space_total) eq "yes")} {
</ins><span class="cx"> puts "[bytesize $spaceall $units] total"
</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] && [info exists private_options(ports_no_args)] && $private_options(ports_no_args) == "yes"} {
</del><ins>+ if {![llength $portlist] && [info exists private_options(ports_no_args)] && $private_options(ports_no_args) eq "yes"} {
</ins><span class="cx"> ui_error "You must specify a search pattern"
</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)] && $options(ports_search_depends) == "yes"} {
</del><ins>+ if {[info exists options(ports_search_depends)] && $options(ports_search_depends) eq "yes"} {
</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) != "yes" } {
</del><ins>+ if { $options($option) ne "yes" } {
</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 == "none"} {
</del><ins>+ if {$matchstyle eq "none"} {
</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 "*" $portname] == -1 && [string first "?" $portname] == -1} {
</span><span class="cx"> set searchstring "*$portname*"
</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>- && $options(ports_search_line) == "yes"} {
</del><ins>+ && $options(ports_search_line) eq "yes"} {
</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 "$portinfo(name)\t$portinfo(version)\t$portinfo(categories)\t$portinfo(description)"
</span><span class="lines">@@ -3700,7 +3702,7 @@
</span><span class="cx"> ui_notice "No match for $portname found"
</span><span class="cx"> } elseif {[llength $res] > 1} {
</span><span class="cx"> if {(![info exists global_options(ports_search_line)]
</span><del>- || $global_options(ports_search_line) != "yes")} {
</del><ins>+ || $global_options(ports_search_line) ne "yes")} {
</ins><span class="cx"> ui_notice "\nFound [llength $res] ports."
</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] && [info exists private_options(ports_no_args)] && $private_options(ports_no_args) == "yes"} {
</del><ins>+ if { ![llength $portlist] && [info exists private_options(ports_no_args)] && $private_options(ports_no_args) eq "yes"} {
</ins><span class="cx"> add_to_portlist portlist [list name "-all-"]
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> foreachport $portlist {
</span><del>- if {$portname == "-all-"} {
</del><ins>+ if {$portname eq "-all-"} {
</ins><span class="cx"> if {[catch {set res [mportlistall]} result]} {
</span><span class="cx"> global errorInfo
</span><span class="cx"> ui_debug "$errorInfo"
</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 "$key=$value"
</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 != "" } {
</del><ins>+ if { $composite_version ne "" } {
</ins><span class="cx"> set ver_field "@$composite_version"
</span><span class="cx"> } else {
</span><span class="cx"> set ver_field ""
</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 == ""} {
</del><ins>+ if {$porturl eq ""} {
</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} == "10.5"} {
</del><ins>+ if {${macports::macosx_version} eq "10.5"} {
</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 == "" } { set editor "/usr/bin/vi" }
</del><ins>+ if { $editor eq "" } { set editor "/usr/bin/vi" }
</ins><span class="cx">
</span><span class="cx"> # Invoke the editor
</span><span class="cx"> if {[catch {eval exec >@stdout <@stdin 2>@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} == "10.5"} {
</del><ins>+ if {${macports::macosx_version} eq "10.5"} {
</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 == "" && ![catch {set ctx [mportopen $porturl]} result]} {
</del><ins>+ if {$homepage eq "" && ![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 != "" } {
</del><ins>+ if { $homepage ne "" } {
</ins><span class="cx"> if {[catch {system "${macports::autoconf::open_path} '$homepage'"} result]} {
</span><span class="cx"> global errorInfo
</span><span class="cx"> ui_debug "$errorInfo"
</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 == "install" || $action == "archive") && [prefix_unwritable] && ![macports::global_option_isset ports_dryrun]} {
</del><ins>+ if {($action eq "install" || $action eq "archive") && [prefix_unwritable] && ![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 == ""} {
</del><ins>+ if {$porturl eq ""} {
</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] == "" && [array get variations] != ""} {
</del><ins>+ if {[array get requested_variations] eq "" && [array get variations] ne ""} {
</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 == "install"} {
</del><ins>+ if {$action eq "install"} {
</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 == "archive"} {
</del><ins>+ } elseif {$action eq "archive"} {
</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 && $action == "install" && ![macports::global_option_isset ports_dryrun]} {
</del><ins>+ if {$status == 0 && $action eq "install" && ![macports::global_option_isset ports_dryrun]} {
</ins><span class="cx"> array set options $opts
</span><span class="cx"> if {![info exists options(ports_nodeps)] && ![info exists options(ports_install_no-rev-upgrade)] && ${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] != "-"} {
</del><ins>+ if {[string index $arg 0] ne "-"} {
</ins><span class="cx"> break
</span><del>- } elseif {[string index $arg 1] == "-"} {
</del><ins>+ } elseif {[string index $arg 1] eq "-"} {
</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 "\"port ${action} --${key}\" is ambiguous: \n port ${action} [join $errlst "\n port ${action} "]"
</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] && $kargc > 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 > 0} {
</span><del>- return -code error "--${key} expects [expr $kargc + [llength $args]] parameters!"
</del><ins>+ return -code error "--${key} expects [expr {$kargc + [llength $args]}] parameters!"
</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 ""
</span><del>- while { $line == "" } {
</del><ins>+ while { $line eq "" } {
</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 && $line != "" } {
</del><ins>+ if { $use_readline && $line ne "" } {
</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 "stdin"]
</span><span class="cx"> set name "port"
</span><del>- set use_readline [expr $isstdin && [readline init $name]]
</del><ins>+ set use_readline [expr {$isstdin && [readline init $name]}]
</ins><span class="cx"> set history_file [file normalize "${macports::macports_user_dir}/history"]
</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 == "-"} {
</del><ins>+ if {$file eq "-"} {
</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 != "stdin"} {
</del><ins>+ if {$in ne "stdin"} {
</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 "start", "update", "intermission" or "finish", where start will
+# be called before any number of update calls, interrupted by any number
+# of intermission calls (called because other output is being produced),
+# followed by one call to finish.
+# @param args
+# A list of variadic args that differ for each action.
+# For "start": empty.
+# For "update": contains the arguments $cur and $total where $cur is the
+# current number of units processed and $total is the total number of
+# units to be processed.
+# For "intermission": empty.
+# For "finish": empty.
+proc port_progress_generic {action args} {
+ global _port_progress_starttime _port_progress_display_bar
+ switch -nocase -- $action {
+ start {
+ set _port_progress_starttime [clock milliseconds]
+ set _port_progress_display_bar no
+ }
+ update {
+ # the for loop is a simple hack because Tcl 8.4 doesn't have
+ # lassign
+ foreach {now total} $args {
+ if {${_port_progress_display_bar} ne yes} {
+ # check whether we should show a progress bar for this transfer
+ if {[expr {[clock milliseconds] - ${_port_progress_starttime}}] > 500 && ($total == 0 || [expr {$now / $total}] < 0.5)} {
+ # wait 500ms, then, if we don't know the total or we're
+ # not past 50% yet, display a progress bar.
+ set _port_progress_display_bar yes
+ }
+ }
+ if {${_port_progress_display_bar} eq yes} {
+ set barprefix " "
+ if {$total != 0} {
+ progress_bar $now $total 20 $barprefix
+ } else {
+ unprogress_bar $now 20 $barprefix
+ }
+ }
+ }
+ }
+ intermission -
+ finish {
+ # erase to start of line
+ ::term::ansi::send::esol
+ # return cursor to start of line
+ puts -nonewline "\r"
+ flush stdout
+ }
+ }
</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 "start", "update" or "finish", where start will be called
+# before any number of update calls, followed by one call to finish.
+# @param args
+# A list of variadic args that differ for each action.
+# For "start": contains a single argument "ul" or "dl" indicating
+# whether this is an up- or download.
+# For "update": contains the arguments ("ul"|"dl") total now speed where
+# ul/dl are as for start, and total, now and speed are doubles
+# indicating the total transfer size, currently transferred amount and
+# average speed per second in bytes.
+# For "finish": empty.
+proc port_progress_download {action args} {
+ global _port_progress_starttime _port_progress_display_bar
+ switch -nocase -- $action {
+ start {
+ set _port_progress_starttime [clock milliseconds]
+ set _port_progress_display_bar no
+ }
+ update {
+ # the for loop is a simple hack because Tcl 8.4 doesn't have
+ # lassign
+ foreach {type total now speed} $args {
+ if {${_port_progress_display_bar} ne yes} {
+ # check whether we should show a progress bar for this transfer
+ if {[expr {[clock milliseconds] - ${_port_progress_starttime}}] > 500 && ($total == 0 || [expr {$now / $total}] < 0.5)} {
+ # wait 500ms, then, if we don't know the total or we're
+ # not past 50% yet, display a progress bar.
+ set _port_progress_display_bar yes
+ }
+ }
+ if {${_port_progress_display_bar} eq yes} {
+ set barprefix " "
+ if {$total != 0} {
+ set barsuffix [format " speed: %-13s" "[bytesize $speed {} "%.1f"]/s"]
+ progress_bar $now $total 20 $barprefix $barsuffix
+ } else {
+ set barsuffix [format " %-10s speed: %-13s" [bytesize $now {} "%6.1f"] "[bytesize $speed {} "%.1f"]/s"]
+ unprogress_bar $now 20 $barprefix $barsuffix
+ }
+ }
+ }
+ }
+ finish {
+ # erase to start of line
+ ::term::ansi::send::esol
+ # return cursor to start of line
+ puts -nonewline "\r"
+ flush stdout
+ }
+ }
+
+ 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 ""} {suffix ""}} {
+ # we use 8 different states per character, so let's multiply the width by
+ # 8 and map the percentage to this range
+ set percent [expr {(double($current) * 100 / double($total))}]
+ set progress [expr {int(round(($current * $halfwidth * 8) / $total))}]
+ set fullfields [expr {int($progress / 8)}]
+ set remainder [expr {$progress % 8}]
+
+ # clear the current line
+ set progressbar ""
+ for {set i 0} {$i < $fullfields} {incr i} {
+ # U+2588 FULL BLOCK doesn't match the other blocks in some fonts :/
+ # Use two half blocks instead
+ # Since we use two chars here, make sure to remove a space for each of
+ # those used!
+ append progressbar "\u258c\u258c"
+ }
+
+ if {$remainder == 0 && $fullfields < $halfwidth} {
+ append progressbar " "
+ } elseif {$remainder == 1} {
+ # U+258F LEFT ONE EIGHTH BLOCK
+ append progressbar "\u258f"
+ } elseif {$remainder == 2} {
+ # U+258E LEFT ONE QUARTER BLOCK
+ append progressbar "\u258e"
+ } elseif {$remainder == 3} {
+ # U+258D LEFT THREE EIGHTHS BLOCK
+ append progressbar "\u258d"
+ } elseif {$remainder == 4} {
+ # U+258C LEFT HALF BLOCK
+ append progressbar "\u258c"
+ } elseif {$remainder == 5} {
+ # U+258B LEFT FIVE EIGHTHS BLOCK
+ append progressbar "\u258b"
+ } elseif {$remainder == 6} {
+ # U+258A LEFT THREE QUARTERS BLOCK
+ append progressbar "\u258a"
+ } elseif {$remainder == 7} {
+ # U+2589 LEFT SEVEN EIGHTHS BLOCK
+ append progressbar "\u2589"
+ }
+
+ for {set i [expr {[string length $progressbar]}]} {$i < [expr {2 * $halfwidth}]} {incr i} {
+ append progressbar " "
+ }
+ set percentagesuffix [format " %5.1f %%" $percent]
+
+ puts -nonewline "\r${prefix}\[${progressbar}\]${percentagesuffix}${suffix}"
+ flush stdout
+}
+
+##
+# Draw a progress indicator
+#
+# @param current
+# the number of bytes currently downloaded
+# @param halfwidth
+# the half width in characters of the progress indicator
+# @param prefix
+# prefix to be printed in front of the progress indicator
+# @param suffix
+# suffix to be printed after the progress indicator
+proc unprogress_bar {current halfwidth {prefix ""} {suffix ""}} {
+ global _port_progress_unprogressbar_state
+
+ 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 ""
+
+ for {set i 0} {$i < [expr {2 * $halfwidth}]} {incr i} {
+ if {[expr $i % $numstates] == ${_port_progress_unprogressbar_state}} {
+ # U+2022 BULLET
+ append progressbar "\u2022"
+ } else {
+ append progressbar " "
+ }
+ }
+
+ puts -nonewline "\r${prefix}\[${progressbar}\]${suffix}"
+ 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] && $cmdname == "portf"} {
</del><ins>+if {[moreargs] && $cmdname eq "portf"} {
</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] && (![info exists ui_options(ports_quiet)] || $ui_options(ports_quiet) ne "yes")} {
+ set ui_options(progress_download) port_progress_download
+ set ui_options(progress_generic) port_progress_generic
+}
+
</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 && ![info exists ui_options(ports_commandfiles)] } {
</span><span class="cx"> lappend ui_options(ports_commandfiles) -
</span><del>-} elseif {[lookahead] == "selfupdate" || [lookahead] == "sync"} {
</del><ins>+} elseif {[lookahead] eq "selfupdate" || [lookahead] eq "sync"} {
</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 != "1" && [info exists qindex([string tolower [file tail $portdir]])]} {
</del><ins>+ if {$full_reindex != 1 && [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 >= $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)] && $availkey != "subports"} {
</del><ins>+ if {![info exists keepkeys($availkey)] && $availkey ne "subports"} {
</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 > 8]} {
</del><ins>+if {$argc > 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 == "-d"} { # Turn on debug output
</del><ins>+ if {$arg eq "-d"} { # Turn on debug output
</ins><span class="cx"> set ui_options(ports_debug) yes
</span><del>- } elseif {$arg == "-o"} { # Set output directory
</del><ins>+ } elseif {$arg eq "-o"} { # 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 == "-p"} { # Set platform
</del><ins>+ } elseif {$arg eq "-p"} { # 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 == "macosx"} {
</del><ins>+ if {$os_platform eq "macosx"} {
</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 == "-f"} { # Completely rebuild index
</del><ins>+ } elseif {$arg eq "-f"} { # Completely rebuild index
</ins><span class="cx"> set full_reindex 1
</span><span class="cx"> } else {
</span><span class="cx"> puts stderr "Unknown option: $arg"
</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 "\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"
</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 "Usage: $argv0"
</span><span class="cx"> }
</span><span class="cx">
</span><del>-if {[expr $argc > 0]} {
</del><ins>+if {$argc > 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 ""
</span><del>- while {[string length $str] > 0} {
</del><ins>+ while {$str ne ""} {
</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] != "/"} {
</del><ins>+ if {[string index $site end] ne "/"} {
</ins><span class="cx"> append site /
</span><span class="cx"> }
</span><span class="cx"> return "${site}[percent_encode ${distfile}]"
</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 && $firstslash < $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 ""
</span><span class="cx"> }
</span><span class="lines">@@ -122,9 +122,9 @@
</span><span class="cx"> set mirror_tag ""
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if {$mirror_tag == "mirror"} {
</del><ins>+ if {$mirror_tag eq "mirror"} {
</ins><span class="cx"> set thesubdir ${dist_subdir}
</span><del>- } elseif {$subdir == "" && $mirror_tag != "nosubdir"} {
</del><ins>+ } elseif {$subdir eq "" && $mirror_tag ne "nosubdir"} {
</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] && ![info exists extras_added($tag)]} {
</span><del>- if {$sglobal != ""} {
</del><ins>+ if {$sglobal ne ""} {
</ins><span class="cx"> set site_list [concat $site_list [mirror_sites $sglobal $tag "" $mirrorfile]]
</span><span class="cx"> }
</span><del>- if {$sfallback != ""} {
</del><ins>+ if {$sfallback ne ""} {
</ins><span class="cx"> set site_list [concat $site_list [mirror_sites $sfallback $tag "" $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] == "file://"} {
</del><ins>+ if {[string range $site 0 6] eq "file://"} {
</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] == "file://"} {
</del><ins>+ if {[string range $site 0 6] eq "file://"} {
</ins><span class="cx"> set host localhost
</span><span class="cx"> } else {
</span><span class="cx"> regexp $hostregex $site -> 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 "Your DNS servers incorrectly claim to know the address of nonexistent hosts. This may cause checksum mismatches for some ports."
</del><ins>+ ui_warn "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: <https://trac.macports.org/wiki/MisbehavingServers>"
</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 "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+namespace eval macports::autoconf {
+ variable macports_tcl_dir "@macports_tcl_dir@"
+ variable prefix "@prefix@"
+}
</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 ""
</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 "$UI_PREFIX [format [msgcat::mc "Loading %s"] [option subport]]"
</del><ins>+ ui_notice "$UI_PREFIX [format [msgcat::mc "Loading %s"] $subport]"
</ins><span class="cx"> if {[eval_targets "load"]} {
</span><del>- ui_error [format [msgcat::mc "Failed to load %s"] [option subport]]
</del><ins>+ ui_error [format [msgcat::mc "Failed to load %s"] $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] == "bsd" && [option os.platform] == "darwin"} {
</del><ins>+ if {[option build.type] eq "bsd" && [option os.platform] eq "darwin"} {
</ins><span class="cx"> ui_debug "build.type is BSD, adding bin:bsdmake:bsdmake build dependency"
</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] == "gnu" && [option os.platform] == "freebsd"} {
</del><ins>+ if {[option build.type] eq "gnu" && [option os.platform] eq "freebsd"} {
</ins><span class="cx"> ui_debug "build.type is GNU, adding bin:gmake:gmake build dependency"
</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] == "default"} {
</del><ins>+ if {[option build.type] eq "default"} {
</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] == "darwin"} {
</del><ins>+ if {[option os.platform] eq "darwin"} {
</ins><span class="cx"> return [findBinary bsdmake $portutil::autoconf::bsdmake_path]
</span><del>- } elseif {[option os.platform] == "freebsd"} {
</del><ins>+ } elseif {[option os.platform] eq "freebsd"} {
</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] == "darwin"} {
</del><ins>+ if {[option os.platform] eq "darwin"} {
</ins><span class="cx"> return [findBinary gnumake $portutil::autoconf::gnumake_path]
</span><del>- } elseif {[option os.platform] == "linux"} {
</del><ins>+ } elseif {[option os.platform] eq "linux"} {
</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] != "darwin"} {
</del><ins>+ if {[option os.platform] ne "darwin"} {
</ins><span class="cx"> return -code error "[format [msgcat::mc "This port requires 'xcodebuild', which is not available on %s."] [option os.platform]]"
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> global xcodebuildcmd
</span><del>- if {$xcodebuildcmd != "none"} {
</del><ins>+ if {$xcodebuildcmd ne "none"} {
</ins><span class="cx"> return $xcodebuildcmd
</span><span class="cx"> } else {
</span><span class="cx"> return -code error "xcodebuild was not found on this system!"
</span><span class="lines">@@ -140,7 +140,7 @@
</span><span class="cx"> ui_warn "defaulting to $jobs jobs, consider setting buildmakejobs to a nonzero value in macports.conf"
</span><span class="cx"> }
</span><span class="cx"> if {[info exists memsize] && $jobs > $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 <= 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] == "default" && [option os.platform] != "freebsd") || \
- ([option build.type] == "gnu")) \
</del><ins>+ if {(([option build.type] eq "default" && [option os.platform] ne "freebsd") || \
+ ([option build.type] eq "gnu")) \
</ins><span class="cx"> && [regexp "^(/\\S+/|)(g|gnu|)make(\\s+.*|)$" [option build.cmd]]} {
</span><span class="cx"> # Print "Entering directory" lines for better log debugging
</span><span class="cx"> return "-w [option build.target]"
</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 "md5 sha1 rmd160 sha256"
</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>- && [expr $nb_checksum % 2] == 0
- && [expr $nb_checksum / 2] <= $checksum_types_count
</del><ins>+ && [expr {$nb_checksum % 2}] == 0
+ && [expr {$nb_checksum / 2}] <= $checksum_types_count
</ins><span class="cx"> && [lsearch -exact $checksum_types [lindex $checksums_str 0]] >= 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] == "yes"} {
</del><ins>+ if {[parse_checksums $checksums_str] eq "yes"} {
</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 "%-8s%s" $type $calculated_sum]
</span><del>- if {[string equal $sum $calculated_sum]} {
</del><ins>+
+                 # Used for regression testing
+ ui_debug "[format [msgcat::mc "Calculated (%s) is %s"] $type $calculated_sum]"
+
+ if {$sum eq $calculated_sum} {
</ins><span class="cx"> ui_debug "[format [msgcat::mc "Correct (%s) checksum for %s"] $type $distfile]"
</span><span class="cx"> } else {
</span><span class="cx"> ui_error "[format [msgcat::mc "Checksum (%s) mismatch for %s"] $type $distfile]"
</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 "Only cleaning in ~/.macports; insufficient privileges for standard locations"
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if {[info exists ports_clean_all] && $ports_clean_all == "yes" || \
- [info exists ports_clean_dist] && $ports_clean_dist == "yes"} {
</del><ins>+ if {[info exists ports_clean_all] && $ports_clean_all eq "yes" || \
+ [info exists ports_clean_dist] && $ports_clean_dist eq "yes"} {
</ins><span class="cx"> ui_info "$UI_PREFIX [format [msgcat::mc "Removing distfiles for %s"] [option subport]]"
</span><span class="cx"> clean_dist
</span><span class="cx"> }
</span><del>- if {([info exists ports_clean_all] && $ports_clean_all == "yes" || \
- [info exists ports_clean_archive] && $ports_clean_archive == "yes")
</del><ins>+ if {([info exists ports_clean_all] && $ports_clean_all eq "yes" || \
+ [info exists ports_clean_archive] && $ports_clean_archive eq "yes")
</ins><span class="cx"> && !$usealtworkpath} {
</span><span class="cx"> ui_info "$UI_PREFIX [format [msgcat::mc "Removing temporary archives for %s"] [option subport]]"
</span><span class="cx"> clean_archive
</span><span class="cx"> }
</span><del>- if {[info exists ports_clean_all] && $ports_clean_all == "yes" || \
- [info exists ports_clean_work] && $ports_clean_work == "yes" || \
- [info exists ports_clean_archive] && $ports_clean_archive == "yes" || \
- [info exists ports_clean_dist] && $ports_clean_dist == "yes" || \
- !([info exists ports_clean_logs] && $ports_clean_logs == "yes")} {
</del><ins>+ if {[info exists ports_clean_all] && $ports_clean_all eq "yes" || \
+ [info exists ports_clean_work] && $ports_clean_work eq "yes" || \
+ [info exists ports_clean_archive] && $ports_clean_archive eq "yes" || \
+ [info exists ports_clean_dist] && $ports_clean_dist eq "yes" || \
+ !([info exists ports_clean_logs] && $ports_clean_logs eq "yes")} {
</ins><span class="cx"> ui_info "$UI_PREFIX [format [msgcat::mc "Removing work directory for %s"] [option subport]]"
</span><span class="cx"> clean_work
</span><span class="cx"> }
</span><del>- if {(([info exists ports_clean_logs] && $ports_clean_logs == "yes") || ($keeplogs == "no"))
</del><ins>+ if {(([info exists ports_clean_logs] && $ports_clean_logs eq "yes") || ($keeplogs eq "no"))
</ins><span class="cx"> && !$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] && $ports_force == "yes")
</del><ins>+ if {!([info exists ports_force] && $ports_force eq "yes")
</ins><span class="cx"> && [file isdirectory $distpath]
</span><span class="cx"> && [llength [readdir $distpath]] > 0} {
</span><span class="cx"> ui_warn [format [msgcat::mc "Distfiles directory '%s' may contain distfiles needed for other ports, use the -f flag to force removal" ] $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] && ($archivetype == "TMP"
</del><ins>+ if {[file isfile $path] && ($archivetype eq "TMP"
</ins><span class="cx"> || [extract_archive_metadata $path $archivetype portname] == $subport)} {
</span><span class="cx"> ui_debug "Removing archive: $path"
</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 <mww@macports.org>
</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)] && [set ${type}.cmd] == $option_defaults(${type}.cmd)) ||
- (![info exists option_defaults(${type}.cmd)] && [set ${type}.cmd] == "${type}")
</del><ins>+ ([info exists option_defaults(${type}.cmd)] && [set ${type}.cmd] eq $option_defaults(${type}.cmd)) ||
+ (![info exists option_defaults(${type}.cmd)] && [set ${type}.cmd] eq ${type})
</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} "set"]} {
</del><ins>+ if {$action eq "set"} {
</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 {"-L${prefix}/lib -Wl,-headerpad_max_install_names"}
</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 "\[portconfigure::configure_get_archflags $tool\]"
</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 ""} {
</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 "configure ccache"
</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 "ccache_dir ${ccache_dir} could not be created; disabling ccache: $result"
</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} >/dev/null
</span><del>- } result] {
</del><ins>+ } result]} {
</ins><span class="cx"> ui_warn "ccache_dir ${ccache_dir} could not be initialized; disabling ccache: $result"
</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 == ""} {
</del><ins>+ if {$supported_archs eq ""} {
</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 == "x86_64" && [lsearch -exact $supported_archs "i386"] != -1} {
</del><ins>+ } elseif {$arch eq "x86_64" && [lsearch -exact $supported_archs "i386"] != -1} {
</ins><span class="cx"> set add_arch "i386"
</span><del>- } elseif {$arch == "ppc64" && [lsearch -exact $supported_archs "ppc"] != -1} {
</del><ins>+ } elseif {$arch eq "ppc64" && [lsearch -exact $supported_archs "ppc"] != -1} {
</ins><span class="cx"> set add_arch "ppc"
</span><span class="cx"> } else {
</span><span class="cx"> continue
</span><span class="lines">@@ -297,14 +301,14 @@
</span><span class="cx"> set flags "-m64"
</span><span class="cx"> } elseif {[tbool configure.m32]} {
</span><span class="cx"> set flags "-m32"
</span><del>- } elseif {${configure.build_arch} != ""} {
</del><ins>+ } elseif {${configure.build_arch} ne ""} {
</ins><span class="cx"> if {[arch_flag_supported ${configure.compiler}] &&
</span><span class="cx"> [regexp {^(?:cc|cxx|objc|objcxx)$} $tool]
</span><span class="cx"> } then {
</span><span class="cx"> set flags "-arch ${configure.build_arch}"
</span><del>- } elseif {${configure.build_arch} == "x86_64" || ${configure.build_arch} == "ppc64"} {
</del><ins>+ } elseif {${configure.build_arch} eq "x86_64" || ${configure.build_arch} eq "ppc64"} {
</ins><span class="cx"> set flags "-m64"
</span><del>- } elseif {${configure.compiler} != "gcc-3.3"} {
</del><ins>+ } elseif {${configure.compiler} ne "gcc-3.3"} {
</ins><span class="cx"> set flags "-m32"
</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} != "" && [arch_flag_supported ${configure.compiler}]} {
</del><ins>+ if {${configure.build_arch} ne "" && [arch_flag_supported ${configure.compiler}]} {
</ins><span class="cx"> return "-arch ${configure.build_arch}"
</span><span class="cx"> } else {
</span><span class="cx"> return ""
</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} == "darwin" && ($macosx_deployment_target != $macosx_version
- || (${os.arch} == "powerpc" && $macosx_version == "10.4" && [variant_exists universal] && [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 "darwin" && ($sdk_version ne $macosx_version
+ || (${os.arch} eq "powerpc" && $macosx_version eq "10.4" && [variant_exists universal] && [variant_isset universal]))} {
</ins><span class="cx"> if {[vercmp $xcodeversion 4.3] < 0} {
</span><del>- set sdks_dir "${developer_dir}/SDKs"
</del><ins>+ set sdks_dir ${developer_dir}/SDKs
</ins><span class="cx"> } else {
</span><del>- set sdks_dir "${developer_dir}/Platforms/MacOSX.platform/Developer/SDKs"
</del><ins>+ set sdks_dir ${developer_dir}/Platforms/MacOSX.platform/Developer/SDKs
</ins><span class="cx"> }
</span><del>- if {$macosx_deployment_target == "10.4"} {
- set sdk "${sdks_dir}/MacOSX10.4u.sdk"
</del><ins>+ if {$sdk_version eq "10.4"} {
+ set sdk ${sdks_dir}/MacOSX10.4u.sdk
</ins><span class="cx"> } else {
</span><del>- set sdk "${sdks_dir}/MacOSX${macosx_deployment_target}.sdk"
</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 ""
</del><ins>+ return {}
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> # internal function to determine the "-arch xy" 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 ""
</span><span class="cx"> foreach arch ${configure.universal_archs} {
</span><del>- if {$flags == ""} {
</del><ins>+ if {$flags eq ""} {
</ins><span class="cx"> set flags "-arch $arch"
</span><span class="cx"> } else {
</span><span class="cx"> append flags " -arch $arch"
</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 ""} {
</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}] != ""}]
</del><ins>+ return [expr {[portconfigure::compiler_port_name ${compiler}] ne ""}]
</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 ""} {
</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 == "none" || $xcodeversion == ""} {
</del><ins>+ } elseif {$xcodeversion eq "none" || $xcodeversion eq ""} {
</ins><span class="cx"> return {cc}
</span><del>- } elseif {[vercmp $xcodeversion 4.6] >= 0} {
</del><ins>+ } elseif {[vercmp $xcodeversion 5.0] >= 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] >= 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] >= 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] >= 0} {
</span><del>- if {$macosx_deployment_target == "10.4"} {
- # 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] >= 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 ""} {
</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 == "-4.2"} {
</del><ins>+ if {$suffix eq "-4.2"} {
</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 -> suffix]} {
</span><del>- if {$suffix ne {}} {
</del><ins>+ if {$suffix ne ""} {
</ins><span class="cx"> set suffix "-mp${suffix}"
</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"> -> infix suffix]} {
</span><del>- if {$suffix ne {}} {
</del><ins>+ if {$suffix ne ""} {
</ins><span class="cx"> set suffix "-mp${suffix}"
</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 -> suffix]} {
</span><del>- if {$suffix ne {}} {
</del><ins>+ if {$suffix ne ""} {
</ins><span class="cx"> set suffix "-mp${suffix}"
</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} == "darwin" && ${os.major} == 12} {
</del><ins>+ if {${os.platform} eq "darwin" && ${os.major} == 12} {
</ins><span class="cx"> append_to_environment_value configure "__CFPREFERENCES_AVOID_DAEMON" 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} != ""} {
</del><ins>+ if {${configure.sdkroot} ne ""} {
</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 ""} {
</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 ""} {
</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 {} && [string match *clang* [option configure.cxx]]} {
</del><ins>+ if {${configure.cxx_stdlib} ne "" && [string match "*clang*" [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] == "default" && [option os.platform] != "freebsd") || \
- ([option build.type] == "gnu")) \
</del><ins>+ if {(([option build.type] eq "default" && [option os.platform] ne "freebsd") || \
+ ([option build.type] eq "gnu")) \
</ins><span class="cx"> && [regexp "^(/\\S+/|)(g|gnu|)make(\\s+.*|)$" [option destroot.cmd]]} {
</span><span class="cx"> # Print "Entering directory" lines for better log debugging
</span><span class="cx"> return "-w [option destroot.target]"
</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 "${destroot}${prefix}/${fileToDelete}"] {
</del><ins>+ if {[file exists "${destroot}${prefix}/${fileToDelete}"]} {
</ins><span class="cx"> ui_debug "Deleting stray ${fileToDelete} file."
</span><span class="cx"> file delete "${destroot}${prefix}/${fileToDelete}"
</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 "Fixing glibtool .la files in destroot for ${subport}"
</span><span class="cx"> fs-traverse -depth fullpath ${destroot} {
</span><del>- if {[file extension $fullpath] == ".la" && [file type $fullpath] == "file"} {
</del><ins>+ if {[file extension $fullpath] eq ".la" && [file type $fullpath] eq "file"} {
</ins><span class="cx"> # Make sure it is from glibtool ... "a libtool library file" will appear in the first line
</span><span class="cx"> if {![catch {set fp [open $fullpath]}]} {
</span><span class="cx"> if {[gets $fp line] > 0 && [string first "a libtool library file" $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] == "directory"} {
</del><ins>+ if {[file type $dir] eq "directory"} {
</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 "$gzip -d"
</span><span class="cx"> set bunzip2 "[findBinary bzip2 ${portutil::autoconf::bzip2_path}] -d"
</span><del>- if {[file isdirectory ${manpath}] && [file type ${manpath}] == "directory"} {
</del><ins>+ if {[file isdirectory ${manpath}] && [file type ${manpath}] eq "directory"} {
</ins><span class="cx"> ui_info "$UI_PREFIX [format [msgcat::mc "Compressing man pages for %s"] ${subport}]"
</span><span class="cx"> set found 0
</span><span class="cx"> set manlinks [list]
</span><span class="cx"> foreach mandir [readdir "${manpath}"] {
</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}] && [file type ${mandirpath}] == "directory"} {
</del><ins>+ if {[file isdirectory ${mandirpath}] && [file type ${mandirpath}] eq "directory"} {
</ins><span class="cx"> ui_debug "Scanning ${mandir}"
</span><span class="cx"> foreach manfile [readdir ${mandirpath}] {
</span><span class="cx"> set manfilepath [file join ${mandirpath} ${manfile}]
</span><del>- if {[file isfile ${manfilepath}] && [file type ${manfilepath}] == "file"} {
</del><ins>+ if {[file isfile ${manfilepath}] && [file type ${manfilepath}] eq "file"} {
</ins><span class="cx"> if {[regexp "^(.*\[.\]${manindex}\[a-z\]*)\[.\]gz\$" ${manfile} gzfile manfile]} {
</span><span class="cx"> set found 1
</span><span class="cx"> system "cd ${manpath} && \
</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}] == "link"} {
</del><ins>+ } elseif {[file type ${manfilepath}] eq "link"} {
</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 "yes"
</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 "$applications_dir $frameworks_dir /Library/LaunchAgents /Library/LaunchDaemons /Library/StartupItems" {
</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 "Portfile modification date is [clock format $port_moddate]"
</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 "--ignore-ssl-cert"
</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 "${size}"
</span><span class="cx"> } elseif {$totalsize < 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 "%.1fK" $size]
</span><span class="cx"> } elseif {$totalsize < 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 "%.1fM" $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 "%.1fG" $size]
</span><span class="cx"> }
</span><span class="cx"> ui_msg "$subport: $humansize"
</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 == "{}")
- && (![info exists patchfiles] || ![info exists patch_sites] || $patch_sites == "{}")} {
</del><ins>+ if {(![info exists master_sites] || $master_sites eq "{}")
+ && (![info exists patchfiles] || ![info exists patch_sites] || $patch_sites eq "{}")} {
</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 "\[$distfile\] [file join $portdbpath distfiles $dist_subdir $distfile]"
</span><span class="cx">
</span><span class="cx"> # print checksums if available
</span><del>- if {$result == "yes" && [array get checksums_array $distfile] != ""} {
</del><ins>+ if {$result eq "yes" && [array get checksums_array $distfile] ne ""} {
</ins><span class="cx"> foreach {type sum} $checksums_array($distfile) {
</span><span class="cx"> ui_msg " $type: $sum"
</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 "$UI_PREFIX [format [msgcat::mc "Extracting %s"] [option subport]]"
</span><span class="cx">
</span><span class="lines">@@ -103,6 +103,10 @@
</span><span class="cx"> option extract.cmd [binaryInPath "7za"]
</span><span class="cx"> option extract.pre_args x
</span><span class="cx"> option extract.post_args ""
</span><ins>+ } elseif {[tbool use_lzip]} {
+ option extract.cmd [binaryInPath "lzip"]
+ option extract.pre_args "-dc"
+ #option extract.post_args ""
</ins><span class="cx"> } elseif {[tbool use_dmg]} {
</span><span class="cx"> global distname extract.cmd
</span><span class="cx"> set dmg_mount [mkdtemp "/tmp/mports.XXXXXXXX"]
</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} "set"]} {
</span><del>- if {$args != "standard"} {
</del><ins>+ if {$args ne "standard"} {
</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 != ""} {
</del><ins>+ if {$distsite ne ""} {
</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 != ""} {
</del><ins>+ if {$distsite ne ""} {
</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 "--config-option servers:global:http-proxy-host=${proxy_host}"
</span><del>- if {$proxy_port != ""} {
</del><ins>+ if {$proxy_port ne ""} {
</ins><span class="cx"> append ret " --config-option servers:global:http-proxy-port=${proxy_port}"
</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} != "no"} {
</span><span class="cx"> lappend fetch_options "--remote-time"
</span><span class="cx"> }
</span><del>- if {$portverbose == "yes"} {
- lappend fetch_options "-v"
</del><ins>+ if {$portverbose eq "yes"} {
+ lappend fetch_options "--progress"
+ lappend fetch_options "builtin"
+ } elseif {[llength [info commands ui_progress_download]] > 0} {
+ lappend fetch_options "--progress"
+ lappend fetch_options "ui_progress_download"
</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) == "+"} {
</del><ins>+ if {$ourvariations($v) eq "+"} {
</ins><span class="cx"> puts $fd "@portvariant +${v}"
</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] == "directory"} {
</del><ins>+ if {[file type $fullpath] eq "directory"} {
</ins><span class="cx"> continue
</span><span class="cx"> }
</span><span class="cx"> set relpath [strsed $fullpath "s|^$destpath/||"]
</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 == ""} {
</del><ins>+ if {$oldpwd eq ""} {
</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 != ""} {
</del><ins>+ if {$archive_path ne ""} {
</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 != ""} {
</del><ins>+ if {$dep_portname ne ""} {
</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 "1970-1-1 00:00:00" -gmt true]]
</del><ins>+ $regref date [expr {[clock scan now -gmt true] - [clock scan "1970-1-1 00:00:00" -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 "\n" $last]} {
</del><ins>+ if {"\n" ne $last} {
</ins><span class="cx"> ui_warn "Line $lineno has missing newline (at end of file)"
</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 == "PortSystem" || $require_after == "PortGroup") && \
</del><ins>+ if {($require_after eq "PortSystem" || $require_after eq "PortGroup") && \
</ins><span class="cx"> [string match "PortGroup*" $line]} {
</span><span class="cx"> set require_blank false
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if {$nitpick && $require_blank && ($line != "")} {
</del><ins>+ if {$nitpick && $require_blank && ($line ne "")} {
</ins><span class="cx"> ui_warn "Line $lineno should be a newline (after $require_after)"
</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 "PortSystem"
</span><span class="cx"> }
</span><span class="cx"> if {[string match "PortGroup*" $line]} {
</span><del>- regexp {PortGroup\s+([a-z0-9_]+)\s+([0-9.]+)} $line -> portgroup portgroupversion
</del><ins>+ regexp {PortGroup\s+([A-Za-z0-9_]+)\s+([0-9.]+)} $line -> portgroup portgroupversion
</ins><span class="cx"> if {![info exists portgroup]} {
</span><span class="cx"> ui_error "Line $lineno has unrecognized PortGroup"
</span><span class="cx"> incr errors
</span><span class="lines">@@ -228,7 +228,7 @@
</span><span class="cx"> if {[string match "long_description*" $line]} {
</span><span class="cx"> set in_description true
</span><span class="cx"> }
</span><del>- if {$in_description && ([string range $line end end] != "\\")} {
</del><ins>+ if {$in_description && ([string range $line end end] ne "\\")} {
</ins><span class="cx"> set in_description false
</span><span class="cx"> #set require_blank true
</span><span class="cx"> #set require_after "long_description"
</span><span class="lines">@@ -245,7 +245,7 @@
</span><span class="cx">
</span><span class="cx"> if {[string match "platform\[ \t\]*" $line]} {
</span><span class="cx"> regexp {platform\s+(?:\w+\s+(?:\w+\s+)?)?(\w+)} $line -> platform_arch
</span><del>- if {$platform_arch == "ppc"} {
</del><ins>+ if {$platform_arch eq "ppc"} {
</ins><span class="cx"> ui_error "Arch 'ppc' in platform on line $lineno should be 'powerpc'"
</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"> && ![regexp {^\s*PortSystem|^\s*PortGroup|^\s*version} $line]
</span><del>- && ![regexp {^\s*[a-z0-9]+\.setup} $line]
</del><ins>+ && ![regexp {^\s*[A-Za-z0-9_]+\.setup} $line]
+ && ![regexp {^\s*license} $line]
</ins><span class="cx"> && [string first [option version] $line] != -1} {
</span><span class="cx"> ui_warn "Line $lineno seems to hardcode the version number, consider using \${version} instead"
</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
+ && $name ne "MacPorts"
+ && [string match "*/opt/local*" $line]
+ && ![regexp {^\s*reinplace} $line]
+ && ![regexp {^\s*system.*\Wsed\W} $line]} {
+ ui_error "Line $lineno hardcodes /opt/local, use \${prefix} instead"
+ }
+
</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 == "master_sites"} {
</del><ins>+ if {$req_var eq "master_sites"} {
</ins><span class="cx"> if {${fetch.type} != "standard"} {
</span><span class="cx"> ui_info "OK: $req_var not required for fetch.type ${fetch.type}"
</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 == ""} {
</del><ins>+ if {![info exists variantname] || $variantname eq ""} {
</ins><span class="cx"> ui_error "Variant number $variantnumber does not have a name"
</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 == ""} {
</del><ins>+ if {![info exists variantdesc] || $variantdesc eq ""} {
</ins><span class="cx"> # don't warn about missing descriptions for global variants
</span><span class="cx"> if {[lsearch -exact $local_variants $variantname] != -1 &&
</span><del>- [variant_desc $porturl $variantname] == ""} {
</del><ins>+ [variant_desc $porturl $variantname] eq ""} {
</ins><span class="cx"> ui_warn "Variant $variantname does not have a description"
</span><span class="cx"> incr warnings
</span><span class="cx"> set desc_ok false
</span><del>- } elseif {$variantdesc == ""} {
</del><ins>+ } elseif {$variantdesc eq ""} {
</ins><span class="cx"> set variantdesc "(pre-defined variant)"
</span><span class="cx"> }
</span><span class="cx"> } else {
</span><del>- if {[variant_desc $porturl $variantname] != ""} {
</del><ins>+ if {[variant_desc $porturl $variantname] ne ""} {
</ins><span class="cx"> ui_warn "Variant $variantname overrides global description"
</span><span class="cx"> incr warnings
</span><span class="cx"> }
</span><span class="lines">@@ -460,7 +470,7 @@
</span><span class="cx"> ui_debug "$errorInfo"
</span><span class="cx"> continue
</span><span class="cx"> }
</span><del>- if {$res == ""} {
</del><ins>+ if {$res eq ""} {
</ins><span class="cx"> ui_error "Unknown dependency: $dep"
</span><span class="cx"> incr errors
</span><span class="cx"> } else {
</span><span class="lines">@@ -499,19 +509,19 @@
</span><span class="cx"> $addr == "openmaintainer@macports.org"} {
</span><span class="cx"> ui_warn "Using full email address for no/open maintainer"
</span><span class="cx"> incr warnings
</span><del>- } elseif [regexp "^(.+)@macports.org$" $addr -> localpart] {
</del><ins>+ } elseif {[regexp "^(.+)@macports.org$" $addr -> localpart]} {
</ins><span class="cx"> ui_warn "Maintainer email address for $localpart includes @macports.org"
</span><span class="cx"> incr warnings
</span><span class="cx"> } elseif {$addr == "darwinports@opendarwin.org"} {
</span><span class="cx"> ui_warn "Using legacy email address for no/open maintainer"
</span><span class="cx"> incr warnings
</span><del>- } elseif [regexp "^(.+)@(.+)$" $addr -> localpart domain] {
</del><ins>+ } elseif {[regexp "^(.+)@(.+)$" $addr -> localpart domain]} {
</ins><span class="cx"> ui_warn "Maintainer email address should be obfuscated as $domain:$localpart"
</span><span class="cx"> incr warnings
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if {$license == "unknown"} {
</del><ins>+ if {$license eq "unknown"} {
</ins><span class="cx"> ui_warn "no license set"
</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 "+" $license_end] || [string is integer -strict $license_end]} {
</del><ins>+ if {"+" eq $license_end || [string is integer -strict $license_end]} {
</ins><span class="cx"> ui_error "invalid license '${test}': missing hyphen before version"
</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 > 0} {
</span><del>- if {$newoption != ""} {
</del><ins>+ if {$newoption ne ""} {
</ins><span class="cx"> ui_warn "Using deprecated option '$option', superseded by '$newoption'"
</span><span class="cx"> } else {
</span><span class="cx"> ui_warn "Using deprecated option '$option'"
</span><span class="lines">@@ -612,22 +622,22 @@
</span><span class="cx">
</span><span class="cx"> set svn_cmd ""
</span><span class="cx"> catch {set svn_cmd [findBinary svn]}
</span><del>- if {$svn_cmd != "" && ([file exists $portpath/.svn] || ![catch {exec $svn_cmd info $portpath > /dev/null 2>@1}])} {
</del><ins>+ if {$svn_cmd ne "" && ([file exists $portpath/.svn] || ![catch {exec $svn_cmd info $portpath > /dev/null 2>@1}])} {
</ins><span class="cx"> ui_debug "Checking svn properties"
</span><del>- if [catch {exec $svn_cmd propget svn:keywords $portfile 2>@1} output] {
</del><ins>+ if {[catch {exec $svn_cmd propget svn:keywords $portfile 2>@1} output]} {
</ins><span class="cx"> ui_warn "Unable to check for svn:keywords property: $output"
</span><span class="cx"> } else {
</span><span class="cx"> ui_debug "Property svn:keywords is \"$output\", should be \"Id\""
</span><del>- if {$output != "Id"} {
</del><ins>+ if {$output ne "Id"} {
</ins><span class="cx"> ui_error "Missing subversion property on Portfile, please execute: svn ps svn:keywords Id Portfile"
</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>@1} output] {
</del><ins>+ if {[catch {exec $svn_cmd propget svn:eol-style $portfile 2>@1} output]} {
</ins><span class="cx"> ui_warn "Unable to check for svn:eol-style property: $output"
</span><span class="cx"> } else {
</span><span class="cx"> ui_debug "Property svn:eol-style is \"$output\", should be \"native\""
</span><del>- if {$output != "native"} {
</del><ins>+ if {$output ne "native"} {
</ins><span class="cx"> ui_error "Missing subversion property on Portfile, please execute: svn ps svn:eol-style native Portfile"
</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 "Port (livecheck) version is ${livecheck.version}"
</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 "--ignore-ssl-cert"
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -99,7 +99,7 @@
</span><span class="cx"> if {[regexp "^($available_types)(?::(\[^:\]+))?" ${master_site} _ site subdir]} {
</span><span class="cx"> set subdirs [split $subdir /]
</span><span class="cx"> if {[llength $subdirs] > 1} {
</span><del>- if {[lindex $subdirs 0] == "project"} {
</del><ins>+ if {[lindex $subdirs 0] eq "project"} {
</ins><span class="cx"> set subdir [lindex $subdirs 1]
</span><span class="cx"> } else {
</span><span class="cx"> set subdir ""
</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 } "/Library/${startupitem.location}/${startupitem.plist}" {
</span><del>- if {[string length $launchctl_path] == 0} {
</del><ins>+ if {$launchctl_path eq ""} {
</ins><span class="cx"> return -code error [format [msgcat::mc "launchctl command was not found by configure"]]
</span><span class="cx"> } elseif {![file exists $path]} {
</span><span class="cx"> return -code error [format [msgcat::mc "Launchd plist %s was not found"] $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 != ""} {
</del><ins>+ if {$subport ne ""} {
</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] == "darwin"} {
</del><ins>+if {[option os.platform] eq "darwin"} {
</ins><span class="cx"> set macosx_version_text "(Mac OS X ${macosx_version}) "
</span><span class="cx"> }
</span><span class="cx"> ui_debug "OS [option os.platform]/[option os.version] ${macosx_version_text}arch [option os.arch]"
</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] == "darwin"} {
</del><ins>+if {[option os.platform] eq "darwin"} {
</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 "${altprefix}${portbuildpath}"
</span><span class="cx">
</span><span class="cx"> ui_debug "Going to use alternate build prefix: $altprefix"
</span><span class="cx"> ui_debug "workpath = $workpath"
</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"> && [info exists ports_mirror_new]
</span><del>- && $ports_mirror_new == "yes"
</del><ins>+ && $ports_mirror_new eq "yes"
</ins><span class="cx"> && [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] == ""} {
</del><ins>+ if {![exists patchfiles] || [option patchfiles] eq ""} {
</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 && $sandbox_enable]}
</del><ins>+default portsandbox_active {[expr {$portsandbox_supported && $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} "LOGFILE=\"${startupitem.logfile}\""
</span><span class="cx"> puts ${item} "EXECUTABLE=\"${startupitem.executable}\""
</span><span class="cx"> puts ${item} ""
</span><del>- puts ${item} "HAVE_STARTCMDS=[expr [llength ${startupitem.start}] ? "true" : "false"]"
- puts ${item} "HAVE_STOPCMDS=[expr [llength ${startupitem.stop}] ? "true" : "false"]"
- puts ${item} "HAVE_RESTARTCMDS=[expr [llength ${startupitem.restart}] ? "true" : "false"]"
</del><ins>+ puts ${item} "HAVE_STARTCMDS=[expr {[llength ${startupitem.start}] ? "true" : "false"}]"
+ puts ${item} "HAVE_STOPCMDS=[expr {[llength ${startupitem.stop}] ? "true" : "false"}]"
+ puts ${item} "HAVE_RESTARTCMDS=[expr {[llength ${startupitem.restart}] ? "true" : "false"}]"
</ins><span class="cx"> puts ${item} "DELETE_PIDFILE=${createPidFile}"
</span><span class="cx"> puts ${item} "CREATE_PIDFILE=${deletePidFile}"
</span><del>- puts ${item} "LOG_EVENTS=[expr [tbool ${startupitem.logevents}] ? "true" : "false"]"
</del><ins>+ puts ${item} "LOG_EVENTS=[expr {[tbool ${startupitem.logevents}] ? "true" : "false"}]"
</ins><span class="cx"> puts ${item} ""
</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} "<key>Debug</key><false/>"
</span><span class="cx"> puts ${plist} "<key>Disabled</key><true/>"
</span><del>- if {$macosx_deployment_target != "10.4"} {
</del><ins>+ if {$macosx_deployment_target ne "10.4"} {
</ins><span class="cx"> puts ${plist} "<key>KeepAlive</key><true/>"
</span><span class="cx"> } else {
</span><span class="cx"> puts ${plist} "<key>OnDemand</key><false/>"
</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} == "darwin"} {
</span><span class="cx"> if {[catch {package require Thread} error]} {
</span><span class="cx"> ui_warn "trace requires Tcl Thread package ($error)"
</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] \
+ "$env(HOME)/Library/Preferences/com.apple.dt.Xcode.plist" \
+ /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"> "$env(HOME)/.ccache"]
</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 == "10.5"} {
- 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 == "10.5"} {
</del><ins>+ if {$macosx_version eq "10.5"} {
</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 > 0} {
</span><del>- set path_start [expr [string first "\t" $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 "\t" $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 == "open" || $op == "execve"} {
</del><ins>+ if {$op eq "open" || $op eq "execve"} {
</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 == "sandbox_violation"} {
</del><ins>+ } elseif {$op eq "sandbox_violation"} {
</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 } "/Library/${startupitem.location}/${startupitem.plist}" {
</span><del>- if {[string length $launchctl_path] == 0} {
</del><ins>+ if {$launchctl_path eq ""} {
</ins><span class="cx"> return -code error [format [msgcat::mc "launchctl command was not found by configure"]]
</span><span class="cx"> } elseif {![file exists $path]} {
</span><span class="cx"> return -code error [format [msgcat::mc "Launchd plist %s was not found"] $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 == ""} {
</del><ins>+ if {$newoption eq ""} {
</ins><span class="cx"> ui_warn "Port $subport using deprecated option \"$option\"."
</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 != "read"} {
</del><ins>+ if {$action ne "read"} {
</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 ""
</span><span class="cx">
</span><span class="cx"> if {[llength $args] > 0} {
</span><del>- if {[lindex $args 0] == "-notty"} {
</del><ins>+ if {[lindex $args 0] eq "-notty"} {
</ins><span class="cx"> set notty "-notty"
</span><span class="cx"> set args [lrange $args 1 end]
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if {[lindex $args 0] == "-varprefix"} {
</del><ins>+ if {[lindex $args 0] eq "-varprefix"} {
</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 ""
</span><del>- if {[info exists ${varprefix}.nice] && [set ${varprefix}.nice] != ""} {
</del><ins>+ if {[info exists ${varprefix}.nice] && [set ${varprefix}.nice] ne ""} {
</ins><span class="cx"> set nice "-nice [set ${varprefix}.nice]"
</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 == "10.5"} {
</del><ins>+ if {$macosx_version eq "10.5"} {
</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] == "\n"} {
</del><ins>+ if {[string index $arg 0] eq "\n"} {
</ins><span class="cx"> set arg [string range $arg 1 end]
</span><span class="cx"> }
</span><del>- if {[string index $arg end] == "\n"} {
</del><ins>+ if {[string index $arg end] eq "\n"} {
</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 ""
</span><span class="cx"> for {set i 0} {$i < [string length $arg]} {incr i} {
</span><span class="cx"> set c [string index $arg $i]
</span><del>- if {$c != " " && $c != "\t"} {
</del><ins>+ if {$c ne " " && $c ne "\t"} {
</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 "\"\n$indent\" \"\n\"" $arg]
</span><span class="cx">
</span><span class="lines">@@ -563,7 +581,7 @@
</span><span class="cx"> return -code error "Malformed variant specification"
</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 "temp-variant"]
</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 == ""} {
</del><ins>+ if {$vdesc eq ""} {
</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)] && $variations($name) == "+"} {
</del><ins>+ if {[info exists variations($name)] && $variations($name) eq "+"} {
</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 != "" && $desc != ""} {
</del><ins>+ if {$name ne "" && $desc ne ""} {
</ins><span class="cx"> set variant_descs_global(${descfile}_$name) $desc
</span><span class="cx"> } else {
</span><span class="cx"> ui_warn "Invalid variant description in $descfile at line $lineno"
</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 "\n[join [lsort $env_list] "\n"]"
</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 == "N/A"} {
</del><ins>+ if {$portutil::autoconf::sed_ext_flag eq "N/A"} {
</ins><span class="cx"> ui_debug "sed extended regexp not available"
</span><span class="cx"> return -code error "reinplace sed(1) too old"
</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 < $file >@ $tmpfd]]
- if {$locale != ""} {
</del><ins>+ set cmdline [concat $cmdline [list $pattern < $file >@ $tmpfd 2>@stderr]]
+ if {$locale ne ""} {
</ins><span class="cx"> set env(LC_CTYPE) $locale
</span><span class="cx"> }
</span><ins>+ ui_info "$UI_PREFIX [format [msgcat::mc "Patching %s: %s"] [file tail $file] $pattern]"
</ins><span class="cx"> ui_debug "Executing reinplace: $cmdline"
</span><span class="cx"> if {[catch {eval exec $cmdline} error]} {
</span><span class="cx"> global errorInfo
</span><span class="cx"> ui_debug "$errorInfo"
</span><span class="cx"> ui_error "reinplace: $error"
</span><span class="cx"> file delete "$tmpfile"
</span><del>- if {$locale != ""} {
</del><ins>+ if {$locale ne ""} {
</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 == "10.5"} {
</del><ins>+ if {$macosx_version eq "10.5"} {
</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 "reinplace sed(1) failed"
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if {$locale != ""} {
</del><ins>+ if {$locale ne ""} {
</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 == "10.5"} {
</del><ins>+ if {$macosx_version eq "10.5"} {
</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 "delete: $args"
- 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 "-*" [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 ""} {
</ins><span class="cx"> return -code error "touch: option requires an argument -- $arg"
</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 "r"} {
</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 ""} {
</ins><span class="cx"> set year [clock format [clock seconds] -format %Y]
</span><del>- } elseif {[string length $CC] == 0} {
</del><ins>+ } elseif {$CC eq ""} {
</ins><span class="cx"> if {$YY >= 69 && $YY <= 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 ""} {
</ins><span class="cx"> set SS 00
</span><span class="cx"> }
</span><span class="cx"> set atime [clock scan "$year$MM$DD $hh$mm$SS"]
</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 "-*" [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 "move: illegal option -- $arg"}
+ }
+ }
+ if {[llength $args] == 2} {
+ set oldname [lindex $args 0]
+ set newname [lindex $args 1]
+ if {[string equal -nocase $oldname $newname] && $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 "-*" [lindex $args 0]]} {
</ins><span class="cx"> set arg [string range [lindex $args 0] 1 end]
</span><span class="cx"> if {[string length $arg] > 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) "${workpath}/.home"
</span><span class="cx"> set env(TMPDIR) "${workpath}/.tmp"
</span><span class="cx">
</span><del>- if {[ditem_key $ditem state] != "no"} {
</del><ins>+ if {[ditem_key $ditem state] ne "no"} {
</ins><span class="cx"> set target_state_fd [open_statefile]
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if {$procedure != ""} {
</del><ins>+ if {$procedure ne ""} {
</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] != "no"
</del><ins>+ if {[ditem_key $ditem state] ne "no"
</ins><span class="cx"> && [check_statefile target $targetname $target_state_fd]} {
</span><span class="cx"> ui_debug "Skipping completed $targetname ($portname)"
</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] && $ports_dryrun == "yes"} {
</del><ins>+ if {[info exists ports_dryrun] && $ports_dryrun eq "yes"} {
</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 "For $portname: skipping $targetname (dry run)"
</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"> && [info exists ports_trace]
</span><del>- && $ports_trace == "yes"
- && $target != "clean")} {
</del><ins>+ && $ports_trace eq "yes"
+ && $target ne "clean"
+ && $target ne "uninstall")} {
+ # 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 != "activate"
- && $target != "archive"
- && $target != "install"} {
</del><ins>+ if {$target ne "activate"
+ && $target ne "deactivate"
+ && $target ne "archive"
+ && $target ne "install"} {
</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)] && $PortInfo($deptype) != ""} {
</del><ins>+ if {[info exists PortInfo($deptype)] && $PortInfo($deptype) ne ""} {
</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 != ""} {
</del><ins>+ if {$name ne ""} {
</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] && $result == 0} {
- set postrun [ditem_key $ditem postrun]
- ui_debug "Executing $postrun"
- 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 & file creations outside workpath.
</span><span class="cx"> if {[info exists ports_trace]
</span><del>- && $ports_trace == "yes"
- && $target!="clean"} {
</del><ins>+ && $ports_trace eq "yes"
+ && $target ne "clean"
+ && $target ne "uninstall"} {
</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] && $result == 0} {
+ set postrun [ditem_key $ditem postrun]
+ ui_debug "Executing $postrun"
+ 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>- && [ditem_key $ditem runtype] != "always"
- && [ditem_key $ditem state] != "no"} {
</del><ins>+ && [ditem_key $ditem runtype] ne "always"
+ && [ditem_key $ditem state] ne "no"} {
</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] != "no"} {
</del><ins>+ if {[ditem_key $ditem state] ne "no"} {
</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 == "10.5"} {
</del><ins>+ if {$macosx_version eq "10.5"} {
</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 == "install"} {
</del><ins>+ if {$target eq "install"} {
</ins><span class="cx"> ui_debug "Skipping $target ($subport) since this port is already installed"
</span><span class="cx"> return 0
</span><del>- } elseif {$target == "activate"} {
</del><ins>+ } elseif {$target eq "activate"} {
</ins><span class="cx"> set regref [registry_open $subport $version $revision $portvariants ""]
</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 != ""} {
</del><ins>+ if {$target ne ""} {
</ins><span class="cx"> set matches [dlist_search $dlist provides $target]
</span><span class="cx">
</span><span class="cx"> if {[llength $matches] > 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 != "all"} {
</del><ins>+ } elseif {$target ne "all"} {
</ins><span class="cx"> ui_error "unknown target: $target"
</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) == "+"} {
</del><ins>+ if {$upvariations($flavor) eq "+"} {
</ins><span class="cx"> incr pros
</span><del>- } elseif {$upvariations($flavor) == "-"} {
</del><ins>+ } elseif {$upvariations($flavor) eq "-"} {
</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] != "no"} {
</del><ins>+ if {[ditem_key $d state] ne "no"} {
</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 &&
</span><del>- !([info exists ports_force] && $ports_force == "yes")} {
</del><ins>+ !([info exists ports_force] && $ports_force eq "yes")} {
</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 "Requested variants \"[canonicalize_variants [array get variations]]\" do not match original selection \"[canonicalize_variants [array get oldvariations]]\".\nPlease use the same variants again, perform 'port clean [option subport]' or specify the force option (-f)."
</span><span class="cx"> set result 1
</span><del>- } elseif {!([info exists ports_dryrun] && $ports_dryrun == "yes")} {
</del><ins>+ } elseif {!([info exists ports_dryrun] && $ports_dryrun eq "yes")} {
</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] == ""} {
</del><ins>+ if {[info commands $target] eq ""} {
</ins><span class="cx"> proc $target {args} "
</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] && ![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 ""
</span><span class="cx"> foreach val [option add_users] {
</span><del>- if {[string match *=* $val] && $cur != ""} {
</del><ins>+ if {[string match "*=*" $val] && $cur ne ""} {
</ins><span class="cx"> set split_arg [split $val =]
</span><del>- if {[lindex $split_arg 0] == "group"} {
</del><ins>+ if {[lindex $split_arg 0] eq "group"} {
</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 "darwin"} {
</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>@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 & 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 & Groups Preference Pane,
+ # and the others are just noise, so delete them.
+ # https://trac.macports.org/ticket/30168
+ exec $dscl . -delete /Users/${name} AuthenticationAuthority 2>@stderr
+ exec $dscl . -delete /Users/${name} PasswordPolicyOptions 2>@stderr
+ exec $dscl . -delete /Users/${name} dsAttrTypeNative:KerberosKeys 2>@stderr
+ exec $dscl . -delete /Users/${name} dsAttrTypeNative:ShadowHashData 2>@stderr
</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>@stderr
+ exec $dscl . -create /Users/${name} Password ${passwd} 2>@stderr
+ exec $dscl . -create /Users/${name} PrimaryGroupID ${gid} 2>@stderr
+ exec $dscl . -create /Users/${name} NFSHomeDirectory ${home} 2>@stderr
+ exec $dscl . -create /Users/${name} UserShell ${shell} 2>@stderr
+ } 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 "dscl($pid) was killed by $sigName: $msg"
+ ui_debug "dscl printed: $eMessage"
+ }
+
+ set failed? 1
+ } catch {{CHILDSTATUS *} eCode eMessage} {
+ foreach {- pid code} $eCode {
+ ui_error "dscl($pid) termined with an exit status of $code"
+ ui_debug "dscl printed: $eMessage"
+ }
+
+ set failed? 1
+ } catch {{POSIX *} eCode eMessage} {
+ foreach {- errName msg} {
+ ui_error "failed to execute $dscl: $errName: $msg"
+ ui_debug "dscl printed: $eMessage"
+ }
+
+ 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 "Attempting to clean up failed creation of user $name"
+ try {
+ exec $dscl . -delete /Users/${name} 2>@stderr
+ } catch {{CHILDKILLED *} eCode eMessage} {
+ foreach {- pid sigName msg} {
+ ui_warn "dscl($pid) was killed by $sigName: $msg while trying to clean up failed creation of user $name."
+ ui_debug "dscl printed: $eMessage"
+ }
+ } 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 "failed to execute $dscl: $errName: $msg while trying to clean up failed creation of user $name."
+ ui_debug "dscl printed: $eMessage"
+ }
+ }
+
+ # and raise an error to abort
+ error "dscl failed to create required user $name."
+ }
+ }
</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 "adduser is not implemented on ${os.platform}."
</span><span class="lines">@@ -2370,11 +2471,63 @@
</span><span class="cx">
</span><span class="cx"> if {${os.platform} eq "darwin"} {
</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 ""} {
- 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 ""} {
+ 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 "dscl($pid) was killed by $sigName: $msg"
+ ui_debug "dscl printed: $eMessage"
+ }
+
+ set failed? 1
+ } catch {{CHILDSTATUS *} eCode eMessage} {
+ foreach {- pid code} $eCode {
+ ui_error "dscl($pid) termined with an exit status of $code"
+ ui_debug "dscl printed: $eMessage"
+ }
+
+ set failed? 1
+ } catch {{POSIX *} eCode eMessage} {
+ foreach {- errName msg} {
+ ui_error "failed to execute $dscl: $errName: $msg"
+ ui_debug "dscl printed: $eMessage"
+ }
+
+ 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 "Attempting to clean up failed creation of group $name"
+ try {
+ exec $dscl . -delete /Groups/${name} 2>@stderr
+ } catch {{CHILDKILLED *} eCode eMessage} {
+ foreach {- pid sigName msg} {
+ ui_warn "dscl($pid) was killed by $sigName: $msg while trying to clean up failed creation of group $name."
+ ui_debug "dscl printed: $eMessage"
+ }
+ } 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 "failed to execute $dscl: $errName: $msg while trying to clean up failed creation of group $name."
+ ui_debug "dscl printed: $eMessage"
+ }
+ }
+
+ # and raise an error to abort
+ error "dscl failed to create required group $name."
+ }
</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 "source $groupFile"
</span><ins>+ ui_debug "Sourcing PortGroup $group $version from $groupFile"
</ins><span class="cx"> } else {
</span><span class="cx"> ui_warn "PortGroup ${group} ${version} could not be located. ${group}-${version}.tcl does not exist."
</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 == "contents"} {
</del><ins>+ if {$metadata_type eq "contents"} {
</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 == "portname"} {
</del><ins>+ } elseif {$metadata_type eq "portname"} {
</ins><span class="cx"> foreach line [split $raw_contents \n] {
</span><span class="cx"> if {[lindex $line 0] == "@portname"} {
</span><span class="cx"> return [lindex $line 1]
</span><span class="lines">@@ -2688,7 +2842,7 @@
</span><span class="cx"> set archs ""
</span><span class="cx"> set base_arch ""
</span><span class="cx"> foreach arch ${configure.universal_archs} {
</span><del>- if [file exists "${base}/${arch}"] {
</del><ins>+ if {[file exists "${base}/${arch}"]} {
</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 "-permissions"] + 1]]
</del><ins>+ set permissions [lindex $attributes [expr {[lsearch $attributes "-permissions"] + 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 && $macportsuser != "root" &&
</del><ins>+ if {[getuid] == 0 && $macportsuser ne "root" &&
</ins><span class="cx"> ([existsuser $macportsuser] == 0 || [existsgroup $macportsuser] == 0 )} {
</span><span class="cx"> ui_warn "configured user/group $macportsuser does not exist, will build as root"
</span><span class="cx"> set macportsuser "root"
</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 < 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} == "darwin"} {
</span><span class="lines">@@ -2942,7 +3096,7 @@
</span><span class="cx">
</span><span class="cx"> regexp {^(.*)/(.*?)$} "$fullname" match search_path depregex
</span><span class="cx">
</span><del>- if {[string index $search_path 0] != "/"} {
</del><ins>+ if {[string index $search_path 0] ne "/"} {
</ins><span class="cx"> # Prepend prefix if not an absolute path
</span><span class="cx"> set search_path "${prefix}/${search_path}"
</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 == ""} {
</del><ins>+ if {$depfile eq ""} {
</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 == "noarch"} {
</del><ins>+ if {$supported_archs eq "noarch"} {
</ins><span class="cx"> return "noarch"
</span><span class="cx"> } elseif {[variant_exists universal] && [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 "archflags do not exist for tool '$tool'"
</span><span class="cx"> }
</span><span class="cx"> } else {
</span><del>- if {$tool == "cc"} {
</del><ins>+ if {$tool eq "cc"} {
</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 == "noarch"} {
</del><ins>+ if {$supported_archs eq "noarch"} {
</ins><span class="cx"> return 0
</span><span class="cx"> } elseif {[variant_exists universal] && [variant_isset universal]} {
</span><span class="cx"> if {[llength ${configure.universal_archs}] > 1 || $universal_archs == ${configure.universal_archs}} {
</span><span class="lines">@@ -3028,7 +3182,7 @@
</span><span class="cx"> ui_error "$subport cannot be installed for the configured universal_archs '$universal_archs' because it only supports the arch(s) '$supported_archs'."
</span><span class="cx"> return 1
</span><span class="cx"> }
</span><del>- } elseif {$build_arch == "" || ${configure.build_arch} != ""} {
</del><ins>+ } elseif {$build_arch eq "" || ${configure.build_arch} != ""} {
</ins><span class="cx"> return 0
</span><span class="cx"> }
</span><span class="cx"> ui_error "$subport cannot be installed for the configured build_arch '$build_arch' because it only supports the arch(s) '$supported_archs'."
</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} == "macosx"} {
</del><ins>+ if {${os.subplatform} eq "macosx"} {
</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 == "none"} {
</del><ins>+ if {$xcodeversion eq "none"} {
</ins><span class="cx"> ui_warn "Xcode does not appear to be installed; most ports will likely fail to build."
</span><span class="cx"> if {[file exists "/Applications/Install Xcode.app"]} {
</span><span class="cx"> ui_warn "You downloaded Xcode from the Mac App Store but didn't install it. Run \"Install Xcode\" in the /Applications folder."
</span><span class="lines">@@ -3079,16 +3238,38 @@
</span><span class="cx"> ui_warn "The installed version of Xcode (${xcodeversion}) is known to cause problems. Version $rec or later is recommended on Mac OS X ${macosx_version}."
</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] >= 0 ||
- ($xcodeversion == "none" && [file exists "/Applications/Xcode.app"])} {
- if {![file exists "/usr/bin/make"]} {
- ui_warn "The Command Line Tools for Xcode don't appear to be installed; most ports will likely fail to build."
- ui_warn "See http://guide.macports.org/chunked/installing.xcode.html for more information."
</del><ins>+ # Xcode 4.3 and above requires the command-line utilities package to be installed.
+ if {[vercmp $xcodeversion 4.3] >= 0 || ($xcodeversion eq "none" && [file exists "/Applications/Xcode.app"])} {
+ if {[vercmp $macosx_version 10.9] >= 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 "/Library/Developer/CommandLineTools"
+ } else {
+ set cltpath "/"
</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 "The Xcode Command Line Tools don't appear to be installed; most ports will likely fail to build."
+ if {[vercmp $macosx_version 10.9] >= 0} {
+ ui_warn "Install them by running `xcode-select --install'."
+ } else {
+ ui_warn "You can install them from Xcode's Preferences in the Downloads section."
+ ui_warn "See http://guide.macports.org/chunked/installing.xcode.html#installing.xcode.lion.43 for more information."
+ }
+ }
+
+ # Check whether users have agreed to the Xcode license agreement
+ catch {exec [findBinary xcrun $portutil::autoconf::xcrun_path] clang 2>@1} output
+ set output [join [lrange [split $output "\n"] 0 end-1] "\n"]
+ if {[string match -nocase "*license*" $output]} {
+ ui_error "It seems you have not accepted the Xcode license; most ports will fail to build."
+ ui_error "Agree to the license by opening Xcode or running `sudo xcodebuild -license'."
+ 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] != ""} {
</del><ins>+ if {[find_portarchive_path] ne ""} {
</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 && [file extension $porturl] != ""} {
</del><ins>+ if {[file rootname [file tail $porturl]] eq $archiverootname && [file extension $porturl] ne ""} {
</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 && $firstslash < $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] != "/"} {
</del><ins>+ if {[string index $site end] ne "/"} {
</ins><span class="cx"> append site "/[option archive.subdir]"
</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 "s|^CFLAGS = -g \$(WFLAGS)|CFLAGS = -g \$(WFLAGS) ${configure.cppflags} ${configure.cflags} ${configure.ldflags} [get_canonical_archflags]|g" ${worksrcpath}/Makefile.in
+}
+
+configure.args --bindir=${prefix}/bin \
+ --mandir=${prefix}/share/man
+
+post-destroot {
+ eval xinstall -m 644 [glob ${worksrcpath}/*.1] ${destroot}${prefix}/share/man/man1/
+}
+
+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 "\
- puts -nonewline {checking if $statement == \"$value\"... }
- if {\[catch {
- set actual $statement
- if {\$actual == \[subst {$value}\]} { \n\
- puts yes
- } else { \n\
- puts \"no (was \$actual)\" \n\
- exit 1 \n\
- } \n\
- } msg\]} { \n\
- puts \"caught error: \$msg\" \n\
- exit 1 \n\
- }"
-}
-
-
</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 "FAIL: couldn't elevate privileges"
+ }
+
+ # when uid == 0 and euid == 0, the code will not attempt to elevate
+ # privileges
+ seteuid 0
+ if {[catch {portactivate::activate_start args}] != 0} {
+ return "FAIL: couldn't elevate privileges"
+ }
+ return "Activate_start successful."
+} -result "Activate_start successful."
+
+
+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 "FAIL: port install failed"
+ }
+
+} -body {
+ if {[$workername eval eval_targets activate] != 0} {
+ return "FAIL: cannot activate port after install"
+ }
+ if {[$workername eval eval_targets deactivate] != 0} {
+ return "FAIL: cannot deactivate port"
+ }
+ if {[$workername eval eval_targets activate] != 0} {
+ return "FAIL: cannot activate port after deactivate"
+ }
+ return "Port activate successful."
+
+} -cleanup {
+ if {[$workername eval eval_targets uninstall] != 0} {
+ return "FAIL: uninstall failed"
+ }
+ if {[$workername eval eval_targets clean] != 0} {
+ return "FAIL: clean failed"
+ }
+ array set macports::channels $oldchannels
+
+ mportclose $mport
+} -result "Port activate successful."
+
+
+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 != "yes"} {return "FAIL: error in checksum parse"}
+ if {$checksums_array(file) != "md5 1111"} {
+         return "FAIL: invalid file options"
+ }
+ if {$checksums_array(file2) != "sha1 3333"} {
+         return "FAIL: invalid file options"
+ }
+ return "Parse checksum successful."
+} -result "Parse checksum successful."
+
+
+test calc_md5 {
+ Calculate md5 unit test. Based on a file it creates.
+} -body {
+ set fd [open $pwd/file w+]
+ puts $fd "test.file"
+ close $fd
+
+ set res [portchecksum::calc_md5 $pwd/file]
+ if {$res != "9f70ecc1095ff10df81be6b5f218328d"} {
+         return "FAIL: unexpected md5"
+ }
+ return "Calc md5 successful."
+
+} -cleanup {
+ file delete -force $pwd/file
+} -result "Calc md5 successful."
+
+
+test calc_sha1 {
+ Calculate sha1 unit test.
+} -body {
+ set fd [open $pwd/file w+]
+ puts $fd "test.file"
+ close $fd
+
+ set res [portchecksum::calc_sha1 $pwd/file]
+ if {$res != "5560df60ff202ca8b8c3dcf51ad650b78e859261"} {
+         return "FAIL: unexpected sha1"
+ }
+ return "Calc sha1 successful."
+
+} -cleanup {
+ file delete -force $pwd/file
+} -result "Calc sha1 successful."
+
+
+test calc_rmd160 {
+ Calculate rmd160 unit test.
+} -body {
+ set fd [open $pwd/file w+]
+ puts $fd "test.file"
+ close $fd
+
+ set res [portchecksum::calc_rmd160 $pwd/file]
+ if {$res != "5aee5d12fe536e2e288e9f1daafd84f1bc17c3e6"} {
+         return "FAIL: unexpected rmd160"
+ }
+ return "Calc rmd160 successful."
+
+} -cleanup {
+ file delete -force $pwd/file
+} -result "Calc rmd160 successful."
+
+
+test calc_sha256 {
+ Calculate sha256 unit test.
+} -body {
+ set fd [open $pwd/file w+]
+ puts $fd "test.file"
+ close $fd
+
+ set res [portchecksum::calc_sha256 $pwd/file]
+ if {$res != "2f686816f2a80e8efcc4ef40ac4e898d27ce4205a61ee422d56f8c5e8b46612e"} {
+         return "FAIL: unexpected sha1"
+ }
+ return "Calc sha256 successful."
+
+} -cleanup {
+ file delete -force $pwd/file
+} -result "Calc sha256 successful."
+
+
+# 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 "FAIL: checksum not skipped"
+ }
+
+ 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 "FAIL: incorrect checksum"
+ }
+ return "Checksum main successful."
+
+} -cleanup {
+ file delete -force $distpath
+ file delete -force file
+ file delete -force file2
+} -result "Checksum main successful."
+
+
+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 "FAIL: couldn't elevate privileges"
+ }
+ seteuid 0
+ return "Clean_start successful."
+} -result "Clean_start successful."
+
+
+# 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 "FAIL: distfile not removed"
+ }
+ if {[file exists $distpath/dist_file2]} {
+ return "FAIL: distfile not removed"
+ }
+ if {[file exists $altprefix$distpath/dist_file2]} {
+ return "FAIL: alt distfile not removed"
+ }
+ if {[file exists $patchpath/patch_file2]} {
+ return "FAIL: patchfile not removed"
+ }
+ if {[file exists $altprefix$patchpath/patch_file2]} {
+ return "FAIL: alt patchfile not removed"
+ }
+ if {[file exists $portdbpath/distfiles/$dist_subdir]} {
+ return "FAIL: distfiles dir not removed"
+ }
+
+ return "Clean distfiles successful."
+
+} -cleanup {
+ file delete -force $distpath
+ file delete -force $portdbpath
+ file delete -force $patchpath
+ file delete -force $altprefix
+
+} -result "Clean distfiles successful."
+
+
+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 "FAIL: buildpath not removed"
+ }
+ if {[file exists $altprefix/subbuild]} {
+ return "FAIL: subbuild not removed"
+ }
+ if {[file exists $worksymlink]} {
+ return "FAIL: symlink not removed"
+ }
+ if {[file exists $altprefix$portpath]} {
+ return "FAIL: port dir in alt prefix not removed"
+ }
+
+ return "Clean work successful."
+
+} -cleanup {
+ file delete -force $subbuildpath
+ file delete -force $altprefix
+ file delete -force $worksymlink
+
+} -result "Clean work successful."
+
+
+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 "FAIL: log dir not removed"
+ }
+ return "Clean logs successful."
+
+} -cleanup {
+ file delete -force $portpath
+ file delete -force $subport
+
+} -result "Clean logs successful."
+
+
+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 "@portname subport"
+ 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 "FAIL: .TMP file not removed"
+ }
+ if {![file exists $portdbpath/incoming/test.clean]} {
+ return "FAIL: removed unrelated file"
+ }
+ if {[file exists $portdbpath/incoming/subport-2_0.0.0.0.zip]} {
+ return "FAIL: zip archive not removed"
+ }
+
+ return "Clean archive successful."
+
+} -cleanup {
+ file delete -force $pwd/+CONTENTS
+ file delete -force $portdbpath
+
+} -result "Clean archive successful."
+
+
+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 "FAIL: couldn't elevate privileges"
+ }
+
+ # when uid == 0 and euid == 0, the code will not attempt to elevate
+ # privileges
+ seteuid 0
+ if {[catch {portdeactivate::deactivate_start args}] != 0} {
+ return "FAIL: couldn't elevate privileges"
+ }
+ return "Deactivate_start successful."
+} -result "Deactivate_start successful."
+
+
+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 "FAIL: port install failed"
+ }
+
+} -body {
+ if {[$workername eval eval_targets activate] != 0} {
+ return "FAIL: cannot activate port after install"
+ }
+ if {[$workername eval eval_targets deactivate] != 0} {
+ return "FAIL: cannot deactivate port after activate"
+ }
+ return "Port deactivate successful."
+
+} -cleanup {
+ if {[$workername eval eval_targets uninstall] != 0} {
+ return "FAIL: uninstall failed"
+ }
+ if {[$workername eval eval_targets clean] != 0} {
+ return "FAIL: clean failed"
+ }
+ array set macports::channels $oldchannels
+
+ mportclose $mport
+} -result "Port deactivate successful."
+
+
+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 "FAIL: value lib:test.val:value not accepted"}
+ set res [catch {portdepends::validate_depends_options target set {bin:test.val:value}}]
+ if {$res != 0} {return "FAIL: value bin:test.val:value not accepted"}
+ set res [catch {portdepends::validate_depends_options target set {path:test:value}}]
+ if {$res != 0} {return "FAIL: value path:test:value not accepted"}
+ set res [catch {portdepends::validate_depends_options target set {port:test3}}]
+ if {$res != 0} {return "FAIL: value port:test3 not accepted"}
+ set res [catch {portdepends::validate_depends_options target set {lib:test}}]
+ if {$res != 1} {return "FAIL: invalid options lib:test accepted"}
+ return "Validate depends successful."
+} -result "Validate depends successful."
+
+# 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 "when destroot cmd is not gmake no -w argument is added" {} {
- global build.type build.cmd destroot.cmd destroot.target
-
- set build.type "gnu"
- set build.cmd "gmake"
- set destroot.cmd "_destroot_cmd_"
- set destroot.target "_target_"
-
- test_equal {[portdestroot::destroot_getargs]} "_target_"
-}
-
-proc "when destroot cmd is gmake a -w argument is added" {} {
- global build.type build.cmd destroot.cmd destroot.target
-
- set build.type "gnu"
- set build.cmd "_build_cmd_"
- set destroot.cmd "gmake"
- set destroot.target "_target_"
-
- test_equal {[portdestroot::destroot_getargs]} "-w _target_"
-}
-
-
-# run all tests
-foreach proc [info procs *] {
- puts "* ${proc}"
- $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 "http://distfiles.macports.org/cocot/"
+ set master_sites $porturl
+ set extract.suffix .tar.bz2
+
+} -body {
+ set fetch.type standard
+ set distcheck.type moddate
+ if {[portdistcheck::distcheck_main] != ""} {
+ return "FAIL: unable to download or check file, type moddate"
+ }
+ set distcheck.type filesize
+ if {[portdistcheck::distcheck_main] != ""} {
+ return "FAIL: unable to download or check file, type filesize"
+ }
+
+ return "Distcheck main successful."
+} -result "Distcheck main successful."
+
+
+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 "mirror tags are parsed correctly" {} {
- 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 {}] ""
- 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 "* ${proc}"
- $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 "FAIL: problem with install start"
+ }
+ return "Install start successful."
+} -result "Install start successful."
+
+
+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 "FAIL: destroot failed"
+ }
+
+ # 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 "FAIL: port install failed"
+ }
+
+} -body {
+ if {[catch {$workername eval portinstall::create_archive $create tgz}] != 0} {
+ return "FAIL: cannot create archive"
+ }
+ return "Create archive successful."
+
+} -cleanup {
+ if {[$workername eval eval_targets uninstall] != 0} {
+ return "FAIL: uninstall failed"
+ }
+ if {[$workername eval eval_targets clean] != 0} {
+ return "FAIL: clean failed"
+ }
+ array set macports::channels $oldchannels
+ mportclose $mport
+
+ file delete -force $pwd/$subport
+ file delete -force $portdbpath
+ file delete -force $pwd/work
+
+} -result "Create archive successful."
+
+
+# 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 "Error evaluating variants"
+ }
+
+ # set $version var
+ set workername [ditem_key $mport workername]
+
+ # run destroot
+ if {[$workername eval eval_targets destroot] != 0} {
+ return "FAIL: destroot failed"
+ }
+
+ # 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 "FAIL: cannot install port"
+ }
+ return "Install main successful."
+
+} -cleanup {
+ if {[$workername eval eval_targets uninstall] != 0} {
+ return "FAIL: uninstall failed"
+ }
+ if {[$workername eval eval_targets clean] != 0} {
+ return "FAIL: clean failed"
+ }
+ array set macports::channels $oldchannels
+
+ mportclose $mport
+
+ file delete -force $pwd/$subport
+ file delete -force $portdbpath
+ file delete -force $pwd/work
+
+} -result "Install main successful."
+
+
+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 "\<?xml version=\"1.0\" encoding=\"UTF-8\"?\>"
+ puts $fd "\<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"\>"
+ puts $fd "\<plist version=\"1.0\"\>"
+ puts $fd "\<dict\>"
+ puts $fd "\<key\>Label\</key\>"
+ puts $fd "\<string\>org.test.load\</string\>"
+ puts $fd "\<key\>ProgramArguments\</key\>"
+ puts $fd "\<array\>\<string\>/bin/ls\</string\>\</array\>"
+ puts $fd "\</dict\>"
+ puts $fd "\</plist\>"
+ close $fd
+
+} -body {
+ set launchctl_path ${portutil::autoconf::launchctl_path}
+ set startupitem.location test
+ set startupitem.plist files/file.plist
+
+ if {[portload::load_main] != ""} {
+ return "FAIL: unable to load plist"
+ }
+ return "Load successful."
+
+} -cleanup {
+ exec $launchctl_path unload -w $path 2>@stderr
+ file delete -force /Library/test
+
+} -result "Load successful."
+
+
+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] != "subport"} {
+ return "FAIL: wrong subport"
+ }
+ return "Get default subport successful."
+} -result "Get default subport successful."
+
+
+test get_subbuildpath {
+ Get subbuildpath unit test.
+} -body {
+ set portpath path/port/subport
+ if {[portmain::get_subbuildpath] != [file normalize "./build/subport"]} {
+ return "FAIL: wrong subbuildpath"
+ }
+ return "Get subbuild path successful."
+} -result "Get subbuild path successful."
+
+
+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 "FAIL: wrong path"
+ }
+ return "Get patch type successful."
+} -result "Get patch type successful."
+
+
+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 "first line should get to the workpath"
+ close $fd
+
+ set mport [mportopen file://.]
+ set workername [ditem_key $mport workername]
+ $workername eval "set patchfiles {file.diff}"
+
+} -body {
+ if {[$workername eval eval_targets patch]} {
+ return "FAIL: cannot run patch"
+ }
+ if {![file exists $pwd/work/fondu-060102/test_patch]} {
+ return "FAIL: missing patched file"
+ }
+ return "Patch successful."
+
+} -cleanup {
+ file delete -force $filespath
+ file delete -force $pwd/work
+
+} -result "Patch successful."
+
+
+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 "FAIL: port install failed"
+ }
+
+} -body {
+ if {[$workername eval eval_targets test] != 0} {
+ return "FAIL: test target failed"
+ }
+
+ return "Test main successful."
+
+} -cleanup {
+ if {[$workername eval eval_targets uninstall] != 0} {
+ return "FAIL: uninstall failed"
+ }
+ if {[$workername eval eval_targets clean] != 0} {
+ return "FAIL: clean failed"
+ }
+ file delete -force $pwd/work
+
+} -result "Test main successful."
+
+
+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 "Error evaluating variants"
+ }
+
+ # set $version var
+ set workername [ditem_key $mport workername]
+
+ # run destroot
+ if {[$workername eval eval_targets destroot] != 0} {
+ return "FAIL: destroot failed"
+ }
+
+ # 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 "FAIL: cannot install port"
+ }
+
+} -body {
+ if {[$workername eval eval_targets uninstall] != 0} {
+ return "FAIL: uninstall failed"
+ }
+ return "Uninstall main successful."
+
+} -cleanup {
+ if {[$workername eval eval_targets clean] != 0} {
+ return "FAIL: clean failed"
+ }
+
+ file delete -force $pwd/$subport
+ file delete -force $portdbpath
+ file delete -force $pwd/work
+
+} -result "Uninstall main successful."
+
+
+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 "/tmp/macports-portutil-delete"
- # 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 "delete (symlink) failed"
- }
-
- # test multiple args
- delete $root/a $root/b
-
- if {[file exists $root/a] || [file exists $root/b]} {
- error "delete (multiple args) failed"
- }
- } 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 "port:foo"} {
- error "depends_lib-delete did not delete properly"
- }
-}
-
-proc test_touch {} {
- set root "/tmp/macports-portutil-touch"
- file delete -force $root
-
- try {
- touch -c $root
- if {[file exists $root]} { error "touch failed" }
-
- touch $root
- if {![file exists $root]} { error "touch failed" }
-
- touch -a -t 199912010001.01 $root
- if {[file atime $root] != [clock scan 19991201T000101]} { error "touch failed" }
- if {[file mtime $root] == [clock scan 19991201T000101]} { error "touch failed" }
-
- touch -m -t 200012010001.01 $root
- if {[file atime $root] == [clock scan 20001201T000101]} { error "touch failed" }
- if {[file mtime $root] != [clock scan 20001201T000101]} { error "touch failed" }
-
- touch -a -m -t 200112010001.01 $root
- if {[file atime $root] != [clock scan 20011201T000101]} { error "touch failed" }
- if {[file mtime $root] != [clock scan 20011201T000101]} { error "touch failed" }
-
- touch -r ~ $root
- if {[file atime $root] != [file atime ~]} { error "touch failed" }
- if {[file mtime $root] != [file mtime ~]} { error "touch failed" }
- } finally {
- file delete -force $root
- }
-}
-
-proc test_ln {} {
- set root "/tmp/macports-portutil-ln"
- 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 "link"} {
- set message "ln failed: "
- if {[catch {file type $root/b}]} {
- append message "symlink not created"
- } elseif {[file type $root/b] ne "link"} {
- append message "created [file type $root/b], expected link"
- }
- error $message
- }
-
- close [open $root/c w]
- if {![catch {ln -s c $root/b}]} { error "ln failed" }
-
- ln -s -f c $root/b
- if {[catch {file type $root/b}] || [file type $root/b] ne "link"} { error "ln failed" }
-
- file delete $root/b
-
- ln $root/a $root/b
- if {[catch {file type $root/b}] || [file type $root/b] ne "file"} { error "ln failed" }
-
- 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 "link"} { error "ln failed" }
- file delete $root/dir/a
-
- ln -s -f -h a $root/b
- if {[catch {file type $root/b}] || [file type $root/b] ne "link" || [file readlink $root/b] ne "a"} { error "ln failed" }
-
- cd $root/dir
- ln -s ../c
- if {[catch {file type $root/dir/c}] || [file type $root/dir/c] ne "link"} { error "ln failed" }
-
- ln -s foobar $root/d
- if {[catch {file type $root/d}] || [file type $root/d] ne "link" || [file readlink $root/d] ne "foobar"} { error "ln failed" }
-
- ln -s -f -h z $root/dir
- if {[catch {file type $root/dir/z}] || [file type $root/dir/z] ne "link"} { error "ln failed" }
-
- # test combined flags
- ln -sf q $root/dir
- if {[catch {file type $root/dir/q}] || [file type $root/dir/q] ne "link"} { error "ln failed" }
- } finally {
- file delete -force $root
- }
-}
-
-# 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 "Unknown file map type: $typelist"
- }
- }
- }
-}
-
-# 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 ""
+
+
+ set mport [mportopen file://.]
+
+ proc getportbuildpath {id {portname ""}} {
+ global portdbpath
+ regsub {://} $id {.} port_path
+ regsub -all {/} $port_path {_} port_path
+ return [file join $portdbpath build $port_path $portname]
+ }
+
+ proc getportworkpath_from_buildpath {portbuildpath} {
+ return [file join $portbuildpath work]
+ }
+
+ proc getportworkpath_from_portdir {portpath {portname ""}} {
+ 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 "Unknown file map type: $typelist"
+ }
+ }
+ }
+}
+
+
+test option {
+ Option unit test. Tcl 'set' functionality.
+} -body {
+ if {[option MP macports] != "macports"} {return "FAIL: var not set correctly"}
+ if {$MP != "macports"} {return "FAIL: var not set"}
+ return "Option successful."
+} -result "Option successful."
+
+
+test exists {
+ Exists unit test. Checks for existance of a Portfile option.
+} -body {
+ set vara a
+ if {[exists vara] != 1} {return "FAIL: option exists but not detected"}
+ if {[exists varb] != 0} {return "FAIL: option detected although missing"}
+ return "Exists successful."
+} -result "Exists successful."
+
+
+test handle_option {
+ Handle_option unit test.
+} -body {
+ if {[handle_option vara a] != "a"} {return "FAIL: unable to set var"}
+ return "Handle_option successful."
+} -result "Handle_option successful."
+
+
+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] < 0} {return "FAIL: var not appended"}
+ if {[lsearch $user_options vard] >= 0} {return "FAIL: unappended var found"}
+ return "Handle_option-append successful."
+} -result "Handle_option-append successful."
+
+
+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] > 0} {return "FAIL: var not deleted"}
+ if {[lsearch $user_options vara] < 0} {return "FAIL: var not found"}
+ return "Handle_option-delete successful."
+} -result "Handle_option-delete successful."
+
+
+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] != ""} {return "FAIL: invalid result"}
+ return "Handle_option-strsed successful."
+} -result "Handle_option-strsed successful."
+
+
+# test handle_option-replace # deprecated
+
+
+test options {
+ Options unit test.
+} -body {
+ options date
+ if {[date macports] != "macports"} {return "FAIL: incorect options"}
+ return "Options successful."
+} -result "Options successful."
+
+
+# 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 != "tag1"} {return "FAIL: invalid tag detected"}
+ set tag [getdisttag distfile.tar.gz:tag1:tag2]
+ if {$tag != "tag2"} {return "FAIL: invalid last tag"}
+ set tag [getdisttag distfile.tar.gz]
+ if {$tag != ""} {return "FAIL: detected unexistent tag"}
+ return "Getdisttag successful."
+} -result "Getdisttag successful."
+
+
+test getdistname {
+ Get dist tag unit test.
+} -body {
+ set tag [getdistname distfile.tar.gz:tag1]
+ if {$tag != "distfile.tar.gz"} {return "FAIL: invalid name detected"}
+ set tag [getdistname distfile.gz::tag1]
+ if {$tag != "distfile.gz:"} {return "FAIL: invalid name"}
+ return "Getdistname successful."
+} -result "Getdistname successful."
+
+
+test tbool {
+ Tbool unit test. Check if variable is in calling namespace.
+} -setup {
+ set vara "yes"
+ set varb no
+} -body {
+ if {[tbool vara] == 0} { return "FAIL: var not true" }
+ if {[tbool varb] != 0} { return "FAIL: var not false" }
+ if {[tbool var] != 0} { return "FAIL: var should not be here" }
+ return "tbool successful."
+} -result "tbool successful."
+
+
+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 "FAIL: element not deleted" }
+ if {[ldelete $list a] != {b a}} { return "FAIL: first element not removed" }
+ if {[ldelete $empty a] != {}} { return "FAIL: list was empty" }
+ return "ldelete successful."
+} -result "ldelete successful."
+
+
+test reinplace {
+ Reinplace unit test. "Sed in place" functionality.
+} -setup {
+ global macportsuser
+ set macportsuser macports
+
+ set root "/tmp/macports-portutil-reinplace"
+ 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 "Macports reinplace unit test?"
+ 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 != "MacPorts reinplace unit test?" } {
+ return "FAIL: reinplace no args."
+ }
+ close $f
+
+ reinplace -E s/test?/testing/1 $file
+ catch {set f [open $file r]}
+ set cont [read -nonewline $f]
+ if { $cont != "MacPorts reinplace unit testing?" } {
+ return "FAIL: reinplace (-E) extended regex."
+ }
+ close $f
+
+ reinplace -W $second s/Macports/MP/1 file
+ catch {set f [open $second/file r]}
+ set cont [read -nonewline $f]
+ if { $cont != "MP reinplace unit test?" } {
+ return "FAIL: reinplace (-W) relative path."
+ }
+ close $f
+
+ reinplace -n s/unit/testing/1 $file
+ catch {set f [open $file r]}
+ set cont [read -nonewline $f]
+ if { $cont != "" } {
+ return "FAIL: reinplace (-n) suppress output."
+ }
+ close $f
+
+ return "Reinplace successful."
+
+} -cleanup {
+ file delete -force $root
+} -result "Reinplace successful."
+
+
+test delete {
+ Delete unit test.
+} -setup {
+ set root "/tmp/macports-portutil-delete"
+ 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 "FAIL: delete with single args."
+ }
+
+ delete $root/a $root/b
+ if {[file exists $root/a] || [file exists $root/b]} {
+ return "FAIL: delete with multiple args.""
+ }
+ return "Files deleted."
+
+} -cleanup {
+ file delete -force $root
+} -result "Files deleted."
+
+
+test touch {
+ Touch unit test.
+} -setup {
+ set root "/tmp/macports-portutil-touch"
+ file delete -force $root
+} -body {
+ touch -c $root
+ if {[file exists $root]} { return "FAIL: touch unsuccessful" }
+
+ touch $root
+ if {![file exists $root]} { return "FAIL: touch unsuccessful" }
+ return "Files successfully touched."
+
+} -cleanup {
+ file delete -force $root
+} -result "Files successfully touched."
+
+
+test ln {
+ ln unit test.
+} -setup {
+ set oldpwd [pwd]
+ set root "/tmp/macports-portutil-ln"
+ 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 "FAIL: symlink not created." }
+ if {[file type $root/b] ne "link"} { return "FAIL: expected link." }
+
+ close [open $root/c w]
+ if {![catch {ln -s c $root/b}]} { return "FAIL: ln not created." }
+
+ ln -s -f c $root/b
+ if {[catch {file type $root/b}] || [file type $root/b] ne "link"} {
+ return "FAIL: ln failed."
+ }
+ file delete $root/b
+
+ ln $root/a $root/b
+ if {[catch {file type $root/b}] || [file type $root/b] ne "file"} {
+ return "FAIL: ln failed."
+ }
+ 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 "link"} {
+ return "FAIL: directory ln failed."
+ }
+ file delete $root/dir/a
+
+ ln -s -f -h a $root/b
+ if {[catch {file type $root/b}] || [file type $root/b] ne "link" || [file readlink $root/b] ne "a"} {
+ return "FAIL: readlink error."
+ }
+
+ cd $root/dir
+ ln -s ../c
+ if {[catch {file type $root/dir/c}] || [file type $root/dir/c] ne "link"} {
+ return "FAIL: ln failed."
+ }
+
+ ln -s foobar $root/d
+ if {[catch {file type $root/d}] || [file type $root/d] ne "link" || [file readlink $root/d] ne "foobar"} {
+ return "FAIL: readlink error."
+ }
+
+ ln -s -f -h z $root/dir
+ if {[catch {file type $root/dir/z}] || [file type $root/dir/z] ne "link"} {
+ return "FAIL: ln failed."
+ }
+
+ ln -sf q $root/dir
+ if {[catch {file type $root/dir/q}] || [file type $root/dir/q] ne "link"} {
+ return "FAIL: error combined ln flags."
+ }
+ return "Files successfully linked."
+
+} -cleanup {
+ cd $oldpwd
+ file delete -force $root
+} -result "Files successfully linked."
+
+test makeuserproc {
+ Make user proc unit test.
+} -setup {
+ global MP
+ set MP macports
+} -body {
+ makeuserproc test-proc "\{ if \{ \$MP == \"macports\" \} \{return \"works\"\} \}"
+ set res [test-proc]
+ if { $res != "works" } { return "FAIL: global var not set in proc" }
+ return "Make user proc successful."
+
+} -result "Make user proc successful."
+
+
+# test backup -
+# test lipo -
+
+
+test unobscure_maintainers {
+ Unobscure maintainers unit test.
+} -body {
+ set list { port }
+ if { [unobscure_maintainers $list] != "port@macports.org" } {
+ return "FAIL: invalid maintainer name"
+ }
+ set list { google.com:port }
+ if { [unobscure_maintainers $list] != "port@google.com" } {
+ return "FAIL: invalid maintainer name"
+ }
+
+ set list { port@google.com }
+ if { [unobscure_maintainers $list] != "port@google.com" } {
+ return "FAIL: invalid maintainer name"
+ }
+ return "unobscure_maintainers successful."
+} -result "unobscure_maintainers successful."
+
+
+# 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 "first line should get to the workpath"
+ close $fd
+
+ # sets up PortInfo array
+ if {[eval_variants variations] != 0} {
+ mportclose $mport
+ error "Error evaluating variants"
+ }
+
+ 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 "FAIL: invalid target detected"
+ }
+ if {[$workername eval eval_targets checksum] != 0} {
+ return "FAIL: valid target not detected"
+ }
+ return "Eval_targets successful."
+
+} -cleanup {
+ mportclose $mport
+ file delete -force $filespath
+ file delete -force work
+
+} -result "Eval_targets successful."
+
+
+test get_statefile_value {
+ Get statefile value unit test.
+ Depends on line in statefile "target: org.macports.fetch".
+} -body {
+ set fd [open $pwd/statefile r]
+
+ set res [catch {get_statefile_value target $fd result}]
+ if {$res != 0 || $result != "org.macports.fetch"} {
+ return "FAIL: invalid value"
+ }
+ return "Get statefile value successful."
+} -result "Get statefile value successful."
+
+
+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 "FAIL: target not found"}
+
+ set res [check_statefile target org.macports.port $fd]
+ if {$res != 0} {return "FAIL: invalid target found"}
+ close $fd
+ return "Check_statefile successful."
+} -result "Check_statefile successful."
+
+
+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 "FAIL: variant not set"}
+ close $fd
+ return "Write_statefile successful."
+
+} -cleanup {
+ file delete -force $pwd/test.statefile
+} -result "Write_statefile successful."
+
+
+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 "FAIL: invalid variant"}
+ set res [check_statefile_variants variations oldvariations_fail $fd]
+ if {$res != 1} {return "FAIL: invalid variant"}
+ close $fd
+ return "Check statefile successful."
+
+} -result "Check statefile successful."
+
+
+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] != "" && [lindex $res 0] != "ditem_1"} {
+ return "FAIL: invalid variations"
+ }
+ set res [choose_variants $mport variations_neg]
+ if {[lindex $res 0] != "" && [lindex $res 1] != "ditem_1"} {
+ return "FAIL: invalid variations"
+ }
+ set res [choose_variants $mport variations_not]
+ if {[lindex $res 0] != "" && [lindex $res 1] != ""} {
+ return "FAIL: invalid variations"
+ }
+ return "Choose variant successful."
+} -result "Choose variant successful."
+
+
+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 "FAIL: unable to run variant name proc"
+ }
+ return "Variant run successful."
+} -cleanup {
+ mportclose $mport
+ file delete -force work
+} -result "Variant run successful."
+
+
+test canonicalize_variants {
+ Canonicalize_variants unit test.
+} -body {
+ set arr {c + b - d +}
+ if {[canonicalize_variants $arr +] != "+c+d"} {
+ return "FAIL: incorrect string"
+ }
+ if {[canonicalize_variants $arr -] != "-b"} {
+ return "FAIL: incorrect string"
+ }
+ return "Canonicalize variants successful."
+} -result "Canonicalize variants successful."
+
+
+# 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 "FAIL: universal variant not set"
+ }
+ return "Universal_setup successful."
+} -result "Universal_setup successful."
+
+
+# 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] != "new-variant"} {
+ return "FAIL: error building new variant"
+ }
+ return "Variant new successful."
+} -result "Variant new successful."
+
+
+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] != "org" || [lindex $PortInfo(vinfo) 1] != "is_default +"} {
+ return "FAIL: default variant not set"
+ }
+ if {[lindex $PortInfo(vinfo) 2] != "org2" || [lindex $PortInfo(vinfo) 3] != "is_default -"} {
+ return "FAIL: nondefault variant not set"
+ }
+
+ return "Handle default variant successful."
+} -result "Handle default variant successful."
+
+
+# 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 "FAIL: wrong dir size"
+ }
+ return "Directory size calculated successfully."
+
+} -cleanup {
+ file delete -force $pwd/test.dir
+} -result "Directory size calculated successfully."
+
+
+test set_ui_prefix {
+ Set_ui unit test. Assumes default: "---> ".
+} -body {
+ set env(UI_PREFIX) MacPorts
+ set_ui_prefix
+ if {$UI_PREFIX != "MacPorts"} {return "FAIL: incorrect prefix"}
+
+ unset env(UI_PREFIX)
+ set_ui_prefix
+ if {$UI_PREFIX != "---> "} {return "FAIL; default prefix not set"}
+ return "Set_ui_prefix successful."
+} -result "Set_ui_prefix successful."
+
+
+# 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 != "testport-1.0_2var1.darwin_10.no.tgz"} {
+ return "FAIL: invalid portimage_name"
+ }
+ return "Get portimage_name successful."
+} -result "Get portimage_name successful."
+
+
+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 "dbpath/software/subport/subport-1.0_2var1.darwin_10.no.tgz"]} {
+ return "FAIL: invalid portimage_path"
+ }
+ return "Get portimage_path successful."
+} -result "Get portimage_path successful."
+
+
+test supportedArchiveTypes {
+ Supported archive types unit test.
+ Only tests xar, zip, cpio.
+} -body {
+ set archives [supportedArchiveTypes]
+
+ foreach archive $archives {
+ if {$archive == "xar" && ![file exists ${portutil::autoconf::xar_path}]} {
+ return "FAIL: xar detected but inexistent"
+ }
+ if {$archive == "zip" && ![file exists ${portutil::autoconf::zip_path}]} {
+ return "FAIL: zip detected but inexistent"
+ }
+ if {$archive == "cpio" && ![file exists ${portutil::autoconf::cpio_path}]} {
+ return "FAIL: cpio detected but inexistent"
+ }
+ }
+ return "Supported archives successful."
+} -result "Supported archives successful."
+
+
+# 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 ""
+set test_name ""
+set color_out ""
+set tcl ""
+set err ""
+
+# Get tclsh path.
+set autoconf ../../Mk/macports.autoconf.mk
+set fp [open $autoconf r]
+while {[gets $fp line] != -1} {
+ if {[string match "TCLSH*" $line] != 0} {
+ set tcl [lrange [split $line " "] 1 1]
+ }
+}
+
+proc print_help {arg} {
+ if { $arg eq "tests" } {
+ puts "The list of available tests is:"
+        cd tests
+        set test_suite [glob *.test]
+ foreach test $test_suite {
+ puts [puts -nonewline " "]$test
+ }
+ } else {
+ puts "Usage: tclsh test.tcl \[-debug level\] \[-t test\] \[-l\]\n"
+ puts " -debug LVL : sets the level of printed debug info \[0-3\]"
+ puts " -t TEST : run a specific test"
+ puts " -nocolor : disable color output (for automatic testing)"
+ puts " -l : print the list of available tests"
+ puts " -h, -help : print this message\n"
+ }
+}
+
+# Process args
+foreach arg $argv {
+ if { $arg eq "-h" || $arg eq "-help" } {
+ print_help ""
+ exit 0
+ } elseif { $arg eq "-debug" } {
+ set index [expr {[lsearch $argv $arg] + 1}]
+ set level [lindex $argv $index]
+ if { $level >= 0 && $level <= 3 } {
+ append arguments "-debug " $level
+ } else {
+ puts "Invalid debug level."
+ exit 1
+ }
+ } elseif { $arg eq "-t" } {
+ set index [expr {[lsearch $argv $arg] + 1}]
+ set test_name [lindex $argv $index]
+ set no 0
+        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 "-l" } {
+ print_help tests
+ exit 0
+ } elseif { $arg eq "-nocolor" } {
+ set color_out "no"
+ }
+}
+
+
+# Run tests
+if { $test_name ne ""} {
+ set result [eval exec $tcl $test_name $arguments 2>@stderr]
+ puts $result
+
+} else {
+ cd tests
+ set test_suite [glob *.test]
+
+ foreach test $test_suite {
+ set result [eval exec $tcl $test $arguments 2>@stderr]
+        set lastline [lindex [split $result "\n"] end]
+
+        if {[lrange [split $lastline "\t"] 1 1] != "Total"} {
+         set lastline [lindex [split $result "\n"] end-2]
+         set errmsg [lindex [split $result "\n"] end]
+        }
+
+        set splitresult [split $lastline "\t"]
+ set total [lindex $splitresult 2]
+ set pass [lindex $splitresult 4]
+ set skip [lindex $splitresult 6]
+ set fail [lindex $splitresult 8]
+
+        # Format output
+        if {$total < 10} { set total "0${total}"}
+        if {$pass < 10} { set pass "0${pass}"}
+        if {$skip < 10} { set skip "0${skip}"}
+        if {$fail < 10} { set fail "0${fail}"}
+
+ # Check for errors.
+ if { $fail != 0 } { set err "yes" }
+
+ set out ""
+ if { ($fail != 0 || $skip != 0) && $color_out eq "" } {
+ # Color failed tests.
+ append out "\x1b\[1;31mTotal:" $total " Passed:" $pass " Failed:" $fail " Skipped:" $skip " \x1b\[0m" $test
+ } else {
+ append out "Total:" $total " Passed:" $pass " Failed:" $fail " Skipped:" $skip " " $test
+ }
+
+ # Print results and constrints for auto-skipped tests.
+ puts $out
+ if { $skip != 0 } {
+ set out " Constraint: "
+ append out [string trim $errmsg "\t {}"]
+ puts $out
+ }
+        if { $fail != 0 } {
+         set end [expr {[string first $test $result 0] - 1}]
+         puts [string range $result 0 $end]
+        }
+ }
+}
+
+# Return 1 if errors were found.
+if {$err ne ""} { exit 1 }
+
+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("Unable to launch process %s.\n", 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("Option error: missing argument for option %s\n", 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 ""} {optionslist ""}} {
</span><del>- if {$v == ""} {
</del><ins>+ if {$v eq ""} {
</ins><span class="cx"> return [activate $name "" "" 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 "[$i version]_[$i revision][$i variants]"] } {
</del><ins>+ if { $specifier ne "[$i version]_[$i revision][$i variants]" } {
</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] "image"] } {
</del><ins>+ if { [$requested installtype] ne "image" } {
</ins><span class="cx"> return -code error "Image error: ${name} @${specifier} not installed as an image."
</span><span class="cx"> }
</span><span class="cx"> if {![::file isfile $location]} {
</span><span class="cx"> return -code error "Image error: Can't find image file $location"
</span><span class="cx"> }
</span><del>- if { [string equal [$requested state] "installed"] } {
</del><ins>+ if {[$requested state] eq "installed"} {
</ins><span class="cx"> return -code error "Image error: ${name} @${specifier} is already active."
</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 ""} {optionslist ""}} {
</span><del>- if {$v == ""} {
</del><ins>+ if {$v eq ""} {
</ins><span class="cx"> return [deactivate $name "" "" 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 ""] } {
</del><ins>+ if {$name eq ""} {
</ins><span class="cx"> throw registry::image-error "Registry error: Please specify the name of the port."
</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 "[$requested version]_[$requested revision][$requested variants]"
</span><span class="cx">
</span><del>- if {$version != "" && ($version != [$requested version] ||
- ($revision != "" && ($revision != [$requested revision] || $variants != [$requested variants])))} {
</del><ins>+ if {$version ne "" && ($version != [$requested version] ||
+ ($revision ne "" && ($revision != [$requested revision] || $variants != [$requested variants])))} {
</ins><span class="cx"> set v $version
</span><del>- if {$revision != ""} {
</del><ins>+ if {$revision ne ""} {
</ins><span class="cx"> append v _${revision}${variants}
</span><span class="cx"> }
</span><span class="cx"> return -code error "Active version of $name is not $v but ${specifier}."
</span><span class="lines">@@ -186,11 +186,11 @@
</span><span class="cx">
</span><span class="cx"> ui_msg "$UI_PREFIX [format [msgcat::mc "Deactivating %s @%s"] $name $specifier]"
</span><span class="cx">
</span><del>- if { ![string equal [$requested installtype] "image"] } {
</del><ins>+ if { [$requested installtype] ne "image" } {
</ins><span class="cx"> return -code error "Image error: ${name} @${specifier} not installed as an image."
</span><span class="cx"> }
</span><span class="cx"> # this shouldn't be possible
</span><del>- if { [$requested state] != "installed" } {
</del><ins>+ if { [$requested state] ne "installed" } {
</ins><span class="cx"> return -code error "Image error: ${name} @${specifier} is not active."
</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 ""
</span><del>- if {$version != ""} {
</del><ins>+ if {$version ne ""} {
</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 != ""} {
</del><ins>+ if {$revision ne ""} {
</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] == "installed" } {
</del><ins>+ if { [$i state] eq "installed" } {
</ins><span class="cx"> ui_msg "$UI_PREFIX [format [msgcat::mc " %s @%s_%s%s (active)"] $iname $iversion $irevision $ivariants]"
</span><span class="cx"> } else {
</span><span class="cx"> ui_msg "$UI_PREFIX [format [msgcat::mc " %s @%s_%s%s"] $iname $iversion $irevision $ivariants]"
</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 != ""} {
</del><ins>+ if {$composite_spec ne ""} {
</ins><span class="cx"> set composite_spec " @${composite_spec}"
</span><span class="cx"> }
</span><span class="cx"> throw registry::invalid "Registry error: ${name}${composite_spec} is not installed."
</span><span class="lines">@@ -469,7 +469,7 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if {$owner != "replaced"} {
</del><ins>+ if {$owner ne "replaced"} {
</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] == "imaged" && ($noexec || ![registry::run_target $entry activate ""])} {
</del><ins>+ if {[$entry state] eq "imaged" && ($noexec || ![registry::run_target $entry activate ""])} {
</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 "$dstfile does not exist"
</span><span class="cx"> return
</span><span class="cx"> }
</span><del>- if { $filetype == "link" } {
</del><ins>+ if { $filetype eq "link" } {
</ins><span class="cx"> ui_debug "deactivating link: $dstfile"
</span><span class="cx"> file delete -- $dstfile
</span><del>- } elseif { $filetype == "directory" } {
</del><ins>+ } elseif { $filetype eq "directory" } {
</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}] && [::file type $file] == "link") } {
</del><ins>+ if { [::file exists $file] || (![catch {::file type $file}] && [::file type $file] eq "link") } {
</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 ""} {optionslist ""}} {
</span><del>- if {$v == ""} {
</del><ins>+ if {$v eq ""} {
</ins><span class="cx"> return [uninstall $portname "" "" 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 ""
</span><del>- if {$version != ""} {
</del><ins>+ if {$version ne ""} {
</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 != ""} {
</del><ins>+ if {$revision ne ""} {
</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 "$UI_PREFIX [msgcat::mc "The following versions of $portname are currently installed:"]"
</span><span class="cx"> foreach i [portlist_sortint $ilist] {
</span><span class="cx"> set ispec "[$i version]_[$i revision][$i variants]"
</span><del>- if { [string equal [$i state] installed] } {
</del><ins>+ if {[$i state] eq "installed"} {
</ins><span class="cx"> ui_msg "$UI_PREFIX [format [msgcat::mc " %s @%s (active)"] [$i name] $ispec]"
</span><span class="cx"> } else {
</span><span class="cx"> ui_msg "$UI_PREFIX [format [msgcat::mc " %s @%s"] [$i name] $ispec]"
</span><span class="lines">@@ -106,7 +106,7 @@
</span><span class="cx"> set variants [$port variants]
</span><span class="cx"> set composite_spec "${version}_${revision}${variants}"
</span><span class="cx"> } else {
</span><del>- if {$composite_spec != ""} {
</del><ins>+ if {$composite_spec ne ""} {
</ins><span class="cx"> set composite_spec " @${composite_spec}"
</span><span class="cx"> }
</span><span class="cx"> throw registry::invalid "Registry error: ${portname}${composite_spec} not registered as installed"
</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] && ([$depport state] == "imaged" || [$depport state] == "installed")} {
</del><ins>+ if {[registry::entry exists $depport] && ([$depport state] eq "imaged" || [$depport state] eq "installed")} {
</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} "uninstall"
</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 "installed"} {
</ins><span class="cx"> if {[info exists options(ports_dryrun)] && [string is true -strict $options(ports_dryrun)]} {
</span><span class="cx"> ui_msg "For $portname @${composite_spec}: skipping deactivate (dry run)"
</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 ""} {
</ins><span class="cx">                 return ""
</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 != "" } {
</del><ins>+                if {$receipt_file eq ""} {
+                        if { $version ne "" } {
</ins><span class="cx">                                 return -code error "Registry error: ${name} @${version}_${revision}${variants} not registered as installed."
</span><span class="cx">                         } else {
</span><span class="cx">                                 return -code error "Registry error: ${name} not registered as installed."
</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 == "" } {
</del><ins>+                if { $version eq "" } {
</ins><span class="cx">                         set theFileName [::file tail $receipt_file]
</span><span class="cx">                         regexp "^$name-(.*)\$" $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 == "" } {
</del><ins>+                if { $version eq "" } {
</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 == "" } {
</del><ins>+        if { $name eq "" } {
</ins><span class="cx">                 set query_path [::file join ${query_path} *]
</span><del>-                if { $version == "" } {
</del><ins>+                if { $version eq "" } {
</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 != "" } {
</del><ins>+                if { $version ne "" } {
</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 == "" } {
</del><ins>+        if { $name eq "" } {
</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 ""
</span><del>-         if { $name == "" } {
</del><ins>+         if { $name eq "" } {
</ins><span class="cx">                         regexp {^(.*)-(.*)$} $theFileName match theName version
</span><span class="cx">         } else {
</span><span class="cx">                         regexp "^($name)-(.*)\$" $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] == "link" } {
</del><ins>+        if { [::file type $file] eq "link" } {
</ins><span class="cx">                 ui_debug "Adding link to file_map: $file for: $port"
</span><span class="cx">         } else {
</span><span class="cx">                 ui_debug "Adding file to file_map: $file for: $port"
</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] == "link" } {
</del><ins>+                if { [::file type $file] eq "link" } {
</ins><span class="cx">                         ui_debug "Adding link to file_map: $file for: $port"
</span><span class="cx">                 } else {
</span><span class="cx">                         ui_debug "Adding file to file_map: $file for: $port"
</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 "New dep_map has $newlen entries"
</span><span class="cx"> ui_info "Removed $diff duplicate entries from the dependency map"
</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 != ""} {
</del><ins>+ if {$name ne ""} {
</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 != ""} {
</del><ins>+        if {$port ne ""} {
</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 ""} {version ""}} {
</span><del>-        if { $name == "" && $version == "" } {
</del><ins>+        if { $name eq "" && $version eq "" } {
</ins><span class="cx">          set ports [registry::entry imaged]
</span><del>-        } elseif { $name != "" && $version == ""} {
</del><ins>+        } elseif { $name ne "" && $version eq ""} {
</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 "registry::entry search"
</span><span class="cx"> foreach key {name version revision} {
</span><del>- if {[set $key] != ""} {
</del><ins>+ if {[set $key] ne ""} {
</ins><span class="cx"> append searchcmd " $key [set $key]"
</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 "registry::entry search"
</span><span class="cx"> foreach key {name version revision} {
</span><del>- if {[set $key] != ""} {
</del><ins>+ if {[set $key] ne ""} {
</ins><span class="cx"> append searchcmd " $key [set $key]"
</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) == "image"} {
</del><ins>+ if {$props(installtype) eq "image"} {
</ins><span class="cx"> $regref map $props(imagefiles)
</span><del>- if {$props(state) == "installed"} {
</del><ins>+ if {$props(state) eq "installed"} {
</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] < 1 } {
</span><del>- if { $name == "" } {
</del><ins>+ if { $name eq "" } {
</ins><span class="cx"> return -code error "Registry error: No ports registered as installed."
</span><span class="cx"> } else {
</span><del>- if { $version == "" } {
</del><ins>+ if { $version eq "" } {
</ins><span class="cx"> return -code error "Registry error: $name not registered as installed."
</span><span class="cx"> } else {
</span><span class="cx"> return -code error "Registry error: $name $version not registered as installed."
</span><span class="lines">@@ -196,7 +196,7 @@
</span><span class="cx"> }
</span><span class="cx">         
</span><span class="cx">         if { [llength $rlist] < 1 } {
</span><del>-                if { $name == "" } {
</del><ins>+                if { $name eq "" } {
</ins><span class="cx">                         return -code error "Registry error: No ports registered as active."
</span><span class="cx">                 } else {
</span><span class="cx">                         return -code error "Registry error: $name not registered as installed & active."
</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] && [::file type $fname] != "link"} {
</del><ins>+        if {[::file isfile $fname] && [::file type $fname] ne "link"} {
</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] != "/"} {
</del><ins>+                if {[string index $file 0] ne "/"} {
</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 == "EAGAIN"} {
</del><ins>+ if {$result eq "EAGAIN"} {
</ins><span class="cx"> ui_msg "Waiting for lock on $lockpath"
</span><span class="cx"> flock $lockfd -exclusive
</span><del>- } elseif {$result == "EOPNOTSUPP"} {
</del><ins>+ } elseif {$result eq "EOPNOTSUPP"} {
</ins><span class="cx"> # Locking not supported, just return
</span><span class="cx"> ui_debug "flock not supported, not locking registry"
</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 == "0"} {
</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 "uninstall/deactivate"}} {
</span><span class="cx"> global UI_PREFIX
</span><del>- if {[$port state] == "installed" || [llength [registry::entry imaged [$port name]]] == 1} {
</del><ins>+ if {[$port state] eq "installed" || [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 == "deactivate"} {
</del><ins>+ if {$action eq "deactivate"} {
</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] == "installed"} {
</del><ins>+ if {[$p state] eq "installed"} {
</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 "[$port name] @[$port version]_[$port revision][$port variants]"
</span><del>- if {[$port portfile] == ""} {
</del><ins>+ if {[$port portfile] eq ""} {
</ins><span class="cx"> ui_debug "no portfile in registry for $portspec"
</span><span class="cx"> return 0
</span><span class="cx"> }
</span><span class="lines">@@ -107,12 +107,12 @@
</span><span class="cx"> ui_warn "Failed to execute portfile from registry for $portspec"
</span><span class="cx"> switch $target {
</span><span class="cx"> activate {
</span><del>- if {[$port state] == "installed"} {
</del><ins>+ if {[$port state] eq "installed"} {
</ins><span class="cx"> return 1
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> deactivate {
</span><del>- if {[$port state] == "imaged"} {
</del><ins>+ if {[$port state] eq "imaged"} {
</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) && $target != "activate"} {
</del><ins>+ if {(![info exists keeplogs] || !$keeplogs) && $target ne "activate"} {
</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 == ""} {
</del><ins>+ if {$svnCmd eq ""} {
</ins><span class="cx"> puts "WARNING: Unable to check svn URL for '$filepath' because no svn command could be found; please manually verify $sourcesConf!"
</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 "Please install MacPorts before running these tests"
-        @exit 1
-
-# Run all tests
-# Use TESTS to choose which tests to run
-# For example: make test TESTS="checkums-1 universal"
-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 ===\> test ${DIRPRFX}$$subdir; \
-                if [ -e $$subdir/Makefile ]; then \
-                        ( cd $$subdir && \
-                                $(MAKE) DIRPRFX=${DIRPRFX}$$subdir/ PORTSRC=$(PWD)/test-macports.conf test) && \
-                        success=$$(( success + 1 )); \
-                else \
-                        ( cd $$subdir && \
-                                PORTSRC=$(PWD)/test-macports.conf $(bindir)/port clean > /dev/null && \
-                                PORTSRC=$(PWD)/test-macports.conf $(bindir)/port test > output 2>&1 \
-                                        || ([ -e error_expected ] || (cat output; exit 1)) && \
-                        sed -e "s|${PWD}|PWD|g" < output > output.sed && \
-                        diff -u master output.sed 2>&1 | tee difference && \
-                        if [ -s difference ]; then \
-                                exit 1; \
-                        else \
-                                rm -f difference output.sed; \
-                        fi) && \
-                        success=$$(( success + 1 )); \
-                        if [ -n "`PORTSRC=$(PWD)/test-macports.conf $(bindir)/port -q echo installed`" ]; then \
-                         PORTSRC=$(PWD)/test-macports.conf $(bindir)/port -f clean --all installed > /dev/null && \
-                         PORTSRC=$(PWD)/test-macports.conf $(bindir)/port -f uninstall installed > /dev/null; \
-                        fi; \
-                fi; \
-                num=$$(( num + 1 )); \
-        done; \
-        echo ===\> $$success of $$num tests passed.
-        @rm -rf /tmp/macports-tests/
-        @rm -f PortIndex PortIndex.quick
-
-# Run specific test
-# Prepend the directory name with "test-" and use it as target
-# For example: make test-checksums-1
-test-%:
-        $(MAKE) TESTS="$(@:test-%=%)" 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 "Please install MacPorts before running this test"
-        @exit 1
-
-test:
-        @echo port install $(TESTPORT1)
-        @sed 's/@name@/$(TESTPORT1)/' Portfile.in > Portfile
-        @PORTSRC=$(PORTSRC) $(bindir)/port install > output 2>&1 || (cat output; exit 1)
-        @if [ ! -f $(TESTFILE) ]; then \
-                echo "FAILED: File should exist after install: $(TESTFILE)" && exit 1; \
-        fi
-        @echo port uninstall $(TESTPORT2)
-        @sed 's/@name@/$(TESTPORT2)/' Portfile.in > Portfile
-        @PORTSRC=$(PORTSRC) $(bindir)/port uninstall > output 2>&1 || (cat output; exit 1)
-        @if [ -f $(TESTFILE) ]; then \
-                rm $(TESTFILE); \
-                echo "FAILED: File should NOT exist after uninstall: $(TESTFILE)" && exit 1; \
-        else \
-                echo "SUCCESS!"; \
-        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 "" "Portfile"
+makeFile "" $output_file
+makeDirectory $work_dir
+set path [file dirname [file normalize $argv0]]
+
+set testfile "/tmp/macports-tests/opt/local/var/test/case"
+set testport1 "casesensitive"
+set testport2 "CaseSensitivE"
+
+load_variables $path
+set_dir
+port_index
+
+proc test_exists {} {
+ global path testfile testport1
+
+ exec sed "s/@name@/$testport1/" $path/Portfile.in > Portfile
+ port_install
+
+ if {[file exists $testfile]} {
+ return "Port installed."
+ } else {
+ return "File missing."
+ }
+}
+
+proc test_not_exists {} {
+ global path testfile testport2
+
+ exec sed "s/@name@/$testport2/" $path/Portfile.in > Portfile
+ port_uninstall
+
+ if {[file exists $testfile]} {
+ return "File still exists."
+ } else {
+ return "Port uninstalled."
+ }
+}
+
+
+# Test cases.
+test file_installed {
+ Regression test for file installed correctly.
+} -body {
+ test_exists
+} -result "Port installed."
+
+test file_uninstalled {
+ Regression test for file uninstalled correctly.
+} -body {
+ test_not_exists
+} -result "Port uninstalled."
+
+
+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 "debug: calculated".
+
+There are 3 test cases, one for each checksum used. The port command must
+return the calculated checksums in debug mode, with the form: "DEBUG:
+Calculated (_checksum-name_) " 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>----> Fetching distfiles for checksum
----> Verifying checksums for checksum
----> Extracting checksum
----> Configuring checksum
----> Building checksum
----> 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 "" $output_file
+makeDirectory $work_dir
+set path [file dirname [file normalize $argv0]]
+
+initial_setup
+
+proc get_checksum {type} {
+ global path output_file
+
+ append string "debug: calculated (" $type ")*"
+ set line [get_line $path/$output_file $string]
+ set result [lrange [split $line " "] 4 4]
+
+ return $result
+}
+
+
+# Test cases
+test md5_checksum {
+ Regression test for MD5 Checksum.
+} -body {
+ get_checksum md5
+} -result "d41d8cd98f00b204e9800998ecf8427e"
+
+
+test sha1_checksum {
+ Regression test for SHA1 Checksum.
+} -body {
+ get_checksum sha1
+} -result "da39a3ee5e6b4b0d3255bfef95601890afd80709"
+
+
+test rmd160_checksum {
+ Regression test for RMD160 Checksum.
+} -body {
+ get_checksum rmd160
+} -result "9c1185a5c5e9fc54612808977ee8f548b2258d31"
+
+
+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 "" $output_file
+makeDirectory $work_dir
+set path [file dirname [file normalize $argv0]]
+
+proc dep-a {} {
+ global path output_file
+
+ initial_setup
+
+ set err "error*"
+ 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 "" $output_file
+makeDirectory $work_dir
+set path [file dirname [file normalize $argv0]]
+
+proc dep-b {} {
+ global path output_file
+
+ initial_setup
+
+ set err "error*"
+ 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>----> Computing dependencies for dependencies-c
----> Dependencies to be installed: dependencies-a dependencies-b
----> Fetching distfiles for dependencies-b
----> Verifying checksums for dependencies-b
----> Extracting dependencies-b
----> Configuring dependencies-b
----> Building dependencies-b
----> Staging dependencies-b into destroot
----> Installing dependencies-b @1_0
----> Activating dependencies-b @1_0
----> Cleaning dependencies-b
----> Fetching distfiles for dependencies-a
----> Verifying checksums for dependencies-a
----> Extracting dependencies-a
----> Configuring dependencies-a
----> Building dependencies-a
----> Staging dependencies-a into destroot
----> Installing dependencies-a @1_0+i_want_b
----> Activating dependencies-a @1_0+i_want_b
----> Cleaning dependencies-a
----> Fetching distfiles for dependencies-c
----> Verifying checksums for dependencies-c
----> Extracting dependencies-c
----> Configuring dependencies-c
----> Building dependencies-c
----> 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 "" $output_file
+makeDirectory $work_dir
+set path [file dirname [file normalize $argv0]]
+
+proc dep-c {} {
+ global path output_file
+
+ initial_setup
+
+ set err "error*"
+ 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 "depends" 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
----> Computing dependencies for dependencies-d
----> Dependencies to be installed: dependencies-a dependencies-b
----> Fetching distfiles for dependencies-b
----> Verifying checksums for dependencies-b
----> Extracting dependencies-b
----> Configuring dependencies-b
----> Building dependencies-b
----> Staging dependencies-b into destroot
----> Installing dependencies-b @1_0
----> Activating dependencies-b @1_0
----> Cleaning dependencies-b
----> Fetching distfiles for dependencies-a
----> Verifying checksums for dependencies-a
----> Extracting dependencies-a
----> Configuring dependencies-a
----> Building dependencies-a
----> Staging dependencies-a into destroot
----> Installing dependencies-a @1_0+i_want_b
----> Activating dependencies-a @1_0+i_want_b
----> Cleaning dependencies-a
----> Fetching distfiles for dependencies-d
----> Verifying checksums for dependencies-d
----> Extracting dependencies-d
----> Configuring dependencies-d
----> Building dependencies-d
----> 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 "" $output_file
+makeDirectory $work_dir
+set path [file dirname [file normalize $argv0]]
+
+proc dep-d {} {
+ global path output_file
+
+ initial_setup
+
+ set err "error*"
+ 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>----> 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 "" $output_file
+makeDirectory $work_dir
+set path [file dirname [file normalize $argv0]]
+
+proc dep-e {} {
+ global path output_file
+
+ initial_setup
+
+ set err "error: dependency 'docbook-xml-4.1.2' not found*"
+ set line [get_line $output_file $err]
+ return $line
+}
+
+test dependencies-e {
+ Regression test for dependencies-e.
+} -body {
+ dep-e
+} -result "error: dependency 'docbook-xml-4.1.2' not found."
+
+
+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 "Please install MacPorts before running this test"
-        @exit 1
-
-test:
-        @PORTSRC=$(PORTSRC) $(bindir)/port clean > /dev/null
-        @sh -c "export ENVA=A ; export ENVB=B; \
-                export PORTSRC=$(PORTSRC); $(bindir)/port test" > output 2>&1 || (cat output; exit 1)
-        @diff -u master output 2>&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>----> Fetching distfiles for envvariables
----> Verifying checksums for envvariables
----> Extracting envvariables
----> Configuring envvariables
----> Building envvariables
----> 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 "" $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 "export ENVA=A; export ENVB=B; "
+ append string "export PORTSRC=${portsrc}; "
+ append string "${bindir}/port test"
+
+ exec sh -c $string > output
+ set line [get_line $path/$output_file "a"]
+ set line2 [get_line $path/$output_file "b"]
+ return $line$line2
+}
+
+test envvariables {
+ Regression test for Environment Variables.
+} -body {
+ envvar_test
+} -result "ab"
+
+
+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 "output"
+set work_dir "work"
+
+# Set of procs used for testing.
+
+# Sets $bindir variable from macports.autoconf.mk
+# autogenerated file.
+proc load_variables {pwd} {
+ global autoconf bindir datadir portsrc cpwd
+
+ if { ![file exists $autoconf] } {
+ puts "ERROR: $autoconf does not exist."
+ exit 1
+ }
+
+ set cpwd [file dirname [file dirname $pwd]]
+
+ set line [get_line $autoconf "prefix*"]
+ set prefix [lrange [split $line " "] 1 1]
+
+ set line [get_line $autoconf "bindir*"]
+ set bin [lrange [split $line "/"] 1 1]
+
+ set bindir ${prefix}/${bin}
+ set datadir ${prefix}/share
+ set portsrc ${cpwd}/test-macports.conf
+
+}
+
+proc cleanup {} {
+ global cpwd
+
+ file delete -force /tmp/macports-tests
+ file delete -force ${cpwd}/PortIndex ${cpwd}/PortIndex.quick
+}
+
+# Sets initial directories
+proc set_dir {} {
+ global datadir cpwd
+
+ cleanup
+
+ file mkdir /tmp/macports-tests/ports \
+ /tmp/macports-tests/opt/local/etc/macports \
+ /tmp/macports-tests/opt/local/share \
+ /tmp/macports-tests/opt/local/var/macports/receipts \
+ /tmp/macports-tests/opt/local/var/macports/registry \
+ /tmp/macports-tests/opt/local/var/macports/build
+
+ file link -symbolic /tmp/macports-tests/opt/local/share/macports $datadir/macports
+ file link -symbolic /tmp/macports-tests/ports/test $cpwd/test
+}
+
+# Run portindex
+proc port_index {} {
+ global bindir datadir cpwd
+
+ # Move up 2 level to run portindex.
+ set path [pwd]
+ cd ../..
+ # Avoid warning about ports tree being old
+ exec sh -c {touch */*/Portfile}
+
+ exec ${bindir}/portindex 2>@1
+
+ file copy ${cpwd}/sources.conf /tmp/macports-tests/opt/local/etc/macports/
+ file copy ${cpwd}/PortIndex ${cpwd}/PortIndex.quick /tmp/macports-tests/ports/
+
+ cd $path
+}
+
+# Executes port clean.
+proc port_clean {pwd} {
+ global bindir datadir portsrc
+
+ set back [pwd]
+ cd $pwd
+
+ catch {exec env PORTSRC=${portsrc} ${bindir}/port clean 2>@1}
+ cd $back
+}
+
+# Runs the portfile.
+proc port_run {pwd} {
+ global bindir datadir portsrc
+
+ set back [pwd]
+ cd $pwd
+
+ set result [catch {exec env PORTSRC=${portsrc} ${bindir}/port -d test >&output} ]
+ cd $back
+ return $result
+}
+
+# Runs port trace.
+proc port_trace {pwd} {
+ global bindir datadir portsrc
+
+ set back [pwd]
+ cd $pwd
+
+ set result [catch {exec env PORTSRC=${portsrc} ${bindir}/port -t test >&output 2>@1} ]
+ cd $back
+ return $result
+}
+
+# Installs new portfile.
+proc port_install {} {
+ global bindir portsrc
+
+ set result [catch {exec env PORTSRC=${portsrc} ${bindir}/port install > output 2>@1} ]
+}
+
+# Run configure command.
+proc port_config {pwd} {
+ global path bindir portsrc
+
+ set result [catch {exec env PORTSRC=${portsrc} ${bindir}/port configure 2>@1} ]
+}
+
+# Run desroot command.
+proc port_desroot {pwd} {
+ global path bindir portsrc work_dir output_file
+
+ file copy -force ${path}/statefile ${work_dir}/.macports.statefile-unknown-version.state
+ if { [exec id -u] == 0 } {
+ exec chown macports ${work_dir}/.macports.statefile-unknown-version.state
+ }
+ set result [catch {exec env PORTSRC=${portsrc} ${bindir}/port destroot >$output_file 2>@1} ]
+}
+
+# Uninstalls portfile.
+proc port_uninstall {} {
+ global bindir portsrc
+
+ set result [catch {exec env PORTSRC=${portsrc} ${bindir}/port uninstall > output 2>@1} ]
+}
+
+# Returns the line containint a given string
+# from a given file, or -1 if nothing is found.
+proc get_line {filename lookup} {
+ set fp [open $filename r]
+
+ while {[gets $fp line] != -1} {
+ set line [string tolower $line]
+
+ if {[string match $lookup $line] != 0} {
+ close $fp
+ return $line
+ }
+ }
+ return -1
+}
+
+# This proc contains all the steps necesary
+# to install a port and save the output to a file.
+# Needed for the majority of regression tests.
+proc initial_setup {} {
+ global output_file work_dir path
+
+ makeFile "" $output_file
+ makeDirectory $work_dir
+
+ load_variables $path
+ set_dir
+ port_index
+ port_clean $path
+ port_run $path
+}
</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>----> Fetching distfiles for site-tags
----> Attempting to fetch app-bm.tar.gz from http://www.douglas.stebila.ca/files/code/vim/app/
----> Attempting to fetch doc.tar.gz from http://www.douglas.stebila.ca/files/code/vim/doc/
----> Verifying checksums for site-tags
----> Extracting site-tags
----> Configuring site-tags
----> Building site-tags
----> 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 "" $output_file
+makeDirectory $work_dir
+set path [file dirname [file normalize $argv0]]
+
+proc sitetag {} {
+ global output_file path
+
+ initial_setup
+
+ set err "error*"
+ set line [get_line $output_file $err]
+ if {$line == -1} {
+ return "No errors found."
+ } else {
+ return "Errors found in the output file."
+ }
+}
+
+test site-tags {
+ Regression test for site-tags.
+} -body {
+ sitetag
+} -result "No errors found."
+
+
+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 "Please install MacPorts before running this test"
-        @exit 1
-
-test:
-        @PORTSRC=$(PORTSRC) $(bindir)/port configure >/dev/null 2>&1
-        @cp statefile work/.macports.statefile-unknown-version.state
-        @PORTSRC=$(PORTSRC) $(bindir)/port destroot >output 2>&1 || (cat output; exit 1)
-        @diff -u master output || (echo "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)"; exit 1)
-        @PORTSRC=$(PORTSRC) $(bindir)/port clean >/dev/null 2>&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
----> Building statefile-unknown-version
-Warning: Unsupported statefile version '3'
-Warning: Please run 'port selfupdate' to update to the latest version of MacPorts
----> 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 "" $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 "no"} {
+ set msg "warning*"
+ } else {
+ set msg "*staging*destroot*"
+ }
+
+ set line [get_line $path/$output_file $msg]
+ return $line
+}
+
+test warning_check {
+ Regression test for statefile-unknown warnings.
+} -body {
+ state_unknown yes
+} -result "warning: unsupported statefile version '3'"
+
+test output_check {
+ Regression test for statefile-unknown output.
+} -body {
+ state_unknown no
+} -result "---> staging statefile-unknown-version into destroot"
+
+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 "Please install MacPorts before running this test"
-        @exit 1
-
-test:
-        @PORTSRC=$(PORTSRC) $(bindir)/port configure >/dev/null 2>&1
-        @cp statefile work/.macports.statefile-version1.state
-        @PORTSRC=$(PORTSRC) $(bindir)/port destroot >output 2>&1 || (cat output; exit 1)
-        @diff -u master output || (echo "statefile version 1 wasn't outdated but still triggered a rebuild"; exit 1)
-        @PORTSRC=$(PORTSRC) $(bindir)/port clean >/dev/null 2>&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>----> Building statefile-version1
----> 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 "" $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 "no"} {
+ set msg "*discarding previous state*"
+ } else {
+ set msg "*staging*destroot*"
+ }
+ set line [get_line $path/$output_file $msg]
+ return $line
+}
+
+test warning_check {
+ Regression test for statefile-version1.
+} -body {
+ statefile_v1 yes
+} -result "-1"
+
+test output_check {
+ Regression test for statefile-version1.
+} -body {
+ statefile_v1 no
+} -result "---> staging statefile-version1 into destroot"
+
+
+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 "Please install MacPorts before running this test"
-        @exit 1
-
-test:
-        @PORTSRC=$(PORTSRC) $(bindir)/port configure >/dev/null 2>&1
-        @cp statefile work/.macports.statefile-version1-outdated.state
-        @touch -t 197001010000.09 work/.macports.statefile-version1-outdated.state
-        @PORTSRC=$(PORTSRC) $(bindir)/port destroot >output 2>&1 || (cat output; exit 1)
-        @diff -u master output || (echo "statfile version 1 was outdated but didn't cause a fresh build"; exit 1)
-        @PORTSRC=$(PORTSRC) $(bindir)/port clean >/dev/null 2>&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.
----> Fetching distfiles for statefile-version1-outdated
----> Verifying checksums for statefile-version1-outdated
----> Extracting statefile-version1-outdated
----> Configuring statefile-version1-outdated
----> Building statefile-version1-outdated
----> 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 "" $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 "no"} {
+ set msg "*discarding previous state*"
+ } else {
+ set msg "*staging*destroot*"
+ }
+
+ 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 "portfile changed since last build; discarding previous state."
+
+test output_check {
+ Regression test for statefile-v1-outdated output.
+} -body {
+ state_v1 no
+} -result "---> staging statefile-version1-outdated into destroot"
+
+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 "Please install MacPorts before running this test"
-        @exit 1
-
-test:
-        @PORTSRC=$(PORTSRC) $(bindir)/port configure >/dev/null 2>&1
-        @cp statefile work/.macports.statefile-version2.state
-        @sed -i'' -E "s/@CHECKSUM@/`openssl dgst -sha256 Portfile | awk '{print $$2}'`/" work/.macports.statefile-version2.state
-        @PORTSRC=$(PORTSRC) $(bindir)/port destroot >output 2>&1 || (cat output; exit 1)
-        @diff -u master output || (echo "statefile version 2 wasn't outdated, but still triggered a rebuild"; exit 1)
-        @PORTSRC=$(PORTSRC) $(bindir)/port clean >/dev/null 2>&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>----> Building statefile-version2
----> 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 "" $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 "s/@CHECKSUM@/`openssl dgst -sha256 Portfile | \
+ awk '{print \$\$2}'`/" $work_dir/.macports.statefile-version2.state
+port_desroot $path
+port_clean $path
+
+proc statefile_v2 {arg} {
+ global path output_file
+
+ if {$arg ne "no"} {
+ set msg "*discarding previous state*"
+ } else {
+ set msg "*staging*destroot*"
+ }
+ 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 "-1"
+
+test statefile-v2 {
+ Regression test for statefile-version2.
+} -body {
+ statefile_v2 no
+} -result "---> staging statefile-version2 into destroot"
+
+
+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 "Please install MacPorts before running this test"
-        @exit 1
-
-test:
-        @PORTSRC=$(PORTSRC) $(bindir)/port configure >/dev/null 2>&1
-        @cp statefile work/.macports.statefile-version2-invalid.state
-        @PORTSRC=$(PORTSRC) $(bindir)/port destroot >output 2>&1 || (cat output; exit 1)
-        @diff -u master output || (echo "statefile version 2 without checksum field didn't cause a warning"; exit 1)
-        @PORTSRC=$(PORTSRC) $(bindir)/port clean >/dev/null 2>&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.
----> Fetching distfiles for statefile-version2-invalid
----> Verifying checksums for statefile-version2-invalid
----> Extracting statefile-version2-invalid
----> Configuring statefile-version2-invalid
----> Building statefile-version2-invalid
----> 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 "" $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 "no"} {
+ set msg "*warning*checksum*"
+ } else {
+ set msg "*staging*destroot*"
+ }
+
+ 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 "warning: statefile has version 2 but didn't contain a checksum"
+
+test output_check {
+ Regression test for statefile-v2-invalid output.
+} -body {
+ state_v2_invalid no
+} -result "---> staging statefile-version2-invalid into destroot"
+
+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 "Please install MacPorts before running this test"
-        @exit 1
-
-test:
-        @PORTSRC=$(PORTSRC) $(bindir)/port configure >/dev/null 2>&1
-        @cp statefile work/.macports.statefile-version2-outdated.state
-        @PORTSRC=$(PORTSRC) $(bindir)/port destroot >output 2>&1 || (cat output; exit 1)
-        @diff -u master output || (echo "statefile version 2 was outdated but didn't cause a fresh build"; exit 1)
-        @PORTSRC=$(PORTSRC) $(bindir)/port clean >/dev/null 2>&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.
----> Fetching distfiles for statefile-version2-outdated
----> Verifying checksums for statefile-version2-outdated
----> Extracting statefile-version2-outdated
----> Configuring statefile-version2-outdated
----> Building statefile-version2-outdated
----> 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 "" $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 "no" } {
+ set msg "*discarding previous state*"
+ } else {
+ set msg "*staging*destroot*"
+ }
+
+ 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 "portfile changed since last build; discarding previous state."
+
+test output_check {
+ Regression test for statefile-v2-outdated output.
+} -body {
+ state_v2_out no
+} -result "---> staging statefile-version2-outdated into destroot"
+
+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>----> Fetching distfiles for svn-and-patchsites
----> Attempting to fetch patch-1.5.14.dgc.xlabel_ext.9 from http://home.uchicago.edu/~dgc/sw/mutt/
----> Verifying checksums for svn-and-patchsites
----> Extracting svn-and-patchsites
----> Configuring svn-and-patchsites
----> Building svn-and-patchsites
----> 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 "error*"
+ set line [get_line $path/$output_file $svn]
+ if {$line == -1} {
+ return "No error found."
+ } else {
+ return "Errors found in output file."
+ }
+}
+
+test svn-patchsites {
+ Regression test for svn-and-patchsites.
+} -body {
+ svn-patch
+} -result "No error found."
+
+
+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 "" $output_file
+makeDirectory $work_dir
+set path [file dirname [file normalize $argv0]]
+
+load_variables $path
+
+proc test_trace {} {
+ global path autoconf output_file
+
+ set line [get_line $autoconf "runusr*"]
+ set user [lrange [split $line " "] 1 1]
+
+ set_dir
+ port_index
+ port_clean $path
+
+
+ makeDirectory ../tracetesttmp
+ file attributes ../tracetesttmp -owner $user
+ exec sudo -u $user touch ../tracetesttmp/delete-trace
+ exec sudo -u $user touch ../tracetesttmp/rename-trace
+ exec sudo -u $user mkdir ../tracetesttmp/rmdir-trace
+ file delete -force /tmp/hello-trace
+ file attributes /usr/include/unistd.h -owner $user
+ file link -symbolic /tmp/link-trace2 /usr/include/unistd.h
+ exec chown -h $user /tmp/link-trace2
+
+ port_trace $path
+
+ #file delete -force /tmp/link-trace2
+ file delete -force /tmp/hello-trace
+
+ set err "error*"
+ set line [get_line $path/$output_file $err]
+ if { $line == -1 } {
+ return "No errors found."
+ } else {
+ return $line
+ }
+}
+
+test trace {
+ Regression test for trace.
+} -constraints {
+ root
+} -body {
+ test_trace
+} -result "No errors found."
+
+
+cleanup
+cleanupTests
</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 "Please install MacPorts before running this test"
-        @exit 1
-
-test:
-        @PORTSRC=$(PORTSRC) $(bindir)/port clean > /dev/null
-        @sh -c "export PORTSRC=$(PORTSRC); $(bindir)/port info --variants" > output 2>&1 || (cat output; exit 1)
-        @diff -u master output 2>&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 "touch ${destroot}${prefix}/lib/${name}"
-}
-
-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 "touch ${destroot}${prefix}/lib/${name}"
+}
+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 "" "Portfile"
+makeFile "" $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 "yes"} {
+ # No universal variant
+ exec sed "s/@option@/universal_variant\ no/" $path/Portfile.in > Portfile
+ } else {
+ # Add universal variant
+ exec sed "s/@option@/default_variants\ +universal/" $path/Portfile.in > Portfile
+ }
+ port_clean $path
+
+ # Build helping string
+ set string "export PORTSRC=${portsrc} ; ${bindir}/port info --variants"
+
+ exec sh -c $string > output 2>@1
+ set var "variants:*"
+ set line [get_line $path/$output_file $var]
+ return $line
+}
+
+
+test universal {
+ Regression test for universal variant.
+} -body {
+ univ_test "yes"
+} -result "variants: universal"
+
+test nouniversal {
+ Regression test for no universal variant.
+} -body {
+ univ_test "no"
+} -result "variants: "
+
+
+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
----> Fetching distfiles for variants
----> Verifying checksums for variants
----> Extracting variants
----> Configuring variants
----> Building variants
----> 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 "utopia variant*"
+ set line [get_line $path/$output_file $var]
+ return $line
+}
+
+
+test variants {
+ Regression test for variants.
+} -body {
+ var_check
+} -result "utopia variant -- 2"
+
+
+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>----> Fetching distfiles for xcodeversion
----> Verifying checksums for xcodeversion
----> Extracting xcodeversion
----> Configuring xcodeversion
----> Building xcodeversion
----> Testing xcodeversion
-xcodeversion >= 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 "xcodeversion*"
+ set line [get_line $path/$output_file $xcode]
+ return $line
+}
+
+proc xcode_binpath {} {
+ global output_file path
+
+ set xcode "xcodebuildcmd*"
+ set line [get_line $path/$output_file $xcode]
+ return $line
+}
+
+test envvariables {
+ Regression test for XCode version.
+} -body {
+ xcode_ver
+} -result "xcodeversion >= 2.1"
+
+test xcode_path {
+ Regression test for XCode path.
+} -body {
+ xcode_binpath
+} -result "xcodebuildcmd = /usr/bin/xcodebuild"
+
+
+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 ""
+set test_name ""
+set color_out ""
+set tcl ""
+set err ""
+
+# Get tclsh path.
+set autoconf ../Mk/macports.autoconf.mk
+set fp [open $autoconf r]
+while {[gets $fp line] != -1} {
+ if {[string match "TCLSH*" $line] != 0} {
+ set tcl [lrange [split $line " "] 1 1]
+ }
+}
+
+proc print_help {arg} {
+ if { $arg eq "tests" } {
+ puts "The list of available tests is:"
+ foreach test $::test_suite {
+ puts [puts -nonewline " "]$test
+ }
+ } else {
+ puts "Usage: tclsh test.tcl \[-debug level\] \[-t test\] \[-l\]\n"
+ puts " -debug LVL : sets the level of printed debug info \[0-3\]"
+ puts " -t TEST : run a specific test"
+ puts " -nocolor : disable color output (for automatic testing)"
+ puts " -l : print the list of available tests"
+ puts " -h, -help : print this message\n"
+ }
+}
+
+# Process args
+foreach arg $argv {
+ if { $arg eq "-h" || $arg eq "-help" } {
+ print_help ""
+ exit 0
+ } elseif { $arg eq "-debug" } {
+ set index [expr {[lsearch $argv $arg] + 1}]
+ set level [lindex $argv $index]
+ if { $level >= 0 && $level <= 3 } {
+ append arguments "-debug " $level
+ } else {
+ puts "Invalid debug level."
+ exit 1
+ }
+ } elseif { $arg eq "-t" } {
+ set index [expr {[lsearch $argv $arg] + 1}]
+ set test_name [lindex $argv $index]
+ set no 0
+ foreach test $test_suite {
+ if { $test_name != $test } {
+ set no [expr {$no + 1}]
+ }
+ }
+ if { $no == [llength $test_suite] } {
+ print_help tests
+ exit 1
+ }
+ } elseif { $arg eq "-l" } {
+ print_help tests
+ exit 0
+ } elseif { $arg eq "-nocolor" } {
+ set color_out "no"
+ }
+}
+
+
+# Run tests
+if {$test_name ne ""} {
+ cd test/$test_name
+
+ set result [eval exec $tcl test.tcl $arguments 2>@stderr]
+ puts $result
+
+} else {
+ foreach test $test_suite {
+ cd test/$test
+
+ set result [eval exec $tcl test.tcl $arguments 2>@stderr]
+ set lastline [lindex [split $result "\n"] end]
+
+ if {[lrange [split $lastline "\t"] 1 1] != "Total"} {
+ set lastline [lindex [split $result "\n"] end-2]
+ set errmsg [lindex [split $result "\n"] end]
+ }
+
+ set splitresult [split $lastline "\t"]
+ set total [lindex $splitresult 2]
+ set pass [lindex $splitresult 4]
+ set skip [lindex $splitresult 6]
+ set fail [lindex $splitresult 8]
+
+ # Check for errors.
+ if { $fail != 0 } { set err "yes" }
+
+ set out ""
+ if { ($fail != 0 || $skip != 0) && $color_out eq "" } {
+ # Color failed tests.
+ append out "\x1b\[1;31mTotal:" $total " Passed:" $pass " Failed:" $fail " Skipped:" $skip " \x1b\[0m" $test
+ } else {
+ append out "Total:" $total " Passed:" $pass " Failed:" $fail " Skipped:" $skip " " $test
+ }
+
+ # Print results and constrints for auto-skipped tests.
+ puts $out
+ if { $skip != 0 } {
+ set out " Constraint: "
+ append out [string trim $errmsg "\t {}"]
+ puts $out
+ }
+
+ cd ../..
+ }
+}
+
+# Return 1 if errors were found.
+if {$err ne ""} {
+ exit 1
+}
+
+return 0
</ins></span></pre>
</div>
</div>
</body>
</html>