aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-12-11 06:38:07 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-12-11 06:38:07 +0000
commitd6908b44d6436767ee23df69bbe1aa6da7c04d06 (patch)
tree07b4da372e5087f6fb84f230193615fbbe1b1364
parent2b5b912430c88f9e8828b2789871bd9c99bf1596 (diff)
downloadpaludis-d6908b44d6436767ee23df69bbe1aa6da7c04d06.tar.gz
paludis-d6908b44d6436767ee23df69bbe1aa6da7c04d06.tar.xz
Implement --with-repositories. Include skeleton gems code (not usable).
-rw-r--r--configure.ac46
-rw-r--r--paludis/repositories/Makefile.am3
-rw-r--r--paludis/repositories/gems/Makefile.am82
-rw-r--r--paludis/repositories/gems/gems_repository.cc114
-rw-r--r--paludis/repositories/gems/gems_repository.hh68
-rw-r--r--paludis/repositories/gems/gems_repository.sr18
-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.cc30
-rw-r--r--paludis/repositories/gems/gems_repository_exceptions.hh38
-rw-r--r--paludis/repositories/gems/make_gems_repository.cc70
-rw-r--r--paludis/repositories/gems/make_gems_repository.hh33
13 files changed, 565 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac
index c32c4b2..246f350 100644
--- a/configure.ac
+++ b/configure.ac
@@ -524,7 +524,7 @@ dnl }}}
dnl {{{ gtk support
AC_MSG_CHECKING([whether to build the gtk+ client])
AC_ARG_ENABLE([gtk],
- AS_HELP_STRING([--enable-gtk], [Enable gtk+ client (default: disable)]),
+ AS_HELP_STRING([--enable-gtk], [Enable gtk+ client (default: disable) (UNUSABLE)]),
enable_gtk=$enableval,
enable_gtk=no)
AC_MSG_RESULT($enable_gtk)
@@ -642,7 +642,50 @@ if test "x$enable_ruby" = "xyes" ; then
fi
AM_CONDITIONAL([ENABLE_RUBY], test "x$enable_ruby" = "xyes")
+dnl }}}
+
+dnl {{{ repositories
+ALL_REPOSITORIES="cran fake nothing portage vdb gems virtuals"
+DEFAULT_REPOSITORIES="cran fake nothing portage vdb virtuals"
+AC_MSG_CHECKING([which repositories to build...])
+AC_ARG_WITH([repositories],
+ [ --with-repositories=foo,bar,...
+ Build the specified repositories. Available repositories are:
+ cran The Comprehensive R Archive Network
+ fake A fake repository for test cases
+ gems Ruby Gems (requires libyaml) (UNUSABLE)
+ nothing A repository with no content
+ portage Gentoo Portage
+ vdb Gentoo installed packages
+ virtuals Old style Portage virtuals],
+ [repositories="`echo $with_repositories | tr ',' ' '`"],
+ [repositories="$DEFAULT_REPOSITORIES"])
+repositories=`echo $repositories | tr ' ' '\n' | sort | uniq | tr '\n' ' '`
+AC_MSG_RESULT([$repositories])
+BUILD_REPOSITORIES="$repositories"
+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 {{{ is sed gnu sed
@@ -710,6 +753,7 @@ AC_OUTPUT(
paludis/repositories/Makefile
paludis/repositories/cran/Makefile
paludis/repositories/fake/Makefile
+ paludis/repositories/gems/Makefile
paludis/repositories/nothing/Makefile
paludis/repositories/portage/Makefile
paludis/repositories/vdb/Makefile
diff --git a/paludis/repositories/Makefile.am b/paludis/repositories/Makefile.am
index ab50dbf..81ad59f 100644
--- a/paludis/repositories/Makefile.am
+++ b/paludis/repositories/Makefile.am
@@ -1,4 +1,5 @@
-SUBDIRS = cran fake nothing portage vdb virtuals
+SUBDIRS = $(BUILD_REPOSITORIES)
+DIST_SUBDIRS = $(ALL_REPOSITORIES)
CLEANFILES = *~ gmon.out *.gcov *.gcno *.gcda
MAINTAINERCLEANFILES = Makefile.in
diff --git a/paludis/repositories/gems/Makefile.am b/paludis/repositories/gems/Makefile.am
new file mode 100644
index 0000000..831452a
--- /dev/null
+++ b/paludis/repositories/gems/Makefile.am
@@ -0,0 +1,82 @@
+CLEANFILES = *~ gmon.out *.gcov *.gcno *.gcda
+DISTCLEANFILES = gems_repository-sr.hh gems_repository-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
+paludis_repositories_lib_LTLIBRARIES = libpaludisgemsrepository.la
+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 \
+ make_gems_repository.hh
+
+libpaludisgemsrepository_la_SOURCES = \
+ gems_repository.cc \
+ gems_repository_exceptions.cc \
+ make_gems_repository.cc \
+ $(paludis_repositories_gems_include_HEADERS)
+
+libpaludisgemsrepository_la_LIBADD = \
+ $(top_builddir)/paludis/util/libpaludisutil.la \
+ $(top_builddir)/paludis/libpaludis.la \
+ $(DYNAMIC_LD_LIBS)
+
+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/environment/test/libpaludistestenvironment.la \
+ $(top_builddir)/test/libtest.a
+
+gems_repository_TEST_CXXFLAGS = -I$(top_srcdir)
+
+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
+
+BUILT_SOURCES = \
+ gems_repository-sr.hh \
+ gems_repository-sr.cc
+
+check_SCRIPTS = \
+ gems_repository_TEST_setup.sh gems_repository_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="`$(top_srcdir)/ebuild/utils/canonicalise $(top_builddir)/paludis/repositories/gems/`" \
+ bash $(top_srcdir)/test/run_test.sh
+
+TESTS = gems_repository_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 > $@
+
+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/gems_repository.cc b/paludis/repositories/gems/gems_repository.cc
new file mode 100644
index 0000000..3ed0cda
--- /dev/null
+++ b/paludis/repositories/gems/gems_repository.cc
@@ -0,0 +1,114 @@
+/* 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.hh"
+
+using namespace paludis;
+
+#include <paludis/repositories/gems/gems_repository-sr.cc>
+#include <paludis/util/collection_concrete.hh>
+#include <paludis/package_database.hh>
+
+namespace paludis
+{
+ template<>
+ struct Implementation<GemsRepository>
+ {
+ void need_entries() const;
+ };
+}
+
+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 false;
+}
+
+CategoryNamePartCollection::ConstPointer
+GemsRepository::do_category_names() const
+{
+ static CategoryNamePartCollection::Pointer names(new CategoryNamePartCollection::Concrete);
+ if (names->empty())
+ names->insert(CategoryNamePart("gems"));
+
+ return names;
+}
+
+QualifiedPackageNameCollection::ConstPointer
+GemsRepository::do_package_names(const CategoryNamePart & c) const
+{
+ if (! has_category_named(c))
+ return QualifiedPackageNameCollection::ConstPointer(new QualifiedPackageNameCollection::Concrete);
+
+ _imp->need_entries();
+
+ return QualifiedPackageNameCollection::ConstPointer(new QualifiedPackageNameCollection::Concrete);
+}
+
+VersionSpecCollection::ConstPointer
+GemsRepository::do_version_specs(const QualifiedPackageName & p) const
+{
+ if (! has_category_named(p.category))
+ return VersionSpecCollection::ConstPointer(new VersionSpecCollection::Concrete);
+
+ _imp->need_entries();
+
+ return VersionSpecCollection::ConstPointer(new VersionSpecCollection::Concrete);
+}
+
+bool
+GemsRepository::do_has_version(const QualifiedPackageName & q, const VersionSpec &) const
+{
+ if (! has_category_named(q.category))
+ return false;
+
+ _imp->need_entries();
+
+ return false;
+}
+
+VersionMetadata::ConstPointer
+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();
+
+ return VersionMetadata::ConstPointer(new VersionMetadata);
+}
+
+bool
+GemsRepository::do_is_licence(const std::string &) const
+{
+ return false;
+}
+
+
diff --git a/paludis/repositories/gems/gems_repository.hh b/paludis/repositories/gems/gems_repository.hh
new file mode 100644
index 0000000..f32464b
--- /dev/null
+++ b/paludis/repositories/gems/gems_repository.hh
@@ -0,0 +1,68 @@
+/* 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 CategoryNamePartCollection::ConstPointer do_category_names() const;
+
+ virtual QualifiedPackageNameCollection::ConstPointer do_package_names(
+ const CategoryNamePart &) const;
+
+ virtual VersionSpecCollection::ConstPointer do_version_specs(
+ const QualifiedPackageName &) const;
+
+ virtual bool do_has_version(const QualifiedPackageName &, const VersionSpec &) const;
+
+ virtual VersionMetadata::ConstPointer do_version_metadata(
+ const QualifiedPackageName &,
+ const VersionSpec &) const;
+
+ virtual bool do_is_licence(const std::string &) const;
+
+ virtual void do_install(const QualifiedPackageName &, const VersionSpec &,
+ const InstallOptions &) const;
+
+ virtual DepAtom::Pointer do_package_set(const SetName &) const;
+
+ virtual SetsCollection::ConstPointer sets_list() const;
+
+ virtual bool do_sync() const;
+
+ public:
+ virtual RepositoryInfo::ConstPointer info(bool verbose) const;
+
+ GemsRepository(const GemsRepositoryParams &);
+ ~GemsRepository();
+
+ virtual void invalidate() const;
+ virtual void regenerate_cache() const;
+
+ typedef CountedPtr<GemsRepository, count_policy::InternalCountTag> Pointer;
+ typedef CountedPtr<const GemsRepository, count_policy::InternalCountTag> ConstPointer;
+ };
+}
+
+#endif
diff --git a/paludis/repositories/gems/gems_repository.sr b/paludis/repositories/gems/gems_repository.sr
new file mode 100644
index 0000000..6aa2d23
--- /dev/null
+++ b/paludis/repositories/gems/gems_repository.sr
@@ -0,0 +1,18 @@
+#!/bin/bash
+# vim: set sw=4 sts=4 et :
+
+make_class_GemsRepositoryParams()
+{
+ key environment "const Environment *"
+ key package_database "const PackageDatabase *"
+ key location FSEntry
+ key distdir FSEntry
+ key sync std::string
+ key sync_exclude std::string
+ key root FSEntry
+ key buildroot FSEntry
+
+ allow_named_args
+}
+
+
diff --git a/paludis/repositories/gems/gems_repository_TEST.cc b/paludis/repositories/gems/gems_repository_TEST.cc
new file mode 100644
index 0000000..d8d7fc1
--- /dev/null
+++ b/paludis/repositories/gems/gems_repository_TEST.cc
@@ -0,0 +1,51 @@
+/* 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/gems_repository.hh>
+#include <paludis/repositories/gems/make_gems_repository.hh>
+#include <paludis/util/collection_concrete.hh>
+#include <paludis/environment/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;
+ AssociativeCollection<std::string, std::string>::Pointer keys(
+ new AssociativeCollection<std::string, std::string>::Concrete);
+ keys->insert("format", "gems");
+ keys->insert("location", "gems_repository_TEST_dir/repo1");
+ GemsRepository::Pointer repo(make_gems_repository(
+ &env, env.package_database().raw_pointer(), 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
new file mode 100755
index 0000000..5d20e5c
--- /dev/null
+++ b/paludis/repositories/gems/gems_repository_TEST_cleanup.sh
@@ -0,0 +1,9 @@
+#!/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
new file mode 100755
index 0000000..ada6cd8
--- /dev/null
+++ b/paludis/repositories/gems/gems_repository_TEST_setup.sh
@@ -0,0 +1,5 @@
+#!/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
new file mode 100644
index 0000000..9f11f1c
--- /dev/null
+++ b/paludis/repositories/gems/gems_repository_exceptions.cc
@@ -0,0 +1,30 @@
+/* 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)
+{
+}
+
+
diff --git a/paludis/repositories/gems/gems_repository_exceptions.hh b/paludis/repositories/gems/gems_repository_exceptions.hh
new file mode 100644
index 0000000..55bce82
--- /dev/null
+++ b/paludis/repositories/gems/gems_repository_exceptions.hh
@@ -0,0 +1,38 @@
+/* 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 ();
+ };
+}
+
+#endif
diff --git a/paludis/repositories/gems/make_gems_repository.cc b/paludis/repositories/gems/make_gems_repository.cc
new file mode 100644
index 0000000..6010a3b
--- /dev/null
+++ b/paludis/repositories/gems/make_gems_repository.cc
@@ -0,0 +1,70 @@
+/* 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 "make_gems_repository.hh"
+#include <paludis/repositories/gems/gems_repository_exceptions.hh>
+
+using namespace paludis;
+
+Repository::Pointer
+paludis::make_gems_repository(const Environment * const env,
+ const PackageDatabase * const db,
+ AssociativeCollection<std::string, std::string>::ConstPointer 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 sync;
+ if (m->end() != m->find("sync"))
+ sync = m->find("sync")->second;
+
+ std::string sync_exclude;
+ if (m->end() != m->find("sync_exclude"))
+ sync_exclude = m->find("sync_exclude")->second;
+
+ std::string root;
+ if (m->end() == m->find("root") || ((root = m->find("root")->second)).empty())
+ root = "/";
+
+ std::string buildroot;
+ if (m->end() == m->find("buildroot") || ((buildroot = m->find("buildroot")->second)).empty())
+ buildroot = "/var/tmp/paludis";
+
+ return Repository::Pointer(new GemsRepository(GemsRepositoryParams::create()
+ .environment(env)
+ .package_database(db)
+ .location(location)
+ .distdir(distdir)
+ .sync(sync)
+ .sync_exclude(sync_exclude)
+ .root(root)
+ .buildroot(buildroot)));
+
+}
+
diff --git a/paludis/repositories/gems/make_gems_repository.hh b/paludis/repositories/gems/make_gems_repository.hh
new file mode 100644
index 0000000..fb86584
--- /dev/null
+++ b/paludis/repositories/gems/make_gems_repository.hh
@@ -0,0 +1,33 @@
+/* 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_MAKE_GEMS_REPOSITORY_HH
+#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_GEMS_MAKE_GEMS_REPOSITORY_HH 1
+
+#include <paludis/repositories/gems/gems_repository.hh>
+
+namespace paludis
+{
+ Repository::Pointer
+ make_gems_repository(const Environment * const,
+ const PackageDatabase * const,
+ AssociativeCollection<std::string, std::string>::ConstPointer) PALUDIS_VISIBLE;
+}
+
+#endif