aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar David Leverton <levertond@googlemail.com> 2011-04-01 22:09:46 +0100
committerAvatar David Leverton <levertond@googlemail.com> 2011-04-02 01:02:05 +0100
commit568b21f7bec6a17356bedfbc95a6adf505d74d59 (patch)
treeca155acb9e7a69c1019d2f977a8d098fc445eba9
parentea370e26e5bd368512c7e54f11f5179ac4fe1610 (diff)
downloadpaludis-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.cc8
-rwxr-xr-xpaludis/repositories/e/e_repository_TEST_0_setup.sh16
-rw-r--r--paludis/repositories/e/e_repository_TEST_4.cc8
-rwxr-xr-xpaludis/repositories/e/e_repository_TEST_4_setup.sh17
-rw-r--r--paludis/repositories/e/eapi.cc3
-rw-r--r--paludis/repositories/e/eapi.hh2
-rw-r--r--paludis/repositories/e/eapis/0.conf1
-rw-r--r--paludis/repositories/e/eapis/4.conf1
-rw-r--r--paludis/repositories/e/eapis/exheres-0.conf1
-rw-r--r--paludis/repositories/e/eapis/paludis-1.conf1
-rw-r--r--paludis/repositories/e/ebuild.cc2
-rw-r--r--paludis/repositories/e/ebuild/0/conditional_functions.bash13
-rw-r--r--paludis/repositories/e/ebuild/0/conditional_functions_TEST.bash11
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 8967ab0..b988786 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 df0383e..ca1ff7a 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 c1780d7..a3ccf6a 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 22653d4..f20568c 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 ab4c08d..8f59768 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 50d601a..e9c8745 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 9bf100b..0f4616f 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 006a2d9..363791f 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 dda1079..25907fb 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 bdfcbe7..beec05d 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 377b6fb..f2980d1 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 d464317..0931b14 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 4e31924..86e0788 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="
}