1 |
On Fri, Dec 7, 2012 at 1:35 PM, Rick "Zero_Chaos" Farina |
2 |
<zerochaos@g.o> wrote: |
3 |
> -----BEGIN PGP SIGNED MESSAGE----- |
4 |
> Hash: SHA1 |
5 |
> |
6 |
> |
7 |
> From: "Rick Farina (Zero_Chaos)" <zerochaos@g.o> |
8 |
> |
9 |
> After the recent fixes which ensure the bindist use flag |
10 |
> is always set, users now have no way to disable this flag. |
11 |
> This patch introduces the new "bindist" feature, enabled by |
12 |
> default, which will allow users to turn off bindist if |
13 |
> they are not going to redistribute the builds (or for |
14 |
> tinderbox testing, etc). |
15 |
> - --- |
16 |
> catalyst | 7 +++++++ |
17 |
> files/catalyst.conf | 4 +++- |
18 |
> modules/generic_stage_target.py | 5 +++-- |
19 |
> modules/grp_target.py | 11 ++++++----- |
20 |
> modules/livecd_stage1_target.py | 6 ++++-- |
21 |
> targets/stage1/stage1-chroot.sh | 10 +++++++--- |
22 |
> 6 files changed, 30 insertions(+), 13 deletions(-) |
23 |
> |
24 |
> diff --git a/catalyst b/catalyst |
25 |
> index 3d31599..8485984 100755 |
26 |
> - --- a/catalyst |
27 |
> +++ b/catalyst |
28 |
> @@ -112,6 +112,13 @@ def parse_config(myconfig): |
29 |
> print "Autoresuming support enabled." |
30 |
> conf_values["AUTORESUME"]="1" |
31 |
> |
32 |
> + if "bindist" in string.split(conf_values["options"]): |
33 |
> + print "Binary redistribution enabled" |
34 |
> + conf_values["BINDIST"]="1" |
35 |
> + else: |
36 |
> + print "Bindist is not enabled in catalyst.conf" |
37 |
> + print "Binary redistribution of generated stages/isos is prohibited |
38 |
> by law." |
39 |
> + |
40 |
> if "ccache" in string.split(conf_values["options"]): |
41 |
> print "Compiler cache support enabled." |
42 |
> conf_values["CCACHE"]="1" |
43 |
> diff --git a/files/catalyst.conf b/files/catalyst.conf |
44 |
> index ea74eb1..18c6ab8 100644 |
45 |
> - --- a/files/catalyst.conf |
46 |
> +++ b/files/catalyst.conf |
47 |
> @@ -49,6 +49,8 @@ hash_function="crc32" |
48 |
> # the -a option to the catalyst cmdline. -p will clear the autoresume |
49 |
> flags |
50 |
> # as well as your pkgcache and kerncache |
51 |
> # ( This option is not fully tested, bug reports welcome ) |
52 |
> +# bindist = enable this option when the builds will be publicly |
53 |
> redistributed to prevent |
54 |
> + building of patent encumbered and redistribution restricted items. |
55 |
> # ccache = enables build time ccache support (highly recommended) |
56 |
> # distcc = enable distcc support for building. You have to set |
57 |
> distcc_hosts in |
58 |
> # your spec file. |
59 |
> @@ -64,7 +66,7 @@ hash_function="crc32" |
60 |
> # your cache. The cache is unlinked before any empty or rm processing, |
61 |
> though. |
62 |
> # |
63 |
> # (These options can be used together) |
64 |
> - -options="autoresume kerncache pkgcache seedcache snapcache" |
65 |
> +options="autoresume bindist kerncache pkgcache seedcache snapcache" |
66 |
> |
67 |
> # portdir specifies the source portage tree used by the snapshot target. |
68 |
> portdir="/usr/portage" |
69 |
> diff --git a/modules/generic_stage_target.py |
70 |
> b/modules/generic_stage_target.py |
71 |
> index 3597680..89082c5 100644 |
72 |
> - --- a/modules/generic_stage_target.py |
73 |
> +++ b/modules/generic_stage_target.py |
74 |
> @@ -490,8 +490,9 @@ class generic_stage_target(generic_target): |
75 |
> if type(self.settings["use"])==types.StringType: |
76 |
> self.settings["use"]=self.settings["use"].split() |
77 |
> |
78 |
> - - # Force bindist for all targets |
79 |
> - - self.settings["use"].append("bindist") |
80 |
> + # Force bindist when options ask for it |
81 |
> + if self.settings.has_key("BINDIST"): |
82 |
> + self.settings["use"].append("bindist") |
83 |
> |
84 |
> def set_stage_path(self): |
85 |
> self.settings["stage_path"]=normpath(self.settings["chroot_path"]) |
86 |
> diff --git a/modules/grp_target.py b/modules/grp_target.py |
87 |
> index 12eab08..5d3af2e 100644 |
88 |
> - --- a/modules/grp_target.py |
89 |
> +++ b/modules/grp_target.py |
90 |
> @@ -62,11 +62,12 @@ class grp_target(generic_stage_target): |
91 |
> raise CatalystError,"GRP build aborting due to error." |
92 |
> |
93 |
> def set_use(self): |
94 |
> - - generic_stage_target.set_use(self) |
95 |
> - - if self.settings.has_key("use"): |
96 |
> - - self.settings["use"].append("bindist") |
97 |
> - - else: |
98 |
> - - self.settings["use"]=["bindist"] |
99 |
> + generic_stage_target.set_use(self) |
100 |
> + if self.settings.has_key("BINDIST"): |
101 |
> + if self.settings.has_key("use"): |
102 |
> + self.settings["use"].append("bindist") |
103 |
> + else: |
104 |
> + self.settings["use"]=["bindist"] |
105 |
> |
106 |
> def set_mounts(self): |
107 |
> self.mounts.append("/tmp/grp") |
108 |
> diff --git a/modules/livecd_stage1_target.py |
109 |
> b/modules/livecd_stage1_target.py |
110 |
> index 17254bb..a27cfe4 100644 |
111 |
> - --- a/modules/livecd_stage1_target.py |
112 |
> +++ b/modules/livecd_stage1_target.py |
113 |
> @@ -48,10 +48,12 @@ class livecd_stage1_target(generic_stage_target): |
114 |
> generic_stage_target.set_use(self) |
115 |
> if self.settings.has_key("use"): |
116 |
> self.settings["use"].append("livecd") |
117 |
> - - self.settings["use"].append("bindist") |
118 |
> + if self.settings.has_key("BINDIST"): |
119 |
> + self.settings["use"].append("bindist") |
120 |
> else: |
121 |
> self.settings["use"]=["livecd"] |
122 |
> - - self.settings["use"].append("bindist") |
123 |
> + if self.settings.has_key("BINDIST"): |
124 |
> + self.settings["use"].append("bindist") |
125 |
|
126 |
This if has_key -> append otherwise create and append pattern is ugly. |
127 |
I wonder if there's a cleaner way to do this. I'll see what I can |
128 |
find. |
129 |
|
130 |
In any case, you can factor the bindist part out of the if has_key block. |
131 |
|
132 |
> def set_packages(self): |
133 |
> generic_stage_target.set_packages(self) |
134 |
> diff --git a/targets/stage1/stage1-chroot.sh |
135 |
> b/targets/stage1/stage1-chroot.sh |
136 |
> index e40982b..8e5a492 100644 |
137 |
> - --- a/targets/stage1/stage1-chroot.sh |
138 |
> +++ b/targets/stage1/stage1-chroot.sh |
139 |
> @@ -6,7 +6,11 @@ source /tmp/chroot-functions.sh |
140 |
> export clst_buildpkgs="$(/tmp/build.py)" |
141 |
> |
142 |
> # Setup our environment |
143 |
> - -BOOTSTRAP_USE="$(portageq envvar BOOTSTRAP_USE)" |
144 |
> +if [ -n "${clst_BINDIST}" ]; then |
145 |
> + BOOTSTRAP_USE="$(portageq envvar BOOTSTRAP_USE) bindist" |
146 |
> +else |
147 |
> + BOOTSTRAP_USE="$(portageq envvar BOOTSTRAP_USE)" |
148 |
> +fi |
149 |
|
150 |
I would change this to just |
151 |
|
152 |
BOOTSTRAP_USE="$(portageq envvar BOOTSTRAP_USE)" |
153 |
if [ -n "${clst_BINDIST}" ]; then |
154 |
BOOTSTRAP_USE="$BOOTSTRAP_USE bindist" |
155 |
fi |
156 |
|
157 |
> FEATURES="${clst_myfeatures} nodoc noman noinfo -news" |
158 |
> |
159 |
> ## Sanity check profile |
160 |
> @@ -50,8 +54,8 @@ sed -i '/USE="${USE} -build"/d' /etc/portage/make.conf |
161 |
> |
162 |
> # Now, we install our packages |
163 |
> [ -e /etc/portage/make.conf ] && \ |
164 |
> - - echo "USE=\"-* bindist build ${BOOTSTRAP_USE} ${clst_HOSTUSE}\"" \ |
165 |
> + echo "USE=\"-* build ${BOOTSTRAP_USE} ${clst_HOSTUSE}\"" \ |
166 |
> >> /etc/portage/make.conf |
167 |
> run_merge "--oneshot ${clst_buildpkgs}" |
168 |
> - -sed -i "/USE=\"-* bindist build ${BOOTSTRAP_USE} ${clst_HOSTUSE}\"/d" \ |
169 |
> +sed -i "/USE=\"-* build ${BOOTSTRAP_USE} ${clst_HOSTUSE}\"/d" \ |
170 |
> /etc/portage/make.conf |
171 |
> - -- |
172 |
> 1.7.8.6 |
173 |
|
174 |
Overall, the patch looks good. With the couple of little style changes |
175 |
and the wording change suggested by Mike & Jorge, this is Reviewed-by: |
176 |
Matt Turner <mattst88@×××××.com> |