From 50247e57320de74e88049101e1ad47fb8e78b5a3 Mon Sep 17 00:00:00 2001 From: Tiago Gomes Date: Tue, 1 Sep 2015 10:15:36 +0000 Subject: Simplify StagingArea class Pass the Source to the staging area constructor so that we don't need to pass it as a parameter when we call some StagingArea methods. Also move the creation of the build and destdir directories to the constructor so that we can get rid of the chroot_open() and chroot_close() methods. Also, provide API to retrieve the relative locations for buildir and destdir. Change-Id: I6e8085392e19ff3d8df807f260acf90eec9e0901 --- morphlib/buildcommand.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'morphlib/buildcommand.py') diff --git a/morphlib/buildcommand.py b/morphlib/buildcommand.py index 3ace34bd..bb354b2f 100644 --- a/morphlib/buildcommand.py +++ b/morphlib/buildcommand.py @@ -362,13 +362,14 @@ class BuildCommand(object): use_chroot = True setup_mounts = True - staging_area = self.create_staging_area(build_env, + staging_area = self.create_staging_area(source, + build_env, use_chroot, extra_env=extra_env, extra_path=extra_path) self.install_dependencies(staging_area, deps, source) else: - staging_area = self.create_staging_area(build_env, False) + staging_area = self.create_staging_area(source, build_env, False) self.build_and_cache(staging_area, source, setup_mounts) self.remove_staging_area(staging_area) @@ -440,15 +441,15 @@ class BuildCommand(object): name=artifact.name) fetch_files(to_fetch) - def create_staging_area(self, build_env, use_chroot=True, extra_env={}, - extra_path=[]): + def create_staging_area(self, source, build_env, use_chroot=True, + extra_env={}, extra_path=[]): '''Create the staging area for building a single artifact.''' self.app.status(msg='Creating staging area') staging_dir = tempfile.mkdtemp( dir=os.path.join(self.app.settings['tempdir'], 'staging')) staging_area = morphlib.stagingarea.StagingArea( - self.app, staging_dir, build_env, use_chroot, extra_env, + self.app, source, staging_dir, build_env, use_chroot, extra_env, extra_path) return staging_area -- cgit v1.2.1