<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[25795] trunk/base/src/port</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.macosforge.org/projects/macports/changeset/25795">25795</a></dd>
<dt>Author</dt> <dd>jberry@macports.org</dd>
<dt>Date</dt> <dd>2007-06-02 07:26:58 -0700 (Sat, 02 Jun 2007)</dd>
</dl>

<h3>Log Message</h3>
<pre>Add support for decoding of obscured maintainer addresses.

We support two types of obscured addresses in Portfile maintainers field:
 (1) username ==&gt; implies username@macports.org
 (2) subdomain.tld:username ==&gt; implies username@subdomain.tld

These are unobscured by port info, and by port submit during the submission process,
but are left obscured in the Portfile to avoid accidental disclosure.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkbasesrcportporttcl">trunk/base/src/port/port.tcl</a></li>
<li><a href="#trunkbasesrcport10portsubmittcl">trunk/base/src/port1.0/portsubmit.tcl</a></li>
<li><a href="#trunkbasesrcport10portutiltcl">trunk/base/src/port1.0/portutil.tcl</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkbasesrcportporttcl"></a>
<div class="modfile"><h4>Modified: trunk/base/src/port/port.tcl (25794 => 25795)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/base/src/port/port.tcl        2007-06-02 14:24:59 UTC (rev 25794)
+++ trunk/base/src/port/port.tcl        2007-06-02 14:26:58 UTC (rev 25795)
</span><span class="lines">@@ -432,6 +432,22 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> 
</span><ins>+proc unobscure_maintainers { list } {
+        set result {}
+        foreach m $list {
+                if {[string first &quot;@&quot; $m] &lt; 0} {
+                        if {[string first &quot;:&quot; $m] &gt;= 0} {
+                                set m [regsub -- &quot;(.*):(.*)&quot; $m &quot;\\2@\\1&quot;] 
+                        } else {
+                                set m &quot;$m@macports.org&quot;
+                        }
+                }
+                lappend result $m
+        }
+        return $result
+}
+
+
</ins><span class="cx"> ##########################################
</span><span class="cx"> # Port selection
</span><span class="cx"> ##########################################
</span><span class="lines">@@ -1241,6 +1257,9 @@
</span><span class="cx">             
</span><span class="cx">             # Format the data
</span><span class="cx">             set inf $portinfo($ropt)
</span><ins>+            if { $ropt eq &quot;maintainers&quot; } {
+                    set inf [unobscure_maintainers $inf]
+            }
</ins><span class="cx">             if [info exists list_map($ropt)] {
</span><span class="cx">                 set field [join $inf $subfield_sep]
</span><span class="cx">             } else {
</span><span class="lines">@@ -1294,7 +1313,9 @@
</span><span class="cx">             }
</span><span class="cx">                 
</span><span class="cx">             if {[info exists portinfo(platforms)]} { puts &quot;Platforms: $portinfo(platforms)&quot;}
</span><del>-            if {[info exists portinfo(maintainers)]} { puts &quot;Maintainers: $portinfo(maintainers)&quot;}
</del><ins>+            if {[info exists portinfo(maintainers)]} {
+                    puts &quot;Maintainers: [unobscure_maintainers $portinfo(maintainers)]&quot;
+            }
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx">     
</span></span></pre></div>
<a id="trunkbasesrcport10portsubmittcl"></a>
<div class="modfile"><h4>Modified: trunk/base/src/port1.0/portsubmit.tcl (25794 => 25795)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/base/src/port1.0/portsubmit.tcl        2007-06-02 14:24:59 UTC (rev 25794)
+++ trunk/base/src/port1.0/portsubmit.tcl        2007-06-02 14:26:58 UTC (rev 25795)
</span><span class="lines">@@ -107,6 +107,9 @@
</span><span class="cx">         foreach var $vars {
</span><span class="cx">                 if {![info exists $var]} { set $var {} }
</span><span class="cx">         }
</span><ins>+        
+        # Unobscure the maintainer addresses
+        set maintainers [unobscure_maintainers $maintainers]
</ins><span class="cx"> 
</span><span class="cx">     # Make sure our workpath is clean
</span><span class="cx">     file delete -force $dirpath $metapath $pkgpath
</span><span class="lines">@@ -182,6 +185,9 @@
</span><span class="cx">     global mp_remote_submit_url portname portversion portverbose prefix UI_PREFIX workpath portpath
</span><span class="cx">     
</span><span class="cx">     set submiturl $mp_remote_submit_url
</span><ins>+    
+    # Make sure we have a work directory
+    file mkdir ${workpath}
</ins><span class="cx">   
</span><span class="cx">            # Create portpkg.xar in the work directory
</span><span class="cx">            set pkgpath [create_portpkg]
</span><span class="lines">@@ -201,7 +207,8 @@
</span><span class="cx">     if {[tbool portverbose]} {
</span><span class="cx">             ui_msg &quot;Submitting portpkg $pkgpath for $portname to $submiturl&quot;
</span><span class="cx">     }
</span><del>-
</del><ins>+    
+        # Invoke curl to do the submit
</ins><span class="cx">     ui_debug $cmd
</span><span class="cx">     if {[system $cmd] != &quot;&quot;} {
</span><span class="cx">                 return -code error [format [msgcat::mc &quot;Failure during submit of port %s&quot;] $portname]
</span></span></pre></div>
<a id="trunkbasesrcport10portutiltcl"></a>
<div class="modfile"><h4>Modified: trunk/base/src/port1.0/portutil.tcl (25794 => 25795)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/base/src/port1.0/portutil.tcl        2007-06-02 14:24:59 UTC (rev 25794)
+++ trunk/base/src/port1.0/portutil.tcl        2007-06-02 14:26:58 UTC (rev 25795)
</span><span class="lines">@@ -1005,6 +1005,32 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+
+# unobscure maintainer addresses as used in Portfiles
+# We allow two obscured forms:
+#        (1) User name only with no domain:
+#                        foo implies foo@macports.org
+#        (2) Mangled name:
+#                        subdomain.tld:username implies username@subdomain.tld
+#
+proc unobscure_maintainers { list } {
+        set result {}
+        foreach m $list {
+                if {[string first &quot;@&quot; $m] &lt; 0} {
+                        if {[string first &quot;:&quot; $m] &gt;= 0} {
+                                set m [regsub -- &quot;(.*):(.*)&quot; $m &quot;\\2@\\1&quot;] 
+                        } else {
+                                set m &quot;$m@macports.org&quot;
+                        }
+                }
+                lappend result $m
+        }
+        return $result
+}
+
+
+
+
</ins><span class="cx"> ########### Internal Dependency Manipulation Procedures ###########
</span><span class="cx"> 
</span><span class="cx"> proc target_run {ditem} {
</span></span></pre>
</div>
</div>

</body>
</html>