[37881] branches/gsoc08-privileges/base

pmagrath at macports.org pmagrath at macports.org
Fri Jun 27 12:01:23 PDT 2008


Revision: 37881
          http://trac.macosforge.org/projects/macports/changeset/37881
Author:   pmagrath at macports.org
Date:     2008-06-27 12:01:22 -0700 (Fri, 27 Jun 2008)
Log Message:
-----------
Merged revisions 37621,37682,37711,37728,37756-37759,37780,37786 via svnmerge from 
https://svn.macosforge.org/repository/macports/trunk/base

........
  r37621 | jmr at macports.org | 2008-06-15 21:32:58 +0100 (Sun, 15 Jun 2008) | 2 lines
  
  Treat port names case-insensitively in filemap. (#11759)
........
  r37682 | raimue at macports.org | 2008-06-19 01:00:16 +0100 (Thu, 19 Jun 2008) | 2 lines
  
  Add tcldox directory to svn:ignore
........
  r37711 | dluke at macports.org | 2008-06-20 14:07:41 +0100 (Fri, 20 Jun 2008) | 2 lines
  
  Use the $SVN variable for the commit too.
........
  r37728 | raimue at macports.org | 2008-06-21 02:14:18 +0100 (Sat, 21 Jun 2008) | 3 lines
  
  port/port.tcl:
  Sort portlists case-insensitive (e.g. for port installed)
........
  r37756 | raimue at macports.org | 2008-06-22 02:25:48 +0100 (Sun, 22 Jun 2008) | 5 lines
  
  port/port.tcl:
  Add new option --editor to port edit
  
  Bug with "port ed --editor" fixed in r37786.
........
  r37757 | raimue at macports.org | 2008-06-22 02:37:04 +0100 (Sun, 22 Jun 2008) | 3 lines
  
  port/port.tcl:
  Simplify the cmd_args_array
........
  r37758 | raimue at macports.org | 2008-06-22 02:47:12 +0100 (Sun, 22 Jun 2008) | 4 lines
  
  port/port.tcl:
    * Rename cmd_args_array to cmd_opts_array, as this name is more appropriate
    * Fix a possible issue with the restructured array in proc action_get_usage
........
  r37759 | raimue at macports.org | 2008-06-22 05:43:13 +0100 (Sun, 22 Jun 2008) | 3 lines
  
  cregistry/registry.c:
  Fix an invalid free introduced in r36500.
........
  r37780 | eridius at macports.org | 2008-06-23 08:00:08 +0100 (Mon, 23 Jun 2008) | 2 lines
  
  Remove some redundant code in mportinit
........
  r37786 | ryandesign at macports.org | 2008-06-23 12:44:41 +0100 (Mon, 23 Jun 2008) | 2 lines
  
  port.tcl: fix bug from r37756: allow 'port ed --editor' to work
........

Modified Paths:
--------------
    branches/gsoc08-privileges/base/portmgr/jobs/PortIndexRegen.sh
    branches/gsoc08-privileges/base/src/cregistry/registry.c
    branches/gsoc08-privileges/base/src/macports1.0/macports.tcl
    branches/gsoc08-privileges/base/src/pextlib1.0/filemap.c
    branches/gsoc08-privileges/base/src/port/port.tcl

Property Changed:
----------------
    branches/gsoc08-privileges/base/


Property changes on: branches/gsoc08-privileges/base
___________________________________________________________________
Name: svn:ignore
   - autom4te.cache
config.log
config.status
Makefile
Doxyfile

   + autom4te.cache
config.log
config.status
Makefile
Doxyfile
tcldox

Name: svnmerge-integrated
   - /trunk/base:1-37618
   + /trunk/base:1-37880

Modified: branches/gsoc08-privileges/base/portmgr/jobs/PortIndexRegen.sh
===================================================================
--- branches/gsoc08-privileges/base/portmgr/jobs/PortIndexRegen.sh	2008-06-27 18:33:32 UTC (rev 37880)
+++ branches/gsoc08-privileges/base/portmgr/jobs/PortIndexRegen.sh	2008-06-27 19:01:22 UTC (rev 37881)
@@ -127,7 +127,7 @@
 echo "" >> $COMMIT_MSG
 grep Failed $FAILURE_LOG >> $COMMIT_MSG
 { cd ${SRCTREE}/dports/ && \
-    svn --config-dir $SVN_CONFIG_DIR commit -F $COMMIT_MSG PortIndex > $FAILURE_LOG 2>&1 ; } \
+    $SVN --config-dir $SVN_CONFIG_DIR commit -F $COMMIT_MSG PortIndex > $FAILURE_LOG 2>&1 ; } \
     || { echo "SVN commit failed." >> $FAILURE_LOG ; bail ; }
 
 # At this point the index was committed successfuly, so we cleanup before we exit.

Modified: branches/gsoc08-privileges/base/src/cregistry/registry.c
===================================================================
--- branches/gsoc08-privileges/base/src/cregistry/registry.c	2008-06-27 18:33:32 UTC (rev 37880)
+++ branches/gsoc08-privileges/base/src/cregistry/registry.c	2008-06-27 19:01:22 UTC (rev 37881)
@@ -162,12 +162,13 @@
     if (stat(path, &sb) != 0) {
         initialized = 0;
         if (errno == ENOENT) {
-            char *mypath = strdup(path);
-            mypath = dirname(mypath);
-            if (stat(mypath, &sb) != 0) {
+            char *dirc, *dname;
+            dirc = strdup(path);
+            dname = dirname(dirc);
+            if (stat(dname, &sb) != 0) {
                 can_write = 0;
             }
-            free(mypath);
+            free(dirc);
         } else {
             can_write = 0;
         }

Modified: branches/gsoc08-privileges/base/src/macports1.0/macports.tcl
===================================================================
--- branches/gsoc08-privileges/base/src/macports1.0/macports.tcl	2008-06-27 18:33:32 UTC (rev 37880)
+++ branches/gsoc08-privileges/base/src/macports1.0/macports.tcl	2008-06-27 19:01:22 UTC (rev 37881)
@@ -456,23 +456,12 @@
             if {[catch {file mkdir $portdbpath} result]} {
                 return -code error "portdbpath $portdbpath does not exist and could not be created: $result"
             }
+        } else {
+            return -code error "$portdbpath is not a directory. Please create the directory $portdbpath and try again"
         }
     }
-    if {![file isdirectory $portdbpath]} {
-        return -code error "$portdbpath is not a directory. Please create the directory $portdbpath and try again"
-    }
 
     set registry.path $portdbpath
-    if {![file isdirectory ${registry.path}]} {
-        if {![file exists ${registry.path}]} {
-            if {[catch {file mkdir ${registry.path}} result]} {
-                return -code error "portdbpath ${registry.path} does not exist and could not be created: $result"
-            }
-        }
-    }
-    if {![file isdirectory ${macports::registry.path}]} {
-        return -code error "${macports::registry.path} is not a directory. Please create the directory $portdbpath and try again"
-    }
 
     # Format for receipts, can currently be either "flat" or "sqlite"
     if {[info exists portdbformat]} {

Modified: branches/gsoc08-privileges/base/src/pextlib1.0/filemap.c
===================================================================
--- branches/gsoc08-privileges/base/src/pextlib1.0/filemap.c	2008-06-27 18:33:32 UTC (rev 37880)
+++ branches/gsoc08-privileges/base/src/pextlib1.0/filemap.c	2008-06-27 19:01:22 UTC (rev 37881)
@@ -1003,7 +1003,7 @@
 	if (inRoot->fNodeType == kLeaf)
 	{
 		/* it's a leaf. Does the value match? */
-		if (strcmp(((SLeaf*) inRoot)->fValue, inValue) == 0)
+		if (strcasecmp(((SLeaf*) inRoot)->fValue, inValue) == 0)
 		{
 			/* It matches. */
 			char* thePath = ckalloc(inSubpathLen + NAME_MAX + 1);

Modified: branches/gsoc08-privileges/base/src/port/port.tcl
===================================================================
--- branches/gsoc08-privileges/base/src/port/port.tcl	2008-06-27 18:33:32 UTC (rev 37880)
+++ branches/gsoc08-privileges/base/src/port/port.tcl	2008-06-27 19:01:22 UTC (rev 37881)
@@ -356,7 +356,7 @@
 proc portlist_compare { a b } {
     array set a_ $a
     array set b_ $b
-    set namecmp [string compare $a_(name) $b_(name)]
+    set namecmp [string compare -nocase $a_(name) $b_(name)]
     if {$namecmp != 0} {
         return $namecmp
     }
@@ -1193,18 +1193,23 @@
 ##########################################
 
 proc action_get_usage { action } {
-    global action_array cmd_args_array
+    global action_array cmd_opts_array
 
     if {[info exists action_array($action)]} {
         set cmds ""
-        if {[info exists cmd_args_array($action)]} {
-            foreach cmd $cmd_args_array($action) {
-                set name [lindex $cmd 0]
-                set argc [lindex $cmd 1]
+        if {[info exists cmd_opts_array($action)]} {
+            foreach opt $cmd_opts_array($action) {
+                if {[llength $opt] == 1} {
+                    set name $opt
+                    set optc 0
+                } else {
+                    set name [lindex $opt 0]
+                    set optc [lindex $opt 1]
+                }
 
                 append cmds " --$name"
 
-                for {set i 1} {$i <= $argc} {incr i} {
+                for {set i 1} {$i <= $optc} {incr i} {
                     append cmds " <arg$i>"
                 }
             }
@@ -2241,6 +2246,8 @@
     # Operations on the port's directory and Portfile
     global env boot_env
     global current_portdir
+
+    array set local_options $opts
     
     set status 0
     if {[require_portlist portlist]} {
@@ -2292,10 +2299,16 @@
                     
                     # Find an editor to edit the portfile
                     set editor ""
-                    foreach ed { VISUAL EDITOR } {
-                        if {[info exists env($ed)]} {
-                            set editor $env($ed)
-                            break
+                    if {[info exists local_options(ports_edit_editor)]} {
+                        set editor $local_options(ports_edit_editor)
+                    } elseif {[info exists local_options(ports_ed_editor)]} {
+                        set editor $local_options(ports_ed_editor)
+                    } else {
+                        foreach ed { VISUAL EDITOR } {
+                            if {[info exists env($ed)]} {
+                                set editor $env($ed)
+                                break
+                            }
                         }
                     }
                     
@@ -2616,25 +2629,25 @@
     return $ret
 }
 
-# cmd_args_array specifies which arguments the commands accept
+# cmd_opts_array specifies which arguments the commands accept
 # Commands not listed here do not accept any arguments
 # Syntax if {option argn}
 # Where option is the name of the option and argn specifies how many arguments
 # this argument takes
-global cmd_args_array
-array set cmd_args_array {
-    info        {{category 0} {categories 0} {depends_build 0} {depends_lib 0}
-                {depends_run 0} {depends 0} {description 0} {epoch 0}
-                {homepage 0} {index 0} {line 0} {long_description 0}
-                {maintainer 0} {maintainers 0} {name 0} {platform 0}
-                {platforms 0} {portdir 0} {revision 0} {variant 0} {variants 0}
-                {version 0}}
-    search      {{line 0}}
-    selfupdate  {{nosync 0} {pretend 0}}
-    uninstall   {{follow-dependents 0}}
-    variants    {{index 0}}
-    clean       {{all 0} {archive 0} {dist 0} {work 0}}
-    mirror      {{new 0}}
+global cmd_opts_array
+array set cmd_opts_array {
+    edit        {{editor 1}}
+    ed          {{editor 1}}
+    info        {category categories depends_build depends_lib depends_run
+                 depends description epoch homepage index line long_description
+                 maintainer maintainers name platform platforms portdir
+                 revision variant variants version}
+    search      {line}
+    selfupdate  {nosync pretend}
+    uninstall   {follow-dependents}
+    variants    {index}
+    clean       {all archive dist work}
+    mirror      {new}
 }
 
 ##
@@ -2645,19 +2658,24 @@
 # @param upoptargc reference to upvar for storing the number of arguments for
 #                  this option
 proc cmd_option_exists { action option {upoptargc ""}} {
-    global cmd_args_array
+    global cmd_opts_array
     upvar 1 $upoptargc optargc
 
     # This could be so easy with lsearch -index,
     # but that's only available as of Tcl 8.5
 
-    if {![info exists cmd_args_array($action)]} {
+    if {![info exists cmd_opts_array($action)]} {
         return 0
     }
 
-    foreach item $cmd_args_array($action) {
-        set name [lindex $item 0]
-        set argc [lindex $item 1]
+    foreach item $cmd_opts_array($action) {
+        if {[llength $item] == 1} {
+            set name $item
+            set argc 0
+        } else {
+            set name [lindex $item 0]
+            set argc [lindex $item 1]
+        }
 
         if {$name == $option} {
             set optargc $argc
@@ -2679,7 +2697,7 @@
 proc parse_options { action ui_options_name global_options_name } {
     upvar $ui_options_name ui_options
     upvar $global_options_name global_options
-    global cmdname cmd_args_array
+    global cmdname cmd_opts_array
     
     while {[moreargs]} {
         set arg [lookahead]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20080627/77afe698/attachment-0001.html 


More information about the macports-changes mailing list