[93258] trunk/base/src/port1.0

jmr at macports.org jmr at macports.org
Fri May 18 06:53:17 PDT 2012


Revision: 93258
          https://trac.macports.org/changeset/93258
Author:   jmr at macports.org
Date:     2012-05-18 06:53:16 -0700 (Fri, 18 May 2012)
Log Message:
-----------
fix parsing of tags for urls that contain a colon to indicate a port number, and add unit test (#32018)

Modified Paths:
--------------
    trunk/base/src/port1.0/Makefile
    trunk/base/src/port1.0/fetch_common.tcl

Modified: trunk/base/src/port1.0/Makefile
===================================================================
--- trunk/base/src/port1.0/Makefile	2012-05-18 13:16:41 UTC (rev 93257)
+++ trunk/base/src/port1.0/Makefile	2012-05-18 13:53:16 UTC (rev 93258)
@@ -34,3 +34,4 @@
 test::
 	${TCLSH} tests/portutil.tcl ${macports_tcl_dir}
 	${TCLSH} tests/portdestroot.tcl
+	${TCLSH} tests/portfetch.tcl

Modified: trunk/base/src/port1.0/fetch_common.tcl
===================================================================
--- trunk/base/src/port1.0/fetch_common.tcl	2012-05-18 13:16:41 UTC (rev 93257)
+++ trunk/base/src/port1.0/fetch_common.tcl	2012-05-18 13:53:16 UTC (rev 93258)
@@ -103,10 +103,17 @@
 
         # here we have the chance to take a look at tags, that possibly
         # have been assigned in mirror_sites.tcl
-        set splitlist [split $element :]
-        # every element is a URL, so we'll always have multiple elements. no need to check
-        set element "[lindex $splitlist 0]:[lindex $splitlist 1]"
-        set mirror_tag "[lindex $splitlist 2]"
+        # tag will be after the last colon after the
+        # first slash after the ://
+        set lastcolon [string last : $element]
+        set aftersep [expr [string first : $element] + 3]
+        set firstslash [string first / $element $aftersep]
+        if {$firstslash != -1 && $firstslash < $lastcolon} {
+            set mirror_tag [string range $element [expr $lastcolon + 1] end]
+            set element [string range $element 0 [expr $lastcolon - 1]]
+        } else {
+            set mirror_tag ""
+        }
 
         set name_re {\$(?:name\y|\{name\})}
         # if the URL has $name embedded, kill any mirror_tag that may have been added
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20120518/ddf24960/attachment.html>


More information about the macports-changes mailing list