aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Paul Mulders <info@mld.demon.nl> 2010-02-15 12:48:27 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-02-15 14:59:53 +0000
commitb1396996d5d99f5edcd25c644f4c8818afac6f0b (patch)
treefe6d78780e4aeb3a551d7e8fb371feca18dbf3c5
parentea4d3f5df4695119b5be9c1d202abdef40a12fb4 (diff)
downloadpaludis-b1396996d5d99f5edcd25c644f4c8818afac6f0b.tar.gz
paludis-b1396996d5d99f5edcd25c644f4c8818afac6f0b.tar.xz
Implement ever is_scm.
-rw-r--r--paludis/repositories/e/e_repository_TEST_ever.cc1
-rwxr-xr-xpaludis/repositories/e/e_repository_TEST_ever_setup.sh23
-rw-r--r--paludis/repositories/e/ebuild/exheres-0/ever_functions.bash5
-rw-r--r--paludis/repositories/e/pipe_command_handler.cc12
4 files changed, 41 insertions, 0 deletions
diff --git a/paludis/repositories/e/e_repository_TEST_ever.cc b/paludis/repositories/e/e_repository_TEST_ever.cc
index ab01c9a..784157a 100644
--- a/paludis/repositories/e/e_repository_TEST_ever.cc
+++ b/paludis/repositories/e/e_repository_TEST_ever.cc
@@ -173,6 +173,7 @@ namespace test_cases
EverTest test_split("ever-split");
EverTest test_split_all("ever-split-all");
EverTest test_at_least("ever-at-least");
+ EverTest test_is_scm("ever-is_scm");
EverTest test_major("ever-major");
EverTest test_range("ever-range");
EverTest test_remainder("ever-remainder");
diff --git a/paludis/repositories/e/e_repository_TEST_ever_setup.sh b/paludis/repositories/e/e_repository_TEST_ever_setup.sh
index de5b5ff..657909a 100755
--- a/paludis/repositories/e/e_repository_TEST_ever_setup.sh
+++ b/paludis/repositories/e/e_repository_TEST_ever_setup.sh
@@ -59,6 +59,29 @@ pkg_setup() {
ever at_least 1.4 1.2 && die "at_least 1.4 1.2"
}
END
+mkdir -p "packages/cat/ever-is_scm"
+cat <<'END' > packages/cat/ever-is_scm/ever-is_scm-1.ebuild || exit 1
+if ever is_scm ; then
+ DESCRIPTION="Not The Long Description"
+ SUMMARY="Not The Short Description"
+else
+ DESCRIPTION="The Long Description"
+ SUMMARY="The Short Description"
+fi
+HOMEPAGE="http://example.com/"
+DOWNLOADS=""
+SLOT="0"
+MYOPTIONS="spork"
+LICENCES="GPL-2"
+PLATFORMS="test"
+
+pkg_setup() {
+ ever is_scm scm || die "is_scm scm"
+ ever is_scm 1.0-scm || die "is_scm 1.0-scm"
+ ever is_scm 1 && die "is_scm 1"
+ ever is_scm && die "is_scm"
+}
+END
mkdir -p "packages/cat/ever-split"
cat <<'END' > packages/cat/ever-split/ever-split-1.ebuild || exit 1
HOMEPAGE="http://example.com/"
diff --git a/paludis/repositories/e/ebuild/exheres-0/ever_functions.bash b/paludis/repositories/e/ebuild/exheres-0/ever_functions.bash
index 89b8d71..aff6905 100644
--- a/paludis/repositories/e/ebuild/exheres-0/ever_functions.bash
+++ b/paludis/repositories/e/ebuild/exheres-0/ever_functions.bash
@@ -76,6 +76,11 @@ ever()
r=$(paludis_pipe_command EVER "$EAPI" AT_LEAST "${2}" "${3:-${PVR}}" )
;;
+ is_scm)
+ [[ "${#@}" != 1 ]] && [[ "${#@}" != 2 ]] && die "$FUNCNAME $1 takes zero or one extra arguments"
+ r=$(paludis_pipe_command EVER "$EAPI" IS_SCM "${2:-${PV}}" )
+ ;;
+
*)
die "ever subcommand ${1} unrecognised"
;;
diff --git a/paludis/repositories/e/pipe_command_handler.cc b/paludis/repositories/e/pipe_command_handler.cc
index 93e4a96..bf07d51 100644
--- a/paludis/repositories/e/pipe_command_handler.cc
+++ b/paludis/repositories/e/pipe_command_handler.cc
@@ -449,6 +449,18 @@ paludis::erepository::pipe_command_handler(const Environment * const environment
v2(tokens[4], eapi->supported()->version_spec_options());
return v2 >= v1 ? "O0;" : "O1;";
}
+ else if (tokens[2] == "IS_SCM")
+ {
+ if (tokens.size() != 4)
+ {
+ Log::get_instance()->message("e.pipe_commands.ever.is_scm.bad", ll_warning, lc_context) << "Got bad EVER IS_SCM pipe command";
+ return "Ebad EVER " + tokens[2] + " command {'" + join(tokens.begin(), tokens.end(), "', '") + "'}";
+ }
+
+ VersionSpec v(tokens[3], eapi->supported()->version_spec_options());
+
+ return v.is_scm() ? "O0;" : "O1;";
+ }
else if (tokens[2] == "SPLIT" || tokens[2] == "SPLIT_ALL")
{
bool all(tokens[2] == "SPLIT_ALL");