aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-05-22 14:35:57 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-05-22 14:35:57 +0000
commitf1d2eebbc18965e0ddf048dca276a6b06878e4eb (patch)
tree19570402277e9a1ceb7d1c9746d21078415f6d15
parentd6205575ba1d134541d8b9d48e6912c69ef65b2a (diff)
downloadpaludis-f1d2eebbc18965e0ddf048dca276a6b06878e4eb.tar.gz
paludis-f1d2eebbc18965e0ddf048dca276a6b06878e4eb.tar.xz
Killg ems for now until upstream fixes their yaml.
-rw-r--r--configure.ac25
-rw-r--r--paludis/repositories/gems/Makefile.am150
-rw-r--r--paludis/repositories/gems/cache.cc339
-rw-r--r--paludis/repositories/gems/cache.hh52
-rw-r--r--paludis/repositories/gems/cache.sr18
-rw-r--r--paludis/repositories/gems/cache_TEST.cc93
-rwxr-xr-xpaludis/repositories/gems/cache_TEST_cleanup.sh9
-rwxr-xr-xpaludis/repositories/gems/cache_TEST_setup.sh33
-rw-r--r--paludis/repositories/gems/gems_repository.cc284
-rw-r--r--paludis/repositories/gems/gems_repository.hh63
-rw-r--r--paludis/repositories/gems/gems_repository.sr23
-rw-r--r--paludis/repositories/gems/gems_repository_TEST.cc51
-rwxr-xr-xpaludis/repositories/gems/gems_repository_TEST_cleanup.sh9
-rwxr-xr-xpaludis/repositories/gems/gems_repository_TEST_setup.sh5
-rw-r--r--paludis/repositories/gems/gems_repository_exceptions.cc35
-rw-r--r--paludis/repositories/gems/gems_repository_exceptions.hh46
-rw-r--r--paludis/repositories/gems/gems_version_metadata.cc49
-rw-r--r--paludis/repositories/gems/gems_version_metadata.hh50
-rw-r--r--paludis/repositories/gems/make_gems_repository.cc59
-rw-r--r--paludis/repositories/gems/make_gems_repository.hh32
-rw-r--r--paludis/repositories/gems/registration.cc40
-rw-r--r--paludis/repositories/gems/yaml.cc368
-rw-r--r--paludis/repositories/gems/yaml.hh130
-rw-r--r--paludis/repositories/gems/yaml_TEST.cc146
24 files changed, 1 insertions, 2108 deletions
diff --git a/configure.ac b/configure.ac
index 71601ce..4b015b1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -842,7 +842,7 @@ AC_SUBST([VIM_INSTALL_DIR])
dnl }}}
dnl {{{ repositories
-ALL_REPOSITORIES="cran fake gentoo gems virtuals"
+ALL_REPOSITORIES="cran fake gentoo virtuals"
DEFAULT_REPOSITORIES="fake gentoo virtuals"
AC_MSG_CHECKING([which repositories to build...])
AC_ARG_WITH([repositories],
@@ -852,7 +852,6 @@ AC_ARG_WITH([repositories],
cran The Comprehensive R Archive Network
fake A fake repository for test cases and adjutrix
- gems Ruby Gems (requires libyaml) (UNUSABLE)
gentoo Gentoo packages (ebuilds, vdb)
virtuals Old style Gentoo virtuals],
[repositories="`echo $with_repositories | tr ',' ' '`"],
@@ -864,27 +863,6 @@ AC_SUBST([ALL_REPOSITORIES])
AC_SUBST([BUILD_REPOSITORIES])
dnl }}}
-dnl {{{ gems
-AC_MSG_CHECKING([whether we're building the gems repository])
-if echo $repositories | tr ' ' '\n' | sort | uniq | grep '^gems$' >/dev/null ; then
- AC_MSG_RESULT([yes])
- AC_MSG_CHECKING([for libyaml])
- AC_COMPILE_IFELSE([
-#include <yaml.h>
-int main(int, char **)
-{
- yaml_get_version_string();
- return 0;
-}
-],
- [AC_MSG_RESULT([yes])],
- [AC_MSG_RESULT([no])
- AC_MSG_ERROR([libyaml (http://pyyaml.org/wiki/LibYAML) is required for gems support])])
-else
- AC_MSG_RESULT([no])
-fi
-dnl }}}
-
dnl {{{ environments
ALL_ENVIRONMENTS="adapted no_config paludis portage test"
DEFAULT_ENVIRONMENTS="adapted no_config paludis test"
@@ -1101,7 +1079,6 @@ AC_OUTPUT(
paludis/repositories/cran/Makefile
paludis/repositories/cran/cran/Makefile
paludis/repositories/fake/Makefile
- paludis/repositories/gems/Makefile
paludis/repositories/gentoo/Makefile
paludis/repositories/gentoo/ebuild/Makefile
paludis/repositories/gentoo/ebuild/digests/Makefile
diff --git a/paludis/repositories/gems/Makefile.am b/paludis/repositories/gems/Makefile.am
deleted file mode 100644
index bee9bc1..0000000
--- a/paludis/repositories/gems/Makefile.am
+++ /dev/null
@@ -1,150 +0,0 @@
-CLEANFILES = *~ gmon.out *.gcov *.gcno *.gcda
-
-DISTCLEANFILES = \
- gems_repository-sr.hh gems_repository-sr.cc \
- cache-sr.hh cache-sr.cc
-
-MAINTAINERCLEANFILES = Makefile.in
-
-AM_CXXFLAGS = -I$(top_srcdir) @PALUDIS_CXXFLAGS@ @PALUDIS_CXXFLAGS_VISIBILITY@
-DEFS= \
- -DSYSCONFDIR=\"$(sysconfdir)\" \
- -DLIBEXECDIR=\"$(libexecdir)\" \
- -DDATADIR=\"$(datadir)\" \
- -DLIBDIR=\"$(libdir)\"
-
-paludis_repositories_libdir = $(libdir)/paludis/repositories
-
-if MONOLITHIC
-
-noinst_LTLIBRARIES = libpaludisgemsrepository.la
-
-else
-
-paludis_repositories_lib_LTLIBRARIES = libpaludisgemsrepository.la
-
-endif
-
-paludis_repositories_gems_includedir = $(includedir)/paludis/repositories/gems/
-libpaludisgemsrepository_la_LDFLAGS = -version-info @VERSION_LIB_CURRENT@:@VERSION_LIB_REVISION@:0
-
-paludis_repositories_gems_include_HEADERS = \
- gems_repository.hh \
- gems_repository-sr.hh \
- gems_repository_exceptions.hh \
- cache.hh \
- cache-sr.hh \
- make_gems_repository.hh \
- yaml.hh \
- gems_version_metadata.hh
-
-libpaludisgemsrepository_la_SOURCES = \
- gems_repository.cc \
- gems_repository_exceptions.cc \
- cache.cc \
- make_gems_repository.cc \
- yaml.cc \
- gems_version_metadata.cc \
- registration.cc \
- $(paludis_repositories_gems_include_HEADERS)
-
-if ! MONOLITHIC
-
-libpaludisgemsrepository_la_LIBADD = \
- $(top_builddir)/paludis/repositories/libpaludisrepositories.la \
- $(top_builddir)/paludis/util/libpaludisutil.la \
- $(top_builddir)/paludis/libpaludis.la \
- -lyaml \
- $(DYNAMIC_LD_LIBS)
-
-endif
-
-gems_repository_TEST_SOURCES = gems_repository_TEST.cc
-
-gems_repository_TEST_LDADD = \
- libpaludisgemsrepository.la \
- $(top_builddir)/paludis/util/libpaludisutil.la \
- $(top_builddir)/paludis/util/test_extras.o \
- $(top_builddir)/paludis/libpaludis.la \
- $(top_builddir)/paludis/environments/test/libpaludistestenvironment.la \
- $(top_builddir)/test/libtest.a
-
-gems_repository_TEST_CXXFLAGS = -I$(top_srcdir) $(AM_CXXFLAGS)
-
-yaml_TEST_SOURCES = yaml_TEST.cc
-
-yaml_TEST_LDADD = \
- libpaludisgemsrepository.la \
- $(top_builddir)/paludis/util/libpaludisutil.la \
- $(top_builddir)/paludis/util/test_extras.o \
- $(top_builddir)/paludis/libpaludis.la \
- $(top_builddir)/paludis/environments/test/libpaludistestenvironment.la \
- $(top_builddir)/test/libtest.a
-
-yaml_TEST_CXXFLAGS = -I$(top_srcdir) $(AM_CXXFLAGS)
-
-cache_TEST_SOURCES = cache_TEST.cc
-
-cache_TEST_LDADD = \
- libpaludisgemsrepository.la \
- $(top_builddir)/paludis/util/libpaludisutil.la \
- $(top_builddir)/paludis/util/test_extras.o \
- $(top_builddir)/paludis/libpaludis.la \
- $(top_builddir)/paludis/environments/test/libpaludistestenvironment.la \
- $(top_builddir)/test/libtest.a
-
-cache_TEST_CXXFLAGS = -I$(top_srcdir) $(AM_CXXFLAGS)
-
-EXTRA_DIST = \
- gems_repository_TEST.cc \
- gems_repository_TEST_setup.sh \
- gems_repository_TEST_cleanup.sh \
- gems_repository.sr \
- gems_repository-sr.hh \
- gems_repository-sr.cc \
- cache_TEST.cc \
- cache_TEST_setup.sh \
- cache_TEST_cleanup.sh \
- cache.sr \
- cache-sr.hh \
- cache-sr.cc \
- yaml_TEST.cc
-
-BUILT_SOURCES = \
- gems_repository-sr.hh \
- gems_repository-sr.cc \
- cache-sr.hh \
- cache-sr.cc
-
-check_SCRIPTS = \
- gems_repository_TEST_setup.sh gems_repository_TEST_cleanup.sh \
- cache_TEST_setup.sh cache_TEST_cleanup.sh
-
-TESTS_ENVIRONMENT = env \
- PALUDIS_EBUILD_DIR="$(top_srcdir)/ebuild/" \
- PALUDIS_SKIP_CONFIG="yes" \
- TEST_SCRIPT_DIR="$(srcdir)/" \
- PALUDIS_REPOSITORY_SO_DIR="$(top_builddir)/paludis/repositories" \
- LD_LIBRARY_PATH="`echo $$LD_LIBRARY_PATH: | sed -e 's,^:,,'`` \
- $(top_srcdir)/paludis/repositories/gentoo/ebuild/utils/canonicalise $(top_builddir)/paludis/repositories/gems/`" \
- bash $(top_srcdir)/test/run_test.sh
-
-TESTS = yaml_TEST gems_repository_TEST cache_TEST
-check_PROGRAMS = $(TESTS)
-
-gems_repository-sr.hh : gems_repository.sr $(top_srcdir)/misc/make_sr.bash
- $(top_srcdir)/misc/make_sr.bash --header $(srcdir)/gems_repository.sr > $@
-
-gems_repository-sr.cc : gems_repository.sr $(top_srcdir)/misc/make_sr.bash
- $(top_srcdir)/misc/make_sr.bash --source $(srcdir)/gems_repository.sr > $@
-
-cache-sr.hh : cache.sr $(top_srcdir)/misc/make_sr.bash
- $(top_srcdir)/misc/make_sr.bash --header $(srcdir)/cache.sr > $@
-
-cache-sr.cc : cache.sr $(top_srcdir)/misc/make_sr.bash
- $(top_srcdir)/misc/make_sr.bash --source $(srcdir)/cache.sr > $@
-
-built-sources : $(BUILT_SOURCES)
- for s in `echo $(SUBDIRS) | tr -d .` ; do $(MAKE) -C $$s built-sources || exit 1 ; done
-
-
diff --git a/paludis/repositories/gems/cache.cc b/paludis/repositories/gems/cache.cc
deleted file mode 100644
index 5448783..0000000
--- a/paludis/repositories/gems/cache.cc
+++ /dev/null
@@ -1,339 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
- *
- * 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 "cache.hh"
-#include <paludis/repositories/gems/gems_repository_exceptions.hh>
-#include <paludis/repositories/gems/yaml.hh>
-#include <paludis/util/fs_entry.hh>
-#include <paludis/util/save.hh>
-#include <paludis/util/collection_concrete.hh>
-#include <paludis/util/log.hh>
-#include <paludis/util/visitor-impl.hh>
-#include <list>
-
-#include <yaml.h>
-
-using namespace paludis;
-
-#include <paludis/repositories/gems/cache-sr.cc>
-
-namespace paludis
-{
- template<>
- struct Implementation<GemsCache>
- {
- std::list<GemsCacheEntry> entries;
- };
-}
-
-namespace
-{
- struct AsStringVisitor :
- YamlNodeVisitorTypes::ConstVisitor
- {
- std::string str;
- std::string join;
-
- void visit(const YamlSequenceNode * nn)
- {
- if (join.empty())
- throw GemsCacheError("Expected a scalar node, not a sequence");
- else
- std::for_each(nn->begin(), nn->end(), accept_visitor(this));
- }
-
- void visit(const YamlMappingNode *) PALUDIS_ATTRIBUTE((noreturn))
- {
- throw GemsCacheError("Expected a scalar node, not a mapping");
- }
-
- void visit(const YamlScalarNode * nn)
- {
- if (! str.empty())
- str.append(join);
- str.append(nn->value());
- }
- };
-
- std::string
- as_string(tr1::shared_ptr<const YamlNode> n, const std::string & join = "")
- {
- AsStringVisitor v;
- v.join = join;
- n->accept(&v);
- return v.str;
- }
-
- struct VersionVisitor :
- YamlNodeVisitorTypes::ConstVisitor
- {
- std::string str;
-
- void visit(const YamlScalarNode * n) PALUDIS_ATTRIBUTE((noreturn))
- {
- throw GemsCacheError("Expected a mapping node, not scalar '" + n->value() + "'");
- }
-
- void visit(const YamlSequenceNode *) PALUDIS_ATTRIBUTE((noreturn))
- {
- throw GemsCacheError("Expected a mapping node, not a sequence");
- }
-
- void visit(const YamlMappingNode * n)
- {
- Context context("When looking for a version: key in a mapping:");
- for (YamlMappingNode::Iterator i(n->begin()), i_end(n->end()) ; i != i_end ; ++i)
- if (i->first->value() == "version")
- str = as_string(i->second);
- }
- };
-
- struct RequirementsVisitor :
- YamlNodeVisitorTypes::ConstVisitor
- {
- tr1::shared_ptr<VersionRequirements> r;
- bool top_level;
-
- std::string op;
- std::string v;
-
- RequirementsVisitor(tr1::shared_ptr<VersionRequirements> rr) :
- r(rr),
- top_level(true)
- {
- }
-
- void visit(const YamlMappingNode * n)
- {
- Context context("When handling mapping node:");
-
- if (top_level)
- {
- for (YamlMappingNode::Iterator i(n->begin()), i_end(n->end()) ; i != i_end ; ++i)
- if (i->first->value() == "requirements")
- {
- Context context2("When handling mapping node requirements key:");
- i->second->accept(this);
- }
- }
- else
- for (YamlMappingNode::Iterator i(n->begin()), i_end(n->end()) ; i != i_end ; ++i)
- if (i->first->value() == "version")
- {
- Context local_context("When looking for a version: key in a requirements mapping:");
- v = as_string(i->second);
- }
- }
-
- void visit(const YamlSequenceNode * n)
- {
- Context context("When handling sequence node:");
-
- if (top_level)
- {
- Save<bool> save_top_level(&top_level, false);
- std::for_each(n->begin(), n->end(), accept_visitor(this));
- }
- else
- {
- op = "";
- v = "";
-
- YamlSequenceNode::Iterator i(n->begin()), i_end(n->end());
- if (i == i_end)
- throw YamlError("Expected a sequence with two entries, not zero");
- op = as_string(*i++);
- if (i == i_end)
- throw YamlError("Expected a sequence with two entries, not one");
- VersionVisitor vv;
- (*i++)->accept(&vv);
- v = vv.str;
- if (i != i_end)
- throw YamlError("Expected a sequence with two entries, not more than two");
-
- r->push_back(VersionRequirement(VersionOperator(op), VersionSpec(v)));
- }
- }
-
- void visit(const YamlScalarNode * n)
- {
- if (top_level && n->value().empty())
- return;
-
- throw YamlError("Didn't expect a scalar");
- }
- };
-
- struct EntryVisitor :
- YamlNodeVisitorTypes::ConstVisitor
- {
- const std::string id;
-
- std::string name;
- std::string version;
- std::string summary;
- std::string description;
- std::string homepage;
- tr1::shared_ptr<VersionRequirements> required_ruby_version;
-
- EntryVisitor(const std::string & _id) :
- id(_id),
- required_ruby_version(new VersionRequirements::Concrete)
- {
- }
-
- GemsCacheEntry
- entry() const
- {
- Context context("When creating GemsCacheEntry with id '" + id + "':");
-
- return GemsCacheEntry::create()
- .name(PackageNamePart(name))
- .version(VersionSpec(version))
- .summary(summary)
- .description(description)
- .homepage(homepage)
- .required_ruby_version(required_ruby_version)
- .authors(tr1::shared_ptr<SequentialCollection<std::string> >())
- .dependencies(tr1::shared_ptr<SequentialCollection<std::string> >())
- .requirements(tr1::shared_ptr<SequentialCollection<std::string> >());
- }
-
- void visit(const YamlSequenceNode *) PALUDIS_ATTRIBUTE((noreturn))
- {
- throw GemsCacheError("Sequence node not expected here'");
- }
-
- void visit(const YamlScalarNode * n) PALUDIS_ATTRIBUTE((noreturn))
- {
- throw GemsCacheError("Node '" + n->value() + "' not expected here'");
- }
-
- void visit(const YamlMappingNode * n)
- {
- for (YamlMappingNode::Iterator i(n->begin()), i_end(n->end()) ; i != i_end ; ++i)
- {
- Context context("When handling entry key '" + i->first->value() + "':");
-
- if (i->first->value() == "name")
- name = as_string(i->second);
- else if (i->first->value() == "summary")
- summary = as_string(i->second);
- else if (i->first->value() == "description")
- description = as_string(i->second);
- else if (i->first->value() == "homepage")
- homepage = as_string(i->second, " ");
- else if (i->first->value() == "version")
- {
- VersionVisitor v;
- i->second->accept(&v);
- version = v.str;
- }
- else if (i->first->value() == "required_ruby_version")
- {
- Context context2("When handling required_ruby_version children:");
- RequirementsVisitor v(required_ruby_version);
- i->second->accept(&v);
- }
- }
- }
- };
-
- struct TopLevelVisitor :
- YamlNodeVisitorTypes::ConstVisitor,
- YamlNodeVisitorTypes::ConstVisitor::VisitChildren<TopLevelVisitor, YamlSequenceNode>
- {
- using YamlNodeVisitorTypes::ConstVisitor::VisitChildren<TopLevelVisitor, YamlSequenceNode>::visit;
-
- Implementation<GemsCache> * imp;
- bool top_level;
-
- TopLevelVisitor(Implementation<GemsCache> * p) :
- imp(p),
- top_level(true)
- {
- }
-
- void visit(const YamlMappingNode * n)
- {
- for (YamlMappingNode::Iterator i(n->begin()), i_end(n->end()) ; i != i_end ; ++i)
- {
- if (top_level)
- {
- if (i->first->value() != "gems")
- throw GemsCacheError("Node '" + i->first->value() + "' is not 'gems'");
- Save<bool> save_top_level(&top_level, false);
- i->second->accept(this);
- }
- else
- {
- Context context("When processing ID '" + i->first->value() + "':");
- try
- {
- EntryVisitor v(i->first->value());
- i->second->accept(&v);
- imp->entries.push_back(v.entry());
- }
- catch (const NameError & e)
- {
- Log::get_instance()->message(ll_qa, lc_context, "Skipping ID '"
- + i->first->value() + "' due to exception '" + e.message() + "' ("
- + e.what() + ")");
- }
- }
- }
- }
-
- void visit(const YamlScalarNode * n) PALUDIS_ATTRIBUTE((noreturn))
- {
- throw GemsCacheError("Node '" + n->value() + "' not expected here'");
- }
- };
-}
-
-GemsCache::GemsCache(const FSEntry & loc) :
- PrivateImplementationPattern<GemsCache>(new Implementation<GemsCache>)
-{
- Context context("When creating Gems cache from '" + stringify(loc) + "':");
-
- if (! loc.is_regular_file())
- throw GemsCacheError("Cache '" + stringify(loc) + "' is not a regular file");
-
- YamlDocument doc(loc);
-
- TopLevelVisitor v(_imp.operator-> ());
- doc.top()->accept(&v);
-}
-
-GemsCache::~GemsCache()
-{
-}
-
-GemsCache::Iterator
-GemsCache::begin() const
-{
- return Iterator(_imp->entries.begin());
-}
-
-GemsCache::Iterator
-GemsCache::end() const
-{
- return Iterator(_imp->entries.end());
-}
-
diff --git a/paludis/repositories/gems/cache.hh b/paludis/repositories/gems/cache.hh
deleted file mode 100644
index 856cb27..0000000
--- a/paludis/repositories/gems/cache.hh
+++ /dev/null
@@ -1,52 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
- *
- * 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
- */
-
-#ifndef PALUDIS_GUARD_PALUDIS_REPOSITORIES_GEMS_CACHE_HH
-#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_GEMS_CACHE_HH 1
-
-#include <paludis/util/instantiation_policy.hh>
-#include <paludis/util/private_implementation_pattern.hh>
-#include <paludis/util/collection.hh>
-#include <paludis/name.hh>
-#include <paludis/version_spec.hh>
-#include <paludis/version_requirements.hh>
-
-#include <libwrapiter/libwrapiter.hh>
-
-namespace paludis
-{
- class FSEntry;
-
-#include <paludis/repositories/gems/cache-sr.hh>
-
- class PALUDIS_VISIBLE GemsCache :
- private InstantiationPolicy<GemsCache, instantiation_method::NonCopyableTag>,
- private PrivateImplementationPattern<GemsCache>
- {
- public:
- GemsCache(const FSEntry &);
- ~GemsCache();
-
- typedef libwrapiter::ForwardIterator<GemsCache, const GemsCacheEntry> Iterator;
- Iterator begin() const;
- Iterator end() const;
- };
-}
-
-#endif
diff --git a/paludis/repositories/gems/cache.sr b/paludis/repositories/gems/cache.sr
deleted file mode 100644
index fe3bafa..0000000
--- a/paludis/repositories/gems/cache.sr
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/bash
-# vim: set sw=4 sts=4 et :
-
-make_class_GemsCacheEntry()
-{
- key name PackageNamePart
- key version VersionSpec
- key summary std::string
- key description std::string
- key homepage std::string
- key required_ruby_version "tr1::shared_ptr<VersionRequirements>"
- key authors "tr1::shared_ptr<SequentialCollection<std::string> >"
- key dependencies "tr1::shared_ptr<SequentialCollection<std::string> >"
- key requirements "tr1::shared_ptr<SequentialCollection<std::string> >"
-
- allow_named_args
-}
-
diff --git a/paludis/repositories/gems/cache_TEST.cc b/paludis/repositories/gems/cache_TEST.cc
deleted file mode 100644
index c40afa6..0000000
--- a/paludis/repositories/gems/cache_TEST.cc
+++ /dev/null
@@ -1,93 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
- *
- * 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/gems/cache.hh>
-#include <paludis/repositories/gems/gems_repository_exceptions.hh>
-#include <paludis/repositories/gems/yaml.hh>
-#include <paludis/util/collection_concrete.hh>
-#include <paludis/util/fs_entry.hh>
-#include <paludis/environments/test/test_environment.hh>
-#include <test/test_framework.hh>
-#include <test/test_runner.hh>
-
-using namespace test;
-using namespace paludis;
-
-namespace test_cases
-{
- struct GemsRepositoryCacheEntriesTest : TestCase
- {
- GemsRepositoryCacheEntriesTest() : TestCase("cache entries") { }
-
- void run()
- {
- GemsCache cache(FSEntry("cache_TEST_dir/entries"));
-
- TEST_CHECK_EQUAL(std::distance(cache.begin(), cache.end()), 2);
-
- GemsCache::Iterator c(cache.begin());
- TEST_CHECK(c != cache.end());
-
- TEST_CHECK_EQUAL(c->name, PackageNamePart("foo"));
- TEST_CHECK_EQUAL(c->homepage, "http://foo.com/");
- TEST_CHECK_EQUAL(c->version, VersionSpec("1.2.3"));
-
- TEST_CHECK(c->required_ruby_version);
- TEST_CHECK_EQUAL(std::distance(c->required_ruby_version->begin(),
- c->required_ruby_version->end()), 1);
- TEST_CHECK_EQUAL(c->required_ruby_version->begin()->version_operator, VersionOperator(">"));
- TEST_CHECK_EQUAL(c->required_ruby_version->begin()->version_spec, VersionSpec("1.8.0"));
-
- ++c;
- TEST_CHECK(c != cache.end());
-
- TEST_CHECK_EQUAL(c->name, PackageNamePart("bar"));
- TEST_CHECK_EQUAL(c->homepage, "");
- TEST_CHECK_EQUAL(c->version, VersionSpec("2.3.4"));
- TEST_CHECK(c->required_ruby_version);
- TEST_CHECK(c->required_ruby_version->empty());
-
- ++c;
- TEST_CHECK(c == cache.end());
- }
- } test_cache_entries;
-
- struct GemsRepositoryCacheNoFileTest : TestCase
- {
- GemsRepositoryCacheNoFileTest() : TestCase("cache no file") { }
-
- void run()
- {
- TEST_CHECK_THROWS(GemsCache(FSEntry("cache_TEST_dir/nofile")), GemsCacheError);
- }
- } test_cache_no_file;
-
- struct GemsRepositoryCacheBrokenTest : TestCase
- {
- GemsRepositoryCacheBrokenTest() : TestCase("cache broken file") { }
-
- void run()
- {
- TEST_CHECK_THROWS(GemsCache(FSEntry("cache_TEST_dir/broken")), YamlError);
- }
- } test_cache_broken;
-}
-
-
-
diff --git a/paludis/repositories/gems/cache_TEST_cleanup.sh b/paludis/repositories/gems/cache_TEST_cleanup.sh
deleted file mode 100755
index c75183a..0000000
--- a/paludis/repositories/gems/cache_TEST_cleanup.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/bash
-# vim: set ft=sh sw=4 sts=4 et :
-
-if [ -d cache_TEST_dir ] ; then
- rm -fr cache_TEST_dir
-else
- true
-fi
-
diff --git a/paludis/repositories/gems/cache_TEST_setup.sh b/paludis/repositories/gems/cache_TEST_setup.sh
deleted file mode 100755
index 826220c..0000000
--- a/paludis/repositories/gems/cache_TEST_setup.sh
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/bin/bash
-# vim: set ft=sh sw=4 sts=4 et :
-
-mkdir cache_TEST_dir || exit 1
-cd cache_TEST_dir || exit 1
-
-cat <<END > entries
---- !ruby/object:Gem::Cache
-gems:
- foo-1.2.3: !ruby/object:Gem::Specification
- name: foo
- homepage: http://foo.com/
- version: !ruby/object:Gem::Version
- version: 1.2.3
- required_ruby_version: !ruby/object:Gem::Version::Requirement
- requirements:
- - - ">"
- - !ruby/object:Gem::Version
- version: 1.8.0
- version:
-
- bar-2.3.4: !ruby/object:Gem::Specification
- name: bar
- version: !ruby/object:Gem::Version
- version: 2.3.4
-
-END
-
-cat <<"END" > broken
-foo:
- [ [ foo:
-END
-
diff --git a/paludis/repositories/gems/gems_repository.cc b/paludis/repositories/gems/gems_repository.cc
deleted file mode 100644
index 57314ad..0000000
--- a/paludis/repositories/gems/gems_repository.cc
+++ /dev/null
@@ -1,284 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
- *
- * 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 "gems_repository.hh"
-
-using namespace paludis;
-
-#include <paludis/repositories/gems/gems_repository-sr.cc>
-#include <paludis/repositories/gems/gems_version_metadata.hh>
-#include <paludis/repositories/gems/cache.hh>
-#include <paludis/util/collection_concrete.hh>
-#include <paludis/util/tokeniser.hh>
-#include <paludis/util/system.hh>
-#include <paludis/util/log.hh>
-#include <paludis/syncer.hh>
-#include <paludis/package_database.hh>
-#include <paludis/hashed_containers.hh>
-#include <paludis/environment.hh>
-
-#include <paludis/portage_dep_parser.hh>
-
-namespace paludis
-{
- typedef std::map<VersionSpec, GemsRepositoryEntry> Versions;
- typedef MakeHashedMap<PackageNamePart, Versions>::Type Packages;
-
- template<>
- struct Implementation<GemsRepository>
- {
- const GemsRepositoryParams params;
-
- void need_entries() const;
-
- mutable bool has_entries;
- mutable Packages packages;
-
- Implementation(const GemsRepositoryParams & p) :
- params(p),
- has_entries(false)
- {
- }
- };
-
- void
- Implementation<GemsRepository>::need_entries() const
- {
- if (has_entries)
- return;
-
- Context context("When loading Gems repository entries:");
-
- GemsCache cache(params.location / "yaml");
- for (GemsCache::Iterator g(cache.begin()), g_end(cache.end()) ;
- g != g_end ; ++g)
- {
- tr1::shared_ptr<VersionMetadata> m(new GemsVersionMetadata(g->version));
- m->set_homepage(g->homepage);
- if (g->description.empty())
- m->description = g->summary;
- else
- m->description = g->description;
-
- Packages::iterator v(packages.insert(std::make_pair(g->name, Versions())).first);
- v->second.insert(std::make_pair(g->version, m));
- }
-
- has_entries = true;
- }
-}
-
-bool
-GemsRepository::do_has_category_named(const CategoryNamePart & c) const
-{
- return stringify(c) == "gems";
-}
-
-bool
-GemsRepository::do_has_package_named(const QualifiedPackageName & c) const
-{
- if (! do_has_category_named(c.category))
- return false;
-
- _imp->need_entries();
- return _imp->packages.end() != _imp->packages.find(c.package);
-
- return false;
-}
-
-tr1::shared_ptr<const CategoryNamePartCollection>
-GemsRepository::do_category_names() const
-{
- static tr1::shared_ptr<CategoryNamePartCollection> names(new CategoryNamePartCollection::Concrete);
- if (names->empty())
- names->insert(CategoryNamePart("gems"));
-
- return names;
-}
-
-tr1::shared_ptr<const QualifiedPackageNameCollection>
-GemsRepository::do_package_names(const CategoryNamePart & c) const
-{
- if (! has_category_named(c))
- return tr1::shared_ptr<const QualifiedPackageNameCollection>(new QualifiedPackageNameCollection::Concrete);
-
- _imp->need_entries();
-
- tr1::shared_ptr<QualifiedPackageNameCollection> result(new QualifiedPackageNameCollection::Concrete);
- for (Packages::const_iterator i(_imp->packages.begin()), i_end(_imp->packages.end()) ;
- i != i_end ; ++i)
- result->insert(c + i->first);
-
- return result;
-}
-
-tr1::shared_ptr<const VersionSpecCollection>
-GemsRepository::do_version_specs(const QualifiedPackageName & p) const
-{
- if (! has_category_named(p.category))
- return tr1::shared_ptr<const VersionSpecCollection>(new VersionSpecCollection::Concrete);
-
- _imp->need_entries();
-
- tr1::shared_ptr<VersionSpecCollection> result(new VersionSpecCollection::Concrete);
- Packages::const_iterator i(_imp->packages.find(p.package));
- if (i != _imp->packages.end())
- std::copy(i->second.begin(), i->second.end(), transform_inserter(
- result->inserter(), SelectFirst<VersionSpec, GemsRepositoryEntry>()));
-
- return result;
-}
-
-bool
-GemsRepository::do_has_version(const QualifiedPackageName & q, const VersionSpec &) const
-{
- if (! has_category_named(q.category))
- return false;
-
- _imp->need_entries();
-
- return false;
-}
-
-tr1::shared_ptr<const VersionMetadata>
-GemsRepository::do_version_metadata(const QualifiedPackageName & q, const VersionSpec & v) const
-{
- if (! has_category_named(q.category))
- throw NoSuchPackageError(stringify(PackageDatabaseEntry(q, v, name())));
-
- _imp->need_entries();
-
- Packages::const_iterator i(_imp->packages.find(q.package));
- if (i == _imp->packages.end())
- throw NoSuchPackageError(stringify(PackageDatabaseEntry(q, v, name())));
-
- Versions::const_iterator j(i->second.find(v));
- if (j == i->second.end())
- throw NoSuchPackageError(stringify(PackageDatabaseEntry(q, v, name())));
-
- return j->second.metadata;
-}
-
-void
-GemsRepository::do_install(const QualifiedPackageName &, const VersionSpec &, const InstallOptions &) const
-{
-}
-
-tr1::shared_ptr<DepSpec>
-GemsRepository::do_package_set(const SetName &) const
-{
- return tr1::shared_ptr<DepSpec>();
-}
-
-tr1::shared_ptr<const SetNameCollection>
-GemsRepository::sets_list() const
-{
- return tr1::shared_ptr<SetNameCollection>(new SetNameCollection::Concrete);
-}
-
-bool
-GemsRepository::do_sync() const
-{
- Context context("When syncing repository '" + stringify(name()) + "':");
-
- if (_imp->params.yaml_uri.empty())
- return false;
-
- std::string::size_type p;
- if (std::string::npos == ((p = _imp->params.yaml_uri.find(':'))))
- throw ConfigurationError("Don't recognise URI '" + _imp->params.yaml_uri + "'");
-
- std::string protocol(_imp->params.yaml_uri.substr(0, p));
-
- Log::get_instance()->message(ll_debug, lc_context) << "looking for syncer protocol '"
- + stringify(protocol) + "'";
-
- FSEntry fetcher("/var/empty");
- bool ok(false);
- tr1::shared_ptr<const FSEntryCollection> fetchers_dirs(_imp->params.environment->fetchers_dirs());
- for (FSEntryCollection::Iterator d(fetchers_dirs->begin()),
- d_end(fetchers_dirs->end()) ; d != d_end && ! ok; ++d)
- {
- fetcher = FSEntry(*d) / ("do" + protocol);
- if (fetcher.exists() && fetcher.has_permission(fs_ug_owner, fs_perm_execute))
- ok = true;
-
- Log::get_instance()->message(ll_debug, lc_no_context, "Trying '" + stringify(fetcher) + "': "
- + (ok ? "ok" : "not ok"));
- }
-
- if (! ok)
- throw ConfigurationError("Don't know how to fetch URI '" + _imp->params.yaml_uri + "'");
-
- (_imp->params.location / "yaml").unlink();
- if (run_command(stringify(fetcher) + " '" +_imp->params.yaml_uri + "' '" +
- stringify(_imp->params.location / "yaml") + "'"))
- throw SyncFailedError(stringify(_imp->params.location / "yaml"), _imp->params.yaml_uri);
-
- return true;
-}
-
-GemsRepository::GemsRepository(const GemsRepositoryParams & p) :
- Repository(RepositoryName("gems"),
- RepositoryCapabilities::create()
- .mask_interface(0)
- .contents_interface(0)
- .installable_interface(this)
- .installed_interface(0)
- .sets_interface(this)
- .syncable_interface(this)
- .uninstallable_interface(0)
- .use_interface(0)
- .world_interface(0)
- .environment_variable_interface(0)
- .mirrors_interface(0)
- .virtuals_interface(0)
- .provides_interface(0)
- .config_interface(0)
- .destination_interface(0)
- .licenses_interface(0)
- .portage_interface(0)
- .pretend_interface(0)
- .hook_interface(0),
- "gems"),
- PrivateImplementationPattern<GemsRepository>(new Implementation<GemsRepository>(p))
-{
-}
-
-GemsRepository::~GemsRepository()
-{
-}
-
-void
-GemsRepository::invalidate()
-{
- _imp.reset(new Implementation<GemsRepository>(_imp->params));
-}
-
-void
-GemsRepository::regenerate_cache() const
-{
-}
-
-tr1::shared_ptr<const RepositoryInfo>
-GemsRepository::info(bool) const
-{
- return tr1::shared_ptr<RepositoryInfo>(new RepositoryInfo);
-}
-
diff --git a/paludis/repositories/gems/gems_repository.hh b/paludis/repositories/gems/gems_repository.hh
deleted file mode 100644
index 73fa810..0000000
--- a/paludis/repositories/gems/gems_repository.hh
+++ /dev/null
@@ -1,63 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-#ifndef PALUDIS_GUARD_PALUDIS_REPOSITORIES_GEMS_GEMS_REPOSITORY_HH
-#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_GEMS_GEMS_REPOSITORY_HH 1
-
-#include <paludis/repository.hh>
-#include <paludis/util/fs_entry.hh>
-#include <paludis/util/private_implementation_pattern.hh>
-#include <string>
-
-namespace paludis
-{
- class PackageDatabase;
-
-#include <paludis/repositories/gems/gems_repository-sr.hh>
-
- class PALUDIS_VISIBLE GemsRepository :
- public Repository,
- public RepositoryInstallableInterface,
- public RepositorySyncableInterface,
- public RepositorySetsInterface,
- private PrivateImplementationPattern<GemsRepository>
- {
- protected:
- virtual bool do_has_category_named(const CategoryNamePart &) const;
-
- virtual bool do_has_package_named(const QualifiedPackageName &) const;
-
- virtual tr1::shared_ptr<const CategoryNamePartCollection> do_category_names() const;
-
- virtual tr1::shared_ptr<const QualifiedPackageNameCollection> do_package_names(
- const CategoryNamePart &) const;
-
- virtual tr1::shared_ptr<const VersionSpecCollection> do_version_specs(
- const QualifiedPackageName &) const;
-
- virtual bool do_has_version(const QualifiedPackageName &, const VersionSpec &) const;
-
- virtual tr1::shared_ptr<const VersionMetadata> do_version_metadata(
- const QualifiedPackageName &,
- const VersionSpec &) const;
-
- virtual void do_install(const QualifiedPackageName &, const VersionSpec &,
- const InstallOptions &) const;
-
- virtual tr1::shared_ptr<DepSpec> do_package_set(const SetName &) const;
-
- virtual tr1::shared_ptr<const SetNameCollection> sets_list() const;
-
- virtual bool do_sync() const;
-
- public:
- virtual tr1::shared_ptr<const RepositoryInfo> info(bool verbose) const;
-
- GemsRepository(const GemsRepositoryParams &);
- ~GemsRepository();
-
- virtual void invalidate();
- virtual void regenerate_cache() const;
- };
-}
-
-#endif
diff --git a/paludis/repositories/gems/gems_repository.sr b/paludis/repositories/gems/gems_repository.sr
deleted file mode 100644
index d22fe76..0000000
--- a/paludis/repositories/gems/gems_repository.sr
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/bash
-# vim: set sw=4 sts=4 et :
-
-make_class_GemsRepositoryParams()
-{
- visible
-
- key environment "const Environment *"
- key location FSEntry
- key distdir FSEntry
- key yaml_uri std::string
- key buildroot FSEntry
-
- allow_named_args
-}
-
-make_class_GemsRepositoryEntry()
-{
- visible
-
- key metadata "tr1::shared_ptr<VersionMetadata>"
-}
-
diff --git a/paludis/repositories/gems/gems_repository_TEST.cc b/paludis/repositories/gems/gems_repository_TEST.cc
deleted file mode 100644
index 7cd220d..0000000
--- a/paludis/repositories/gems/gems_repository_TEST.cc
+++ /dev/null
@@ -1,51 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
- *
- * 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/gems/gems_repository.hh>
-#include <paludis/repositories/gems/make_gems_repository.hh>
-#include <paludis/util/collection_concrete.hh>
-#include <paludis/environments/test/test_environment.hh>
-#include <paludis/util/system.hh>
-#include <test/test_framework.hh>
-#include <test/test_runner.hh>
-
-using namespace test;
-using namespace paludis;
-
-namespace test_cases
-{
- struct GemsRepositoryRepoNameTest : TestCase
- {
- GemsRepositoryRepoNameTest() : TestCase("repo name") { }
-
- void run()
- {
- TestEnvironment env;
- tr1::shared_ptr<AssociativeCollection<std::string, std::string> > keys(
- new AssociativeCollection<std::string, std::string>::Concrete);
- keys->insert("format", "gems");
- keys->insert("location", "gems_repository_TEST_dir/repo1");
- tr1::shared_ptr<Repository> repo(make_gems_repository(
- &env, keys));
- TEST_CHECK_STRINGIFY_EQUAL(repo->name(), "gems");
- }
- } test_portage_repository_repo_name;
-}
-
-
diff --git a/paludis/repositories/gems/gems_repository_TEST_cleanup.sh b/paludis/repositories/gems/gems_repository_TEST_cleanup.sh
deleted file mode 100755
index 5d20e5c..0000000
--- a/paludis/repositories/gems/gems_repository_TEST_cleanup.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/bash
-# vim: set ft=sh sw=4 sts=4 et :
-
-if [ -d gems_repository_TEST_dir ] ; then
- rm -fr gems_repository_TEST_dir
-else
- true
-fi
-
diff --git a/paludis/repositories/gems/gems_repository_TEST_setup.sh b/paludis/repositories/gems/gems_repository_TEST_setup.sh
deleted file mode 100755
index ada6cd8..0000000
--- a/paludis/repositories/gems/gems_repository_TEST_setup.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/bash
-# vim: set ft=sh sw=4 sts=4 et :
-
-mkdir gems_repository_TEST_dir || exit 1
-cd gems_repository_TEST_dir || exit 1
diff --git a/paludis/repositories/gems/gems_repository_exceptions.cc b/paludis/repositories/gems/gems_repository_exceptions.cc
deleted file mode 100644
index cc7905b..0000000
--- a/paludis/repositories/gems/gems_repository_exceptions.cc
+++ /dev/null
@@ -1,35 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
- *
- * 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 "gems_repository_exceptions.hh"
-
-using namespace paludis;
-
-GemsRepositoryConfigurationError::GemsRepositoryConfigurationError(
- const std::string & msg) throw () :
- ConfigurationError("Gems repository configuration error: " + msg)
-{
-}
-
-GemsCacheError::GemsCacheError(
- const std::string & msg) throw () :
- ConfigurationError("Gems repository cache error: " + msg)
-{
-}
-
diff --git a/paludis/repositories/gems/gems_repository_exceptions.hh b/paludis/repositories/gems/gems_repository_exceptions.hh
deleted file mode 100644
index 38a0ca9..0000000
--- a/paludis/repositories/gems/gems_repository_exceptions.hh
+++ /dev/null
@@ -1,46 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
- *
- * 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
- */
-
-#ifndef PALUDIS_GUARD_PALUDIS_REPOSITORIES_GEMS_GEMS_REPOSITORY_EXCEPTIONS_HH
-#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_GEMS_GEMS_REPOSITORY_EXCEPTIONS_HH 1
-
-#include <paludis/util/exception.hh>
-
-namespace paludis
-{
- class PALUDIS_VISIBLE GemsRepositoryConfigurationError :
- public ConfigurationError
- {
- public:
- /**
- * Constructor.
- */
- GemsRepositoryConfigurationError(const std::string & msg) throw ();
- };
-
- class PALUDIS_VISIBLE GemsCacheError :
- public ConfigurationError
- {
- public:
- GemsCacheError(const std::string & msg) throw ();
- };
-
-}
-
-#endif
diff --git a/paludis/repositories/gems/gems_version_metadata.cc b/paludis/repositories/gems/gems_version_metadata.cc
deleted file mode 100644
index d4eb9f8..0000000
--- a/paludis/repositories/gems/gems_version_metadata.cc
+++ /dev/null
@@ -1,49 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
- *
- * 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 "gems_version_metadata.hh"
-#include <paludis/portage_dep_parser.hh>
-
-using namespace paludis;
-
-GemsVersionMetadata::GemsVersionMetadata(const VersionSpec & v) :
- VersionMetadata(
- VersionMetadataBase::create()
- .slot(SlotName(stringify(v)))
- .homepage("")
- .description("")
- .eapi(EAPIData::get_instance()->eapi_from_string("paludis-1"))
- .interactive(false),
- VersionMetadataCapabilities::create()
- .deps_interface(this)
- .ebuild_interface(0)
- .cran_interface(0)
- .virtual_interface(0)
- .origins_interface(0)
- .license_interface(0)
- .ebin_interface(0)
- ),
- VersionMetadataDepsInterface(&PortageDepParser::parse_depend)
-{
-}
-
-GemsVersionMetadata::~GemsVersionMetadata()
-{
-}
-
diff --git a/paludis/repositories/gems/gems_version_metadata.hh b/paludis/repositories/gems/gems_version_metadata.hh
deleted file mode 100644
index 9fadb3c..0000000
--- a/paludis/repositories/gems/gems_version_metadata.hh
+++ /dev/null
@@ -1,50 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
- *
- * 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
- */
-
-#ifndef PALUDIS_GUARD_PALUDIS_REPOSITORIES_GEMS_GEMS_VERSION_METADATA_HH
-#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_GEMS_GEMS_VERSION_METADATA_HH 1
-
-#include <paludis/version_metadata.hh>
-#include <paludis/version_spec.hh>
-
-namespace paludis
-{
- /**
- * Version metadata for a Gems repository entry.
- *
- * \see GemsRepository
- * \ingroup grpgemsrepository
- */
- class GemsVersionMetadata :
- public VersionMetadata,
- public VersionMetadataDepsInterface,
- public virtual VersionMetadataHasInterfaces
- {
- public:
- GemsVersionMetadata(const VersionSpec &);
- virtual ~GemsVersionMetadata();
-
- virtual const VersionMetadata * version_metadata() const
- {
- return this;
- }
- };
-}
-
-#endif
diff --git a/paludis/repositories/gems/make_gems_repository.cc b/paludis/repositories/gems/make_gems_repository.cc
deleted file mode 100644
index aa844b5..0000000
--- a/paludis/repositories/gems/make_gems_repository.cc
+++ /dev/null
@@ -1,59 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
- *
- * 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 "make_gems_repository.hh"
-#include <paludis/repositories/gems/gems_repository_exceptions.hh>
-
-using namespace paludis;
-
-tr1::shared_ptr<Repository>
-paludis::make_gems_repository(Environment * const env,
- tr1::shared_ptr<const AssociativeCollection<std::string, std::string> > m)
-{
- std::string repo_file(m->end() == m->find("repo_file") ? std::string("?") :
- m->find("repo_file")->second);
-
- Context context("When making gems repository from repo_file '" + repo_file + "':");
-
- std::string location;
- if (m->end() == m->find("location") || ((location = m->find("location")->second)).empty())
- throw GemsRepositoryConfigurationError("Key 'location' not specified or empty");
-
- std::string distdir;
- if (m->end() == m->find("distdir") || ((distdir = m->find("distdir")->second)).empty())
- distdir = location + "/distfiles";
-
- std::string yaml_uri;
- if (m->end() != m->find("yaml_uri"))
- yaml_uri = m->find("yaml_uri")->second;
-
- std::string buildroot;
- if (m->end() == m->find("buildroot") || ((buildroot = m->find("buildroot")->second)).empty())
- buildroot = "/var/tmp/paludis";
-
- return tr1::shared_ptr<Repository>(new GemsRepository(GemsRepositoryParams::create()
- .environment(env)
- .location(location)
- .distdir(distdir)
- .yaml_uri(yaml_uri)
- .buildroot(buildroot)));
-
-}
-
-
diff --git a/paludis/repositories/gems/make_gems_repository.hh b/paludis/repositories/gems/make_gems_repository.hh
deleted file mode 100644
index d0a9d33..0000000
--- a/paludis/repositories/gems/make_gems_repository.hh
+++ /dev/null
@@ -1,32 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
- *
- * 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
- */
-
-#ifndef PALUDIS_GUARD_PALUDIS_REPOSITORIES_GEMS_MAKE_GEMS_REPOSITORY_HH
-#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_GEMS_MAKE_GEMS_REPOSITORY_HH 1
-
-#include <paludis/repositories/gems/gems_repository.hh>
-
-namespace paludis
-{
- tr1::shared_ptr<Repository>
- make_gems_repository(Environment * const,
- tr1::shared_ptr<const AssociativeCollection<std::string, std::string> >) PALUDIS_VISIBLE;
-}
-
-#endif
diff --git a/paludis/repositories/gems/registration.cc b/paludis/repositories/gems/registration.cc
deleted file mode 100644
index 3c96553..0000000
--- a/paludis/repositories/gems/registration.cc
+++ /dev/null
@@ -1,40 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
- *
- * 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/repository_maker.hh>
-#include <paludis/repositories/gems/make_gems_repository.hh>
-#include "config.h"
-
-using namespace paludis;
-
-#ifndef MONOLITHIC
-
-extern "C"
-{
- void PALUDIS_VISIBLE register_repositories(RepositoryMaker * maker);
-}
-
-void register_repositories(RepositoryMaker * maker)
-{
- maker->register_maker("gems", &make_gems_repository);
-}
-
-#endif
-
-
diff --git a/paludis/repositories/gems/yaml.cc b/paludis/repositories/gems/yaml.cc
deleted file mode 100644
index c426b7f..0000000
--- a/paludis/repositories/gems/yaml.cc
+++ /dev/null
@@ -1,368 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
- *
- * 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 "yaml.hh"
-#include <paludis/util/fs_entry.hh>
-#include <paludis/util/stringify.hh>
-#include <yaml.h>
-#include <list>
-
-using namespace paludis;
-
-YamlNode::YamlNode()
-{
-}
-
-YamlNode::~YamlNode()
-{
-}
-
-YamlScalarNode::YamlScalarNode(const std::string & v, const std::string & t) :
- _value(v),
- _tag(t)
-{
-}
-
-namespace paludis
-{
- template<>
- struct Implementation<YamlMappingNode>
- {
- std::list<std::pair<tr1::shared_ptr<YamlScalarNode>, tr1::shared_ptr<YamlNode> > > nodes;
- };
-
- template<>
- struct Implementation<YamlSequenceNode>
- {
- std::list<tr1::shared_ptr<YamlNode> > nodes;
- };
-}
-
-
-YamlMappingNode::YamlMappingNode() :
- PrivateImplementationPattern<YamlMappingNode>(new Implementation<YamlMappingNode>)
-{
-}
-
-YamlMappingNode::Iterator
-YamlMappingNode::begin() const
-{
- return Iterator(_imp->nodes.begin());
-}
-
-YamlMappingNode::Iterator
-YamlMappingNode::end() const
-{
- return Iterator(_imp->nodes.end());
-}
-
-std::pair<tr1::shared_ptr<YamlScalarNode>, tr1::shared_ptr<YamlNode> > &
-YamlMappingNode::back()
-{
- return _imp->nodes.back();
-}
-
-YamlSequenceNode::YamlSequenceNode() :
- PrivateImplementationPattern<YamlSequenceNode>(new Implementation<YamlSequenceNode>)
-{
-}
-
-YamlSequenceNode::Iterator
-YamlSequenceNode::begin() const
-{
- return Iterator(_imp->nodes.begin());
-}
-
-YamlSequenceNode::Iterator
-YamlSequenceNode::end() const
-{
- return Iterator(_imp->nodes.end());
-}
-
-void
-YamlSequenceNode::add(tr1::shared_ptr<YamlNode> node)
-{
- _imp->nodes.push_back(node);
-}
-
-void
-YamlMappingNode::add(tr1::shared_ptr<YamlScalarNode> a, tr1::shared_ptr<YamlNode> b)
-{
- _imp->nodes.push_back(std::make_pair(a, b));
-}
-
-namespace paludis
-{
- template<>
- struct Implementation<YamlDocument>
- {
- tr1::shared_ptr<YamlSequenceNode> top;
-
- void parse(yaml_parser_t * parser);
- tr1::shared_ptr<YamlScalarNode> parse_scalar(yaml_parser_t * parser);
-
- Implementation() :
- top(new YamlSequenceNode)
- {
- }
- };
-}
-
-namespace
-{
- template <typename PtrType_, typename ReturnType_ = void>
- class PtrHolder
- {
- private:
- PtrType_ _ptr;
- ReturnType_ (* _free_func) (PtrType_);
- bool _new_used;
-
- PtrHolder(const PtrHolder &);
- void operator= (const PtrHolder &);
-
- public:
- PtrHolder(PtrType_ ptr, ReturnType_ (* free_func) (PtrType_), bool new_used = false) :
- _ptr(ptr),
- _free_func(free_func),
- _new_used(new_used)
- {
- }
-
- ~PtrHolder()
- {
- if (0 != _ptr)
- {
- _free_func(_ptr);
- if (_new_used)
- delete _ptr;
- }
- }
-
- operator PtrType_ () const
- {
- return _ptr;
- }
- };
-
- struct ScalarAdder :
- YamlNodeVisitorTypes::Visitor
- {
- tr1::shared_ptr<YamlScalarNode> a;
-
- ScalarAdder(tr1::shared_ptr<YamlScalarNode> aa) :
- a(aa)
- {
- }
-
- void visit(YamlMappingNode * n)
- {
- if (n->empty() || n->back().second)
- n->add(a, tr1::shared_ptr<YamlNode>());
- else
- n->back().second = a;
- }
-
- void visit(YamlScalarNode *) PALUDIS_ATTRIBUTE((noreturn))
- {
- throw YamlError("Can't add a YamlScalarNode to a YamlScalarNode");
- }
-
- void visit(YamlSequenceNode * n)
- {
- n->add(a);
- }
- };
-
- struct NonScalarAdder :
- YamlNodeVisitorTypes::Visitor
- {
- tr1::shared_ptr<YamlNode> a;
-
- NonScalarAdder(tr1::shared_ptr<YamlNode> aa) :
- a(aa)
- {
- }
-
- void visit(YamlMappingNode * n)
- {
- if (n->empty() || n->back().second)
- throw YamlError("Can't add a non YamlScalarNode to a YamlMappingNode on the left");
- else
- n->back().second = a;
- }
-
- void visit(YamlScalarNode *) PALUDIS_ATTRIBUTE((noreturn))
- {
- throw YamlError("Can't add a YamlScalarNode to a YamlScalarNode");
- }
-
- void visit(YamlSequenceNode * n)
- {
- n->add(a);
- }
- };
-}
-
-YamlDocument::YamlDocument(const std::string & s) :
- PrivateImplementationPattern<YamlDocument>(new Implementation<YamlDocument>)
-{
- Context context("When creating YamlDocument from string:");
-
- PtrHolder<yaml_parser_t *> parser(new yaml_parser_t, yaml_parser_delete, true);
- yaml_parser_initialize(parser);
- /* silly c api */
- yaml_parser_set_input_string(parser, const_cast<unsigned char *>(
- reinterpret_cast<const unsigned char *>(s.c_str())), s.length());
-
- _imp->parse(parser);
-}
-
-YamlDocument::YamlDocument(const FSEntry & loc) :
- PrivateImplementationPattern<YamlDocument>(new Implementation<YamlDocument>)
-{
- Context context("When creating YamlDocument from location '" + stringify(loc) + "':");
-
- if (! loc.is_regular_file())
- throw YamlError("Document '" + stringify(loc) + "' is not a regular file");
-
- PtrHolder<FILE *, int> f(std::fopen(stringify(loc).c_str(), "rb"), &std::fclose);
- if (! f)
- throw YamlError("Document '" + stringify(loc) + "' is not readable");
-
- PtrHolder<yaml_parser_t *> parser(new yaml_parser_t, yaml_parser_delete, true);
- yaml_parser_initialize(parser);
- yaml_parser_set_input_file(parser, f);
-
- _imp->parse(parser);
-}
-
-void
-Implementation<YamlDocument>::parse(yaml_parser_t * parser)
-{
- std::list<tr1::shared_ptr<YamlNode> > stack;
- stack.push_back(top);
-
- bool done(false);
-
- while (! done)
- {
- PtrHolder<yaml_event_t *> event_holder(new yaml_event_t, yaml_event_delete, true);
- std::memset(event_holder, 0, sizeof(*event_holder));
- if (! yaml_parser_parse(parser, event_holder))
- throw YamlError("Error parsing document");
-
- yaml_event_t * event(event_holder);
-
- switch (event->type)
- {
- case YAML_STREAM_START_EVENT:
- break;
-
- case YAML_STREAM_END_EVENT:
- done = true;
- break;
-
- case YAML_MAPPING_START_EVENT:
- {
- tr1::shared_ptr<YamlMappingNode> node(new YamlMappingNode);
- if (stack.empty())
- throw YamlError("Error building tree: stack empty on YAML_SEQUENCE_START_EVENT");
-
- if (stack.back())
- {
- NonScalarAdder a(node);
- stack.back()->accept(&a);
- }
- else
- stack.back() = node;
- stack.push_back(node);
- }
- break;
-
- case YAML_MAPPING_END_EVENT:
- case YAML_SEQUENCE_END_EVENT:
- if (stack.empty())
- throw YamlError("Error building tree: stack empty on YAML_*_END_EVENT");
- stack.pop_back();
- break;
-
- case YAML_SEQUENCE_START_EVENT:
- {
- tr1::shared_ptr<YamlSequenceNode> node(new YamlSequenceNode);
- if (stack.empty())
- throw YamlError("Error building tree: stack empty on YAML_SEQUENCE_START_EVENT");
- if (stack.back())
- {
- NonScalarAdder a(node);
- stack.back()->accept(&a);
- }
- else
- stack.back() = node;
- stack.push_back(node);
- }
- break;
-
- case YAML_SCALAR_EVENT:
- {
- if (stack.empty())
- throw YamlError("Error building tree: stack empty on YAML_SCALAR_EVENT");
- tr1::shared_ptr<YamlScalarNode> node(new YamlScalarNode(
- event->data.scalar.value ? reinterpret_cast<const char *>(event->data.scalar.value) : "",
- event->data.scalar.tag ? reinterpret_cast<const char *>(event->data.scalar.tag) : ""));
- if (stack.back())
- {
- ScalarAdder a(node);
- stack.back()->accept(&a);
- }
- else
- stack.back() = node;
- }
- break;
-
- case YAML_NO_EVENT:
- case YAML_DOCUMENT_START_EVENT:
- case YAML_DOCUMENT_END_EVENT:
- case YAML_ALIAS_EVENT:
- break;
- }
- };
-
- if (stack.empty())
- throw YamlError("Error building tree: stack empty at end");
- stack.pop_back();
- if (! stack.empty())
- throw YamlError("Error building tree: stack not empty at end");
-}
-
-YamlDocument::~YamlDocument()
-{
-}
-
-tr1::shared_ptr<const YamlNode>
-YamlDocument::top() const
-{
- return _imp->top;
-}
-
-YamlError::YamlError(const std::string & msg) throw () :
- ConfigurationError(msg)
-{
-}
-
diff --git a/paludis/repositories/gems/yaml.hh b/paludis/repositories/gems/yaml.hh
deleted file mode 100644
index d459189..0000000
--- a/paludis/repositories/gems/yaml.hh
+++ /dev/null
@@ -1,130 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
- *
- * 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
- */
-
-#ifndef PALUDIS_GUARD_PALUDIS_REPOSITORIES_GEMS_YAML_HH
-#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_GEMS_YAML_HH 1
-
-#include <paludis/util/visitor.hh>
-#include <paludis/util/instantiation_policy.hh>
-#include <paludis/util/private_implementation_pattern.hh>
-#include <paludis/util/tr1_memory.hh>
-
-namespace paludis
-{
- class FSEntry;
-
- class YamlNode;
- class YamlScalarNode;
- class YamlSequenceNode;
- class YamlMappingNode;
-
- typedef VisitorTypes<YamlScalarNode *, YamlSequenceNode *, YamlMappingNode *> YamlNodeVisitorTypes;
-
- class PALUDIS_VISIBLE YamlError :
- public ConfigurationError
- {
- public:
- YamlError(const std::string & msg) throw ();
- };
-
- class PALUDIS_VISIBLE YamlNode :
- public virtual VisitableInterface<YamlNodeVisitorTypes>,
- private InstantiationPolicy<YamlNode, instantiation_method::NonCopyableTag>
- {
- protected:
- YamlNode();
-
- public:
- virtual ~YamlNode();
- };
-
- class PALUDIS_VISIBLE YamlScalarNode :
- public YamlNode,
- public Visitable<YamlScalarNode, YamlNodeVisitorTypes>
- {
- private:
- std::string _value;
- std::string _tag;
-
- public:
- YamlScalarNode(const std::string &, const std::string &);
-
- std::string value() const
- {
- return _value;
- }
-
- std::string tag() const
- {
- return _tag;
- }
- };
-
- class PALUDIS_VISIBLE YamlMappingNode :
- public YamlNode,
- public Visitable<YamlMappingNode, YamlNodeVisitorTypes>,
- private PrivateImplementationPattern<YamlMappingNode>
- {
- public:
- YamlMappingNode();
-
- void add(tr1::shared_ptr<YamlScalarNode>, tr1::shared_ptr<YamlNode>);
-
- typedef libwrapiter::ForwardIterator<YamlMappingNode,
- const std::pair<tr1::shared_ptr<YamlScalarNode>, tr1::shared_ptr<YamlNode> > > Iterator;
- Iterator begin() const;
- Iterator end() const;
-
- std::pair<tr1::shared_ptr<YamlScalarNode>, tr1::shared_ptr<YamlNode> > & back();
-
- bool empty() const
- {
- return begin() == end();
- }
- };
-
- class PALUDIS_VISIBLE YamlSequenceNode :
- public YamlNode,
- public Visitable<YamlSequenceNode, YamlNodeVisitorTypes>,
- private PrivateImplementationPattern<YamlSequenceNode>
- {
- public:
- YamlSequenceNode();
-
- typedef libwrapiter::ForwardIterator<YamlSequenceNode, const tr1::shared_ptr<YamlNode> > Iterator;
- Iterator begin() const;
- Iterator end() const;
-
- void add(tr1::shared_ptr<YamlNode>);
- };
-
- class PALUDIS_VISIBLE YamlDocument :
- private PrivateImplementationPattern<YamlDocument>,
- private InstantiationPolicy<YamlDocument, instantiation_method::NonCopyableTag>
- {
- public:
- YamlDocument(const std::string &);
- YamlDocument(const FSEntry &);
- ~YamlDocument();
-
- tr1::shared_ptr<const YamlNode> top() const;
- };
-}
-
-#endif
diff --git a/paludis/repositories/gems/yaml_TEST.cc b/paludis/repositories/gems/yaml_TEST.cc
deleted file mode 100644
index 64005df..0000000
--- a/paludis/repositories/gems/yaml_TEST.cc
+++ /dev/null
@@ -1,146 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
- *
- * 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/gems/yaml.hh>
-#include <test/test_framework.hh>
-#include <test/test_runner.hh>
-#include <algorithm>
-
-using namespace test;
-using namespace paludis;
-
-namespace
-{
- struct Dumper :
- YamlNodeVisitorTypes::ConstVisitor
- {
- std::string str;
-
- void visit(const YamlSequenceNode * n)
- {
- str.append("seq<");
- std::for_each(n->begin(), n->end(), accept_visitor(this));
- str.append(">");
- }
-
- void visit(const YamlScalarNode * n)
- {
- str.append("scalar<");
- str.append(n->value());
- str.append(">");
- }
-
- void visit(const YamlMappingNode * n)
- {
- str.append("map<");
- bool need_comma(false);
- for (YamlMappingNode::Iterator i(n->begin()), i_end(n->end()) ; i != i_end ; ++i)
- {
- if (need_comma)
- str.append(",");
-
- i->first->accept(this);
- str.append("=");
- i->second->accept(this);
- need_comma = true;
- }
- str.append(">");
- }
- };
-}
-
-namespace test_cases
-{
- struct YamlTest : TestCase
- {
- YamlTest() : TestCase("yaml") { }
-
- void run()
- {
- YamlDocument yaml("foo");
- Dumper d;
- yaml.top()->accept(&d);
- TEST_CHECK_EQUAL(d.str, "seq<scalar<foo>>");
- }
- } test_yaml;
-
- struct YamlSequenceTest : TestCase
- {
- YamlSequenceTest() : TestCase("yaml sequence") { }
-
- void run()
- {
- YamlDocument yaml(
- "- a\n"
- "- b\n"
- "- c\n");
- Dumper d;
- yaml.top()->accept(&d);
- TEST_CHECK_EQUAL(d.str, "seq<seq<scalar<a>scalar<b>scalar<c>>>");
- }
- } test_yaml_sequence;
-
- struct YamlMappingTest : TestCase
- {
- YamlMappingTest() : TestCase("yaml mapping") { }
-
- void run()
- {
- YamlDocument yaml(
- "a: b\n"
- "c: d\n");
- Dumper d;
- yaml.top()->accept(&d);
- TEST_CHECK_EQUAL(d.str, "seq<map<scalar<a>=scalar<b>,scalar<c>=scalar<d>>>");
- }
- } test_yaml_map;
-
- struct YamlMixedTest : TestCase
- {
- YamlMixedTest() : TestCase("yaml mixed") { }
-
- void run()
- {
- YamlDocument yaml(
-"a:\n"
-" b: !c\n"
-" d: e\n"
-" f:\n"
-" - g\n"
-" - h\n"
-"i: j\n");
- Dumper d;
- yaml.top()->accept(&d);
- TEST_CHECK_EQUAL(d.str, "seq<map<scalar<a>=map<scalar<b>=map<scalar<d>=scalar<e>,"
- "scalar<f>=seq<scalar<g>scalar<h>>>>,scalar<i>=scalar<j>>>");
- }
- } test_yaml_mixed;
-
- struct YamlBadTest : TestCase
- {
- YamlBadTest() : TestCase("yaml bad") { }
-
- void run()
- {
- TEST_CHECK_THROWS(YamlDocument yaml("[ [ foo:\n"), YamlError);
- }
- } test_yaml_bad;
-
-}
-