aboutsummaryrefslogtreecommitdiff
blob: db3238dcc1e48761e59ac4d1972b39c121c5d48f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/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 autotua, shutil, os, sys
import os.path as osp
from autotua import chroot, fetch, sync

tmpdir = '/tmp'
#modules = ['job', 'fetch', 'sync', 'chroot']

if 'fetch' in modules:
    job = autotua.Jobs().getjobs()[0]
    fetcher = autotua.fetch.Fetcher(tmpdir)
    fetcher.fetch(job.stage)

if 'sync' in modules:
    destdir = tmpdir+'/jobtage'
    syncer = autotua.sync.Syncer(destdir=destdir)
    syncer.sync()

if 'chroot' in modules:
    job = autotua.Jobs().getjobs()[0]
    chroot = autotua.chroot.WorkChroot(job.jobdir, job.stage.filename)
    chroot.setup()
    chroot.tidy()

if 'job' in modules:
    job = autotua.Jobs().getjobs()[0]
    job.fetch()
    if os.getuid() == 0:
        job.prepare()
        job.tidy()
    else:
        print 'You need to be root to run job.prepare()'