Gentoo Archives: gentoo-catalyst

From: Matt Turner <mattst88@g.o>
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 04:51:41
Message-Id: CAEdQ38G6n_4pnuW9OSPcuBmqh0Q95s4Gr_+u8M9Xt0fYh5-KqA@mail.gmail.com
In Reply to: [gentoo-catalyst] [PATCH 1/4] Add more configured defaults by Brian Dolbec
1 On Fri, Dec 13, 2013 at 7:07 PM, Brian Dolbec <dolsen@g.o> 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 I agree that adding a key:value to store "portage-" seems unnecessary.
35 I don't think we should do this unless someone has a compelling
36 reason.
37
38 Also, we lost "options" here. Is this intentional or consequential?
39
40 >
41 > # first, try the one passed (presumably from the cmdline)
42 > if myconfig:
43 > diff --git a/modules/generic_stage_target.py b/modules/generic_stage_target.py
44 > index 848aca2..c2888b6 100644
45 > --- a/modules/generic_stage_target.py
46 > +++ b/modules/generic_stage_target.py
47 > @@ -410,7 +410,8 @@ class generic_stage_target(generic_target):
48 >
49 > def set_snapshot_path(self):
50 > self.settings["snapshot_path"]=normpath(self.settings["storedir"]+\
51 > - "/snapshots/portage-"+self.settings["snapshot"]+".tar.xz")
52 > + "/snapshots/" + self.settings["snapshot_name"] +
53 > + self.settings["snapshot"]+".tar.xz")
54 >
55 > if os.path.exists(self.settings["snapshot_path"]):
56 > self.settings["snapshot_path_hash"]=\
57 > @@ -418,7 +419,8 @@ class generic_stage_target(generic_target):
58 > hash_function=self.settings["hash_function"],verbose=False)
59 > else:
60 > self.settings["snapshot_path"]=normpath(self.settings["storedir"]+\
61 > - "/snapshots/portage-"+self.settings["snapshot"]+".tar.bz2")
62 > + "/snapshots/" + self.settings["snapshot_name"] +
63 > + self.settings["snapshot"]+".tar.bz2")
64 >
65 > if os.path.exists(self.settings["snapshot_path"]):
66 > self.settings["snapshot_path_hash"]=\
67 > diff --git a/modules/snapshot_target.py b/modules/snapshot_target.py
68 > index e93a86a..29d6e87 100644
69 > --- a/modules/snapshot_target.py
70 > +++ b/modules/snapshot_target.py
71 > @@ -18,8 +18,9 @@ class snapshot_target(generic_stage_target):
72 > self.settings=myspec
73 > self.settings["target_subpath"]="portage"
74 > st=self.settings["storedir"]
75 > - self.settings["snapshot_path"]=normpath(st+"/snapshots/portage-"+self.settings["version_stamp"]\
76 > - +".tar.bz2")
77 > + self.settings["snapshot_path"]=normpath(st + "/snapshots/"
78 > + + self.settings["snapshot_name"]
79 > + + self.settings["version_stamp"] + ".tar.bz2")
80 > self.settings["tmp_path"]=normpath(st+"/tmp/"+self.settings["target_subpath"])
81 >
82 > def setup(self):
83 > @@ -46,11 +47,14 @@ class snapshot_target(generic_stage_target):
84 > if not os.path.exists(mytmp):
85 > os.makedirs(mytmp)
86 >
87 > - cmd("rsync -a --delete --exclude /packages/ --exclude /distfiles/ --exclude /local/ --exclude CVS/ --exclude .svn --filter=H_**/files/digest-* "+\
88 > - self.settings["portdir"]+"/ "+mytmp+"/portage/","Snapshot failure",env=self.env)
89 > + cmd("rsync -a --delete --exclude /packages/ --exclude /distfiles/ " +
90 > + "--exclude /local/ --exclude CVS/ --exclude .svn --filter=H_**/files/digest-* " +
91 > + self.settings["portdir"] + "/ " + mytmp + "/%s/" % self.settings["repo_name"],
92 > + "Snapshot failure",env=self.env)
93 >
94 > print "Compressing Portage snapshot tarball..."
95 > - cmd("tar -I lbzip2 -cf "+self.settings["snapshot_path"]+" -C "+mytmp+" portage",\
96 > + cmd("tar -I lbzip2 -cf " + self.settings["snapshot_path"] + " -C " +
97 > + mytmp + " %s" % self.settings["repo_name"],
98
99 There's no need for "%s" % ... here. Just mytmp + " " +
100 self.settings["repo_name"].
101
102 > "Snapshot creation failure",env=self.env)
103 >
104 > self.gen_contents_file(self.settings["snapshot_path"])
105 > diff --git a/modules/tinderbox_target.py b/modules/tinderbox_target.py
106 > index 46fe082..d6d3ea3 100644
107 > --- a/modules/tinderbox_target.py
108 > +++ b/modules/tinderbox_target.py
109 > @@ -29,8 +29,8 @@ class tinderbox_target(generic_stage_target):
110 > raise CatalystError,"Tinderbox aborting due to error."
111 >
112 > def set_cleanables(self):
113 > - self.settings["cleanables"]=["/etc/resolv.conf","/var/tmp/*","/root/*",\
114 > - "/usr/portage"]
115 > + self.settings["cleanables"]=["/etc/resolv.conf","/var/tmp/*","/root/*",
116 > + self.settings['portdir']]
117 >
118 > def set_action_sequence(self):
119 > #Default action sequence for run method
120 > --
121 > 1.8.3.2
122 >
123 >

Replies

Subject Author
Re: [gentoo-catalyst] [PATCH 1/4] Add more configured defaults Brian Dolbec <dolsen@g.o>