aboutsummaryrefslogtreecommitdiff
path: root/slave
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek.chauhan@gmail.com>2008-08-30 13:13:27 +0530
committerNirbheek Chauhan <nirbheek.chauhan@gmail.com>2008-08-30 13:13:27 +0530
commit76231987ecb51e943435e940dfce6200e2cd7dbe (patch)
tree95e36cc6bc217fddcfc5b287ba8a451ab4686091 /slave
parentFix teeny weeny bug in git-proxy-cmd.sh related to anon proxies (diff)
downloadautotua-76231987ecb51e943435e940dfce6200e2cd7dbe.tar.gz
autotua-76231987ecb51e943435e940dfce6200e2cd7dbe.tar.bz2
autotua-76231987ecb51e943435e940dfce6200e2cd7dbe.zip
Use "atexit" for cleaning up instead of the test_modules.sh kludge.
Diffstat (limited to 'slave')
-rw-r--r--slave/autotua/__init__.py3
-rwxr-xr-xslave/cleanup_on_death.py22
-rwxr-xr-xslave/test_modules.py (renamed from slave/which_tests.py)0
-rwxr-xr-xslave/test_modules.sh12
4 files changed, 2 insertions, 35 deletions
diff --git a/slave/autotua/__init__.py b/slave/autotua/__init__.py
index 5ddc53c..601937d 100644
--- a/slave/autotua/__init__.py
+++ b/slave/autotua/__init__.py
@@ -6,7 +6,7 @@
# Immortal lh!
#
-import os, shutil, urllib2
+import os, shutil, urllib2, atexit
import os.path as osp
import cPickle as pickle
from autotua import fetch, const, sync, chroot, jobuild
@@ -42,6 +42,7 @@ class Job:
self.atoms = job_data['atoms']
self.jobuilds = []
self.chroot = chroot.WorkChroot(self.jobdir, self.stage.filename)
+ atexit.register(self.tidy())
def __repr__(self):
return '<%s: %s>' % (self.name, 'Job object')
diff --git a/slave/cleanup_on_death.py b/slave/cleanup_on_death.py
deleted file mode 100755
index 00c37ea..0000000
--- a/slave/cleanup_on_death.py
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/usr/bin/env python
-# vim: set sw=4 sts=4 et :
-# Copyright: 2008 Gentoo Foundation
-# Author(s): Nirbheek Chauhan <nirbheek.chauhan@gmail.com>
-# License: GPL-2
-#
-# Immortal lh!
-#
-
-import re, subprocess
-from autotua import const
-
-def clean_mounts():
- # /proc/mounts is more reliable than mtab (which is what `mount` uses)
- mounts = open('/proc/mounts', 'r').read()
- regex = re.compile(r'%s/[^ ]+' % const.TMPDIR.replace(' ', r'\\040'))
- for mount in regex.findall(mounts):
- mount = mount.replace(r'\040(deleted)', '').replace(r'\040', ' ')
- subprocess.check_call('umount "%s"' % mount, shell=True)
-
-print "ZOMG!@~: WE DIED. Cleaning up stuff..."
-clean_mounts()
diff --git a/slave/which_tests.py b/slave/test_modules.py
index 34013a1..34013a1 100755
--- a/slave/which_tests.py
+++ b/slave/test_modules.py
diff --git a/slave/test_modules.sh b/slave/test_modules.sh
deleted file mode 100755
index e79dd29..0000000
--- a/slave/test_modules.sh
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/bash
-# vim: set sw=4 sts=4 et :
-# Copyright: 2008 Gentoo Foundation
-# Author(s): Nirbheek Chauhan <nirbheek.chauhan@gmail.com>
-# License: GPL-2
-#
-# Immortal lh!
-#
-
-WHERE="$(dirname $0)"
-
-"${WHERE}"/which_tests.py || "${WHERE}"/cleanup_on_death.py