<!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>[147031] branches/vcs-fetch/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/147031">147031</a></dd>
<dt>Author</dt> <dd>raimue@macports.org</dd>
<dt>Date</dt> <dd>2016-03-23 16:51:56 -0700 (Wed, 23 Mar 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>Merge from trunk</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#branchesvcsfetchbasedocportdiagnose1">branches/vcs-fetch/base/doc/port-diagnose.1</a></li>
<li><a href="#branchesvcsfetchbasedocportreclaim1">branches/vcs-fetch/base/doc/port-reclaim.1</a></li>
<li><a href="#branchesvcsfetchbasedocport1">branches/vcs-fetch/base/doc/port.1</a></li>
<li><a href="#branchesvcsfetchbasedocportgroup7">branches/vcs-fetch/base/doc/portgroup.7</a></li>
<li><a href="#branchesvcsfetchbasesrcmacports10Makefilein">branches/vcs-fetch/base/src/macports1.0/Makefile.in</a></li>
<li><a href="#branchesvcsfetchbasesrcmacports10macportstcl">branches/vcs-fetch/base/src/macports1.0/macports.tcl</a></li>
<li><a href="#branchesvcsfetchbasesrcmacports10macports_utiltcl">branches/vcs-fetch/base/src/macports1.0/macports_util.tcl</a></li>
<li><a href="#branchesvcsfetchbasesrcmacports10reclaimtcl">branches/vcs-fetch/base/src/macports1.0/reclaim.tcl</a></li>
<li><a href="#branchesvcsfetchbasesrcmacports10testslibrarytcl">branches/vcs-fetch/base/src/macports1.0/tests/library.tcl</a></li>
<li><a href="#branchesvcsfetchbasesrcmacports10testsmacportstest">branches/vcs-fetch/base/src/macports1.0/tests/macports.test</a></li>
<li><a href="#branchesvcsfetchbasesrcmacports10testsreclaimtest">branches/vcs-fetch/base/src/macports1.0/tests/reclaim.test</a></li>
<li><a href="#branchesvcsfetchbasesrcportporttcl">branches/vcs-fetch/base/src/port/port.tcl</a></li>
<li><a href="#branchesvcsfetchbasesrcportportindextcl">branches/vcs-fetch/base/src/port/portindex.tcl</a></li>
<li><a href="#branchesvcsfetchbasesrcport10portbuildtcl">branches/vcs-fetch/base/src/port1.0/portbuild.tcl</a></li>
<li><a href="#branchesvcsfetchbasesrcport10portcleantcl">branches/vcs-fetch/base/src/port1.0/portclean.tcl</a></li>
<li><a href="#branchesvcsfetchbasesrcport10portdistchecktcl">branches/vcs-fetch/base/src/port1.0/portdistcheck.tcl</a></li>
<li><a href="#branchesvcsfetchbasesrcport10portfetchtcl">branches/vcs-fetch/base/src/port1.0/portfetch.tcl</a></li>
<li><a href="#branchesvcsfetchbasesrcport10portutiltcl">branches/vcs-fetch/base/src/port1.0/portutil.tcl</a></li>
<li><a href="#branchesvcsfetchbasesrcport10testsportactivatetest">branches/vcs-fetch/base/src/port1.0/tests/portactivate.test</a></li>
<li><a href="#branchesvcsfetchbasesrcregistry20portimagetcl">branches/vcs-fetch/base/src/registry2.0/portimage.tcl</a></li>
<li><a href="#branchesvcsfetchbasesrcregistry20portuninstalltcl">branches/vcs-fetch/base/src/registry2.0/portuninstall.tcl</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#branchesvcsfetchbasesrcmacports10selfupdatetcl">branches/vcs-fetch/base/src/macports1.0/selfupdate.tcl</a></li>
<li><a href="#branchesvcsfetchbasesrcport10testsportbuildtest">branches/vcs-fetch/base/src/port1.0/tests/portbuild.test</a></li>
</ul>
<h3>Property Changed</h3>
<ul>
<li><a href="#branchesvcsfetchbase">branches/vcs-fetch/base/</a></li>
<li><a href="#branchesvcsfetchbasedocportdiagnose1txt">branches/vcs-fetch/base/doc/port-diagnose.1.txt</a></li>
<li><a href="#branchesvcsfetchbasedocportreclaim1txt">branches/vcs-fetch/base/doc/port-reclaim.1.txt</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchesvcsfetchbase"></a>
<div class="propset"><h4>Property changes: branches/vcs-fetch/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/gsoc11-statistics/base:79520,79666
</span><span class="cx">/branches/gsoc13-tests:106692-111324
</span><span class="cx">/branches/gsoc14-cleanup:123738-124046
</span><span class="cx">/branches/gsoc14-interactive/base:119516-124240
</span><span class="cx">/branches/gsoc15-dependency/base:138631
</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">/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/gsoc14-cleanup:123738-124046
</span><span class="cx">/branches/gsoc14-interactive/base:119516-124240
</span><span class="cx">/branches/gsoc15-dependency/base:138631
</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:146631-147030
</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="branchesvcsfetchbasedocportdiagnose1"></a>
<div class="modfile"><h4>Modified: branches/vcs-fetch/base/doc/port-diagnose.1 (147030 => 147031)</h4>
<pre class="diff"><span>
<span class="info">--- branches/vcs-fetch/base/doc/port-diagnose.1        2016-03-23 13:41:22 UTC (rev 147030)
+++ branches/vcs-fetch/base/doc/port-diagnose.1        2016-03-23 23:51:56 UTC (rev 147031)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> '\" t
</span><del>-.TH "PORT\-DIAGNOSE" "1" "10/18/2015" "MacPorts 2\&.3\&.99" "MacPorts Manual"
</del><ins>+.TH "PORT\-DIAGNOSE" "1" "2016\-03\-15" "MacPorts 2\&.3\&.99" "MacPorts Manual"
</ins><span class="cx"> .\" -----------------------------------------------------------------
</span><span class="cx"> .\" * Define some portability stuff
</span><span class="cx"> .\" -----------------------------------------------------------------
</span></span></pre></div>
<a id="branchesvcsfetchbasedocportdiagnose1txt"></a>
<div class="propset"><h4>Property changes: branches/vcs-fetch/base/doc/port-diagnose.1.txt</h4>
<pre class="diff"><span>
</span></pre></div>
<a id="svnkeywords"></a>
<div class="addfile"><h4>Added: svn:keywords</h4></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="branchesvcsfetchbasedocportreclaim1"></a>
<div class="modfile"><h4>Modified: branches/vcs-fetch/base/doc/port-reclaim.1 (147030 => 147031)</h4>
<pre class="diff"><span>
<span class="info">--- branches/vcs-fetch/base/doc/port-reclaim.1        2016-03-23 13:41:22 UTC (rev 147030)
+++ branches/vcs-fetch/base/doc/port-reclaim.1        2016-03-23 23:51:56 UTC (rev 147031)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> '\" t
</span><del>-.TH "PORT\-RECLAIM" "1" "10/18/2015" "MacPorts 2\&.3\&.99" "MacPorts Manual"
</del><ins>+.TH "PORT\-RECLAIM" "1" "2016\-03\-15" "MacPorts 2\&.3\&.99" "MacPorts Manual"
</ins><span class="cx"> .\" -----------------------------------------------------------------
</span><span class="cx"> .\" * Define some portability stuff
</span><span class="cx"> .\" -----------------------------------------------------------------
</span></span></pre></div>
<a id="branchesvcsfetchbasedocportreclaim1txt"></a>
<div class="propset"><h4>Property changes: branches/vcs-fetch/base/doc/port-reclaim.1.txt</h4>
<pre class="diff"><span>
</span></pre></div>
<a id="svnkeywords"></a>
<div class="addfile"><h4>Added: svn:keywords</h4></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="branchesvcsfetchbasedocport1"></a>
<div class="modfile"><h4>Modified: branches/vcs-fetch/base/doc/port.1 (147030 => 147031)</h4>
<pre class="diff"><span>
<span class="info">--- branches/vcs-fetch/base/doc/port.1        2016-03-23 13:41:22 UTC (rev 147030)
+++ branches/vcs-fetch/base/doc/port.1        2016-03-23 23:51:56 UTC (rev 147031)
</span><span class="lines">@@ -947,7 +947,8 @@
</span><span class="cx"> .RS 4
</span><span class="cx"> Clean the files used for building
</span><span class="cx"> \fIportname\fR\&. To just remove the work files, use the
</span><del>-\fB\-\-work\fR\fIactionflag\fR\&. This is the default when no flag is given\&. To remove the distribution files (fetched tarballs, patches, etc), specify
</del><ins>+\fB\-\-work\fR
+\fIactionflag\fR\&. This is the default when no flag is given\&. To remove the distribution files (fetched tarballs, patches, etc), specify
</ins><span class="cx"> \fB\-\-dist\fR\&. To remove any archive(s) of a port than remain in the temporary download directory, pass
</span><span class="cx"> \fB\-\-archive\fR\&. (This does not remove archives from the installed location\&.) To remove log files for a port, pass
</span><span class="cx"> \fB\-\-logs\fR\&. To remove the work files, distribution files, temporary archives and logs pass
</span></span></pre></div>
<a id="branchesvcsfetchbasedocportgroup7"></a>
<div class="modfile"><h4>Modified: branches/vcs-fetch/base/doc/portgroup.7 (147030 => 147031)</h4>
<pre class="diff"><span>
<span class="info">--- branches/vcs-fetch/base/doc/portgroup.7        2016-03-23 13:41:22 UTC (rev 147030)
+++ branches/vcs-fetch/base/doc/portgroup.7        2016-03-23 23:51:56 UTC (rev 147031)
</span><span class="lines">@@ -443,7 +443,8 @@
</span><span class="cx"> .PP
</span><span class="cx"> homepage
</span><span class="cx"> .RS 4
</span><del>-\fBDefault:\fR\m[blue]\fBhttp://www\&.gnustep\&.org/\fR\m[]
</del><ins>+\fBDefault:\fR
+\m[blue]\fBhttp://www\&.gnustep\&.org/\fR\m[]
</ins><span class="cx"> .RE
</span><span class="cx"> .PP
</span><span class="cx"> master_sites
</span></span></pre></div>
<a id="branchesvcsfetchbasesrcmacports10Makefilein"></a>
<div class="modfile"><h4>Modified: branches/vcs-fetch/base/src/macports1.0/Makefile.in (147030 => 147031)</h4>
<pre class="diff"><span>
<span class="info">--- branches/vcs-fetch/base/src/macports1.0/Makefile.in        2016-03-23 13:41:22 UTC (rev 147030)
+++ branches/vcs-fetch/base/src/macports1.0/Makefile.in        2016-03-23 23:51:56 UTC (rev 147031)
</span><span class="lines">@@ -4,7 +4,7 @@
</span><span class="cx"> include ../../Mk/macports.autoconf.mk
</span><span class="cx">
</span><span class="cx"> SRCS=                macports.tcl macports_dlist.tcl macports_util.tcl \
</span><del>-                macports_autoconf.tcl diagnose.tcl reclaim.tcl
</del><ins>+                macports_autoconf.tcl diagnose.tcl reclaim.tcl selfupdate.tcl
</ins><span class="cx"> OBJS=                macports.o get_systemconfiguration_proxies.o sysctl.o
</span><span class="cx"> SHLIB_NAME=        MacPorts${SHLIB_SUFFIX}
</span><span class="cx">
</span></span></pre></div>
<a id="branchesvcsfetchbasesrcmacports10macportstcl"></a>
<div class="modfile"><h4>Modified: branches/vcs-fetch/base/src/macports1.0/macports.tcl (147030 => 147031)</h4>
<pre class="diff"><span>
<span class="info">--- branches/vcs-fetch/base/src/macports1.0/macports.tcl        2016-03-23 13:41:22 UTC (rev 147030)
+++ branches/vcs-fetch/base/src/macports1.0/macports.tcl        2016-03-23 23:51:56 UTC (rev 147031)
</span><span class="lines">@@ -38,6 +38,7 @@
</span><span class="cx"> package require macports_util 1.0
</span><span class="cx"> package require diagnose 1.0
</span><span class="cx"> package require reclaim 1.0
</span><ins>+package require selfupdate 1.0
</ins><span class="cx"> package require Tclx
</span><span class="cx">
</span><span class="cx"> namespace eval macports {
</span><span class="lines">@@ -154,8 +155,8 @@
</span><span class="cx">
</span><span class="cx"> set ::debuglogname $logname
</span><span class="cx">
</span><del>- # Truncate the file if already exists
- set ::debuglog [open $::debuglogname w]
</del><ins>+ # Append to the file if it already exists
+ set ::debuglog [open $::debuglogname a]
</ins><span class="cx"> puts $::debuglog version:1
</span><span class="cx"> }
</span><span class="cx"> proc macports::push_log {mport} {
</span><span class="lines">@@ -354,10 +355,11 @@
</span><span class="cx"> if {$autoconf_hint ne "" && [file executable $autoconf_hint]} {
</span><span class="cx"> return $autoconf_hint
</span><span class="cx"> } else {
</span><del>- if {[catch {set cmd_path [macports::binaryInPath $prog]} result] == 0} {
</del><ins>+ try -pass_signal {
+ set cmd_path [macports::binaryInPath $prog]
</ins><span class="cx"> return $cmd_path
</span><del>- } else {
- return -code error "$result or at its MacPorts configuration time location, did you move it?"
</del><ins>+ } catch {{*} eCode eMessage} {
+ error "$eMessage or at its MacPorts configuration time location, did you move it?"
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -387,11 +389,13 @@
</span><span class="cx"> trace remove variable macports::xcodeversion read macports::setxcodeinfo
</span><span class="cx"> trace remove variable macports::xcodebuildcmd read macports::setxcodeinfo
</span><span class="cx">
</span><del>- if {![catch {findBinary xcodebuild $macports::autoconf::xcodebuild_path} xcodebuild]} {
</del><ins>+ try -pass_signal {
+ set xcodebuild [findBinary xcodebuild $macports::autoconf::xcodebuild_path]
</ins><span class="cx"> if {![info exists xcodeversion]} {
</span><span class="cx"> # Determine xcode version
</span><span class="cx"> set macports::xcodeversion 2.0orlower
</span><del>- if {[catch {set xcodebuildversion [exec -- $xcodebuild -version 2> /dev/null]}] == 0} {
</del><ins>+ try -pass_signal {
+ set xcodebuildversion [exec -- $xcodebuild -version 2> /dev/null]
</ins><span class="cx"> if {[regexp {Xcode ([0-9.]+)} $xcodebuildversion - xcode_v] == 1} {
</span><span class="cx"> set macports::xcodeversion $xcode_v
</span><span class="cx"> } elseif {[regexp {DevToolsCore-(.*);} $xcodebuildversion - devtoolscore_v] == 1} {
</span><span class="lines">@@ -421,7 +425,7 @@
</span><span class="cx"> set macports::xcodeversion 2.1
</span><span class="cx"> }
</span><span class="cx"> }
</span><del>- } else {
</del><ins>+ } catch {*} {
</ins><span class="cx"> ui_warn "xcodebuild exists but failed to execute"
</span><span class="cx"> set macports::xcodeversion none
</span><span class="cx"> }
</span><span class="lines">@@ -429,7 +433,7 @@
</span><span class="cx"> if {![info exists xcodebuildcmd]} {
</span><span class="cx"> set macports::xcodebuildcmd $xcodebuild
</span><span class="cx"> }
</span><del>- } else {
</del><ins>+ } catch {*} {
</ins><span class="cx"> if {![info exists xcodeversion]} {
</span><span class="cx"> set macports::xcodeversion none
</span><span class="cx"> }
</span><span class="lines">@@ -446,24 +450,29 @@
</span><span class="cx"> trace remove variable macports::developer_dir read macports::set_developer_dir
</span><span class="cx">
</span><span class="cx"> # Look for xcodeselect, and make sure it has a valid value
</span><del>- if {![catch {findBinary xcode-select $macports::autoconf::xcode_select_path} xcodeselect]} {
</del><ins>+ try -pass_signal {
+ set xcodeselect [findBinary xcode-select $macports::autoconf::xcode_select_path]
</ins><span class="cx">
</span><span class="cx"> # We have xcode-select: ask it where xcode is and check if it's valid.
</span><span class="cx"> # If no xcode is selected, xcode-select will fail, so catch that
</span><del>- if {![catch {exec $xcodeselect -print-path 2> /dev/null} devdir] &&
- [_is_valid_developer_dir $devdir]} {
- set macports::developer_dir $devdir
- return
- }
</del><ins>+ try -pass_signal {
+ set devdir [exec $xcodeselect -print-path 2> /dev/null]
+ if {[_is_valid_developer_dir $devdir]} {
+ set macports::developer_dir $devdir
+ return
+ }
+ } catch {*} {}
</ins><span class="cx">
</span><span class="cx"> # The directory from xcode-select isn't correct.
</span><span class="cx">
</span><span class="cx"> # Ask mdfind where Xcode is and make some suggestions for the user,
</span><span class="cx"> # searching by bundle identifier for various Xcode versions (3.x and 4.x)
</span><span class="cx"> set installed_xcodes {}
</span><del>- if {![catch {findBinary mdfind $macports::autoconf::mdfind_path} mdfind]} {
</del><ins>+
+ try -pass_signal {
+ set mdfind [findBinary mdfind $macports::autoconf::mdfind_path]
</ins><span class="cx"> set installed_xcodes [exec $mdfind "kMDItemCFBundleIdentifier == 'com.apple.Xcode' || kMDItemCFBundleIdentifier == 'com.apple.dt.Xcode'"]
</span><del>- }
</del><ins>+ } catch {*} {}
</ins><span class="cx">
</span><span class="cx"> # In case mdfind metadata wasn't complete, also look in two well-known locations for Xcode.app
</span><span class="cx"> foreach app {/Applications/Xcode.app /Developer/Applications/Xcode.app} {
</span><span class="lines">@@ -477,7 +486,13 @@
</span><span class="cx">
</span><span class="cx"> # Present instructions to the user
</span><span class="cx"> ui_error
</span><del>- if {[llength $installed_xcodes] > 0 && ![catch {findBinary mdls $macports::autoconf::mdls_path} mdls]} {
</del><ins>+ try -pass_signal {
+ if {[llength $installed_xcodes] == 0} {
+ error "No Xcode installation was found."
+ }
+
+ set mdls [findBinary mdls $macports::autoconf::mdls_path]
+
</ins><span class="cx"> # One, or more than one, Xcode installations found
</span><span class="cx"> ui_error "No valid Xcode installation is properly selected."
</span><span class="cx"> ui_error "Please use xcode-select to select an Xcode installation:"
</span><span class="lines">@@ -499,12 +514,12 @@
</span><span class="cx"> ui_error " # malformed Xcode at ${xcode}, version $vers"
</span><span class="cx"> }
</span><span class="cx"> }
</span><del>- } else {
</del><ins>+ } catch {*} {
</ins><span class="cx"> ui_error "No Xcode installation was found."
</span><span class="cx"> ui_error "Please install Xcode and/or run xcode-select to specify its location."
</span><span class="cx"> }
</span><span class="cx"> ui_error
</span><del>- }
</del><ins>+ } catch {*} {}
</ins><span class="cx">
</span><span class="cx"> # Try the default
</span><span class="cx"> if {$os_major >= 11 && [vercmp $xcodeversion 4.3] >= 0} {
</span><span class="lines">@@ -627,9 +642,10 @@
</span><span class="cx"> set os_endian [string range $tcl_platform(byteOrder) 0 end-6]
</span><span class="cx"> set macosx_version {}
</span><span class="cx"> if {$os_platform eq "darwin" && [file executable /usr/bin/sw_vers]} {
</span><del>- if {![catch {exec /usr/bin/sw_vers -productVersion | cut -f1,2 -d.} result]} {
- set macosx_version $result
- } else {
</del><ins>+
+ try -pass_signal {
+ set macosx_version [exec /usr/bin/sw_vers -productVersion | cut -f1,2 -d.]
+ } catch {*} {
</ins><span class="cx"> ui_debug "sw_vers exists but running it failed: $result"
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -876,7 +892,11 @@
</span><span class="cx"> # Set noninteractive mode if specified in config
</span><span class="cx"> if {[info exists ui_interactive] && !$ui_interactive} {
</span><span class="cx"> set macports::ui_options(ports_noninteractive) yes
</span><del>- unset -nocomplain macports::ui_options(questions_yesno) macports::ui_options(questions_singlechoice) macports::ui_options(questions_multichoice)
</del><ins>+ unset -nocomplain macports::ui_options(questions_yesno) \
+ macports::ui_options(questions_singlechoice) \
+ macports::ui_options(questions_multichoice) \
+ macports::ui_options(questions_alternative)
+
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> # Archive type, what type of binary archive to use (CPIO, gzipped
</span><span class="lines">@@ -1053,8 +1073,10 @@
</span><span class="cx"> # might slow builds down considerably. You can avoid this by touching
</span><span class="cx"> # $portdbpath/.nohide.
</span><span class="cx"> 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} {
</span><del>- if {[catch {file attributes $portdbpath -hidden yes} result]} {
- ui_debug "error setting hidden flag for $portdbpath: $result"
</del><ins>+ try -pass_signal {
+ file attributes $portdbpath -hidden yes
+ } catch {{*} eCode eMessage} {
+ ui_debug "error setting hidden flag for $portdbpath: $eMessage"
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -1159,11 +1181,17 @@
</span><span class="cx"> set env(CCACHE_DIR) $macports::ccache_dir
</span><span class="cx">
</span><span class="cx"> # load cached ping times
</span><del>- if {[catch {
</del><ins>+ try -pass_signal {
+ set pingfile -1
</ins><span class="cx"> set pingfile [open ${macports::portdbpath}/pingtimes r]
</span><span class="cx"> array set macports::ping_cache [gets $pingfile]
</span><del>- close $pingfile
- }]} {array set macports::ping_cache {}}
</del><ins>+ } catch {*} {
+ array set macports::ping_cache {}
+ } finally {
+ if {$pingfile != -1} {
+ close $pingfile
+ }
+ }
</ins><span class="cx"> # set up arrays of blacklisted and preferred hosts
</span><span class="cx"> if {[info exists macports::host_blacklist]} {
</span><span class="cx"> foreach host $macports::host_blacklist {
</span><span class="lines">@@ -1199,6 +1227,7 @@
</span><span class="cx"> # convert any flat receipts if we just created a new db
</span><span class="cx"> if {$db_exists == 0 && [file exists ${registry.path}/receipts] && [file writable $db_path]} {
</span><span class="cx"> ui_warn "Converting your registry to sqlite format, this might take a while..."
</span><ins>+ # XXX: catch, leave unfixed, code should go away.
</ins><span class="cx"> if {[catch {registry::convert_to_sqlite}]} {
</span><span class="cx"> ui_debug $::errorInfo
</span><span class="cx"> file delete -force $db_path
</span><span class="lines">@@ -1226,13 +1255,13 @@
</span><span class="cx"> close $pingfile
</span><span class="cx"> }
</span><span class="cx"> }
</span><del>- # close it down so the cleanup stuff is called, e.g. vacuuming the db
- registry::close
-
- # Check the last time 'reclaim' was run
</del><ins>+ # Check the last time 'reclaim' was run and run it
</ins><span class="cx"> if {![macports::ui_isset ports_quiet]} {
</span><span class="cx"> reclaim::check_last_run
</span><span class="cx"> }
</span><ins>+
+ # close it down so the cleanup stuff is called, e.g. vacuuming the db
+ registry::close
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> # link plist for xcode 4.3's benefit
</span><span class="lines">@@ -1243,17 +1272,22 @@
</span><span class="cx"> file delete -force "${target_dir}/com.apple.dt.Xcode.plist"
</span><span class="cx"> if {[file isfile $user_plist]} {
</span><span class="cx"> if {![file isdirectory $target_dir]} {
</span><del>- if {[catch {file mkdir $target_dir} result]} {
- ui_warn "Failed to create Library/Preferences in ${target_homedir}: $result"
</del><ins>+ try -pass_signal {
+ file mkdir $target_dir
+ } catch {{*} eCode eMessage} {
+ ui_warn "Failed to create Library/Preferences in ${target_homedir}: $eMessage"
</ins><span class="cx"> return
</span><span class="cx"> }
</span><span class="cx"> }
</span><del>- if {[file writable $target_dir] && [catch {
</del><ins>+ try -pass_signal {
+ if {![file writable $target_dir]} {
+ error "${target_dir} is not writable"
+ }
</ins><span class="cx"> ui_debug "Copying $user_plist to $target_dir"
</span><span class="cx"> file copy -force $user_plist $target_dir
</span><span class="cx"> file attributes ${target_dir}/com.apple.dt.Xcode.plist -owner $macportsuser -permissions 0644
</span><del>- } result]} {
- ui_warn "Failed to copy com.apple.dt.Xcode.plist to ${target_dir}: $result"
</del><ins>+ } catch {{*} eCode eMessage} {
+ ui_warn "Failed to copy com.apple.dt.Xcode.plist to ${target_dir}: $eMessage"
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -2435,7 +2469,9 @@
</span><span class="cx"> switch -regexp -- [macports::getprotocol $source] {
</span><span class="cx"> {^file$} {
</span><span class="cx"> set portdir [macports::getportdir $source]
</span><del>- if {[catch {macports::GetVCSUpdateCmd $portdir} repoInfo]} {
</del><ins>+ try -pass_signal {
+ set repoInfo [macports::GetVCSUpdateCmd $portdir]
+ } catch {*} {
</ins><span class="cx"> ui_debug $::errorInfo
</span><span class="cx"> ui_info "Could not access contents of $portdir"
</span><span class="cx"> incr numfailed
</span><span class="lines">@@ -2443,7 +2479,9 @@
</span><span class="cx"> }
</span><span class="cx"> if {[llength $repoInfo]} {
</span><span class="cx"> lassign $repoInfo vcs cmd
</span><del>- if {[catch {macports::UpdateVCS $cmd $portdir}]} {
</del><ins>+ try -pass_signal {
+ macports::UpdateVCS $cmd $portdir
+ } catch {*} {
</ins><span class="cx"> ui_debug $::errorInfo
</span><span class="cx"> ui_info "Syncing local $vcs ports tree failed"
</span><span class="cx"> incr numfailed
</span><span class="lines">@@ -2473,8 +2511,9 @@
</span><span class="cx"> }
</span><span class="cx"> # Do rsync fetch
</span><span class="cx"> set rsync_commandline "$macports::autoconf::rsync_path $rsync_options $exclude_option $source $destdir"
</span><del>- ui_debug $rsync_commandline
- if {[catch {system $rsync_commandline}]} {
</del><ins>+ try -pass_signal {
+ system $rsync_commandline
+ } catch {*} {
</ins><span class="cx"> ui_error "Synchronization of the local ports tree failed doing rsync"
</span><span class="cx"> incr numfailed
</span><span class="cx"> continue
</span><span class="lines">@@ -2484,8 +2523,9 @@
</span><span class="cx"> # verify signature for tarball
</span><span class="cx"> global macports::archivefetch_pubkeys
</span><span class="cx"> set rsync_commandline "$macports::autoconf::rsync_path $rsync_options $exclude_option ${source}.rmd160 $destdir"
</span><del>- ui_debug $rsync_commandline
- if {[catch {system $rsync_commandline}]} {
</del><ins>+ try -pass_signal {
+ system $rsync_commandline
+ } catch {*} {
</ins><span class="cx"> ui_error "Synchronization of the ports tree signature failed doing rsync"
</span><span class="cx"> incr numfailed
</span><span class="cx"> continue
</span><span class="lines">@@ -2495,13 +2535,14 @@
</span><span class="cx"> set openssl [macports::findBinary openssl $macports::autoconf::openssl_path]
</span><span class="cx"> set verified 0
</span><span class="cx"> foreach pubkey $macports::archivefetch_pubkeys {
</span><del>- if {![catch {exec $openssl dgst -ripemd160 -verify $pubkey -signature $signature $tarball} result]} {
</del><ins>+ try -pass_signal {
+ exec $openssl dgst -ripemd160 -verify $pubkey -signature $signature $tarball
</ins><span class="cx"> set verified 1
</span><span class="cx"> ui_debug "successful verification with key $pubkey"
</span><span class="cx"> break
</span><del>- } else {
</del><ins>+ } catch {{*} eCode eMessage} {
</ins><span class="cx"> ui_debug "failed verification with key $pubkey"
</span><del>- ui_debug "openssl output: $result"
</del><ins>+ ui_debug "openssl output: $eMessage"
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> if {!$verified} {
</span><span class="lines">@@ -2514,9 +2555,10 @@
</span><span class="cx"> set tar [macports::findBinary tar $macports::autoconf::tar_path]
</span><span class="cx"> file mkdir ${destdir}/tmp
</span><span class="cx"> set tar_cmd "$tar -C ${destdir}/tmp -xf $tarball"
</span><del>- ui_debug $tar_cmd
- if {[catch {system $tar_cmd}]} {
- ui_error "Failed to extract ports tree from tarball!"
</del><ins>+ try -pass_signal {
+ system $tar_cmd
+ } catch {{*} eCode eMessage} {
+ ui_error "Failed to extract ports tree from tarball: $eMessage"
</ins><span class="cx"> incr numfailed
</span><span class="cx"> continue
</span><span class="cx"> }
</span><span class="lines">@@ -2545,10 +2587,9 @@
</span><span class="cx"> }
</span><span class="cx"> set remote_indexfile "${index_source}PortIndex_${macports::os_platform}_${macports::os_major}_${macports::os_arch}/PortIndex"
</span><span class="cx"> set rsync_commandline "$macports::autoconf::rsync_path $rsync_options $remote_indexfile $destdir"
</span><del>- ui_debug $rsync_commandline
- if {[catch {system $rsync_commandline}]} {
- ui_debug "Synchronization of the PortIndex failed doing rsync"
- } else {
</del><ins>+ try -pass_signal {
+ system $rsync_commandline
+
</ins><span class="cx"> set ok 1
</span><span class="cx"> set needs_portindex false
</span><span class="cx"> if {$is_tarball} {
</span><span class="lines">@@ -2556,31 +2597,34 @@
</span><span class="cx"> set needs_portindex true
</span><span class="cx"> # verify signature for PortIndex
</span><span class="cx"> set rsync_commandline "$macports::autoconf::rsync_path $rsync_options ${remote_indexfile}.rmd160 $destdir"
</span><del>- ui_debug $rsync_commandline
- if {![catch {system $rsync_commandline}]} {
- foreach pubkey $macports::archivefetch_pubkeys {
- if {![catch {exec $openssl dgst -ripemd160 -verify $pubkey -signature ${destdir}/PortIndex.rmd160 ${destdir}/PortIndex} result]} {
- set ok 1
- set needs_portindex false
- ui_debug "successful verification with key $pubkey"
- break
- } else {
- ui_debug "failed verification with key $pubkey"
- ui_debug "openssl output: $result"
- }
</del><ins>+ system $rsync_commandline
+ foreach pubkey $macports::archivefetch_pubkeys {
+ try -pass_signal {
+ exec $openssl dgst -ripemd160 -verify $pubkey -signature ${destdir}/PortIndex.rmd160 ${destdir}/PortIndex
+ set ok 1
+ set needs_portindex false
+ ui_debug "successful verification with key $pubkey"
+ break
+ } catch {{*} eCode eMessage} {
+ ui_debug "failed verification with key $pubkey"
+ ui_debug "openssl output: $eMessage"
</ins><span class="cx"> }
</span><del>- if {$ok} {
- # move PortIndex into place
- file rename -force ${destdir}/PortIndex ${destdir}/ports/
- }
</del><span class="cx"> }
</span><ins>+ if {$ok} {
+ # move PortIndex into place
+ file rename -force ${destdir}/PortIndex ${destdir}/ports/
+ }
</ins><span class="cx"> }
</span><span class="cx"> if {$ok} {
</span><span class="cx"> mports_generate_quickindex $indexfile
</span><span class="cx"> }
</span><ins>+ } catch {*} {
+ ui_debug "Synchronization of the PortIndex failed doing rsync"
</ins><span class="cx"> }
</span><span class="cx"> }
</span><del>- if {[catch {system "chmod -R a+r \"$destdir\""}]} {
</del><ins>+ try -pass_signal {
+ system [list chmod -R a+r $destdir]
+ } catch {*} {
</ins><span class="cx"> ui_warn "Setting world read permissions on parts of the ports tree failed, need root?"
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -2601,6 +2645,7 @@
</span><span class="cx"> set updated 1
</span><span class="cx"> if {[file isdirectory $destdir]} {
</span><span class="cx"> set moddate [file mtime $destdir]
</span><ins>+ # XXX, catch, don't fix rarely used code
</ins><span class="cx"> if {[catch {set updated [curl isnewer $source $moddate]} error]} {
</span><span class="cx"> ui_warn "Cannot check if $source was updated, ($error)"
</span><span class="cx"> }
</span><span class="lines">@@ -2621,13 +2666,8 @@
</span><span class="cx"> set progressflag "--progress ${macports::ui_options(progress_download)}"
</span><span class="cx"> set verboseflag ""
</span><span class="cx"> }
</span><del>-
- try {
</del><ins>+ try -pass_signal {
</ins><span class="cx"> curl fetch {*}$progressflag $source $tarpath
</span><del>- } catch {{POSIX SIG SIGINT} eCode eMessage} {
- throw
- } catch {{POSIX SIG SIGTERM} eCode eMessage} {
- throw
</del><span class="cx"> } catch {{*} eCode eMessage} {
</span><span class="cx"> ui_error [msgcat::mc "Fetching %s failed: %s" $source $eMessage]
</span><span class="cx"> incr numfailed
</span><span class="lines">@@ -2746,10 +2786,10 @@
</span><span class="cx"> foreach source $sources {
</span><span class="cx"> set source [lindex $source 0]
</span><span class="cx"> set protocol [macports::getprotocol $source]
</span><del>- if {[catch {set fd [open [macports::getindex $source] r]} result]} {
- ui_warn "Can't open index file for source: $source"
- } else {
- try {
</del><ins>+ try -pass_signal {
+ set fd [open [macports::getindex $source] r]
+
+ try -pass_signal {
</ins><span class="cx"> incr found 1
</span><span class="cx"> while {[gets $fd line] >= 0} {
</span><span class="cx"> array unset portinfo
</span><span class="lines">@@ -2831,6 +2871,8 @@
</span><span class="cx"> } finally {
</span><span class="cx"> close $fd
</span><span class="cx"> }
</span><ins>+ } catch {*} {
+ ui_warn "Can't open index file for source: $source"
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> if {!$found} {
</span><span class="lines">@@ -2874,7 +2916,7 @@
</span><span class="cx"> if {[catch {set fd [open [macports::getindex $source] r]} result]} {
</span><span class="cx"> ui_warn "Can't open index file for source: $source"
</span><span class="cx"> } else {
</span><del>- try {
</del><ins>+ try -pass_signal {
</ins><span class="cx"> seek $fd $offset
</span><span class="cx"> gets $fd line
</span><span class="cx"> set name [lindex $line 0]
</span><span class="lines">@@ -2901,14 +2943,10 @@
</span><span class="cx"> }
</span><span class="cx"> lappend matches $name
</span><span class="cx"> lappend matches $line
</span><del>- close $fd
- set fd -1
</del><span class="cx"> } catch * {
</span><span class="cx"> ui_warn "It looks like your PortIndex file for $source may be corrupt."
</span><span class="cx"> } finally {
</span><del>- if {$fd != -1} {
- close $fd
- }
</del><ins>+ close $fd
</ins><span class="cx"> }
</span><span class="cx"> if {[llength $matches] > 0} {
</span><span class="cx"> # if we have a match, exit. If we don't, continue with the next
</span><span class="lines">@@ -2937,8 +2975,10 @@
</span><span class="cx"> foreach source $sources {
</span><span class="cx"> set source [lindex $source 0]
</span><span class="cx"> set protocol [macports::getprotocol $source]
</span><del>- if {![catch {set fd [open [macports::getindex $source] r]} result]} {
- try {
</del><ins>+ try -pass_signal {
+ set fd [open [macports::getindex $source] r]
+
+ try -pass_signal {
</ins><span class="cx"> incr found 1
</span><span class="cx"> while {[gets $fd line] >= 0} {
</span><span class="cx"> array unset portinfo
</span><span class="lines">@@ -2972,7 +3012,7 @@
</span><span class="cx"> } finally {
</span><span class="cx"> close $fd
</span><span class="cx"> }
</span><del>- } else {
</del><ins>+ } catch {*} {
</ins><span class="cx"> ui_warn "Can't open index file for source: $source"
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -3004,21 +3044,24 @@
</span><span class="cx"> }
</span><span class="cx"> if {![file exists ${index}.quick]} {
</span><span class="cx"> ui_warn "No quick index file found, attempting to generate one for source: $source"
</span><del>- if {[catch {set quicklist [mports_generate_quickindex $index]}]} {
</del><ins>+ try -pass_signal {
+ set quicklist [mports_generate_quickindex $index]
+ } catch {*} {
</ins><span class="cx"> incr sourceno
</span><span class="cx"> continue
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> # only need to read the quick index file if we didn't just update it
</span><span class="cx"> if {![info exists quicklist]} {
</span><del>- if {[catch {set fd [open ${index}.quick r]} result]} {
</del><ins>+ try -pass_signal {
+ set fd [open ${index}.quick r]
+ } catch {*} {
</ins><span class="cx"> ui_warn "Can't open quick index file for source: $source"
</span><span class="cx"> incr sourceno
</span><span class="cx"> continue
</span><del>- } else {
- set quicklist [read $fd]
- close $fd
</del><span class="cx"> }
</span><ins>+ set quicklist [read $fd]
+ close $fd
</ins><span class="cx"> }
</span><span class="cx"> foreach entry [split $quicklist \n] {
</span><span class="cx"> set quick_index(${sourceno},[lindex $entry 0]) [lindex $entry 1]
</span><span class="lines">@@ -3045,34 +3088,38 @@
</span><span class="cx"> # is corrupt), or the quick index generation failed for some other
</span><span class="cx"> # reason.
</span><span class="cx"> proc mports_generate_quickindex {index} {
</span><del>- if {[catch {set indexfd [open $index r]} result] || [catch {set quickfd [open ${index}.quick w]} result]} {
</del><ins>+ try -pass_signal {
+ set indexfd -1
+ set quickfd -1
+ set indexfd [open $index r]
+ set quickfd [open ${index}.quick w]
+ } catch {*} {
</ins><span class="cx"> ui_warn "Can't open index file: $index"
</span><span class="cx"> return -code error
</span><del>- } else {
- try {
- set offset [tell $indexfd]
- set quicklist {}
- while {[gets $indexfd line] >= 0} {
- if {[llength $line] != 2} {
- continue
- }
- set name [lindex $line 0]
- append quicklist "[string tolower $name] $offset\n"
-
- set len [lindex $line 1]
- read $indexfd $len
- set offset [tell $indexfd]
</del><ins>+ }
+ try -pass_signal {
+ set offset [tell $indexfd]
+ set quicklist {}
+ while {[gets $indexfd line] >= 0} {
+ if {[llength $line] != 2} {
+ continue
</ins><span class="cx"> }
</span><del>- puts -nonewline $quickfd $quicklist
- } catch {{POSIX SIG SIGINT} eCode eMessage} {
- throw
- } catch {{POSIX SIG SIGTERM} eCode eMessage} {
- throw
- } catch {{*} eCode eMessage} {
- ui_warn "It looks like your PortIndex file $index may be corrupt."
- throw
- } finally {
</del><ins>+ set name [lindex $line 0]
+ append quicklist "[string tolower $name] $offset\n"
+
+ set len [lindex $line 1]
+ read $indexfd $len
+ set offset [tell $indexfd]
+ }
+ puts -nonewline $quickfd $quicklist
+ } catch {{*} eCode eMessage} {
+ ui_warn "It looks like your PortIndex file $index may be corrupt."
+ throw
+ } finally {
+ if {$indexfd != -1} {
</ins><span class="cx"> close $indexfd
</span><ins>+ }
+ if {$quickfd != -1} {
</ins><span class="cx"> close $quickfd
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -3235,11 +3282,13 @@
</span><span class="cx"> }
</span><span class="cx"> if {$parse} {
</span><span class="cx"> # Find the porturl
</span><del>- if {[catch {set res [mportlookup $dep_portname]} error]} {
</del><ins>+ try -pass_signal {
+ set res [mportlookup $dep_portname]
+ } catch {{*} eCode eMessage} {
</ins><span class="cx"> global errorInfo
</span><span class="cx"> ui_msg {}
</span><span class="cx"> ui_debug $errorInfo
</span><del>- ui_error "Internal error: port lookup failed: $error"
</del><ins>+ ui_error "Internal error: port lookup failed: $eMessage"
</ins><span class="cx"> return 1
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -3496,186 +3545,7 @@
</span><span class="cx">
</span><span class="cx"> # selfupdate procedure
</span><span class="cx"> proc macports::selfupdate {{optionslist {}} {updatestatusvar {}}} {
</span><del>- global macports::prefix macports::portdbpath macports::rsync_server macports::rsync_dir \
- macports::rsync_options macports::autoconf::macports_version \
- macports::autoconf::rsync_path tcl_platform macports::autoconf::openssl_path \
- macports::autoconf::tar_path
- array set options $optionslist
-
- # variable that indicates whether we actually updated base
- if {$updatestatusvar ne ""} {
- upvar $updatestatusvar updatestatus
- set updatestatus no
- }
-
- # are we syncing a tarball? (implies detached signature)
- set is_tarball 0
- if {[string range $rsync_dir end-3 end] eq ".tar"} {
- set is_tarball 1
- set mp_source_path [file join $portdbpath sources $rsync_server [file dirname $rsync_dir]]
- } else {
- if {[string index $rsync_dir end] ne "/"} {
- append rsync_dir /
- }
- set mp_source_path [file join $portdbpath sources $rsync_server $rsync_dir]
- }
- # create the path to the to be downloaded sources if it doesn't exist
- if {![file exists $mp_source_path]} {
- file mkdir $mp_source_path
- }
- ui_debug "MacPorts sources location: $mp_source_path"
-
- # sync the MacPorts sources
- ui_msg "$macports::ui_prefix Updating MacPorts base sources using rsync"
- if {[catch {system "$rsync_path $rsync_options rsync://${rsync_server}/$rsync_dir $mp_source_path"} result]} {
- return -code error "Error synchronizing MacPorts sources: $result"
- }
-
- if {$is_tarball} {
- # verify signature for tarball
- global macports::archivefetch_pubkeys
- if {[catch {system "$rsync_path $rsync_options rsync://${rsync_server}/${rsync_dir}.rmd160 $mp_source_path"} result]} {
- return -code error "Error synchronizing MacPorts source signature: $result"
- }
- set openssl [findBinary openssl $macports::autoconf::openssl_path]
- set tarball ${mp_source_path}/[file tail $rsync_dir]
- set signature ${tarball}.rmd160
- set verified 0
- foreach pubkey $macports::archivefetch_pubkeys {
- if {![catch {exec $openssl dgst -ripemd160 -verify $pubkey -signature $signature $tarball} result]} {
- set verified 1
- ui_debug "successful verification with key $pubkey"
- break
- } else {
- ui_debug "failed verification with key $pubkey"
- ui_debug "openssl output: $result"
- }
- }
- if {!$verified} {
- return -code error "Failed to verify signature for MacPorts source!"
- }
-
- # extract tarball and move into place
- set tar [macports::findBinary tar $macports::autoconf::tar_path]
- file mkdir ${mp_source_path}/tmp
- set tar_cmd "$tar -C ${mp_source_path}/tmp -xf $tarball"
- ui_debug $tar_cmd
- if {[catch {system $tar_cmd}]} {
- return -code error "Failed to extract MacPorts sources from tarball!"
- }
- file delete -force ${mp_source_path}/base
- file rename ${mp_source_path}/tmp/base ${mp_source_path}/base
- file delete -force ${mp_source_path}/tmp
- # set the final extracted source path
- set mp_source_path ${mp_source_path}/base
- }
-
- # echo current MacPorts version
- ui_msg "MacPorts base version $macports::autoconf::macports_version installed,"
-
- if {[info exists options(ports_force)] && $options(ports_force)} {
- set use_the_force_luke yes
- ui_debug "Forcing a rebuild and reinstallation of MacPorts"
- } else {
- set use_the_force_luke no
- ui_debug "Rebuilding and reinstalling MacPorts if needed"
- }
-
- # Choose what version file to use: old, floating point format or new, real version number format
- set version_file [file join $mp_source_path config macports_version]
- if {[file exists $version_file]} {
- set fd [open $version_file r]
- gets $fd macports_version_new
- close $fd
- # echo downloaded MacPorts version
- ui_msg "MacPorts base version $macports_version_new downloaded."
- } else {
- ui_warn "No version file found, please rerun selfupdate."
- set macports_version_new 0
- }
-
- # check if we we need to rebuild base
- set comp [vercmp $macports_version_new $macports::autoconf::macports_version]
-
- # syncing ports tree.
- if {![info exists options(ports_selfupdate_nosync)] || !$options(ports_selfupdate_nosync)} {
- if {$comp > 0} {
- # updated portfiles potentially need new base to parse - tell sync to try to
- # use prefabricated PortIndex files and signal if it couldn't
- lappend optionslist no_reindex 1 needed_portindex_var needed_portindex
- }
- if {[catch {mportsync $optionslist} result]} {
- return -code error "Couldn't sync the ports tree: $result"
- }
- }
-
- if {$use_the_force_luke || $comp > 0} {
- if {[info exists options(ports_dryrun)] && $options(ports_dryrun)} {
- ui_msg "$macports::ui_prefix MacPorts base is outdated, selfupdate would install $macports_version_new (dry run)"
- } else {
- ui_msg "$macports::ui_prefix MacPorts base is outdated, installing new version $macports_version_new"
-
- # get installation user/group and permissions
- set owner [file attributes $prefix -owner]
- set group [file attributes $prefix -group]
- set perms [string range [file attributes $prefix -permissions] end-3 end]
- if {$tcl_platform(user) ne "root" && $tcl_platform(user) ne $owner} {
- return -code error "User $tcl_platform(user) does not own $prefix - try using sudo"
- }
- ui_debug "Permissions OK"
-
- set configure_args "--prefix=[macports::shellescape $prefix] --with-install-user=[macports::shellescape $owner] --with-install-group=[macports::shellescape $group] --with-directory-mode=[macports::shellescape $perms]"
- # too many users have an incompatible readline in /usr/local, see ticket #10651
- if {$tcl_platform(os) ne "Darwin" || $prefix eq "/usr/local"
- || ([glob -nocomplain /usr/local/lib/lib{readline,history}*] eq "" && [glob -nocomplain /usr/local/include/readline/*.h] eq "")} {
- append configure_args " --enable-readline"
- } else {
- ui_warn "Disabling readline support due to readline in /usr/local"
- }
-
- if {$prefix eq "/usr/local" || $prefix eq "/usr"} {
- append configure_args " --with-unsupported-prefix"
- }
-
- # Choose a sane compiler
- set cc_arg {}
- if {$::macports::os_platform eq "darwin"} {
- set cc_arg "CC=/usr/bin/cc OBJC=/usr/bin/cc "
- }
-
- # do the actual configure, build and installation of new base
- ui_msg "Installing new MacPorts release in $prefix as ${owner}:${group}; permissions ${perms}\n"
- if {[catch {system "cd $mp_source_path && ${cc_arg}./configure $configure_args && make SELFUPDATING=1 && make install SELFUPDATING=1"} result]} {
- return -code error "Error installing new MacPorts base: $result"
- }
- if {[info exists updatestatus]} {
- set updatestatus yes
- }
- }
- } elseif {$comp < 0} {
- ui_msg "$macports::ui_prefix MacPorts base is probably trunk or a release candidate"
- } else {
- ui_msg "$macports::ui_prefix MacPorts base is already the latest version"
- }
-
- # set the MacPorts sources to the right owner
- set sources_owner [file attributes [file join $portdbpath sources/] -owner]
- ui_debug "Setting MacPorts sources ownership to $sources_owner"
- if {[catch {exec [findBinary chown $macports::autoconf::chown_path] -R $sources_owner [file join $portdbpath sources/]} result]} {
- return -code error "Couldn't change permissions of the MacPorts sources at $mp_source_path to ${sources_owner}: $result"
- }
-
- if {![info exists options(ports_selfupdate_nosync)] || !$options(ports_selfupdate_nosync)} {
- if {[info exists needed_portindex]} {
- ui_msg "Not all sources could be fully synced using the old version of MacPorts."
- ui_msg "Please run selfupdate again now that MacPorts base has been updated."
- } else {
- ui_msg "\nThe ports tree has been updated. To upgrade your installed ports, you should run"
- ui_msg " port upgrade outdated"
- }
- }
-
- return 0
</del><ins>+ return [uplevel [list selfupdate::main $optionslist $updatestatusvar]]
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> # upgrade API wrapper procedure
</span><span class="lines">@@ -3744,10 +3614,13 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> # check if the port is in tree
</span><del>- if {[catch {mportlookup $portname} result]} {
</del><ins>+ set result ""
+ try {
+ set result [mportlookup $portname]
+ } catch {{*} eCode eMessage} {
</ins><span class="cx"> global errorInfo
</span><span class="cx"> ui_debug $errorInfo
</span><del>- ui_error "port lookup failed: $result"
</del><ins>+ ui_error "port lookup failed: $eMessage"
</ins><span class="cx"> return 1
</span><span class="cx"> }
</span><span class="cx"> # argh! port doesnt exist!
</span><span class="lines">@@ -4467,7 +4340,6 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> proc macports::reclaim_main {} {
</span><del>-
</del><span class="cx"> # Calls the main function for the 'port reclaim' command.
</span><span class="cx"> #
</span><span class="cx"> # Args:
</span><span class="lines">@@ -4475,7 +4347,19 @@
</span><span class="cx"> # Returns:
</span><span class="cx"> # None
</span><span class="cx">
</span><del>- reclaim::main
</del><ins>+ try {
+ reclaim::main
+ } catch {{POSIX SIG SIGINT} eCode eMessage} {
+ ui_error [msgcat::mc "reclaim aborted: SIGINT received."]
+ return 2
+ } catch {{POSIX SIG SIGTERM} eCode eMessage} {
+ ui_error [msgcat::mc "reclaim aborted: SIGTERM received."]
+ return 2
+ } catch {{*} eCode eMessage} {
+ ui_debug "reclaim failed: $::errorInfo"
+ ui_error [msgcat::mc "reclaim failed: %s" $eMessage]
+ return 1
+ }
</ins><span class="cx"> return 0
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -4559,12 +4443,26 @@
</span><span class="cx"> ui_debug "Updating binary flag for file $i of ${files_count}: $fpath"
</span><span class="cx"> incr i
</span><span class="cx">
</span><del>- if {0 != [catch {$f binary [fileIsBinary $fpath]} fileIsBinaryError]} {
- # handle errors (e.g. file not found, permission denied) gracefully
</del><ins>+ try {
+ $f binary [fileIsBinary $fpath]
+ } catch {{POSIX SIG SIGINT} eCode eMessage} {
</ins><span class="cx"> if {$fancy_output} {
</span><span class="cx"> $revupgrade_progress intermission
</span><span class="cx"> }
</span><del>- ui_warn "Error determining file type of `$fpath': $fileIsBinaryError"
</del><ins>+ ui_debug [msgcat::mc "Aborted: SIGINT signal received"]
+ throw
+ } catch {{POSIX SIG SIGTERM} eCode eMessage} {
+ if {$fancy_output} {
+ $revupgrade_progress intermission
+ }
+ ui_debug [msgcat::mc "Aborted: SIGTERM signal received"]
+ throw
+ } catch {{*} eCode eMessage} {
+ if {$fancy_output} {
+ $revupgrade_progress intermission
+ }
+ # handle errors (e.g. file not found, permission denied) gracefully
+ ui_warn "Error determining file type of `$fpath': $eMessage"
</ins><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="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -4633,7 +4531,9 @@
</span><span class="cx"> if {[$architecture cget -mat_install_name] ne "NULL" && [$architecture cget -mat_install_name] ne ""} {
</span><span class="cx"> # check if this lib's install name actually refers to this file itself
</span><span class="cx"> # if this is not the case software linking against this library might have erroneous load commands
</span><del>- if {0 == [catch {set idloadcmdpath [revupgrade_handle_special_paths $bpath [$architecture cget -mat_install_name]]}]} {
</del><ins>+
+ try {
+ set idloadcmdpath [revupgrade_handle_special_paths $bpath [$architecture cget -mat_install_name]]
</ins><span class="cx"> if {[string index $idloadcmdpath 0] ne "/"} {
</span><span class="cx"> set port [registry::entry owner $bpath]
</span><span class="cx"> if {$port ne ""} {
</span><span class="lines">@@ -4675,7 +4575,19 @@
</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="cx"> }
</span><span class="cx"> }
</span><del>- }
</del><ins>+ } catch {{POSIX SIG SIGINT} eCode eMessage} {
+ if {$fancy_output} {
+ $revupgrade_progress intermission
+ }
+ ui_debug [msgcat::mc "Aborted: SIGINT signal received"]
+ throw
+ } catch {{POSIX SIG SIGTERM} eCode eMessage} {
+ if {$fancy_output} {
+ $revupgrade_progress intermission
+ }
+ ui_debug [msgcat::mc "Aborted: SIGTERM signal received"]
+ throw
+ } catch {*} {}
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -4689,7 +4601,21 @@
</span><span class="cx"> set loadcommand [$architecture cget -mat_loadcmds]
</span><span class="cx">
</span><span class="cx"> while {$loadcommand ne "NULL"} {
</span><del>- if {0 != [catch {set filepath [revupgrade_handle_special_paths $bpath [$loadcommand cget -mlt_install_name]]}]} {
</del><ins>+ try {
+ set filepath [revupgrade_handle_special_paths $bpath [$loadcommand cget -mlt_install_name]]
+ } catch {{POSIX SIG SIGINT} eCode eMessage} {
+ if {$fancy_output} {
+ $revupgrade_progress intermission
+ }
+ ui_debug [msgcat::mc "Aborted: SIGINT signal received"]
+ throw
+ } catch {{POSIX SIG SIGTERM} eCode eMessage} {
+ if {$fancy_output} {
+ $revupgrade_progress intermission
+ }
+ ui_debug [msgcat::mc "Aborted: SIGTERM signal received"]
+ throw
+ } catch {*} {
</ins><span class="cx"> set loadcommand [$loadcommand cget -next]
</span><span class="cx"> continue;
</span><span class="cx"> }
</span></span></pre></div>
<a id="branchesvcsfetchbasesrcmacports10macports_utiltcl"></a>
<div class="modfile"><h4>Modified: branches/vcs-fetch/base/src/macports1.0/macports_util.tcl (147030 => 147031)</h4>
<pre class="diff"><span>
<span class="info">--- branches/vcs-fetch/base/src/macports1.0/macports_util.tcl        2016-03-23 13:41:22 UTC (rev 147030)
+++ branches/vcs-fetch/base/src/macports1.0/macports_util.tcl        2016-03-23 23:51:56 UTC (rev 147031)
</span><span class="lines">@@ -176,6 +176,64 @@
</span><span class="cx"> }
</span><span class="cx"> macports_util::method_wrap lunshift
</span><span class="cx">
</span><ins>+
+# bytesize filesize ?unit? ?format?
+# Format an integer representing bytes using given units
+proc bytesize {siz {unit {}} {format {%.3f}}} {
+ if {$unit == {}} {
+ if {$siz > 0x40000000} {
+ set unit "GiB"
+ } elseif {$siz > 0x100000} {
+ set unit "MiB"
+ } elseif {$siz > 0x400} {
+ set unit "KiB"
+ } else {
+ set unit "B"
+ }
+ }
+ switch -- $unit {
+ KiB {
+ set siz [expr {$siz / 1024.0}]
+ }
+ kB {
+ set siz [expr {$siz / 1000.0}]
+ }
+ MiB {
+ set siz [expr {$siz / 1048576.0}]
+ }
+ MB {
+ set siz [expr {$siz / 1000000.0}]
+ }
+ GiB {
+ set siz [expr {$siz / 1073741824.0}]
+ }
+ GB {
+ set siz [expr {$siz / 1000000000.0}]
+ }
+ B { }
+ default {
+ ui_warn "Unknown file size unit '$unit' specified"
+ set unit "B"
+ }
+ }
+ if {[expr {round($siz)}] != $siz} {
+ set siz [format $format $siz]
+ }
+ return "$siz $unit"
+}
+
+# filesize file ?unit?
+# Return size of file in human-readable format
+# In case of any errors, returns -1
+proc filesize {fil {unit {}}} {
+ set siz -1
+ catch {
+ set siz [bytesize [file size $fil] $unit]
+ }
+ return $siz
+}
+
+
</ins><span class="cx"> ################################
</span><span class="cx"> # try/catch exception handling #
</span><span class="cx"> ################################
</span><span class="lines">@@ -220,15 +278,27 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-# try body ?catch {type_list ?ecvar? ?msgvar? ?infovar?} body ...? ?finally body?
</del><ins>+# try ?-pass_signal? body ?catch {type_list ?ecvar? ?msgvar? ?infovar?} body ...? ?finally body?
</ins><span class="cx"> # implementation of try as specified in TIP #89
</span><ins>+# option -pass_signal passes SIGINT and SIGTERM signals up the stack
</ins><span class="cx"> proc try {args} {
</span><span class="cx"> # validate and interpret the arguments
</span><span class="cx"> set catchList {}
</span><span class="cx"> if {[llength $args] == 0} {
</span><span class="cx"> return -code error "wrong # args: \
</span><del>- should be \"try body ?catch {type-list ?ecvar? ?msgvar? ?infovar?} body ...? ?finally body?\""
</del><ins>+ should be \"try ?-pass_signal? body ?catch {type-list ?ecvar? ?msgvar? ?infovar?} body ...? ?finally body?\""
</ins><span class="cx"> }
</span><ins>+ if {[lindex $args 0] eq "-pass_signal"} {
+ lpush catchList {{POSIX SIG SIGINT} eCode eMessage} {
+ ui_debug [msgcat::mc "Aborted: SIGINT signal received"]
+ throw
+ }
+ lpush catchList {{POSIX SIG SIGTERM} eCode eMessage} {
+ ui_debug [msgcat::mc "Aborted: SIGTERM signal received"]
+ throw
+ }
+ lshift args
+ }
</ins><span class="cx"> set body [lshift args]
</span><span class="cx"> while {[llength $args] > 0} {
</span><span class="cx"> set arg [lshift args]
</span></span></pre></div>
<a id="branchesvcsfetchbasesrcmacports10reclaimtcl"></a>
<div class="modfile"><h4>Modified: branches/vcs-fetch/base/src/macports1.0/reclaim.tcl (147030 => 147031)</h4>
<pre class="diff"><span>
<span class="info">--- branches/vcs-fetch/base/src/macports1.0/reclaim.tcl        2016-03-23 13:41:22 UTC (rev 147030)
+++ branches/vcs-fetch/base/src/macports1.0/reclaim.tcl        2016-03-23 23:51:56 UTC (rev 147031)
</span><span class="lines">@@ -137,9 +137,11 @@
</span><span class="cx"> set variants [lindex $port 3]
</span><span class="cx">
</span><span class="cx"> # Get mport reference
</span><del>- if {[catch {set mport [mportopen_installed $name $version $revision $variants {}]} error]} {
</del><ins>+ try -pass_signal {
+ set mport [mportopen_installed $name $version $revision $variants {}]
+ } catch {{*} eCode eMessage} {
</ins><span class="cx"> $progress intermission
</span><del>- ui_warn [msgcat::mc "Failed to open port %s from registry: %s" $name $error]
</del><ins>+ ui_warn [msgcat::mc "Failed to open port %s from registry: %s" $name $eMessage]
</ins><span class="cx"> continue
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -193,61 +195,60 @@
</span><span class="cx"> incr size_superfluous_files [file size $f]
</span><span class="cx"> }
</span><span class="cx"> if {[llength $superfluous_files] > 0} {
</span><del>- ui_msg [msgcat::mc \
- "Found %d files (total %s) that are no longer needed and can be deleted." \
- $num_superfluous_files \
- [bytesize $size_superfluous_files]]
- while {1} {
- ui_msg "\[D]elete / \[k]eep / \[l]ist: "
- switch [gets stdin] {
- d -
- D {
- ui_msg "Deleting..."
- foreach f $superfluous_files {
- set root_length [string length "${root_dist}/"]
- set home_length [string length "${home_dist}/"]
</del><ins>+ if {[info exists macports::ui_options(questions_alternative)]} {
+ array set alternatives {d delete k keep l list}
+ while 1 {
+ set retstring [$macports::ui_options(questions_alternative) [msgcat::mc \
+ "Found %d files (total %s) that are no longer needed and can be deleted." \
+ $num_superfluous_files [bytesize $size_superfluous_files]] "deleteFilesQ" "alternatives" {k}]
+
+ switch $retstring {
+ d {
+ ui_msg "Deleting..."
+ foreach f $superfluous_files {
+ set root_length [string length "${root_dist}/"]
+ set home_length [string length "${home_dist}/"]
</ins><span class="cx">
</span><del>- try {
- ui_info [msgcat::mc "Deleting unused file %s" $f]
- file delete -- $f
</del><ins>+ try -pass_signal {
+ ui_info [msgcat::mc "Deleting unused file %s" $f]
+ file delete -- $f
</ins><span class="cx">
</span><del>- set directory [file dirname $f]
- while {1} {
- set is_below_root [string equal -length $root_length $directory "${root_dist}/"]
- set is_below_home [string equal -length $home_length $directory "${home_dist}/"]
</del><ins>+ set directory [file dirname $f]
+ while {1} {
+ set is_below_root [string equal -length $root_length $directory "${root_dist}/"]
+ set is_below_home [string equal -length $home_length $directory "${home_dist}/"]
</ins><span class="cx">
</span><del>- if {!$is_below_root && !$is_below_home} {
- break
- }
</del><ins>+ if {!$is_below_root && !$is_below_home} {
+ break
+ }
</ins><span class="cx">
</span><del>- if {[llength [readdir $directory]] > 0} {
- break
- }
</del><ins>+ if {[llength [readdir $directory]] > 0} {
+ break
+ }
</ins><span class="cx">
</span><del>- ui_info [msgcat::mc "Deleting empty directory %s" $directory]
- try {
- file delete -- $directory
- } catch {{*} eCode eMessage} {
- ui_warn [msgcat::mc "Could not delete empty directory %s: %s" $directory $eMesage]
</del><ins>+ ui_info [msgcat::mc "Deleting empty directory %s" $directory]
+ try -pass_signal {
+ file delete -- $directory
+ } catch {{*} eCode eMessage} {
+ ui_warn [msgcat::mc "Could not delete empty directory %s: %s" $directory $eMesage]
+ }
+ set directory [file dirname $directory]
</ins><span class="cx"> }
</span><del>- set directory [file dirname $directory]
</del><ins>+ } catch {{*} eCode eMessage} {
+ ui_warn [msgcat::mc "Could not delete %s: %s" $f $eMessage]
</ins><span class="cx"> }
</span><del>- } catch {{*} eCode eMessage} {
- ui_warn [msgcat::mc "Could not delete %s: %s" $f $eMessage]
</del><span class="cx"> }
</span><ins>+ break
</ins><span class="cx"> }
</span><del>- break
- }
- k -
- K {
- ui_msg "OK, keeping the files."
- break
- }
- l -
- L {
- foreach f $superfluous_files {
- ui_msg " $f"
</del><ins>+ k {
+ ui_msg "OK, keeping the files."
+ break
</ins><span class="cx"> }
</span><ins>+ l {
+ foreach f $superfluous_files {
+ ui_msg " $f"
+ }
+ }
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -258,19 +259,6 @@
</span><span class="cx"> return 0
</span><span class="cx"> }
</span><span class="cx">
</span><del>- proc close_file {file} {
-
- # Closes the file, handling error catching if needed.
- #
- # Args:
- # file - The file handler
- # Returns:
- # None
- if {[catch {close $file} error]} {
- ui_error "something went wrong when closing file, $file."
- }
- }
-
</del><span class="cx"> proc is_inactive {port} {
</span><span class="cx">
</span><span class="cx"> # Determines whether a port is inactive or not.
</span><span class="lines">@@ -298,12 +286,12 @@
</span><span class="cx"> # A multidimensional list where each port is a sublist, i.e., [{first port info} {second port info} {...}]
</span><span class="cx"> # Indexes of each sublist are: 0 = name, 1 = version, 2 = revision, 3 = variants, 4 = activity, and 5 = epoch.
</span><span class="cx">
</span><del>- if {[catch {set installed [registry::installed]} result]} {
</del><ins>+ try -pass_signal {
+ return [registry::installed]
+ } catch {*} {
</ins><span class="cx"> ui_error "no installed ports found."
</span><span class="cx"> return {}
</span><span class="cx"> }
</span><del>-
- return $installed
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> proc update_last_run {} {
</span><span class="lines">@@ -317,10 +305,18 @@
</span><span class="cx">
</span><span class="cx"> ui_debug "Updating last run information."
</span><span class="cx">
</span><del>- set path [file join ${macports::portdbpath} last_reclaim]
- set fd [open $path w]
- puts $fd [clock seconds]
- close_file $fd
</del><ins>+ set path [file join ${macports::portdbpath} last_reclaim]
+ set fd -1
+ try -pass_signal {
+ set fd [open $path w]
+ puts $fd [clock seconds]
+ } catch {*} {
+ # Ignore error silently
+ } finally {
+ if {$fd != -1} {
+ close $fd
+ }
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> proc check_last_run {} {
</span><span class="lines">@@ -336,15 +332,26 @@
</span><span class="cx">
</span><span class="cx"> set path [file join ${macports::portdbpath} last_reclaim]
</span><span class="cx">
</span><del>- if {[file exists $path]} {
-
- set fd [open $path r]
- set time [gets $fd]
- close_file $fd
-
- if {$time ne ""} {
- if {[clock seconds] - $time > 1209600} {
- ui_warn "You haven't run 'port reclaim' in two weeks. It's recommended you run this every two weeks to reclaim disk space."
</del><ins>+ set fd -1
+ set time ""
+ try -pass_signal {
+ set fd [open $path r]
+ set time [gets $fd]
+ } catch {*} {
+ # Ignore error silently; the file might not have been created yet
+ } finally {
+ if {$fd != -1} {
+ close $fd
+ }
+ }
+ if {$time ne ""} {
+ if {[clock seconds] - $time > 1209600} {
+ if {[info exists macports::ui_options(questions_yesno)]} {
+ set retval [$macports::ui_options(questions_yesno) "You haven't run 'port reclaim' in two weeks. It's recommended you run this every two weeks to reclaim disk space." "ReclaimPrompt" "" {y} 0 "Would you like to run it now?"]
+ if {$retval == 0} {
+ # User said yes, run port reclaim
+ macports::reclaim_main
+ }
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -381,38 +388,26 @@
</span><span class="cx"> } else {
</span><span class="cx">
</span><span class="cx"> ui_msg "Found inactive ports: $inactive_names."
</span><del>- ui_msg "Would you like to uninstall these ports? \[y/N\]: "
</del><ins>+ if {[info exists macports::ui_options(questions_multichoice)]} {
+ set retstring [$macports::ui_options(questions_multichoice) "Would you like to uninstall these ports?" "" $inactive_names]
</ins><span class="cx">
</span><del>- set input [gets stdin]
- if {$input eq "Y" || $input eq "y" } {
</del><ins>+ if {[llength $retstring] > 0} {
+ foreach i $retstring {
+ set port [lindex $inactive_ports $i]
+ set name [lindex $port 0]
</ins><span class="cx">
</span><del>- ui_debug "Iterating through all inactive ports... again."
</del><ins>+ ui_msg "Uninstalling: $name"
</ins><span class="cx">
</span><del>- foreach port $inactive_ports {
- set name [lindex $port 0]
-
- # Get all dependents of the current port
- if {[catch {set dependents [registry::list_dependents $name [lindex 1] [lindex 2] [lindex 3]]} error]} {
- ui_error "something went wrong when trying to enumerate all dependents of $name"
- }
- if {${dependents} ne ""} {
- ui_warn "Port $name is a dependent of $dependents. Do you want to uninstall this port at the risk of breaking other ports? \[Y/n\]"
-
- set input [gets stdin]
- if { $input eq "N" || "n" } {
- ui_msg "Skipping port."
- continue
</del><ins>+ # Note: 'uninstall' takes a name, version, revision, variants and an options list.
+ try -pass_signal {
+ registry_uninstall::uninstall $name [lindex $port 1] [lindex $port 2] [lindex $port 3] {}
+ } catch {{*} eCode eMessage} {
+ ui_error "Error uninstalling $name: $eMessage"
</ins><span class="cx"> }
</span><span class="cx"> }
</span><del>- ui_msg "Uninstalling: $name"
-
- # Note: 'uninstall' takes a name, version, revision, variants and an options list.
- if {[catch {registry_uninstall::uninstall $name [lindex $port 1] [lindex $port 2] [lindex $port 3] {}} error]} {
- ui_error "something went wrong when uninstalling $name"
- }
</del><ins>+ } else {
+ ui_msg "Not uninstalling ports."
</ins><span class="cx"> }
</span><del>- } else {
- ui_msg "Not uninstalling ports."
</del><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> return 0
</span></span></pre></div>
<a id="branchesvcsfetchbasesrcmacports10selfupdatetclfromrev147030trunkbasesrcmacports10selfupdatetcl"></a>
<div class="copfile"><h4>Copied: branches/vcs-fetch/base/src/macports1.0/selfupdate.tcl (from rev 147030, trunk/base/src/macports1.0/selfupdate.tcl) (0 => 147031)</h4>
<pre class="diff"><span>
<span class="info">--- branches/vcs-fetch/base/src/macports1.0/selfupdate.tcl         (rev 0)
+++ branches/vcs-fetch/base/src/macports1.0/selfupdate.tcl        2016-03-23 23:51:56 UTC (rev 147031)
</span><span class="lines">@@ -0,0 +1,233 @@
</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
+# selfupdate.tcl
+# $Id$
+#
+# Copyright (c) 2016 The MacPorts Project
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# 3. Neither the name of 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.
+
+package provide selfupdate 1.0
+
+package require macports
+
+namespace eval selfupdate {
+ namespace export main
+}
+
+proc selfupdate::main {{optionslist {}} {updatestatusvar {}}} {
+ global macports::prefix macports::portdbpath macports::rsync_server macports::rsync_dir \
+ macports::rsync_options macports::autoconf::macports_version \
+ macports::autoconf::rsync_path tcl_platform macports::autoconf::openssl_path \
+ macports::autoconf::tar_path
+ array set options $optionslist
+
+ # variable that indicates whether we actually updated base
+ if {$updatestatusvar ne ""} {
+ upvar $updatestatusvar updatestatus
+ set updatestatus no
+ }
+
+ # are we syncing a tarball? (implies detached signature)
+ set is_tarball 0
+ if {[string range $rsync_dir end-3 end] eq ".tar"} {
+ set is_tarball 1
+ set mp_source_path [file join $portdbpath sources $rsync_server [file dirname $rsync_dir]]
+ } else {
+ if {[string index $rsync_dir end] ne "/"} {
+ append rsync_dir /
+ }
+ set mp_source_path [file join $portdbpath sources $rsync_server $rsync_dir]
+ }
+ # create the path to the to be downloaded sources if it doesn't exist
+ if {![file exists $mp_source_path]} {
+ file mkdir $mp_source_path
+ }
+ ui_debug "MacPorts sources location: $mp_source_path"
+
+ # sync the MacPorts sources
+ ui_msg "$macports::ui_prefix Updating MacPorts base sources using rsync"
+ try -pass_signal {
+ system "$rsync_path $rsync_options rsync://${rsync_server}/$rsync_dir $mp_source_path"
+ } catch {{*} eCode eMessage} {
+ return -code error "Error synchronizing MacPorts sources: $eMessage"
+ }
+
+ if {$is_tarball} {
+ # verify signature for tarball
+ global macports::archivefetch_pubkeys
+ try -pass_signal {
+ system "$rsync_path $rsync_options rsync://${rsync_server}/${rsync_dir}.rmd160 $mp_source_path"
+ } catch {{*} eCode eMessage} {
+ return -code error "Error synchronizing MacPorts source signature: $eMessage"
+ }
+ set openssl [macports::findBinary openssl $macports::autoconf::openssl_path]
+ set tarball ${mp_source_path}/[file tail $rsync_dir]
+ set signature ${tarball}.rmd160
+ set verified 0
+ foreach pubkey $macports::archivefetch_pubkeys {
+ try -pass_signal {
+ exec $openssl dgst -ripemd160 -verify $pubkey -signature $signature $tarball
+ set verified 1
+ ui_debug "successful verification with key $pubkey"
+ break
+ } catch {{*} eCode eMessage} {
+ ui_debug "failed verification with key $pubkey"
+ ui_debug "openssl output: $eMessage"
+ }
+ }
+ if {!$verified} {
+ return -code error "Failed to verify signature for MacPorts source!"
+ }
+
+ # extract tarball and move into place
+ set tar [macports::findBinary tar $macports::autoconf::tar_path]
+ file mkdir ${mp_source_path}/tmp
+ set tar_cmd "$tar -C ${mp_source_path}/tmp -xf $tarball"
+ try -pass_signal {
+ system $tar_cmd
+ } catch {*} {
+ return -code error "Failed to extract MacPorts sources from tarball!"
+ }
+ file delete -force ${mp_source_path}/base
+ file rename ${mp_source_path}/tmp/base ${mp_source_path}/base
+ file delete -force ${mp_source_path}/tmp
+ # set the final extracted source path
+ set mp_source_path ${mp_source_path}/base
+ }
+
+ # echo current MacPorts version
+ ui_msg "MacPorts base version $macports::autoconf::macports_version installed,"
+
+ if {[info exists options(ports_force)] && $options(ports_force)} {
+ set use_the_force_luke yes
+ ui_debug "Forcing a rebuild and reinstallation of MacPorts"
+ } else {
+ set use_the_force_luke no
+ ui_debug "Rebuilding and reinstalling MacPorts if needed"
+ }
+
+ # Choose what version file to use: old, floating point format or new, real version number format
+ set version_file [file join $mp_source_path config macports_version]
+ if {[file exists $version_file]} {
+ set fd [open $version_file r]
+ gets $fd macports_version_new
+ close $fd
+ # echo downloaded MacPorts version
+ ui_msg "MacPorts base version $macports_version_new downloaded."
+ } else {
+ ui_warn "No version file found, please rerun selfupdate."
+ set macports_version_new 0
+ }
+
+ # check if we we need to rebuild base
+ set comp [vercmp $macports_version_new $macports::autoconf::macports_version]
+
+ # syncing ports tree.
+ if {![info exists options(ports_selfupdate_nosync)] || !$options(ports_selfupdate_nosync)} {
+ if {$comp > 0} {
+ # updated portfiles potentially need new base to parse - tell sync to try to
+ # use prefabricated PortIndex files and signal if it couldn't
+ lappend optionslist no_reindex 1 needed_portindex_var needed_portindex
+ }
+ try {
+ mportsync $optionslist
+ } catch {{*} eCode eMessage} {
+ return -code error "Couldn't sync the ports tree: $eMessage"
+ }
+ }
+
+ if {$use_the_force_luke || $comp > 0} {
+ if {[info exists options(ports_dryrun)] && $options(ports_dryrun)} {
+ ui_msg "$macports::ui_prefix MacPorts base is outdated, selfupdate would install $macports_version_new (dry run)"
+ } else {
+ ui_msg "$macports::ui_prefix MacPorts base is outdated, installing new version $macports_version_new"
+
+ # get installation user/group and permissions
+ set owner [file attributes $prefix -owner]
+ set group [file attributes $prefix -group]
+ set perms [string range [file attributes $prefix -permissions] end-3 end]
+ if {$tcl_platform(user) ne "root" && $tcl_platform(user) ne $owner} {
+ return -code error "User $tcl_platform(user) does not own $prefix - try using sudo"
+ }
+ ui_debug "Permissions OK"
+
+ set configure_args "--prefix=[macports::shellescape $prefix] --with-install-user=[macports::shellescape $owner] --with-install-group=[macports::shellescape $group] --with-directory-mode=[macports::shellescape $perms]"
+ # too many users have an incompatible readline in /usr/local, see ticket #10651
+ if {$tcl_platform(os) ne "Darwin" || $prefix eq "/usr/local"
+ || ([glob -nocomplain /usr/local/lib/lib{readline,history}*] eq "" && [glob -nocomplain /usr/local/include/readline/*.h] eq "")} {
+ append configure_args " --enable-readline"
+ } else {
+ ui_warn "Disabling readline support due to readline in /usr/local"
+ }
+
+ if {$prefix eq "/usr/local" || $prefix eq "/usr"} {
+ append configure_args " --with-unsupported-prefix"
+ }
+
+ # Choose a sane compiler
+ set cc_arg {}
+ if {$::macports::os_platform eq "darwin"} {
+ set cc_arg "CC=/usr/bin/cc OBJC=/usr/bin/cc "
+ }
+
+ # do the actual configure, build and installation of new base
+ ui_msg "Installing new MacPorts release in $prefix as ${owner}:${group}; permissions ${perms}\n"
+ try {
+ system -W $mp_source_path "${cc_arg}./configure $configure_args && make SELFUPDATING=1 && make install SELFUPDATING=1"
+ } catch {{*} eCode eMessage} {
+ return -code error "Error installing new MacPorts base: $eMessage"
+ }
+ if {[info exists updatestatus]} {
+ set updatestatus yes
+ }
+ }
+ } elseif {$comp < 0} {
+ ui_msg "$macports::ui_prefix MacPorts base is probably trunk or a release candidate"
+ } else {
+ ui_msg "$macports::ui_prefix MacPorts base is already the latest version"
+ }
+
+ # set the MacPorts sources to the right owner
+ set sources_owner [file attributes [file join $portdbpath sources/] -owner]
+ ui_debug "Setting MacPorts sources ownership to $sources_owner"
+ try {
+ exec [macports::findBinary chown $macports::autoconf::chown_path] -R $sources_owner [file join $portdbpath sources/]
+ } catch {{*} eCode eMessage} {
+ return -code error "Couldn't change permissions of the MacPorts sources at $mp_source_path to ${sources_owner}: $eMessage"
+ }
+
+ if {![info exists options(ports_selfupdate_nosync)] || !$options(ports_selfupdate_nosync)} {
+ if {[info exists needed_portindex]} {
+ ui_msg "Not all sources could be fully synced using the old version of MacPorts."
+ ui_msg "Please run selfupdate again now that MacPorts base has been updated."
+ } else {
+ ui_msg "\nThe ports tree has been updated. To upgrade your installed ports, you should run"
+ ui_msg " port upgrade outdated"
+ }
+ }
+
+ return 0
+}
</ins></span></pre></div>
<a id="branchesvcsfetchbasesrcmacports10testslibrarytcl"></a>
<div class="modfile"><h4>Modified: branches/vcs-fetch/base/src/macports1.0/tests/library.tcl (147030 => 147031)</h4>
<pre class="diff"><span>
<span class="info">--- branches/vcs-fetch/base/src/macports1.0/tests/library.tcl        2016-03-23 13:41:22 UTC (rev 147030)
+++ branches/vcs-fetch/base/src/macports1.0/tests/library.tcl        2016-03-23 23:51:56 UTC (rev 147031)
</span><span class="lines">@@ -63,3 +63,26 @@
</span><span class="cx"> # We don't need to handle portinterp_deferred_options, they're
</span><span class="cx"> # automatically handled correctly.
</span><span class="cx"> }
</span><ins>+
+# Set up a custom environment with its own configuration
+proc init_tmp_prefix {srcpath dstpath} {
+ global env
+
+ # use custom macports.conf and sources.conf
+ makeDirectory $dstpath
+ makeDirectory $dstpath/share
+ makeDirectory $dstpath/var/macports/registry
+ makeDirectory $dstpath/var/macports/distfiles
+ set fd [open $dstpath/macports.conf w+]
+ puts $fd "portdbpath $dstpath/var/macports"
+ puts $fd "prefix $dstpath"
+ puts $fd "variants_conf $dstpath/variants.conf"
+ puts $fd "sources_conf $srcpath/sources.conf"
+ puts $fd "applications_dir $dstpath/Applications"
+ puts $fd "frameworks_dir $dstpath/Library/Frameworks"
+ close $fd
+ file link -symbolic $dstpath/share/macports $macports::autoconf::prefix/share/macports
+ close [open $dstpath/variants.conf w+]
+
+ set env(PORTSRC) $dstpath/macports.conf
+}
</ins></span></pre></div>
<a id="branchesvcsfetchbasesrcmacports10testsmacportstest"></a>
<div class="modfile"><h4>Modified: branches/vcs-fetch/base/src/macports1.0/tests/macports.test (147030 => 147031)</h4>
<pre class="diff"><span>
<span class="info">--- branches/vcs-fetch/base/src/macports1.0/tests/macports.test        2016-03-23 13:41:22 UTC (rev 147030)
+++ branches/vcs-fetch/base/src/macports1.0/tests/macports.test        2016-03-23 23:51:56 UTC (rev 147031)
</span><span class="lines">@@ -12,36 +12,21 @@
</span><span class="cx"> testConstraint darwin [expr {$macports::autoconf::os_platform eq "darwin"}]
</span><span class="cx">
</span><span class="cx"> package require macports 1.0
</span><ins>+package require Thread
</ins><span class="cx">
</span><ins>+source ./library.tcl
+
</ins><span class="cx"> # clean leftovers from interrupted tests
</span><span class="cx"> file delete -force $pwd/tmpdir
</span><ins>+# use a local, temporary prefix for testing
+init_tmp_prefix $pwd $pwd/tmpdir
</ins><span class="cx">
</span><del>-# 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+]
-
</del><span class="cx"> # Debug options
</span><span class="cx"> array set ui_options {}
</span><del>-#set ui_options(ports_debug) yes
-#set ui_options(ports_verbose) yes
</del><ins>+set ui_options(ports_noninteractive) yes
</ins><span class="cx"> mportinit ui_options
</span><span class="cx">
</span><del>-package require Thread
-source ./library.tcl
</del><span class="cx">
</span><del>-
</del><span class="cx"> test mportclose {
</span><span class="cx"> Mport close unit test.
</span><span class="cx"> } -setup {
</span><span class="lines">@@ -112,13 +97,6 @@
</span><span class="cx"> if {[macports::init_logging $mport] != 0} {
</span><span class="cx"> return "FAIL: incorrect channels"
</span><span class="cx"> }
</span><del>- if {$macports::channels(any) ne "stdout debuglog"} {
- return "FAIL: incorrect channels(any)"
- }
- if {(![info exists ui_options(ports_debug)] && $macports::channels(debug) ne "debuglog") ||
- ([info exists ui_options(ports_debug)] && $macports::channels(debug) ne "stderr debuglog")} {
- return "FAIL: incorrect channels(debug)"
- }
</del><span class="cx"> return "Init logging successful."
</span><span class="cx"> } -cleanup {
</span><span class="cx"> mportclose $mport
</span><span class="lines">@@ -351,12 +329,19 @@
</span><span class="cx">
</span><span class="cx"> test ui_warn_once {
</span><span class="cx"> UI warn once unit test.
</span><ins>+} -setup {
+ # suppress test warning to avoid noise on terminal output
+ set channel_saved $macports::channels(warn)
+ set macports::channels(warn) {}
</ins><span class="cx"> } -body {
</span><span class="cx"> set res [ui_warn_once 0 test]
</span><ins>+
</ins><span class="cx"> if {$macports::warning_done(0) != 1} {
</span><span class="cx">         return "FAIL: warning flag not set"
</span><span class="cx"> }
</span><span class="cx"> return "UI warn once successful."
</span><ins>+} -cleanup {
+ set macports::channels(warn) $channel_saved
</ins><span class="cx"> } -result "UI warn once successful."
</span><span class="cx">
</span><span class="cx">
</span></span></pre></div>
<a id="branchesvcsfetchbasesrcmacports10testsreclaimtest"></a>
<div class="modfile"><h4>Modified: branches/vcs-fetch/base/src/macports1.0/tests/reclaim.test (147030 => 147031)</h4>
<pre class="diff"><span>
<span class="info">--- branches/vcs-fetch/base/src/macports1.0/tests/reclaim.test        2016-03-23 13:41:22 UTC (rev 147030)
+++ branches/vcs-fetch/base/src/macports1.0/tests/reclaim.test        2016-03-23 23:51:56 UTC (rev 147031)
</span><span class="lines">@@ -9,22 +9,24 @@
</span><span class="cx"> source ../macports_test_autoconf.tcl
</span><span class="cx"> package require macports 1.0
</span><span class="cx">
</span><ins>+source ./library.tcl
+
+# clean leftovers from interrupted tests
+file delete -force $pwd/tmpdir
+# use a local, temporary prefix for testing
+init_tmp_prefix $pwd $pwd/tmpdir
+
</ins><span class="cx"> array set ui_options {}
</span><ins>+set ui_options(ports_noninteractive) yes
</ins><span class="cx"> mportinit ui_options
</span><span class="cx">
</span><ins>+# reclaim nees to be fixed to honor the noninteractive flag
</ins><span class="cx"> test remove_distfiles {
</span><del>-
- # Regression test for remove_distfiles.
- #
- # Constraints:
- # Requires root to run.
-
</del><span class="cx"> Test for distfiles being successfully removed.
</span><del>-
</del><span class="cx"> } -constraints {
</span><span class="cx"> root
</span><ins>+ userInteraction
</ins><span class="cx"> } -body {
</span><del>-
</del><span class="cx"> set path [file join ${macports::portdbpath} distfiles]
</span><span class="cx"> set file [file join $path "test.txt"]
</span><span class="cx">
</span><span class="lines">@@ -38,26 +40,15 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> return "Successfully removed distfile."
</span><del>-
</del><span class="cx"> } -cleanup {
</span><span class="cx"> file delete -force $file
</span><del>-
</del><span class="cx"> } -result "Successfully removed distfile."
</span><span class="cx">
</span><span class="cx"> test update_last_run {
</span><del>-
- # Regression test for update_last_run.
- #
- # Constraints:
- # Requires root to run.
-
</del><span class="cx"> Tests for last_reclaim file being updated.
</span><del>-
</del><span class="cx"> } -constraints {
</span><span class="cx"> root
</span><del>-
</del><span class="cx"> } -body {
</span><del>-
</del><span class="cx"> set path [file join ${macports::portdbpath} last_reclaim]
</span><span class="cx">
</span><span class="cx"> set fd [open $path w]
</span><span class="lines">@@ -83,24 +74,14 @@
</span><span class="cx"> set fd [open $path w]
</span><span class="cx"> puts $fd $old_time
</span><span class="cx"> close $fd
</span><del>-
</del><span class="cx"> } -result "Successfully updated to the correct time."
</span><span class="cx">
</span><span class="cx">
</span><span class="cx"> test walk_files {
</span><del>-
- # Regression test for walk_files.
- #
- # Constraints:
- # Require's root to run.
-
</del><span class="cx"> Tests if walking through the files, and deleting distfiles, ignoring normal files, and removing directory trees works.
</span><del>-
</del><span class="cx"> } -constraints {
</span><span class="cx"> root
</span><del>-
</del><span class="cx"> } -body {
</span><del>-
</del><span class="cx"> set path [file join ${macports::portdbpath} distfiles]
</span><span class="cx"> set dir [file join $path tmp_dir]
</span><span class="cx"> set subdir [file join $dir other_tmp_dir]
</span><span class="lines">@@ -108,6 +89,7 @@
</span><span class="cx"> set bad_dist2 [file join $dir bad_distfile2.txt]
</span><span class="cx"> set good_dist [file join $dir good_distfile.txt]
</span><span class="cx"> set dist_list [list]
</span><ins>+ set unused_list [list]
</ins><span class="cx">
</span><span class="cx"> lappend dist_list $good_dist
</span><span class="cx">
</span><span class="lines">@@ -122,18 +104,24 @@
</span><span class="cx"> set $fd [open $good_dist w]
</span><span class="cx"> close $fd
</span><span class="cx">
</span><del>- reclaim::walk_files $dir yes $dist_list
</del><ins>+ reclaim::walk_files $dir $dist_list unused_list
</ins><span class="cx">
</span><del>- if {[file exists $bad_dist] || [file exists $bad_dist2] || [file exists $subdir] || ![file exists $good_dist] || ![file exists $dir]} {
- return "FAIL: Did not delete the correct files, or deleted files that should not have been deleted."
</del><ins>+ if {[lsearch -exact $unused_list $bad_dist] == -1} {
+ return "FAIL: bad_dist should be deleted"
</ins><span class="cx"> }
</span><ins>+ if {[lsearch -exact $unused_list $bad_dist2] == -1} {
+ return "FAIL: bad_dist2 should be deleted"
+ }
+ if {[lsearch -exact $unused_list $good_dist] != -1} {
+ return "FAIL: good_dist should NOT be deleted"
+ }
+ if {[lsearch -exact $unused_list $dir] != -1} {
+ return "FAIL: good_dist should NOT be deleted"
+ }
</ins><span class="cx">
</span><span class="cx"> return "Successfully deleted all files that needed to be deleted."
</span><del>-
</del><span class="cx"> } -cleanup {
</span><span class="cx"> file delete -force $dir
</span><del>-
</del><span class="cx"> } -result "Successfully deleted all files that needed to be deleted."
</span><span class="cx">
</span><span class="cx"> cleanupTests
</span><del>-
</del></span></pre></div>
<a id="branchesvcsfetchbasesrcportporttcl"></a>
<div class="modfile"><h4>Modified: branches/vcs-fetch/base/src/port/port.tcl (147030 => 147031)</h4>
<pre class="diff"><span>
<span class="info">--- branches/vcs-fetch/base/src/port/port.tcl        2016-03-23 13:41:22 UTC (rev 147030)
+++ branches/vcs-fetch/base/src/port/port.tcl        2016-03-23 23:51:56 UTC (rev 147031)
</span><span class="lines">@@ -18,7 +18,7 @@
</span><span class="cx"> # 3. Neither the name of Apple Inc. nor the names of its contributors
</span><span class="cx"> # may be used to endorse or promote products derived from this software
</span><span class="cx"> # without specific prior written permission.
</span><del>-#
</del><ins>+#
</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">@@ -115,12 +115,12 @@
</span><span class="cx">
</span><span class="cx"> Portnames that contain standard glob characters will be expanded to the
</span><span class="cx"> set of ports matching the glob pattern.
</span><del>-
</del><ins>+
</ins><span class="cx"> Port expressions
</span><span class="cx"> ----------------
</span><span class="cx"> Portnames, port glob patterns, and pseudo-portnames may be logically
</span><span class="cx"> combined using expressions consisting of and, or, not, !, (, and ).
</span><del>-
</del><ins>+
</ins><span class="cx"> For more information
</span><span class="cx"> --------------------
</span><span class="cx"> See man pages: port(1), macports.conf(5), portfile(7), portgroup(7),
</span><span class="lines">@@ -154,58 +154,6 @@
</span><span class="cx"> proc $name {} [list return [expr $args]]
</span><span class="cx"> }
</span><span class="cx">
</span><del>-# Format an integer representing bytes using given units
-proc bytesize {siz {unit {}} {format {%.3f}}} {
- if {$unit == {}} {
- if {$siz > 0x40000000} {
- set unit "GiB"
- } elseif {$siz > 0x100000} {
- set unit "MiB"
- } elseif {$siz > 0x400} {
- set unit "KiB"
- } else {
- set unit "B"
- }
- }
- switch -- $unit {
- KiB {
- set siz [expr {$siz / 1024.0}]
- }
- kB {
- set siz [expr {$siz / 1000.0}]
- }
- MiB {
- set siz [expr {$siz / 1048576.0}]
- }
- MB {
- set siz [expr {$siz / 1000000.0}]
- }
- GiB {
- set siz [expr {$siz / 1073741824.0}]
- }
- GB {
- set siz [expr {$siz / 1000000000.0}]
- }
- B { }
- default {
- ui_warn "Unknown file size unit '$unit' specified"
- set unit "B"
- }
- }
- if {[expr {round($siz)}] != $siz} {
- set siz [format $format $siz]
- }
- return "$siz $unit"
-}
-
-proc filesize {fil {unit {}}} {
- set siz {@}
- catch {
- set siz [bytesize [file size $fil] $unit]
- }
- return $siz
-}
-
</del><span class="cx"> # Produce an error message, and exit, unless
</span><span class="cx"> # we're handling errors in a soft fashion, in which
</span><span class="cx"> # case we continue
</span><span class="lines">@@ -223,7 +171,7 @@
</span><span class="cx"> # we're handling errors in a soft fashion, in which
</span><span class="cx"> # case we continue
</span><span class="cx"> proc break_softcontinue { msg status name_status } {
</span><del>- upvar $name_status status_var
</del><ins>+ upvar $name_status status_var
</ins><span class="cx"> ui_error $msg
</span><span class="cx"> if {[macports::ui_isset ports_processall]} {
</span><span class="cx"> set status_var 0
</span><span class="lines">@@ -245,7 +193,7 @@
</span><span class="cx"> # This function sorts the variants and presents them in a canonical representation
</span><span class="cx"> proc composite_version {version variations {emptyVersionOkay 0}} {
</span><span class="cx"> # Form a composite version out of the version and variations
</span><del>-
</del><ins>+
</ins><span class="cx"> # Select the variations into positive and negative
</span><span class="cx"> set pos {}
</span><span class="cx"> set neg {}
</span><span class="lines">@@ -367,14 +315,14 @@
</span><span class="cx">
</span><span class="cx"> # Form the fully discriminated portname: portname/version_revison+-variants
</span><span class="cx"> set port(fullname) "$port(name)/[composite_version $port(version) $port(variants)]"
</span><del>-
</del><ins>+
</ins><span class="cx"> return [array get port]
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx">
</span><span class="cx"> proc add_to_portlist {listname portentry} {
</span><span class="cx"> upvar $listname portlist
</span><del>-
</del><ins>+
</ins><span class="cx"> # Form portlist entry and add to portlist
</span><span class="cx"> lappend portlist [entry_for_portlist $portentry]
</span><span class="cx"> }
</span><span class="lines">@@ -455,7 +403,7 @@
</span><span class="cx"> proc foreachport {portlist block} {
</span><span class="cx"> set savedir [pwd]
</span><span class="cx"> foreach portspec $portlist {
</span><del>-
</del><ins>+
</ins><span class="cx"> # Set the variables for the block
</span><span class="cx"> uplevel 1 "array unset portspec; array set portspec { $portspec }"
</span><span class="cx"> uplevel 1 {
</span><span class="lines">@@ -469,10 +417,10 @@
</span><span class="cx"> array unset options
</span><span class="cx"> array set options $portspec(options)
</span><span class="cx"> }
</span><del>-
</del><ins>+
</ins><span class="cx"> # Invoke block
</span><span class="cx"> uplevel 1 $block
</span><del>-
</del><ins>+
</ins><span class="cx"> # Restore cwd after each port, since mportopen changes it, and otherwise relative
</span><span class="cx"> # urls would break on subsequent passes
</span><span class="cx"> if {[file exists $savedir]} {
</span><span class="lines">@@ -686,7 +634,7 @@
</span><span class="cx"> foreach m $list {
</span><span class="cx"> if {[string first "@" $m] < 0} {
</span><span class="cx"> if {[string first ":" $m] >= 0} {
</span><del>- set m [regsub -- "(.*):(.*)" $m "\\2@\\1"]
</del><ins>+ set m [regsub -- "(.*):(.*)" $m "\\2@\\1"]
</ins><span class="cx"> } elseif {$m ne "openmaintainer" && $m ne "nomaintainer"} {
</span><span class="cx"> set m "$m@macports.org"
</span><span class="cx"> }
</span><span class="lines">@@ -706,15 +654,15 @@
</span><span class="cx"> foreach {name info} $infos {
</span><span class="cx"> array unset portinfo
</span><span class="cx"> array set portinfo $info
</span><del>-
</del><ins>+
</ins><span class="cx"> set portentry [entry_for_portlist [list url $portinfo(porturl) name $name]]
</span><del>-
</del><ins>+
</ins><span class="cx"> array unset entry
</span><span class="cx"> array set entry $portentry
</span><del>-
</del><ins>+
</ins><span class="cx"> if {[info exists unique($entry(fullname))]} continue
</span><span class="cx"> set unique($entry(fullname)) 1
</span><del>-
</del><ins>+
</ins><span class="cx"> lappend result $portentry
</span><span class="cx"> }
</span><span class="cx"> return $result
</span><span class="lines">@@ -728,7 +676,7 @@
</span><span class="cx"> fatal "search for portname $pattern failed: $result"
</span><span class="cx"> }
</span><span class="cx"> set results [unique_results_to_portlist $res]
</span><del>-
</del><ins>+
</ins><span class="cx"> # Return the list of all ports, sorted
</span><span class="cx"> return [portlist_sort $results]
</span><span class="cx"> }
</span><span class="lines">@@ -891,12 +839,12 @@
</span><span class="cx"> # Get information about latest available version and revision
</span><span class="cx"> set latest_version $portinfo(version)
</span><span class="cx"> set latest_revision 0
</span><del>- if {[info exists portinfo(revision)] && $portinfo(revision) > 0} {
</del><ins>+ if {[info exists portinfo(revision)] && $portinfo(revision) > 0} {
</ins><span class="cx"> set latest_revision $portinfo(revision)
</span><span class="cx"> }
</span><span class="cx"> set latest_compound "${latest_version}_${latest_revision}"
</span><span class="cx"> set latest_epoch 0
</span><del>- if {[info exists portinfo(epoch)]} {
</del><ins>+ if {[info exists portinfo(epoch)]} {
</ins><span class="cx"> set latest_epoch $portinfo(epoch)
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -1108,7 +1056,7 @@
</span><span class="cx"> array unset portinfo
</span><span class="cx"> array set portinfo [lindex $result 1]
</span><span class="cx"> set porturl $portinfo(porturl)
</span><del>-
</del><ins>+
</ins><span class="cx"> # open its portfile
</span><span class="cx"> if {[catch {set mport [mportopen $porturl [list subport $portinfo(name)] [array get global_variations]]} result]} {
</span><span class="cx"> ui_debug "$::errorInfo"
</span><span class="lines">@@ -1198,7 +1146,7 @@
</span><span class="cx">
</span><span class="cx"> proc seqExpr { resname } {
</span><span class="cx"> upvar $resname reslist
</span><del>-
</del><ins>+
</ins><span class="cx"> # Evaluate a sequence of expressions a b c...
</span><span class="cx"> # These act the same as a or b or c
</span><span class="cx">
</span><span class="lines">@@ -1217,14 +1165,14 @@
</span><span class="cx"> set reslist [opUnion $reslist $blist]
</span><span class="cx"> }
</span><span class="cx"> }
</span><del>-
</del><ins>+
</ins><span class="cx"> return $result
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx">
</span><span class="cx"> proc orExpr { resname } {
</span><span class="cx"> upvar $resname reslist
</span><del>-
</del><ins>+
</ins><span class="cx"> set a [andExpr reslist]
</span><span class="cx"> while ($a) {
</span><span class="cx"> switch -- [lookahead] {
</span><span class="lines">@@ -1234,7 +1182,7 @@
</span><span class="cx"> if {![andExpr blist]} {
</span><span class="cx"> return 0
</span><span class="cx"> }
</span><del>-
</del><ins>+
</ins><span class="cx"> # Calculate a union b
</span><span class="cx"> set reslist [opUnion $reslist $blist]
</span><span class="cx"> }
</span><span class="lines">@@ -1243,26 +1191,26 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> }
</span><del>-
</del><ins>+
</ins><span class="cx"> return $a
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx">
</span><span class="cx"> proc andExpr { resname } {
</span><span class="cx"> upvar $resname reslist
</span><del>-
</del><ins>+
</ins><span class="cx"> set a [unaryExpr reslist]
</span><span class="cx"> while {$a} {
</span><span class="cx"> switch -- [lookahead] {
</span><span class="cx"> and {
</span><span class="cx"> advance
</span><del>-
</del><ins>+
</ins><span class="cx"> set blist {}
</span><span class="cx"> set b [unaryExpr blist]
</span><span class="cx"> if {!$b} {
</span><span class="cx"> return 0
</span><span class="cx"> }
</span><del>-
</del><ins>+
</ins><span class="cx"> # Calculate a intersect b
</span><span class="cx"> set reslist [opIntersection $reslist $blist]
</span><span class="cx"> }
</span><span class="lines">@@ -1271,7 +1219,7 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> }
</span><del>-
</del><ins>+
</ins><span class="cx"> return $a
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -1295,7 +1243,7 @@
</span><span class="cx"> set result [element reslist]
</span><span class="cx"> }
</span><span class="cx"> }
</span><del>-
</del><ins>+
</ins><span class="cx"> return $result
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -1303,13 +1251,13 @@
</span><span class="cx"> proc element { resname } {
</span><span class="cx"> upvar $resname reslist
</span><span class="cx"> set el 0
</span><del>-
</del><ins>+
</ins><span class="cx"> set url ""
</span><span class="cx"> set name ""
</span><span class="cx"> set version ""
</span><span class="cx"> array unset requested_variants
</span><span class="cx"> array unset options
</span><del>-
</del><ins>+
</ins><span class="cx"> set token [lookahead]
</span><span class="cx"> switch -regex -- $token {
</span><span class="cx"> ^\\)$ -
</span><span class="lines">@@ -1411,10 +1359,10 @@
</span><span class="cx">
</span><span class="cx"> set recursive [string equal $selector "rdependentof"]
</span><span class="cx"> add_multiple_ports reslist [get_dependent_ports $portname $recursive]
</span><del>-
</del><ins>+
</ins><span class="cx"> set el 1
</span><span class="cx"> }
</span><del>-
</del><ins>+
</ins><span class="cx"> ^depof: -
</span><span class="cx"> ^rdepof: {
</span><span class="cx"> advance
</span><span class="lines">@@ -1424,7 +1372,7 @@
</span><span class="cx">
</span><span class="cx"> set recursive [string equal $selector "rdepof"]
</span><span class="cx"> add_multiple_ports reslist [get_dep_ports $portname $recursive]
</span><del>-
</del><ins>+
</ins><span class="cx"> set el 1
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -1481,12 +1429,12 @@
</span><span class="cx">
</span><span class="cx"> proc add_multiple_ports { resname ports {remainder ""} } {
</span><span class="cx"> upvar $resname reslist
</span><del>-
</del><ins>+
</ins><span class="cx"> set version ""
</span><span class="cx"> array unset variants
</span><span class="cx"> array unset options
</span><span class="cx"> parsePortSpec version variants options $remainder
</span><del>-
</del><ins>+
</ins><span class="cx"> array unset overrides
</span><span class="cx"> if {$version ne ""} { set overrides(version) $version }
</span><span class="cx"> if {[array size variants]} {
</span><span class="lines">@@ -1525,7 +1473,7 @@
</span><span class="cx">
</span><span class="cx"> proc opIntersection { a b } {
</span><span class="cx"> set result {}
</span><del>-
</del><ins>+
</ins><span class="cx"> # Rules we follow in performing the intersection of two port lists:
</span><span class="cx"> #
</span><span class="cx"> # a/, a/ ==> a/
</span><span class="lines">@@ -1536,7 +1484,7 @@
</span><span class="cx"> #
</span><span class="cx"> # If there's an exact match, we take it.
</span><span class="cx"> # If there's a match between simple and discriminated, we take the later.
</span><del>-
</del><ins>+
</ins><span class="cx"> # First create a list of the fully discriminated names in b
</span><span class="cx"> array unset bfull
</span><span class="cx"> set i 0
</span><span class="lines">@@ -1545,14 +1493,14 @@
</span><span class="cx"> set bfull($port(fullname)) $i
</span><span class="cx"> incr i
</span><span class="cx"> }
</span><del>-
</del><ins>+
</ins><span class="cx"> # Walk through each item in a, matching against b
</span><span class="cx"> foreach aitem [unique_entries $a] {
</span><span class="cx"> array set port $aitem
</span><del>-
</del><ins>+
</ins><span class="cx"> # Quote the fullname and portname to avoid special characters messing up the regexp
</span><span class="cx"> set safefullname [regex_pat_sanitize $port(fullname)]
</span><del>-
</del><ins>+
</ins><span class="cx"> set simpleform [expr { "$port(name)/" == $port(fullname) }]
</span><span class="cx"> if {$simpleform} {
</span><span class="cx"> set pat "^${safefullname}"
</span><span class="lines">@@ -1560,7 +1508,7 @@
</span><span class="cx"> set safename [regex_pat_sanitize $port(name)]
</span><span class="cx"> set pat "^${safefullname}$|^${safename}/$"
</span><span class="cx"> }
</span><del>-
</del><ins>+
</ins><span class="cx"> set matches [array names bfull -regexp $pat]
</span><span class="cx"> foreach match $matches {
</span><span class="cx"> if {$simpleform} {
</span><span class="lines">@@ -1571,16 +1519,16 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> }
</span><del>-
</del><ins>+
</ins><span class="cx"> return $result
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx">
</span><span class="cx"> proc opComplement { a b } {
</span><span class="cx"> set result {}
</span><del>-
</del><ins>+
</ins><span class="cx"> # Return all elements of a not matching elements in b
</span><del>-
</del><ins>+
</ins><span class="cx"> # First create a list of the fully discriminated names in b
</span><span class="cx"> array unset bfull
</span><span class="cx"> set i 0
</span><span class="lines">@@ -1589,14 +1537,14 @@
</span><span class="cx"> set bfull($port(fullname)) $i
</span><span class="cx"> incr i
</span><span class="cx"> }
</span><del>-
</del><ins>+
</ins><span class="cx"> # Walk through each item in a, taking all those items that don't match b
</span><span class="cx"> foreach aitem $a {
</span><span class="cx"> array set port $aitem
</span><del>-
</del><ins>+
</ins><span class="cx"> # Quote the fullname and portname to avoid special characters messing up the regexp
</span><span class="cx"> set safefullname [regex_pat_sanitize $port(fullname)]
</span><del>-
</del><ins>+
</ins><span class="cx"> set simpleform [expr { "$port(name)/" == $port(fullname) }]
</span><span class="cx"> if {$simpleform} {
</span><span class="cx"> set pat "^${safefullname}"
</span><span class="lines">@@ -1604,7 +1552,7 @@
</span><span class="cx"> set safename [regex_pat_sanitize $port(name)]
</span><span class="cx"> set pat "^${safefullname}$|^${safename}/$"
</span><span class="cx"> }
</span><del>-
</del><ins>+
</ins><span class="cx"> set matches [array names bfull -regexp $pat]
</span><span class="cx">
</span><span class="cx"> # We copy this element to result only if it didn't match against b
</span><span class="lines">@@ -1612,7 +1560,7 @@
</span><span class="cx"> lappend result $aitem
</span><span class="cx"> }
</span><span class="cx"> }
</span><del>-
</del><ins>+
</ins><span class="cx"> return $result
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -1623,12 +1571,12 @@
</span><span class="cx"> upvar $vername portversion
</span><span class="cx"> upvar $varname portvariants
</span><span class="cx"> upvar $optname portoptions
</span><del>-
</del><ins>+
</ins><span class="cx"> set portname ""
</span><span class="cx"> set portversion ""
</span><span class="cx"> array unset portvariants
</span><span class="cx"> array unset portoptions
</span><del>-
</del><ins>+
</ins><span class="cx"> if { [moreargs] } {
</span><span class="cx"> # Look first for a potential portname
</span><span class="cx"> #
</span><span class="lines">@@ -1641,7 +1589,7 @@
</span><span class="cx"> if {![regexp {^(@|[-+]([[:alpha:]_]+[\w\.]*)|[[:alpha:]_]+[\w\.]*=)} $token match]} {
</span><span class="cx"> advance
</span><span class="cx"> regexp {^([^@]+)(@.*)?} $token match portname remainder
</span><del>-
</del><ins>+
</ins><span class="cx"> # If the portname contains a /, then try to use it as a URL
</span><span class="cx"> if {[string match "*/*" $portname]} {
</span><span class="cx"> set url "file://$portname"
</span><span class="lines">@@ -1662,7 +1610,7 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> }
</span><del>-
</del><ins>+
</ins><span class="cx"> # Now parse the rest of the spec
</span><span class="cx"> parsePortSpec portversion portvariants portoptions $remainder
</span><span class="cx"> }
</span><span class="lines">@@ -1680,25 +1628,25 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-
</del><ins>+
</ins><span class="cx"> proc parsePortSpec { vername varname optname {remainder ""} } {
</span><span class="cx"> upvar $vername portversion
</span><span class="cx"> upvar $varname portvariants
</span><span class="cx"> upvar $optname portoptions
</span><del>-
</del><ins>+
</ins><span class="cx"> global global_options
</span><del>-
</del><ins>+
</ins><span class="cx"> set portversion ""
</span><span class="cx"> array unset portoptions
</span><span class="cx"> array set portoptions [array get global_options]
</span><span class="cx"> array unset portvariants
</span><del>-
</del><ins>+
</ins><span class="cx"> # Parse port version/variants/options
</span><span class="cx"> set opt $remainder
</span><span class="cx"> set adv 0
</span><span class="cx"> set consumed 0
</span><span class="cx"> for {set firstTime 1} {$opt ne "" || [moreargs]} {set firstTime 0} {
</span><del>-
</del><ins>+
</ins><span class="cx"> # Refresh opt as needed
</span><span class="cx"> if {$opt eq ""} {
</span><span class="cx"> if {$adv} advance
</span><span class="lines">@@ -1706,14 +1654,14 @@
</span><span class="cx"> set adv 1
</span><span class="cx"> set consumed 0
</span><span class="cx"> }
</span><del>-
</del><ins>+
</ins><span class="cx"> # Version must be first, if it's there at all
</span><span class="cx"> if {$firstTime && [string match {@*} $opt]} {
</span><span class="cx"> # Parse the version
</span><del>-
</del><ins>+
</ins><span class="cx"> # Strip the @
</span><span class="cx"> set opt [string range $opt 1 end]
</span><del>-
</del><ins>+
</ins><span class="cx"> # Handle the version
</span><span class="cx"> set sepPos [string first "/" $opt]
</span><span class="cx"> if {$sepPos >= 0} {
</span><span class="lines">@@ -1736,7 +1684,7 @@
</span><span class="cx"> set consumed 1
</span><span class="cx"> } else {
</span><span class="cx"> # Parse all other options
</span><del>-
</del><ins>+
</ins><span class="cx"> # Look first for a variable setting: VARNAME=VALUE
</span><span class="cx"> if {[regexp {^([[:alpha:]_]+[\w\.]*)=(.*)} $opt match key val] == 1} {
</span><span class="cx"> # It's a variable setting
</span><span class="lines">@@ -2018,10 +1966,10 @@
</span><span class="cx"> # specified for the port (so we get e.g. dependencies right)
</span><span class="cx"> array unset merged_variations
</span><span class="cx"> array set merged_variations [array get variations]
</span><del>- foreach { variation value } [array get global_variations] {
- if { ![info exists merged_variations($variation)] } {
- set merged_variations($variation) $value
- }
</del><ins>+ foreach { variation value } [array get global_variations] {
+ if { ![info exists merged_variations($variation)] } {
+ set merged_variations($variation) $value
+ }
</ins><span class="cx"> }
</span><span class="cx"> if {![info exists options(subport)]} {
</span><span class="cx"> if {[info exists portinfo(name)]} {
</span><span class="lines">@@ -2030,7 +1978,7 @@
</span><span class="cx"> set options(subport) $portname
</span><span class="cx"> }
</span><span class="cx"> }
</span><del>-
</del><ins>+
</ins><span class="cx"> if {[catch {set mport [mportopen $porturl [array get options] [array get merged_variations]]} result]} {
</span><span class="cx"> ui_debug "$::errorInfo"
</span><span class="cx"> break_softcontinue "Unable to open port: $result" 1 status
</span><span class="lines">@@ -2122,13 +2070,13 @@
</span><span class="cx"> set options(ports_info_depends_run) yes
</span><span class="cx"> set options(ports_info_depends_test) yes
</span><span class="cx"> }
</span><del>-
</del><ins>+
</ins><span class="cx"> # Set up our field separators
</span><span class="cx"> set show_label 1
</span><span class="cx"> set field_sep "\n"
</span><span class="cx"> set subfield_sep ", "
</span><span class="cx"> set pretty_print 0
</span><del>-
</del><ins>+
</ins><span class="cx"> # For human-readable summary, which is the default with no options
</span><span class="cx"> if {[llength [array get options ports_info_*]] == 0} {
</span><span class="cx"> set pretty_print 1
</span><span class="lines">@@ -2145,7 +2093,7 @@
</span><span class="cx"> set field_sep "\t"
</span><span class="cx"> set subfield_sep ","
</span><span class="cx"> }
</span><del>-
</del><ins>+
</ins><span class="cx"> # Figure out whether to show field name
</span><span class="cx"> set quiet [macports::ui_isset ports_quiet]
</span><span class="cx"> if {$quiet} {
</span><span class="lines">@@ -2165,9 +2113,9 @@
</span><span class="cx"> set opts_todo {ports_info_heading
</span><span class="cx"> ports_info_replaced_by
</span><span class="cx"> ports_info_subports
</span><del>- ports_info_variants
</del><ins>+ ports_info_variants
</ins><span class="cx"> ports_info_skip_line
</span><del>- ports_info_long_description ports_info_homepage
</del><ins>+ ports_info_long_description ports_info_homepage
</ins><span class="cx"> ports_info_skip_line ports_info_depends_fetch
</span><span class="cx"> ports_info_depends_extract ports_info_depends_build
</span><span class="cx"> ports_info_depends_lib ports_info_depends_run
</span><span class="lines">@@ -2201,7 +2149,7 @@
</span><span class="cx"> } else {
</span><span class="cx"> # Map from friendly name
</span><span class="cx"> set ropt [map_friendly_field_names $opt]
</span><del>-
</del><ins>+
</ins><span class="cx"> # If there's no such info, move on
</span><span class="cx"> if {![info exists portinfo($ropt)]} {
</span><span class="cx"> set inf ""
</span><span class="lines">@@ -2221,7 +2169,7 @@
</span><span class="cx"> } elseif {$show_label} {
</span><span class="cx"> set label "$opt: "
</span><span class="cx"> }
</span><del>-
</del><ins>+
</ins><span class="cx"> # Format the data
</span><span class="cx"> if { $ropt eq "maintainers" } {
</span><span class="cx"> set inf [unobscure_maintainers $inf]
</span><span class="lines">@@ -2257,7 +2205,7 @@
</span><span class="cx"> }
</span><span class="cx"> lappend inf "$varmodifier$v"
</span><span class="cx"> }
</span><del>- } elseif {[string match "depend*" $ropt]
</del><ins>+ } elseif {[string match "depend*" $ropt]
</ins><span class="cx"> && ![macports::ui_isset ports_verbose]} {
</span><span class="cx"> set pi_deps $inf
</span><span class="cx"> set inf {}
</span><span class="lines">@@ -2265,14 +2213,14 @@
</span><span class="cx"> lappend inf [lindex [split $d :] end]
</span><span class="cx"> }
</span><span class="cx"> }
</span><del>- }
</del><ins>+ }
</ins><span class="cx"> #End of special pretty-print formatting for certain fields
</span><span class="cx"> if {[info exists list_map($ropt)]} {
</span><span class="cx"> set field [join $inf $subfield_sep]
</span><span class="cx"> } else {
</span><span class="cx"> set field $inf
</span><span class="cx"> }
</span><del>-
</del><ins>+
</ins><span class="cx"> # Assemble the entry
</span><span class="cx"> if {$pretty_print} {
</span><span class="cx"> # The two special fields are considered headings and are
</span><span class="lines">@@ -2320,7 +2268,7 @@
</span><span class="cx"> set separator "--\n"
</span><span class="cx"> }
</span><span class="cx"> }
</span><del>-
</del><ins>+
</ins><span class="cx"> return $status
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -2349,7 +2297,7 @@
</span><span class="cx"> ui_notice "Port $portname ${version}_${revision}${variants} is installed as an image in:"
</span><span class="cx"> puts $imagedir
</span><span class="cx"> }
</span><del>-
</del><ins>+
</ins><span class="cx"> return $status
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -2377,15 +2325,15 @@
</span><span class="cx"> array set portinfo [lindex $result 1]
</span><span class="cx"> set porturl $portinfo(porturl)
</span><span class="cx"> }
</span><del>-
</del><ins>+
</ins><span class="cx"> # Add any global_variations to the variations
</span><span class="cx"> # specified for the port
</span><span class="cx"> array unset merged_variations
</span><span class="cx"> array set merged_variations [array get variations]
</span><del>- foreach { variation value } [array get global_variations] {
- if { ![info exists merged_variations($variation)] } {
- set merged_variations($variation) $value
- }
</del><ins>+ foreach { variation value } [array get global_variations] {
+ if { ![info exists merged_variations($variation)] } {
+ set merged_variations($variation) $value
+ }
</ins><span class="cx"> }
</span><span class="cx"> if {![info exists options(subport)]} {
</span><span class="cx"> if {[info exists portinfo(name)]} {
</span><span class="lines">@@ -2457,7 +2405,7 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> registry::close_file_map
</span><del>-
</del><ins>+
</ins><span class="cx"> return 0
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -2489,7 +2437,7 @@
</span><span class="cx"> ui_msg "Skipping activate $portname (dry run)"
</span><span class="cx"> }
</span><span class="cx"> }
</span><del>-
</del><ins>+
</ins><span class="cx"> return $status
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -2526,7 +2474,7 @@
</span><span class="cx"> ui_msg "Skipping deactivate $portname (dry run)"
</span><span class="cx"> }
</span><span class="cx"> }
</span><del>-
</del><ins>+
</ins><span class="cx"> return $status
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -2548,7 +2496,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> set group [lindex $portlist 0]
</span><del>-
</del><ins>+
</ins><span class="cx"> # If no command (--set, --show, --list, --summary) is specified *but*
</span><span class="cx"> # more than one argument is specified, default to the set command.
</span><span class="cx"> if {[llength $commands] < 1 && [llength $portlist] > 1} {
</span><span class="lines">@@ -2710,7 +2658,7 @@
</span><span class="cx"> }
</span><span class="cx"> fatal "port selfupdate failed: $result"
</span><span class="cx"> }
</span><del>-
</del><ins>+
</ins><span class="cx"> if {$base_updated} {
</span><span class="cx"> # exit immediately if in batch/interactive mode
</span><span class="cx"> return -999
</span><span class="lines">@@ -2741,7 +2689,7 @@
</span><span class="cx"> break_softcontinue "$result" 1 status
</span><span class="cx"> }
</span><span class="cx"> }
</span><del>-
</del><ins>+
</ins><span class="cx"> return $status
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -2757,7 +2705,7 @@
</span><span class="cx"> if {[prefix_unwritable]} {
</span><span class="cx"> return 1
</span><span class="cx"> }
</span><del>- macports::reclaim_main
</del><ins>+ macports::reclaim_main
</ins><span class="cx"> return 0
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -2780,7 +2728,7 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> }
</span><del>-
</del><ins>+
</ins><span class="cx"> if {$status != 0 && $status != 2 && $status != 3} {
</span><span class="cx"> print_tickets_url
</span><span class="cx"> } elseif {$status == 0} {
</span><span class="lines">@@ -2857,7 +2805,7 @@
</span><span class="cx"> set irevision [lindex $ilist $index 2]
</span><span class="cx"> set ivariants [lindex $ilist $index 3]
</span><span class="cx"> }
</span><del>-
</del><ins>+
</ins><span class="cx"> set deplist [registry::list_dependents $portname $iversion $irevision $ivariants]
</span><span class="cx"> if { [llength $deplist] > 0 } {
</span><span class="cx"> if {$action eq "rdependents"} {
</span><span class="lines">@@ -2993,10 +2941,10 @@
</span><span class="cx"> # specified for the port, so we get dependencies right
</span><span class="cx"> array unset merged_variations
</span><span class="cx"> array set merged_variations [array get variations]
</span><del>- foreach { variation value } [array get global_variations] {
- if { ![info exists merged_variations($variation)] } {
- set merged_variations($variation) $value
- }
</del><ins>+ foreach { variation value } [array get global_variations] {
+ if { ![info exists merged_variations($variation)] } {
+ set merged_variations($variation) $value
+ }
</ins><span class="cx"> }
</span><span class="cx"> if {![info exists options(subport)]} {
</span><span class="cx"> if {[info exists portinfo(name)]} {
</span><span class="lines">@@ -3071,7 +3019,7 @@
</span><span class="cx"> set depname [lindex [split $dep :] end]
</span><span class="cx"> if {![info exists seen($depname)]} {
</span><span class="cx"> set seen($depname) 1
</span><del>-
</del><ins>+
</ins><span class="cx"> # look up the dep
</span><span class="cx"> if {[catch {mportlookup $depname} result]} {
</span><span class="cx"> ui_debug "$::errorInfo"
</span><span class="lines">@@ -3084,7 +3032,7 @@
</span><span class="cx"> array set portinfo [lindex $result 1]
</span><span class="cx"> set porturl $portinfo(porturl)
</span><span class="cx"> set options(subport) $portinfo(name)
</span><del>-
</del><ins>+
</ins><span class="cx"> # open the portfile if requested
</span><span class="cx"> if {!([info exists options(ports_${action}_index)] && $options(ports_${action}_index) eq "yes")} {
</span><span class="cx"> if {[catch {set mport [mportopen $porturl [array get options] [array get merged_variations]]} result]} {
</span><span class="lines">@@ -3095,7 +3043,7 @@
</span><span class="cx"> array set portinfo [mportinfo $mport]
</span><span class="cx"> mportclose $mport
</span><span class="cx"> }
</span><del>-
</del><ins>+
</ins><span class="cx"> # get list of the dep's deps
</span><span class="cx"> set rdeplist {}
</span><span class="cx"> foreach type $deptypes {
</span><span class="lines">@@ -3222,7 +3170,7 @@
</span><span class="cx"> set status 0
</span><span class="cx"> set restrictedList 0
</span><span class="cx"> set ilist {}
</span><del>-
</del><ins>+
</ins><span class="cx"> if { [llength $portlist] || (![info exists private_options(ports_no_args)] || $private_options(ports_no_args) eq "no")} {
</span><span class="cx"> set restrictedList 1
</span><span class="cx"> foreachport $portlist {
</span><span class="lines">@@ -3270,6 +3218,10 @@
</span><span class="cx"> if {$archs != 0 && $archs ne ""} {
</span><span class="cx"> append extra " archs='$archs'"
</span><span class="cx"> }
</span><ins>+ set date [registry::property_retrieve $regref date]
+ if {$date ne ""} {
+ append extra " date='[clock format $date -format "%Y-%m-%d %T"]'"
+ }
</ins><span class="cx"> }
</span><span class="cx"> if { $iactive == 0 } {
</span><span class="cx"> puts " $iname @${iversion}_${irevision}${ivariants}${nvariants}${extra}"
</span><span class="lines">@@ -3322,7 +3274,7 @@
</span><span class="cx"> set num_outdated 0
</span><span class="cx"> if { [llength $ilist] > 0 } {
</span><span class="cx"> foreach i [portlist_sortint $ilist] {
</span><del>-
</del><ins>+
</ins><span class="cx"> # Get information about the installed port
</span><span class="cx"> set portname [lindex $i 0]
</span><span class="cx"> set installed_version [lindex $i 1]
</span><span class="lines">@@ -3349,7 +3301,7 @@
</span><span class="cx"> }
</span><span class="cx"> array unset portinfo
</span><span class="cx"> array set portinfo [lindex $res 1]
</span><del>-
</del><ins>+
</ins><span class="cx"> # Get information about latest available version and revision
</span><span class="cx"> if {![info exists portinfo(version)]} {
</span><span class="cx"> ui_warn "$portname has no version field"
</span><span class="lines">@@ -3357,15 +3309,15 @@
</span><span class="cx"> }
</span><span class="cx"> set latest_version $portinfo(version)
</span><span class="cx"> set latest_revision 0
</span><del>- if {[info exists portinfo(revision)] && $portinfo(revision) > 0} {
</del><ins>+ if {[info exists portinfo(revision)] && $portinfo(revision) > 0} {
</ins><span class="cx"> set latest_revision $portinfo(revision)
</span><span class="cx"> }
</span><span class="cx"> set latest_compound "${latest_version}_${latest_revision}"
</span><span class="cx"> set latest_epoch 0
</span><del>- if {[info exists portinfo(epoch)]} {
</del><ins>+ if {[info exists portinfo(epoch)]} {
</ins><span class="cx"> set latest_epoch $portinfo(epoch)
</span><span class="cx"> }
</span><del>-
</del><ins>+
</ins><span class="cx"> # Compare versions, first checking epoch, then version, then revision
</span><span class="cx"> set epoch_comp_result [expr {$installed_epoch - $latest_epoch}]
</span><span class="cx"> set comp_result [vercmp $installed_version $latest_version]
</span><span class="lines">@@ -3389,10 +3341,10 @@
</span><span class="cx"> set reason { (platform $os_platform_installed $os_major_installed != ${macports::os_platform} ${macports::os_major})}
</span><span class="cx"> }
</span><span class="cx"> }
</span><del>-
</del><ins>+
</ins><span class="cx"> # Report outdated (or, for verbose, predated) versions
</span><span class="cx"> if { $comp_result != 0 } {
</span><del>-
</del><ins>+
</ins><span class="cx"> # Form a relation between the versions
</span><span class="cx"> set flag ""
</span><span class="cx"> if { $comp_result > 0 } {
</span><span class="lines">@@ -3401,10 +3353,10 @@
</span><span class="cx"> } else {
</span><span class="cx"> set relation "<"
</span><span class="cx"> }
</span><del>-
</del><ins>+
</ins><span class="cx"> # Emit information
</span><span class="cx"> if {$comp_result < 0 || [macports::ui_isset ports_verbose]} {
</span><del>-
</del><ins>+
</ins><span class="cx"> if {$num_outdated == 0} {
</span><span class="cx"> ui_notice "The following installed ports are outdated:"
</span><span class="cx"> }
</span><span class="lines">@@ -3412,10 +3364,10 @@
</span><span class="cx">
</span><span class="cx"> puts [format "%-30s %-24s %1s" $portname "$installed_compound $relation $latest_compound [subst $reason]" $flag]
</span><span class="cx"> }
</span><del>-
</del><ins>+
</ins><span class="cx"> }
</span><span class="cx"> }
</span><del>-
</del><ins>+
</ins><span class="cx"> if {$num_outdated == 0} {
</span><span class="cx"> ui_notice "No installed ports are outdated."
</span><span class="cx"> }
</span><span class="lines">@@ -3424,7 +3376,7 @@
</span><span class="cx"> } else {
</span><span class="cx"> ui_notice "No ports are installed."
</span><span class="cx"> }
</span><del>-
</del><ins>+
</ins><span class="cx"> return $status
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -3805,12 +3757,12 @@
</span><span class="cx"> proc action_list { action portlist opts } {
</span><span class="cx"> global private_options
</span><span class="cx"> set status 0
</span><del>-
</del><ins>+
</ins><span class="cx"> # Default to list all ports if no portnames are supplied
</span><span class="cx"> if { ![llength $portlist] && [info exists private_options(ports_no_args)] && $private_options(ports_no_args) eq "yes"} {
</span><span class="cx"> add_to_portlist portlist [list name "-all-"]
</span><span class="cx"> }
</span><del>-
</del><ins>+
</ins><span class="cx"> foreachport $portlist {
</span><span class="cx"> if {$portname eq "-all-"} {
</span><span class="cx"> if {[catch {set res [mportlistall]} result]} {
</span><span class="lines">@@ -3841,7 +3793,7 @@
</span><span class="cx"> puts [format "%-30s @%-14s %s" $portinfo(name) $portinfo(version) $outdir]
</span><span class="cx"> }
</span><span class="cx"> }
</span><del>-
</del><ins>+
</ins><span class="cx"> return $status
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -3880,7 +3832,7 @@
</span><span class="cx"> global env boot_env current_portdir
</span><span class="cx">
</span><span class="cx"> array set local_options $opts
</span><del>-
</del><ins>+
</ins><span class="cx"> set status 0
</span><span class="cx"> if {[require_portlist portlist]} {
</span><span class="cx"> return 1
</span><span class="lines">@@ -3889,7 +3841,7 @@
</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><span class="cx"> if {$porturl eq ""} {
</span><del>-
</del><ins>+
</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">@@ -3903,13 +3855,13 @@
</span><span class="cx"> set porturl $portinfo(porturl)
</span><span class="cx"> set portname $portinfo(name)
</span><span class="cx"> }
</span><del>-
-
</del><ins>+
+
</ins><span class="cx"> # Calculate portdir, porturl, and portfile from initial porturl
</span><span class="cx"> set portdir [file normalize [macports::getportdir $porturl]]
</span><span class="cx"> set porturl "file://${portdir}"; # Rebuild url so it's fully qualified
</span><span class="cx"> set portfile "${portdir}/Portfile"
</span><del>-
</del><ins>+
</ins><span class="cx"> # Now execute the specific action
</span><span class="cx"> if {[file readable $portfile]} {
</span><span class="cx"> switch -- $action {
</span><span class="lines">@@ -3921,17 +3873,17 @@
</span><span class="cx"> }
</span><span class="cx"> close $f
</span><span class="cx"> }
</span><del>-
</del><ins>+
</ins><span class="cx"> edit {
</span><span class="cx"> # Edit the port's portfile with the user's editor
</span><del>-
</del><ins>+
</ins><span class="cx"> # Restore our entire environment from start time.
</span><span class="cx"> # We need it to evaluate the editor, and the editor
</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><span class="cx"> array set env [array get boot_env]
</span><del>-
</del><ins>+
</ins><span class="cx"> # Find an editor to edit the portfile
</span><span class="cx"> set editor ""
</span><span class="cx"> set editor_var "ports_${action}_editor"
</span><span class="lines">@@ -3945,17 +3897,17 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> }
</span><del>-
</del><ins>+
</ins><span class="cx"> # Use a reasonable canned default if no editor specified or set in env
</span><span class="cx"> if { $editor eq "" } { set editor "/usr/bin/vi" }
</span><del>-
</del><ins>+
</ins><span class="cx"> # Invoke the editor
</span><span class="cx"> if {[catch {exec -ignorestderr >@stdout <@stdin {*}$editor $portfile} result]} {
</span><span class="cx"> global errorInfo
</span><span class="cx"> ui_debug "$errorInfo"
</span><span class="cx"> break_softcontinue "unable to invoke editor $editor: $result" 1 status
</span><span class="cx"> }
</span><del>-
</del><ins>+
</ins><span class="cx"> # Restore internal MacPorts environment
</span><span class="cx"> array unset env *
</span><span class="cx"> array set env [array get env_save]
</span><span class="lines">@@ -4032,7 +3984,7 @@
</span><span class="cx"> break_softcontinue "Could not read $portfile" 1 status
</span><span class="cx"> }
</span><span class="cx"> }
</span><del>-
</del><ins>+
</ins><span class="cx"> return $status
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -4047,7 +3999,7 @@
</span><span class="cx"> ui_msg "port sync failed: $result"
</span><span class="cx"> set status 1
</span><span class="cx"> }
</span><del>-
</del><ins>+
</ins><span class="cx"> return $status
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -4136,14 +4088,14 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> mportclose $workername
</span><del>-
</del><ins>+
</ins><span class="cx"> # Process any error that wasn't thrown and handled already
</span><span class="cx"> if {$result} {
</span><span class="cx"> print_tickets_url
</span><span class="cx"> break_softcontinue "Processing of port $portname failed" 1 status
</span><span class="cx"> }
</span><span class="cx"> }
</span><del>-
</del><ins>+
</ins><span class="cx"> if {$status == 0 && $action eq "install" && ![macports::global_option_isset ports_dryrun]} {
</span><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="lines">@@ -4316,7 +4268,7 @@
</span><span class="cx"> # Returns an action proc, or a list of matching action procs, or the action passed in
</span><span class="cx"> proc find_action { action } {
</span><span class="cx"> global action_array
</span><del>-
</del><ins>+
</ins><span class="cx"> if { ! [info exists action_array($action)] } {
</span><span class="cx"> set guess [guess_action $action]
</span><span class="cx"> if { [info exists action_array($guess)] } {
</span><span class="lines">@@ -4324,7 +4276,7 @@
</span><span class="cx"> }
</span><span class="cx"> return $guess
</span><span class="cx"> }
</span><del>-
</del><ins>+
</ins><span class="cx"> return $action
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -4332,7 +4284,7 @@
</span><span class="cx"> # If there's more than one match, return the next possibility
</span><span class="cx"> proc find_action_proc { action } {
</span><span class="cx"> global action_array
</span><del>-
</del><ins>+
</ins><span class="cx"> set action_proc ""
</span><span class="cx"> if { [info exists action_array($action)] } {
</span><span class="cx"> set action_proc [lindex $action_array($action) 0]
</span><span class="lines">@@ -4342,18 +4294,18 @@
</span><span class="cx"> set action_proc [lindex $action_array($action) 0]
</span><span class="cx"> }
</span><span class="cx"> }
</span><del>-
</del><ins>+
</ins><span class="cx"> return $action_proc
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> proc get_action_proc { action } {
</span><span class="cx"> global action_array
</span><del>-
</del><ins>+
</ins><span class="cx"> set action_proc ""
</span><span class="cx"> if { [info exists action_array($action)] } {
</span><span class="cx"> set action_proc [lindex $action_array($action) 0]
</span><span class="cx"> }
</span><del>-
</del><ins>+
</ins><span class="cx"> return $action_proc
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -4464,10 +4416,10 @@
</span><span class="cx"> upvar $ui_options_name ui_options
</span><span class="cx"> upvar $global_options_name global_options
</span><span class="cx"> global cmdname cmd_opts_array
</span><del>-
</del><ins>+
</ins><span class="cx"> while {[moreargs]} {
</span><span class="cx"> set arg [lookahead]
</span><del>-
</del><ins>+
</ins><span class="cx"> if {[string index $arg 0] ne "-"} {
</span><span class="cx"> break
</span><span class="cx"> } elseif {[string index $arg 1] eq "-"} {
</span><span class="lines">@@ -4528,7 +4480,7 @@
</span><span class="cx"> # Ignore errors while processing within a command
</span><span class="cx"> set ui_options(ports_processall) yes
</span><span class="cx"> }
</span><del>- N {
</del><ins>+ N {
</ins><span class="cx"> # Interactive mode is available or not
</span><span class="cx"> set ui_options(ports_noninteractive) yes
</span><span class="cx"> }
</span><span class="lines">@@ -4623,26 +4575,34 @@
</span><span class="cx"> while {($action_status == 0 || [macports::ui_isset ports_processall]) && [moreargs]} {
</span><span class="cx"> set action [lookahead]
</span><span class="cx"> advance
</span><del>-
</del><ins>+
</ins><span class="cx"> # Handle command separator
</span><span class="cx"> if { $action == ";" } {
</span><span class="cx"> continue
</span><span class="cx"> }
</span><del>-
</del><ins>+
</ins><span class="cx"> # Handle a comment
</span><span class="cx"> if { [string index $action 0] == "#" } {
</span><span class="cx"> while { [moreargs] } { advance }
</span><span class="cx"> break
</span><span class="cx"> }
</span><span class="cx">
</span><del>- set locked [lock_reg_if_needed $action]
</del><ins>+ try {
+ set locked [lock_reg_if_needed $action]
+ } catch {{POSIX SIG SIGINT} eCode eMessage} {
+ set action_status 1
+ break
+ } catch {{POSIX SIG SIGTERM} eCode eMessage} {
+ set action_status 1
+ break
+ }
</ins><span class="cx"> # Always start out processing an action in current_portdir
</span><span class="cx"> cd $current_portdir
</span><del>-
</del><ins>+
</ins><span class="cx"> # Reset global_options from base before each action, as we munge it just below...
</span><span class="cx"> array unset global_options
</span><span class="cx"> array set global_options $global_options_base
</span><del>-
</del><ins>+
</ins><span class="cx"> # Find an action to execute
</span><span class="cx"> set actions [find_action $action]
</span><span class="cx"> if {[llength $actions] == 1} {
</span><span class="lines">@@ -4711,7 +4671,7 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> }
</span><del>-
</del><ins>+
</ins><span class="cx"> # execute the action
</span><span class="cx"> set action_status [$action_proc $action $portlist [array get global_options]]
</span><span class="cx">
</span><span class="lines">@@ -4726,14 +4686,14 @@
</span><span class="cx"> # semaphore to exit
</span><span class="cx"> if {$action_status == -999} break
</span><span class="cx"> }
</span><del>-
</del><ins>+
</ins><span class="cx"> return $action_status
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx">
</span><del>-proc complete_portname { text state } {
</del><ins>+proc complete_portname { text state } {
</ins><span class="cx"> global complete_choices complete_position
</span><del>-
</del><ins>+
</ins><span class="cx"> if {$state == 0} {
</span><span class="cx"> set complete_position 0
</span><span class="cx"> set complete_choices {}
</span><span class="lines">@@ -4748,16 +4708,16 @@
</span><span class="cx"> lappend complete_choices $name
</span><span class="cx"> }
</span><span class="cx"> }
</span><del>-
</del><ins>+
</ins><span class="cx"> set word [lindex $complete_choices $complete_position]
</span><span class="cx"> incr complete_position
</span><del>-
</del><ins>+
</ins><span class="cx"> return $word
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx">
</span><span class="cx"> # return text action beginning with $text
</span><del>-proc complete_action { text state } {
</del><ins>+proc complete_action { text state } {
</ins><span class="cx"> global action_array complete_choices complete_position
</span><span class="cx">
</span><span class="cx"> if {$state == 0} {
</span><span class="lines">@@ -4772,7 +4732,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> # return all actions beginning with $text
</span><del>-proc guess_action { text } {
</del><ins>+proc guess_action { text } {
</ins><span class="cx"> global action_array
</span><span class="cx">
</span><span class="cx"> return [array names action_array "[string tolower $text]*"]
</span><span class="lines">@@ -4793,14 +4753,14 @@
</span><span class="cx">
</span><span class="cx"> # Decide how to do completion based on where we are in the string
</span><span class="cx"> set prefix [string range $text 0 [expr {$start - 1}]]
</span><del>-
</del><ins>+
</ins><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="cx"> # an action (the first word of a command)
</span><span class="cx"> if { [regexp {(^\s*$)|(;\s*$)} $prefix] } {
</span><span class="cx"> return complete_action
</span><span class="cx"> }
</span><del>-
</del><ins>+
</ins><span class="cx"> # Otherwise, do completion on portname
</span><span class="cx"> return complete_portname
</span><span class="cx"> }
</span><span class="lines">@@ -4808,7 +4768,7 @@
</span><span class="cx">
</span><span class="cx"> proc get_next_cmdline { in out use_readline prompt linename } {
</span><span class="cx"> upvar $linename line
</span><del>-
</del><ins>+
</ins><span class="cx"> set line ""
</span><span class="cx"> while { $line eq "" } {
</span><span class="cx">
</span><span class="lines">@@ -4823,14 +4783,14 @@
</span><span class="cx"> if { $len < 0 } {
</span><span class="cx"> return -1
</span><span class="cx"> }
</span><del>-
</del><ins>+
</ins><span class="cx"> set line [string trim $line]
</span><span class="cx">
</span><span class="cx"> if { $use_readline && $line ne "" } {
</span><span class="cx"> rl_history add $line
</span><span class="cx"> }
</span><span class="cx"> }
</span><del>-
</del><ins>+
</ins><span class="cx"> return [llength $line]
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -4877,7 +4837,7 @@
</span><span class="cx">
</span><span class="cx"> # Process the command
</span><span class="cx"> set exit_status [process_cmd $line]
</span><del>-
</del><ins>+
</ins><span class="cx"> # Check for semaphore to exit
</span><span class="cx"> if {$exit_status == -999} {
</span><span class="cx"> set exit_status 0
</span><span class="lines">@@ -5322,203 +5282,320 @@
</span><span class="cx">
</span><span class="cx"> # Create namespace for questions
</span><span class="cx"> namespace eval portclient::questions {
</span><del>-        
-        package require Tclx
-        ##
-        # Function that handles printing of a timeout.
-        #
-        # @param time
-        # The amount of time for which a timeout is to occur.
-        # @param def
-        # The default action to be taken in the occurence of a timeout.
-        proc ui_timeout {def timeout} {
-                fconfigure stdin -blocking 0
</del><span class="cx">
</span><del>-                signal error {TERM INT}
-                while {$timeout >= 0} {
-                        if {[catch {set inp [read stdin]} err]} {
-                                return -code error "Ctrl-C"
-                        }
-                        if {$inp eq "\n"} {
-                                return $def
-                        }
-                        puts -nonewline "\r"
-                        puts -nonewline [format "Continuing in %02d s. Press Ctrl-C to exit: " $timeout]
-                        flush stdout
-                        after 1000
-                        incr timeout -1
-                }
-                puts ""
-                fconfigure stdin -blocking 1
-                signal -restart error {TERM INT}
-                return $def
-        }
-        
-        ##
-        # Main function that displays numbered choices for a multiple choice question.
-        #
-        # @param msg
-        # The question specific message that is to be printed before asking the question.
-        # @param ???name???
-        # May be a qid will be of better use instead as the client does not do anything port specific.
-        # @param ports
-        # The list of ports for which the question is being asked.
-        proc ui_choice {msg name ports} {
-                # Print the main message
-                puts $msg
-                
-                # Print portname or port list suitably
-                set i 1
-                foreach port $ports {
-                        puts -nonewline " $i) "
-                        puts [string map {@ " @" ( " ("} $port]
-                        incr i
-                }
-        }
-        
-        ##
-        # Displays a question with 'yes' and 'no' as options.
-        # Waits for user input indefinitely unless a timeout is specified.
-        # Shows the list of port passed to it without any numbers.
-        #
-        # @param msg
-        # The question specific message that is to be printed before asking the question.
-        # @param ???name???
-        # May be a qid will be of better use instead as the client does not do anything port specific.
-        # @param ports
-        # The port/list of ports for which the question is being asked.
-        # @param def
-        # The default answer to the question.
-        # @param time
-        #                  The amount of time for which a timeout is to occur.
-        proc ui_ask_yesno {msg name ports def {timeout 0}} {
-                # Set number default to the given letter default
-                if {$def == {y}} {
-                        set default 0
-                } else {
-                        set default 1
-                }
-                
-                puts -nonewline $msg
-                set leftmargin " "
-                
-                # Print portname or port list suitably
-                if {[llength $ports] == 1} {
-                        puts -nonewline " "
-                        puts [string map {@ " @"} $ports]
-                } else {
-                        puts ""
-                        foreach port $ports {
-                                puts -nonewline $leftmargin
-                                puts [string map {@ " @"} $port]
-                        }
-                }
-                
-                # Check if timeout is set or not
-                if {$timeout > 0} {
-                        # Run ui_timeout and skip the rest of the stuff here
-                        return [ui_timeout $default $timeout]
-                }
-                                
-                # Check for the default and print accordingly
-                if {$def == {y}} {
-                        puts -nonewline "Continue? \[Y/n\]: "
-                        flush stdout
-                } else {
-                        puts -nonewline "Continue? \[y/N\]: "
-                        flush stdout
-                }
-                
-                # User input (probably requires some input error checking code)
-                while 1 {
-                        signal error {TERM INT}
-                        if {[catch {set input [gets stdin]} err]} {
-                                return -code error "Ctrl-C"
-                        }
-                        signal -restart error {TERM INT}
-                        if {$input in {y Y}} {
-                                return 0
-                        } elseif {$input in {n N}} {
-                                return 1
-                        } elseif {$input == ""} {
-                                return $default
-                        } else {
-                                puts "Please enter either 'y' or 'n'."
-                        }
-                }
-        }
-        
-        ##
-        # Displays a question with a list of numbered choices and asks the user to enter a number to specify their choice.
-        # Waits for user input indefinitely.
-        #
-        # @param msg
-        # The question specific message that is to be printed before asking the question.
-        # @param ???name???
-        # May be a qid will be of better use instead as the client does not do anything port specific.
-        # @param ports
-        # The port/list of ports for which the question is being asked.
-        proc ui_ask_singlechoice {msg name ports} {
-                ui_choice $msg $name $ports
-                                
-                # User Input (single input restriction)
-                while 1 {
-                        puts -nonewline "Enter a number to select an option: "
-                        flush stdout
-                        signal error {TERM INT}
-                        if {[catch {set input [gets stdin]} err]} {
-                                return -code error "Ctrl-C"
-                        }
-                        signal -restart error {TERM INT}
-                        if {($input <= [llength $ports] && [string is integer -strict $input])} {
-                                return $input
-                        } else {
-                                puts "Please enter an index from the above list."
-                        }
-                }
-        }
-        
-        ##
-        # Displays a question with a list of numbered choices and asks the user to enter a space separated string of numbers to specify their choice.
-        # Waits for user input indefinitely.
-        #
-        # @param msg
-        # The question specific message that is to be printed before asking the question.
-        # @param ???name???
-        # May be a qid will be of better use instead as the client does not do anything port specific.
-        # @param ports
-        # The list of ports for which the question is being asked.
-        proc ui_ask_multichoice {msg name ports} {
-                
-                ui_choice $msg $name $ports
-                                
-                # User Input (with Multiple input parsing)
-                while 1 {
-                        puts -nonewline "Enter the numbers to select the options: "
-                        flush stdout
-                        signal error {TERM INT}
-                        if {[catch {set input [gets stdin]} err]} {
-                                return -code error "Ctrl-C"
-                        }
-                        signal -restart error {TERM INT}
-                        set count 0
-                        # check if input is non-empty and otherwise fine
-                        if {$input == ""} {
-                                continue
-                        }
-                        foreach num $input {
-                                if {($num <= [llength $ports] && [string is integer -strict $num])} {
-                                        incr count
-                                } else {
-                                        puts "Please enter numbers separated by a space which are indices from the above list."
-                                        break
-                                }
-                        }
-                        if {$count == [llength $input]} {
-                                return $input
-                        }
-                }
-        }
</del><ins>+ package require Tclx
+ ##
+ # Function that handles printing of a timeout.
+ #
+ # @param time
+ # The amount of time for which a timeout is to occur.
+ # @param def
+ # The default action to be taken in the occurence of a timeout.
+ proc ui_timeout {def timeout} {
+ fconfigure stdin -blocking 0
+
+ signal error {TERM INT}
+ while {$timeout >= 0} {
+ try {
+ set inp [read stdin]
+ } catch {*} {
+ # An error occurred, print a newline so the error message
+ # doesn't occur on the prompt line and re-throw
+ puts ""
+ throw
+ }
+ if {$inp eq "\n"} {
+ return $def
+ }
+ puts -nonewline "\r"
+ puts -nonewline [format "Continuing in %02d s. Press Ctrl-C to exit: " $timeout]
+ flush stdout
+ after 1000
+ incr timeout -1
+ }
+ puts ""
+ fconfigure stdin -blocking 1
+ signal -restart error {TERM INT}
+ return $def
+ }
+
+ ##
+ # Main function that displays numbered choices for a multiple choice question.
+ #
+ # @param msg
+ # The question specific message that is to be printed before asking the question.
+ # @param ???name???
+ # May be a qid will be of better use instead as the client does not do anything port specific.
+ # @param ports
+ # The list of ports for which the question is being asked.
+ proc ui_choice {msg name ports} {
+ # Print the main message
+ puts $msg
+
+ # Print portname or port list suitably
+ set i 1
+ foreach port $ports {
+ puts -nonewline " $i) "
+ puts [string map {@ " @" ( " ("} $port]
+ incr i
+ }
+ }
+
+ ##
+ # Displays a question with 'yes' and 'no' as options.
+ # Waits for user input indefinitely unless a timeout is specified.
+ # Shows the list of port passed to it without any numbers.
+ #
+ # @param msg
+ # The question specific message that is to be printed before asking the question.
+ # @param ???name???
+ # May be a qid will be of better use instead as the client does not do anything port specific.
+ # @param ports
+ # The port/list of ports for which the question is being asked.
+ # @param def
+ # The default answer to the question.
+ # @param timeout
+ # The amount of time for which a timeout is to occur.
+ # @param question
+ # Custom question message. Defaults to "Continue?".
+ proc ui_ask_yesno {msg name ports def {timeout 0} {question "Continue?"}} {
+ # Set number default to the given letter default
+ if {$def == {y}} {
+ set default 0
+ } else {
+ set default 1
+ }
+
+ puts -nonewline $msg
+ set leftmargin " "
+
+ # Print portname or port list suitably
+ if {[llength $ports] == 1} {
+ puts -nonewline " "
+ puts [string map {@ " @"} $ports]
+ } elseif {[llength $ports] == 0} {
+ puts -nonewline " "
+ } else {
+ puts ""
+ foreach port $ports {
+ puts -nonewline $leftmargin
+ puts [string map {@ " @"} $port]
+ }
+ }
+
+ # Check if timeout is set or not
+ if {$timeout > 0} {
+ # Run ui_timeout and skip the rest of the stuff here
+ return [ui_timeout $default $timeout]
+ }
+
+ # Check for the default and print accordingly
+ if {$def == {y}} {
+ puts -nonewline "${question} \[Y/n\]: "
+ flush stdout
+ } else {
+ puts -nonewline "${question} \[y/N\]: "
+ flush stdout
+ }
+
+ # User input (probably requires some input error checking code)
+ while 1 {
+ signal error {TERM INT}
+ try {
+ set input [gets stdin]
+ } catch {*} {
+ # An error occurred, print a newline so the error message
+ # doesn't occur on the prompt line and re-throw
+ puts ""
+ throw
+ }
+ signal -restart error {TERM INT}
+ if {$input in {y Y}} {
+ return 0
+ } elseif {$input in {n N}} {
+ return 1
+ } elseif {$input == ""} {
+ return $default
+ } else {
+ puts "Please enter either 'y' or 'n'."
+ }
+ }
+ }
+
+ ##
+ # Displays a question with a list of numbered choices and asks the user to enter a number to specify their choice.
+ # Waits for user input indefinitely.
+ #
+ # @param msg
+ # The question specific message that is to be printed before asking the question.
+ # @param ???name???
+ # May be a qid will be of better use instead as the client does not do anything port specific.
+ # @param ports
+ # The port/list of ports for which the question is being asked.
+ proc ui_ask_singlechoice {msg name ports} {
+ ui_choice $msg $name $ports
+
+ # User Input (single input restriction)
+ while 1 {
+ puts -nonewline "Enter a number to select an option: "
+ flush stdout
+ signal error {TERM INT}
+ try {
+ set input [gets stdin]
+ } catch {*} {
+ # An error occurred, print a newline so the error message
+ # doesn't occur on the prompt line and re-throw
+ puts ""
+ throw
+ }
+ signal -restart error {TERM INT}
+ if {($input <= [llength $ports] && [string is integer -strict $input])} {
+ return [expr {$input - 1}]
+ } else {
+ puts "Please enter an index from the above list."
+ }
+ }
+ }
+
+ ##
+ # Displays a question with a list of numbered choices and asks the user to enter a space separated string of numbers to specify their choice.
+ # Waits for user input indefinitely.
+ #
+ # @param msg
+ # The question specific message that is to be printed before asking the question.
+ # @param ???name???
+ # May be a qid will be of better use instead as the client does not do anything port specific.
+ # @param ports
+ # The list of ports for which the question is being asked.
+ proc ui_ask_multichoice {msg name ports} {
+
+ ui_choice $msg $name $ports
+
+ # User Input (with Multiple input parsing)
+ while 1 {
+ if {[llength $ports] > 1} {
+ set option_range "1-[llength $ports]"
+ } else {
+ set option_range "1"
+ }
+ puts -nonewline "Enter option(s) \[$option_range/all\]: "
+ flush stdout
+ signal error {TERM INT}
+ try {
+ set input [gets stdin]
+ } catch {*} {
+ # An error occurred, print a newline so the error message
+ # doesn't occur on the prompt line and re-throw
+ puts ""
+ throw
+ }
+ signal -restart error {TERM INT}
+ # check if input is non-empty and otherwise fine
+ if {$input == ""} {
+ return []
+ }
+
+ if {[string equal -nocase $input "all"]} {
+ set count 0
+ set options_seq []
+ foreach port $ports {
+ lappend options_seq $count
+ incr count
+ }
+ return $options_seq
+ }
+
+ if {[llength $input] > [llength $ports]} {
+ puts "Extra indices present. Please enter option(s) only once."
+ continue
+ }
+
+ set selected_opt []
+
+ set err_flag 1
+ foreach num $input {
+ if {[string is integer -strict $num] && $num <= [llength $ports] && $num > 0} {
+ lappend selected_opt [expr {$num -1}]
+ } elseif {[regexp {(\d+)-(\d+)} $input _ start end]
+ && $start <= [llength $ports]
+ && $start > 0
+ && $end <= [llength $ports]
+ && $end > 0
+ } then {
+ if {$start > $end} {
+ set tmp $start
+ set start $end
+ set end $tmp
+ }
+ for {set x $start} {$x <= $end} {incr x} {
+ lappend selected_opt [expr {$x -1}]
+ }
+ } else {
+ puts "Please enter numbers separated by a space which are indices from the above list."
+ set err_flag 0
+ break
+ }
+ }
+ if {$err_flag == 1} {
+ return $selected_opt
+ }
+ }
+ }
+
+ ##
+ # Displays alternative actions a user has to select by typing the text
+ # within the square brackets of the desired action name.
+ # Waits for user input indefinitely.
+ #
+ # @param msg
+ # The question specific message that is to be printed before asking the question.
+ # @param ???name???
+ # May be a qid will be of better use instead as the client does not do anything port specific.
+ # @param alts
+ # An array of action-text.
+ # @param def
+ # The default action. If empty, the first action is set as default
+ proc ui_ask_alternative {msg name alts def} {
+ puts $msg
+ upvar $alts alternatives
+
+ if {$def eq ""} {
+ # Default to first action
+ set def [lindex [array names alternatives] 0]
+ }
+
+ set alt_names []
+ foreach key [array names alternatives] {
+ set key_match [string first $key $alternatives($key)]
+ append alt_name [string range $alternatives($key) 0 [expr {$key_match - 1}]] \
+ \[ [expr {$def eq $key ? [string toupper $key] : $key}] \] \
+ [string range $alternatives($key) [expr {$key_match + [string length $key]}] end]
+ lappend alt_names $alt_name
+ unset alt_name
+ }
+
+ while 1 {
+ puts -nonewline "[join $alt_names /]: "
+ flush stdout
+ signal error {TERM INT}
+ try {
+ set input [gets stdin]
+ } catch {*} {
+ # An error occurred, print a newline so the error message
+ # doesn't occur on the prompt line and re-throw
+ puts ""
+ throw
+ }
+ set input [string tolower $input]
+ if {[info exists alternatives($input)]} {
+ return $input
+ } elseif {$input eq ""} {
+ return $def
+ } else {
+ puts "Please enter one of the alternatives"
+ }
+ }
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> ##########################################
</span><span class="lines">@@ -5576,12 +5653,13 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if {[isatty stdin]
</span><del>-        && [isatty stdout]
-        && (![info exists ui_options(ports_quiet)] || $ui_options(ports_quiet) ne "yes")
-        && (![info exists ui_options(ports_noninteractive)] || $ui_options(ports_noninteractive) ne "yes")} {
-        set ui_options(questions_yesno) portclient::questions::ui_ask_yesno
-        set ui_options(questions_singlechoice) portclient::questions::ui_ask_singlechoice
-        set ui_options(questions_multichoice) portclient::questions::ui_ask_multichoice
</del><ins>+ && [isatty stdout]
+ && (![info exists ui_options(ports_quiet)] || $ui_options(ports_quiet) ne "yes")
+ && (![info exists ui_options(ports_noninteractive)] || $ui_options(ports_noninteractive) ne "yes")} {
+ set ui_options(questions_yesno) portclient::questions::ui_ask_yesno
+ set ui_options(questions_singlechoice) portclient::questions::ui_ask_singlechoice
+ set ui_options(questions_multichoice) portclient::questions::ui_ask_multichoice
+ set ui_options(questions_alternative) portclient::questions::ui_ask_alternative
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> set ui_options(notifications_append) portclient::notifications::append
</span></span></pre></div>
<a id="branchesvcsfetchbasesrcportportindextcl"></a>
<div class="modfile"><h4>Modified: branches/vcs-fetch/base/src/port/portindex.tcl (147030 => 147031)</h4>
<pre class="diff"><span>
<span class="info">--- branches/vcs-fetch/base/src/port/portindex.tcl        2016-03-23 13:41:22 UTC (rev 147030)
+++ branches/vcs-fetch/base/src/port/portindex.tcl        2016-03-23 23:51:56 UTC (rev 147031)
</span><span class="lines">@@ -106,7 +106,7 @@
</span><span class="cx"> set portfile [file join $absportdir Portfile]
</span><span class="cx"> # try to reuse the existing entry if it's still valid
</span><span class="cx"> if {$full_reindex != 1 && [info exists qindex($qname)]} {
</span><del>- try {
</del><ins>+ try -pass_signal {
</ins><span class="cx"> set mtime [file mtime $portfile]
</span><span class="cx"> if {$oldmtime >= $mtime} {
</span><span class="cx"> lassign [_read_index $qname] name len line
</span><span class="lines">@@ -129,10 +129,6 @@
</span><span class="cx">
</span><span class="cx"> return
</span><span class="cx"> }
</span><del>- } catch {{POSIX SIG SIGINT} eCode eMessage} {
- throw
- } catch {{POSIX SIG SIGTERM} eCode eMessage} {
- throw
</del><span class="cx"> } catch {{*} eCode eMessage} {
</span><span class="cx"> ui_warn "Failed to open old entry for ${portdir}, making a new one"
</span><span class="cx"> if {[info exists ui_options(ports_debug)]} {
</span><span class="lines">@@ -142,7 +138,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> incr stats(total)
</span><del>- try {
</del><ins>+ try -pass_signal {
</ins><span class="cx"> _open_port portinfo $portdir $absportdir port_options
</span><span class="cx"> puts "Adding port $portdir"
</span><span class="cx">
</span><span class="lines">@@ -158,24 +154,16 @@
</span><span class="cx"> }
</span><span class="cx"> foreach sub $portinfo(subports) {
</span><span class="cx"> incr stats(total)
</span><del>- try {
</del><ins>+ try -pass_signal {
</ins><span class="cx"> _open_port portinfo $portdir $absportdir port_options $sub
</span><span class="cx"> puts "Adding subport $sub"
</span><span class="cx">
</span><span class="cx"> _write_index_from_portinfo portinfo yes
</span><del>- } catch {{POSIX SIG SIGINT} eCode eMessage} {
- throw
- } catch {{POSIX SIG SIGTERM} eCode eMessage} {
- throw
</del><span class="cx"> } catch {{*} eCode eMessage} {
</span><span class="cx"> puts stderr "Failed to parse file $portdir/Portfile with subport '${sub}': $eMessage"
</span><span class="cx"> incr stats(failed)
</span><span class="cx"> }
</span><span class="cx"> }
</span><del>- } catch {{POSIX SIG SIGINT} eCode eMessage} {
- throw
- } catch {{POSIX SIG SIGTERM} eCode eMessage} {
- throw
</del><span class="cx"> } catch {{*} eCode eMessage} {
</span><span class="cx"> puts stderr "Failed to parse file $portdir/Portfile: $eMessage"
</span><span class="cx"> incr stats(failed)
</span></span></pre></div>
<a id="branchesvcsfetchbasesrcport10portbuildtcl"></a>
<div class="modfile"><h4>Modified: branches/vcs-fetch/base/src/port1.0/portbuild.tcl (147030 => 147031)</h4>
<pre class="diff"><span>
<span class="info">--- branches/vcs-fetch/base/src/port1.0/portbuild.tcl        2016-03-23 13:41:22 UTC (rev 147030)
+++ branches/vcs-fetch/base/src/port1.0/portbuild.tcl        2016-03-23 23:51:56 UTC (rev 147031)
</span><span class="lines">@@ -134,14 +134,20 @@
</span><span class="cx"> set jobs $buildmakejobs
</span><span class="cx"> # if set to '0', use the number of cores for the number of jobs
</span><span class="cx"> if {$jobs == 0} {
</span><del>- if {[catch {set jobs [sysctl hw.activecpu]}] || [catch {set memsize [sysctl hw.memsize]}]} {
- set jobs 2
</del><ins>+ try -pass_signal {
+ set jobs [sysctl hw.activecpu]
+ } catch {{*} eCode eMessage} {
</ins><span class="cx"> ui_warn "failed to determine the number of available CPUs (probably not supported on this platform)"
</span><span class="cx"> ui_warn "defaulting to $jobs jobs, consider setting buildmakejobs to a nonzero value in macports.conf"
</span><ins>+ set jobs 2
</ins><span class="cx"> }
</span><del>- if {[info exists memsize] && $jobs > $memsize / 1000000000 + 1} {
- set jobs [expr {$memsize / 1000000000 + 1}]
- }
</del><ins>+
+ try -pass_signal {
+ set memsize [sysctl hw.memsize]
+ if {$jobs > $memsize / (1024 * 1024 * 1024) + 1} {
+ set jobs [expr {$memsize / (1024 * 1024 * 1024) + 1}]
+ }
+ } catch {*} {}
</ins><span class="cx"> }
</span><span class="cx"> if {![string is integer -strict $jobs] || $jobs <= 1} {
</span><span class="cx"> set jobs 1
</span></span></pre></div>
<a id="branchesvcsfetchbasesrcport10portcleantcl"></a>
<div class="modfile"><h4>Modified: branches/vcs-fetch/base/src/port1.0/portclean.tcl (147030 => 147031)</h4>
<pre class="diff"><span>
<span class="info">--- branches/vcs-fetch/base/src/port1.0/portclean.tcl        2016-03-23 13:41:22 UTC (rev 147030)
+++ branches/vcs-fetch/base/src/port1.0/portclean.tcl        2016-03-23 23:51:56 UTC (rev 147031)
</span><span class="lines">@@ -214,14 +214,8 @@
</span><span class="cx">
</span><span class="cx"> if {[file isdirectory $subbuildpath]} {
</span><span class="cx"> ui_debug "Removing directory: ${subbuildpath}"
</span><del>- try {
</del><ins>+ try -pass_signal {
</ins><span class="cx"> delete $subbuildpath
</span><del>- } catch {{POSIX SIG SIGINT} eCode eMessage} {
- ui_debug [msgcat::mc "Aborted due to SIGINT"]
- throw
- } catch {{POSIX SIG SINTERM} eCode eMessage} {
- ui_debug [msgcat::mc "Aborted due to SIGTERM"]
- throw
</del><span class="cx"> } catch {{*} eCode eMessage} {
</span><span class="cx"> ui_debug "$::errorInfo"
</span><span class="cx"> ui_error "$eMessage"
</span><span class="lines">@@ -234,14 +228,8 @@
</span><span class="cx">
</span><span class="cx"> if {!$usealtworkpath && [file isdirectory ${altprefix}${subbuildpath}]} {
</span><span class="cx"> ui_debug "Removing directory: ${altprefix}${subbuildpath}"
</span><del>- try {
</del><ins>+ try -pass_signal {
</ins><span class="cx"> delete ${altprefix}${subbuildpath}
</span><del>- } catch {{POSIX SIG SIGINT} eCode eMessage} {
- ui_debug [msgcat::mc "Aborted due to SIGINT"]
- throw
- } catch {{POSIX SIG SINTERM} eCode eMessage} {
- ui_debug [msgcat::mc "Aborted due to SIGTERM"]
- throw
</del><span class="cx"> } catch {{*} eCode eMessage} {
</span><span class="cx"> ui_debug "$::errorInfo"
</span><span class="cx"> ui_error "$eMessage"
</span></span></pre></div>
<a id="branchesvcsfetchbasesrcport10portdistchecktcl"></a>
<div class="modfile"><h4>Modified: branches/vcs-fetch/base/src/port1.0/portdistcheck.tcl (147030 => 147031)</h4>
<pre class="diff"><span>
<span class="info">--- branches/vcs-fetch/base/src/port1.0/portdistcheck.tcl        2016-03-23 13:41:22 UTC (rev 147030)
+++ branches/vcs-fetch/base/src/port1.0/portdistcheck.tcl        2016-03-23 23:51:56 UTC (rev 147031)
</span><span class="lines">@@ -85,18 +85,12 @@
</span><span class="cx"> foreach site $urlmap($url_var) {
</span><span class="cx"> ui_debug [format [msgcat::mc "Checking %s from %s"] $distfile $site]
</span><span class="cx"> set file_url [portfetch::assemble_url $site $distfile]
</span><del>- try {
</del><ins>+ try -pass_signal {
</ins><span class="cx"> set urlnewer [curl isnewer {*}$curl_options $file_url $port_moddate]
</span><span class="cx"> if {$urlnewer} {
</span><span class="cx"> ui_warn "port $subport: $file_url is newer than Portfile"
</span><span class="cx"> }
</span><span class="cx"> incr count
</span><del>- } catch {{POSIX SIG SIGINT} eCode eMessage} {
- ui_debug [msgcat::mc "Aborted due to SIGINT"]
- throw
- } catch {{POSIX SIG SIGTERM} eCode eMessage} {
- ui_debug [msgcat::mc "Aborted due to SIGTERM"]
- throw
</del><span class="cx"> } catch {{*} eCode eMessage} {
</span><span class="cx"> ui_debug [msgcat::mc "couldn't fetch %s for %s (%s)" $file_url $subport $eMessage]
</span><span class="cx"> }
</span><span class="lines">@@ -109,7 +103,7 @@
</span><span class="cx"> foreach site $urlmap($url_var) {
</span><span class="cx"> ui_debug [format [msgcat::mc "Checking %s from %s"] $distfile $site]
</span><span class="cx"> set file_url [portfetch::assemble_url $site $distfile]
</span><del>- try {
</del><ins>+ try -pass_signal {
</ins><span class="cx"> set urlsize [curl getsize {*}$curl_options $file_url]
</span><span class="cx"> incr count
</span><span class="cx"> if {$urlsize > 0} {
</span><span class="lines">@@ -117,12 +111,6 @@
</span><span class="cx"> incr totalsize $urlsize
</span><span class="cx"> break
</span><span class="cx"> }
</span><del>- } catch {{POSIX SIG SIGINT} eCode eMessage} {
- ui_debug [msgcat::mc "Aborted due to SIGINT"]
- throw
- } catch {{POSIX SIG SIGTERM} eCode eMessage} {
- ui_debug [msgcat::mc "Aborted due to SIGTERM"]
- throw
</del><span class="cx"> } catch {{*} eCode eMessage} {
</span><span class="cx"> ui_debug [msgcat::mc "couldn't fetch %s for %s (%s)" $file_url $subport $eMessage]
</span><span class="cx"> }
</span></span></pre></div>
<a id="branchesvcsfetchbasesrcport10portfetchtcl"></a>
<div class="modfile"><h4>Modified: branches/vcs-fetch/base/src/port1.0/portfetch.tcl (147030 => 147031)</h4>
<pre class="diff"><span>
<span class="info">--- branches/vcs-fetch/base/src/port1.0/portfetch.tcl        2016-03-23 13:41:22 UTC (rev 147030)
+++ branches/vcs-fetch/base/src/port1.0/portfetch.tcl        2016-03-23 23:51:56 UTC (rev 147031)
</span><span class="lines">@@ -535,7 +535,7 @@
</span><span class="cx">
</span><span class="cx"> foreach {url_var distfile} $fetch_urls {
</span><span class="cx"> if {![file isfile "${distpath}/${distfile}"]} {
</span><del>- ui_info "$UI_PREFIX [format [msgcat::mc "%s doesn't seem to exist in %s"] $distfile $distpath]"
</del><ins>+ ui_info "$UI_PREFIX [format [msgcat::mc "%s does not exist in %s"] $distfile $distpath]"
</ins><span class="cx"> if {![file writable $distpath]} {
</span><span class="cx"> return -code error [format [msgcat::mc "%s must be writable"] $distpath]
</span><span class="cx"> }
</span><span class="lines">@@ -560,22 +560,16 @@
</span><span class="cx"> foreach site $urlmap($url_var) {
</span><span class="cx"> ui_notice "$UI_PREFIX [format [msgcat::mc "Attempting to fetch %s from %s"] $distfile $site]"
</span><span class="cx"> set file_url [portfetch::assemble_url $site $distfile]
</span><del>- try {
</del><ins>+ try -pass_signal {
</ins><span class="cx"> curl fetch {*}$fetch_options $file_url "${distpath}/${distfile}.TMP"
</span><span class="cx"> file rename -force "${distpath}/${distfile}.TMP" "${distpath}/${distfile}"
</span><span class="cx"> set fetched 1
</span><span class="cx"> break
</span><del>- } catch {{POSIX SIG SIGINT} eCode eMessage} {
- ui_debug [msgcat::mc "Aborted fetching distfile due to SIGINT"]
- file delete -force "${distpath}/${distfile}.TMP"
- throw
- } catch {{POSIX SIG SIGTERM} eCode eMessage} {
- ui_debug [msgcat::mc "Aborted fetching distfile due to SIGTERM"]
- file delete -force "${distpath}/${distfile}.TMP"
- throw
</del><span class="cx"> } catch {{*} eCode eMessage} {
</span><span class="cx"> ui_debug [msgcat::mc "Fetching distfile failed: %s" $eMessage]
</span><span class="cx"> set lastError $eMessage
</span><ins>+ } finally {
+ file delete -force "${distpath}/${distfile}.TMP"
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> if {![info exists fetched]} {
</span></span></pre></div>
<a id="branchesvcsfetchbasesrcport10portutiltcl"></a>
<div class="modfile"><h4>Modified: branches/vcs-fetch/base/src/port1.0/portutil.tcl (147030 => 147031)</h4>
<pre class="diff"><span>
<span class="info">--- branches/vcs-fetch/base/src/port1.0/portutil.tcl        2016-03-23 13:41:22 UTC (rev 147030)
+++ branches/vcs-fetch/base/src/port1.0/portutil.tcl        2016-03-23 23:51:56 UTC (rev 147031)
</span><span class="lines">@@ -449,6 +449,7 @@
</span><span class="cx"> array set env [array get ${varprefix}.env_array]
</span><span class="cx"> # Call the command.
</span><span class="cx"> set fullcmdstring "$command_prefix $cmdstring $command_suffix"
</span><ins>+ ui_info "Executing: $fullcmdstring"
</ins><span class="cx"> set code [catch {system {*}$notty {*}$nice $fullcmdstring} result]
</span><span class="cx"> # Save variables in order to re-throw the same error code.
</span><span class="cx"> set errcode $::errorCode
</span></span></pre></div>
<a id="branchesvcsfetchbasesrcport10testsportactivatetest"></a>
<div class="modfile"><h4>Modified: branches/vcs-fetch/base/src/port1.0/tests/portactivate.test (147030 => 147031)</h4>
<pre class="diff"><span>
<span class="info">--- branches/vcs-fetch/base/src/port1.0/tests/portactivate.test        2016-03-23 13:41:22 UTC (rev 147030)
+++ branches/vcs-fetch/base/src/port1.0/tests/portactivate.test        2016-03-23 23:51:56 UTC (rev 147031)
</span><span class="lines">@@ -19,38 +19,70 @@
</span><span class="cx"> macports_worker_init
</span><span class="cx">
</span><span class="cx">
</span><del>-test activate_start {
- Activate start unit test.
- Requires root for setting euid.
-} -constraints {
- root
-} -setup {
</del><ins>+set activate_start_fixture_setup {
+ global prefix
+
+ set _save_prefix ${prefix}
+ file mkdir ${pwd}/tmpdir
+ set prefix ${pwd}/tmpdir
+
+ rename getuid _save_getuid
+ rename geteuid _save_geteuid
+
+ set fake_uid 0
+ set fake_euid 0
+ set elevateToRootCalls [list]
+
+ proc getuid {} {
+ global fake_uid
+ return ${fake_uid}
+ }
+ proc geteuid {} {
+ global fake_euid
+ return ${fake_euid}
+ }
+
+ proc elevateToRoot {phase} {
+ global elevateToRootCalls
+ lappend elevateToRootCalls $phase
+ }
+}
+set activate_start_fixture_cleanup {
+ rename getuid ""
+ rename geteuid ""
+
+ rename _save_getuid getuid
+ rename _save_geteuid geteuid
+
+ file delete -force ${pwd}/tmpdir
+}
+
+test activate_start_elevate {
+ Test portactivate::activate_start to make sure it elevates to root if necessary
+} -setup $activate_start_fixture_setup -cleanup $activate_start_fixture_cleanup -body {
</ins><span class="cx"> # file writable $prefix is used to determine whether privilege escalation
</span><span class="cx"> # is needed, so set prefix to a directory unwritable for this user
</span><span class="cx"> set prefix /usr/bin
</span><ins>+ set fake_uid 0
+ set fake_euid 500
</ins><span class="cx">
</span><del>- # elevateToRoot uses $euid and $egid as the IDs to set
- set euid 0
- set egid 0
</del><ins>+ portactivate::activate_start
</ins><span class="cx">
</span><del>-} -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"
- }
</del><ins>+ return ${elevateToRootCalls}
+} -result [list "activate"] -errorOutput ""
</ins><span class="cx">
</span><del>- # 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."
</del><ins>+test activate_start_noelevate {
+ Test portactivate::activate_start to make sure that it does not elevate to root if it cannot
+} -setup $activate_start_fixture_setup -cleanup $activate_start_fixture_cleanup -body {
+ set fake_uid 500
+ set fake_euid 500
</ins><span class="cx">
</span><ins>+ portactivate::activate_start
</ins><span class="cx">
</span><ins>+ return ${elevateToRootCalls}
+} -result [list] -errorOutput ""
+
+
</ins><span class="cx"> test activate_main {
</span><span class="cx"> Activate main unit test.
</span><span class="cx"> } -constraints {
</span><span class="lines">@@ -100,7 +132,7 @@
</span><span class="cx"> array set macports::channels $oldchannels
</span><span class="cx">
</span><span class="cx"> mportclose $mport
</span><del>-} -result "Port activate successful."
</del><ins>+} -result "Port activate successful." -errorOutput ""
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx"> cleanupTests
</span></span></pre></div>
<a id="branchesvcsfetchbasesrcport10testsportbuildtestfromrev147030trunkbasesrcport10testsportbuildtest"></a>
<div class="copfile"><h4>Copied: branches/vcs-fetch/base/src/port1.0/tests/portbuild.test (from rev 147030, trunk/base/src/port1.0/tests/portbuild.test) (0 => 147031)</h4>
<pre class="diff"><span>
<span class="info">--- branches/vcs-fetch/base/src/port1.0/tests/portbuild.test         (rev 0)
+++ branches/vcs-fetch/base/src/port1.0/tests/portbuild.test        2016-03-23 23:51:56 UTC (rev 147031)
</span><span class="lines">@@ -0,0 +1,139 @@
</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
+package require macports 1.0
+
+array set ui_options {}
+#set ui_options(ports_debug) yes
+#set ui_options(ports_verbose) yes
+mportinit ui_options
+
+# Provide a stub for the port callback mechanism
+namespace eval port {
+ proc register_callback {args} {}
+ proc run_callbacks {args} {}
+}
+
+package require portbuild 1.0
+
+set build_getjobs_fixture_setup {
+ # Move away sysctl and replace it with our own implementation
+ rename sysctl sysctl_backup
+ proc sysctl {sysctlname} {
+ global _activecpus _memsize _activecpus_fail _memsize_fail
+ switch -exact $sysctlname {
+ hw.activecpu {
+ if {${_activecpus_fail}} {
+ error "error requested"
+ }
+ return ${_activecpus}
+ }
+ hw.memsize {
+ if {${_memsize_fail}} {
+ error "error requested"
+ }
+ return [expr {${_memsize} * 1024 * 1024 * 1024}]
+ }
+ default {
+ error "Unknown sysctl property $sysctlname"
+ }
+ }
+ }
+}
+set build_getjobs_fixture_cleanup {
+ global buildmakejobs
+
+ # Restore modified state
+ rename sysctl ""
+ rename sysctl_backup sysctl
+}
+
+test build_getjobs_auto_cpubound {
+ Verify that portbuild::build_getjobs correctly computes the number of parallel executors in the CPU-bound case
+} -setup $build_getjobs_fixture_setup -cleanup $build_getjobs_fixture_cleanup -body {
+ global buildmakejobs
+
+ # Make sure that buildmakejobs is 0 so the auto-detection is being run
+ set buildmakejobs 0
+ set _activecpus 8
+ set _activecpus_fail no
+ set _memsize 16
+ set _memsize_fail no
+
+ return [portbuild::build_getjobs]
+} -result 8
+
+test build_getjobs_auto_memlimited {
+ Verify that portbuild::build_getjobs correctly computes the number of parallel executors in the memory-bound case
+} -setup $build_getjobs_fixture_setup -cleanup $build_getjobs_fixture_cleanup -body {
+ global buildmakejobs
+
+ # Make sure that buildmakejobs is 0 so the auto-detection is being run
+ set buildmakejobs 0
+ set _activecpus 8
+ set _activecpus_fail no
+ set _memsize 4
+ set _memsize_fail no
+
+ return [portbuild::build_getjobs]
+} -result 5
+
+test build_getjobs_configured {
+ Verify that portbuild::build_getjobs correctly returns the number of configured parallel executors
+} -setup $build_getjobs_fixture_setup -cleanup $build_getjobs_fixture_cleanup -body {
+ global buildmakejobs
+
+ set buildmakejobs 42
+ return [portbuild::build_getjobs]
+} -result 42
+
+test build_getjobs_nonnegative {
+ Verify that portbuild::build_getjobs doesn't return negative numbers, even if configured
+} -setup $build_getjobs_fixture_setup -cleanup $build_getjobs_fixture_cleanup -body {
+ global buildmakejobs
+
+ set buildmakejobs -42
+ return [portbuild::build_getjobs]
+} -result 1
+
+test build_getjobs_nonnumeric {
+ Verify that portbuild::build_getjobs doesn't return junk if the configuration is non-numeric
+} -setup $build_getjobs_fixture_setup -cleanup $build_getjobs_fixture_cleanup -body {
+ global buildmakejobs
+
+ set buildmakejobs "foobar"
+ return [portbuild::build_getjobs]
+} -result 1
+
+test build_getjobs_cpus_fail {
+ Verify that a failing [sysctl hw.activecpus] will print a warning
+} -setup $build_getjobs_fixture_setup -cleanup $build_getjobs_fixture_cleanup -body {
+ global buildmakejobs
+
+ # Make sure that buildmakejobs is 0 so the auto-detection is being run
+ set buildmakejobs 0
+ set _activecpus_fail yes
+
+ return [portbuild::build_getjobs]
+} -result 2 -match glob -errorOutput "Warning:*failed to determine the number of available CPUs*"
+
+test build_getjobs_mem_fail {
+ Verify that a failing [sysctl hw.memsize] will print a warning
+} -setup $build_getjobs_fixture_setup -cleanup $build_getjobs_fixture_cleanup -body {
+ global buildmakejobs
+
+ # Make sure that buildmakejobs is 0 so the auto-detection is being run
+ set buildmakejobs 0
+ set _activecpus 8
+ set _activecpus_fail no
+ set _memsize_fail yes
+
+ return [portbuild::build_getjobs]
+} -result 8
+
+cleanupTests
</ins></span></pre></div>
<a id="branchesvcsfetchbasesrcregistry20portimagetcl"></a>
<div class="modfile"><h4>Modified: branches/vcs-fetch/base/src/registry2.0/portimage.tcl (147030 => 147031)</h4>
<pre class="diff"><span>
<span class="info">--- branches/vcs-fetch/base/src/registry2.0/portimage.tcl        2016-03-23 13:41:22 UTC (rev 147030)
+++ branches/vcs-fetch/base/src/registry2.0/portimage.tcl        2016-03-23 23:51:56 UTC (rev 147031)
</span><span class="lines">@@ -252,8 +252,7 @@
</span><span class="cx"> }
</span><span class="cx"> if {[info exists macports::ui_options(questions_singlechoice)]} {
</span><span class="cx"> set retvalue [$macports::ui_options(questions_singlechoice) $msg "Choice_Q1" $portilist]
</span><del>- set index [expr { $retvalue - 1 }]
- return [lindex $ilist $index]
</del><ins>+ return [lindex $ilist $retvalue]
</ins><span class="cx"> }
</span><span class="cx"> throw registry::invalid "Registry error: Please specify the full version as recorded in the port registry."
</span><span class="cx"> } elseif { [llength $ilist] == 1 } {
</span></span></pre></div>
<a id="branchesvcsfetchbasesrcregistry20portuninstalltcl"></a>
<div class="modfile"><h4>Modified: branches/vcs-fetch/base/src/registry2.0/portuninstall.tcl (147030 => 147031)</h4>
<pre class="diff"><span>
<span class="info">--- branches/vcs-fetch/base/src/registry2.0/portuninstall.tcl        2016-03-23 13:41:22 UTC (rev 147030)
+++ branches/vcs-fetch/base/src/registry2.0/portuninstall.tcl        2016-03-23 23:51:56 UTC (rev 147031)
</span><span class="lines">@@ -174,7 +174,7 @@
</span><span class="cx"> if {[info exists macports::ui_options(questions_multichoice)]} {
</span><span class="cx"> set retstring [$macports::ui_options(questions_multichoice) $msg "Choice_Q2" $portilist]
</span><span class="cx"> foreach index $retstring {
</span><del>- set uport [lindex $sortedlist [expr { $index - 1 }]]
</del><ins>+ set uport [lindex $sortedlist $index]
</ins><span class="cx"> uninstall [$uport name] [$uport version] [$uport revision] [$uport variants]
</span><span class="cx"> }
</span><span class="cx"> return 0
</span></span></pre>
</div>
</div>
</body>
</html>