[53746] branches/images-and-archives/base

blb at macports.org blb at macports.org
Sun Jul 12 23:52:33 PDT 2009


Revision: 53746
          http://trac.macports.org/changeset/53746
Author:   blb at macports.org
Date:     2009-07-12 23:52:32 -0700 (Sun, 12 Jul 2009)
Log Message:
-----------
Merge from trunk

Modified Paths:
--------------
    branches/images-and-archives/base/configure
    branches/images-and-archives/base/configure.ac
    branches/images-and-archives/base/src/macports1.0/Makefile
    branches/images-and-archives/base/src/macports1.0/macports.c
    branches/images-and-archives/base/src/macports1.0/macports.tcl
    branches/images-and-archives/base/src/pextlib1.0/Makefile
    branches/images-and-archives/base/src/pextlib1.0/Pextlib.c
    branches/images-and-archives/base/src/port/portindex.tcl

Added Paths:
-----------
    branches/images-and-archives/base/src/macports1.0/get_systemconfiguration_proxies.c
    branches/images-and-archives/base/src/macports1.0/get_systemconfiguration_proxies.h

Removed Paths:
-------------
    branches/images-and-archives/base/src/pextlib1.0/get_systemconfiguration_proxies.c
    branches/images-and-archives/base/src/pextlib1.0/get_systemconfiguration_proxies.h

Property Changed:
----------------
    branches/images-and-archives/base/


Property changes on: branches/images-and-archives/base
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/gsoc08-privileges/base:37343-46937
/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:50249-53714
/users/perry/base-bugs_and_notes:45682-46060
/users/perry/base-select:44044-44692
   + /branches/gsoc08-privileges/base:37343-46937
/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:50249-53745
/users/perry/base-bugs_and_notes:45682-46060
/users/perry/base-select:44044-44692

Modified: branches/images-and-archives/base/configure
===================================================================
--- branches/images-and-archives/base/configure	2009-07-13 06:09:19 UTC (rev 53745)
+++ branches/images-and-archives/base/configure	2009-07-13 06:52:32 UTC (rev 53746)
@@ -7797,6 +7797,11 @@
 
 # Check for paths
 
+if test x$prefix = x/usr/local; then
+    { { $as_echo "$as_me:$LINENO: error: Installing MacPorts into /usr/local is not supported" >&5
+$as_echo "$as_me: error: Installing MacPorts into /usr/local is not supported" >&2;}
+   { (exit 1); exit 1; }; }
+fi
 
 
 

Modified: branches/images-and-archives/base/configure.ac
===================================================================
--- branches/images-and-archives/base/configure.ac	2009-07-13 06:09:19 UTC (rev 53745)
+++ branches/images-and-archives/base/configure.ac	2009-07-13 06:52:32 UTC (rev 53746)
@@ -165,6 +165,9 @@
 
 # Check for paths
 AC_PREFIX_DEFAULT(/opt/local)
+if test x$prefix = x/usr/local; then
+    AC_MSG_ERROR([Installing MacPorts into /usr/local is not supported])
+fi
 MP_PATH_PORTSDIR([$PORTS_DIR_DEFAULT])
 MP_PATH_MPCONFIGDIR
 

Modified: branches/images-and-archives/base/src/macports1.0/Makefile
===================================================================
--- branches/images-and-archives/base/src/macports1.0/Makefile	2009-07-13 06:09:19 UTC (rev 53745)
+++ branches/images-and-archives/base/src/macports1.0/Makefile	2009-07-13 06:52:32 UTC (rev 53746)
@@ -1,6 +1,6 @@
 SRCS=		macports.tcl macports_dlist.tcl macports_util.tcl \
 		macports_autoconf.tcl macports_index.tcl macports_fastload.tcl
-OBJS=		macports.o
+OBJS=		macports.o get_systemconfiguration_proxies.o
 SHLIB_NAME=	MacPorts${SHLIB_SUFFIX}
 
 INSTALLDIR=	${DESTDIR}${TCL_PACKAGE_DIR}/macports1.0
@@ -8,6 +8,10 @@
 include ../../Mk/macports.autoconf.mk
 include ../../Mk/macports.tea.mk
 
+ifeq ($(OBJC_RUNTIME), APPLE_RUNTIME)
+	LIBS+= -framework CoreFoundation -framework SystemConfiguration
+endif
+
 test::
 	${TCLSH} tests/macports_dlist.tcl
 	${TCLSH} tests/macports_util.tcl

Copied: branches/images-and-archives/base/src/macports1.0/get_systemconfiguration_proxies.c (from rev 53745, trunk/base/src/macports1.0/get_systemconfiguration_proxies.c)
===================================================================
--- branches/images-and-archives/base/src/macports1.0/get_systemconfiguration_proxies.c	                        (rev 0)
+++ branches/images-and-archives/base/src/macports1.0/get_systemconfiguration_proxies.c	2009-07-13 06:52:32 UTC (rev 53746)
@@ -0,0 +1,175 @@
+/*
+ * get_systemconfiguration_proxies.c
+ * $Id$
+ *
+ * Copyright (c) 2008-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 MacPorts Team 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+
+#include "get_systemconfiguration_proxies.h"
+
+
+#ifdef HAVE_FRAMEWORK_SYSTEMCONFIGURATION
+#include <CoreFoundation/CoreFoundation.h>
+#include <SystemConfiguration/SystemConfiguration.h>
+
+int appendProxyInformationForKeys( CFDictionaryRef proxies, Tcl_Obj *tclList, const char *listKey, const void *proxyEnabledKey, const void *proxyHostKey, const void *proxyPortKey );
+char *cfStringToCStringASCII( CFStringRef cfString );
+
+#endif   /* HAVE_FRAMEWORK_SYSTEMCONFIGURATION */
+
+
+/**
+ *
+ * Query SystemConfiguration for proxy information, returning this
+ * information in a Tcl list ready to be 'array set' (key, name pairs).
+ *
+ * Synopsis: array set someArray get_systemconfiguration_proxies
+ */
+int GetSystemConfigurationProxiesCmd( ClientData clientData UNUSED, Tcl_Interp *interp, int objc UNUSED, Tcl_Obj *CONST objv[] UNUSED )
+{
+    int cmdResult = TCL_OK;
+#ifdef HAVE_FRAMEWORK_SYSTEMCONFIGURATION
+    CFDictionaryRef proxies = SCDynamicStoreCopyProxies( NULL );
+    if( proxies != NULL )
+    {
+        Tcl_Obj *proxyList = Tcl_NewListObj( 0, NULL );
+        if( appendProxyInformationForKeys( proxies, proxyList, "proxy_http", kSCPropNetProxiesHTTPEnable, kSCPropNetProxiesHTTPProxy, kSCPropNetProxiesHTTPPort ) == 0 &&
+            appendProxyInformationForKeys( proxies, proxyList, "proxy_https", kSCPropNetProxiesHTTPSEnable, kSCPropNetProxiesHTTPSProxy, kSCPropNetProxiesHTTPSPort ) == 0 &&
+            appendProxyInformationForKeys( proxies, proxyList, "proxy_ftp", kSCPropNetProxiesFTPEnable, kSCPropNetProxiesFTPProxy, kSCPropNetProxiesFTPPort ) == 0 )
+        {
+            CFArrayRef exceptionsCFArray = CFDictionaryGetValue( proxies, kSCPropNetProxiesExceptionsList );
+            if( exceptionsCFArray != NULL )
+            {
+                CFStringRef exceptionsCFString = CFStringCreateByCombiningStrings( kCFAllocatorDefault, exceptionsCFArray, CFSTR( "," ) );
+                char *exceptionsString = cfStringToCStringASCII( exceptionsCFString );
+                if( exceptionsString != NULL )
+                {
+                    Tcl_Obj *exceptionsKey = Tcl_NewStringObj( "proxy_skip", 10 );
+                    Tcl_Obj *exceptionsTclString = Tcl_NewStringObj( exceptionsString, strlen( exceptionsString ) );
+                    Tcl_ListObjAppendElement( interp, proxyList, exceptionsKey );
+                    Tcl_ListObjAppendElement( interp, proxyList, exceptionsTclString );
+                    free( exceptionsString );
+                }
+                else
+                    cmdResult = TCL_ERROR;
+                CFRelease( exceptionsCFString );
+            }
+            Tcl_SetObjResult( interp, proxyList );
+        }
+        else
+            cmdResult = TCL_ERROR;
+        CFRelease( proxies );
+    }
+    if( cmdResult == TCL_ERROR )
+        Tcl_SetResult( interp, (char *) Tcl_PosixError( interp ), TCL_STATIC );
+#endif
+   return cmdResult;
+}
+
+
+#ifdef HAVE_FRAMEWORK_SYSTEMCONFIGURATION
+/**
+ *
+ * Extract the proxy information (given by proxyEnabledKey, proxyHostKey,
+ * and proxyPortKey) from the proxies dictionary, then append listKey and
+ * the pertinent proxy information to the Tcl list.
+ *
+ * Returns 0 on success; -1 on failure
+ */
+int appendProxyInformationForKeys( CFDictionaryRef proxies, Tcl_Obj *tclList, const char *listKey, const void *proxyEnabledKey, const void *proxyHostKey, const void *proxyPortKey )
+{
+    int result = 0;
+    CFNumberRef proxyEnabledNumber = CFDictionaryGetValue( proxies, proxyEnabledKey );
+    int proxyEnabled = 0;
+    if( proxyEnabledNumber != NULL &&
+        CFNumberGetValue( proxyEnabledNumber, kCFNumberIntType, &proxyEnabled ) &&
+        proxyEnabled )
+    {
+        CFStringRef proxyHostString = CFDictionaryGetValue( proxies, proxyHostKey );
+        char *hostname = NULL;
+        if( proxyHostString != NULL &&
+            ( hostname = cfStringToCStringASCII( proxyHostString ) ) != NULL )
+        {
+            CFNumberRef proxyPortNumber = CFDictionaryGetValue( proxies, proxyPortKey );
+            int proxyPort = 0;
+            if( proxyPortNumber != NULL &&
+                CFNumberGetValue( proxyPortNumber, kCFNumberIntType, &proxyPort ) &&
+                proxyPort > 0 )
+            {
+                /*
+                 * We are adding :<port>\0 to the end, which is up to 7
+                 * bytes additional (up to 5 for the port)
+                 */
+                int newLength = strlen( hostname ) + 7;
+                char *hostnameAndPort = calloc( 1, newLength );
+                if( hostnameAndPort != NULL )
+                {
+                    Tcl_Obj *hostnameAndPortTcl;
+                    Tcl_Obj *listKeyTcl = Tcl_NewStringObj( listKey, strlen( listKey ) );
+                    Tcl_ListObjAppendElement( NULL, tclList, listKeyTcl );
+                    snprintf( hostnameAndPort, newLength, "%s:%d", hostname, proxyPort );
+                    hostnameAndPortTcl = Tcl_NewStringObj( hostnameAndPort, strlen( hostnameAndPort ) );
+                    Tcl_ListObjAppendElement( NULL, tclList, hostnameAndPortTcl );
+                    free( hostnameAndPort );
+                }
+                else
+                    result = -1;
+            }
+            else
+                result = -1;
+        }
+        else
+            result = -1;
+    }
+
+    return result;
+}
+
+
+/**
+ *
+ * Convert a CFStringRef to an ASCII-encoded C string; be sure to free()
+ * the returned string when done with it.
+ */
+char *cfStringToCStringASCII( CFStringRef cfString )
+{
+    int strLen = CFStringGetMaximumSizeForEncoding( CFStringGetLength( cfString ), kCFStringEncodingASCII ) + 1;
+    char *cString = calloc( 1, strLen );
+    if( cString != NULL )
+        CFStringGetCString( cfString, cString, strLen, kCFStringEncodingASCII );
+
+   return cString;
+}
+
+#endif
+

Copied: branches/images-and-archives/base/src/macports1.0/get_systemconfiguration_proxies.h (from rev 53745, trunk/base/src/macports1.0/get_systemconfiguration_proxies.h)
===================================================================
--- branches/images-and-archives/base/src/macports1.0/get_systemconfiguration_proxies.h	                        (rev 0)
+++ branches/images-and-archives/base/src/macports1.0/get_systemconfiguration_proxies.h	2009-07-13 06:52:32 UTC (rev 53746)
@@ -0,0 +1,41 @@
+/* 
+ * get_systemconfiguration_proxies.h 
+ * $Id$ 
+ * 
+ * Copyright (c) 2008-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 MacPorts Team nor the names of its contributors 
+ *    may be used to endorse or promote products derived from this software 
+ *    without specific prior written permission. 
+ *  
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
+ * POSSIBILITY OF SUCH DAMAGE. 
+ */ 
+
+#ifndef _GETSYSTEMCONFIGURATIONPROXIES_H
+#define _GETSYSTEMCONFIGURATIONPROXIES_H
+
+#include <tcl.h> 
+
+int GetSystemConfigurationProxiesCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ); 
+
+#endif   /* _GETSYSTEMCONFIGURATIONPROXIES_H */
+

Modified: branches/images-and-archives/base/src/macports1.0/macports.c
===================================================================
--- branches/images-and-archives/base/src/macports1.0/macports.c	2009-07-13 06:09:19 UTC (rev 53745)
+++ branches/images-and-archives/base/src/macports1.0/macports.c	2009-07-13 06:52:32 UTC (rev 53746)
@@ -37,6 +37,8 @@
 
 #include <tcl.h>
 
+#include "get_systemconfiguration_proxies.h"
+
 static int
 macports__version(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[])
 {
@@ -54,6 +56,7 @@
 	if (Tcl_InitStubs(interp, "8.4", 0) == NULL)
 		return TCL_ERROR;
 	Tcl_CreateObjCommand(interp, "macports::version", macports__version, NULL, NULL);
+	Tcl_CreateObjCommand(interp, "get_systemconfiguration_proxies", GetSystemConfigurationProxiesCmd, NULL, NULL);
 	if (Tcl_PkgProvide(interp, "macports", "1.0") != TCL_OK)
 		return TCL_ERROR;
 	return TCL_OK;

Modified: branches/images-and-archives/base/src/macports1.0/macports.tcl
===================================================================
--- branches/images-and-archives/base/src/macports1.0/macports.tcl	2009-07-13 06:09:19 UTC (rev 53745)
+++ branches/images-and-archives/base/src/macports1.0/macports.tcl	2009-07-13 06:52:32 UTC (rev 53746)
@@ -975,6 +975,9 @@
         file {
             set proposedpath [file normalize [file join [getportdir $url] .. ..]]
         }
+        default {
+            set proposedpath [getsourcepath $url]
+        }
     }
 
     # append requested path
@@ -1635,7 +1638,8 @@
                     # sync just a PortIndex file
                     set indexfile [macports::getindex $source]
                     file mkdir [file dirname $indexfile]
-                    curl $source/PortIndex $indexfile
+                    curl fetch ${source}/PortIndex $indexfile
+                    curl fetch ${source}/PortIndex.quick ${indexfile}.quick
                 }
             }
             default {

Modified: branches/images-and-archives/base/src/pextlib1.0/Makefile
===================================================================
--- branches/images-and-archives/base/src/pextlib1.0/Makefile	2009-07-13 06:09:19 UTC (rev 53745)
+++ branches/images-and-archives/base/src/pextlib1.0/Makefile	2009-07-13 06:52:32 UTC (rev 53746)
@@ -1,8 +1,7 @@
 OBJS=		Pextlib.o strsed.o fgetln.o md5cmd.o setmode.o xinstall.o \
 		fs-traverse.o strcasecmp.o vercomp.o filemap.o \
 		sha1cmd.o curl.o rmd160cmd.o readline.o uid.o\
-		tracelib.o tty.o get_systemconfiguration_proxies.o\
-		sysctl.o readdir.o pipe.o
+		tracelib.o tty.o sysctl.o readdir.o pipe.o
 SHLIB_NAME=	Pextlib${SHLIB_SUFFIX}
 INSTALLDIR= ${DESTDIR}${datadir}/macports/Tcl/pextlib1.0
 
@@ -11,9 +10,6 @@
 
 CFLAGS+= ${CURL_CFLAGS} ${MD5_CFLAGS} ${READLINE_CFLAGS}
 LIBS+= ${CURL_LIBS} ${MD5_LIBS} ${READLINE_LIBS}
-ifeq ($(OBJC_RUNTIME), APPLE_RUNTIME)
-   LIBS+= -framework CoreFoundation -framework SystemConfiguration
-endif
 
 .PHONY: test
 

Modified: branches/images-and-archives/base/src/pextlib1.0/Pextlib.c
===================================================================
--- branches/images-and-archives/base/src/pextlib1.0/Pextlib.c	2009-07-13 06:09:19 UTC (rev 53745)
+++ branches/images-and-archives/base/src/pextlib1.0/Pextlib.c	2009-07-13 06:52:32 UTC (rev 53746)
@@ -104,7 +104,6 @@
 #include "uid.h"
 #include "tracelib.h"
 #include "tty.h"
-#include "get_systemconfiguration_proxies.h"
 #include "sysctl.h"
 #include "strsed.h"
 #include "readdir.h"
@@ -948,7 +947,6 @@
 	Tcl_CreateObjCommand(interp, "tracelib", TracelibCmd, NULL, NULL);
 	Tcl_CreateObjCommand(interp, "isatty", IsattyCmd, NULL, NULL);
 	Tcl_CreateObjCommand(interp, "term_get_size", TermGetSizeCmd, NULL, NULL);
-	Tcl_CreateObjCommand(interp, "get_systemconfiguration_proxies", GetSystemConfigurationProxiesCmd, NULL, NULL);
 
 	if (Tcl_PkgProvide(interp, "Pextlib", "1.0") != TCL_OK)
 		return TCL_ERROR;

Deleted: branches/images-and-archives/base/src/pextlib1.0/get_systemconfiguration_proxies.c
===================================================================
--- branches/images-and-archives/base/src/pextlib1.0/get_systemconfiguration_proxies.c	2009-07-13 06:09:19 UTC (rev 53745)
+++ branches/images-and-archives/base/src/pextlib1.0/get_systemconfiguration_proxies.c	2009-07-13 06:52:32 UTC (rev 53746)
@@ -1,175 +0,0 @@
-/*
- * get_systemconfiguration_proxies.c
- * $Id$
- *
- * Copyright (c) 2008-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 MacPorts Team 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-
-#include "get_systemconfiguration_proxies.h"
-
-
-#ifdef HAVE_FRAMEWORK_SYSTEMCONFIGURATION
-#include <CoreFoundation/CoreFoundation.h>
-#include <SystemConfiguration/SystemConfiguration.h>
-
-int appendProxyInformationForKeys( CFDictionaryRef proxies, Tcl_Obj *tclList, const char *listKey, const void *proxyEnabledKey, const void *proxyHostKey, const void *proxyPortKey );
-char *cfStringToCStringASCII( CFStringRef cfString );
-
-#endif   /* HAVE_FRAMEWORK_SYSTEMCONFIGURATION */
-
-
-/**
- *
- * Query SystemConfiguration for proxy information, returning this
- * information in a Tcl list ready to be 'array set' (key, name pairs).
- *
- * Synopsis: array set someArray get_systemconfiguration_proxies
- */
-int GetSystemConfigurationProxiesCmd( ClientData clientData UNUSED, Tcl_Interp *interp, int objc UNUSED, Tcl_Obj *CONST objv[] UNUSED )
-{
-    int cmdResult = TCL_OK;
-#ifdef HAVE_FRAMEWORK_SYSTEMCONFIGURATION
-    CFDictionaryRef proxies = SCDynamicStoreCopyProxies( NULL );
-    if( proxies != NULL )
-    {
-        Tcl_Obj *proxyList = Tcl_NewListObj( 0, NULL );
-        if( appendProxyInformationForKeys( proxies, proxyList, "proxy_http", kSCPropNetProxiesHTTPEnable, kSCPropNetProxiesHTTPProxy, kSCPropNetProxiesHTTPPort ) == 0 &&
-            appendProxyInformationForKeys( proxies, proxyList, "proxy_https", kSCPropNetProxiesHTTPSEnable, kSCPropNetProxiesHTTPSProxy, kSCPropNetProxiesHTTPSPort ) == 0 &&
-            appendProxyInformationForKeys( proxies, proxyList, "proxy_ftp", kSCPropNetProxiesFTPEnable, kSCPropNetProxiesFTPProxy, kSCPropNetProxiesFTPPort ) == 0 )
-        {
-            CFArrayRef exceptionsCFArray = CFDictionaryGetValue( proxies, kSCPropNetProxiesExceptionsList );
-            if( exceptionsCFArray != NULL )
-            {
-                CFStringRef exceptionsCFString = CFStringCreateByCombiningStrings( kCFAllocatorDefault, exceptionsCFArray, CFSTR( "," ) );
-                char *exceptionsString = cfStringToCStringASCII( exceptionsCFString );
-                if( exceptionsString != NULL )
-                {
-                    Tcl_Obj *exceptionsKey = Tcl_NewStringObj( "proxy_skip", 10 );
-                    Tcl_Obj *exceptionsTclString = Tcl_NewStringObj( exceptionsString, strlen( exceptionsString ) );
-                    Tcl_ListObjAppendElement( interp, proxyList, exceptionsKey );
-                    Tcl_ListObjAppendElement( interp, proxyList, exceptionsTclString );
-                    free( exceptionsString );
-                }
-                else
-                    cmdResult = TCL_ERROR;
-                CFRelease( exceptionsCFString );
-            }
-            Tcl_SetObjResult( interp, proxyList );
-        }
-        else
-            cmdResult = TCL_ERROR;
-        CFRelease( proxies );
-    }
-    if( cmdResult == TCL_ERROR )
-        Tcl_SetResult( interp, (char *) Tcl_PosixError( interp ), TCL_STATIC );
-#endif
-   return cmdResult;
-}
-
-
-#ifdef HAVE_FRAMEWORK_SYSTEMCONFIGURATION
-/**
- *
- * Extract the proxy information (given by proxyEnabledKey, proxyHostKey,
- * and proxyPortKey) from the proxies dictionary, then append listKey and
- * the pertinent proxy information to the Tcl list.
- *
- * Returns 0 on success; -1 on failure
- */
-int appendProxyInformationForKeys( CFDictionaryRef proxies, Tcl_Obj *tclList, const char *listKey, const void *proxyEnabledKey, const void *proxyHostKey, const void *proxyPortKey )
-{
-    int result = 0;
-    CFNumberRef proxyEnabledNumber = CFDictionaryGetValue( proxies, proxyEnabledKey );
-    int proxyEnabled = 0;
-    if( proxyEnabledNumber != NULL &&
-        CFNumberGetValue( proxyEnabledNumber, kCFNumberIntType, &proxyEnabled ) &&
-        proxyEnabled )
-    {
-        CFStringRef proxyHostString = CFDictionaryGetValue( proxies, proxyHostKey );
-        char *hostname = NULL;
-        if( proxyHostString != NULL &&
-            ( hostname = cfStringToCStringASCII( proxyHostString ) ) != NULL )
-        {
-            CFNumberRef proxyPortNumber = CFDictionaryGetValue( proxies, proxyPortKey );
-            int proxyPort = 0;
-            if( proxyPortNumber != NULL &&
-                CFNumberGetValue( proxyPortNumber, kCFNumberIntType, &proxyPort ) &&
-                proxyPort > 0 )
-            {
-                /*
-                 * We are adding :<port>\0 to the end, which is up to 7
-                 * bytes additional (up to 5 for the port)
-                 */
-                int newLength = strlen( hostname ) + 7;
-                char *hostnameAndPort = calloc( 1, newLength );
-                if( hostnameAndPort != NULL )
-                {
-                    Tcl_Obj *hostnameAndPortTcl;
-                    Tcl_Obj *listKeyTcl = Tcl_NewStringObj( listKey, strlen( listKey ) );
-                    Tcl_ListObjAppendElement( NULL, tclList, listKeyTcl );
-                    snprintf( hostnameAndPort, newLength, "%s:%d", hostname, proxyPort );
-                    hostnameAndPortTcl = Tcl_NewStringObj( hostnameAndPort, strlen( hostnameAndPort ) );
-                    Tcl_ListObjAppendElement( NULL, tclList, hostnameAndPortTcl );
-                    free( hostnameAndPort );
-                }
-                else
-                    result = -1;
-            }
-            else
-                result = -1;
-        }
-        else
-            result = -1;
-    }
-
-    return result;
-}
-
-
-/**
- *
- * Convert a CFStringRef to an ASCII-encoded C string; be sure to free()
- * the returned string when done with it.
- */
-char *cfStringToCStringASCII( CFStringRef cfString )
-{
-    int strLen = CFStringGetMaximumSizeForEncoding( CFStringGetLength( cfString ), kCFStringEncodingASCII ) + 1;
-    char *cString = calloc( 1, strLen );
-    if( cString != NULL )
-        CFStringGetCString( cfString, cString, strLen, kCFStringEncodingASCII );
-
-   return cString;
-}
-
-#endif
-

Deleted: branches/images-and-archives/base/src/pextlib1.0/get_systemconfiguration_proxies.h
===================================================================
--- branches/images-and-archives/base/src/pextlib1.0/get_systemconfiguration_proxies.h	2009-07-13 06:09:19 UTC (rev 53745)
+++ branches/images-and-archives/base/src/pextlib1.0/get_systemconfiguration_proxies.h	2009-07-13 06:52:32 UTC (rev 53746)
@@ -1,41 +0,0 @@
-/* 
- * get_systemconfiguration_proxies.h 
- * $Id$ 
- * 
- * Copyright (c) 2008-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 MacPorts Team nor the names of its contributors 
- *    may be used to endorse or promote products derived from this software 
- *    without specific prior written permission. 
- *  
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
- * POSSIBILITY OF SUCH DAMAGE. 
- */ 
-
-#ifndef _GETSYSTEMCONFIGURATIONPROXIES_H
-#define _GETSYSTEMCONFIGURATIONPROXIES_H
-
-#include <tcl.h> 
-
-int GetSystemConfigurationProxiesCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ); 
-
-#endif   /* _GETSYSTEMCONFIGURATIONPROXIES_H */
-

Modified: branches/images-and-archives/base/src/port/portindex.tcl
===================================================================
--- branches/images-and-archives/base/src/port/portindex.tcl	2009-07-13 06:09:19 UTC (rev 53745)
+++ branches/images-and-archives/base/src/port/portindex.tcl	2009-07-13 06:52:32 UTC (rev 53746)
@@ -60,15 +60,15 @@
             set portinfo(portarchive) [file join [file dirname $portdir] [file tail $portdir]].tgz
             cd [file join $directory [file dirname $portinfo(portdir)]]
             puts "Archiving port $portinfo(name) to [file join $outdir $portinfo(portarchive)]"
-            set tar [findBinary tar $macports::autoconf::tar_path]
-            set gzip [findBinary gzip $macports::autoconf::gzip_path]
+            set tar [macports::findBinary tar $macports::autoconf::tar_path]
+            set gzip [macports::findBinary gzip $macports::autoconf::gzip_path]
             if {[catch {exec $tar -cf - [file tail $portdir] | $gzip -c >[file join $outdir $portinfo(portarchive)]} result]} {
                 puts stderr "Failed to create port archive $portinfo(portarchive): $result"
                 exit 1
             }
         }
 
-        set keepkeys {categories depends_fetch depends_extract depends_build depends_lib depends_run description epoch homepage long_description maintainers name platforms revision variants version portdir}
+        set keepkeys {categories depends_fetch depends_extract depends_build depends_lib depends_run description epoch homepage long_description maintainers name platforms revision variants version portdir portarchive}
         foreach availkey [array names portinfo] {
             if {[lsearch -exact ${keepkeys} $availkey] == -1} {
                 unset portinfo($availkey)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20090712/309efbbb/attachment-0001.html>


More information about the macports-changes mailing list