[Collab-qa-commits] r666 - svnbuildstat/trunk/script

goneri-guest at alioth.debian.org goneri-guest at alioth.debian.org
Sun Jan 20 21:33:13 UTC 2008


Author: goneri-guest
Date: 2008-01-20 21:33:12 +0000 (Sun, 20 Jan 2008)
New Revision: 666

Modified:
   svnbuildstat/trunk/script/svnbuildstat_agent.pl
Log:
minor changes

Modified: svnbuildstat/trunk/script/svnbuildstat_agent.pl
===================================================================
--- svnbuildstat/trunk/script/svnbuildstat_agent.pl	2008-01-20 21:31:13 UTC (rev 665)
+++ svnbuildstat/trunk/script/svnbuildstat_agent.pl	2008-01-20 21:33:12 UTC (rev 666)
@@ -32,7 +32,7 @@
 
 #my $maxjobs = $config->agent_maxjobs;
 my $maxjobs = 1;
-my $vardir = "/home/goneri/svnbuildstat/tmp";
+my $vardir = "/home/goneri/svnbuildstattest";
 my $workplace = $vardir."/workplace";
 my $pbuilderplace = $vardir."/pbuilder";
 #my $tarballsplace = $vardir."/tarballs";
@@ -211,8 +211,9 @@
   if (bsd_glob($threadbuildarea.'/*.changes')) {
     print "build is ok\n";
     $report->{build} = "ok";
+    $report->{binarypackages} = '';
     foreach (bsd_glob($threadbuildarea.'/*.deb'), bsd_glob($threadbuildarea.'/*.udeb')) {
-      $report->{binarypackages} = basename($_).' ';
+      $report->{binarypackages} = $report->{binarypackages}.basename($_).' ';
       postFile($_);
     }
   } else {
@@ -226,7 +227,7 @@
     chomp $report->{$_};
     print BUILDREPORT $_."=".$report->{$_}."\n";
   }
-  print BUILDREPORT "-END-\n";
+#  print BUILDREPORT "-END-\n";
   close BUILDREPORT;
   postFile ($threadbuildarea."/".$infofile);
 
@@ -264,7 +265,7 @@
   $report->{'stamp_build-start'} = time;
   my $dsc_localpath = $threadworkplace.'/'.basename($report->{dsc});
   
-  `cd $threadworkplace/$tarballdir; pbuilder --build --buildresult $threadbuildarea --configfile $ccachedir/ccache.cfg --buildplace $pbuilderplace --aptcache $aptcachedir --distribution $distro --basetgz $pbuilderplace/$distro.tar.gz $dsc_localpath >$threadbuildarea/build.log.tmp 2>&1`;
+  `cd $threadworkplace/$tarballdir; pbuilder --build --buildresult $threadbuildarea --configfile $ccachedir/ccache.cfg --buildplace $pbuilderplace --aptcache $aptcachedir --distribution $distro --basetgz $pbuilderplace/$distro.tar.gz --timeout 10h $dsc_localpath >$threadbuildarea/build.log.tmp 2>&1`;
   $report->{'stamp_build-end'} = time;
 
   sendReport($report, $threadbuildarea);
@@ -274,44 +275,48 @@
   1;
 }
 
-while (sleep 1) { # TODO replace by a more important values
+while (sleep 15) { # TODO replace by a more important values
 
   if (isFull($workplace)||isFull($buildarea)) {
     `rm -f $aptcachedir/*` unless $keeptmpdir;
     print "disk is full\n";
     if (%job&&(isFull($workplace)||isFull($buildarea))) {
       print "Emergency clean up\n";
-      kill 9, $_ foreach (keys %job);
+      foreach (keys %job) {
+        kill 9, $_;
+        waitpid($_, WNOHANG);
+        delete ($job{$_});
+      }
+      `rm -rf $workplace/* $buildarea/*` unless $keeptmpdir;
     }
   }
 
   upgradeChroot();
 
+# Check the running jobs (See #453710)
   foreach my $pid (keys %job) {
-    if (time > $job{$pid} + 3600*4) {
-      print "kill\n";
-      kill 9, $pid; # timeout
-      sleep 5;
-    }
+    print "ckeck $pid, still ".int(keys %job)." running process\n";
+    waitpid($pid, WNOHANG);
     if (! -d "/proc/".$pid) {
+      print "$pid is finish\n";
       `rm -rf $workplace/$pid $buildarea/$pid` unless $keeptmpdir;
       delete ($job{$pid});
     }
-    waitpid($pid,WNOHANG);
   }
 
+
   if (keys %job < $maxjobs) {
     my $newpid = fork;
-    if ($newpid) {
+    if ($newpid) { # Father
       $job{$newpid} = time;
-    } else {
+    } else { # Son
       my $report = getBuildJob ();
       if (!exists($report->{dsc})) {
-        print "Can't get a package to rebuild from $server\n";
+        print "Can't get a package to build from $server\n";
       } else {
         build($report);
+        print "done\n";
       }
-      print "done\n";
       exit;
     }
   }




More information about the Collab-qa-commits mailing list