diff options
author | 2011-04-01 22:09:46 +0100 | |
---|---|---|
committer | 2011-04-02 01:02:05 +0100 | |
commit | 568b21f7bec6a17356bedfbc95a6adf505d74d59 (patch) | |
tree | ca155acb9e7a69c1019d2f977a8d098fc445eba9 | |
parent | ea370e26e5bd368512c7e54f11f5179ac4fe1610 (diff) | |
download | paludis-568b21f7bec6a17356bedfbc95a6adf505d74d59.tar.gz paludis-568b21f7bec6a17356bedfbc95a6adf505d74d59.tar.xz |
Make --use-with / --use-enable with empty 3rd argument EAPI-dependent
See: Gentoo#322049
-rw-r--r-- | paludis/repositories/e/e_repository_TEST_0.cc | 8 | ||||
-rwxr-xr-x | paludis/repositories/e/e_repository_TEST_0_setup.sh | 16 | ||||
-rw-r--r-- | paludis/repositories/e/e_repository_TEST_4.cc | 8 | ||||
-rwxr-xr-x | paludis/repositories/e/e_repository_TEST_4_setup.sh | 17 | ||||
-rw-r--r-- | paludis/repositories/e/eapi.cc | 3 | ||||
-rw-r--r-- | paludis/repositories/e/eapi.hh | 2 | ||||
-rw-r--r-- | paludis/repositories/e/eapis/0.conf | 1 | ||||
-rw-r--r-- | paludis/repositories/e/eapis/4.conf | 1 | ||||
-rw-r--r-- | paludis/repositories/e/eapis/exheres-0.conf | 1 | ||||
-rw-r--r-- | paludis/repositories/e/eapis/paludis-1.conf | 1 | ||||
-rw-r--r-- | paludis/repositories/e/ebuild.cc | 2 | ||||
-rw-r--r-- | paludis/repositories/e/ebuild/0/conditional_functions.bash | 13 | ||||
-rw-r--r-- | paludis/repositories/e/ebuild/0/conditional_functions_TEST.bash | 11 |
13 files changed, 81 insertions, 3 deletions
diff --git a/paludis/repositories/e/e_repository_TEST_0.cc b/paludis/repositories/e/e_repository_TEST_0.cc index 8967ab01a..b988786ea 100644 --- a/paludis/repositories/e/e_repository_TEST_0.cc +++ b/paludis/repositories/e/e_repository_TEST_0.cc @@ -341,5 +341,13 @@ TEST(ERepository, InstallEAPI0) EXPECT_EQ("0", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value()); id->perform_action(action); } + + { + const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( + PackageDepSpec(parse_user_package_dep_spec("=cat/use-with-enable-empty-third-0", + &env, { })), make_null_shared_ptr(), { }))]->last()); + ASSERT_TRUE(bool(id)); + id->perform_action(action); + } } diff --git a/paludis/repositories/e/e_repository_TEST_0_setup.sh b/paludis/repositories/e/e_repository_TEST_0_setup.sh index df0383e99..ca1ff7adf 100755 --- a/paludis/repositories/e/e_repository_TEST_0_setup.sh +++ b/paludis/repositories/e/e_repository_TEST_0_setup.sh @@ -1001,6 +1001,22 @@ EAPI="3" S="${WORKDIR}" END +mkdir -p "cat/use-with-enable-empty-third" +cat <<'END' > cat/use-with-enable-empty-third/use-with-enable-empty-third-0.ebuild || exit 1 +EAPI="${PV}" +DESCRIPTION="The Description" +HOMEPAGE="http://example.com/" +SRC_URI="" +SLOT="0" +IUSE="spork" +LICENSE="GPL-2" +KEYWORDS="test" + +src_compile() { + [[ $(use_with cheese cheese "") == --with-cheese ]] || die + [[ $(use_enable cheese cheese "") == --enable-cheese ]] || die +} +END cd .. cd .. diff --git a/paludis/repositories/e/e_repository_TEST_4.cc b/paludis/repositories/e/e_repository_TEST_4.cc index c1780d7c7..a3ccf6ab2 100644 --- a/paludis/repositories/e/e_repository_TEST_4.cc +++ b/paludis/repositories/e/e_repository_TEST_4.cc @@ -221,6 +221,14 @@ TEST(ERepository, InstallEAPI4) EXPECT_EQ("4", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value()); id->perform_action(action); } + + { + const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches( + PackageDepSpec(parse_user_package_dep_spec("=cat/use-with-enable-empty-third-4", + &env, { })), make_null_shared_ptr(), { }))]->last()); + ASSERT_TRUE(bool(id)); + id->perform_action(action); + } } TEST(ERepository, EAPI4MergeType) diff --git a/paludis/repositories/e/e_repository_TEST_4_setup.sh b/paludis/repositories/e/e_repository_TEST_4_setup.sh index 22653d45c..f20568cff 100755 --- a/paludis/repositories/e/e_repository_TEST_4_setup.sh +++ b/paludis/repositories/e/e_repository_TEST_4_setup.sh @@ -1201,6 +1201,23 @@ src_install() { rm "${D}"/usr/share/man/xx/man7/bar.en_GB.7 || die } END +mkdir -p "cat/use-with-enable-empty-third" +cat <<'END' > cat/use-with-enable-empty-third/use-with-enable-empty-third-4.ebuild || exit 1 +EAPI="${PV}" +DESCRIPTION="The Description" +HOMEPAGE="http://example.com/" +SRC_URI="" +SLOT="0" +IUSE="spork" +LICENSE="GPL-2" +KEYWORDS="test" +S=${WORKDIR} + +src_configure() { + [[ $(use_with cheese cheese "") == --with-cheese= ]] || die + [[ $(use_enable cheese cheese "") == --enable-cheese= ]] || die +} +END cd .. cd .. diff --git a/paludis/repositories/e/eapi.cc b/paludis/repositories/e/eapi.cc index ab4c08d23..8f597684e 100644 --- a/paludis/repositories/e/eapi.cc +++ b/paludis/repositories/e/eapi.cc @@ -246,7 +246,8 @@ namespace n::failure_is_fatal() = destringify_key<bool>(k, "failure_is_fatal"), n::unpack_fix_permissions() = destringify_key<bool>(k, "unpack_fix_permissions"), n::unpack_suffixes() = k.get("unpack_suffixes"), - n::unpack_unrecognised_is_fatal() = destringify_key<bool>(k, "unpack_unrecognised_is_fatal") + n::unpack_unrecognised_is_fatal() = destringify_key<bool>(k, "unpack_unrecognised_is_fatal"), + n::use_with_enable_empty_third_argument() = destringify_key<bool>(k, "use_with_enable_empty_third_argument") )); } diff --git a/paludis/repositories/e/eapi.hh b/paludis/repositories/e/eapi.hh index 50d601abb..e9c8745b0 100644 --- a/paludis/repositories/e/eapi.hh +++ b/paludis/repositories/e/eapi.hh @@ -208,6 +208,7 @@ namespace paludis typedef Name<struct name_use_expand> use_expand; typedef Name<struct name_use_expand_hidden> use_expand_hidden; typedef Name<struct name_use_expand_separator> use_expand_separator; + typedef Name<struct name_use_with_enable_empty_third_argument> use_with_enable_empty_third_argument; typedef Name<struct name_userpriv_cannot_use_root> userpriv_cannot_use_root; typedef Name<struct name_utility_path_suffixes> utility_path_suffixes; typedef Name<struct name_vdb_from_env_unless_empty_variables> vdb_from_env_unless_empty_variables; @@ -467,6 +468,7 @@ namespace paludis NamedValue<n::unpack_fix_permissions, bool> unpack_fix_permissions; NamedValue<n::unpack_suffixes, std::string> unpack_suffixes; NamedValue<n::unpack_unrecognised_is_fatal, bool> unpack_unrecognised_is_fatal; + NamedValue<n::use_with_enable_empty_third_argument, bool> use_with_enable_empty_third_argument; }; struct EAPIPipeCommands diff --git a/paludis/repositories/e/eapis/0.conf b/paludis/repositories/e/eapis/0.conf index 9bf100b6c..0f4616f5e 100644 --- a/paludis/repositories/e/eapis/0.conf +++ b/paludis/repositories/e/eapis/0.conf @@ -281,6 +281,7 @@ doins_symlink = false dosym_mkdir = true failure_is_fatal = false no_s_workdir_fallback = false +use_with_enable_empty_third_argument = false unpack_suffixes = tar tar.gz,tgz,tar.Z tar.bz2,tbz2,tbz zip,ZIP,jar gz,Z,z bz2 rar,RAR lha,LHa,LHA,lzh a,deb tar.lzma lzma 7z,7Z diff --git a/paludis/repositories/e/eapis/4.conf b/paludis/repositories/e/eapis/4.conf index 006a2d9bb..363791f01 100644 --- a/paludis/repositories/e/eapis/4.conf +++ b/paludis/repositories/e/eapis/4.conf @@ -60,6 +60,7 @@ dodoc_r = true doins_symlink = true failure_is_fatal = true no_s_workdir_fallback = true +use_with_enable_empty_third_argument = true rdepend_defaults_to_depend = false diff --git a/paludis/repositories/e/eapis/exheres-0.conf b/paludis/repositories/e/eapis/exheres-0.conf index dda107946..25907fba1 100644 --- a/paludis/repositories/e/eapis/exheres-0.conf +++ b/paludis/repositories/e/eapis/exheres-0.conf @@ -348,6 +348,7 @@ dosym_mkdir = false doins_symlink = true failure_is_fatal = true no_s_workdir_fallback = true +use_with_enable_empty_third_argument = true fix_mtimes = true shell_options = extglob globstar diff --git a/paludis/repositories/e/eapis/paludis-1.conf b/paludis/repositories/e/eapis/paludis-1.conf index bdfcbe756..beec05d42 100644 --- a/paludis/repositories/e/eapis/paludis-1.conf +++ b/paludis/repositories/e/eapis/paludis-1.conf @@ -278,6 +278,7 @@ doman_lang_filenames_overrides = false dodoc_r = false dosym_mkdir = false doins_symlink = false +use_with_enable_empty_third_argument = true failure_is_fatal = false unpack_suffixes = tar tar.gz,tgz,tar.Z tar.bz2,tbz2,tbz zip,ZIP,jar gz,Z,z bz2 rar,RAR lha,LHa,LHA,lzh a,deb tar.lzma lzma 7z,7Z tar.xz xz diff --git a/paludis/repositories/e/ebuild.cc b/paludis/repositories/e/ebuild.cc index 377b6fb49..f2980d166 100644 --- a/paludis/repositories/e/ebuild.cc +++ b/paludis/repositories/e/ebuild.cc @@ -247,6 +247,8 @@ EbuildCommand::operator() () params.package_id()->eapi()->supported()->tools_options()->doman_lang_filenames_overrides() ? "yes" : "") .setenv("PALUDIS_DOSYM_NO_MKDIR", params.package_id()->eapi()->supported()->tools_options()->dosym_mkdir() ? "" : "yes") + .setenv("PALUDIS_USE_WITH_ENABLE_EMPTY_THIRD_ARGUMENT", + params.package_id()->eapi()->supported()->tools_options()->use_with_enable_empty_third_argument() ? "yes" : "") .setenv("PALUDIS_FAILURE_IS_FATAL", params.package_id()->eapi()->supported()->tools_options()->failure_is_fatal() ? "yes" : "") .setenv("PALUDIS_UNPACK_FROM_VAR", diff --git a/paludis/repositories/e/ebuild/0/conditional_functions.bash b/paludis/repositories/e/ebuild/0/conditional_functions.bash index d464317fe..0931b1427 100644 --- a/paludis/repositories/e/ebuild/0/conditional_functions.bash +++ b/paludis/repositories/e/ebuild/0/conditional_functions.bash @@ -2,6 +2,7 @@ # vim: set sw=4 sts=4 et : # Copyright (c) 2006, 2007, 2008 Ciaran McCreesh +# Copyright (c) 2011 David Leverton # # Based in part upon ebuild.sh from Portage, which is Copyright 1995-2005 # Gentoo Foundation and distributed under the terms of the GNU General @@ -23,7 +24,11 @@ use_with() { if useq "${1}" ; then - echo "--with-${2:-${1}}${3+=${3}}" + if [[ -n ${PALUDIS_USE_WITH_ENABLE_EMPTY_THIRD_ARGUMENT} ]]; then + echo "--with-${2:-${1}}${3+=${3}}" + else + echo "--with-${2:-${1}}${3:+=${3}}" + fi else echo "--without-${2:-${1}}" fi @@ -32,7 +37,11 @@ use_with() use_enable() { if useq "${1}" ; then - echo "--enable-${2:-${1}}${3+=${3}}" + if [[ -n ${PALUDIS_USE_WITH_ENABLE_EMPTY_THIRD_ARGUMENT} ]]; then + echo "--enable-${2:-${1}}${3+=${3}}" + else + echo "--enable-${2:-${1}}${3:+=${3}}" + fi else echo "--disable-${2:-${1}}" fi diff --git a/paludis/repositories/e/ebuild/0/conditional_functions_TEST.bash b/paludis/repositories/e/ebuild/0/conditional_functions_TEST.bash index 4e31924b3..86e0788f2 100644 --- a/paludis/repositories/e/ebuild/0/conditional_functions_TEST.bash +++ b/paludis/repositories/e/ebuild/0/conditional_functions_TEST.bash @@ -2,6 +2,7 @@ # vim: set sw=4 sts=4 et : # Copyright (c) 2006 Ciaran McCreesh +# Copyright (c) 2011 David Leverton # # This file is part of the Paludis package manager. Paludis is free software; # you can redistribute it and/or modify it under the terms of the GNU General @@ -27,6 +28,11 @@ use_with_TEST() test_equality "$(use_with foo )" "--without-foo" test_equality "$(use_with foo bar )" "--without-bar" test_equality "$(use_with foo bar baz )" "--without-bar" + + export PALUDIS_USE_WITH_ENABLE_EMPTY_THIRD_ARGUMENT= + test_equality "$(use_with oink zoink "" )" "--with-zoink" + export PALUDIS_USE_WITH_ENABLE_EMPTY_THIRD_ARGUMENT=yes + test_equality "$(use_with oink zoink "" )" "--with-zoink=" } @@ -41,5 +47,10 @@ use_enable_TEST() test_equality "$(use_enable foo )" "--disable-foo" test_equality "$(use_enable foo bar )" "--disable-bar" test_equality "$(use_enable foo bar baz )" "--disable-bar" + + export PALUDIS_USE_WITH_ENABLE_EMPTY_THIRD_ARGUMENT= + test_equality "$(use_enable oink zoink "" )" "--enable-zoink" + export PALUDIS_USE_WITH_ENABLE_EMPTY_THIRD_ARGUMENT=yes + test_equality "$(use_enable oink zoink "" )" "--enable-zoink=" } |