aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek.chauhan@gmail.com>2008-06-28 15:48:25 +0530
committerNirbheek Chauhan <nirbheek.chauhan@gmail.com>2008-06-28 15:48:25 +0530
commita8b8677fb457bb6d0a5d1c585c0b95277212a7d0 (patch)
treeba4deea22f8f4fac97f280085deece71b43b920d /slave/autotua/jobuild
parent- Implement basic jobuild parsing (jobuild.sh, jobuild-functions.sh, jobuild/... (diff)
downloadautotua-a8b8677fb457bb6d0a5d1c585c0b95277212a7d0.tar.gz
autotua-a8b8677fb457bb6d0a5d1c585c0b95277212a7d0.tar.bz2
autotua-a8b8677fb457bb6d0a5d1c585c0b95277212a7d0.zip
- Implement jobuild atom parsing and autotua.jobuild.Jobuild()._best_jobuild() (incomplete)
- Always use a tuple in autotua.sync.Command()._get_args(); fixes a nasty runtime bug - Use subprocess module in autotua.chroot - Implement an (incomplete) autotua.chroot.WorkChroot().clean() - Implement an (incomplete) autotua.Job().clean() which calls autotua.chroot.WorkChroot().clean() - Pass around jobdir = '/var/tmp/autotua/work/<job_atom>/' instead of jobtagedir, chrootdir etc - Add testing for autotua.Job() in test_modules.py - scripts/init-autotua-tmpdirs.sh for initialising the tmpdir structure - Add README
Diffstat (limited to 'slave/autotua/jobuild')
-rw-r--r--slave/autotua/jobuild/__init__.py40
1 files changed, 32 insertions, 8 deletions
diff --git a/slave/autotua/jobuild/__init__.py b/slave/autotua/jobuild/__init__.py
index 76b8e52..1e0e2cf 100644
--- a/slave/autotua/jobuild/__init__.py
+++ b/slave/autotua/jobuild/__init__.py
@@ -15,18 +15,41 @@ from .. import const
class Jobuild(object):
"""A jobuild"""
- def __init__(self, atom):
+ def __init__(self, jobdir, atom):
self.name = atom
- # Hardcoding to central jobtagedir now, proper resolver, version parsing crap later.
- parts = self.split_atom(atom)
- self.jobuild = '%s/%s/%s/%s-%s.jobuild' % (const.JOBTAGE_DIR, parts[1], parts[2], parts[2], parts[3])
+ self.jobdir = jobdir
+ self.jobuild = self._best_jobuild(atom)
def __str__(self):
return '%s jobuild object' % self.name
- def split_atom(self, atom):
- regex = re.compile(r'([=<>]*)([a-zA-Z0-9_+-]*)/([a-zA-Z0-9_+-]*)-([0-9\.]*)') # Implement reusing of this later.
- return regex.sub(r'\1 \2 \3 \4', atom).split()
+ def _split_atom(self, atom):
+ regex = re.compile(r'^([<>]?=)?([a-zA-Z0-9_+-]+)/([a-zA-Z0-9_+-]+)(-|$)([0-9]+\.[0-9]+)?') # Fancy regex aye?
+ # >= bheekling / test-beagle - 1.0
+ # bheekling / build-brasero
+ parts = regex.findall(atom)
+ if not parts:
+ # FIXME: Custom exceptions
+ raise 'Invalid atom %s' % atom
+ parts = parts[0]
+ if parts[3] and not parts[4]:
+ # FIXME: Custom exceptions
+ raise 'Invalid atom %s' % atom
+ parts = (parts[0], parts[1], parts[2], parts[4],)
+ if (parts[0] and not parts[3]) or (parts[3] and not parts[0]):
+ # FIXME: Custom exceptions
+ raise 'Invalid atom %s' % atom
+ return parts
+
+ def _best_jobuild(self, atom):
+ parts = self._split_atom(atom)
+ data = {'maint': parts[1],
+ 'pn': parts[2],
+ 'pv': parts[3],
+ 'jobtage': '%s/jobtage' % self.jobdir}
+ # FIXME: Add support for overlays, [<>]=, and unqualified atoms
+ jobuild = '%(jobtage)s/%(maint)s/%(pn)s/%(pn)s-%(pv)s.jobuild' % data
+ return jobuild
def get_var(self, var):
"""
@@ -41,6 +64,7 @@ class Jobuild(object):
process.stdin.write('ping\n')
response = process.stderr.readline()[:-1] # Remove trailing newline
if not response == 'pong':
- sys.exit('Communication error: received %s when expecting "pong"' % response)
+ # FIXME: Custom exceptions
+ raise 'Communication error: received %s when expecting "pong"' % response
response = process.stderr.readline()[:-1]
print response