public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Petteri Räty" <betelgeuse@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/libbash:master commit in: /, utils/
Date: Mon, 23 May 2011 14:34:21 +0000 (UTC)	[thread overview]
Message-ID: <0b81725ba19e24f5fbbe7e0026058aa93f6a9965.betelgeuse@gentoo> (raw)

commit:     0b81725ba19e24f5fbbe7e0026058aa93f6a9965
Author:     Mu Qiao <qiaomuf <AT> gentoo <DOT> org>
AuthorDate: Sun May 22 09:41:22 2011 +0000
Commit:     Petteri Räty <betelgeuse <AT> gentoo <DOT> org>
CommitDate: Mon May 23 15:04:45 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/libbash.git;a=commit;h=0b81725b

Utility: support misc functions for instruo

"has", "hasq" and "die" are supported for instruo.

---
 Makefile.am                 |    1 +
 utils/instruo.cpp           |    2 +-
 utils/isolated-functions.sh |   22 ++++++++++++++++++++++
 3 files changed, 24 insertions(+), 1 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 011f011..267240e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -225,6 +225,7 @@ EXTRA_DIST = bashast/bashast.g \
 			 scripts/illegal_script.sh \
 			 scripts/foo.eclass \
 			 utils/metadata_diff.sh \
+			 utils/isolated-functions.sh \
 			 test_coverage.sh \
 			 autogen.sh \
 			 $(BASH_TESTS) \

diff --git a/utils/instruo.cpp b/utils/instruo.cpp
index da020c3..8206b95 100644
--- a/utils/instruo.cpp
+++ b/utils/instruo.cpp
@@ -103,7 +103,7 @@ void worker(const std::shared_ptr<PackageIDSequence> &ids)
                             variables["PVR"][0] + ".ebuild");
     try
     {
-      libbash::interpret(ebuild_path, variables, functions);
+      libbash::interpret(ebuild_path, "utils/isolated-functions.sh", variables, functions);
     }
     catch(const interpreter_exception& e)
     {

diff --git a/utils/isolated-functions.sh b/utils/isolated-functions.sh
new file mode 100755
index 0000000..efbf933
--- /dev/null
+++ b/utils/isolated-functions.sh
@@ -0,0 +1,22 @@
+die(){
+    echo "Die is called. Something went wrong while interpreting"
+}
+
+has() {
+    hasq "$@"
+}
+
+hasq() {
+    for item in ${*:2}
+    do
+        [[ $item == $1 ]] && return 0
+    done
+    return 1
+}
+
+EXPORT_FUNCTIONS() {
+    if [ -z "$ECLASS" ]; then 
+        die "EXPORT_FUNCTIONS without a defined ECLASS"
+    fi   
+    $__export_funcs_var="$__export_funcs_var $*" 
+}



             reply	other threads:[~2011-05-23 14:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-23 14:34 Petteri Räty [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-08-04 13:53 [gentoo-commits] proj/libbash:master commit in: /, utils/ Petteri Räty
2011-05-23 14:34 Petteri Räty
2011-05-23 14:34 Petteri Räty
2011-04-26 11:02 Petteri Räty

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=0b81725ba19e24f5fbbe7e0026058aa93f6a9965.betelgeuse@gentoo \
    --to=betelgeuse@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.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