Gentoo Archives: gentoo-catalyst

From: Dylan Baker <baker.dylan.c@×××××.com>
To: gentoo-catalyst@l.g.o
Cc: Brian Dolbec <dolsen@g.o>
Subject: Re: [gentoo-catalyst] [PATCH 1/4] Add more configured defaults
Date: Sat, 14 Dec 2013 15:03:59
Message-Id: 1535770.iBKyIEEe9T@moiraine
In Reply to: [gentoo-catalyst] [PATCH 1/4] Add more configured defaults by Brian Dolbec
1 On Friday, December 13, 2013 07:07:13 PM Brian Dolbec wrote:
2 > Use the new configured snapshot_name and portdir settings
3 > Use the portdir setting rather than hard-coded path
4 > ---
5 > catalyst | 14 +++++++++-----
6 > modules/generic_stage_target.py | 6 ++++--
7 > modules/snapshot_target.py | 14 +++++++++-----
8 > modules/tinderbox_target.py | 4 ++--
9 > 4 files changed, 24 insertions(+), 14 deletions(-)
10 >
11 > diff --git a/catalyst b/catalyst
12 > index ba26f3c..19ec77e 100755
13 > --- a/catalyst
14 > +++ b/catalyst
15 > @@ -61,11 +61,15 @@ def parse_config(myconfig):
16 > myconf={}
17 > config_file=""
18 >
19 > - confdefaults={ "storedir":"/var/tmp/catalyst",\
20 > - "sharedir":"/usr/share/catalyst","distdir":"/usr/portage/distfiles",\
21 > - "portdir":"/usr/portage","options":"",\
22 > - "snapshot_cache":"/var/tmp/catalyst/snapshot_cache",\
23 > - "hash_function":"crc32"}
24 > + confdefaults={
25 > + "hash_function": "crc32",
26 > + "portdir": "/usr/portage",
27 > + "repo_name": "portage",
28 > + "sharedir": "/usr/lib/catalyst",
29 > + "snapshot_name": "portage-",
30 > + "snapshot_cache": "/var/tmp/catalyst/snapshot_cache",
31 > + "storedir": "/var/tmp/catalyst",
32 > + }
33
34 pleas keep the formatting style; no comma on the last element and closing
35 brace on the same line
36
37 >
38 > # first, try the one passed (presumably from the cmdline)
39 > if myconfig:
40 > diff --git a/modules/generic_stage_target.py
41 > b/modules/generic_stage_target.py index 848aca2..c2888b6 100644
42 > --- a/modules/generic_stage_target.py
43 > +++ b/modules/generic_stage_target.py
44 > @@ -410,7 +410,8 @@ class generic_stage_target(generic_target):
45 >
46 > def set_snapshot_path(self):
47 > self.settings["snapshot_path"]=normpath(self.settings["storedir"]+\
48 > - "/snapshots/portage-"+self.settings["snapshot"]+".tar.xz")
49 > + "/snapshots/" + self.settings["snapshot_name"] +
50 > + self.settings["snapshot"]+".tar.xz")
51
52 please be consistent with spaces between operators; follow whatever PEP8 says
53 to do this case :)
54
55 I'd also suggest using the str.format() method instead of concatenating a
56 large number of strings and variables, it's much more readable IMHO:
57 self.settings["snapshot_path"] = os.path.normpath(
58 "{0}/snapshots/{1}{2}.tar.xz".format(
59 self.settings["storedir"], self.settings["snapshot_name"],
60 self.settings["snapshot"]))
61
62 >
63 > if os.path.exists(self.settings["snapshot_path"]):
64 > self.settings["snapshot_path_hash"]=\
65 > @@ -418,7 +419,8 @@ class generic_stage_target(generic_target):
66 > hash_function=self.settings["hash_function"],verbose=False)
67 > else:
68 >
69 self.settings["snapshot_path"]=normpath(self.settings["storedir"]+\
70 > - "/snapshots/portage-"+self.settings["snapshot"]+".tar.bz2")
71 > + "/snapshots/" + self.settings["snapshot_name"] +
72 > + self.settings["snapshot"]+".tar.bz2")
73
74 see my previous comment
75
76 >
77 > if os.path.exists(self.settings["snapshot_path"]):
78 > self.settings["snapshot_path_hash"]=\
79 > diff --git a/modules/snapshot_target.py b/modules/snapshot_target.py
80 > index e93a86a..29d6e87 100644
81 > --- a/modules/snapshot_target.py
82 > +++ b/modules/snapshot_target.py
83 > @@ -18,8 +18,9 @@ class snapshot_target(generic_stage_target):
84 > self.settings=myspec
85 > self.settings["target_subpath"]="portage"
86 > st=self.settings["storedir"]
87 > -
88 self.settings["snapshot_path"]=normpath(st+"/snapshots/portage-"+self.set
89 > tings["version_stamp"]\ - +".tar.bz2")
90 > + self.settings["snapshot_path"]=normpath(st + "/snapshots/"
91 > + + self.settings["snapshot_name"]
92 > + + self.settings["version_stamp"] + ".tar.bz2")
93
94 again
95
96 >
97 self.settings["tmp_path"]=normpath(st+"/tmp/"+self.settings["target_subpa
98 > th"])
99 >
100 > def setup(self):
101 > @@ -46,11 +47,14 @@ class snapshot_target(generic_stage_target):
102 > if not os.path.exists(mytmp):
103 > os.makedirs(mytmp)
104 >
105 > - cmd("rsync -a --delete --exclude /packages/ --exclude /distfiles/
106 > --exclude /local/ --exclude CVS/ --exclude .svn
107 > --filter=H_**/files/digest-* "+\ - self.settings["portdir"]+"/
108 > "+mytmp+"/portage/","Snapshot failure",env=self.env) + cmd("rsync -a
109 > --delete --exclude /packages/ --exclude /distfiles/ " + + "--exclude
110 > /local/ --exclude CVS/ --exclude .svn --filter=H_**/files/digest-* " +
111 > + self.settings["portdir"] + "/ " + mytmp + "/%s/" %
112 > self.settings["repo_name"], + "Snapshot failure",env=self.env)
113 >
114 > print "Compressing Portage snapshot tarball..."
115 > - cmd("tar -I lbzip2 -cf "+self.settings["snapshot_path"]+" -C
116 "+mytmp+"
117 > portage",\ + cmd("tar -I lbzip2 -cf " +
118 self.settings["snapshot_path"] + "
119 > -C " + + mytmp + " %s" % self.settings["repo_name"],
120 > "Snapshot creation failure",env=self.env)
121 >
122 > self.gen_contents_file(self.settings["snapshot_path"])
123 > diff --git a/modules/tinderbox_target.py b/modules/tinderbox_target.py
124 > index 46fe082..d6d3ea3 100644
125 > --- a/modules/tinderbox_target.py
126 > +++ b/modules/tinderbox_target.py
127 > @@ -29,8 +29,8 @@ class tinderbox_target(generic_stage_target):
128 > raise CatalystError,"Tinderbox aborting due to error."
129 >
130 > def set_cleanables(self):
131 > -
132 > self.settings["cleanables"]=["/etc/resolv.conf","/var/tmp/*","/root/*",\
133 > - "/usr/portage"]
134 > +
135 > self.settings["cleanables"]=["/etc/resolv.conf","/var/tmp/*","/root/*",
136 > + self.settings['portdir']]
137
138 spaces between the elements of a list pls.
139
140 >
141 > def set_action_sequence(self):
142 > #Default action sequence for run method

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies

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