~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/canonical/buildd/buildrecipe

  • Committer: Martin Pool
  • Date: 2011-11-02 01:14:15 UTC
  • mto: This revision was merged to the branch mainline in revision 14240.
  • Revision ID: mbp@canonical.com-20111102011415-slzg1t8jflqomsp9
Report resource usage when running bzr dailybuild

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
from resource import RLIMIT_AS, setrlimit
14
14
import socket
15
15
from subprocess import (
 
16
    Popen,
16
17
    call,
17
 
    check_call,
18
18
    )
19
19
import sys
20
20
 
33
33
        Exception.__init__(self, 'Not running under Xen.')
34
34
 
35
35
 
 
36
def call_report_rusage(args):
 
37
    """Run a subprocess.
 
38
 
 
39
    Report that it was run, and the resources used, and complain if it fails.
 
40
 
 
41
    :return: The process wait status.
 
42
    """
 
43
    print 'RUN %r' % args
 
44
    proc = Popen(args)
 
45
    pid, status, rusage = os.wait4(proc.pid, 0)
 
46
    print(rusage)
 
47
    return status
 
48
 
 
49
 
36
50
class RecipeBuilder:
37
51
    """Builds a package from a recipe."""
38
52
 
106
120
            'DEBEMAIL': self.author_email,
107
121
            'DEBFULLNAME': self.author_name.encode('utf-8'),
108
122
            'BZR_EMAIL': bzr_email}
109
 
        retcode = call([
 
123
        retcode = call_report_rusage([
110
124
            'bzr', 'dailydeb', '--safe', '--no-build', recipe_path,
111
125
            self.tree_path, '--manifest', manifest_path,
112
126
            '--append-version', '~%s1' % self.distroseries_name], env=env)