[Midnightbsd-cvs] mports: magus.pl: various cleanups.
ctriv at midnightbsd.org
ctriv at midnightbsd.org
Fri Mar 7 02:31:10 EST 2008
Log Message:
-----------
various cleanups. Most importantly, we refresh the port object in the
parent after the child exits. This insures that package is uploaded in the
port passed.
Modified Files:
--------------
mports/Tools/magus/slave:
magus.pl (r1.12 -> r1.13)
-------------- next part --------------
Index: magus.pl
===================================================================
RCS file: /home/cvs/mports/Tools/magus/slave/magus.pl,v
retrieving revision 1.12
retrieving revision 1.13
diff -L Tools/magus/slave/magus.pl -L Tools/magus/slave/magus.pl -u -r1.12 -r1.13
--- Tools/magus/slave/magus.pl
+++ Tools/magus/slave/magus.pl
@@ -117,7 +117,7 @@
=head3 Exiting
Note that all the locks associated with this machine will be deleted at
-script exit. If you are running to copies of this script on one machine,
+script exit. If you are running two copies of this script on one machine,
make sure to assign them different machine IDs in the master database.
=cut
@@ -157,7 +157,8 @@
# we fork so just the child chroots, then we can get out of the chroot.
my $pid = fork();
if ($pid) {
- # Parent, we wait for the child to finish.
+ # Parent, we wait for the child to finish, and if we get sigint
+ # while we are waiting, we stop the child and then cleanup
local $SIG{INT} = sub {
waitpid($pid, 0);
handle_exception("Caught SIGINT", $lock);
@@ -166,11 +167,12 @@
waitpid($pid, 0);
} elsif (defined $pid) {
+ # child here; chroot and test the port
eval {
$chroot->do_chroot();
chdir($port->origin);
- my $test = Magus::PortTest->new(port => $port, chroot => $chroot);
+ my $test = Magus::PortTest->new(port => $port, chroot => $chroot);
report('info', "Building $port");
my $results = $test->run;
@@ -186,8 +188,12 @@
die "Could not fork: $!\n";
}
- # Back to the parent here.
+ # Back to the parent here
if ($? == 0) {
+ # update our port object with new data from the database, as the child
+ # process probably changed stuff
+ $port->refresh;
+
eval {
if ($port->status eq 'pass' || $port->status eq 'warn') {
upload_pkgfile($port, $chroot);
@@ -400,8 +406,15 @@
die "Couldn't fetch $tarball";
}
+
+ report(debug => "Deleting old /usr/mports");
rmtree('/usr/mports');
+
+
+ report(debug => "Extracting %s", $current->tarball);
system('/usr/bin/tar xf ' . $current->tarball);
+
+ report(debug => "Reloading self.");
exec($self, @origARGV);
}
More information about the Midnightbsd-cvs
mailing list