aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-01-18 21:03:03 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-01-18 21:03:03 +0000
commit01de4db497ac3104e511a996b315a2e640940782 (patch)
treed8038097e172ed8293e8bbe2e465393d2885a303
parentde4ab52707c112cee35dd588a3cf0e1663bb0280 (diff)
downloadpaludis-01de4db497ac3104e511a996b315a2e640940782.tar.gz
paludis-01de4db497ac3104e511a996b315a2e640940782.tar.xz
Change SUBOPTIONS behaviour for exheres option_enable etc
-rwxr-xr-xpaludis/repositories/e/ebuild/exheres-0/conditional_functions.bash9
-rw-r--r--paludis/repositories/e/ebuild/exheres-0/conditional_functions_TEST.bash7
-rw-r--r--paludis/repositories/e/ebuild/exheres-0/list_functions.bash11
-rw-r--r--paludis/repositories/e/ebuild/exheres-0/list_functions_TEST.bash9
4 files changed, 27 insertions, 9 deletions
diff --git a/paludis/repositories/e/ebuild/exheres-0/conditional_functions.bash b/paludis/repositories/e/ebuild/exheres-0/conditional_functions.bash
index be5280c..cf26fde 100755
--- a/paludis/repositories/e/ebuild/exheres-0/conditional_functions.bash
+++ b/paludis/repositories/e/ebuild/exheres-0/conditional_functions.bash
@@ -33,17 +33,18 @@ use_enable()
option_with()
{
if optionq "${1}" ; then
- echo "--with-${2:-${1}}${3+=${3}}"
+ echo "--with-${2:-$(optionfmt ${1} )}${3+=${3}}"
else
- echo "--without-${2:-${1}}"
+ echo "--without-${2:-$(optionfmt ${1} )}"
fi
}
option_enable()
{
if optionq "${1}" ; then
- echo "--enable-${2:-${1}}${3+=${3}}"
+ echo "--enable-${2:-$(optionfmt ${1} )}${3+=${3}}"
else
- echo "--disable-${2:-${1}}"
+ echo "--disable-${2:-$(optionfmt ${1} )}"
fi
}
+
diff --git a/paludis/repositories/e/ebuild/exheres-0/conditional_functions_TEST.bash b/paludis/repositories/e/ebuild/exheres-0/conditional_functions_TEST.bash
index 9a9769a..91874ee 100644
--- a/paludis/repositories/e/ebuild/exheres-0/conditional_functions_TEST.bash
+++ b/paludis/repositories/e/ebuild/exheres-0/conditional_functions_TEST.bash
@@ -18,10 +18,11 @@
option_with_TEST()
{
- export OPTIONS="foo" MYOPTIONS="foo bar baz"
+ export OPTIONS="foo blah:moo" MYOPTIONS="foo bar baz blah:moo"
test_equality "$(option_with foo )" "--with-foo"
test_equality "$(option_with foo bar )" "--with-bar"
test_equality "$(option_with foo bar baz )" "--with-bar=baz"
+ test_equality "$(option_with blah:moo )" "--with-moo"
export OPTIONS="oink"
test_equality "$(option_with foo )" "--without-foo"
@@ -32,13 +33,15 @@ option_with_TEST()
option_enable_TEST()
{
- export OPTIONS="foo" MYOPTIONS="foo bar baz"
+ export OPTIONS="foo blah:moo" MYOPTIONS="foo bar baz blah:moo"
test_equality "$(option_enable foo )" "--enable-foo"
test_equality "$(option_enable foo bar )" "--enable-bar"
test_equality "$(option_enable foo bar baz )" "--enable-bar=baz"
+ test_equality "$(option_enable blah:moo )" "--enable-moo"
export OPTIONS="oink"
test_equality "$(option_enable foo )" "--disable-foo"
test_equality "$(option_enable foo bar )" "--disable-bar"
test_equality "$(option_enable foo bar baz )" "--disable-bar"
}
+
diff --git a/paludis/repositories/e/ebuild/exheres-0/list_functions.bash b/paludis/repositories/e/ebuild/exheres-0/list_functions.bash
index 159c666..d9f72a0 100644
--- a/paludis/repositories/e/ebuild/exheres-0/list_functions.bash
+++ b/paludis/repositories/e/ebuild/exheres-0/list_functions.bash
@@ -1,7 +1,7 @@
#!/bin/bash
# vim: set sw=4 sts=4 et :
-# Copyright (c) 2006, 2007 Ciaran McCreesh
+# Copyright (c) 2006, 2007, 2008 Ciaran McCreesh
#
# Based in part upon ebuild.sh from Portage, which is Copyright 1995-2005
# Gentoo Foundation and distributed under the terms of the GNU General
@@ -35,6 +35,12 @@ useq()
die "Function 'useq' banned in this EAPI"
}
+optionfmt()
+{
+ local opt="${1#!}"
+ echo ${opt#*([^:]):}
+}
+
option()
{
optionq "${1}"
@@ -43,7 +49,7 @@ option()
optionv()
{
if optionq "${1}" ; then
- echo "${1#!}"
+ optionfmt "${1}"
return 0
else
return 1
@@ -87,3 +93,4 @@ hasq()
done
return 1
}
+
diff --git a/paludis/repositories/e/ebuild/exheres-0/list_functions_TEST.bash b/paludis/repositories/e/ebuild/exheres-0/list_functions_TEST.bash
index e4df155..2315b8e 100644
--- a/paludis/repositories/e/ebuild/exheres-0/list_functions_TEST.bash
+++ b/paludis/repositories/e/ebuild/exheres-0/list_functions_TEST.bash
@@ -35,13 +35,19 @@ option_TEST()
optionv_TEST()
{
- export OPTIONS="foo bar" MYOPTIONS="foo bar baz"
+ export OPTIONS="foo bar moo:oink" MYOPTIONS="foo bar baz moo:oink moo:baah"
optionv foo 1>/dev/null ; test_return_code
test_equality "$(optionv foo)" "foo"
optionv bar 1>/dev/null ; test_return_code
test_equality "$(optionv bar)" "bar"
+ optionv moo:oink 1>/dev/null ; test_return_code
+ test_equality "$(optionv moo:oink )" "oink"
+
+ ! optionv moo:baah 1>/dev/null ; test_return_code
+ test_equality "$(optionv moo:baah )" ""
+
! optionv baz 1>/dev/null ; test_return_code
test_equality "$(optionv baz)" ""
@@ -71,3 +77,4 @@ optionq_TEST()
optionq !foofoo ; test_return_code
optionq !fo ; test_return_code
}
+