make bindist optional
authorRick Farina (Zero_Chaos) <zerochaos@gentoo.org>
Fri, 25 Jan 2013 03:46:05 +0000 (22:46 -0500)
committerRick Farina (Zero_Chaos) <zerochaos@gentoo.org>
Fri, 25 Jan 2013 03:46:05 +0000 (22:46 -0500)
After the recent fixes which ensure the bindist use flag
is always set, users now have no way to disable this flag.
This patch introduces the new "bindist" feature, enabled by
default, which will allow users to turn off bindist if
they are not going to redistribute the builds (or for
tinderbox testing, etc).

catalyst
files/catalyst.conf
modules/generic_stage_target.py
modules/grp_target.py
modules/livecd_stage1_target.py
targets/stage1/stage1-chroot.sh

index 93114e94212d03dd54a817575f194d7b34745eb6..9f8dd30127c7c7fbdf2803e43eda90ae213e7467 100755 (executable)
--- a/catalyst
+++ b/catalyst
@@ -112,6 +112,14 @@ def parse_config(myconfig):
                print "Autoresuming support enabled."
                conf_values["AUTORESUME"]="1"
 
+       if "bindist" in string.split(conf_values["options"]):
+               print "Binary redistribution enabled"
+               conf_values["BINDIST"]="1"
+       else:
+               print "Bindist is not enabled in catalyst.conf"
+               print "Binary redistribution of generated stages/isos may be prohibited by law."
+               print "Please see the use description for bindist on any package you are including."
+
        if "ccache" in string.split(conf_values["options"]):
                print "Compiler cache support enabled."
                conf_values["CCACHE"]="1"
index e2def6644d8cf37f546172a6ae0716a9f77b27ce..f88f10525b9cc17b6b8727101bc494b7f6b41f03 100644 (file)
@@ -49,6 +49,8 @@ hash_function="crc32"
 #      the -a option to the catalyst cmdline.  -p will clear the autoresume flags
 #      as well as your pkgcache and kerncache
 #      ( This option is not fully tested, bug reports welcome )
+# bindist = enables the bindist USE flag, please see package specific definition,
+#      however, it is suggested to enable this if redistributing builds.
 # ccache = enables build time ccache support
 # distcc = enable distcc support for building. You have to set distcc_hosts in
 #      your spec file.
@@ -64,7 +66,7 @@ hash_function="crc32"
 #      your cache. The cache is unlinked before any empty or rm processing, though.
 #
 # (These options can be used together)
-options="autoresume kerncache pkgcache seedcache snapcache"
+options="autoresume bindist kerncache pkgcache seedcache snapcache"
 
 # portdir specifies the source portage tree used by the snapshot target.
 portdir="/usr/portage"
index 0a473ef617f0fcd298cb599577abbda12a754b2c..12921d6ce025f129eeae1e0711a052da8abf1deb 100644 (file)
@@ -490,8 +490,9 @@ class generic_stage_target(generic_target):
                if type(self.settings["use"])==types.StringType:
                        self.settings["use"]=self.settings["use"].split()
 
-               # Force bindist for all targets
-               self.settings["use"].append("bindist")
+               # Force bindist when options ask for it
+               if "BINDIST" in self.settings:
+                       self.settings["use"].append("bindist")
 
        def set_stage_path(self):
                self.settings["stage_path"]=normpath(self.settings["chroot_path"])
index 654b5e5cacc453ed36c9e917a80aef58f044eb95..6941522224bc65e4e5c8b5824280320090e8a318 100644 (file)
@@ -62,11 +62,12 @@ class grp_target(generic_stage_target):
                                raise CatalystError,"GRP build aborting due to error."
 
        def set_use(self):
-           generic_stage_target.set_use(self)
-           if "use" in self.settings:
-               self.settings["use"].append("bindist")
-           else:
-               self.settings["use"]=["bindist"]
+               generic_stage_target.set_use(self)
+               if "BINDIST" in self.settings:
+                       if "use" in self.settings:
+                               self.settings["use"].append("bindist")
+                       else:
+                               self.settings["use"]=["bindist"]
 
        def set_mounts(self):
            self.mounts.append("/tmp/grp")
index 5b552b9b6d2271f9c7d705b5dcb032d58d6945e5..59de9bb84ed79d9757f2307d41bad454d718e975 100644 (file)
@@ -48,10 +48,12 @@ class livecd_stage1_target(generic_stage_target):
                generic_stage_target.set_use(self)
                if "use" in self.settings:
                        self.settings["use"].append("livecd")
-                       self.settings["use"].append("bindist")
+                       if "BINDIST" in self.settings:
+                               self.settings["use"].append("bindist")
                else:
                        self.settings["use"]=["livecd"]
-                       self.settings["use"].append("bindist")
+                       if "BINDIST" in self.settings:
+                               self.settings["use"].append("bindist")
 
        def set_packages(self):
                generic_stage_target.set_packages(self)
index 73d27ffefb2405ecf37bb4b6af11abe1a092cac5..462ea28387fa3678ab51507d783ca671d18c0f96 100644 (file)
@@ -7,6 +7,8 @@ export clst_buildpkgs="$(/tmp/build.py)"
 
 # Setup our environment
 BOOTSTRAP_USE="$(portageq envvar BOOTSTRAP_USE)"
+[ -n "${clst_BINDIST}" ] && BOOTSTRAP_USE="${BOOTSTRAP_USE} bindist"
+
 FEATURES="${clst_myfeatures} nodoc noman noinfo -news"
 
 ## Sanity check profile
@@ -50,8 +52,8 @@ sed -i '/USE="${USE} -build"/d' /etc/portage/make.conf
 
 # Now, we install our packages
 [ -e /etc/portage/make.conf ] && \
-       echo "USE=\"-* bindist build ${BOOTSTRAP_USE} ${clst_HOSTUSE}\"" \
+       echo "USE=\"-* build ${BOOTSTRAP_USE} ${clst_HOSTUSE}\"" \
        >> /etc/portage/make.conf
 run_merge "--oneshot ${clst_buildpkgs}"
-sed -i "/USE=\"-* bindist build ${BOOTSTRAP_USE} ${clst_HOSTUSE}\"/d" \
+sed -i "/USE=\"-* build ${BOOTSTRAP_USE} ${clst_HOSTUSE}\"/d" \
        /etc/portage/make.conf