aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-01-26 23:37:32 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-01-26 23:37:32 +0000
commitc2513f966b4d92347f1047dadefaf13497a3e866 (patch)
tree39a6ee7f40196a517a206f9fc0195f38d9e0c847
parent8bd9839a8c5cca312c61147bec0d2cf05f824dfc (diff)
downloadpaludis-c2513f966b4d92347f1047dadefaf13497a3e866.tar.gz
paludis-c2513f966b4d92347f1047dadefaf13497a3e866.tar.xz
More ever commands
-rw-r--r--.gitignore1
-rw-r--r--paludis/repositories/e/Makefile.am33
-rw-r--r--paludis/repositories/e/e_repository_TEST.cc11
-rw-r--r--paludis/repositories/e/e_repository_TEST_ever.cc163
-rwxr-xr-xpaludis/repositories/e/e_repository_TEST_ever_cleanup.sh9
-rwxr-xr-xpaludis/repositories/e/e_repository_TEST_ever_setup.sh155
-rwxr-xr-xpaludis/repositories/e/e_repository_TEST_setup.sh30
-rw-r--r--paludis/repositories/e/ebuild/exheres-0/ever_functions.bash11
-rw-r--r--paludis/repositories/e/pipe_command_handler.cc116
9 files changed, 480 insertions, 49 deletions
diff --git a/.gitignore b/.gitignore
index ee2c266..7fea0a1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -208,6 +208,7 @@ paludis-*.*.*.tar.bz2
/paludis/repositories/e/dep_parser_TEST
/paludis/repositories/e/dep_spec_pretty_printer_TEST
/paludis/repositories/e/e_repository_TEST
+/paludis/repositories/e/e_repository_TEST_ever
/paludis/repositories/e/e_repository_sets_TEST
/paludis/repositories/e/ebuild_flat_metadata_cache_TEST
/paludis/repositories/e/ebuild/utils/exheres-0/dohard
diff --git a/paludis/repositories/e/Makefile.am b/paludis/repositories/e/Makefile.am
index f94aa54..402a30e 100644
--- a/paludis/repositories/e/Makefile.am
+++ b/paludis/repositories/e/Makefile.am
@@ -163,6 +163,20 @@ e_repository_TEST_LDADD = \
e_repository_TEST_CXXFLAGS = $(AM_CXXFLAGS) -I$(top_srcdir) @PALUDIS_CXXFLAGS_NO_DEBUGGING@
+e_repository_TEST_ever_SOURCES = e_repository_TEST_ever.cc
+
+e_repository_TEST_ever_LDADD = \
+ libpaludiserepository_@PALUDIS_PC_SLOT@.la \
+ $(top_builddir)/paludis/repositories/fake/libpaludisfakerepository_@PALUDIS_PC_SLOT@.la \
+ $(top_builddir)/paludis/util/libpaludisutil_@PALUDIS_PC_SLOT@.la \
+ $(top_builddir)/paludis/util/test_extras.o \
+ $(top_builddir)/paludis/libpaludis_@PALUDIS_PC_SLOT@.la \
+ $(top_builddir)/paludis/environments/test/libpaludistestenvironment_@PALUDIS_PC_SLOT@.la \
+ $(top_builddir)/test/libtest.a \
+ $(DYNAMIC_LD_LIBS)
+
+e_repository_TEST_ever_CXXFLAGS = $(AM_CXXFLAGS) -I$(top_srcdir) @PALUDIS_CXXFLAGS_NO_DEBUGGING@
+
vdb_repository_TEST_SOURCES = vdb_repository_TEST.cc
vdb_repository_TEST_LDADD = \
@@ -340,6 +354,9 @@ EXTRA_DIST = \
e_repository_TEST.cc \
e_repository_TEST_setup.sh \
e_repository_TEST_cleanup.sh \
+ e_repository_TEST_ever.cc \
+ e_repository_TEST_ever_setup.sh \
+ e_repository_TEST_ever_cleanup.sh \
e_repository_params-se.hh \
e_repository_params-se.cc \
e_repository_params.se \
@@ -383,6 +400,7 @@ BUILT_SOURCES = \
check_SCRIPTS = \
e_repository_TEST_setup.sh e_repository_TEST_cleanup.sh \
+ e_repository_TEST_ever_setup.sh e_repository_TEST_ever_cleanup.sh \
xml_things_TEST_setup.sh xml_things_TEST_cleanup.sh \
vdb_repository_TEST_setup.sh vdb_repository_TEST_cleanup.sh \
exndbam_repository_TEST_setup.sh exndbam_repository_TEST_cleanup.sh \
@@ -465,20 +483,21 @@ paludis_datadir = $(datadir)/paludis
dist_paludis_data_DATA = traditional.exclude ebuild_entries_suffixes.conf
TESTS = \
+ aa_visitor_TEST \
dep_parser_TEST \
dep_spec_pretty_printer_TEST \
e_repository_TEST \
- vdb_merger_TEST \
- vdb_unmerger_TEST \
- $(GLSA_TESTS) \
+ e_repository_TEST_ever \
e_repository_sets_TEST \
- aa_visitor_TEST \
+ ebuild_flat_metadata_cache_TEST \
+ exndbam_repository_TEST \
fetch_visitor_TEST \
+ fix_locked_dependencies_TEST \
source_uri_finder_TEST \
- exndbam_repository_TEST \
+ vdb_merger_TEST \
vdb_repository_TEST \
- fix_locked_dependencies_TEST \
- ebuild_flat_metadata_cache_TEST
+ vdb_unmerger_TEST \
+ $(GLSA_TESTS)
check_PROGRAMS = $(TESTS)
diff --git a/paludis/repositories/e/e_repository_TEST.cc b/paludis/repositories/e/e_repository_TEST.cc
index a9f7ab4..72cae77 100644
--- a/paludis/repositories/e/e_repository_TEST.cc
+++ b/paludis/repositories/e/e_repository_TEST.cc
@@ -2211,17 +2211,6 @@ namespace test_cases
}
{
- TestMessageSuffix suffix("ever", true);
- const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
- PackageDepSpec(parse_user_package_dep_spec("=cat/ever-1.3",
- &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
- TEST_CHECK(id);
- TEST_CHECK(id->short_description_key());
- TEST_CHECK_EQUAL(id->short_description_key()->value(), "The Short Description");
- id->perform_action(action);
- }
-
- {
TestMessageSuffix suffix("econf phase", true);
const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
PackageDepSpec(parse_user_package_dep_spec("=cat/econf-phase-0",
diff --git a/paludis/repositories/e/e_repository_TEST_ever.cc b/paludis/repositories/e/e_repository_TEST_ever.cc
new file mode 100644
index 0000000..bf51591
--- /dev/null
+++ b/paludis/repositories/e/e_repository_TEST_ever.cc
@@ -0,0 +1,163 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2008, 2009 Ciaran McCreesh
+ *
+ * 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
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <paludis/repositories/e/e_repository.hh>
+#include <paludis/repositories/e/e_repository_exceptions.hh>
+#include <paludis/repositories/e/e_repository_id.hh>
+#include <paludis/repositories/e/vdb_repository.hh>
+#include <paludis/repositories/e/eapi.hh>
+#include <paludis/repositories/e/dep_spec_pretty_printer.hh>
+#include <paludis/repositories/fake/fake_installed_repository.hh>
+#include <paludis/repositories/fake/fake_package_id.hh>
+#include <paludis/environments/test/test_environment.hh>
+#include <paludis/util/system.hh>
+#include <paludis/util/simple_visitor_cast.hh>
+#include <paludis/util/map.hh>
+#include <paludis/util/make_shared_ptr.hh>
+#include <paludis/util/make_named_values.hh>
+#include <paludis/util/set.hh>
+#include <paludis/package_id.hh>
+#include <paludis/metadata_key.hh>
+#include <paludis/action.hh>
+#include <paludis/stringify_formatter.hh>
+#include <paludis/user_dep_spec.hh>
+#include <paludis/generator.hh>
+#include <paludis/filter.hh>
+#include <paludis/filtered_generator.hh>
+#include <paludis/selection.hh>
+#include <paludis/repository_factory.hh>
+#include <paludis/choice.hh>
+#include <test/test_framework.hh>
+#include <test/test_runner.hh>
+#include <tr1/functional>
+#include <set>
+#include <fstream>
+#include <string>
+
+#include "config.h"
+
+using namespace test;
+using namespace paludis;
+
+namespace
+{
+ std::string from_keys(const std::tr1::shared_ptr<const Map<std::string, std::string> > & m,
+ const std::string & k)
+ {
+ Map<std::string, std::string>::ConstIterator mm(m->find(k));
+ if (m->end() == mm)
+ return "";
+ else
+ return mm->second;
+ }
+
+ void dummy_used_this_for_config_protect(const std::string &)
+ {
+ }
+
+ WantPhase want_all_phases(const std::string &)
+ {
+ return wp_yes;
+ }
+
+ struct EverTest : TestCase
+ {
+ const std::string test;
+
+ EverTest(const std::string & s) :
+ TestCase("ever " + s),
+ test(s)
+ {
+ }
+
+ unsigned max_run_time() const
+ {
+ return 3000;
+ }
+
+ bool repeatable() const
+ {
+ return false;
+ }
+
+ void run()
+ {
+#ifdef ENABLE_VIRTUALS_REPOSITORY
+ ::setenv("PALUDIS_ENABLE_VIRTUALS_REPOSITORY", "yes", 1);
+#else
+ ::setenv("PALUDIS_ENABLE_VIRTUALS_REPOSITORY", "", 1);
+#endif
+ TestEnvironment env;
+ env.set_paludis_command("/bin/false");
+ std::tr1::shared_ptr<Map<std::string, std::string> > keys(new Map<std::string, std::string>);
+ keys->insert("format", "ebuild");
+ keys->insert("names_cache", "/var/empty");
+ keys->insert("location", stringify(FSEntry::cwd() / "e_repository_TEST_ever_dir" / "repo1"));
+ keys->insert("profiles", stringify(FSEntry::cwd() / "e_repository_TEST_ever_dir" / "repo1/profiles/profile"));
+ keys->insert("layout", "exheres");
+ keys->insert("eapi_when_unknown", "exheres-0");
+ keys->insert("eapi_when_unspecified", "exheres-0");
+ keys->insert("profile_eapi", "exheres-0");
+ keys->insert("distdir", stringify(FSEntry::cwd() / "e_repository_TEST_ever_dir" / "distdir"));
+ keys->insert("builddir", stringify(FSEntry::cwd() / "e_repository_TEST_ever_dir" / "build"));
+ std::tr1::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
+ std::tr1::bind(from_keys, keys, std::tr1::placeholders::_1)));
+ env.package_database()->add_repository(1, repo);
+
+ std::tr1::shared_ptr<FakeInstalledRepository> installed_repo(new FakeInstalledRepository(&env, RepositoryName("installed")));
+ installed_repo->add_version("cat", "pretend-installed", "0")->provide_key()->set_from_string("virtual/virtual-pretend-installed");
+ installed_repo->add_version("cat", "pretend-installed", "1")->provide_key()->set_from_string("virtual/virtual-pretend-installed");
+ env.package_database()->add_repository(2, installed_repo);
+
+#ifdef ENABLE_VIRTUALS_REPOSITORY
+ std::tr1::shared_ptr<Map<std::string, std::string> > iv_keys(new Map<std::string, std::string>);
+ iv_keys->insert("root", "/");
+ iv_keys->insert("format", "installed_virtuals");
+ env.package_database()->add_repository(-2, RepositoryFactory::get_instance()->create(&env,
+ std::tr1::bind(from_keys, iv_keys, std::tr1::placeholders::_1)));
+ std::tr1::shared_ptr<Map<std::string, std::string> > v_keys(new Map<std::string, std::string>);
+ v_keys->insert("format", "virtuals");
+ env.package_database()->add_repository(-2, RepositoryFactory::get_instance()->create(&env,
+ std::tr1::bind(from_keys, v_keys, std::tr1::placeholders::_1)));
+#endif
+
+ InstallAction action(make_named_values<InstallActionOptions>(
+ value_for<n::destination>(installed_repo),
+ value_for<n::used_this_for_config_protect>(&dummy_used_this_for_config_protect),
+ value_for<n::want_phase>(&want_all_phases)
+ ));
+
+ const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
+ PackageDepSpec(parse_user_package_dep_spec("cat/" + test,
+ &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
+ TEST_CHECK(id);
+ id->perform_action(action);
+ }
+ };
+}
+
+namespace test_cases
+{
+ EverTest test_split("ever-split");
+ EverTest test_split_all("ever-split-all");
+ EverTest test_at_least("ever-at-least");
+ EverTest test_major("ever-major");
+ EverTest test_range("ever-range");
+}
+
diff --git a/paludis/repositories/e/e_repository_TEST_ever_cleanup.sh b/paludis/repositories/e/e_repository_TEST_ever_cleanup.sh
new file mode 100755
index 0000000..6af9f95
--- /dev/null
+++ b/paludis/repositories/e/e_repository_TEST_ever_cleanup.sh
@@ -0,0 +1,9 @@
+#!/usr/bin/env bash
+# vim: set ft=sh sw=4 sts=4 et :
+
+if [ -d e_repository_TEST_ever_dir ] ; then
+ rm -fr e_repository_TEST_ever_dir
+else
+ true
+fi
+
diff --git a/paludis/repositories/e/e_repository_TEST_ever_setup.sh b/paludis/repositories/e/e_repository_TEST_ever_setup.sh
new file mode 100755
index 0000000..d5ffdb8
--- /dev/null
+++ b/paludis/repositories/e/e_repository_TEST_ever_setup.sh
@@ -0,0 +1,155 @@
+#!/usr/bin/env bash
+# vim: set ft=sh sw=4 sts=4 et :
+
+mkdir e_repository_TEST_ever_dir || exit 1
+cd e_repository_TEST_ever_dir || exit 1
+
+mkdir -p root/etc
+
+mkdir -p vdb
+touch vdb/THISISTHEVDB
+
+mkdir -p build
+ln -s build symlinked_build
+
+mkdir -p distdir
+
+mkdir -p repo1/{profiles/profile,metadata,eclass} || exit 1
+cd repo1 || exit 1
+echo "test-repo-1" >> profiles/repo_name || exit 1
+cat <<END > profiles/profile/virtuals
+virtual/virtual-pretend-installed cat/pretend-installed
+virtual/virtual-doesnotexist cat/doesnotexist
+END
+echo "cat" >> metadata/categories.conf || exit 1
+cat <<END > profiles/profile/make.defaults
+CHOST="i286-badger-linux-gnu"
+SUBOPTIONS="LINGUAS"
+LINGUAS="en en_GB en_GB@UTF-8"
+USERLAND="GNU"
+OPTIONS="weasel spinach"
+END
+mkdir -p "packages/cat/ever-at-least"
+cat <<'END' > packages/cat/ever-at-least/ever-at-least-1.3.ebuild || exit 1
+if ever at_least 2 ; then
+ DESCRIPTION="Really Not The Long Description"
+ SUMMARY="Really Not The Short Description"
+elif ever at_least 1.2.3 ; then
+ DESCRIPTION="The Long Description"
+ SUMMARY="The Short Description"
+else
+ DESCRIPTION="Not The Long Description"
+ SUMMARY="Not The Short Description"
+fi
+
+HOMEPAGE="http://example.com/"
+DOWNLOADS=""
+SLOT="0"
+MYOPTIONS="spork"
+LICENCES="GPL-2"
+PLATFORMS="test"
+
+pkg_setup() {
+ ever at_least 1.2 || die "at_least 1.2"
+ ever at_least 1.3 || die "at_least 1.3"
+ ever at_least 1.4 && die "at_least 1.4"
+
+ ever at_least 1.2 1.2 || die "at_least 1.2 1.2"
+ ever at_least 1.3 1.2 && die "at_least 1.3 1.2"
+ ever at_least 1.4 1.2 && die "at_least 1.4 1.2"
+}
+END
+mkdir -p "packages/cat/ever-split"
+cat <<'END' > packages/cat/ever-split/ever-split-1.ebuild || exit 1
+HOMEPAGE="http://example.com/"
+DOWNLOADS=""
+SLOT="0"
+MYOPTIONS="spork"
+LICENCES="GPL-2"
+PLATFORMS="test"
+
+check() {
+ a=$(ever split $1 )
+ [[ "${a}" == "${2}" ]] || die "got $a wanted $2"
+}
+
+pkg_setup() {
+ check 0.8.3 "0 8 3"
+ check 7c "7 c"
+ check 3.0_p2 "3 0 p2"
+ check 20040905 "20040905"
+ check 3.0c-r1 "3 0 c r1"
+}
+END
+mkdir -p "packages/cat/ever-split-all"
+cat <<'END' > packages/cat/ever-split-all/ever-split-all-1.ebuild || exit 1
+HOMEPAGE="http://example.com/"
+DOWNLOADS=""
+SLOT="0"
+MYOPTIONS="spork"
+LICENCES="GPL-2"
+PLATFORMS="test"
+
+check() {
+ a=$(ever split_all $1 )
+ [[ "${a}" == "${2}" ]] || die "got $a wanted $2"
+}
+
+pkg_setup() {
+ check 0.8.3 "0 . 8 . 3"
+ check 7c "7 c"
+ check 3.0_p2 "3 . 0 _ p2"
+ check 20040905 "20040905"
+ check 3.0c-r1 "3 . 0 c - r1"
+}
+END
+mkdir -p "packages/cat/ever-major"
+cat <<'END' > packages/cat/ever-major/ever-major-1.ebuild || exit 1
+HOMEPAGE="http://example.com/"
+DOWNLOADS=""
+SLOT="0"
+MYOPTIONS="spork"
+LICENCES="GPL-2"
+PLATFORMS="test"
+
+check() {
+ a=$(ever major $1 )
+ [[ "${a}" == "${2}" ]] || die "got $a wanted $2"
+}
+
+pkg_setup() {
+ check 0.8.3 "0"
+ check 7c "7"
+ check 3.0_p2 "3"
+ check 20040905 "20040905"
+ check 3.0c-r1 "3"
+ check scm "scm"
+ check "" "1"
+}
+END
+mkdir -p "packages/cat/ever-range"
+cat <<'END' > packages/cat/ever-range/ever-range-1.ebuild || exit 1
+HOMEPAGE="http://example.com/"
+DOWNLOADS=""
+SLOT="0"
+MYOPTIONS="spork"
+LICENCES="GPL-2"
+PLATFORMS="test"
+
+check() {
+ a=$(ever range $1 $2 )
+ [[ "${a}" == "${3}" ]] || die "got $a wanted $3"
+}
+
+pkg_setup() {
+ check "1" "1.2.3" "1"
+ check "1-2" "1.2.3" "1.2"
+ check "2-" "1.2.3" "2.3"
+ check "-2" "1.2.3" "1.2"
+ check "1" "" "1"
+}
+END
+cd ..
+
+cd ..
+
diff --git a/paludis/repositories/e/e_repository_TEST_setup.sh b/paludis/repositories/e/e_repository_TEST_setup.sh
index 941b21e..93a4d62 100755
--- a/paludis/repositories/e/e_repository_TEST_setup.sh
+++ b/paludis/repositories/e/e_repository_TEST_setup.sh
@@ -2019,36 +2019,6 @@ pkg_setup() {
done
}
END
-mkdir -p "packages/cat/ever"
-cat <<'END' > packages/cat/ever/ever-1.3.ebuild || exit 1
-if ever at_least 2 ; then
- DESCRIPTION="Really Not The Long Description"
- SUMMARY="Really Not The Short Description"
-elif ever at_least 1.2.3 ; then
- DESCRIPTION="The Long Description"
- SUMMARY="The Short Description"
-else
- DESCRIPTION="Not The Long Description"
- SUMMARY="Not The Short Description"
-fi
-
-HOMEPAGE="http://example.com/"
-DOWNLOADS=""
-SLOT="0"
-MYOPTIONS="spork"
-LICENCES="GPL-2"
-PLATFORMS="test"
-
-pkg_setup() {
- ever at_least 1.2 || die "at_least 1.2"
- ever at_least 1.3 || die "at_least 1.3"
- ever at_least 1.4 && die "at_least 1.4"
-
- ever at_least 1.2 1.2 || die "at_least 1.2 1.2"
- ever at_least 1.3 1.2 && die "at_least 1.3 1.2"
- ever at_least 1.4 1.2 && die "at_least 1.4 1.2"
-}
-END
mkdir -p "packages/cat/econf-phase"
cat <<'END' > packages/cat/econf-phase/econf-phase-0.ebuild || exit 1
DESCRIPTION="The Long Description"
diff --git a/paludis/repositories/e/ebuild/exheres-0/ever_functions.bash b/paludis/repositories/e/ebuild/exheres-0/ever_functions.bash
index af4bbdb..376042a 100644
--- a/paludis/repositories/e/ebuild/exheres-0/ever_functions.bash
+++ b/paludis/repositories/e/ebuild/exheres-0/ever_functions.bash
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
# vim: set sw=4 sts=4 et :
-# Copyright (c) 2008 Ciaran McCreesh
+# Copyright (c) 2008, 2009 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
@@ -25,15 +25,23 @@ ever()
local r="1;"
case "${1}" in
split)
+ [[ "${#@}" != 2 ]] && die "$0 $1 takes one extra argument"
+ r=$(paludis_pipe_command EVER "$EAPI" SPLIT "${2}" )
;;
split_all)
+ [[ "${#@}" != 2 ]] && die "$0 $1 takes one extra argument"
+ r=$(paludis_pipe_command EVER "$EAPI" SPLIT_ALL "${2}" )
;;
major)
+ [[ "${#@}" != 1 ]] && [[ "${#@}" != 2 ]] && die "$0 $1 takes zero or one extra arguments"
+ r=$(paludis_pipe_command EVER "$EAPI" RANGE 1 "${2:-${PVR}}" )
;;
range)
+ [[ "${#@}" != 2 ]] && [[ "${#@}" != 3 ]] && die "$0 $1 takes one or two extra arguments"
+ r=$(paludis_pipe_command EVER "$EAPI" RANGE ${2} "${3:-${PVR}}" )
;;
remainder)
@@ -64,3 +72,4 @@ ever()
[[ -z "${r#*;}" ]] || echo "${r#*;}"
return ${r%%;*}
}
+
diff --git a/paludis/repositories/e/pipe_command_handler.cc b/paludis/repositories/e/pipe_command_handler.cc
index 783d7ea..6bd0b5c 100644
--- a/paludis/repositories/e/pipe_command_handler.cc
+++ b/paludis/repositories/e/pipe_command_handler.cc
@@ -44,6 +44,7 @@
#include <paludis/filtered_generator.hh>
#include <paludis/choice.hh>
#include <vector>
+#include <limits>
using namespace paludis;
@@ -305,6 +306,121 @@ paludis::erepository::pipe_command_handler(const Environment * const environment
VersionSpec v1(tokens[3]), v2(tokens[4]);
return v2 >= v1 ? "O0;" : "O1;";
}
+ else if (tokens[2] == "SPLIT" || tokens[2] == "SPLIT_ALL")
+ {
+ bool all(tokens[2] == "SPLIT_ALL");
+
+ if (tokens.size() != 4)
+ {
+ Log::get_instance()->message("e.pipe_commands.ever.split.bad", ll_warning, lc_context) << "Got bad EVER " + tokens[2] + " pipe command";
+ return "Ebad EVER " + tokens[2] + " command {'" + join(tokens.begin(), tokens.end(), "', '") + "'}";
+ }
+
+ VersionSpec v(tokens[3]);
+ std::string result;
+ for (VersionSpec::ConstIterator c(v.begin()), c_end(v.end()) ;
+ c != c_end ; ++c)
+ {
+ if (c->text().empty())
+ continue;
+
+ if (! result.empty())
+ result.append(" ");
+
+ switch (c->text().at(0))
+ {
+ case '.':
+ case '-':
+ case '_':
+ {
+ if (all)
+ result.append(c->text().substr(0, 1));
+ if (c->text().length() > 1)
+ {
+ if (all)
+ result.append(" ");
+ result.append(c->text().substr(1));
+ }
+
+ }
+ break;
+
+ default:
+ result.append(c->text());
+ break;
+ }
+ }
+ return "O0;" + result;
+ }
+ else if (tokens[2] == "RANGE")
+ {
+ if (tokens.size() != 5)
+ {
+ Log::get_instance()->message("e.pipe_commands.ever.major.bad", ll_warning, lc_context) << "Got bad EVER " + tokens[2] + " pipe command";
+ return "Ebad EVER " + tokens[2] + " command {'" + join(tokens.begin(), tokens.end(), "', '") + "'}";
+ }
+
+ std::string range_s(tokens[3]);
+ std::string::size_type hyphen_pos(range_s.find('-'));
+ int range_start, range_end;
+
+ if (std::string::npos == hyphen_pos)
+ range_start = range_end = destringify<int>(range_s);
+ else
+ {
+ std::string range_start_s(range_s.substr(0, hyphen_pos));
+ std::string range_end_s(range_s.substr(hyphen_pos + 1));
+
+ if (range_start_s.empty())
+ range_start = 0;
+ else
+ range_start = destringify<int>(range_start_s);
+
+ if (range_end_s.empty())
+ range_end = std::numeric_limits<int>::max();
+ else
+ range_end = destringify<int>(range_end_s);
+
+ }
+
+ VersionSpec v(tokens[4]);
+
+ int current_pos(0);
+ std::string result;
+ for (VersionSpec::ConstIterator c(v.begin()), c_end(v.end()) ;
+ c != c_end ; ++c)
+ {
+ ++current_pos;
+ if (current_pos > range_end)
+ break;
+ if (current_pos < range_start)
+ continue;
+
+ if (c->text().empty())
+ continue;
+
+ switch (c->text().at(0))
+ {
+ case '.':
+ case '-':
+ case '_':
+ {
+ if (! result.empty())
+ result.append(c->text().substr(0, 1));
+ if (c->text().length() > 1)
+ result.append(c->text().substr(1));
+
+ }
+ break;
+
+ default:
+ result.append(c->text());
+ break;
+ }
+ }
+
+ return "O0;" + result;
+ }
else
{
Log::get_instance()->message("e.pipe_commands.ever.unknown", ll_warning, lc_context) << "Got unknown EVER pipe subcommand";