<pre style='margin:0'>
Rainer Müller (raimue) pushed a commit to branch master
in repository macports-base.
</pre>
<p><a href="https://github.com/macports/macports-base/commit/a90c4b29ac3b55d7ce960012386f36309ba09034">https://github.com/macports/macports-base/commit/a90c4b29ac3b55d7ce960012386f36309ba09034</a></p>
<pre style="white-space: pre; background: #F8F8F8">The following commit(s) were added to refs/heads/master by this push:
<span style='display:block; white-space:pre;color:#404040;'> new a90c4b2 port: add -W to touch command
</span>a90c4b2 is described below
<span style='display:block; white-space:pre;color:#808000;'>commit a90c4b29ac3b55d7ce960012386f36309ba09034
</span>Author: Kurt Hindenburg <kurt.hindenburg@gmail.com>
AuthorDate: Fri Aug 31 18:16:26 2018 -0400
<span style='display:block; white-space:pre;color:#404040;'> port: add -W to touch command
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> Instead of having to use system(), use touch -W dir file
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> See https://trac.macports.org/ticket/53730
</span>---
src/port1.0/portutil.tcl | 12 +++++++++++-
src/port1.0/tests/portutil.test | 35 +++++++++++++++++++++++++++++++++++
2 files changed, 46 insertions(+), 1 deletion(-)
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/src/port1.0/portutil.tcl b/src/port1.0/portutil.tcl
</span><span style='display:block; white-space:pre;color:#808080;'>index d438d94..d9b98ea 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/src/port1.0/portutil.tcl
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/src/port1.0/portutil.tcl
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -1055,6 +1055,8 @@ proc delete {args} {
</span> # touch
# mimics the BSD touch command
proc touch {args} {
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ global worksrcpath
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set dir ${worksrcpath}
</span> while {[string match "-*" [lindex $args 0]]} {
set arg [string range [lindex $args 0] 1 end]
set args [lrange $args 1 end]
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -1072,6 +1074,10 @@ proc touch {args} {
</span> set options($arg) $narg
set options(rt) $arg ;# later option overrides earlier
}
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ W {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set dir [lindex $args 0]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set args [lrange $args 1 end]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span> - break
default {return -code error "touch: illegal option -- $arg"}
}
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -1123,10 +1129,14 @@ proc touch {args} {
</span> # do we have any files to process?
if {[llength $args] == 0} {
# print usage
<span style='display:block; white-space:pre;background:#ffe0e0;'>- return -code error {usage: touch [-a] [-c] [-m] [-r file] [-t [[CC]YY]MMDDhhmm[.SS]] file ...}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return -code error {usage: touch [-a] [-c] [-m] [-r file] [-t [[CC]YY]MMDDhhmm[.SS]] [-W dir] file ...}
</span> }
foreach file $args {
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ # if $file is an absolute path already, file join will just
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # return the absolute path, otherwise it is $dir/$file
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set file [file join $dir $file]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span> if {![file exists $file]} {
if {[info exists options(c)]} {
continue
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/src/port1.0/tests/portutil.test b/src/port1.0/tests/portutil.test
</span><span style='display:block; white-space:pre;color:#808080;'>index c12c0a8..183511d 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/src/port1.0/tests/portutil.test
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/src/port1.0/tests/portutil.test
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -365,18 +365,53 @@ test delete {
</span> test touch {
Touch unit test.
} -setup {
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ set dir "/tmp"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set file "macports-portutil-touch"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set file2 "macports-portutil-touch2"
</span> set root "/tmp/macports-portutil-touch"
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ set root2 "/tmp/macports-portutil-touch2"
</span> file delete -force $root
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ file delete -force $root2
</span> } -body {
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ # -c: do not create file
</span> touch -c $root
if {[file exists $root]} { return "FAIL: touch unsuccessful" }
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ touch -c -W $dir $file
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {[file exists $root]} { return "FAIL: touch unsuccessful" }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ touch -W $dir -c $file
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {[file exists $root]} { return "FAIL: touch unsuccessful" }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span> touch $root
if {![file exists $root]} { return "FAIL: touch unsuccessful" }
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ file delete -force $root
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ touch -W $dir $root
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {![file exists $root]} { return "FAIL: touch unsuccessful" }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ file delete -force $root
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ touch -W $dir $file
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {![file exists $root]} { return "FAIL: touch unsuccessful" }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ file delete -force $root
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ touch -W $dir $root $root2
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {![file exists $root]} { return "FAIL: touch unsuccessful" }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ file delete -force $root
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {![file exists $root2]} { return "FAIL: touch unsuccessful" }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ file delete -force $root2
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ touch -W $dir $file $file2
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {![file exists $root]} { return "FAIL: touch unsuccessful" }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ file delete -force $root
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {![file exists $root2]} { return "FAIL: touch unsuccessful" }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ file delete -force $root2
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span> return "Files successfully touched."
} -cleanup {
file delete -force $root
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ file delete -force $root2
</span> } -result "Files successfully touched."
</pre><pre style='margin:0'>
</pre>