[Collab-qa-commits] r819 - svnbuildstat/trunk/script
goneri at alioth.debian.org
goneri at alioth.debian.org
Sat Apr 26 23:10:10 UTC 2008
Author: goneri
Date: 2008-04-26 23:10:09 +0000 (Sat, 26 Apr 2008)
New Revision: 819
Modified:
svnbuildstat/trunk/script/svnbuildstat_agent.pl
Log:
try to unmount pbuilder directory if needed, send back the .dsc and .changes too
Modified: svnbuildstat/trunk/script/svnbuildstat_agent.pl
===================================================================
--- svnbuildstat/trunk/script/svnbuildstat_agent.pl 2008-04-26 21:56:02 UTC (rev 818)
+++ svnbuildstat/trunk/script/svnbuildstat_agent.pl 2008-04-26 23:10:09 UTC (rev 819)
@@ -38,8 +38,13 @@
my $admin = "Gonéri Le Bouder <goneri\@rulezlan.org>";
my $pbuildertgz = "$pbuilderplace/$distro.tar.gz";
my $server = "http://88.191.78.230:3000";
-my $keeptmpdir = 1;
+my $keeptmpdir = 0;
+my $sigTermCatched = 0;
+my $exit = 0;
+sub sigterm {print "SIGTERM!\n";$sigTermCatched=1};
+$SIG{INT}= 'sigterm';
+
die unless $maxjobs =~ /^\d+$/;
$ENV{LC_ALL} = 'C';
@@ -91,9 +96,15 @@
}
}
- # TODO: looks for mounted filesystem here and try
- # to umount them
-
+ foreach (`mount`) {
+ if (/^\/\S+\son\s(\S+)/) {
+ my $mountPoint = $1;
+ if ($mountPoint =~ /^$pbuilderplace/) {
+ print "umounting $mountPoint\n";
+ system("umount $mountPoint");
+ }
+ }
+ }
# !!! Maybe danger if $pbuilderplace is unset
# so I do another check here!
die "DANGER: pbuilderplace not correct!" unless $pbuilderplace =~ /\/./;
@@ -125,12 +136,21 @@
if (isMemFull()||isDiskFull($workplace)||isDiskFull($buildarea)||isDiskFull('/tmp')) {
print "checkSanity(): disk or memory full!!!\n";
+ purge();
+ }
+
+ $exit = 1 if $sigTermCatched;
+ if ($exit||isMemFull()||isDiskFull($workplace)||isDiskFull($buildarea)||isDiskFull('/tmp')) {
if (%job&&(isDiskFull($workplace)||isDiskFull($buildarea))) {
print "Emergency clean up\n";
killfam (15, keys %job);
-
- sleep (60*3);
+ foreach (1..10) {
+ sleep (1);
+ print ".";
+ }
+ print "\n";
+
killfam (9, keys %job);
foreach (keys %job) {
@@ -292,8 +312,8 @@
$report->{build} = "ok";
$report->{files} = '';
foreach (bsd_glob($threadbuildarea.'/*')) {
- next unless /deb$/; # deb & udeb
- $report->{packages} = $report->{packages}.basename($_).' ';
+ next if /orig\.tar\.gz$/; # deb & udeb
+ $report->{files} = $report->{files}.basename($_).' ';
postFile($_);
}
} else {
@@ -368,6 +388,7 @@
while (sleep 1) {
checkSanity();
+ exit(1) if $exit;
upgradeChroot();
# Check the running jobs (See #453710)
More information about the Collab-qa-commits
mailing list