summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--morphlib/buildcommand.py8
-rw-r--r--morphlib/builder2.py13
-rw-r--r--morphlib/builder2_tests.py3
-rw-r--r--morphlib/plugins/cross-bootstrap_plugin.py2
-rw-r--r--morphlib/stagingarea.py28
5 files changed, 12 insertions, 42 deletions
diff --git a/morphlib/buildcommand.py b/morphlib/buildcommand.py
index 2aec5e08..7398dcfc 100644
--- a/morphlib/buildcommand.py
+++ b/morphlib/buildcommand.py
@@ -321,7 +321,6 @@ class BuildCommand(object):
self.cache_artifacts_locally(deps)
use_chroot = False
- setup_mounts = False
if source.morphology['kind'] == 'chunk':
build_mode = source.build_mode
extra_env = {'PREFIX': source.prefix}
@@ -338,7 +337,6 @@ class BuildCommand(object):
if build_mode == 'staging':
use_chroot = True
- setup_mounts = True
staging_area = self.create_staging_area(build_env,
use_chroot,
@@ -352,7 +350,7 @@ class BuildCommand(object):
else:
staging_area = self.create_staging_area(build_env, False)
- self.build_and_cache(staging_area, source, setup_mounts)
+ self.build_and_cache(staging_area, source)
self.remove_staging_area(staging_area)
td = datetime.datetime.now() - starttime
@@ -519,7 +517,7 @@ class BuildCommand(object):
if target_source.build_mode == 'staging':
morphlib.builder2.ldconfig(self.app.runcmd, staging_area.dirname)
- def build_and_cache(self, staging_area, source, setup_mounts):
+ def build_and_cache(self, staging_area, source):
'''Build a source and put its artifacts into the local cache.'''
self.app.status(msg='Starting actual build: %(name)s '
@@ -527,7 +525,7 @@ class BuildCommand(object):
name=source.name, sha1=source.sha1[:7])
builder = morphlib.builder2.Builder(
self.app, staging_area, self.lac, self.rac, self.lrc,
- self.app.settings['max-jobs'], setup_mounts)
+ self.app.settings['max-jobs'])
return builder.build_and_cache(source)
class InitiatorBuildCommand(BuildCommand):
diff --git a/morphlib/builder2.py b/morphlib/builder2.py
index f2ef7393..e890dd5f 100644
--- a/morphlib/builder2.py
+++ b/morphlib/builder2.py
@@ -167,8 +167,7 @@ class BuilderBase(object):
'''Base class for building artifacts.'''
def __init__(self, app, staging_area, local_artifact_cache,
- remote_artifact_cache, source, repo_cache, max_jobs,
- setup_mounts):
+ remote_artifact_cache, source, repo_cache, max_jobs):
self.app = app
self.staging_area = staging_area
self.local_artifact_cache = local_artifact_cache
@@ -177,7 +176,6 @@ class BuilderBase(object):
self.repo_cache = repo_cache
self.max_jobs = max_jobs
self.build_watch = morphlib.stopwatch.Stopwatch()
- self.setup_mounts = setup_mounts
def save_build_times(self):
'''Write the times captured by the stopwatch'''
@@ -292,8 +290,7 @@ class ChunkBuilder(BuilderBase):
def build_and_cache(self): # pragma: no cover
with self.build_watch('overall-build'):
- builddir, destdir = self.staging_area.chroot_open(
- self.source, self.setup_mounts)
+ builddir, destdir = self.staging_area.chroot_open(self.source)
stdout = (self.app.output
if self.app.settings['build-log-on-stdout'] else None)
@@ -708,22 +705,20 @@ class Builder(object): # pragma: no cover
}
def __init__(self, app, staging_area, local_artifact_cache,
- remote_artifact_cache, repo_cache, max_jobs, setup_mounts):
+ remote_artifact_cache, repo_cache, max_jobs):
self.app = app
self.staging_area = staging_area
self.local_artifact_cache = local_artifact_cache
self.remote_artifact_cache = remote_artifact_cache
self.repo_cache = repo_cache
self.max_jobs = max_jobs
- self.setup_mounts = setup_mounts
def build_and_cache(self, source):
kind = source.morphology['kind']
o = self.classes[kind](self.app, self.staging_area,
self.local_artifact_cache,
self.remote_artifact_cache, source,
- self.repo_cache, self.max_jobs,
- self.setup_mounts)
+ self.repo_cache, self.max_jobs)
self.app.status(msg='Builder.build: artifact %s with %s' %
(source.name, repr(o)),
chatty=True)
diff --git a/morphlib/builder2_tests.py b/morphlib/builder2_tests.py
index 4fd0807a..a0fd0234 100644
--- a/morphlib/builder2_tests.py
+++ b/morphlib/builder2_tests.py
@@ -160,8 +160,7 @@ class BuilderBaseTests(unittest.TestCase):
None,
self.artifact,
self.repo_cache,
- self.max_jobs,
- False)
+ self.max_jobs)
def test_runs_desired_command(self):
self.builder.runcmd(['foo', 'bar'])
diff --git a/morphlib/plugins/cross-bootstrap_plugin.py b/morphlib/plugins/cross-bootstrap_plugin.py
index 7b53a4a5..608102e3 100644
--- a/morphlib/plugins/cross-bootstrap_plugin.py
+++ b/morphlib/plugins/cross-bootstrap_plugin.py
@@ -297,7 +297,7 @@ class CrossBootstrapPlugin(cliapp.Plugin):
build_env, use_chroot=False)
builder = BootstrapSystemBuilder(
self.app, staging_area, build_command.lac, build_command.rac,
- system_artifact.source, build_command.lrc, 1, False)
+ system_artifact.source, build_command.lrc, 1)
builder.build_and_cache()
self.app.status(
diff --git a/morphlib/stagingarea.py b/morphlib/stagingarea.py
index 25e33b3f..1af3a7c0 100644
--- a/morphlib/stagingarea.py
+++ b/morphlib/stagingarea.py
@@ -45,7 +45,6 @@ class StagingArea(object):
self.dirname = dirname
self.builddirname = None
self.destdirname = None
- self.mounted = []
self._bind_readonly_mount = None
self.use_chroot = use_chroot
@@ -224,24 +223,7 @@ class StagingArea(object):
os.makedirs(ccache_destdir)
return ccache_repodir
- def do_mounts(self, setup_mounts): # pragma: no cover
- if not setup_mounts:
- return
- for mount_point, mount_type, source in self.to_mount:
- logging.debug('Mounting %s in staging area' % mount_point)
- path = os.path.join(self.dirname, mount_point)
- if not os.path.exists(path):
- os.makedirs(path)
- morphlib.fsutils.mount(self._app.runcmd, source, path, mount_type)
- self.mounted.append(path)
- return
-
- def do_unmounts(self): # pragma: no cover
- for path in reversed(self.mounted):
- logging.debug('Unmounting %s in staging area' % path)
- morphlib.fsutils.unmount(self._app.runcmd, path)
-
- def chroot_open(self, source, setup_mounts): # pragma: no cover
+ def chroot_open(self, source): # pragma: no cover
'''Setup staging area for use as a chroot.'''
assert self.builddirname == None and self.destdirname == None
@@ -251,19 +233,15 @@ class StagingArea(object):
self.builddirname = builddir
self.destdirname = destdir
- self.do_mounts(setup_mounts)
-
return builddir, destdir
def chroot_close(self): # pragma: no cover
- '''Undo changes by chroot_open.
+ '''Clean up resources after opening a chroot
- This should be called after the staging area is no longer needed.
+ No resources are currently allocated at open time, so this is a NOOP
'''
- self.do_unmounts()
-
def runcmd(self, argv, **kwargs): # pragma: no cover
'''Run a command in a chroot in the staging area.'''
assert 'env' not in kwargs