[114289] trunk/base
ryandesign at macports.org
ryandesign at macports.org
Wed Dec 4 03:45:30 PST 2013
Revision: 114289
https://trac.macports.org/changeset/114289
Author: ryandesign at macports.org
Date: 2013-12-04 03:45:30 -0800 (Wed, 04 Dec 2013)
Log Message:
-----------
portutil.tcl: support case-only renames on case-insensitive filesystems in proc move (#41679)
Modified Paths:
--------------
trunk/base/ChangeLog
trunk/base/src/port1.0/portutil.tcl
Modified: trunk/base/ChangeLog
===================================================================
--- trunk/base/ChangeLog 2013-12-04 11:25:12 UTC (rev 114288)
+++ trunk/base/ChangeLog 2013-12-04 11:45:30 UTC (rev 114289)
@@ -20,6 +20,9 @@
log files, archives, base source and the default ports tree.
(cal in r113649)
+ - "move" now supports case-only renames on case-insensitive filesystems
+ (#41679, ryandesign in r114167)
+
Release 2.2.1 (2013-10-26 by jmr)
- Fixed a problem where dependency calculation could sometimes fail for
ports that only support 32-bit architectures when the configured
Modified: trunk/base/src/port1.0/portutil.tcl
===================================================================
--- trunk/base/src/port1.0/portutil.tcl 2013-12-04 11:25:12 UTC (rev 114288)
+++ trunk/base/src/port1.0/portutil.tcl 2013-12-04 11:45:30 UTC (rev 114289)
@@ -1167,13 +1167,38 @@
}
# copy
+# Wrapper for file copy
proc copy {args} {
eval file copy $args
}
# move
+# Wrapper for file rename that handles case-only renames
proc move {args} {
- eval file rename $args
+ set options {}
+ while {[string match -* [lindex $args 0]]} {
+ set arg [string range [lindex $args 0] 1 end]
+ set args [lreplace $args 0 0]
+ switch -- $arg {
+ force {append options -$arg}
+ - break
+ default {return -code error "move: illegal option -- $arg"}
+ }
+ }
+ if {[llength $args] == 2} {
+ set oldname [lindex $args 0]
+ set newname [lindex $args 1]
+ if {[string equal -nocase $oldname $newname] && $oldname ne $newname} {
+ # case-only rename
+ set tempdir [mkdtemp ${oldname}-XXXXXXXX]
+ set tempname $tempdir/[file tail $oldname]
+ file rename $options -- $oldname $tempname
+ file rename $options -- $tempname $newname
+ delete $tempdir
+ return
+ }
+ }
+ eval file rename $options -- $args
}
# ln
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20131204/109cab00/attachment.html>
More information about the macports-changes
mailing list