[49347] trunk/base/src

jmr at macports.org jmr at macports.org
Tue Apr 7 21:25:22 PDT 2009


Revision: 49347
          http://trac.macports.org/changeset/49347
Author:   jmr at macports.org
Date:     2009-04-07 21:25:21 -0700 (Tue, 07 Apr 2009)
Log Message:
-----------
Remove 'compat' commands since the native commands they stand in for are available on Panther and later. Fixes #19235.

Modified Paths:
--------------
    trunk/base/src/pextlib1.0/Makefile
    trunk/base/src/pextlib1.0/Pextlib.c
    trunk/base/src/port/port.tcl
    trunk/base/src/registry1.0/portimage.tcl
    trunk/base/src/registry1.0/portuninstall.tcl
    trunk/base/src/registry2.0/portimage.tcl
    trunk/base/src/registry2.0/portuninstall.tcl

Removed Paths:
-------------
    trunk/base/src/pextlib1.0/compat.c
    trunk/base/src/pextlib1.0/compat.h

Modified: trunk/base/src/pextlib1.0/Makefile
===================================================================
--- trunk/base/src/pextlib1.0/Makefile	2009-04-08 04:23:16 UTC (rev 49346)
+++ trunk/base/src/pextlib1.0/Makefile	2009-04-08 04:25:21 UTC (rev 49347)
@@ -1,6 +1,6 @@
 OBJS=		Pextlib.o strsed.o fgetln.o md5cmd.o setmode.o xinstall.o \
 		fs-traverse.o strcasecmp.o vercomp.o filemap.o \
-		sha1cmd.o compat.o curl.o rmd160cmd.o readline.o uid.o\
+		sha1cmd.o curl.o rmd160cmd.o readline.o uid.o\
 		tracelib.o tty.o get_systemconfiguration_proxies.o
 SHLIB_NAME=	Pextlib${SHLIB_SUFFIX}
 INSTALLDIR= ${DESTDIR}${datadir}/macports/Tcl/pextlib1.0

Modified: trunk/base/src/pextlib1.0/Pextlib.c
===================================================================
--- trunk/base/src/pextlib1.0/Pextlib.c	2009-04-08 04:23:16 UTC (rev 49346)
+++ trunk/base/src/pextlib1.0/Pextlib.c	2009-04-08 04:25:21 UTC (rev 49347)
@@ -111,7 +111,6 @@
 #include "curl.h"
 #include "xinstall.h"
 #include "vercomp.h"
-#include "compat.h"
 #include "readline.h"
 #include "uid.h"
 #include "tracelib.h"
@@ -1296,7 +1295,6 @@
 	Tcl_CreateObjCommand(interp, "rpm-vercomp", RPMVercompCmd, NULL, NULL);
 	Tcl_CreateObjCommand(interp, "rmd160", RMD160Cmd, NULL, NULL);
 	Tcl_CreateObjCommand(interp, "sha1", SHA1Cmd, NULL, NULL);
-	Tcl_CreateObjCommand(interp, "compat", CompatCmd, NULL, NULL);
 	Tcl_CreateObjCommand(interp, "umask", UmaskCmd, NULL, NULL);
 	Tcl_CreateObjCommand(interp, "sudo", SudoCmd, NULL, NULL);
 	Tcl_CreateObjCommand(interp, "mkfifo", MkfifoCmd, NULL, NULL);

Deleted: trunk/base/src/pextlib1.0/compat.c
===================================================================
--- trunk/base/src/pextlib1.0/compat.c	2009-04-08 04:23:16 UTC (rev 49346)
+++ trunk/base/src/pextlib1.0/compat.c	2009-04-08 04:25:21 UTC (rev 49347)
@@ -1,279 +0,0 @@
-/*
- * compat.c
- * $Id$
- *
- * Copyright (c) 2004 Paul Guyot, 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.
- */
-
-#if HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <sys/param.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <unistd.h>
-
-#if HAVE_LIBGEN_H
-#include <libgen.h>
-#endif
-
-#if HAVE_STRING_H
-#include <string.h>
-#endif
-
-#include <tcl.h>
-#include <tclDecls.h>
-
-#include "compat.h"
-
-/* Avoid a warning with Tcl < 8.4, even if Tcl_GetIndexFromObj's tablePtr
-probably isn't modified. */
-#if (TCL_MAJOR_VERSION > 8) || (TCL_MINOR_VERSION >= 4)
-typedef CONST char* tableEntryString;
-#else
-typedef char* tableEntryString;
-#endif
-
-/* ========================================================================= **
- * Definitions
- * ========================================================================= */
-#pragma mark Definitions
-
-/* ------------------------------------------------------------------------- **
- * Prototypes
- * ------------------------------------------------------------------------- */
-int CompatFileNormalize(Tcl_Interp* interp, int objc, Tcl_Obj* CONST objv[]);
-
-/* ========================================================================= **
- * Entry points
- * ========================================================================= */
-#pragma mark -
-#pragma mark Entry points
-
-
-/**
- * compat filelinkhard subcommand entry point.
- *
- * @param interp		current interpreter
- * @param objc			number of parameters
- * @param objv			parameters
- */
-int
-CompatFileLinkHard(Tcl_Interp* interp, int objc, Tcl_Obj* CONST objv[])
-{
-	int theResult = TCL_OK;
-
-	do {
-		char* theSrcPath;
-		char* theDstPath;
-		
-		/* we only have two parameters. */
-		if (objc != 4) {
-			Tcl_WrongNumArgs(interp, 1, objv, "filelinkhard dstpath srcpath");
-			theResult = TCL_ERROR;
-			break;
-		}
-
-		/* retrieve the parameters */
-		theDstPath = Tcl_GetString(objv[2]);
-		theSrcPath = Tcl_GetString(objv[3]);
-		
-		/* perform the hard link */
-		if (link(theSrcPath, theDstPath) < 0)
-		{
-			/* some error occurred. Report it. */
-			Tcl_SetResult(interp, strerror(errno), TCL_VOLATILE);
-			theResult = TCL_ERROR;
-			break;
-		}
-    } while (0);
-    
-	return theResult;
-}
-
-/**
- * compat filelinksymbolic subcommand entry point.
- *
- * @param interp		current interpreter
- * @param objc			number of parameters
- * @param objv			parameters
- */
-int
-CompatFileLinkSymbolic(Tcl_Interp* interp, int objc, Tcl_Obj* CONST objv[])
-{
-	int theResult = TCL_OK;
-
-	do {
-		char* theSrcPath;
-		char* theDstPath;
-		
-		/* we only have two parameters. */
-		if (objc != 4) {
-			Tcl_WrongNumArgs(interp, 1, objv, "filelinksymbolic dstpath srcpath");
-			theResult = TCL_ERROR;
-			break;
-		}
-
-		/* retrieve the parameters */
-		theDstPath = Tcl_GetString(objv[2]);
-		theSrcPath = Tcl_GetString(objv[3]);
-		
-		/* perform the symbolic link */
-		if (symlink(theSrcPath, theDstPath) < 0)
-		{
-			/* some error occurred. Report it. */
-			Tcl_SetResult(interp, strerror(errno), TCL_VOLATILE);
-			theResult = TCL_ERROR;
-			break;
-		}
-    } while (0);
-    
-	return theResult;
-}
-
-/**
- * compat filenormalize subcommand entry point.
- *
- * @param interp		current interpreter
- * @param objc			number of parameters
- * @param objv			parameters
- */
-int
-CompatFileNormalize(Tcl_Interp* interp, int objc, Tcl_Obj* CONST objv[])
-{
-	int theResult = TCL_OK;
-
-	do {
-		char* thePath;
-		char tmpPath[PATH_MAX];
-		char* theBaseName;
-		char theNormalizedPath[PATH_MAX];
-		int pathlength;
-		int baselength;
-		
-		/*	unique (second) parameter is the file path */
-		if (objc != 3) {
-			Tcl_WrongNumArgs(interp, 1, objv, "filenormalize path");
-			theResult = TCL_ERROR;
-			break;
-		}
-
-		/* retrieve the parameter */
-		thePath = Tcl_GetString(objv[2]);
-		
-		/* Some implementations of dirname(3) modify the memory
-			referenced by its argument, so we make a copy of thePath
-			just in case. */
-		(void) strncpy(tmpPath, (const char*) thePath, sizeof(tmpPath));
-
-		/* normalize the dir name */
-		(void) realpath(dirname(tmpPath), theNormalizedPath);
-		
-		/* append the base name */
-		pathlength = strlen(theNormalizedPath);
-		theBaseName = basename(thePath);
-		baselength = strlen(theBaseName);
-		if (pathlength + baselength + 1 >= PATH_MAX)
-		{
-			Tcl_SetResult(interp, "path is too long", TCL_STATIC);
-			theResult = TCL_ERROR;
-			break;
-		}
-		theNormalizedPath[pathlength] = '/';
-		/* copy with null terminator */
-		(void) memcpy(
-					&theNormalizedPath[pathlength + 1],
-					theBaseName,
-					baselength + 1);
-		
-		Tcl_SetResult(interp, theNormalizedPath, TCL_VOLATILE);
-    } while (0);
-    
-	return theResult;
-}
-
-/**
- * compat command entry point.
- *
- * @param clientData	custom data (ignored)
- * @param interp		current interpreter
- * @param objc			number of parameters
- * @param objv			parameters
- */
-int
-CompatCmd(
-		ClientData clientData UNUSED,
-		Tcl_Interp* interp,
-		int objc, 
-		Tcl_Obj* CONST objv[])
-{
-    typedef enum {
-    	kCompatFileNormalize,
-    	kCompatFileLinkHard,
-    	kCompatFileLinkSymbolic
-    } EOption;
-    
-	static tableEntryString options[] = {
-		"filenormalize", "filelinkhard", "filelinksymbolic", NULL
-	};
-
-	int theResult = TCL_OK;
-	EOption theOptionIndex;
-
-	if (objc < 2) {
-		Tcl_WrongNumArgs(interp, 1, objv, "option ?arg ...?");
-		return TCL_ERROR;
-	}
-
-	theResult = Tcl_GetIndexFromObj(
-				interp,
-				objv[1],
-				options,
-				"option",
-				0,
-				(int*) &theOptionIndex);
-	if (theResult == TCL_OK) {
-		switch (theOptionIndex)
-		{
-			case kCompatFileNormalize:
-				theResult = CompatFileNormalize(interp, objc, objv);
-				break;
-
-			case kCompatFileLinkHard:
-				theResult = CompatFileLinkHard(interp, objc, objv);
-				break;
-
-			case kCompatFileLinkSymbolic:
-				theResult = CompatFileLinkSymbolic(interp, objc, objv);
-				break;
-		}
-	}
-	
-	return theResult;
-}

Deleted: trunk/base/src/pextlib1.0/compat.h
===================================================================
--- trunk/base/src/pextlib1.0/compat.h	2009-04-08 04:23:16 UTC (rev 49346)
+++ trunk/base/src/pextlib1.0/compat.h	2009-04-08 04:25:21 UTC (rev 49347)
@@ -1,60 +0,0 @@
-/*
- * compat.h
- * $Id$
- *
- * Copyright (c) 2004 Paul Guyot, 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 _COMPAT_H
-#define _COMPAT_H
-
-#include <tcl.h>
-
-/**
- * A native command to handle limitation of old versions of Tcl.
- *
- * The syntax is:
- * compat filenormalize path
- *	Normalize path just like file normalize does.
- *  Fixes a problem with Tcl installations affected by bug #953284. (this is
- *	the case with 10.3's Tcl)
- *
- * compat filelinkhard dstpath srcpath
- *	Creates a hard link just like file link -hard does.
- *  Fixes a problem with Tcl installations that do not understand link
- *  (typically 10.2's Tcl).
- *
- * compat filelinksymbolic dstpath srcpath
- *	Creates a symbolic link just like file link -symbolic does.
- *  Fixes a problem with Tcl installations that do not understand link
- *  (typically 10.2's Tcl).
- */
-int CompatCmd(ClientData clientData, Tcl_Interp* interp, int objc, Tcl_Obj* CONST objv[]);
-
-#endif
-		/* _COMPAT_H */

Modified: trunk/base/src/port/port.tcl
===================================================================
--- trunk/base/src/port/port.tcl	2009-04-08 04:23:16 UTC (rev 49346)
+++ trunk/base/src/port/port.tcl	2009-04-08 04:25:21 UTC (rev 49347)
@@ -1785,7 +1785,7 @@
         return 1
     }
     foreach filename $portlist {
-        set file [compat filenormalize $filename]
+        set file [file normalize $filename]
         if {[file exists $file]} {
             if {![file isdirectory $file]} {
                 set port [registry::file_registered $file]

Modified: trunk/base/src/registry1.0/portimage.tcl
===================================================================
--- trunk/base/src/registry1.0/portimage.tcl	2009-04-08 04:23:16 UTC (rev 49346)
+++ trunk/base/src/registry1.0/portimage.tcl	2009-04-08 04:25:21 UTC (rev 49347)
@@ -295,9 +295,9 @@
 		file copy -force $srcfile $dstfile
 	} else {
 		# Try a hard link first and if that fails, a symlink
-		if {[catch {compat filelinkhard $dstfile $srcfile}]} {
+		if {[catch {file link -hard $dstfile $srcfile}]} {
 			ui_debug "hardlinking $srcfile to $dstfile failed, symlinking instead"
-			compat filelinksymbolic $dstfile $srcfile
+			file link -symbolic $dstfile $srcfile
 		}
 	}
 }
@@ -439,7 +439,7 @@
 			# instead of the paths we currently have, users' registry won't
 			# match and activate will say that some file exists but doesn't
 			# belong to any port.
-			set theFile [compat filenormalize $file]
+			set theFile [file normalize $file]
 			lappend files $theFile
 			
 			# Split out the filename's subpaths and add them to the image list as

Modified: trunk/base/src/registry1.0/portuninstall.tcl
===================================================================
--- trunk/base/src/registry1.0/portuninstall.tcl	2009-04-08 04:23:16 UTC (rev 49346)
+++ trunk/base/src/registry1.0/portuninstall.tcl	2009-04-08 04:25:21 UTC (rev 49347)
@@ -189,7 +189,7 @@
 			}
 			# Normalize the file path to avoid removing the intermediate
 			# symlinks (remove the empty directories instead)
-			set theFile [compat filenormalize [lindex $f 0]]
+			set theFile [file normalize [lindex $f 0]]
 			lappend files $theFile
 
 			# Split out the filename's subpaths and add them to the

Modified: trunk/base/src/registry2.0/portimage.tcl
===================================================================
--- trunk/base/src/registry2.0/portimage.tcl	2009-04-08 04:23:16 UTC (rev 49346)
+++ trunk/base/src/registry2.0/portimage.tcl	2009-04-08 04:25:21 UTC (rev 49347)
@@ -254,10 +254,10 @@
             ui_debug "activating file: $dstfile"
             # Try a hard link first and if that fails, a symlink
             try {
-                compat filelinkhard $dstfile $srcfile
+                file link -hard $dstfile $srcfile
             } catch {*} {
                 ui_debug "hardlinking $srcfile to $dstfile failed; symlinking instead"
-                compat filelinksymbolic $dstfile $srcfile
+                file link -symbolic $dstfile $srcfile
             }
         }
         default {
@@ -420,7 +420,7 @@
             # instead of the paths we currently have, users' registry won't
             # match and activate will say that some file exists but doesn't
             # belong to any port.
-            set theFile [compat filenormalize $file]
+            set theFile [file normalize $file]
             lappend files $theFile
 
             # Split out the filename's subpaths and add them to the image list

Modified: trunk/base/src/registry2.0/portuninstall.tcl
===================================================================
--- trunk/base/src/registry2.0/portuninstall.tcl	2009-04-08 04:23:16 UTC (rev 49346)
+++ trunk/base/src/registry2.0/portuninstall.tcl	2009-04-08 04:25:21 UTC (rev 49347)
@@ -124,7 +124,7 @@
 
         # Normalize the file path to avoid removing the intermediate
         # symlinks (remove the empty directories instead)
-        set theFile [compat filenormalize $file]
+        set theFile [file normalize $file]
         lappend files $theFile
 
         # Split out the filename's subpaths and add them to the
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20090407/f6e9ff21/attachment.html>


More information about the macports-changes mailing list