[svn:parrot] r46769 - in trunk: examples/io runtime/parrot/library t

whiteknight at svn.parrot.org whiteknight at svn.parrot.org
Tue May 18 17:15:53 UTC 2010


Author: whiteknight
Date: Tue May 18 17:15:15 2010
New Revision: 46769
URL: https://trac.parrot.org/parrot/changeset/46769

Log:
Undo recent changes by fperrad, so I have a clean revision from which to cut the release. Will re-apply these changes in a minute

Modified:
   trunk/examples/io/post.pir
   trunk/runtime/parrot/library/LWP.pir
   trunk/runtime/parrot/library/distutils.pir
   trunk/t/harness.pir

Modified: trunk/examples/io/post.pir
==============================================================================
--- trunk/examples/io/post.pir	Tue May 18 16:47:20 2010	(r46768)
+++ trunk/examples/io/post.pir	Tue May 18 17:15:15 2010	(r46769)
@@ -38,8 +38,7 @@
     response = ua.'post'(url, contents :flat, 'form-data' :named('Content-Type'), 'close' :named('Connection'))
     $I0 = response.'code'()
     unless $I0 == 302 goto L1
-    $S0 = response.'content'()
-    say $S0
+    say "report uploaded"
   L1:
 .end
 

Modified: trunk/runtime/parrot/library/LWP.pir
==============================================================================
--- trunk/runtime/parrot/library/LWP.pir	Tue May 18 16:47:20 2010	(r46768)
+++ trunk/runtime/parrot/library/LWP.pir	Tue May 18 17:15:15 2010	(r46769)
@@ -158,26 +158,14 @@
     referral_uri = response.'get_header'('Location')
     $P0 = get_hll_global ['URI'], 'new_from_string'
     $P1 = $P0(referral_uri)
-    $S0 = $P1.'scheme'()
-    unless $S0 == '' goto L5
-    $P2 = new 'StringBuilder'
-    $P3 = request.'uri'()
-    $S0 = $P3.'scheme'()
-    push $P2, $S0
-    push $P2, '://'
-    $S0 = request.'get_header'('Host')
-    push $P2, $S0
-    push $P2, referral_uri
-    $P1 = $P0($P2)
-  L5:
     setattribute referral, 'uri', $P1
 
     # work in progress
 
     $I0 = self.'redirect_ok'(referral, response)
-    if $I0 goto L6
+    if $I0 goto L5
     .return (response)
-  L6:
+  L5:
     .tailcall self.'request'(referral, response)
   L4:
 
@@ -690,19 +678,12 @@
 .sub '_parse_response_headers' :method
     .param pmc response
     .param string str
-    .local string sep
-    sep = "\r\n"
-    $I0 = index str, "\r"
-    unless $I0 < 0 goto L0
-    sep = "\n"
-  L0:
-    $S0 = sep . sep
-    $I0 = index str, $S0
+    $I0 = index str, "\r\n\r\n"
     if $I0 < 0 goto L1
     str = substr str, 0, $I0
   L1:
 
-    $P0 = split sep, str
+    $P0 = split "\r\n", str
     .local string status_line
     status_line = shift $P0
     $I0 = index status_line, " "
@@ -751,15 +732,7 @@
     $S0 = substr str, $I0
     $P0 = box $S0
     setattribute response, 'content', $P0
-    goto L2
   L1:
-    $I0 = index str, "\n\n"
-    if $I0 < 0 goto L1
-    $I0 += 2
-    $S0 = substr str, $I0
-    $P0 = box $S0
-    setattribute response, 'content', $P0
-  L2:
 .end
 
 .sub 'request' :method

Modified: trunk/runtime/parrot/library/distutils.pir
==============================================================================
--- trunk/runtime/parrot/library/distutils.pir	Tue May 18 16:47:20 2010	(r46768)
+++ trunk/runtime/parrot/library/distutils.pir	Tue May 18 17:15:15 2010	(r46769)
@@ -2216,10 +2216,6 @@
     ua.'show_progress'(1)
     $S0 = kv['smolder_url']
     response = ua.'post'($S0, contents :flat, 'form-data' :named('Content-Type'), 'close' :named('Connection'))
-    $I0 = response.'code'()
-    unless $I0 == 302 goto L1
-    $S0 = response.'content'()
-    say $S0
   L1:
 .end
 

Modified: trunk/t/harness.pir
==============================================================================
--- trunk/t/harness.pir	Tue May 18 16:47:20 2010	(r46768)
+++ trunk/t/harness.pir	Tue May 18 17:15:15 2010	(r46769)
@@ -333,45 +333,38 @@
 
 .sub 'send_archive_to_smolder' :anon
     .param pmc env_data
+    load_bytecode 'osutils.pbc'
+    .const string archive = 'parrot_test_run.tar.gz'
+    .const string smolder_url = 'http://smolder.plusthree.com/app/projects/process_add_report/8'
+    .const string username = 'parrot-autobot'
+    .const string password = 'squ at wk'
     .local pmc config
     $P0 = getinterp
     config = $P0[.IGLOBALS_CONFIG_HASH]
-    .local pmc contents
-    contents = new 'ResizablePMCArray' # by couple
-    push contents, 'architecture'
+    .local string cmd
+    cmd = "curl -F architecture="
     $S0 = config['cpuarch']
-    push contents, $S0
-    push contents, 'platform'
+    cmd .= $S0
+    cmd .= " -F platform="
     $S0 = config['osname']
-    push contents, $S0
-    push contents, 'revision'
+    cmd .= $S0
+    cmd .= " -F revision="
     $S0 = config['revision']
-    push contents, $S0
-    push contents, 'tags'
+    cmd .= $S0
+    cmd .= " -F tags=\""
     $S0 = _get_tags(env_data)
-    push contents, $S0
-    push contents, 'username'
-    push contents, 'parrot-autobot'
-    push contents, 'password'
-    push contents, 'squ at wk'
-    push contents, 'comments'
-    push contents, "EXPERIMENTAL t/harness.pir with LWP.pir"
-    push contents, 'report_file'
-    $P0 = new 'FixedStringArray'
-    set $P0, 1
-    $P0[0] = 'parrot_test_run.tar.gz'
-    push contents, $P0
-    load_bytecode 'LWP.pir'
-    .const string url = 'http://smolder.plusthree.com/app/projects/process_add_report/8'
-    .local pmc ua, response
-    ua = new ['LWP';'UserAgent']
-    ua.'show_progress'(1)
-    response = ua.'post'(url, contents :flat, 'form-data' :named('Content-Type'), 'close' :named('Connection'))
-    $I0 = response.'code'()
-    unless $I0 == 302 goto L1
-    $S0 = response.'content'()
-    say $S0
-  L1:
+    cmd .= $S0
+    cmd .= "\""
+    cmd .= " -F username="
+    cmd .= username
+    cmd .= " -F password="
+    cmd .= password
+    cmd .= " -F comments=\"EXPERIMENTAL t/harness.pir\""
+    cmd .= " -F report_file=@"
+    cmd .= archive
+    cmd .= " "
+    cmd .= smolder_url
+    .tailcall system(cmd, 1 :named('verbose'))
 .end
 
 .sub '_get_tags' :anon


More information about the parrot-commits mailing list