From: Brian Harring <ferringb@gmail.com>
To: Ulrich Mueller <ulm@gentoo.org>
Cc: "Petteri Räty" <betelgeuse@gentoo.org>, gentoo-pms@lists.gentoo.org
Subject: Re: [gentoo-pms] License for code snippets included in PMS
Date: Sun, 13 Mar 2011 09:40:36 -0700 [thread overview]
Message-ID: <20110313164036.GA13362@hrair> (raw)
In-Reply-To: <19836.53359.533858.544748@a1i15.kph.uni-mainz.de>
[-- Attachment #1.1: Type: text/plain, Size: 822 bytes --]
On Sun, Mar 13, 2011 at 03:10:55PM +0100, Ulrich Mueller wrote:
> >>>>> On Sun, 13 Mar 2011, Petteri Räty wrote:
>
> >>> Could we put all code snippets under some unrestrictive license
> >>> please? Like CC0-1.0-Universal?
>
> > To be on the safe side I think we should get permission from
> > everyone who has worked on the code snippets before applying this
> > patch.
>
> Here's the complete list from git history:
> env-saving.listing (21 lines):
> Ciaran McCreesh
This section wasn't accurate, as such I threw it out- attached is a
brain dump of exactly what characteristics can be relied on for
env saving, and should be reasonably complete.
Could stand to have some comments added though.
As for license, CC0-1.0-universal/public domain/whatever floats your
boat.
~harring
[-- Attachment #1.2: 0001-correct-env-saving.listing-to-be-accurate-complete.patch --]
[-- Type: text/plain, Size: 3805 bytes --]
From a02ba65376e463818aa3d7abc2f845bd5ca745ff Mon Sep 17 00:00:00 2001
From: Brian Harring <ferringb@gmail.com>
Date: Sun, 13 Mar 2011 09:09:43 -0700
Subject: [PATCH] correct env-saving.listing to be accurate/complete
Version that was in place wasn't particularly accurate nor complete.
As such, and to cover copyright/licensing concerns, a from-scratch
version was written covering array behaviours, functions, unset behaviour,
and exports.
Signed-off-by: Brian Harring <ferringb@gmail.com>
---
env-saving.listing | 84 +++++++++++++++++++++++++++++++++++++++------------
1 files changed, 64 insertions(+), 20 deletions(-)
diff --git a/env-saving.listing b/env-saving.listing
index 1650aa7..4391553 100644
--- a/env-saving.listing
+++ b/env-saving.listing
@@ -1,27 +1,71 @@
-GLOBAL_VARIABLE="a"
-
-src_compile()
-{
- GLOBAL_VARIABLE="b"
- DEFAULT_VARIABLE="c"
- export EXPORTED_VARIABLE="d"
- local LOCAL_VARIABLE="e"
+GLOBAL_SCOPE_VARIABLE="initial"
+VAR_TO_WIPE=initial
+declare -a ARRAY_VARIABLE=( a b )
+
+my_function() {
+ echo "exists"
+}
+
+src_compile() {
+ [[ ${GLOBAL_SCOPE_VARIABLE} == initial ]] || \
+ die "GLOBAL_SCOPE_VARIABLE must be preserved"
+
+ export GLOBAL_SCOPE_VARIABLE=set_twice
+
+ [[ ${VAR_TO_WIPE} == initial ]] || \
+ die "VAR_TO_WIPE must be preserved"
+
+ # now we wipe the var, to ensure that the env saving doesn't preserve it.
+ unset VAR_TO_WIPE
+
+ local LOCAL_SCOPE_VARIABLE=unseen
+
+ DEFAULT_SCOPE_VARIABLE=set
+
+ { [[ ${#ARRAY_VARIABLE[@]} == 2 ]] && \
+ [[ ${ARRAY_VARIABLE[0]} == a ]] && \
+ [[ ${ARRAY_VARIABLE[1]} == b ]]; \
+ } || \
+ die "ARRAY_VARIABLE contents must be preserved exactly, and accessible"
+ ARRAY_VARIABLE[2]=c
+
+ [[ $(my_function 2> /dev/null) == exists ]] || \
+ die "'my_function' must be preserved"
}
-src_install(){
- [[ ${GLOBAL_VARIABLE} == "a" ]] \
- || [[ ${GLOBAL_VARIABLE} == "b" ]] \
- || die "broken env saving for globals"
- [[ ${DEFAULT_VARIABLE} == "c" ]] \
- || die "broken env saving for default"
+src_install() {
+ [[ ${GLOBAL_SCOPE_VARIABLE} == set_twice ]] || \
+ die "GLOBAL_SCOPE_VARIABLE modifications in src_compile must be preserved"
+
+ [[ -n $(declare -xp GLOBAL_SCOPE_VARIABLE 2> /dev/null) ]] || \
+ die "GLOBAL_SCOPE_VARIABLE must be exported due to src_compile exporting it"
+
+ [[ ${LOCAL_SCOPE_VARIABLE-unset} == unset ]] || \
+ die "a local defined variable should be impossible to propagate"
+
+ [[ ${VAR_TO_WIPE-unset} == unset ]] || \
+ die "VAR_TO_WIPE was unset during src_compile; this wiping must be preserved"
+
+ [[ ${DEFAULT_SCOPE_VARIABLE} == set ]] || \
+ die "DEFAULT_SCOPE_VARIABLE must be preserved"
+
+ [[ -n $(declare -xp DEFAULT_SCOPE_VARIABLE 2> /dev/null) ]] || \
+ die "DEFAULT_SCOPE_VARIABLE wasn't exported; environment saving must be preserved that fact."
+
+ [[ ${ARRAY_VARIABLE-unset} != unset ]] || \
+ die "ARRAY_VARIABLE must be preserved"
- [[ ${EXPORTED_VARIABLE} == "d" ]] \
- || die "broken env saving for exported"
+ [[ -n $(declare -ap ARRAY_VARIABLE 2> /dev/null) ]] || \
+ die "ARRAY_VARIABLE created during src_compile, must have it's array type preserved"
- [[ $(printenv EXPORTED_VARIABLE ) == "d" ]] \
- || die "broken env saving for exported"
+ { [[ ${#ARRAY_VARIABLE[@]} == 3 ]] && \
+ [[ ${ARRAY_VARIABLE[0]} == a ]] && \
+ [[ ${ARRAY_VARIABLE[1]} == b ]]; \
+ [[ ${ARRAY_VARIABLE[2]} == c ]]; \
+ } || \
+ die "ARRAY_VARIABLE contents must be preserved exactly"
- [[ -z ${LOCAL_VARIABLE} ]] \
- || die "broken env saving for locals"
+ [[ $(my_function 2> /dev/null) == exists ]] || \
+ die "'my_function' must be preserved"
}
--
1.7.4
[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]
next prev parent reply other threads:[~2011-03-13 16:40 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-20 0:15 [gentoo-pms] License for code snippets included in PMS Ulrich Mueller
2011-02-24 7:49 ` Ulrich Mueller
2011-03-13 10:30 ` Petteri Räty
2011-03-13 14:10 ` Ulrich Mueller
2011-03-13 16:40 ` Brian Harring [this message]
2011-03-13 17:14 ` David Leverton
2011-03-13 16:58 ` Ciaran McCreesh
2011-03-14 22:23 ` Ulrich Mueller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110313164036.GA13362@hrair \
--to=ferringb@gmail.com \
--cc=betelgeuse@gentoo.org \
--cc=gentoo-pms@lists.gentoo.org \
--cc=ulm@gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox