[25795] trunk/base/src/port

source_changes at macosforge.org source_changes at macosforge.org
Sat Jun 2 07:26:59 PDT 2007


Revision: 25795
          http://trac.macosforge.org/projects/macports/changeset/25795
Author:   jberry at macports.org
Date:     2007-06-02 07:26:58 -0700 (Sat, 02 Jun 2007)

Log Message:
-----------
Add support for decoding of obscured maintainer addresses.

We support two types of obscured addresses in Portfile maintainers field:
 (1) username ==> implies username at macports.org
 (2) subdomain.tld:username ==> implies username at 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.

Modified Paths:
--------------
    trunk/base/src/port/port.tcl
    trunk/base/src/port1.0/portsubmit.tcl
    trunk/base/src/port1.0/portutil.tcl

Modified: trunk/base/src/port/port.tcl
===================================================================
--- 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)
@@ -432,6 +432,22 @@
 }
 
 
+proc unobscure_maintainers { list } {
+	set result {}
+	foreach m $list {
+		if {[string first "@" $m] < 0} {
+			if {[string first ":" $m] >= 0} {
+				set m [regsub -- "(.*):(.*)" $m "\\2@\\1"] 
+			} else {
+				set m "$m at macports.org"
+			}
+		}
+		lappend result $m
+	}
+	return $result
+}
+
+
 ##########################################
 # Port selection
 ##########################################
@@ -1241,6 +1257,9 @@
             
             # Format the data
             set inf $portinfo($ropt)
+            if { $ropt eq "maintainers" } {
+            	set inf [unobscure_maintainers $inf]
+            }
             if [info exists list_map($ropt)] {
                 set field [join $inf $subfield_sep]
             } else {
@@ -1294,7 +1313,9 @@
             }
                 
             if {[info exists portinfo(platforms)]} { puts "Platforms: $portinfo(platforms)"}
-            if {[info exists portinfo(maintainers)]} { puts "Maintainers: $portinfo(maintainers)"}
+            if {[info exists portinfo(maintainers)]} {
+            	puts "Maintainers: [unobscure_maintainers $portinfo(maintainers)]"
+            }
         }
     }
     

Modified: trunk/base/src/port1.0/portsubmit.tcl
===================================================================
--- 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)
@@ -107,6 +107,9 @@
 	foreach var $vars {
 		if {![info exists $var]} { set $var {} }
 	}
+	
+	# Unobscure the maintainer addresses
+	set maintainers [unobscure_maintainers $maintainers]
 
     # Make sure our workpath is clean
     file delete -force $dirpath $metapath $pkgpath
@@ -182,6 +185,9 @@
     global mp_remote_submit_url portname portversion portverbose prefix UI_PREFIX workpath portpath
     
     set submiturl $mp_remote_submit_url
+    
+    # Make sure we have a work directory
+    file mkdir ${workpath}
   
    	# Create portpkg.xar in the work directory
    	set pkgpath [create_portpkg]
@@ -201,7 +207,8 @@
     if {[tbool portverbose]} {
     	ui_msg "Submitting portpkg $pkgpath for $portname to $submiturl"
     }
-
+    
+	# Invoke curl to do the submit
     ui_debug $cmd
     if {[system $cmd] != ""} {
 		return -code error [format [msgcat::mc "Failure during submit of port %s"] $portname]

Modified: trunk/base/src/port1.0/portutil.tcl
===================================================================
--- 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)
@@ -1005,6 +1005,32 @@
     }
 }
 
+
+# unobscure maintainer addresses as used in Portfiles
+# We allow two obscured forms:
+#	(1) User name only with no domain:
+#			foo implies foo at macports.org
+#	(2) Mangled name:
+#			subdomain.tld:username implies username at subdomain.tld
+#
+proc unobscure_maintainers { list } {
+	set result {}
+	foreach m $list {
+		if {[string first "@" $m] < 0} {
+			if {[string first ":" $m] >= 0} {
+				set m [regsub -- "(.*):(.*)" $m "\\2@\\1"] 
+			} else {
+				set m "$m at macports.org"
+			}
+		}
+		lappend result $m
+	}
+	return $result
+}
+
+
+
+
 ########### Internal Dependency Manipulation Procedures ###########
 
 proc target_run {ditem} {

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20070602/5e6f74bd/attachment.html


More information about the macports-changes mailing list