Mailing List Archive

[PATCH v2 3/3] ruby-fakegem.eclass: don't double-add USE=doc/test
This isn't explicitly wrong, but it's a bit ugly in the generated metadata,
and I'm not convinced Portage handles duplicates correctly (see e.g.
the duplicate || ( ... ) issue in *DEPEND).

This doesn't fix all instances and to be honest, it's a bit dubious given has_iuse
doesn't work in global scope, but let's just fix the thing which is definitely
wrong (the quoting).

This does change the metadata generated in the way I expected, but it doesn't
remove *all* duplicates.

Signed-off-by: Sam James <sam@gentoo.org>
---
eclass/ruby-fakegem.eclass | 42 ++++++++++++++++++++++++++------------
1 file changed, 29 insertions(+), 13 deletions(-)

diff --git a/eclass/ruby-fakegem.eclass b/eclass/ruby-fakegem.eclass
index b3262dc5cdb4..8d22c4e3ccf7 100644
--- a/eclass/ruby-fakegem.eclass
+++ b/eclass/ruby-fakegem.eclass
@@ -150,17 +150,23 @@ RUBY_FAKEGEM_SUFFIX="${RUBY_FAKEGEM_SUFFIX:-}"

case ${RUBY_FAKEGEM_RECIPE_DOC} in
rake)
- IUSE+=" doc"
+ if ! has doc ${IUSE} ; then
+ IUSE+=" doc"
+ fi
ruby_add_bdepend "doc? ( dev-ruby/rake )"
RUBY_FAKEGEM_DOCDIR="doc"
;;
rdoc)
- IUSE+=" doc"
+ if ! has doc ${IUSE} ; then
+ IUSE+=" doc"
+ fi
ruby_add_bdepend "doc? ( dev-ruby/rdoc )"
RUBY_FAKEGEM_DOCDIR="doc"
;;
yard)
- IUSE+="doc"
+ if ! has doc ${IUSE} ; then
+ IUSE+="doc"
+ fi
ruby_add_bdepend "doc? ( dev-ruby/yard )"
RUBY_FAKEGEM_DOCDIR="doc"
;;
@@ -173,30 +179,40 @@ esac

case ${RUBY_FAKEGEM_RECIPE_TEST} in
rake)
- IUSE+=" test"
- RESTRICT+=" !test? ( test )"
+ if ! has test ${IUSE} ; then
+ IUSE+=" test"
+ RESTRICT+=" !test? ( test )"
+ fi
ruby_add_bdepend "test? ( dev-ruby/rake )"
;;
rspec)
- IUSE+=" test"
- RESTRICT+=" !test? ( test )"
+ if ! has test ${IUSE} ; then
+ IUSE+=" test"
+ RESTRICT+=" !test? ( test )"
+ fi
# Also require a new enough rspec-core version that installs the
# rspec-2 wrapper.
ruby_add_bdepend "test? ( dev-ruby/rspec:2 >=dev-ruby/rspec-core-2.14.8-r2 )"
;;
rspec3)
- IUSE+=" test"
- RESTRICT+=" !test? ( test )"
+ if ! has test ${IUSE} ; then
+ IUSE+=" test"
+ RESTRICT+=" !test? ( test )"
+ fi
ruby_add_bdepend "test? ( dev-ruby/rspec:3 )"
;;
cucumber)
- IUSE+=" test"
- RESTRICT+=" !test? ( test )"
+ if ! has test ${IUSE} ; then
+ IUSE+=" test"
+ RESTRICT+=" !test? ( test )"
+ fi
ruby_add_bdepend "test? ( dev-util/cucumber )"
;;
sus)
- IUSE+=" test"
- RESTRICT+=" !test? ( test )"
+ if ! has test ${IUSE} ; then
+ IUSE+=" test"
+ RESTRICT+=" !test? ( test )"
+ fi
ruby_add_bdepend "test? ( dev-ruby/sus )"
;;
none)
--
2.40.0