chiark / gitweb /
WIP commod-update-receiver testing - seems to work
authorIan Jackson <ian@liberator.relativity.greenend.org.uk>
Fri, 24 Jul 2009 21:51:12 +0000 (22:51 +0100)
committerIan Jackson <ian@liberator.relativity.greenend.org.uk>
Fri, 24 Jul 2009 21:51:12 +0000 (22:51 +0100)
pctb/Commods.pm
pctb/commod-results-processor
pctb/commod-update-receiver

index 073906ff9da07defd3a8aa3380115ffc6c3cbcd9..5eb9c7bba749cb1a09888c0b32c9bd9608cae499 100644 (file)
@@ -117,7 +117,10 @@ sub get_our_version ($$) {
     my ($aref,$prefix) = @_;
     $aref->{"${prefix}name"}= 'ypp-sc-tools yarrg';
     $aref->{"${prefix}fixes"}= 'lastpage';
     my ($aref,$prefix) = @_;
     $aref->{"${prefix}name"}= 'ypp-sc-tools yarrg';
     $aref->{"${prefix}fixes"}= 'lastpage';
-    $aref->{"${prefix}version"}= `git-describe --tags HEAD`; $? and die $?;
+
+    my $version= `git-describe --tags HEAD`; $? and die $?;
+    chomp($version);
+    $aref->{"${prefix}version"}= $version;
     return $aref;
 }
 
     return $aref;
 }
 
@@ -148,7 +151,7 @@ sub pipethrough_run_gzip ($) {
 
 sub cgipostform ($$$) {
     my ($ua, $url, $form) = @_;
 
 sub cgipostform ($$$) {
     my ($ua, $url, $form) = @_;
-    my $req= HTTP::Request::Common::POST($url, 
+    my $req= HTTP::Request::Common::POST($url,
                                         Content => $form,
                                         Content_Type => 'form-data');
     if ($url =~ m,^\.?/,) {
                                         Content => $form,
                                         Content_Type => 'form-data');
     if ($url =~ m,^\.?/,) {
@@ -173,6 +176,7 @@ sub cgipostform ($$$) {
            }
 #system 'printenv >&2';
        }, "$url", "$url");
            }
 #system 'printenv >&2';
        }, "$url", "$url");
+       $out =~ s/\r\n/\n/g;
        $out =~ m,^Content-Type: text/plain.*\n\n, or die "$out ?";
        return $';
     } else {
        $out =~ m,^Content-Type: text/plain.*\n\n, or die "$out ?";
        return $';
     } else {
index 0286ab3fd99a2203584dac2bc665f48748d37a1f..350ef366d0baa6fda394e4105a4ca624c6008681 100755 (executable)
@@ -455,8 +455,7 @@ sub main__uploadyaarg () {
     my $dest= $ENV{'YPPSC_YAARG_SUBMIT'};
 
     my $respcontent= cgipostform($ua, "$dest/commod-update-receiver", \%o);
     my $dest= $ENV{'YPPSC_YAARG_SUBMIT'};
 
     my $respcontent= cgipostform($ua, "$dest/commod-update-receiver", \%o);
-
-    print $respcontent();
+    $respcontent =~ m/^OK\b/ or die "$respcontent ?";
 }
 
 sub main__uploadpctb () {
 }
 
 sub main__uploadpctb () {
index ac52fec7fe89499ab5feed1ca168ec858c0f1776..11064cd7d9b6897f9194116690602eebb71e3e81 100755 (executable)
@@ -120,9 +120,11 @@ foreach my $cs (qw(client server)) {
 }
 
 foreach my $vn (sort keys %o) {
 }
 
 foreach my $vn (sort keys %o) {
-    my $mpart= MIME::Entity->build(Type => 'text/plain',
+    my $mpart= MIME::Entity->build(Top => 0,
+                                  Type => 'text/plain',
                                   Charset => 'utf-8',
                                   Charset => 'utf-8',
-                                  Disposition => 'inline',
+                                  Disposition => 'attachment',
+                                  Filename => $vn,
                                   Data => $o{$vn});
     $mcontent->add_part($mpart);
 }
                                   Data => $o{$vn});
     $mcontent->add_part($mpart);
 }
@@ -156,15 +158,21 @@ while (<GZ>) {
 GZ->error and die $!;
 $?=0; close GZ; $? and fail("gunzip for check failed code $?");
 
 GZ->error and die $!;
 $?=0; close GZ; $? and fail("gunzip for check failed code $?");
 
-my $mdatafile= MIME::Entity->build(Type => 'application/octet-stream',
+my $mdatafile= MIME::Entity->build(Top => 0,
+                                  Type => 'application/octet-stream',
                                   Disposition => 'attachment',
                                   Encoding => 'base64',
                                   Disposition => 'attachment',
                                   Encoding => 'base64',
-                                  File => $datafile);
+                                  Filename => 'deduped.tsv.gz',
+                                  Path => $datafile);
 $mcontent->add_part($mdatafile);
 
 $mcontent->add_part($mdatafile);
 
-open M, "|/usr/sbin/sendmail -t -oi -oee -odq"
+open M, "|/usr/sbin/sendmail -t -oi -oee -odb"
     or fail("fork sendmail failed! ($!)");
 $mcontent->print(\*M);
 
 M->error and fail("write sendmail failed! ($!)");
 $?=0; close M; $? and fail("sendmail failed code $?");
     or fail("fork sendmail failed! ($!)");
 $mcontent->print(\*M);
 
 M->error and fail("write sendmail failed! ($!)");
 $?=0; close M; $? and fail("sendmail failed code $?");
+
+print header(-type=>'text/plain', -charset=>'us-ascii'),
+      "OK\n"
+    or die $!;