8 def __init__(self, config, builddir, logtofile):
10 self.builddir = builddir
11 self.logfile = infra.open_log_file(builddir, "build", logtofile)
14 if not os.path.isdir(self.builddir):
15 os.makedirs(self.builddir)
17 config_file = os.path.join(self.builddir, ".config")
18 with open(config_file, "w+") as cf:
20 # dump the defconfig to the logfile for easy debugging
21 self.logfile.write("> start defconfig\n" + self.config +
26 "O={}".format(self.builddir),
28 ret = subprocess.call(cmd, stdout=self.logfile, stderr=self.logfile)
30 raise SystemError("Cannot olddefconfig")
32 cmd = ["make", "-C", self.builddir]
33 ret = subprocess.call(cmd, stdout=self.logfile, stderr=self.logfile)
35 raise SystemError("Build failed")
37 open(self.stamp_path(), 'a').close()
40 return os.path.join(self.builddir, "build-done")
42 def is_finished(self):
43 return os.path.exists(self.stamp_path())
46 if os.path.exists(self.builddir):
47 shutil.rmtree(self.builddir)