[139552] branches/gsoc15-dependency/base

ijackson at macports.org ijackson at macports.org
Thu Aug 20 01:24:32 PDT 2015


Revision: 139552
          https://trac.macports.org/changeset/139552
Author:   ijackson at macports.org
Date:     2015-08-20 01:24:32 -0700 (Thu, 20 Aug 2015)
Log Message:
-----------
Merge macports-trunk/base with branches/gsoc15-dependency/base

Merge revisions r137851-139551. Update the branch with latest
changes to trunk so that chances of merge conflicts would be less.

Revision Links:
--------------
    https://trac.macports.org/changeset/137851

Modified Paths:
--------------
    branches/gsoc15-dependency/base/ChangeLog
    branches/gsoc15-dependency/base/Makefile.in
    branches/gsoc15-dependency/base/configure
    branches/gsoc15-dependency/base/configure.ac
    branches/gsoc15-dependency/base/src/darwintracelib1.0/darwintrace.c
    branches/gsoc15-dependency/base/src/darwintracelib1.0/proc.c
    branches/gsoc15-dependency/base/src/machista1.0/Makefile.in
    branches/gsoc15-dependency/base/src/machista1.0/machista_wrap.c
    branches/gsoc15-dependency/base/src/macports1.0/macports.tcl
    branches/gsoc15-dependency/base/src/macports1.0/macports_dlist.tcl
    branches/gsoc15-dependency/base/src/macports1.0/tests/macports.test
    branches/gsoc15-dependency/base/src/macports1.0/tests/test.tcl
    branches/gsoc15-dependency/base/src/package1.0/portarchivefetch.tcl
    branches/gsoc15-dependency/base/src/package1.0/tests/test.tcl
    branches/gsoc15-dependency/base/src/pextlib1.0/Makefile.in
    branches/gsoc15-dependency/base/src/pextlib1.0/Pextlib.c
    branches/gsoc15-dependency/base/src/pextlib1.0/Pextlib.h
    branches/gsoc15-dependency/base/src/pextlib1.0/system.c
    branches/gsoc15-dependency/base/src/pextlib1.0/tracelib.c
    branches/gsoc15-dependency/base/src/pextlib1.0/xinstall.c
    branches/gsoc15-dependency/base/src/port/port.tcl
    branches/gsoc15-dependency/base/src/port1.0/portchecksum.tcl
    branches/gsoc15-dependency/base/src/port1.0/portconfigure.tcl
    branches/gsoc15-dependency/base/src/port1.0/portdestroot.tcl
    branches/gsoc15-dependency/base/src/port1.0/portlint.tcl
    branches/gsoc15-dependency/base/src/port1.0/portlivecheck.tcl
    branches/gsoc15-dependency/base/src/port1.0/portmirror.tcl
    branches/gsoc15-dependency/base/src/port1.0/porttrace.tcl
    branches/gsoc15-dependency/base/src/port1.0/portuninstall.tcl
    branches/gsoc15-dependency/base/src/port1.0/portutil.tcl
    branches/gsoc15-dependency/base/src/port1.0/tests/test.tcl
    branches/gsoc15-dependency/base/src/registry2.0/portimage.tcl
    branches/gsoc15-dependency/base/src/registry2.0/portuninstall.tcl
    branches/gsoc15-dependency/base/src/registry2.0/registry.tcl

Added Paths:
-----------
    branches/gsoc15-dependency/base/src/pextlib1.0/adv-flock.c
    branches/gsoc15-dependency/base/src/pextlib1.0/adv-flock.h

Removed Paths:
-------------
    branches/gsoc15-dependency/base/src/pextlib1.0/flock.c
    branches/gsoc15-dependency/base/src/pextlib1.0/flock.h

Property Changed:
----------------
    branches/gsoc15-dependency/base/
    branches/gsoc15-dependency/base/src/pextlib1.0/Makefile.in


Property changes on: branches/gsoc15-dependency/base
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/gsoc08-privileges/base:37343-46937
/branches/gsoc09-logging/base:51231-60371
/branches/gsoc11-rev-upgrade/base:78828-88375
/branches/gsoc11-statistics/base:79520,79666
/branches/gsoc13-tests:106692-111324
/branches/gsoc14-cleanup:123738-124046
/branches/gsoc14-interactive/base:119516-124240
/branches/universal-sanity/base:51872-52323
/branches/variant-descs-14482/base:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
/trunk/base:136782-137850
/users/perry/base-bugs_and_notes:45682-46060
/users/perry/base-select:44044-44692
   + /branches/gsoc08-privileges/base:37343-46937
/branches/gsoc09-logging/base:51231-60371
/branches/gsoc11-rev-upgrade/base:78828-88375
/branches/gsoc11-statistics/base:79520,79666
/branches/gsoc13-tests:106692-111324
/branches/gsoc14-cleanup:123738-124046
/branches/gsoc14-interactive/base:119516-124240
/branches/universal-sanity/base:51872-52323
/branches/variant-descs-14482/base:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
/trunk/base:136782-139551
/users/perry/base-bugs_and_notes:45682-46060
/users/perry/base-select:44044-44692

Modified: branches/gsoc15-dependency/base/ChangeLog
===================================================================
--- branches/gsoc15-dependency/base/ChangeLog	2015-08-20 07:23:27 UTC (rev 139551)
+++ branches/gsoc15-dependency/base/ChangeLog	2015-08-20 08:24:32 UTC (rev 139552)
@@ -4,6 +4,14 @@
 ###
 
 Release 2.4 (unreleased)
+    - Replaced the strings previously printed by "port help" with much more
+      detailed and current manpages written using asciidoc that open
+      automatically. Added documentation for almost all commands currently
+      implemented by MacPorts.
+      (raimue in branch new-help-system, merge in r123002,
+       manpages written by cal, jmr, raimue, ionic, jeremyhu,
+       #44530, #15467)
+
     - Added macports_version to the Portfile execution context, to allow
       checking the current MacPorts version in Portfiles.
       (cal in r134511)
@@ -22,7 +30,8 @@
 
     - Handle SIGTERM and SIGINT (^C) in MacPorts to prevent inconsistencies in
       the registry database when MacPorts is aborted during a critical
-      operation. (cal in r118297 and r118298)
+      operation.
+      (cal in r118297 and r118298)
 
     - Remove "support" for rpm and deb packages in MacPorts, leaving pkg/mpkg.
       (afb in r123004)

Modified: branches/gsoc15-dependency/base/Makefile.in
===================================================================
--- branches/gsoc15-dependency/base/Makefile.in	2015-08-20 07:23:27 UTC (rev 139551)
+++ branches/gsoc15-dependency/base/Makefile.in	2015-08-20 08:24:32 UTC (rev 139552)
@@ -19,7 +19,7 @@
 
 all:: Mk/macports.autoconf.mk
 
-Mk/macports.autoconf.mk: Mk/macports.autoconf.mk.in src/config.h.in Makefile.in doc/Makefile.in src/cflib1.0/Makefile.in src/cregistry/Makefile.in src/darwintracelib1.0/Makefile.in src/macports1.0/Makefile.in src/package1.0/Makefile.in src/port/Makefile.in src/port1.0/Makefile.in src/registry2.0/Makefile.in tests/Makefile.in config.status
+Mk/macports.autoconf.mk: Mk/macports.autoconf.mk.in src/config.h.in Makefile.in doc/Makefile.in src/Makefile.in src/cflib1.0/Makefile.in src/cregistry/Makefile.in src/darwintracelib1.0/Makefile.in src/machista1.0/Makefile.in src/macports1.0/Makefile.in src/package1.0/Makefile.in src/pextlib1.0/Makefile.in src/port/Makefile.in src/port1.0/Makefile.in src/programs/Makefile.in src/programs/daemondo/Makefile.in src/registry2.0/Makefile.in tests/Makefile.in config.status
 	./config.status
 	${MAKE} clean
 

Modified: branches/gsoc15-dependency/base/configure
===================================================================
--- branches/gsoc15-dependency/base/configure	2015-08-20 07:23:27 UTC (rev 139551)
+++ branches/gsoc15-dependency/base/configure	2015-08-20 08:24:32 UTC (rev 139552)
@@ -3040,7 +3040,7 @@
     as_fn_error $? "This version of Mac OS X is not supported
                   Please upgrade at http://store.apple.com/" "$LINENO" 5
     ;;
-  10.4.[0-9]|10.4.10|10.5.[0-7]|10.6.[0-7]|10.7.[0-4]|10.8.[0-4]|10.9.[0-4])
+  10.4.[0-9]|10.4.10|10.5.[0-7]|10.6.[0-7]|10.7.[0-4]|10.8.[0-4]|10.9.[0-4]|10.10.[0-3])
     { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: This version of Mac OS X is out of date" >&5
 $as_echo "$as_me: WARNING: This version of Mac OS X is out of date" >&2;}
     { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Please run Software Update to update it" >&5

Modified: branches/gsoc15-dependency/base/configure.ac
===================================================================
--- branches/gsoc15-dependency/base/configure.ac	2015-08-20 07:23:27 UTC (rev 139551)
+++ branches/gsoc15-dependency/base/configure.ac	2015-08-20 08:24:32 UTC (rev 139552)
@@ -33,7 +33,7 @@
     AC_MSG_ERROR([This version of Mac OS X is not supported
                   Please upgrade at http://store.apple.com/])
     ;;
-  10.4.[[0-9]]|10.4.10|10.5.[[0-7]]|10.6.[[0-7]]|10.7.[[0-4]]|10.8.[[0-4]]|10.9.[[0-4]])
+  10.4.[[0-9]]|10.4.10|10.5.[[0-7]]|10.6.[[0-7]]|10.7.[[0-4]]|10.8.[[0-4]]|10.9.[[0-4]]|10.10.[[0-3]])
     AC_MSG_WARN([This version of Mac OS X is out of date])
     AC_MSG_WARN([Please run Software Update to update it])
     ;;

Modified: branches/gsoc15-dependency/base/src/darwintracelib1.0/darwintrace.c
===================================================================
--- branches/gsoc15-dependency/base/src/darwintracelib1.0/darwintrace.c	2015-08-20 07:23:27 UTC (rev 139551)
+++ branches/gsoc15-dependency/base/src/darwintracelib1.0/darwintrace.c	2015-08-20 08:24:32 UTC (rev 139552)
@@ -44,6 +44,7 @@
 #endif
 
 #include <errno.h>
+#include <fcntl.h>
 #include <inttypes.h>
 #include <pthread.h>
 #include <string.h>
@@ -133,6 +134,13 @@
  */
 static char *filemap;
 
+static void __darwintrace_sock_destructor(FILE *dtsock) {
+	__darwintrace_close_sock = fileno(dtsock);
+	fclose(dtsock);
+	__darwintrace_close_sock = -1;
+	__darwintrace_sock_set(NULL);
+}
+
 /**
  * Setup method called as constructor to set up thread-local storage for the
  * thread id and the darwintrace socket.
@@ -142,7 +150,7 @@
 		perror("darwintrace: pthread_key_create");
 		abort();
 	}
-	if (0 != (errno = pthread_key_create(&sock_key, NULL))) {
+	if (0 != (errno = pthread_key_create(&sock_key, (void (*)(void *)) __darwintrace_sock_destructor))) {
 		perror("darwintrace: pthread_key_create");
 		abort();
 	}
@@ -333,7 +341,7 @@
 		__darwintrace_close_sock = fileno(dtsock);
 		fclose(dtsock);
 		__darwintrace_close_sock = -1;
-		pthread_setspecific(sock_key, NULL);
+		__darwintrace_sock_set(NULL);
 	}
 }
 
@@ -370,6 +378,7 @@
 
 	if (__darwintrace_sock() == NULL) {
 		int sock;
+		int sockflags;
 		FILE *stream;
 		struct sockaddr_un sun;
 
@@ -385,6 +394,29 @@
 			abort();
 		}
 
+		/* Set the close-on-exec flag as early as possible after the socket
+		 * creation. On OS X, there is no way to do this race-condition free
+		 * unless you synchronize around creation and fork(2) -- however,
+		 * blocking in this function is not acceptable for darwintrace, because
+		 * it could possibly run in a signal handler, leading to a deadlock.
+		 *
+		 * The close-on-exec flag is needed because we're using a thread-local
+		 * variable to hold a reference to this socket, but multi-threaded
+		 * programs that fork will only clone the thread that calls fork(2),
+		 * which leaves us with no reference to the other sockets (which are
+		 * inherited, because FDs are process-wide). Consequently, this can
+		 * lead to a resource leak.
+		 */
+		if (-1 == (sockflags = fcntl(sock, F_GETFD))) {
+			perror("darwintrace: fcntl(F_GETFD)");
+			abort();
+		}
+		sockflags |= FD_CLOEXEC;
+		if (-1 == fcntl(sock, F_SETFD, sockflags)) {
+			perror("darwintrace: fcntl(F_SETFD, flags | FD_CLOEXEC)");
+			abort();
+		}
+
 		if (strlen(__env_darwintrace_log) > sizeof(sun.sun_path) - 1) {
 			fprintf(stderr, "darwintrace: Can't connect to socket %s: name too long\n", __env_darwintrace_log);
 			abort();

Modified: branches/gsoc15-dependency/base/src/darwintracelib1.0/proc.c
===================================================================
--- branches/gsoc15-dependency/base/src/darwintracelib1.0/proc.c	2015-08-20 07:23:27 UTC (rev 139551)
+++ branches/gsoc15-dependency/base/src/darwintracelib1.0/proc.c	2015-08-20 08:24:32 UTC (rev 139552)
@@ -221,6 +221,8 @@
 	 * That _does_ save us another ugly loop to get things right. */
 	bytes_read = read(fd, buffer, sizeof(buffer) - 1);
 	buffer[bytes_read] = '\0';
+	close(fd);
+
 	const char *buffer_end = buffer + bytes_read;
 	if (bytes_read > 2 && buffer[0] == '#' && buffer[1] == '!') {
 		char *interp = buffer + 2;
@@ -238,12 +240,10 @@
 
 		/* check the iterpreter against the sandbox */
 		if (!__darwintrace_is_in_sandbox(interp, DT_REPORT | DT_ALLOWDIR | DT_FOLLOWSYMS)) {
-			close(fd);
 			return ENOENT;
 		}
 	}
 
-	close(fd);
 	return 0;
 #undef open
 #undef close

Modified: branches/gsoc15-dependency/base/src/machista1.0/Makefile.in
===================================================================
--- branches/gsoc15-dependency/base/src/machista1.0/Makefile.in	2015-08-20 07:23:27 UTC (rev 139551)
+++ branches/gsoc15-dependency/base/src/machista1.0/Makefile.in	2015-08-20 08:24:32 UTC (rev 139552)
@@ -27,7 +27,6 @@
 else
 	@echo "Building ${SWIG_SRCS} requires swig, which you apparently did not have installed when configuring MacPorts." >&2
 	@echo "Please install swig and re-run configure" >&2
-	@echo "I recommend installing SWIG 1.x in /opt/swig, because as of this writing SWIG 2.x-generated code does not compile warning-free" >&2
 	@echo "To use this SWIG, run configure as follows:" >&2
 	@echo "    SWIG=/opt/swig/bin/swig ./configure --your-usual-config-flags" >&2
 	@echo "If you checked out from svn you can also run svn revert in base/src/machista1.0 to get rid of this error" >&2

Modified: branches/gsoc15-dependency/base/src/machista1.0/machista_wrap.c
===================================================================
--- branches/gsoc15-dependency/base/src/machista1.0/machista_wrap.c	2015-08-20 07:23:27 UTC (rev 139551)
+++ branches/gsoc15-dependency/base/src/machista1.0/machista_wrap.c	2015-08-20 08:24:32 UTC (rev 139552)
@@ -1,3 +1,12 @@
+/*
+ * Non-generated MacPorts addition:
+ * Ignore these warnings in the generated SWIG code below.
+ *
+ * Please retain these #pragmas when regenerating the file!
+ */
+#pragma GCC   diagnostic ignored "-Wmissing-field-initializers"
+#pragma clang diagnostic ignored "-Wmissing-field-initializers"
+
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
  * Version 3.0.5

Modified: branches/gsoc15-dependency/base/src/macports1.0/macports.tcl
===================================================================
--- branches/gsoc15-dependency/base/src/macports1.0/macports.tcl	2015-08-20 07:23:27 UTC (rev 139551)
+++ branches/gsoc15-dependency/base/src/macports1.0/macports.tcl	2015-08-20 08:24:32 UTC (rev 139552)
@@ -42,7 +42,7 @@
 package require macports_libsolv 1.0
 
 namespace eval macports {
-    namespace export bootstrap_options user_options portinterp_options open_mports ui_priorities port_phases
+    namespace export bootstrap_options user_options portinterp_options open_mports ui_priorities
     variable bootstrap_options "\
         portdbpath binpath auto_path extra_env sources_conf prefix portdbformat \
         portarchivetype portautoclean \
@@ -75,7 +75,6 @@
     variable open_mports {}
 
     variable ui_priorities "error warn msg notice info debug any"
-    variable port_phases "any fetch checksum"
     variable current_phase main
 
     variable ui_prefix "---> "
@@ -140,10 +139,6 @@
         ui_debug "Logging disabled, error opening log file: $err"
         return 1
     }
-    # Add our log-channel to all already initialized channels
-    foreach key [array names channels] {
-        set macports::channels($key) [concat $macports::channels($key) debuglog]
-    }
     return 0
 }
 proc macports::ch_logging {mport} {
@@ -215,7 +210,7 @@
     }
 }
 
-proc ui_message {priority prefix phase args} {
+proc ui_message {priority prefix args} {
     global macports::channels ::debuglog macports::current_phase
 
     # 
@@ -225,38 +220,40 @@
        0 - 1 {}
        2 {
            if {[lindex $args 0] ne "-nonewline"} {
-               set hint "error: when 5 arguments are given, 2nd last must be \"-newnewline\""
-               error "$hint\nusage: ui_message priority prefix phase ?-nonewline? string"
+               set hint "error: when 4 arguments are given, 3rd must be \"-nonewline\""
+               error "$hint\nusage: ui_message priority prefix ?-nonewline? string"
            }
        }
        default {
            set hint "error: too many arguments specified"
-           error "$hint\nusage: ui_message priority prefix phase ?-nonewline? string"
+           error "$hint\nusage: ui_message priority prefix ?-nonewline? string"
        }
     } 
 
     foreach chan $macports::channels($priority) {
-        if {[info exists ::debuglog] && ($chan eq "debuglog")} {
-            set chan $::debuglog
-            if {[info exists macports::current_phase]} {
-                set phase $macports::current_phase
-            }
-            set strprefix ":${priority}:$phase "
-            if {[lindex $args 0] eq "-nonewline"} {
-                puts -nonewline $chan $strprefix[lindex $args 1]
-            } else {
-                puts $chan $strprefix[lindex $args 0]
-            }
+        if {[lindex $args 0] eq "-nonewline"} {
+            puts -nonewline $chan $prefix[lindex $args 1]
+        } else {
+            puts $chan $prefix[lindex $args 0]
+        }
+    }
 
+    if {[info exists ::debuglog]} {
+        set chan $::debuglog
+        if {[info exists macports::current_phase]} {
+            set phase $macports::current_phase
+        }
+        set strprefix ":${priority}:$phase "
+        if {[lindex $args 0] eq "-nonewline"} {
+            puts -nonewline $chan $strprefix[lindex $args 1]
         } else {
-            if {[lindex $args 0] eq "-nonewline"} {
-                puts -nonewline $chan $prefix[lindex $args 1]
-            } else {
-                puts $chan $prefix[lindex $args 0]
+            foreach str [split [lindex $args 0] "\n"] {
+                puts $chan $strprefix$str
             }
         }
     }
 }
+
 proc macports::ui_init {priority args} {
     global macports::channels ::debuglog
     set default_channel [macports::ui_channels_default $priority]
@@ -267,24 +264,16 @@
         set channels($priority) $default_channel
     }
 
-    # if some priority initialized after log file is being created
-    if {[info exists ::debuglog]} {
-        set channels($priority) [concat $channels($priority) debuglog]
-    }
     # Simplify ui_$priority.
     try {
         set prefix [ui_prefix $priority]
     } catch * {
         set prefix [ui_prefix_default $priority]
     }
-    set phases {fetch checksum}
     try {
         ::ui_init $priority $prefix $channels($priority) {*}$args
     } catch * {
-        interp alias {} ui_$priority {} ui_message $priority $prefix {}
-        foreach phase $phases {
-            interp alias {} ui_${priority}_$phase {} ui_message $priority $prefix $phase
-        }
+        interp alias {} ui_$priority {} ui_message $priority $prefix
     }
 }
 
@@ -691,7 +680,7 @@
             set fd [open $file r]
             while {[gets $fd line] >= 0} {
                 if {[regexp {^(\w+)([ \t]+(.*))?$} $line match option ignore val] == 1} {
-                    if {[lsearch -exact $bootstrap_options $option] >= 0} {
+                    if {$option in $bootstrap_options} {
                         set macports::$option [string trim $val]
                         global macports::$option
                     }
@@ -707,7 +696,7 @@
         set fd [open $per_user r]
         while {[gets $fd line] >= 0} {
             if {[regexp {^(\w+)([ \t]+(.*))?$} $line match option ignore val] == 1} {
-                if {[lsearch -exact $user_options $option] >= 0} {
+                if {$option in $user_options} {
                     set macports::$option $val
                     global macports::$option
                 }
@@ -726,7 +715,7 @@
             if {[regexp {^([\w-]+://\S+)(?:\s+\[(\w+(?:,\w+)*)\])?$} $line _ url flags]} {
                 set flags [split $flags ,]
                 foreach flag $flags {
-                    if {[lsearch -exact [list nosync default] $flag] == -1} {
+                    if {$flag ni [list nosync default]} {
                         ui_warn "$sources_conf source '$line' specifies invalid flag '$flag'"
                     }
                     if {$flag eq "default"} {
@@ -1081,20 +1070,11 @@
 
     set env_names [array names env]
     foreach envkey $env_names {
-        if {[lsearch -exact $keepenvkeys $envkey] == -1} {
+        if {$envkey ni $keepenvkeys} {
             unset env($envkey)
         }
     }
 
-    # unset environment an extra time, to work around bugs in Leopard Tcl
-    if {$macosx_version eq "10.5"} {
-        foreach envkey $env_names {
-            if {[lsearch -exact $keepenvkeys $envkey] == -1} {
-                unsetenv $envkey
-            }
-        }
-    }
-
     if {![info exists xcodeversion] || ![info exists xcodebuildcmd]} {
         # We'll resolve these later (if needed)
         trace add variable macports::xcodeversion read macports::setxcodeinfo
@@ -1313,9 +1293,6 @@
     # instantiate the UI call-backs
     foreach priority $macports::ui_priorities {
         $workername alias ui_$priority ui_$priority
-        foreach phase $macports::port_phases {
-            $workername alias ui_${priority}_$phase ui_${priority}_$phase
-        }
     }
     # add the UI progress call-back
     if {[info exists macports::ui_options(progress_download)]} {
@@ -2247,13 +2224,13 @@
                         }
                     }
                     if {[llength $missing] > 0} {
-                        if {[info exists dep_portinfo(variants)] && [lsearch -exact $dep_portinfo(variants) universal] != -1} {
+                        if {[info exists dep_portinfo(variants)] && "universal" in $dep_portinfo(variants)} {
                             # dep offers a universal variant
                             if {[llength $active_archs] == 1} {
                                 # not installed universal
                                 set missing {}
                                 foreach arch $required_archs {
-                                    if {[lsearch -exact $macports::universal_archs $arch] == -1} {
+                                    if {$arch ni $macports::universal_archs} {
                                         lappend missing $arch
                                     }
                                 }
@@ -2463,7 +2440,7 @@
     foreach source $sources {
         set flags [lrange $source 1 end]
         set source [lindex $source 0]
-        if {[lsearch -exact $flags nosync] != -1} {
+        if {"nosync" in $flags} {
             ui_debug "Skipping $source"
             continue
         }
@@ -3395,7 +3372,7 @@
         return 1
     }
     foreach arch $required_archs {
-        if {[lsearch -exact $provided_archs $arch] == -1} {
+        if {$arch ni $provided_archs} {
             return 0
         }
     }
@@ -3451,7 +3428,7 @@
     if {$supported_archs ne ""} {
         set ss [expr {[llength $supported_archs] == 1 ? "" : "s"}]
         foreach arch $required_archs {
-            if {[lsearch -exact $supported_archs $arch] == -1} {
+            if {$arch ni $supported_archs} {
                 ui_error "its dependency $dep only supports the arch${ss} '$supported_archs'."
                 return
             }
@@ -3459,7 +3436,7 @@
     }
     if {$has_universal} {
         foreach arch $required_archs {
-            if {[lsearch -exact $universal_archs $arch] == -1} {
+            if {$arch ni $universal_archs} {
                 ui_error "its dependency $dep does not build for the required arch${s} by default"
                 ui_error "and the configured universal_archs '$universal_archs' are not sufficient."
                 return
@@ -4461,7 +4438,10 @@
         show {
             set selected_version ${conf_path}/current
 
-            if {![file exists $selected_version]} {
+            if {[catch {file type $selected_version} err]} {
+                # this might be okay if nothing was selected yet,
+                # just log the error for debugging purposes
+                ui_debug "cannot determine selected version for $group: $err"
                 return none
             } else {
                 return [file readlink $selected_version]
@@ -5142,7 +5122,7 @@
             set fd [open $conf_file r]
             while {[gets $fd line] >= 0} {
                 if {[regexp {^(\w+)([ \t]+(.*))?$} $line match option ignore val] == 1} {
-                    if {[lsearch -exact $conf_options $option] >= 0} {
+                    if {$option in $conf_options} {
                         if {$option eq "name"} {
                             set cur_name $val
                             lappend all_names $val

Modified: branches/gsoc15-dependency/base/src/macports1.0/macports_dlist.tcl
===================================================================
--- branches/gsoc15-dependency/base/src/macports1.0/macports_dlist.tcl	2015-08-20 07:23:27 UTC (rev 139551)
+++ branches/gsoc15-dependency/base/src/macports1.0/macports_dlist.tcl	2015-08-20 08:24:32 UTC (rev 139552)
@@ -415,7 +415,7 @@
 		return [info exists [set ditem]($key)]
 	} else {
 		set x [lindex [array get $ditem $key] 1]
-		if {[llength $x] > 0 && [lsearch -exact $x [lindex $args 0]] != -1} {
+		if {[llength $x] > 0 && [lindex $args 0] in $x} {
 			return 1
 		} else {
 			return 0

Modified: branches/gsoc15-dependency/base/src/macports1.0/tests/macports.test
===================================================================
--- branches/gsoc15-dependency/base/src/macports1.0/tests/macports.test	2015-08-20 07:23:27 UTC (rev 139551)
+++ branches/gsoc15-dependency/base/src/macports1.0/tests/macports.test	2015-08-20 08:24:32 UTC (rev 139552)
@@ -246,33 +246,46 @@
 test ui_message {
     UI message unit test.
 } -setup {
-    set fd [open $pwd/message w+]
-    set fd2 [open $pwd/log w+]
+    set fd [open $pwd/message w]
+    set fd2 [open $pwd/log w]
     set macports::channels(0) $fd
-    set macports::channels(debuglog) $fd2
     set macports::current_phase test
     set ::debuglog $fd2
 } -body {
-    set res [ui_message 0 prefix phase args]
+    set res [ui_message 0 prefix args]
     close $fd
     close $fd2
-    set fd2 [open $pwd/message r]
-    set line [read $fd2]
+
+    set fd [open $pwd/message r]
+    set fd2 [open $pwd/log r]
+    set line [read $fd]
     if {$line ne "prefixargs\n"} {
-	return "FAIL: wrong message"
+        return "FAIL: wrong message: $line"
     }
+    set line [read $fd2]
+    if {$line ne ":0:test args\n"} {
+        return "FAIL: wrong log: $line"
+    }
+    close $fd
     close $fd2
 
-    set fd [open $pwd/message w+]
-    set fd2 [open $pwd/log w+]
-    set res [ui_message debuglog prefix phase -nonewline arg]
+    set fd [open $pwd/message w]
+    set fd2 [open $pwd/log w]
+    set res [ui_message 0 prefix -nonewline arg]
     close $fd
     close $fd2
+
+    set fd [open $pwd/message r]
     set fd2 [open $pwd/log r]
-    set line [read $fd2]
+    set line [read $fd]
     if {$line ne "prefixarg"} {
-	return "FAIL: wrong message"
+        return "FAIL: wrong message: $line"
     }
+    set line [read $fd2]
+    if {$line ne ":0:test arg"} {
+        return "FAIL: wrong log: $line"
+    }
+    close $fd
     close $fd2
 
     return "UI message successful."

Modified: branches/gsoc15-dependency/base/src/macports1.0/tests/test.tcl
===================================================================
--- branches/gsoc15-dependency/base/src/macports1.0/tests/test.tcl	2015-08-20 07:23:27 UTC (rev 139551)
+++ branches/gsoc15-dependency/base/src/macports1.0/tests/test.tcl	2015-08-20 08:24:32 UTC (rev 139552)
@@ -15,7 +15,7 @@
 }
 
 proc print_help {arg} {
-    if { $arg eq "tests" } {
+    if {$arg eq "tests"} {
         puts "The list of available tests is:"
         cd tests
         set test_suite [glob *.test]
@@ -34,19 +34,19 @@
 
 # Process args
 foreach arg $argv {
-    if { $arg eq "-h" || $arg eq "-help" } {
+    if {$arg eq "-h" || $arg eq "-help"} {
         print_help ""
         exit 0
-    } elseif { $arg eq "-debug" } {
+    } elseif {$arg eq "-debug"} {
         set index [expr {[lsearch $argv $arg] + 1}]
         set level [lindex $argv $index]
-        if { $level >= 0 && $level <= 3 } {
-            lappend arguments -debug $level
+        if {$level >= 0 && $level <= 3} {
+            lappend arguments "-debug" $level
         } else {
             puts "Invalid debug level."
             exit 1
         }
-    } elseif { $arg eq "-t" } {
+    } elseif {$arg eq "-t"} {
         set index [expr {[lsearch $argv $arg] + 1}]
         set test_name [lindex $argv $index]
         set no 0
@@ -74,7 +74,6 @@
 if {$test_name ne ""} {
     set result [exec -ignorestderr $tcl $test_name {*}$arguments]
     puts $result
-
 } else {
     cd tests
     set test_suite [glob *.test]
@@ -84,8 +83,13 @@
         set lastline [lindex [split $result "\n"] end]
 
         if {[lrange [split $lastline "\t"] 1 1] ne "Total"} {
-            set lastline [lindex [split $result "\n"] end-2]
-            set errmsg [lindex [split $result "\n"] end]
+            if {[lrange [split $lastline "\t"] 1 1] eq ""} {
+                set lastline [lindex [split $result "\n"] 0]
+                set errmsg [lindex [split $result "\n"] 2]
+            } else {
+                set lastline [lindex [split $result "\n"] end-2]
+                set errmsg [lindex [split $result "\n"] end]
+            }
         }
 
         set splitresult [split $lastline "\t"]
@@ -95,10 +99,18 @@
         set fail [lindex $splitresult 8]
 
         # Format output
-        if {$total < 10} { set total "0${total}"}
-        if {$pass < 10} { set pass "0${pass}"}
-        if {$skip < 10} { set skip "0${skip}"}
-        if {$fail < 10} { set fail "0${fail}"}
+        if {$total < 10} {
+            set total "0${total}"
+        }
+        if {$pass < 10} {
+            set pass "0${pass}"
+        }
+        if {$skip < 10} {
+            set skip "0${skip}"
+        }
+        if {$fail < 10} {
+            set fail "0${fail}"
+        }
 
         # Check for errors.
         if {$fail != 0} {

Modified: branches/gsoc15-dependency/base/src/package1.0/portarchivefetch.tcl
===================================================================
--- branches/gsoc15-dependency/base/src/package1.0/portarchivefetch.tcl	2015-08-20 07:23:27 UTC (rev 139551)
+++ branches/gsoc15-dependency/base/src/package1.0/portarchivefetch.tcl	2015-08-20 08:24:32 UTC (rev 139552)
@@ -294,7 +294,7 @@
         }
         return 0
     }
-    if {[info exists ports_binary_only] && $ports_binary_only eq "yes"} {
+    if {([info exists ports_binary_only] && $ports_binary_only eq "yes") || [_archive_available]} {
         if {[info exists lastError] && $lastError ne ""} {
             error [msgcat::mc "version @[option version]_[option revision][option portvariants]: %s" $lastError]
         } else {

Modified: branches/gsoc15-dependency/base/src/package1.0/tests/test.tcl
===================================================================
--- branches/gsoc15-dependency/base/src/package1.0/tests/test.tcl	2015-08-20 07:23:27 UTC (rev 139551)
+++ branches/gsoc15-dependency/base/src/package1.0/tests/test.tcl	2015-08-20 08:24:32 UTC (rev 139552)
@@ -15,7 +15,7 @@
 }
 
 proc print_help {arg} {
-    if { $arg eq "tests" } {
+    if {$arg eq "tests"} {
         puts "The list of available tests is:"
         cd tests
         set test_suite [glob *.test]
@@ -54,7 +54,7 @@
         set test_suite [glob *.test]
         foreach test $test_suite {
             if {$test_name ne $test} {
-                set no [expr {$no + 1}]
+                incr no
             }
         }
         if {$no == [llength $test_suite]} {

Modified: branches/gsoc15-dependency/base/src/pextlib1.0/Makefile.in
===================================================================
--- branches/gsoc15-dependency/base/src/pextlib1.0/Makefile.in	2015-08-20 07:23:27 UTC (rev 139551)
+++ branches/gsoc15-dependency/base/src/pextlib1.0/Makefile.in	2015-08-20 08:24:32 UTC (rev 139552)
@@ -7,20 +7,20 @@
 	Pextlib.o strsed.o fgetln.o md5cmd.o setmode.o xinstall.o \
 	fs-traverse.o strcasecmp.o vercomp.o filemap.o base32cmd.o \
 	sha1cmd.o curl.o rmd160cmd.o sha256cmd.o readline.o uid.o \
-	tracelib.o tty.o readdir.o pipe.o flock.o system.o \
+	tracelib.o tty.o readdir.o pipe.o adv-flock.o system.o \
 	mktemp.o realpath.o
 ifneq (@ac_cv_func_strlcat@,yes)
 OBJS+=strlcat.o
 endif
 
-# tracelib.o has an additional dependency
-tracelib.o: ../darwintracelib1.0/sandbox_actions.h
-
 SHLIB_NAME= Pextlib${SHLIB_SUFFIX}
 INSTALLDIR= ${DESTDIR}${TCL_PACKAGE_PATH}/pextlib1.0
 
 include $(srcdir)/../../Mk/macports.tea.mk
 
+# tracelib.o has an additional dependency
+tracelib.o: ../darwintracelib1.0/sandbox_actions.h
+
 CFLAGS+= ${CURL_CFLAGS} ${MD5_CFLAGS} ${READLINE_CFLAGS}
 LIBS+= ${CURL_LIBS} ${MD5_LIBS} ${READLINE_LIBS}
 ifeq ($(shell uname), Darwin)


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

Modified: branches/gsoc15-dependency/base/src/pextlib1.0/Pextlib.c
===================================================================
--- branches/gsoc15-dependency/base/src/pextlib1.0/Pextlib.c	2015-08-20 07:23:27 UTC (rev 139551)
+++ branches/gsoc15-dependency/base/src/pextlib1.0/Pextlib.c	2015-08-20 08:24:32 UTC (rev 139552)
@@ -43,6 +43,8 @@
 #define _BSD_SOURCE
 /* required for clearenv(3)/setenv(3)/unsetenv(3) on OS X */
 #define _DARWIN_C_SOURCE
+/* required for vasprintf(3) on Linux */
+#define _GNU_SOURCE
 
 #include <sys/types.h>
 #include <sys/socket.h>
@@ -89,7 +91,7 @@
 #include "strsed.h"
 #include "readdir.h"
 #include "pipe.h"
-#include "flock.h"
+#include "adv-flock.h"
 #include "system.h"
 #include "mktemp.h"
 #include "realpath.h"
@@ -105,74 +107,78 @@
 #include "setmode.h"
 #endif
 
-static char *
-ui_escape(const char *source)
-{
-    char *d, *dest;
-    const char *s;
-    size_t dlen;
+__attribute__((format(printf, 3, 0)))
+static void ui_message(Tcl_Interp *interp, const char *severity, const char *format, va_list va) {
+    char tclcmd[32];
+    char *buf;
 
-    s = source;
-    dlen = strlen(source) * 2 + 1;
-    d = dest = malloc(dlen);
-    if (dest == NULL) {
-        return NULL;
+    if (vasprintf(&buf, format, va) < 0) {
+        perror("vasprintf");
+        return;
     }
-    while(*s != '\0') {
-        switch(*s) {
-            case '\\':
-            case '}':
-            case '{':
-                *d = '\\';
-                d++;
-                *d = *s;
-                d++;
-                s++;
-                break;
-            case '\n':
-                s++;
-                break;
-            default:
-                *d = *s;
-                d++;
-                s++;
-                break;
-        }
+
+    snprintf(tclcmd, sizeof(tclcmd), "ui_%s $warn", severity);
+
+    Tcl_SetVar(interp, "warn", buf, 0);
+    if (TCL_OK != Tcl_Eval(interp, tclcmd)) {
+        fprintf(stderr, "Error evaluating tcl statement `%s': %s\n", tclcmd, Tcl_GetStringResult(interp));
     }
-    *d = '\0';
-    return dest;
+    Tcl_UnsetVar(interp, "warn", 0);
+    free(buf);
 }
 
-int
-ui_info(Tcl_Interp *interp, char *mesg)
-{
-    const char ui_proc_start[] = "ui_info [subst -nocommands -novariables {";
-    const char ui_proc_end[] = "}]";
-    char *script, *string;
-    size_t scriptlen, len, remaining;
-    int rval;
+__attribute__((format(printf, 2, 3)))
+void ui_error(Tcl_Interp *interp, const char *format, ...) {
+    va_list va;
+    va_start(va, format);
+    ui_message(interp, "error", format, va);
+    va_end(va);
+}
 
-    string = ui_escape(mesg);
-    if (string == NULL)
-        return TCL_ERROR;
+__attribute__((format(printf, 2, 3)))
+void ui_warn(Tcl_Interp *interp, const char *format, ...) {
+    va_list va;
 
-    len = strlen(string);
-    scriptlen = sizeof(ui_proc_start) + len + sizeof(ui_proc_end) - 1;
-    script = malloc(scriptlen);
-    if (script == NULL)
-        return TCL_ERROR;
+    va_start(va, format);
+    ui_message(interp, "warn", format, va);
+    va_end(va);
+}
 
-    memcpy(script, ui_proc_start, sizeof(ui_proc_start));
-    remaining = scriptlen - sizeof(ui_proc_start);
-    strncat(script, string, remaining);
-    remaining -= len;
-    strncat(script, ui_proc_end, remaining);
-    free(string);
-    rval = Tcl_EvalEx(interp, script, -1, 0);
-    free(script);
-    return rval;
+__attribute__((format(printf, 2, 3)))
+void ui_msg(Tcl_Interp *interp, const char *format, ...) {
+    va_list va;
+    va_start(va, format);
+    ui_message(interp, "msg", format, va);
+    va_end(va);
 }
 
+__attribute__((format(printf, 2, 3)))
+void ui_notice(Tcl_Interp *interp, const char *format, ...) {
+    va_list va;
+
+    va_start(va, format);
+    ui_message(interp, "notice", format, va);
+    va_end(va);
+}
+
+__attribute__((format(printf, 2, 3)))
+void ui_info(Tcl_Interp *interp, const char *format, ...) {
+    va_list va;
+
+    va_start(va, format);
+    ui_message(interp, "info", format, va);
+    va_end(va);
+}
+
+__attribute__((format(printf, 2, 3)))
+void ui_debug(Tcl_Interp *interp, const char *format, ...) {
+    va_list va;
+
+    va_start(va, format);
+    ui_message(interp, "debug", format, va);
+    va_end(va);
+}
+
 int StrsedCmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
 {
     char *pattern, *string, *res;
@@ -608,7 +614,7 @@
         return TCL_ERROR;
 
 	Tcl_CreateObjCommand(interp, "system", SystemCmd, NULL, NULL);
-	Tcl_CreateObjCommand(interp, "flock", FlockCmd, NULL, NULL);
+	Tcl_CreateObjCommand(interp, "adv-flock", AdvFlockCmd, NULL, NULL);
 	Tcl_CreateObjCommand(interp, "readdir", ReaddirCmd, NULL, NULL);
 	Tcl_CreateObjCommand(interp, "strsed", StrsedCmd, NULL, NULL);
 	Tcl_CreateObjCommand(interp, "mkstemp", MkstempCmd, NULL, NULL);

Modified: branches/gsoc15-dependency/base/src/pextlib1.0/Pextlib.h
===================================================================
--- branches/gsoc15-dependency/base/src/pextlib1.0/Pextlib.h	2015-08-20 07:23:27 UTC (rev 139551)
+++ branches/gsoc15-dependency/base/src/pextlib1.0/Pextlib.h	2015-08-20 08:24:32 UTC (rev 139552)
@@ -30,4 +30,9 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-int ui_info(Tcl_Interp *, char *);
+void ui_error(Tcl_Interp *interp, const char *format, ...) __attribute__((format(printf, 2, 3)));
+void ui_warn(Tcl_Interp *interp, const char *format, ...) __attribute__((format(printf, 2, 3)));
+void ui_msg(Tcl_Interp *interp, const char *format, ...) __attribute__((format(printf, 2, 3)));
+void ui_notice(Tcl_Interp *interp, const char *format, ...) __attribute__((format(printf, 2, 3)));
+void ui_info(Tcl_Interp *interp, const char *format, ...) __attribute__((format(printf, 2, 3)));
+void ui_debug(Tcl_Interp *interp, const char *format, ...) __attribute__((format(printf, 2, 3)));

Copied: branches/gsoc15-dependency/base/src/pextlib1.0/adv-flock.c (from rev 139551, trunk/base/src/pextlib1.0/adv-flock.c)
===================================================================
--- branches/gsoc15-dependency/base/src/pextlib1.0/adv-flock.c	                        (rev 0)
+++ branches/gsoc15-dependency/base/src/pextlib1.0/adv-flock.c	2015-08-20 08:24:32 UTC (rev 139552)
@@ -0,0 +1,256 @@
+/*
+ * adv-flock.c
+ * $Id$
+ *
+ * Copyright (c) 2009 The MacPorts Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of The MacPorts Project nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+/* needed to get struct sigaction on some platforms */
+#define _XOPEN_SOURCE 500L
+/* the above hides flock on OS X without _DARWIN_C_SOURCE */
+#define _DARWIN_C_SOURCE
+
+#if HAVE_SYS_FILE_H
+#include <sys/file.h>
+#endif
+
+#include <errno.h>
+#include <inttypes.h>
+#include <signal.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <tcl.h>
+
+#include "adv-flock.h"
+
+static volatile int alarmReceived = 0;
+
+static void alarmHandler(int sig UNUSED) {
+    alarmReceived = 1;
+}
+
+int
+AdvFlockCmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
+    static const char errorstr[] = "use one of \"-shared\", \"-exclusive\", or \"-unlock\", and optionally \"-noblock\"";
+    int operation = 0, fd, i, ret, sigret = TCL_OK;
+    int errnoval = 0;
+    int oshared = 0, oexclusive = 0, ounlock = 0, onoblock = 0, retry = 0;
+#if defined(HAVE_LOCKF) && !defined(HAVE_FLOCK)
+    off_t curpos;
+#endif
+    char *res;
+    Tcl_Channel channel;
+    ClientData handle;
+    struct sigaction sa_oldalarm, sa_alarm;
+
+    if (objc < 3 || objc > 4) {
+        Tcl_WrongNumArgs(interp, 1, objv, "channelId switches");
+        return TCL_ERROR;
+    }
+
+    if ((channel = Tcl_GetChannel(interp, Tcl_GetString(objv[1]), NULL)) == NULL) {
+        Tcl_SetResult(interp, "error getting channel, result was NULL", TCL_STATIC);
+        return TCL_ERROR;
+    }
+
+    if (Tcl_GetChannelHandle(channel, TCL_READABLE | TCL_WRITABLE, &handle) != TCL_OK) {
+        Tcl_SetResult(interp, "error getting channel handle", TCL_STATIC);
+        return TCL_ERROR;
+    }
+    fd = (int)(intptr_t)handle;
+
+    for (i = 2; i < objc; i++) {
+        char *arg = Tcl_GetString(objv[i]);
+        if (!strcmp(arg, "-shared")) {
+            oshared = 1;
+        }
+        else if (!strcmp(arg, "-exclusive")) {
+            oexclusive = 1;
+        }
+        else if (!strcmp(arg, "-unlock")) {
+            ounlock = 1;
+        }
+        else if (!strcmp(arg, "-noblock")) {
+            onoblock = 1;
+        }
+    }
+
+    /* verify the arguments */
+
+    if ((oshared + oexclusive + ounlock) != 1) {
+        /* only one of the options should have been specified */
+        Tcl_SetResult(interp, (void *) &errorstr, TCL_STATIC);
+        return TCL_ERROR;
+    }
+
+    if (onoblock && ounlock) {
+        /* should not be specified together */
+        Tcl_SetResult(interp, "-noblock cannot be used with -unlock", TCL_STATIC);
+        return TCL_ERROR;
+    }
+
+    /* (re-)enable SIGALRM so we can use alarm(3) to specify a timeout for the
+     * locking, do some Tcl signal processing and restart the locking to solve
+     * #43388. */
+    memset(&sa_alarm, 0, sizeof(struct sigaction));
+    sigemptyset(&sa_alarm.sa_mask);
+    sa_alarm.sa_flags = 0; /* explicitly don't specify SA_RESTART, we want the
+                              following alarm(3) to interrupt the locking. */
+    sa_alarm.sa_handler = alarmHandler;
+    sigaction(SIGALRM, &sa_alarm, &sa_oldalarm);
+
+    do {
+        /* use a delay of one second */
+        retry = 0;
+        alarmReceived = 0;
+        alarm(1);
+#if HAVE_FLOCK
+        /* prefer flock if present */
+        if (oshared) {
+            operation |= LOCK_SH;
+        }
+
+        if (oexclusive) {
+            operation |= LOCK_EX;
+        }
+
+        if (ounlock) {
+            operation |= LOCK_UN;
+        }
+
+        if (onoblock) {
+            operation |= LOCK_NB;
+        }
+
+        ret = flock(fd, operation);
+        if (ret == -1) {
+            errnoval = errno;
+        }
+#else
+#if HAVE_LOCKF
+        if (ounlock) {
+            operation = F_ULOCK;
+        }
+
+        /* lockf semantics don't map to shared locks. */
+        if (oshared || oexclusive) {
+            if (onoblock) {
+                operation = F_TLOCK;
+            }
+            else {
+                operation = F_LOCK;
+            }
+        }
+
+        curpos = lseek(fd, 0, SEEK_CUR);
+        if (curpos == -1) {
+            Tcl_SetResult(interp, (void *) "Seek error", TCL_STATIC);
+            return TCL_ERROR;
+        }
+
+        ret = lockf(fd, operation, 0); /* lock entire file */
+        if (ret == -1) {
+            errnoval = errno;
+        }
+
+        curpos = lseek(fd, curpos, SEEK_SET);
+        if (curpos == -1) {
+            Tcl_SetResult(interp, (void *) "Seek error", TCL_STATIC);
+            return TCL_ERROR;
+        }
+#else
+#error no available locking implementation
+#endif /* HAVE_LOCKF */
+#endif /* HAVE_FLOCK */
+        /* disable the alarm timer */
+        alarm(0);
+
+        if (ret == -1) {
+            if (oshared || oexclusive) {
+                if (!onoblock && alarmReceived && errnoval == EINTR) {
+                    /* We were trying to lock, the lock was supposed to block,
+                     * it failed with EINTR and we processed a SIGALRM. This
+                     * probably means the call was interrupted by the timer.
+                     * Call Tcl signal processing functions and try again. */
+                    if (Tcl_AsyncReady()) {
+                        sigret = Tcl_AsyncInvoke(interp, TCL_OK);
+                        if (sigret != TCL_OK) {
+                            break;
+                        }
+                    }
+                    retry = 1;
+                    continue;
+                }
+
+                if (onoblock && errnoval == EAGAIN) {
+                    /* The lock wasn't supposed to block, and the lock wasn't
+                     * successful because the lock is taken. On some systems
+                     * EAGAIN == EWOULDBLOCK, but let's play it safe. */
+                    errnoval = EWOULDBLOCK;
+                }
+            }
+        }
+    } while (retry);
+
+    /* Restore the previous handler for SIGALRM */
+    sigaction(SIGALRM, &sa_oldalarm, NULL);
+
+    if (sigret != TCL_OK) {
+        /* We received a signal that raised an error. The file hasn't been
+         * locked. */
+        return sigret;
+    }
+
+    if (ret != 0) {
+        switch (errnoval) {
+            case EAGAIN:
+                res = "EAGAIN";
+                break;
+            case EBADF:
+                res = "EBADF";
+                break;
+            case EINVAL:
+                res = "EINVAL";
+                break;
+            case EOPNOTSUPP:
+                res = "EOPNOTSUPP";
+                break;
+            default:
+                res = strerror(errno);
+                break;
+        }
+        Tcl_SetResult(interp, (void *) res, TCL_STATIC);
+        return TCL_ERROR;
+    }
+    return TCL_OK;
+}

Copied: branches/gsoc15-dependency/base/src/pextlib1.0/adv-flock.h (from rev 139551, trunk/base/src/pextlib1.0/adv-flock.h)
===================================================================
--- branches/gsoc15-dependency/base/src/pextlib1.0/adv-flock.h	                        (rev 0)
+++ branches/gsoc15-dependency/base/src/pextlib1.0/adv-flock.h	2015-08-20 08:24:32 UTC (rev 139552)
@@ -0,0 +1,33 @@
+/*
+ * adv-flock.h
+ * $Id$
+ *
+ * Copyright (c) 2009 The MacPorts Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of The MacPorts Project nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+int AdvFlockCmd(ClientData, Tcl_Interp *, int, Tcl_Obj *CONST objv[]);

Deleted: branches/gsoc15-dependency/base/src/pextlib1.0/flock.c
===================================================================
--- branches/gsoc15-dependency/base/src/pextlib1.0/flock.c	2015-08-20 07:23:27 UTC (rev 139551)
+++ branches/gsoc15-dependency/base/src/pextlib1.0/flock.c	2015-08-20 08:24:32 UTC (rev 139552)
@@ -1,256 +0,0 @@
-/*
- * flock.c
- * $Id$
- *
- * Copyright (c) 2009 The MacPorts Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the name of The MacPorts Project nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#if HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-/* needed to get struct sigaction on some platforms */
-#define _XOPEN_SOURCE 500L
-/* the above hides flock on OS X without _DARWIN_C_SOURCE */
-#define _DARWIN_C_SOURCE
-
-#if HAVE_SYS_FILE_H
-#include <sys/file.h>
-#endif
-
-#include <errno.h>
-#include <inttypes.h>
-#include <signal.h>
-#include <string.h>
-#include <unistd.h>
-
-#include <tcl.h>
-
-#include "flock.h"
-
-static volatile int alarmReceived = 0;
-
-static void alarmHandler(int sig UNUSED) {
-    alarmReceived = 1;
-}
-
-int
-FlockCmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
-    static const char errorstr[] = "use one of \"-shared\", \"-exclusive\", or \"-unlock\", and optionally \"-noblock\"";
-    int operation = 0, fd, i, ret, sigret = TCL_OK;
-    int errnoval = 0;
-    int oshared = 0, oexclusive = 0, ounlock = 0, onoblock = 0, retry = 0;
-#if defined(HAVE_LOCKF) && !defined(HAVE_FLOCK)
-    off_t curpos;
-#endif
-    char *res;
-    Tcl_Channel channel;
-    ClientData handle;
-    struct sigaction sa_oldalarm, sa_alarm;
-
-    if (objc < 3 || objc > 4) {
-        Tcl_WrongNumArgs(interp, 1, objv, "channelId switches");
-        return TCL_ERROR;
-    }
-
-    if ((channel = Tcl_GetChannel(interp, Tcl_GetString(objv[1]), NULL)) == NULL) {
-        Tcl_SetResult(interp, "error getting channel, result was NULL", TCL_STATIC);
-        return TCL_ERROR;
-    }
-
-    if (Tcl_GetChannelHandle(channel, TCL_READABLE | TCL_WRITABLE, &handle) != TCL_OK) {
-        Tcl_SetResult(interp, "error getting channel handle", TCL_STATIC);
-        return TCL_ERROR;
-    }
-    fd = (int)(intptr_t)handle;
-
-    for (i = 2; i < objc; i++) {
-        char *arg = Tcl_GetString(objv[i]);
-        if (!strcmp(arg, "-shared")) {
-            oshared = 1;
-        }
-        else if (!strcmp(arg, "-exclusive")) {
-            oexclusive = 1;
-        }
-        else if (!strcmp(arg, "-unlock")) {
-            ounlock = 1;
-        }
-        else if (!strcmp(arg, "-noblock")) {
-            onoblock = 1;
-        }
-    }
-
-    /* verify the arguments */
-
-    if ((oshared + oexclusive + ounlock) != 1) {
-        /* only one of the options should have been specified */
-        Tcl_SetResult(interp, (void *) &errorstr, TCL_STATIC);
-        return TCL_ERROR;
-    }
-
-    if (onoblock && ounlock) {
-        /* should not be specified together */
-        Tcl_SetResult(interp, "-noblock cannot be used with -unlock", TCL_STATIC);
-        return TCL_ERROR;
-    }
-
-    /* (re-)enable SIGALRM so we can use alarm(3) to specify a timeout for the
-     * locking, do some Tcl signal processing and restart the locking to solve
-     * #43388. */
-    memset(&sa_alarm, 0, sizeof(struct sigaction));
-    sigemptyset(&sa_alarm.sa_mask);
-    sa_alarm.sa_flags = 0; /* explicitly don't specify SA_RESTART, we want the
-                              following alarm(3) to interrupt the locking. */
-    sa_alarm.sa_handler = alarmHandler;
-    sigaction(SIGALRM, &sa_alarm, &sa_oldalarm);
-
-    do {
-        /* use a delay of one second */
-        retry = 0;
-        alarmReceived = 0;
-        alarm(1);
-#if HAVE_FLOCK
-        /* prefer flock if present */
-        if (oshared) {
-            operation |= LOCK_SH;
-        }
-
-        if (oexclusive) {
-            operation |= LOCK_EX;
-        }
-
-        if (ounlock) {
-            operation |= LOCK_UN;
-        }
-
-        if (onoblock) {
-            operation |= LOCK_NB;
-        }
-
-        ret = flock(fd, operation);
-        if (ret == -1) {
-            errnoval = errno;
-        }
-#else
-#if HAVE_LOCKF
-        if (ounlock) {
-            operation = F_ULOCK;
-        }
-
-        /* lockf semantics don't map to shared locks. */
-        if (oshared || oexclusive) {
-            if (onoblock) {
-                operation = F_TLOCK;
-            }
-            else {
-                operation = F_LOCK;
-            }
-        }
-
-        curpos = lseek(fd, 0, SEEK_CUR);
-        if (curpos == -1) {
-            Tcl_SetResult(interp, (void *) "Seek error", TCL_STATIC);
-            return TCL_ERROR;
-        }
-
-        ret = lockf(fd, operation, 0); /* lock entire file */
-        if (ret == -1) {
-            errnoval = errno;
-        }
-
-        curpos = lseek(fd, curpos, SEEK_SET);
-        if (curpos == -1) {
-            Tcl_SetResult(interp, (void *) "Seek error", TCL_STATIC);
-            return TCL_ERROR;
-        }
-#else
-#error no available locking implementation
-#endif /* HAVE_LOCKF */
-#endif /* HAVE_FLOCK */
-        /* disable the alarm timer */
-        alarm(0);
-
-        if (ret == -1) {
-            if (oshared || oexclusive) {
-                if (!onoblock && alarmReceived && errnoval == EINTR) {
-                    /* We were trying to lock, the lock was supposed to block,
-                     * it failed with EINTR and we processed a SIGALRM. This
-                     * probably means the call was interrupted by the timer.
-                     * Call Tcl signal processing functions and try again. */
-                    if (Tcl_AsyncReady()) {
-                        sigret = Tcl_AsyncInvoke(interp, TCL_OK);
-                        if (sigret != TCL_OK) {
-                            break;
-                        }
-                    }
-                    retry = 1;
-                    continue;
-                }
-
-                if (onoblock && errnoval == EAGAIN) {
-                    /* The lock wasn't supposed to block, and the lock wasn't
-                     * successful because the lock is taken. On some systems
-                     * EAGAIN == EWOULDBLOCK, but let's play it safe. */
-                    errnoval = EWOULDBLOCK;
-                }
-            }
-        }
-    } while (retry);
-
-    /* Restore the previous handler for SIGALRM */
-    sigaction(SIGALRM, &sa_oldalarm, NULL);
-
-    if (sigret != TCL_OK) {
-        /* We received a signal that raised an error. The file hasn't been
-         * locked. */
-        return sigret;
-    }
-
-    if (ret != 0) {
-        switch (errnoval) {
-            case EAGAIN:
-                res = "EAGAIN";
-                break;
-            case EBADF:
-                res = "EBADF";
-                break;
-            case EINVAL:
-                res = "EINVAL";
-                break;
-            case EOPNOTSUPP:
-                res = "EOPNOTSUPP";
-                break;
-            default:
-                res = strerror(errno);
-                break;
-        }
-        Tcl_SetResult(interp, (void *) res, TCL_STATIC);
-        return TCL_ERROR;
-    }
-    return TCL_OK;
-}

Deleted: branches/gsoc15-dependency/base/src/pextlib1.0/flock.h
===================================================================
--- branches/gsoc15-dependency/base/src/pextlib1.0/flock.h	2015-08-20 07:23:27 UTC (rev 139551)
+++ branches/gsoc15-dependency/base/src/pextlib1.0/flock.h	2015-08-20 08:24:32 UTC (rev 139552)
@@ -1,33 +0,0 @@
-/*
- * flock.h
- * $Id$
- *
- * Copyright (c) 2009 The MacPorts Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the name of The MacPorts Project nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- * 
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-int FlockCmd(ClientData, Tcl_Interp *, int, Tcl_Obj *CONST objv[]);

Modified: branches/gsoc15-dependency/base/src/pextlib1.0/system.c
===================================================================
--- branches/gsoc15-dependency/base/src/pextlib1.0/system.c	2015-08-20 07:23:27 UTC (rev 139551)
+++ branches/gsoc15-dependency/base/src/pextlib1.0/system.c	2015-08-20 08:24:32 UTC (rev 139552)
@@ -165,6 +165,13 @@
         }
     }
 
+    /* print debug command info */
+    if (path) {
+        ui_debug(interp, "system -W %s: %s", path, cmdstring);
+    } else {
+        ui_debug(interp, "system: %s", cmdstring);
+    }
+
     /* check if and how we should use sandbox-exec */
     sandbox = check_sandboxing(interp, &sandbox_exec_path, &profilestr);
 
@@ -288,10 +295,7 @@
                     pos = 0;
                 }
 
-                if (ui_info(interp, sbuf) != TCL_OK) {
-                    read_failed = 1;
-                    break;
-                }
+                ui_info(interp, "%s", sbuf);
             }
             fclose(pdes);
         } else {
@@ -307,21 +311,11 @@
         if (WEXITSTATUS(ret) == 0) {
             status = TCL_OK;
         } else {
-            char *errorstr;
-            size_t errorstrlen;
             Tcl_Obj* errorCode;
 
             /* print error */
-            /* get buffer large enough for additional message or the error code */
-            errorstrlen = strlen(cmdstring) + strlen("Command failed: ") + 12;
-            errorstr = malloc(errorstrlen);
-            if (errorstr) {
-                snprintf(errorstr, errorstrlen, "Command failed: %s", cmdstring);
-                ui_info(interp, errorstr);
-                snprintf(errorstr, errorstrlen, "Exit code: %d", WEXITSTATUS(ret));
-                ui_info(interp, errorstr);
-                free(errorstr);
-            }
+            ui_info(interp, "Command failed: %s", cmdstring);
+            ui_info(interp, "Exit code: %d", WEXITSTATUS(ret));
 
             /* set errorCode [list CHILDSTATUS <pid> <code>] */
             errorCode = Tcl_NewListObj(0, NULL);

Modified: branches/gsoc15-dependency/base/src/pextlib1.0/tracelib.c
===================================================================
--- branches/gsoc15-dependency/base/src/pextlib1.0/tracelib.c	2015-08-20 07:23:27 UTC (rev 139551)
+++ branches/gsoc15-dependency/base/src/pextlib1.0/tracelib.c	2015-08-20 08:24:32 UTC (rev 139552)
@@ -63,6 +63,8 @@
 
 #include "tracelib.h"
 
+#include "Pextlib.h"
+
 #include "strlcat.h"
 
 #ifdef HAVE_TRACEMODE_SUPPORT
@@ -106,12 +108,6 @@
 } sandbox_violation_t;
 static void sandbox_violation(int sock, const char *path, sandbox_violation_t type);
 
-static void ui_warn(const char *format, ...) __printflike(1, 2);
-#if 0
-static void ui_info(const char *format, ...) __printflike(1, 2);
-#endif
-static void ui_error(const char *format, ...) __printflike(1, 2);
-
 #define MAX_SOCKETS (1024)
 #define BUFSIZE     (4096)
 
@@ -420,7 +416,7 @@
     reg_error error;
 
     if (NULL == (reg = registry_for(interp, reg_attached))) {
-        ui_error("%s", Tcl_GetStringResult(interp));
+        ui_error(interp, "%s", Tcl_GetStringResult(interp));
         /* send unexpected output to make the build fail */
         answer(sock, "#");
     }
@@ -438,7 +434,7 @@
     /* find the port's name to compare with out list */
     if (!reg_entry_propget(&entry, "name", &port, &error)) {
         /* send unexpected output to make the build fail */
-        ui_error("%s", error.description);
+        ui_error(interp, "%s", error.description);
         answer(sock, "#");
     }
 
@@ -455,50 +451,6 @@
     answer(sock, "!");
 }
 
-__printflike(2, 0)
-static void ui_msg(const char *severity, const char *format, va_list va) {
-    char buf[1024], tclcmd[32];
-
-    vsnprintf(buf, sizeof(buf), format, va);
-
-    snprintf(tclcmd, sizeof(tclcmd), "ui_%s $warn", severity);
-
-    Tcl_SetVar(interp, "warn", buf, 0);
-    if (TCL_OK != Tcl_Eval(interp, tclcmd)) {
-        fprintf(stderr, "Error evaluating tcl statement `%s': %s\n", tclcmd, Tcl_GetStringResult(interp));
-    }
-    Tcl_UnsetVar(interp, "warn", 0);
-
-}
-
-__printflike(1, 2)
-static void ui_warn(const char *format, ...) {
-    va_list va;
-
-    va_start(va, format);
-    ui_msg("warn", format, va);
-    va_end(va);
-}
-
-#if 0
-__printflike(1, 2)
-static void ui_info(const char *format, ...) {
-    va_list va;
-
-    va_start(va, format);
-    ui_msg("info", format, va);
-    va_end(va);
-}
-#endif
-
-__printflike(1, 2)
-static void ui_error(const char *format, ...) {
-    va_list va;
-    va_start(va, format);
-    ui_msg("error", format, va);
-    va_end(va);
-}
-
 static int TracelibOpenSocketCmd(Tcl_Interp *in) {
     struct sockaddr_un sun;
     struct rlimit rl;
@@ -520,7 +472,7 @@
     /* raise the limit of open files to the maximum from the default soft limit
      * of 256 */
     if (getrlimit(RLIMIT_NOFILE, &rl) == -1) {
-        ui_warn("getrlimit failed (%d), skipping setrlimit", errno);
+        ui_warn(interp, "getrlimit failed (%d), skipping setrlimit", errno);
     } else {
 #ifdef OPEN_MAX
         if (rl.rlim_max > OPEN_MAX) {
@@ -529,7 +481,7 @@
 #endif
         rl.rlim_cur = rl.rlim_max;
         if (setrlimit(RLIMIT_NOFILE, &rl) == -1) {
-            ui_warn("setrlimit failed (%d)", errno);
+            ui_warn(interp, "setrlimit failed (%d)", errno);
         }
     }
 
@@ -720,7 +672,7 @@
 
                     flags = fcntl(s, F_GETFL, 0);
                     if (-1 == fcntl(s, F_SETFL, flags & ~O_NONBLOCK)) {
-                        ui_warn("tracelib: couldn't mark socket as blocking");
+                        ui_warn(interp, "tracelib: couldn't mark socket as blocking");
                         close(s);
                         continue;
                     }
@@ -728,7 +680,7 @@
                     /* register the new socket in the kqueue */
                     EV_SET(&kev, s, EVFILT_READ, EV_ADD | EV_RECEIPT, 0, 0, NULL);
                     if (1 != kevent(kq, &kev, 1, &kev, 1, NULL)) {
-                        ui_warn("tracelib: error adding socket to kqueue");
+                        ui_warn(interp, "tracelib: error adding socket to kqueue");
                         close(s);
                         continue;
                     }
@@ -736,7 +688,7 @@
                      * always be returned. When a filter is successfully added, the data field
                      * will be zero. */
                     if ((kev.flags & EV_ERROR) == 0 || ((kev.flags & EV_ERROR) > 0 && kev.data != 0)) {
-                        ui_warn("tracelib: error adding socket to kqueue");
+                        ui_warn(interp, "tracelib: error adding socket to kqueue");
                         close(s);
                         continue;
                     }

Modified: branches/gsoc15-dependency/base/src/pextlib1.0/xinstall.c
===================================================================
--- branches/gsoc15-dependency/base/src/pextlib1.0/xinstall.c	2015-08-20 07:23:27 UTC (rev 139551)
+++ branches/gsoc15-dependency/base/src/pextlib1.0/xinstall.c	2015-08-20 08:24:32 UTC (rev 139552)
@@ -310,10 +310,7 @@
 			return TCL_ERROR;
 		}
 		else {
-			char msg[255];
-
-			snprintf(msg, sizeof msg, "%s: chdir(%s)\n", funcname, curdir);
-			ui_info(interp, msg);
+                        ui_info(interp, "%s: chdir(%s)\n", funcname, curdir);
 		}
 	}
 
@@ -443,9 +440,6 @@
 	int tempcopy, temp_fd, to_fd = 0;
 	char backup[MAXPATHLEN], *p, pathbuf[MAXPATHLEN], tempfile[MAXPATHLEN];
 
-        /* message contains function name, two paths and a little bit extra formatting */
-        char msg[MAXPATHLEN * 2 + 32];
-
 	files_match = 0;
 
 	/* If try to install NULL file to a directory, fails. */
@@ -547,8 +541,7 @@
 				Tcl_SetResult(interp, errmsg, TCL_VOLATILE);
 				return TCL_ERROR;
 			}
-			snprintf(msg, sizeof msg, "%s: %s -> %s\n", funcname, from_name, to_name);
-			ui_info(interp, msg);
+			ui_info(interp, "%s: %s -> %s\n", funcname, from_name, to_name);
 		}
 		if (!devnull) {
 			if (copy(interp, from_fd, from_name, to_fd,
@@ -650,8 +643,7 @@
 				Tcl_SetResult(interp, errmsg, TCL_VOLATILE);
 				return TCL_ERROR;
 			}
-			snprintf(msg, sizeof msg, "%s: %s -> %s\n", funcname, to_name, backup);
-			ui_info(interp, msg);
+                        ui_info(interp, "%s: %s -> %s\n", funcname, to_name, backup);
 			if (rename(to_name, backup) < 0) {
 				char errmsg[255];
 
@@ -664,8 +656,7 @@
 				return TCL_ERROR;
 			}
 		}
-		snprintf(msg, sizeof msg, "%s: %s -> %s\n", funcname, from_name, to_name);
-		ui_info(interp, msg);
+                ui_info(interp, "%s: %s -> %s\n", funcname, from_name, to_name);
 		if (rename(tempfile, to_name) < 0) {
 			char errmsg[255];
 
@@ -885,7 +876,6 @@
 	char backup[MAXPATHLEN];
 	int saved_errno = 0;
 	int newfd;
-	char msg[256];
 
 	if (target) {
 		/*
@@ -909,8 +899,7 @@
 				return -1;
 			}
 			(void)snprintf(backup, MAXPATHLEN, "%s%s", path, suffix);
-			snprintf(msg, sizeof msg, "%s: %s -> %s\n", funcname, path, backup);
-			ui_info(interp, msg);
+                        ui_info(interp, "%s: %s -> %s\n", funcname, path, backup);
 			if (rename(path, backup) < 0) {
 				char errmsg[255];
 
@@ -1068,10 +1057,7 @@
 					return TCL_ERROR;
 				}
 				else {
-					char msg[255];
-
-					snprintf(msg, sizeof msg, "%s: mkdir %s\n", funcname, path);
-					ui_info(interp, msg);
+                                        ui_info(interp, "%s: mkdir %s\n", funcname, path);
 				}
 			} else if (!S_ISDIR(sb.st_mode)) {
 				char errmsg[255];

Modified: branches/gsoc15-dependency/base/src/port/port.tcl
===================================================================
--- branches/gsoc15-dependency/base/src/port/port.tcl	2015-08-20 07:23:27 UTC (rev 139551)
+++ branches/gsoc15-dependency/base/src/port/port.tcl	2015-08-20 08:24:32 UTC (rev 139552)
@@ -1870,9 +1870,6 @@
         global env boot_env
         array unset env_save; array set env_save [array get env]
         array unset env *
-        if {${macports::macosx_version} == "10.5"} {
-            unsetenv *
-        }
         array set env [array get boot_env]
 
         if [catch {system -nodup [list ${macports::autoconf::man_path} $pagepath]} result] {
@@ -1883,9 +1880,6 @@
 
         # Restore internal MacPorts environment
         array unset env *
-        if {${macports::macosx_version} == "10.5"} {
-            unsetenv *
-        }
         array set env [array get env_save]
     } else {
         ui_error "Sorry, no help for this topic is available."
@@ -2761,7 +2755,7 @@
 
 
 proc action_upgrade { action portlist opts } {
-    if {[require_portlist portlist "yes"] || ([prefix_unwritable] && ![macports::global_option_isset ports_dryrun])} {
+    if {[require_portlist portlist "yes"] || (![macports::global_option_isset ports_dryrun] && [prefix_unwritable])} {
         return 1
     }
 
@@ -3172,7 +3166,7 @@
             return 1
         }
     }
-    if {[prefix_unwritable]} {
+    if {![macports::global_option_isset ports_dryrun] && [prefix_unwritable]} {
         return 1
     }
 
@@ -3927,9 +3921,6 @@
                     # may want stuff from it as well, like TERM.
                     array unset env_save; array set env_save [array get env]
                     array unset env *
-                    if {${macports::macosx_version} eq "10.5"} {
-                        unsetenv *
-                    }
                     array set env [array get boot_env]
                     
                     # Find an editor to edit the portfile
@@ -3958,9 +3949,6 @@
                     
                     # Restore internal MacPorts environment
                     array unset env *
-                    if {${macports::macosx_version} eq "10.5"} {
-                        unsetenv *
-                    }
                     array set env [array get env_save]
                 }
 
@@ -4061,7 +4049,7 @@
     if {[require_portlist portlist]} {
         return 1
     }
-    if {($action eq "install" || $action eq "archive") && [prefix_unwritable] && ![macports::global_option_isset ports_dryrun]} {
+    if {($action eq "install" || $action eq "archive") && ![macports::global_option_isset ports_dryrun] && [prefix_unwritable]} {
         return 1
     }
     
@@ -4172,6 +4160,21 @@
 }
 
 
+proc action_mirror { action portlist opts } {
+    global macports::portdbpath
+    # handle --new option here so we only delete the db once
+    array set options $opts
+    set mirror_filemap_path [file join $macports::portdbpath distfiles_mirror.db]
+    if {[info exists options(ports_mirror_new)]
+        && [string is true -strict $options(ports_mirror_new)]
+        && [file exists $mirror_filemap_path]} {
+            # Trash the map file if it existed.
+            file delete -force $mirror_filemap_path
+    }
+
+    action_target $action $portlist $opts
+}
+
 proc action_exit { action portlist opts } {
     # Return a semaphore telling the main loop to quit
     return -999
@@ -4259,6 +4262,8 @@
     \
     uninstall   [list action_uninstall      [ACTION_ARGS_PORTS]] \
     \
+    mirror      [list action_mirror         [ACTION_ARGS_PORTS]] \
+    \
     installed   [list action_installed      [ACTION_ARGS_PORTS]] \
     outdated    [list action_outdated       [ACTION_ARGS_PORTS]] \
     contents    [list action_contents       [ACTION_ARGS_PORTS]] \
@@ -4295,7 +4300,6 @@
     lint        [list action_target         [ACTION_ARGS_PORTS]] \
     livecheck   [list action_target         [ACTION_ARGS_PORTS]] \
     distcheck   [list action_target         [ACTION_ARGS_PORTS]] \
-    mirror      [list action_target         [ACTION_ARGS_PORTS]] \
     load        [list action_target         [ACTION_ARGS_PORTS]] \
     unload      [list action_target         [ACTION_ARGS_PORTS]] \
     reload      [list action_target         [ACTION_ARGS_PORTS]] \

Modified: branches/gsoc15-dependency/base/src/port1.0/portchecksum.tcl
===================================================================
--- branches/gsoc15-dependency/base/src/port1.0/portchecksum.tcl	2015-08-20 07:23:27 UTC (rev 139551)
+++ branches/gsoc15-dependency/base/src/port1.0/portchecksum.tcl	2015-08-20 08:24:32 UTC (rev 139552)
@@ -84,7 +84,7 @@
     if {[llength $all_dist_files] == 1
         && [expr {$nb_checksum % 2}] == 0
         && [expr {$nb_checksum / 2}] <= $checksum_types_count
-        && [lsearch -exact $checksum_types [lindex $checksums_str 0]] >= 0} {
+        && [lindex $checksums_str 0] in $checksum_types} {
         # Convert to format #2
         set checksums_str [linsert $checksums_str 0 [lindex $all_dist_files 0]]
         # We increased the size.
@@ -113,7 +113,7 @@
             incr ix_checksum
             while {1} {
                 set checksum_type [lindex $checksums_str $ix_checksum]
-                if {[lsearch -exact $checksum_types $checksum_type] >= 0} {
+                if {$checksum_type in $checksum_types} {
                     # append the type and the value.
                     incr ix_checksum
                     set checksum_value [lindex $checksums_str $ix_checksum]
@@ -281,7 +281,7 @@
                         ui_debug "[format [msgcat::mc "Correct (%s) checksum for %s"] $type $distfile]"
                     } else {
                         ui_error "[format [msgcat::mc "Checksum (%s) mismatch for %s"] $type $distfile]"
-                        ui_info_fetch "[format [msgcat::mc "Portfile checksum: %s %s %s"] $distfile $type $sum]"
+                        ui_info "[format [msgcat::mc "Portfile checksum: %s %s %s"] $distfile $type $sum]"
                         ui_info "[format [msgcat::mc "Distfile checksum: %s %s %s"] $distfile $type $calculated_sum]"
 
                         # Raise the failure flag

Modified: branches/gsoc15-dependency/base/src/port1.0/portconfigure.tcl
===================================================================
--- branches/gsoc15-dependency/base/src/port1.0/portconfigure.tcl	2015-08-20 07:23:27 UTC (rev 139551)
+++ branches/gsoc15-dependency/base/src/port1.0/portconfigure.tcl	2015-08-20 08:24:32 UTC (rev 139552)
@@ -325,16 +325,16 @@
     }
     set ret {}
     foreach arch $archs {
-        if {[lsearch -exact $supported_archs $arch] != -1} {
+        if {$arch in $supported_archs} {
             set add_arch $arch
-        } elseif {$arch eq "x86_64" && [lsearch -exact $supported_archs "i386"] != -1} {
+        } elseif {$arch eq "x86_64" && "i386" in $supported_archs} {
             set add_arch "i386"
-        } elseif {$arch eq "ppc64" && [lsearch -exact $supported_archs "ppc"] != -1} {
+        } elseif {$arch eq "ppc64" && "ppc" in $supported_archs} {
             set add_arch "ppc"
         } else {
             continue
         }
-        if {[lsearch -exact $ret $add_arch] == -1} {
+        if {$add_arch ni $ret} {
             lappend ret $add_arch
         }
     }
@@ -759,7 +759,7 @@
         # add SDK flags if cross-compiling (or universal on ppc tiger)
         if {${configure.sdkroot} ne ""} {
             foreach env_var {CPPFLAGS CFLAGS CXXFLAGS OBJCFLAGS OBJCXXFLAGS} {
-                append_to_environment_value configure $env_var -isysroot ${configure.sdkroot}
+                append_to_environment_value configure $env_var -isysroot${configure.sdkroot}
             }
             append_to_environment_value configure "LDFLAGS" -Wl,-syslibroot,${configure.sdkroot}
         }

Modified: branches/gsoc15-dependency/base/src/port1.0/portdestroot.tcl
===================================================================
--- branches/gsoc15-dependency/base/src/port1.0/portdestroot.tcl	2015-08-20 07:23:27 UTC (rev 139551)
+++ branches/gsoc15-dependency/base/src/port1.0/portdestroot.tcl	2015-08-20 08:24:32 UTC (rev 139552)
@@ -341,7 +341,7 @@
                         if {$pfile eq "." || $pfile eq ".."} {
                             continue
                         }
-                        if {[lsearch -exact $prefixPaths $pfile] == -1} {
+                        if {$pfile ni $prefixPaths} {
                             ui_warn "violation by [file join $dfile $pfile]"
                             set mtree_violation "yes"
                         }

Modified: branches/gsoc15-dependency/base/src/port1.0/portlint.tcl
===================================================================
--- branches/gsoc15-dependency/base/src/port1.0/portlint.tcl	2015-08-20 07:23:27 UTC (rev 139551)
+++ branches/gsoc15-dependency/base/src/port1.0/portlint.tcl	2015-08-20 08:24:32 UTC (rev 139552)
@@ -341,7 +341,7 @@
            maintainers license homepage master_sites checksums patchfiles \
            depends_fetch depends_extract depends_lib depends_build \
            depends_run distfiles fetch.type lint_portsystem lint_platforms \
-           lint_required lint_optional
+           lint_required lint_optional replaced_by conflicts
     set portarch [get_canonical_archs]
 
     if (!$seen_portsystem) {
@@ -403,7 +403,7 @@
 
     if {[info exists platforms]} {
         foreach platform $platforms {
-            if {[lsearch -exact $lint_platforms $platform] == -1} {
+            if {$platform ni $lint_platforms} {
                 ui_error "Unknown platform: $platform"
                 incr errors
             } else {
@@ -450,7 +450,7 @@
 
             if {![info exists variantdesc] || $variantdesc eq ""} {
                 # don't warn about missing descriptions for global variants
-                if {[lsearch -exact $local_variants $variantname] != -1 &&
+                if {$variantname in $local_variants &&
                     [variant_desc $porturl $variantname] eq ""} {
                     ui_warn "Variant $variantname does not have a description"
                     incr warnings
@@ -538,6 +538,45 @@
         }
     }
 
+    if {[info exists replaced_by]} {
+        if {[regexp {[^[:alnum:]_.-]} $replaced_by]} {
+            ui_error "replaced_by should be a single port name, invalid value: $replaced_by"
+            incr errors
+        } else {
+            if {[catch {set res [mport_lookup $replaced_by]} error]} {
+                global errorInfo
+                ui_debug "$errorInfo"
+            }
+            if {$res eq ""} {
+                ui_error "replaced_by references unknown port: $replaced_by"
+                incr errors
+            } else {
+                ui_info "OK: replaced_by $replaced_by"
+            }
+        }
+    }
+
+    if {[info exists conflicts]} {
+        foreach cport $conflicts {
+            if {[regexp {[^[:alnum:]_.-]} $cport]} {
+                ui_error "conflicts lists invalid value, should be port name: $cport"
+                incr errors
+                continue
+            }
+            if {[catch {set res [mport_lookup $cport]} error]} {
+                global errorInfo
+                ui_debug "$errorInfo"
+                continue
+            }
+            if {$res eq ""} {
+                ui_error "conflicts references unknown port: $cport"
+                incr errors
+            } else {
+                ui_info "OK: conflicts $cport"
+            }
+        }
+    }
+
     if {[regexp "^(.+)nomaintainer(@macports.org)?(.+)$" $maintainers] } {
         ui_error "Using nomaintainer together with other maintainer"
         incr errors

Modified: branches/gsoc15-dependency/base/src/port1.0/portlivecheck.tcl
===================================================================
--- branches/gsoc15-dependency/base/src/port1.0/portlivecheck.tcl	2015-08-20 07:23:27 UTC (rev 139551)
+++ branches/gsoc15-dependency/base/src/port1.0/portlivecheck.tcl	2015-08-20 08:24:32 UTC (rev 139552)
@@ -130,7 +130,7 @@
             }
         }
     }
-    if {[lsearch -exact [split $available_types "|"] ${livecheck.type}] != -1} {
+    if {${livecheck.type} in [split $available_types "|"]} {
         # Load the defaults from _resources/port1.0/livecheck/${livecheck.type}.tcl.
         set defaults_file "$types_dir/${livecheck.type}.tcl"
         ui_debug "Loading the defaults from '$defaults_file'"

Modified: branches/gsoc15-dependency/base/src/port1.0/portmirror.tcl
===================================================================
--- branches/gsoc15-dependency/base/src/port1.0/portmirror.tcl	2015-08-20 07:23:27 UTC (rev 139551)
+++ branches/gsoc15-dependency/base/src/port1.0/portmirror.tcl	2015-08-20 08:24:32 UTC (rev 139552)
@@ -53,28 +53,19 @@
 # It also records the path in a database.
 
 proc portmirror::mirror_main {args} {
-    global fetch.type mirror_filemap ports_mirror_new portdbpath
+    global fetch.type mirror_filemap portdbpath
 
     set mirror_filemap_path [file join $portdbpath distfiles_mirror.db]
-    if {![info exists mirror_filemap]
-        && [info exists ports_mirror_new]
-        && $ports_mirror_new eq "yes"
-        && [file exists $mirror_filemap_path]} {
-        # Trash the map file if it existed.
-        file delete -force $mirror_filemap_path
-    }
-
     filemap open mirror_filemap $mirror_filemap_path
 
     # Check the distfiles if it's a regular fetch phase.
-    if {"${fetch.type}" == "standard"} {
+    if {${fetch.type} eq "standard"} {
         # fetch the files.
         portfetch::fetch_init $args
         portfetch::fetch_start $args
         portfetch::fetch_main $args
 
         # checksum the files.
-        #checksum_start
         if {[catch {portchecksum::checksum_main $args}]} {
             # delete the files.
             portfetch::fetch_deletefiles $args

Modified: branches/gsoc15-dependency/base/src/port1.0/porttrace.tcl
===================================================================
--- branches/gsoc15-dependency/base/src/port1.0/porttrace.tcl	2015-08-20 07:23:27 UTC (rev 139551)
+++ branches/gsoc15-dependency/base/src/port1.0/porttrace.tcl	2015-08-20 08:24:32 UTC (rev 139552)
@@ -263,9 +263,6 @@
 
 		foreach var {DYLD_INSERT_LIBRARIES DARWINTRACE_LOG} {
 			array unset env $var
-			if {$macosx_version eq "10.5"} {
-				unsetenv $var
-			}
 		}
 
 		# Kill socket

Modified: branches/gsoc15-dependency/base/src/port1.0/portuninstall.tcl
===================================================================
--- branches/gsoc15-dependency/base/src/port1.0/portuninstall.tcl	2015-08-20 07:23:27 UTC (rev 139551)
+++ branches/gsoc15-dependency/base/src/port1.0/portuninstall.tcl	2015-08-20 08:24:32 UTC (rev 139552)
@@ -49,8 +49,8 @@
 default uninstall.asroot no
 
 proc portuninstall::uninstall_start {args} {
-    global prefix
-    if {![file writable $prefix] || ([getuid] == 0 && [geteuid] != 0)} {
+    global prefix ports_dryrun
+    if {(![file writable $prefix] && ![tbool ports_dryrun]) || ([getuid] == 0 && [geteuid] != 0)} {
         # if install location is not writable, need root privileges
         elevateToRoot "uninstall"
     }

Modified: branches/gsoc15-dependency/base/src/port1.0/portutil.tcl
===================================================================
--- branches/gsoc15-dependency/base/src/port1.0/portutil.tcl	2015-08-20 07:23:27 UTC (rev 139551)
+++ branches/gsoc15-dependency/base/src/port1.0/portutil.tcl	2015-08-20 08:24:32 UTC (rev 139552)
@@ -367,7 +367,6 @@
         }
     }
 
-    ui_debug "Assembled command: '$cmdstring'"
     return $cmdstring
 }
 
@@ -450,7 +449,6 @@
     array set env [array get ${varprefix}.env_array]
     # Call the command.
     set fullcmdstring "$command_prefix $cmdstring $command_suffix"
-    ui_debug "Executing command line: $fullcmdstring"
     set code [catch {system {*}$notty {*}$nice $fullcmdstring} result]
     # Save variables in order to re-throw the same error code.
     set errcode $::errorCode
@@ -461,9 +459,6 @@
 
     # Restore the environment.
     array unset env *
-    if {$macosx_version eq "10.5"} {
-        unsetenv *
-    }
     array set env [array get saved_env]
 
     # Return as if system had been called directly.
@@ -702,8 +697,7 @@
 # determine if a variant exists.
 proc variant_exists {name} {
     global PortInfo
-    if {[info exists PortInfo(variants)] &&
-      [lsearch -exact $PortInfo(variants) $name] >= 0} {
+    if {[info exists PortInfo(variants)] && $name in $PortInfo(variants)} {
         return 1
     }
 
@@ -814,7 +808,7 @@
 proc subport {subname body} {
     global subport name PortInfo
     if {$subport eq $name && $subname ne $name && 
-        (![info exists PortInfo(subports)] || [lsearch -exact $PortInfo(subports) $subname] == -1)} {
+        (![info exists PortInfo(subports)] || $subname ni $PortInfo(subports))} {
         lappend PortInfo(subports) $subname
     }
     if {[string equal -nocase $subname $subport]} {
@@ -893,13 +887,11 @@
 
 # tbool (testbool)
 # If the variable exists in the calling procedure's namespace
-# and is set to "yes", return 1. Otherwise, return 0
+# and is set to a boolean true value, return 1. Otherwise, return 0
 proc tbool {key} {
     upvar $key $key
     if {[info exists $key]} {
-        if {[string equal -nocase [set $key] "yes"]} {
-            return 1
-        }
+        return [string is true -strict [set $key]]
     }
     return 0
 }
@@ -1023,9 +1015,6 @@
                     set env(LC_CTYPE) $oldlocale
                 } else {
                     unset env(LC_CTYPE)
-                    if {$macosx_version eq "10.5"} {
-                        unsetenv LC_CTYPE
-                    }
                 }
             }
             close $tmpfd
@@ -1037,9 +1026,6 @@
                 set env(LC_CTYPE) $oldlocale
             } else {
                 unset env(LC_CTYPE)
-                if {$macosx_version eq "10.5"} {
-                    unsetenv LC_CTYPE
-                }
             }
         }
         close $tmpfd
@@ -1397,7 +1383,7 @@
             }
 
             # Of course, if this is a dry run, don't do the task:
-            if {[info exists ports_dryrun] && $ports_dryrun eq "yes" && [lsearch -exact $dryrun_allow_targets $targetname] == -1} {
+            if {[tbool ports_dryrun] && $targetname ni $dryrun_allow_targets} {
                 # only one message per portname
                 if {$portname != $ports_dry_last_skipped} {
                     ui_notice "For $portname: skipping $targetname (dry run)"
@@ -1428,8 +1414,7 @@
 
                 #start tracelib
                 if {($result ==0
-                  && [info exists ports_trace]
-                  && $ports_trace eq "yes"
+                  && [tbool ports_trace]
                   && $target ne "clean"
                   && $target ne "uninstall")} {
                     # uninstall will open a portfile from registry and call
@@ -1492,11 +1477,9 @@
 
                         # If portname is empty, the dependency is already satisfied by other means,
                         # for example a bin: dependency on a file not installed by MacPorts
-                        if {$name ne ""} {
-                            if {[lsearch -exact $deplist $name] == -1} {
-                                lappend deplist $name
-                                set deplist [recursive_collect_deps $name $deplist]
-                            }
+                        if {$name ne "" && $name ni $deplist} {
+                            lappend deplist $name
+                            set deplist [recursive_collect_deps $name $deplist]
                         }
                     }
 
@@ -1541,8 +1524,7 @@
                 }
 
                 # Check dependencies & file creations outside workpath.
-                if {[info exists ports_trace]
-                  && $ports_trace eq "yes"
+                if {[tbool ports_trace]
                   && $target ne "clean"
                   && $target ne "uninstall"} {
 
@@ -1614,9 +1596,6 @@
     set env(HOME) $savedhome
     if {[info exists env(TMPDIR)]} {
         unset env(TMPDIR)
-        if {$macosx_version eq "10.5"} {
-            unsetenv TMPDIR
-        }
     }
 
     return $result
@@ -1633,7 +1612,7 @@
 
     foreach item $deplist {
         set name [lindex $item 0]
-        if {[lsearch -exact $depsfound $name] == -1} {
+        if {$name ni $depsfound} {
             lappend depsfound $name
             set depsfound [recursive_collect_deps $name $depsfound]
         }
@@ -1836,10 +1815,10 @@
 
     set fd [open $statefile a+]
     if {![tbool ports_dryrun]} {
-        if {[catch {flock $fd -exclusive -noblock} result]} {
+        if {[catch {adv-flock $fd -exclusive -noblock} result]} {
             if {"$result" == "EAGAIN"} {
                 ui_notice "Waiting for lock on $statefile"
-                flock $fd -exclusive
+                adv-flock $fd -exclusive
             } elseif {"$result" == "EOPNOTSUPP"} {
                 # Locking not supported, just return
                 return $fd
@@ -2052,7 +2031,7 @@
     array set requested_variations [array get upvariations]
     foreach key [array names upvariations *] {
         if {![info exists PortInfo(variants)] ||
-            [lsearch $PortInfo(variants) $key] == -1} {
+            $key ni $PortInfo(variants)} {
             ui_debug "Requested variant $upvariations($key)$key is not provided by port $portname."
             array unset upvariations $key
         }
@@ -2139,17 +2118,16 @@
             break
         }
     }
-    if { $statereq &&
-        !([info exists ports_force] && $ports_force eq "yes")} {
+    if {$statereq && ![tbool ports_force]} {
 
         set state_fd [open_statefile]
 
         array set oldvariations {}
         if {[check_statefile_variants variations oldvariations $state_fd]} {
-            ui_error "Requested variants \"[canonicalize_variants [array get variations]]\" do not match original selection \"[canonicalize_variants [array get oldvariations]]\"."
-            ui_error "Please use the same variants again, perform 'port clean [option subport]' or specify the force option (-f)."
+            ui_error "Requested variants \"[canonicalize_variants [array get variations]]\" do not match those the build was started with: \"[canonicalize_variants [array get oldvariations]]\"."
+            ui_error "Please use the same variants again, or run 'port clean [option subport]' first to remove the existing partially completed build."
             set result 1
-        } elseif {!([info exists ports_dryrun] && $ports_dryrun eq "yes")} {
+        } elseif {![tbool ports_dryrun]} {
             # Write variations out to the statefile
             foreach key [array names variations *] {
                 write_statefile variant $variations($key)$key $state_fd

Modified: branches/gsoc15-dependency/base/src/port1.0/tests/test.tcl
===================================================================
--- branches/gsoc15-dependency/base/src/port1.0/tests/test.tcl	2015-08-20 07:23:27 UTC (rev 139551)
+++ branches/gsoc15-dependency/base/src/port1.0/tests/test.tcl	2015-08-20 08:24:32 UTC (rev 139552)
@@ -54,7 +54,7 @@
         set test_suite [glob *.test]
         foreach test $test_suite {
             if {$test_name ne $test} {
-                set no [expr {$no + 1}]
+                incr no
             }
         }
         if {$no == [llength $test_suite]} {
@@ -83,8 +83,13 @@
         set lastline [lindex [split $result "\n"] end]
 
         if {[lrange [split $lastline "\t"] 1 1] ne "Total"} {
-            set lastline [lindex [split $result "\n"] end-2]
-            set errmsg [lindex [split $result "\n"] end]
+            if {[lrange [split $lastline "\t"] 1 1] eq ""} {
+                set lastline [lindex [split $result "\n"] 0]
+                set errmsg [lindex [split $result "\n"] 2]
+            } else {
+                set lastline [lindex [split $result "\n"] end-2]
+                set errmsg [lindex [split $result "\n"] end]
+            }
         }
 
         set splitresult [split $lastline "\t"]

Modified: branches/gsoc15-dependency/base/src/registry2.0/portimage.tcl
===================================================================
--- branches/gsoc15-dependency/base/src/registry2.0/portimage.tcl	2015-08-20 07:23:27 UTC (rev 139551)
+++ branches/gsoc15-dependency/base/src/registry2.0/portimage.tcl	2015-08-20 08:24:32 UTC (rev 139552)
@@ -534,7 +534,7 @@
                 # we'll set the directory attributes properly for all
                 # directories.
                 set directory [::file dirname $file]
-                while { [lsearch -exact $files $directory] == -1 } {
+                while {$directory ni $files} {
                     lappend files $directory
                     set directory [::file dirname $directory]
                 }
@@ -688,7 +688,7 @@
 
             # Split out the filename's subpaths and add them to the image list
             # as well.
-            while { [lsearch -exact $files $directory] == -1 } {
+            while {$directory ni $files} {
                 lappend files $directory
                 set directory [::file dirname $directory]
             }

Modified: branches/gsoc15-dependency/base/src/registry2.0/portuninstall.tcl
===================================================================
--- branches/gsoc15-dependency/base/src/registry2.0/portuninstall.tcl	2015-08-20 07:23:27 UTC (rev 139551)
+++ branches/gsoc15-dependency/base/src/registry2.0/portuninstall.tcl	2015-08-20 08:24:32 UTC (rev 139552)
@@ -249,7 +249,7 @@
         ui_msg "For $portname @${composite_spec}: skipping uninstall (dry run)"
         # allow deps to not be excluded from the list below just because this port is still a dependent
         if {[info exists options(ports_uninstall_follow-dependencies)] && [string is true -strict $options(ports_uninstall_follow-dependencies)]} {
-            set uports [list $portname]
+            set uports [list [list $portname $version $revision $variants]]
         }
     } else {
         ui_msg "$UI_PREFIX [format [msgcat::mc "Uninstalling %s @%s"] $portname $composite_spec]"
@@ -307,25 +307,21 @@
             set uninstalling_this_dep 0
             if {![catch {set ilist [registry::installed $dep]}]} {
                 foreach i $ilist {
-                    set iversion [lindex $i 1]
-                    set irevision [lindex $i 2]
-                    set ivariants [lindex $i 3]
+                    lassign $i dep iversion irevision ivariants
+                    if {[list $dep $iversion $irevision $ivariants] in $uports} {
+                        continue
+                    }
                     set regref [registry::open_entry $dep $iversion $irevision $ivariants [lindex $i 5]]
                     if {![registry::property_retrieve $regref requested]} {
-                        set dependentlist [registry::list_dependents $dep $iversion $irevision $ivariants]
-                        set dependents {}
-                        foreach depdt $dependentlist {
-                            lappend dependents [lindex $depdt 2]
-                        }
                         set all_dependents_uninstalling 1
-                        foreach depdt $dependents {
-                            if {[lsearch -exact $uports $depdt] == -1} {
+                        foreach depdt [$regref dependents] {
+                            if {[list [$depdt name] [$depdt version] [$depdt revision] [$depdt variants]] ni $uports} {
                                 set all_dependents_uninstalling 0
                                 break
                             }
                         }
                         if {$all_dependents_uninstalling} {
-                            lappend uports $dep
+                            lappend uports [list $dep $iversion $irevision $ivariants]
                             lappend portilist $dep@${iversion}_${irevision}${ivariants}
                             set uninstalling_this_dep 1
                         }
@@ -337,7 +333,7 @@
                 foreach depref $deprefs {
                     set depdeps [registry_uninstall::generate_deplist $depref $optionslist]
                     foreach d $depdeps {
-                        if {[lsearch -exact $alldeps $d] == -1} {
+                        if {$d ni [lrange $alldeps $j+1 end]} {
                             lappend alldeps $d 
                         }
                     }
@@ -354,21 +350,16 @@
 
     # uninstall all dependencies in order from uports
     foreach dp $uports {
-        if {![catch {set ilist [registry::installed $dp]}]} {
-            foreach i $ilist {
-                set iversion [lindex $i 1]
-                set irevision [lindex $i 2]
-                set ivariants [lindex $i 3]
-                set regref [registry::open_entry $dp $iversion $irevision $ivariants [lindex $i 5]]
-                if {[info exists options(ports_dryrun)] && [string is true -strict $options(ports_dryrun)]} {
-                    if {$dp ne $portname} {
-                        ui_msg "For $dp @${iversion}_${irevision}${ivariants}: skipping uninstall (dry run)"
-                    }
-                } else {
-                    if {[info exists options(ports_uninstall_no-exec)] || ![registry::run_target $regref uninstall [array get options]]} {
-                        registry_uninstall::uninstall $dp $iversion $irevision $ivariants [array get options]
-                    }
+        lassign $dp iname iversion irevision ivariants
+        if {![catch {registry::open_entry $iname $iversion $irevision $ivariants ""} regref]} {
+            if {[info exists options(ports_dryrun)] && [string is true -strict $options(ports_dryrun)]} {
+                if {$iname ne $portname} {
+                    ui_msg "For $iname @${iversion}_${irevision}${ivariants}: skipping uninstall (dry run)"
                 }
+            } else {
+                if {[info exists options(ports_uninstall_no-exec)] || ![registry::run_target $regref uninstall [array get options]]} {
+                    registry_uninstall::uninstall $iname $iversion $irevision $ivariants [array get options]
+                }
             }
         }
     }

Modified: branches/gsoc15-dependency/base/src/registry2.0/registry.tcl
===================================================================
--- branches/gsoc15-dependency/base/src/registry2.0/registry.tcl	2015-08-20 07:23:27 UTC (rev 139551)
+++ branches/gsoc15-dependency/base/src/registry2.0/registry.tcl	2015-08-20 08:24:32 UTC (rev 139552)
@@ -395,10 +395,10 @@
         }
         set lockfd [::open $lockpath w]
     }
-    if {[catch {flock $lockfd -exclusive -noblock} result]} {
+    if {[catch {adv-flock $lockfd -exclusive -noblock} result]} {
         if {$result eq "EAGAIN"} {
             ui_msg "Waiting for lock on $lockpath"
-            flock $lockfd -exclusive
+            adv-flock $lockfd -exclusive
         } elseif {$result eq "EOPNOTSUPP"} {
             # Locking not supported, just return
             ui_debug "flock not supported, not locking registry"
@@ -420,7 +420,7 @@
     }
     if {[info exists lockfd]} {
         # not much point trying to handle errors
-        catch {flock $lockfd -unlock}
+        catch {adv-flock $lockfd -unlock}
     }
 }
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20150820/932c13c1/attachment-0001.html>


More information about the macports-changes mailing list