finally:
b.stop()
- def _build(self, pkg, resultdir, nodeps=False, **kwargs):
+ def _build(self, pkg, resultdir, nodeps=False, prepare=False, **kwargs):
b = builder.Builder(self, pkg, resultdir, **kwargs)
+ stages = None
+ if prepare:
+ stages = ("prepare",)
+
try:
- b.build()
+ b.build(stages=stages)
except Error:
raise BuildError, _("Build command has failed.")
try:
b.start()
+
+ try:
+ b.build(prepare=True)
+ except BuildError:
+ pass
+
b.shell()
finally:
b.stop()
return ret
- def build(self, install_test=True):
+ def build(self, install_test=True, prepare=False):
if not self.pkg:
raise BuildError, _("You cannot run a build when no package was given.")
"--resultdir=/result",
]
+ if prepare:
+ build_command.append("--prepare")
+
try:
self.do(" ".join(build_command), logger=self.log)
# Perform the install test after the actual build.
- if install_test:
+ if install_test and not prepare:
self.install_test()
except Error:
raise BuildError, _("The build command failed. See logfile for details.")
+ # Don't sign packages in prepare mode.
+ if prepare:
+ return
+
# Sign all built packages with the host key (if available).
if self.settings.get("sign_packages"):
host_key = self.keyring.get_host_key_id()
return f.name
- def build(self):
+ def build(self, stages=None):
# Create buildroot and remove all content if it was existant.
util.rm(self.buildroot)
os.makedirs(self.buildroot)
# Build icecream toolchain if icecream is installed.
self.create_icecream_toolchain()
- for stage in ("prepare", "build", "test", "install"):
+ if stages is None:
+ stages = ("prepare", "build", "test", "install")
+ stop_early = False
+ else:
+ stop_early = True
+
+ for stage in stages:
self.build_stage(stage)
+ # Stop if only the prepare stage is wanted.
+ if stop_early:
+ return
+
# Run post-build stuff.
self.post_compress_man_pages()
self.post_remove_static_libs()
help=_("Mode to run in. Is either 'release' or 'development' (default)."))
sub_build.add_argument("--nodeps", action="store_true",
help=_("Do not verify build dependencies."))
+ sub_build.add_argument("--prepare", action="store_true",
+ help=_("Only run the prepare stage."))
def handle_build(self):
# Get the package descriptor from the command line options
"builder_mode" : self.args.mode,
"config" : conf,
"disable_repos" : disable_repos,
+ "prepare" : self.args.prepare,
"resultdir" : self.args.resultdir,
}