Gentoo Archives: gentoo-catalyst

From: Brian Dolbec <dolsen@g.o>
To: gentoo-catalyst@l.g.o
Cc: Brian Dolbec <dolsen@g.o>
Subject: [gentoo-catalyst] [PATCH 2/4] Add more configured defaults
Date: Thu, 28 Feb 2013 01:48:10
Message-Id: 1362016021-8338-3-git-send-email-dolsen@gentoo.org
In Reply to: [gentoo-catalyst] [PATCH 0/4] Some general cleanup, remove some hardcoding of paths. by Brian Dolbec
1 Use the new configured snapshot_name and portdir settings
2 Use the portdir setting rather than hard-coded path
3
4 Signed-off-by: Brian Dolbec <dolsen@g.o>
5 ---
6 catalyst | 18 +++++++++++++-----
7 modules/generic_stage_target.py | 6 ++++--
8 modules/snapshot_target.py | 14 +++++++++-----
9 modules/tinderbox_target.py | 4 ++--
10 4 files changed, 28 insertions(+), 14 deletions(-)
11
12 diff --git a/catalyst b/catalyst
13 index c29c814..0878ce4 100755
14 --- a/catalyst
15 +++ b/catalyst
16 @@ -61,11 +61,19 @@ def parse_config(myconfig):
17 myconf={}
18 config_file=""
19
20 - confdefaults={ "storedir":"/var/tmp/catalyst",\
21 - "sharedir":"/usr/share/catalyst","distdir":"/usr/portage/distfiles",\
22 - "portdir":"/usr/portage","options":"",\
23 - "snapshot_cache":"/var/tmp/catalyst/snapshot_cache",\
24 - "hash_function":"crc32"}
25 + confdefaults={
26 + "storedir": "/var/tmp/catalyst",
27 + "sharedir": "/usr/lib/catalyst",
28 + "distdir": "/usr/portage/distfiles",
29 + "repo_name": "portage",
30 + "portdir": "/usr/portage",
31 + "packagedir": "/usr/portage/packages",
32 + "port_tmpdir": "/var/tmp/portage",
33 + "options": "",
34 + "snapshot_name": "portage-",
35 + "snapshot_cache": "/var/tmp/catalyst/snapshot_cache",
36 + "hash_function": "crc32",
37 + }
38
39 # first, try the one passed (presumably from the cmdline)
40 if myconfig:
41 diff --git a/modules/generic_stage_target.py b/modules/generic_stage_target.py
42 index 31cb025..c79f8ae 100644
43 --- a/modules/generic_stage_target.py
44 +++ b/modules/generic_stage_target.py
45 @@ -410,7 +410,8 @@ class generic_stage_target(generic_target):
46
47 def set_snapshot_path(self):
48 self.settings["snapshot_path"]=normpath(self.settings["storedir"]+\
49 - "/snapshots/portage-"+self.settings["snapshot"]+".tar.xz")
50 + "/snapshots/" + self.settings["snapshot_name"] +
51 + self.settings["snapshot"]+".tar.xz")
52
53 if os.path.exists(self.settings["snapshot_path"]):
54 self.settings["snapshot_path_hash"]=\
55 @@ -418,7 +419,8 @@ class generic_stage_target(generic_target):
56 hash_function=self.settings["hash_function"],verbose=False)
57 else:
58 self.settings["snapshot_path"]=normpath(self.settings["storedir"]+\
59 - "/snapshots/portage-"+self.settings["snapshot"]+".tar.bz2")
60 + "/snapshots/" + self.settings["snapshot_name"] +
61 + self.settings["snapshot"]+".tar.bz2")
62
63 if os.path.exists(self.settings["snapshot_path"]):
64 self.settings["snapshot_path_hash"]=\
65 diff --git a/modules/snapshot_target.py b/modules/snapshot_target.py
66 index e93a86a..79c1f03 100644
67 --- a/modules/snapshot_target.py
68 +++ b/modules/snapshot_target.py
69 @@ -18,8 +18,9 @@ class snapshot_target(generic_stage_target):
70 self.settings=myspec
71 self.settings["target_subpath"]="portage"
72 st=self.settings["storedir"]
73 - self.settings["snapshot_path"]=normpath(st+"/snapshots/portage-"+self.settings["version_stamp"]\
74 - +".tar.bz2")
75 + self.settings["snapshot_path"]=normpath(st + "/snapshots/"
76 + + self.settings["snapshot_name"]
77 + + self.settings["version_stamp"] + ".tar.bz2")
78 self.settings["tmp_path"]=normpath(st+"/tmp/"+self.settings["target_subpath"])
79
80 def setup(self):
81 @@ -46,11 +47,14 @@ class snapshot_target(generic_stage_target):
82 if not os.path.exists(mytmp):
83 os.makedirs(mytmp)
84
85 - cmd("rsync -a --delete --exclude /packages/ --exclude /distfiles/ --exclude /local/ --exclude CVS/ --exclude .svn --filter=H_**/files/digest-* "+\
86 - self.settings["portdir"]+"/ "+mytmp+"/portage/","Snapshot failure",env=self.env)
87 + cmd("rsync -a --delete --exclude /packages/ --exclude /distfiles/ " + \
88 + "--exclude /local/ --exclude CVS/ --exclude .svn --filter=H_**/files/digest-* "+\
89 + self.settings["portdir"] + "/ " + mytmp + "/%s/" % self.settings["repo_name"],
90 + "Snapshot failure",env=self.env)
91
92 print "Compressing Portage snapshot tarball..."
93 - cmd("tar -I lbzip2 -cf "+self.settings["snapshot_path"]+" -C "+mytmp+" portage",\
94 + cmd("tar -I lbzip2 -cf " + self.settings["snapshot_path"] + " -C " +
95 + mytmp + " %s" % self.settings["repo_name"],
96 "Snapshot creation failure",env=self.env)
97
98 self.gen_contents_file(self.settings["snapshot_path"])
99 diff --git a/modules/tinderbox_target.py b/modules/tinderbox_target.py
100 index 46fe082..d6d3ea3 100644
101 --- a/modules/tinderbox_target.py
102 +++ b/modules/tinderbox_target.py
103 @@ -29,8 +29,8 @@ class tinderbox_target(generic_stage_target):
104 raise CatalystError,"Tinderbox aborting due to error."
105
106 def set_cleanables(self):
107 - self.settings["cleanables"]=["/etc/resolv.conf","/var/tmp/*","/root/*",\
108 - "/usr/portage"]
109 + self.settings["cleanables"]=["/etc/resolv.conf","/var/tmp/*","/root/*",
110 + self.settings['portdir']]
111
112 def set_action_sequence(self):
113 #Default action sequence for run method
114 --
115 1.8.1.4

Replies

Subject Author
Re: [gentoo-catalyst] [PATCH 2/4] Add more configured defaults "W. Trevor King" <wking@×××××××.us>