[24867] branches/dp2mp-move/base/src/port1.0/portsubmit.tcl

source_changes at macosforge.org source_changes at macosforge.org
Sun May 6 19:52:46 PDT 2007


Revision: 24867
          http://trac.macosforge.org/projects/macports/changeset/24867
Author:   jmpp at macports.org
Date:     2007-05-06 19:52:42 -0700 (Sun, 06 May 2007)

Log Message:
-----------

Merging jberry's r24653, r24684, r24685, r24687, r24830, r24833, r24856: Work on portsubmit.tcl for mpwa.

Modified Paths:
--------------
    branches/dp2mp-move/base/src/port1.0/portsubmit.tcl

Modified: branches/dp2mp-move/base/src/port1.0/portsubmit.tcl
===================================================================
--- branches/dp2mp-move/base/src/port1.0/portsubmit.tcl	2007-05-07 02:34:41 UTC (rev 24866)
+++ branches/dp2mp-move/base/src/port1.0/portsubmit.tcl	2007-05-07 02:52:42 UTC (rev 24867)
@@ -93,8 +93,8 @@
 	
     set dirname "portpkg"
     set dirpath "${workpath}/${dirname}"
-    set pkgpath "${workpath}/portpkg.xar"
-    set metaname "portpkg.meta"
+    set pkgpath "${workpath}/${portname}.portpkg"
+    set metaname "portpkg_meta.xml"
     set metapath "${workpath}/${metaname}"
     
     # Expose and default some global variables
@@ -122,6 +122,11 @@
         file copy files ${dirpath}
     }
     
+    # Preconditions for submit
+    if {$submitter_email == ""} {
+		return -code error [format [msgcat::mc "Submitter email is required to submit a port"]]
+    }
+
     # Create the metadata subdoc
     set sd [open ${metapath} w]
     puts $sd "<portpkg version='1'>"
@@ -148,7 +153,11 @@
 			putel $sd long_description $long_description
 		
 			# TODO: variants has platforms in it
-			putlist $sd variants variant $PortInfo(variants)
+			if {[info exists PortInfo(variants)]} {
+				putlist $sd variants variant $PortInfo(variants)
+			} else {
+				putel $sd variants ""
+			}
 			
 			# TODO: Dependencies and platforms
 			#putel $sd dependencies ""
@@ -165,22 +174,70 @@
 		return -code error [format [msgcat::mc "Failed to create portpkg for port : %s"] $portname]
     }
     
-    return
+    return ${pkgpath}
 }
 
 
 proc submit_main {args} {
-    global portname portversion prefix UI_PREFIX workpath portpath
+    global mp_remote_submit_url portname portversion portverbose prefix UI_PREFIX workpath portpath
+    
+    set submiturl $mp_remote_submit_url
   
    	# Create portpkg.xar in the work directory
-   	create_portpkg
+   	set pkgpath [create_portpkg]
    	
    	# If a private key was provided, create a signed digest of the submission
    	# TODO
    	
    	# Submit to the submit url
-   	
-   	# 
+    set args "curl"
+    lappend args "--silent"
+    lappend args "--url ${submiturl}"
+    lappend args "--output ${workpath}/.portsubmit.out"
+    lappend args "-F machine=true"
+    lappend args "-F portpkg=@${pkgpath}"
+    #lappend args "-F signeddigest=${digest}"
+    set cmd [join $args]
+
+    if {[tbool portverbose]} {
+    	ui_msg "Submitting portpkg $pkgpath for $portname to $submiturl"
+    }
+
+    ui_debug $cmd
+    if {[system $cmd] != ""} {
+		return -code error [format [msgcat::mc "Failure during submit of port %s"] $portname]
+    }
+
+	# Parse the result
+	set fd [open ${workpath}/.portsubmit.out r]
+	array set result [list]
+	while {[gets $fd line] != -1} {
+		if {0 != [regexp -- {^([^:]+):\s*(.*)$} $line unused key value]} {
+			set result($key) $value
+		}
+	}
+	close $fd
+	
+	# Interpret and act on the result
+	if {[info exists result(MESSAGE)] && [tbool portverbose]} {
+		ui_msg $result(MESSAGE)
+	}
+	if {[info exists result(STATUS)]} {
+		if { $result(STATUS) == 0 } {
+			ui_msg "Submitted portpkg for $portname"
+			if {[info exists result(DOWNLOAD_URL)]} {
+				ui_msg "    download URL => $result(DOWNLOAD_URL)"
+			}
+			if {[info exists result(HUMAN_URL)]} {
+				ui_msg "    human readable URL => $result(HUMAN_URL)"
+			}
+		} else {
+			return -code error [format [msgcat::mc "Status %d reported during submit of port %s"] $result(STATUS) $portname]
+		}
+	} else {
+		return -code error [format [msgcat::mc "Status not received during submit of port %s"] $portname]
+	}
+
     return
     
     # REMNANTS OF KEVIN'S CODE

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


More information about the macports-changes mailing list