Gentoo Archives: gentoo-catalyst

From: Brian Dolbec <dolsen@g.o>
To: gentoo-catalyst@l.g.o
Subject: [gentoo-catalyst] [PATCH 7/8] Move confdefaults out of main.py
Date: Wed, 02 Apr 2014 20:30:30
Message-Id: 1396470583-8756-7-git-send-email-dolsen@gentoo.org
In Reply to: [gentoo-catalyst] [PATCH 2/8] Initial separation and creation of contents.py by Brian Dolbec
1 ---
2 catalyst/defaults.py | 17 +++++++++++++++++
3 catalyst/main.py | 20 +++-----------------
4 2 files changed, 20 insertions(+), 17 deletions(-)
5
6 diff --git a/catalyst/defaults.py b/catalyst/defaults.py
7 index 748d1dd..b83e4f5 100644
8 --- a/catalyst/defaults.py
9 +++ b/catalyst/defaults.py
10 @@ -21,6 +21,22 @@ valid_config_file_values.extend(["PKGCACHE", "KERNCACHE", "CCACHE", "DISTCC",
11
12 verbosity = 1
13
14 +confdefaults={
15 + "distdir": "/usr/portage/distfiles",
16 + "hash_function": "crc32",
17 + "icecream": "/var/cache/icecream",
18 + "local_overlay": "/usr/local/portage",
19 + "options": "",
20 + "packagedir": "/usr/portage/packages",
21 + "portdir": "/usr/portage",
22 + "port_tmpdir": "/var/tmp/portage",
23 + "repo_name": "portage",
24 + "sharedir": "/usr/lib/catalyst",
25 + "snapshot_cache": "/var/tmp/catalyst/snapshot_cache",
26 + "snapshot_name": "portage-",
27 + "storedir": "/var/tmp/catalyst",
28 + }
29 +
30 PORT_LOGDIR_CLEAN = \
31 'find "${PORT_LOGDIR}" -type f ! -name "summary.log*" -mtime +30 -delete'
32
33 @@ -48,3 +64,4 @@ SOURCE_MOUNT_DEFAULTS = {
34 "proc": "/proc",
35 "shm": "shmfs",
36 }
37 +
38 diff --git a/catalyst/main.py b/catalyst/main.py
39 index e2ef976..5748d31 100644
40 --- a/catalyst/main.py
41 +++ b/catalyst/main.py
42 @@ -22,7 +22,8 @@ from . import __version__
43 import catalyst.config
44 import catalyst.util
45 from catalyst.support import CatalystError, find_binary, LockInUse
46 -from catalyst.defaults import required_build_targets, valid_build_targets
47 +from catalyst.defaults import (required_build_targets, valid_build_targets,
48 + confdefaults)
49 from hash_utils import HashMap, HASH_DEFINITIONS
50 from contents import ContentsMap, CONTENTS_DEFINITIONS
51
52 @@ -70,21 +71,6 @@ def parse_config(myconfig):
53 myconf={}
54 config_file=""
55
56 - confdefaults = {
57 - "distdir": "/usr/portage/distfiles",
58 - "hash_function": "crc32",
59 - "icecream": "/var/cache/icecream",
60 - "local_overlay": "/usr/local/portage",
61 - "options": "",
62 - "packagedir": "/usr/portage/packages",
63 - "portdir": "/usr/portage",
64 - "repo_name": "portage",
65 - "sharedir": "/usr/share/catalyst",
66 - "snapshot_name": "portage-",
67 - "snapshot_cache": "/var/tmp/catalyst/snapshot_cache",
68 - "storedir": "/var/tmp/catalyst",
69 - }
70 -
71 # first, try the one passed (presumably from the cmdline)
72 if myconfig:
73 if os.path.exists(myconfig):
74 @@ -117,7 +103,7 @@ def parse_config(myconfig):
75 sys.exit(1)
76
77 # now, load up the values into conf_values so that we can use them
78 - for x in confdefaults.keys():
79 + for x in list(confdefaults):
80 if x in myconf:
81 print "Setting",x,"to config file value \""+myconf[x]+"\""
82 conf_values[x]=myconf[x]
83 --
84 1.8.5.3