From f48028dc0e9ed1da8413f5fc486b43f2d3d5342a Mon Sep 17 00:00:00 2001 From: Brian Dolbec Date: Mon, 30 Dec 2013 15:56:02 -0800 Subject: [PATCH] modules/generic_stage_target.py, Create SOURCE_MOUNTS_DEFAULTS Similarly to TARGET_MOUNTS_DEFAULTS this is a temporary location. This will simplify the migration to being fully configurable. It also simplifies initialization somewhat. --- modules/generic_stage_target.py | 39 +++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/modules/generic_stage_target.py b/modules/generic_stage_target.py index 7919f072..790e4da2 100644 --- a/modules/generic_stage_target.py +++ b/modules/generic_stage_target.py @@ -22,6 +22,15 @@ TARGET_MOUNTS_DEFAULTS = { "proc": "/proc", } +SOURCE_MOUNTS_DEFAULTS = { + "dev": "/dev", + "devpts": "/dev/pts", + "distdir": "/usr/portage/distfiles", + "portdir": "/usr/portage", + "port_tmpdir": "tmpfs", + "proc": "/proc", + } + class generic_stage_target(generic_target): """ @@ -194,23 +203,19 @@ class generic_stage_target(generic_target): """ Setup our mount points """ # initialize our target mounts. self.target_mounts = TARGET_MOUNTS_DEFAULTS.copy() - if "SNAPCACHE" in self.settings: - self.mounts = ["proc", "dev", "portdir", "distdir", "port_tmpdir"] - self.mountmap = { - "dev": "/dev", - "devpts": "/dev/pts", - "distdir": self.settings["distdir"], - "portdir": normpath("/".join([ - self.settings["snapshot_cache_path"], - self.settings["repo_name"], - ])), - "port_tmpdir": "tmpfs", - "proc": "/proc", - } - else: - self.mounts = ["proc", "dev", "distdir", "port_tmpdir"] - self.mountmap = {"proc":"/proc", "dev":"/dev", "devpts":"/dev/pts", - "distdir":self.settings["distdir"], "port_tmpdir":"tmpfs"} + + self.mounts = ["proc", "dev", "portdir", "distdir", "port_tmpdir"] + # initialize our source mounts + self.mountmap = SOURCE_MOUNTS_DEFAULTS.copy() + # update them from settings + self.mountmap["distdir"] = self.settings["distdir"] + self.mountmap["portdir"] = normpath("/".join([ + self.settings["snapshot_cache_path"], + self.settings["repo_name"], + ])) + if "SNAPCACHE" not in self.settings: + self.mounts.remove("portdir") + #self.mountmap["portdir"] = None if os.uname()[0] == "Linux": self.mounts.append("devpts") -- 2.26.2