public inbox for gentoo-catalyst@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-catalyst] [PATCH] make bindist optional
       [not found] <1354915982-29772-1-git-send-email-sidhayn@gmail.com>
@ 2012-12-07 21:35 ` Rick "Zero_Chaos" Farina
  2012-12-08  2:56   ` Mike Frysinger
  2012-12-08  4:45   ` Matt Turner
  0 siblings, 2 replies; 3+ messages in thread
From: Rick "Zero_Chaos" Farina @ 2012-12-07 21:35 UTC (permalink / raw
  To: gentoo-catalyst

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


From: "Rick Farina (Zero_Chaos)" <zerochaos@gentoo.org>

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                        |    7 +++++++
 files/catalyst.conf             |    4 +++-
 modules/generic_stage_target.py |    5 +++--
 modules/grp_target.py           |   11 ++++++-----
 modules/livecd_stage1_target.py |    6 ++++--
 targets/stage1/stage1-chroot.sh |   10 +++++++---
 6 files changed, 30 insertions(+), 13 deletions(-)

diff --git a/catalyst b/catalyst
index 3d31599..8485984 100755
- --- a/catalyst
+++ b/catalyst
@@ -112,6 +112,13 @@ 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 is prohibited
by law."
+
 	if "ccache" in string.split(conf_values["options"]):
 		print "Compiler cache support enabled."
 		conf_values["CCACHE"]="1"
diff --git a/files/catalyst.conf b/files/catalyst.conf
index ea74eb1..18c6ab8 100644
- --- a/files/catalyst.conf
+++ b/files/catalyst.conf
@@ -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 = enable this option when the builds will be publicly
redistributed to prevent
+	building of patent encumbered and redistribution restricted items.
 # ccache = enables build time ccache support (highly recommended)
 # 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"
diff --git a/modules/generic_stage_target.py
b/modules/generic_stage_target.py
index 3597680..89082c5 100644
- --- a/modules/generic_stage_target.py
+++ b/modules/generic_stage_target.py
@@ -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 self.settings.has_key("BINDIST"):
+			self.settings["use"].append("bindist")

 	def set_stage_path(self):
 		self.settings["stage_path"]=normpath(self.settings["chroot_path"])
diff --git a/modules/grp_target.py b/modules/grp_target.py
index 12eab08..5d3af2e 100644
- --- a/modules/grp_target.py
+++ b/modules/grp_target.py
@@ -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 self.settings.has_key("use"):
- -	    	self.settings["use"].append("bindist")
- -	    else:
- -	    	self.settings["use"]=["bindist"]
+		generic_stage_target.set_use(self)
+		if self.settings.has_key("BINDIST"):
+			if self.settings.has_key("use"):
+				self.settings["use"].append("bindist")
+			else:
+				self.settings["use"]=["bindist"]

 	def set_mounts(self):
 	    self.mounts.append("/tmp/grp")
diff --git a/modules/livecd_stage1_target.py
b/modules/livecd_stage1_target.py
index 17254bb..a27cfe4 100644
- --- a/modules/livecd_stage1_target.py
+++ b/modules/livecd_stage1_target.py
@@ -48,10 +48,12 @@ class livecd_stage1_target(generic_stage_target):
 		generic_stage_target.set_use(self)
 		if self.settings.has_key("use"):
 			self.settings["use"].append("livecd")
- -			self.settings["use"].append("bindist")
+			if self.settings.has_key("BINDIST"):
+				self.settings["use"].append("bindist")
 		else:
 			self.settings["use"]=["livecd"]
- -			self.settings["use"].append("bindist")
+			if self.settings.has_key("BINDIST"):
+				self.settings["use"].append("bindist")

 	def set_packages(self):
 		generic_stage_target.set_packages(self)
diff --git a/targets/stage1/stage1-chroot.sh
b/targets/stage1/stage1-chroot.sh
index e40982b..8e5a492 100644
- --- a/targets/stage1/stage1-chroot.sh
+++ b/targets/stage1/stage1-chroot.sh
@@ -6,7 +6,11 @@ source /tmp/chroot-functions.sh
 export clst_buildpkgs="$(/tmp/build.py)"

 # Setup our environment
- -BOOTSTRAP_USE="$(portageq envvar BOOTSTRAP_USE)"
+if [ -n "${clst_BINDIST}" ]; then
+	BOOTSTRAP_USE="$(portageq envvar BOOTSTRAP_USE) bindist"
+else
+	BOOTSTRAP_USE="$(portageq envvar BOOTSTRAP_USE)"
+fi
 FEATURES="${clst_myfeatures} nodoc noman noinfo -news"

 ## Sanity check profile
@@ -50,8 +54,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
- -- 
1.7.8.6




-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (GNU/Linux)
Comment: Using GnuPG with undefined - http://www.enigmail.net/

iQIcBAEBAgAGBQJQwmEmAAoJEKXdFCfdEflKPmgP/2QG+gCEwOnrpqoSb35JWXSw
Gf2H2hLs5quTDCaJl9JKG63b8PcsA22GLKArEsdBs2eLVmgAsujj6e7Obwun4RUv
SwecZ6wty6N7p4Bvr7TWKTceWORVKWHAlDV65XXg7nE1vzjMg+uLfmuRTJMKcHYh
iQJaKOSOXNWlLWfJwZWiqWL7NoB8uf66Pq9IAEwdO54JcGxDIl/H22NW1JjB10H1
RPGTFEXpJA++1FAHqxS02cWqSK/pjzJ1qq9ibVnW0Eupp5U6F3kweAtuQ9IGy3et
LUFkhfUW+q51+LswJf75WZFfKT6lML6xf55vZ0vP1T+RByUQTD/r6QxDmO7c0cOz
Y7nMP+yT43ieRlGvJvBvE6yYPgNoTOKCDhDkteudNuY7TcqAc2ZVcX9FzR9bcG+H
HOlSK+5JnJqemIb4BIi5lUHkCjJd/LrbHl1w4qSvHGZmLBDSXxZYyVPuPuI0a5Sk
e6ZQ+0wNEqxiYlM4KMniAkuMseguJK+cp9S9bHx2ZAO+c+kbnsN6V7e2p+LBxg5s
VM7wskHuXHzlcUcEw71RMazFRs23vaEVJ7eIU1zBSFK+hxzkeM+9UJq5Bes7zu2L
JPLZsRXZbT8lkvuth4FVp0cgMlrNfWHulFoXbYckwanViA7mYzfQVXf+YTqn/bId
yi9qhh0pFwykopQ4Qson
=lnZN
-----END PGP SIGNATURE-----


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [gentoo-catalyst] [PATCH] make bindist optional
  2012-12-07 21:35 ` [gentoo-catalyst] [PATCH] make bindist optional Rick "Zero_Chaos" Farina
@ 2012-12-08  2:56   ` Mike Frysinger
  2012-12-08  4:45   ` Matt Turner
  1 sibling, 0 replies; 3+ messages in thread
From: Mike Frysinger @ 2012-12-08  2:56 UTC (permalink / raw
  To: gentoo-catalyst

[-- Attachment #1: Type: Text/Plain, Size: 323 bytes --]

On Friday 07 December 2012 16:35:34 Rick "Zero_Chaos" Farina wrote:
> +		print "Bindist is not enabled in catalyst.conf"
> +		print "Binary redistribution of generated stages/isos is prohibited
> by law."

"is" -> "might be".  we can't speak for all jurisdictions.

probably need similar wording fixes in this patch.
-mike

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [gentoo-catalyst] [PATCH] make bindist optional
  2012-12-07 21:35 ` [gentoo-catalyst] [PATCH] make bindist optional Rick "Zero_Chaos" Farina
  2012-12-08  2:56   ` Mike Frysinger
@ 2012-12-08  4:45   ` Matt Turner
  1 sibling, 0 replies; 3+ messages in thread
From: Matt Turner @ 2012-12-08  4:45 UTC (permalink / raw
  To: gentoo-catalyst

On Fri, Dec 7, 2012 at 1:35 PM, Rick "Zero_Chaos" Farina
<zerochaos@gentoo.org> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
>
> From: "Rick Farina (Zero_Chaos)" <zerochaos@gentoo.org>
>
> 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                        |    7 +++++++
>  files/catalyst.conf             |    4 +++-
>  modules/generic_stage_target.py |    5 +++--
>  modules/grp_target.py           |   11 ++++++-----
>  modules/livecd_stage1_target.py |    6 ++++--
>  targets/stage1/stage1-chroot.sh |   10 +++++++---
>  6 files changed, 30 insertions(+), 13 deletions(-)
>
> diff --git a/catalyst b/catalyst
> index 3d31599..8485984 100755
> - --- a/catalyst
> +++ b/catalyst
> @@ -112,6 +112,13 @@ 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 is prohibited
> by law."
> +
>         if "ccache" in string.split(conf_values["options"]):
>                 print "Compiler cache support enabled."
>                 conf_values["CCACHE"]="1"
> diff --git a/files/catalyst.conf b/files/catalyst.conf
> index ea74eb1..18c6ab8 100644
> - --- a/files/catalyst.conf
> +++ b/files/catalyst.conf
> @@ -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 = enable this option when the builds will be publicly
> redistributed to prevent
> +       building of patent encumbered and redistribution restricted items.
>  # ccache = enables build time ccache support (highly recommended)
>  # 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"
> diff --git a/modules/generic_stage_target.py
> b/modules/generic_stage_target.py
> index 3597680..89082c5 100644
> - --- a/modules/generic_stage_target.py
> +++ b/modules/generic_stage_target.py
> @@ -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 self.settings.has_key("BINDIST"):
> +                       self.settings["use"].append("bindist")
>
>         def set_stage_path(self):
>                 self.settings["stage_path"]=normpath(self.settings["chroot_path"])
> diff --git a/modules/grp_target.py b/modules/grp_target.py
> index 12eab08..5d3af2e 100644
> - --- a/modules/grp_target.py
> +++ b/modules/grp_target.py
> @@ -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 self.settings.has_key("use"):
> - -             self.settings["use"].append("bindist")
> - -         else:
> - -             self.settings["use"]=["bindist"]
> +               generic_stage_target.set_use(self)
> +               if self.settings.has_key("BINDIST"):
> +                       if self.settings.has_key("use"):
> +                               self.settings["use"].append("bindist")
> +                       else:
> +                               self.settings["use"]=["bindist"]
>
>         def set_mounts(self):
>             self.mounts.append("/tmp/grp")
> diff --git a/modules/livecd_stage1_target.py
> b/modules/livecd_stage1_target.py
> index 17254bb..a27cfe4 100644
> - --- a/modules/livecd_stage1_target.py
> +++ b/modules/livecd_stage1_target.py
> @@ -48,10 +48,12 @@ class livecd_stage1_target(generic_stage_target):
>                 generic_stage_target.set_use(self)
>                 if self.settings.has_key("use"):
>                         self.settings["use"].append("livecd")
> - -                     self.settings["use"].append("bindist")
> +                       if self.settings.has_key("BINDIST"):
> +                               self.settings["use"].append("bindist")
>                 else:
>                         self.settings["use"]=["livecd"]
> - -                     self.settings["use"].append("bindist")
> +                       if self.settings.has_key("BINDIST"):
> +                               self.settings["use"].append("bindist")

This if has_key -> append otherwise create and append pattern is ugly.
I wonder if there's a cleaner way to do this. I'll see what I can
find.

In any case, you can factor the bindist part out of the if has_key block.

>         def set_packages(self):
>                 generic_stage_target.set_packages(self)
> diff --git a/targets/stage1/stage1-chroot.sh
> b/targets/stage1/stage1-chroot.sh
> index e40982b..8e5a492 100644
> - --- a/targets/stage1/stage1-chroot.sh
> +++ b/targets/stage1/stage1-chroot.sh
> @@ -6,7 +6,11 @@ source /tmp/chroot-functions.sh
>  export clst_buildpkgs="$(/tmp/build.py)"
>
>  # Setup our environment
> - -BOOTSTRAP_USE="$(portageq envvar BOOTSTRAP_USE)"
> +if [ -n "${clst_BINDIST}" ]; then
> +       BOOTSTRAP_USE="$(portageq envvar BOOTSTRAP_USE) bindist"
> +else
> +       BOOTSTRAP_USE="$(portageq envvar BOOTSTRAP_USE)"
> +fi

I would change this to just

BOOTSTRAP_USE="$(portageq envvar BOOTSTRAP_USE)"
if [ -n "${clst_BINDIST}" ]; then
        BOOTSTRAP_USE="$BOOTSTRAP_USE bindist"
fi

>  FEATURES="${clst_myfeatures} nodoc noman noinfo -news"
>
>  ## Sanity check profile
> @@ -50,8 +54,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
> - --
> 1.7.8.6

Overall, the patch looks good. With the couple of little style changes
and the wording change suggested by Mike & Jorge, this is Reviewed-by:
Matt Turner <mattst88@gmail.com>


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-12-08  6:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1354915982-29772-1-git-send-email-sidhayn@gmail.com>
2012-12-07 21:35 ` [gentoo-catalyst] [PATCH] make bindist optional Rick "Zero_Chaos" Farina
2012-12-08  2:56   ` Mike Frysinger
2012-12-08  4:45   ` Matt Turner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox