25
23
class LiveFilesystemBuildManager(DebianBuildManager):
26
24
"""Build a live filesystem."""
28
27
initial_build_state = LiveFilesystemBuildState.BUILD_LIVEFS
30
def __init__(self, slave, buildid, **kwargs):
31
DebianBuildManager.__init__(self, slave, buildid, **kwargs)
32
self.build_livefs_path = os.path.join(self._slavebin, "buildlivefs")
34
29
def initiate(self, files, chroot, extra_args):
35
30
"""Initiate a build with a given set of files and chroot."""
36
self.build_path = get_build_path(
37
self.home, self._buildid, "chroot-autobuild", "build")
38
if os.path.isdir(self.build_path):
39
shutil.rmtree(self.build_path)
41
31
self.subarch = extra_args.get("subarch")
42
32
self.project = extra_args["project"]
43
33
self.subproject = extra_args.get("subproject")
44
self.series = extra_args["series"]
45
34
self.pocket = extra_args["pocket"]
46
35
self.datestamp = extra_args.get("datestamp")
47
36
self.image_format = extra_args.get("image_format")
48
37
self.locale = extra_args.get("locale")
49
38
self.extra_ppas = extra_args.get("extra_ppas", [])
39
self.channel = extra_args.get("channel")
40
self.debug = extra_args.get("debug", False)
51
42
super(LiveFilesystemBuildManager, self).initiate(
52
43
files, chroot, extra_args)
54
45
def doRunBuild(self):
55
46
"""Run the process to build the live filesystem."""
58
"--build-id", self._buildid,
59
"--arch", self.arch_tag,
62
49
args.extend(["--subarch", self.subarch])
63
50
args.extend(["--project", self.project])
64
51
if self.subproject:
65
52
args.extend(["--subproject", self.subproject])
66
args.extend(["--series", self.series])
68
54
args.extend(["--datestamp", self.datestamp])
69
55
if self.image_format:
74
60
args.extend(["--locale", self.locale])
75
61
for ppa in self.extra_ppas:
76
62
args.extend(["--extra-ppa", ppa])
77
self.runSubProcess(self.build_livefs_path, args)
64
args.extend(["--channel", self.channel])
66
args.append("--debug")
67
self.runTargetSubProcess("buildlivefs", *args)
79
69
def iterate_BUILD_LIVEFS(self, retcode):
80
70
"""Finished building the live filesystem."""
102
92
def gatherResults(self):
103
93
"""Gather the results of the build and add them to the file cache."""
104
for entry in sorted(os.listdir(self.build_path)):
105
path = os.path.join(self.build_path, entry)
106
if entry.startswith("livecd.") and not os.path.islink(path):
107
self._slave.addWaitingFile(path)
94
for entry in sorted(self.backend.listdir("/build")):
95
path = os.path.join("/build", entry)
96
if (entry.startswith("livecd.") and
97
not self.backend.islink(path)):
98
self.addWaitingFileFromBackend(path)