diff options
author | Tiago Gomes <tiago.gomes@codethink.co.uk> | 2015-09-01 10:15:36 +0000 |
---|---|---|
committer | Baserock Gerrit <gerrit@baserock.org> | 2015-09-22 16:53:46 +0000 |
commit | 50247e57320de74e88049101e1ad47fb8e78b5a3 (patch) | |
tree | ec3f0fcedf9b9ef2a7ed1c49ed96d9bf994279a0 /morphlib/buildcommand.py | |
parent | 81ebe71089d802061c2c3cb03bfd548388d04cb8 (diff) | |
download | morph-50247e57320de74e88049101e1ad47fb8e78b5a3.tar.gz |
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
Diffstat (limited to 'morphlib/buildcommand.py')
-rw-r--r-- | morphlib/buildcommand.py | 11 |
1 files changed, 6 insertions, 5 deletions
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 |