Merge lp:~mvo/launchpad-buildd/mvo into lp:launchpad-buildd

Proposed by Michael Vogt
Status: Work in progress
Proposed branch: lp:~mvo/launchpad-buildd/mvo
Merge into: lp:launchpad-buildd
Diff against target: 106 lines (+40/-8)
1 file modified
buildlivefs (+40/-8)
To merge this branch: bzr merge lp:~mvo/launchpad-buildd/mvo
Reviewer Review Type Date Requested Status
Colin Watson Needs Fixing
Review via email:

Description of the change

This branch takes the excellent buildlivefs and adds some tweaks to make it more useful outside the buildd environment.

If that branch lands, we can consider moving it outside of the launchpad-buildd branch and into somehthing more general like livecd-rootfs or ubuntu-dev-tools so that people who want to experiment with building a rootfs. It would also provide a canonical way of building the rootfs and could superseed tools like rootstock and BuildLiveCD.

A careful review for this is needed as I'm new to the world of livefs building/buildds and may miss important setup steps that are taken before buildlivefs is called (i.e. I'm not sure if the deboostrap step I added is sufficient).

Thanks for your consideration,

To post a comment you must log in.
lp:~mvo/launchpad-buildd/mvo updated
131. By Michael Vogt

add a default to build-id assuming that local use is mostly sequentical

Revision history for this message
Colin Watson (cjwatson) :
review: Needs Fixing
lp:~mvo/launchpad-buildd/mvo updated
132. By Michael Vogt

fix review issues raised by Colin

Revision history for this message
Michael Vogt (mvo) wrote :

Thanks a lot for your review Colin. I addressed your points in r132. From reading your reply it seems like you disapprove of the idea to make this something that could live outside of launchpad-buildd. In which case the revert of the chroot creation and the build-id default make sense of course.

Revision history for this message
Colin Watson (cjwatson) wrote :

I think it would be odd to move buildlivefs outside of launchpad-buildd and not the corresponding helpers for other build types, and buildlivefs's interface is quite closely tied to launchpad-buildd so it would be nice not to end up overcomplicating our deployments, especially as buildds have historically been stuck on old Ubuntu releases (maybe this will change with scalingstack, but let's see). I don't mind making buildlivefs friendlier for occasional non-launchpad-buildd use; I'd just prefer this not to involve things that might be less resilient to bugs elsewhere in production.

Unmerged revisions

132. By Michael Vogt

fix review issues raised by Colin

131. By Michael Vogt

add a default to build-id assuming that local use is mostly sequentical

130. By Michael Vogt

refactor debootrap into _prepare_chroot() and add friendly message at the end of the build

129. By Michael Vogt

make buildlivefs more general purpose

128. By Michael Vogt

buildlivefs: if the chroot_path does not exits, bootstrap it

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'buildlivefs'
--- buildlivefs 2014-06-24 14:59:08 +0000
+++ buildlivefs 2014-07-24 11:39:17 +0000
@@ -19,14 +19,14 @@
22def get_build_path(build_id, *extra):22def get_build_path(build_home, build_id, *extra):
23 """Generate a path within the build directory.23 """Generate a path within the build directory.
25 :param build_id: the build id to use.25 :param build_id: the build id to use.
26 :param extra: the extra path segments within the build directory.26 :param extra: the extra path segments within the build directory.
27 :return: the generated path.27 :return: the generated path.
28 """28 """
29 return os.path.join(os.environ["HOME"], "build-" + build_id, *extra)29 return os.path.join(build_home, "build-" + build_id, *extra)
32non_meta_re = re.compile(r'^[a-zA-Z0-9+,./:=@_-]+$')32non_meta_re = re.compile(r'^[a-zA-Z0-9+,./:=@_-]+$')
@@ -64,13 +64,36 @@
64 ]64 ]
67class MissingOptionError(Exception):
68 """A required option for the LiveFSBuilder is missing"""
69 pass
72class MissingChrootError(Exception):
73 """A chroot is missing"""
74 pass
67class LiveFSBuilder:77class LiveFSBuilder:
68 """Builds a live file system."""78 """Builds a live file system."""
70 def __init__(self, options):80 def __init__(self, options):
81 self._check_options(options)
71 self.options = options82 self.options = options
72 self.chroot_path = get_build_path(83 self.chroot_path = get_build_path(
73 self.options.build_id, 'chroot-autobuild')84 options.build_home, options.build_id, 'chroot-autobuild')
85 # be gentle to people who run it outside the buildd environment
86 if not os.path.exists(self.chroot_path):
87 raise MissingChrootError(
88 "Missing chroot at '%s'. Please check chroot_url from "
89 "" % (
90 self.chroot_path, options.series, options.arch))
92 def _check_options(self, options):
93 for required_option in ("arch", "project", "series"):
94 if getattr(options, required_option) is None:
95 raise MissingOptionError(
96 "Option '--%s' is required" % required_option)
75 def chroot(self, args, echo=False):98 def chroot(self, args, echo=False):
76 """Run a command in the chroot.99 """Run a command in the chroot.
@@ -161,19 +184,23 @@
162def main():185def main():
163 parser = OptionParser()186 parser = OptionParser()
164 parser.add_option("--build-id", help="build identifier")187 parser.add_option(
165 parser.add_option(188 "--build-id", help="build identifier (use buildlivefs if in doubt)")
166 "--arch", metavar="ARCH", help="build for architecture ARCH")189 parser.add_option(
190 "--arch", metavar="ARCH",
191 help="build for architecture ARCH (e.g. amd64)")
167 parser.add_option(192 parser.add_option(
168 "--subarch", metavar="SUBARCH",193 "--subarch", metavar="SUBARCH",
169 help="build for subarchitecture SUBARCH")194 help="build for subarchitecture SUBARCH")
170 parser.add_option(195 parser.add_option(
171 "--project", metavar="PROJECT", help="build for project PROJECT")196 "--project", metavar="PROJECT",
197 help="build for project PROJECT (e.g. ubuntu-desktop)")
172 parser.add_option(198 parser.add_option(
173 "--subproject", metavar="SUBPROJECT",199 "--subproject", metavar="SUBPROJECT",
174 help="build for subproject SUBPROJECT")200 help="build for subproject SUBPROJECT")
175 parser.add_option(201 parser.add_option(
176 "--series", metavar="SERIES", help="build for series SERIES")202 "--series", metavar="SERIES",
203 help="build for series SERIES (e.g. trusty)")
177 parser.add_option("--datestamp", help="date stamp")204 parser.add_option("--datestamp", help="date stamp")
178 parser.add_option(205 parser.add_option(
179 "--image-format", metavar="FORMAT", help="produce an image in FORMAT")206 "--image-format", metavar="FORMAT", help="produce an image in FORMAT")
@@ -186,6 +213,9 @@
186 parser.add_option(213 parser.add_option(
187 "--extra-ppa", dest="extra_ppas", default=[], action="append",214 "--extra-ppa", dest="extra_ppas", default=[], action="append",
188 help="use this additional PPA")215 help="use this additional PPA")
216 parser.add_option(
217 "--build-home", metavar="DIRECTORY", default=os.environ["HOME"],
218 help="Root directory for the build results (default to $HOME)")
189 options, _ = parser.parse_args()219 options, _ = parser.parse_args()
191 builder = LiveFSBuilder(options)221 builder = LiveFSBuilder(options)
@@ -196,6 +226,8 @@
197 try:227 try:
229 print("Success. Build result is available at '%s'" %
230 os.path.join(builder.chroot_path, "build"))
199 except Exception:231 except Exception:
200 traceback.print_exc()232 traceback.print_exc()


People subscribed via source and target branches