From 264f30494cde1eb44aae89a9872bf12936856252 Mon Sep 17 00:00:00 2001 From: Brian Dolbec Date: Fri, 3 Jan 2014 17:04:10 -0800 Subject: [PATCH] Move generic_stage_targets.py constants to defaults.py Rename the source and target mounts defaults to remove the double plural. --- catalyst/defaults.py | 27 +++++++++++++++++++ catalyst/targets/generic_stage_target.py | 34 +++--------------------- 2 files changed, 31 insertions(+), 30 deletions(-) diff --git a/catalyst/defaults.py b/catalyst/defaults.py index b1dbda48..748d1dd7 100644 --- a/catalyst/defaults.py +++ b/catalyst/defaults.py @@ -21,3 +21,30 @@ valid_config_file_values.extend(["PKGCACHE", "KERNCACHE", "CCACHE", "DISTCC", verbosity = 1 +PORT_LOGDIR_CLEAN = \ + 'find "${PORT_LOGDIR}" -type f ! -name "summary.log*" -mtime +30 -delete' + +TARGET_MOUNT_DEFAULTS = { + "ccache": "/var/tmp/ccache", + "dev": "/dev", + "devpts": "/dev/pts", + "distdir": "/usr/portage/distfiles", + "icecream": "/usr/lib/icecc/bin", + "kerncache": "/tmp/kerncache", + "packagedir": "/usr/portage/packages", + "portdir": "/usr/portage", + "port_tmpdir": "/var/tmp/portage", + "port_logdir": "/var/log/portage", + "proc": "/proc", + "shm": "/dev/shm", + } + +SOURCE_MOUNT_DEFAULTS = { + "dev": "/dev", + "devpts": "/dev/pts", + "distdir": "/usr/portage/distfiles", + "portdir": "/usr/portage", + "port_tmpdir": "tmpfs", + "proc": "/proc", + "shm": "shmfs", + } diff --git a/catalyst/targets/generic_stage_target.py b/catalyst/targets/generic_stage_target.py index de4842c4..05c61e8f 100644 --- a/catalyst/targets/generic_stage_target.py +++ b/catalyst/targets/generic_stage_target.py @@ -4,34 +4,8 @@ from generic_target import * from stat import * from catalyst.lock import LockDir - -PORT_LOGDIR_CLEAN = \ - 'find "${PORT_LOGDIR}" -type f ! -name "summary.log*" -mtime +30 -delete' - -TARGET_MOUNTS_DEFAULTS = { - "ccache": "/var/tmp/ccache", - "dev": "/dev", - "devpts": "/dev/pts", - "distdir": "/usr/portage/distfiles", - "icecream": "/usr/lib/icecc/bin", - "kerncache": "/tmp/kerncache", - "packagedir": "/usr/portage/packages", - "portdir": "/usr/portage", - "port_tmpdir": "/var/tmp/portage", - "port_logdir": "/var/log/portage", - "proc": "/proc", - "shm": "/dev/shm", - } - -SOURCE_MOUNTS_DEFAULTS = { - "dev": "/dev", - "devpts": "/dev/pts", - "distdir": "/usr/portage/distfiles", - "portdir": "/usr/portage", - "port_tmpdir": "tmpfs", - "proc": "/proc", - "shm": "shmfs", - } +from catalyst.defaults import (SOURCE_MOUNT_DEFAULTS, TARGET_MOUNT_DEFAULTS, + PORT_LOGDIR_CLEAN) # for convienience pjoin = os.path.join @@ -208,11 +182,11 @@ class generic_stage_target(generic_target): """ Setup our mount points """ # initialize our target mounts. - self.target_mounts = TARGET_MOUNTS_DEFAULTS.copy() + self.target_mounts = TARGET_MOUNT_DEFAULTS.copy() self.mounts = ["proc", "dev", "portdir", "distdir", "port_tmpdir"] # initialize our source mounts - self.mountmap = SOURCE_MOUNTS_DEFAULTS.copy() + self.mountmap = SOURCE_MOUNT_DEFAULTS.copy() # update them from settings self.mountmap["distdir"] = self.settings["distdir"] if "SNAPCACHE" not in self.settings: -- 2.26.2