aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-05-12 09:47:22 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-05-12 09:47:22 +0100
commit1a7ae61f7a12aeb10ff385bd3f30942016f87aec (patch)
tree9676be6947ff0e466fcef48971a4ad8321f27b87
parent458d13e0d8723bdf723d0406a41a8d30ab1aff01 (diff)
downloadpaludis-1a7ae61f7a12aeb10ff385bd3f30942016f87aec.tar.gz
paludis-1a7ae61f7a12aeb10ff385bd3f30942016f87aec.tar.xz
R^2, with no functionality
-rw-r--r--configure.ac4
-rw-r--r--paludis/Makefile.am.m41
-rw-r--r--paludis/repositories/repository/Makefile.am25
-rw-r--r--paludis/repositories/repository/registration.cc62
-rw-r--r--paludis/repositories/repository/repository_id.cc288
-rw-r--r--paludis/repositories/repository/repository_id.hh112
-rw-r--r--paludis/repositories/repository/repository_repository-fwd.hh31
-rw-r--r--paludis/repositories/repository/repository_repository.cc333
-rw-r--r--paludis/repositories/repository/repository_repository.hh133
-rw-r--r--paludis/repositories/repository/repository_repository_store.cc163
-rw-r--r--paludis/repositories/repository/repository_repository_store.hh73
-rw-r--r--paludis/repository_factory.cc3
-rw-r--r--vim/ftdetect/paludis.vim5
-rw-r--r--vim/syntax/paludis-repositories-conf.vim45
14 files changed, 1260 insertions, 18 deletions
diff --git a/configure.ac b/configure.ac
index 5fd58ba..0d8aa1a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1270,7 +1270,7 @@ AC_SUBST([VIM_INSTALL_DIR])
dnl }}}
dnl {{{ repositories
-m4_define(ALL_REPOSITORIES_m4, [accounts,cran,e,fake,gems,unavailable,unpackaged,unwritten,virtuals])
+m4_define(ALL_REPOSITORIES_m4, [accounts,cran,e,fake,gems,repository,unavailable,unpackaged,unwritten,virtuals])
ALL_REPOSITORIES=`echo ALL_REPOSITORIES_m4 | tr , ' '`
DEFAULT_REPOSITORIES="e fake unavailable unpackaged unwritten virtuals"
AC_MSG_CHECKING([which repositories to build...])
@@ -1285,6 +1285,7 @@ AC_ARG_WITH([repositories],
e Ebuild, Ebin, Exheres, VDB etc
fake A fake repository for test cases and adjutrix
gems Ruby gems (unusable)
+ repository Automatic repository config generation (via 'unavailable')
unavailable Unavailable
unpackaged Unpackaged (for importare)
unwritten Unwritten
@@ -1622,6 +1623,7 @@ AC_OUTPUT(
paludis/repositories/e/ebuild/utils/exheres-0/Makefile
paludis/repositories/fake/Makefile
paludis/repositories/gems/Makefile
+ paludis/repositories/repository/Makefile
paludis/repositories/unavailable/Makefile
paludis/repositories/unpackaged/Makefile
paludis/repositories/unwritten/Makefile
diff --git a/paludis/Makefile.am.m4 b/paludis/Makefile.am.m4
index 6f0cc45..6661e5c 100644
--- a/paludis/Makefile.am.m4
+++ b/paludis/Makefile.am.m4
@@ -117,6 +117,7 @@ condrepo(dummy)
condrepo(e)
condrepo(fake)
condrepo(gems)
+condrepo(repository)
condrepo(unavailable)
condrepo(unpackaged)
condrepo(unwritten)
diff --git a/paludis/repositories/repository/Makefile.am b/paludis/repositories/repository/Makefile.am
new file mode 100644
index 0000000..05dd33f
--- /dev/null
+++ b/paludis/repositories/repository/Makefile.am
@@ -0,0 +1,25 @@
+include $(top_srcdir)/misc/common-makefile.am
+
+SUBDIRS = .
+
+AM_CXXFLAGS = -I$(top_srcdir) -I$(top_builddir) @PALUDIS_CXXFLAGS@ @PALUDIS_CXXFLAGS_VISIBILITY@
+DEFS= \
+ -DSYSCONFDIR=\"$(sysconfdir)\" \
+ -DLIBEXECDIR=\"$(libexecdir)\" \
+ -DDATADIR=\"$(datadir)\" \
+ -DLIBDIR=\"$(libdir)\"
+
+noinst_LTLIBRARIES = libpaludisrepositoryrepository.la
+
+noinst_HEADERS = \
+ repository_id.hh \
+ repository_repository.hh repository_repository-fwd.hh \
+ repository_repository_store.hh
+
+libpaludisrepositoryrepository_la_SOURCES = \
+ repository_id.cc \
+ repository_repository.cc \
+ repository_repository_store.cc \
+ registration.cc \
+ $(noinst_HEADERS)
+
diff --git a/paludis/repositories/repository/registration.cc b/paludis/repositories/repository/registration.cc
new file mode 100644
index 0000000..89b7210
--- /dev/null
+++ b/paludis/repositories/repository/registration.cc
@@ -0,0 +1,62 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2010 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/repository_factory.hh>
+#include <paludis/repositories/repository/repository_repository.hh>
+#include <paludis/util/set.hh>
+#include <paludis/util/destringify.hh>
+#include "config.h"
+
+using namespace paludis;
+using namespace paludis::repository_repository;
+
+namespace
+{
+ int generic_importance(const Environment * const, const std::tr1::function<std::string (const std::string &)> & f)
+ {
+ if (! f("importance").empty())
+ return destringify<int>(f("importance"));
+ else
+ return 1;
+ }
+}
+
+namespace paludis
+{
+ namespace repository_groups
+ {
+ REPOSITORY_GROUPS_DECLS;
+ }
+
+ template <>
+ void register_repositories<repository_groups::repository>(const repository_groups::repository * const,
+ RepositoryFactory * const factory)
+ {
+ std::tr1::shared_ptr<Set<std::string> > repository_formats(new Set<std::string>);
+ repository_formats->insert("repository");
+
+ factory->add_repository_format(repository_formats,
+ &RepositoryRepository::repository_factory_name,
+ &generic_importance,
+ &RepositoryRepository::repository_factory_create,
+ &RepositoryRepository::repository_factory_dependencies
+ );
+ }
+}
+
diff --git a/paludis/repositories/repository/repository_id.cc b/paludis/repositories/repository/repository_id.cc
new file mode 100644
index 0000000..c152fcf
--- /dev/null
+++ b/paludis/repositories/repository/repository_id.cc
@@ -0,0 +1,288 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2010 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/repository/repository_id.hh>
+#include <paludis/repositories/repository/repository_repository.hh>
+#include <paludis/util/private_implementation_pattern-impl.hh>
+#include <paludis/util/stringify.hh>
+#include <paludis/util/simple_visitor_cast.hh>
+#include <paludis/util/set.hh>
+#include <paludis/util/make_shared_ptr.hh>
+#include <paludis/util/hashes.hh>
+#include <paludis/util/wrapped_forward_iterator.hh>
+#include <paludis/name.hh>
+#include <paludis/version_spec.hh>
+#include <paludis/metadata_key.hh>
+#include <paludis/literal_metadata_key.hh>
+#include <paludis/action.hh>
+#include <paludis/unchoices_key.hh>
+#include <paludis/user_dep_spec.hh>
+
+using namespace paludis;
+using namespace paludis::repository_repository;
+
+namespace paludis
+{
+ template <>
+ struct Implementation<RepositoryID>
+ {
+ const Environment * const env;
+ const QualifiedPackageName name;
+ const VersionSpec version;
+ const RepositoryRepository * const repo;
+
+ Implementation(const RepositoryIDParams & e) :
+ env(e.environment()),
+ name(e.name()),
+ version("0", VersionSpecOptions()),
+ repo(e.repository())
+ {
+ }
+ };
+}
+
+RepositoryID::RepositoryID(const RepositoryIDParams & entry) :
+ PrivateImplementationPattern<RepositoryID>(new Implementation<RepositoryID>(entry)),
+ _imp(PrivateImplementationPattern<RepositoryID>::_imp)
+{
+}
+
+RepositoryID::~RepositoryID()
+{
+}
+
+void
+RepositoryID::need_keys_added() const
+{
+}
+
+void
+RepositoryID::need_masks_added() const
+{
+}
+
+const std::string
+RepositoryID::canonical_form(const PackageIDCanonicalForm f) const
+{
+ switch (f)
+ {
+ case idcf_full:
+ return stringify(_imp->name) + "-" + stringify(_imp->version) +
+ "::" + stringify(_imp->repo->name());
+
+ case idcf_no_version:
+ return stringify(_imp->name) + "::" + stringify(_imp->repo->name());
+
+ case idcf_version:
+ return stringify(_imp->version);
+
+ case idcf_no_name:
+ return stringify(_imp->version) + "::" + stringify(_imp->repo->name());
+
+ case last_idcf:
+ break;
+ }
+
+ throw InternalError(PALUDIS_HERE, "Bad PackageIDCanonicalForm");
+}
+
+PackageDepSpec
+RepositoryID::uniquely_identifying_spec() const
+{
+ return parse_user_package_dep_spec("=" + stringify(name()) + "-" + stringify(version()) +
+ + "::" + stringify(repository()->name()),
+ _imp->env, UserPackageDepSpecOptions());
+}
+
+const QualifiedPackageName
+RepositoryID::name() const
+{
+ return _imp->name;
+}
+
+const VersionSpec
+RepositoryID::version() const
+{
+ return _imp->version;
+}
+
+const std::tr1::shared_ptr<const Repository>
+RepositoryID::repository() const
+{
+ return _imp->repo->shared_from_this();
+}
+
+bool
+RepositoryID::supports_action(const SupportsActionTestBase &) const
+{
+ return false;
+}
+
+void
+RepositoryID::perform_action(Action & a) const
+{
+ throw ActionFailedError("Unsupported action: " + a.simple_name());
+}
+
+std::tr1::shared_ptr<const Set<std::string> >
+RepositoryID::breaks_portage() const
+{
+ return make_shared_ptr(new Set<std::string>);
+}
+
+bool
+RepositoryID::arbitrary_less_than_comparison(const PackageID &) const
+{
+ return false;
+}
+
+std::size_t
+RepositoryID::extra_hash_value() const
+{
+ return 0;
+}
+
+const std::tr1::shared_ptr<const MetadataCollectionKey<PackageIDSequence> >
+RepositoryID::contains_key() const
+{
+ return std::tr1::shared_ptr<const MetadataCollectionKey<PackageIDSequence> >();
+}
+
+const std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const PackageID> > >
+RepositoryID::contained_in_key() const
+{
+ return std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const PackageID> > >();
+}
+
+const std::tr1::shared_ptr<const MetadataValueKey<FSEntry> >
+RepositoryID::fs_location_key() const
+{
+ return std::tr1::shared_ptr<const MetadataValueKey<FSEntry> >();
+}
+
+const std::tr1::shared_ptr<const MetadataValueKey<bool> >
+RepositoryID::transient_key() const
+{
+ return std::tr1::shared_ptr<const MetadataValueKey<bool> >();
+}
+
+const std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const PackageID> > >
+RepositoryID::virtual_for_key() const
+{
+ return std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const PackageID> > >();
+}
+
+const std::tr1::shared_ptr<const MetadataCollectionKey<KeywordNameSet> >
+RepositoryID::keywords_key() const
+{
+ return std::tr1::shared_ptr<const MetadataCollectionKey<KeywordNameSet> >();
+}
+
+const std::tr1::shared_ptr<const MetadataSpecTreeKey<ProvideSpecTree> >
+RepositoryID::provide_key() const
+{
+ return std::tr1::shared_ptr<const MetadataSpecTreeKey<ProvideSpecTree> >();
+}
+
+const std::tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> >
+RepositoryID::dependencies_key() const
+{
+ return std::tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> >();
+}
+
+const std::tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> >
+RepositoryID::build_dependencies_key() const
+{
+ return std::tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> >();
+}
+
+const std::tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> >
+RepositoryID::run_dependencies_key() const
+{
+ return std::tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> >();
+}
+
+const std::tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> >
+RepositoryID::post_dependencies_key() const
+{
+ return std::tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> >();
+}
+
+const std::tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> >
+RepositoryID::suggested_dependencies_key() const
+{
+ return std::tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> >();
+}
+
+const std::tr1::shared_ptr<const MetadataValueKey<std::string> >
+RepositoryID::short_description_key() const
+{
+ return make_null_shared_ptr();
+}
+
+const std::tr1::shared_ptr<const MetadataValueKey<std::string> >
+RepositoryID::long_description_key() const
+{
+ return std::tr1::shared_ptr<const MetadataValueKey<std::string> >();
+}
+
+const std::tr1::shared_ptr<const MetadataSpecTreeKey<FetchableURISpecTree> >
+RepositoryID::fetches_key() const
+{
+ return std::tr1::shared_ptr<const MetadataSpecTreeKey<FetchableURISpecTree> >();
+}
+
+const std::tr1::shared_ptr<const MetadataSpecTreeKey<SimpleURISpecTree> >
+RepositoryID::homepage_key() const
+{
+ return std::tr1::shared_ptr<const MetadataSpecTreeKey<SimpleURISpecTree> >();
+}
+
+const std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const Contents> > >
+RepositoryID::contents_key() const
+{
+ return std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const Contents> > >();
+}
+
+const std::tr1::shared_ptr<const MetadataTimeKey>
+RepositoryID::installed_time_key() const
+{
+ return std::tr1::shared_ptr<const MetadataTimeKey>();
+}
+
+const std::tr1::shared_ptr<const MetadataCollectionKey<Set<std::string> > >
+RepositoryID::from_repositories_key() const
+{
+ return make_null_shared_ptr();
+}
+
+const std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const Choices> > >
+RepositoryID::choices_key() const
+{
+ return make_null_shared_ptr();
+}
+
+const std::tr1::shared_ptr<const MetadataValueKey<SlotName> >
+RepositoryID::slot_key() const
+{
+ return make_null_shared_ptr();
+}
+
+template class PrivateImplementationPattern<RepositoryID>;
+
diff --git a/paludis/repositories/repository/repository_id.hh b/paludis/repositories/repository/repository_id.hh
new file mode 100644
index 0000000..398c60e
--- /dev/null
+++ b/paludis/repositories/repository/repository_id.hh
@@ -0,0 +1,112 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2010 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
+ */
+
+#ifndef PALUDIS_GUARD_PALUDIS_REPOSITORIES_REPOSITORY_REPOSITORY_ID_HH
+#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_REPOSITORY_REPOSITORY_ID_HH 1
+
+#include <paludis/repositories/repository/repository_repository-fwd.hh>
+#include <paludis/util/named_value.hh>
+#include <paludis/package_id.hh>
+#include <paludis/name.hh>
+
+namespace paludis
+{
+ namespace n
+ {
+ struct environment;
+ struct name;
+ struct repository;
+ }
+
+ namespace repository_repository
+ {
+ struct RepositoryIDParams
+ {
+ NamedValue<n::environment, const Environment *> environment;
+ NamedValue<n::name, QualifiedPackageName> name;
+ NamedValue<n::repository, const RepositoryRepository *> repository;
+ };
+
+ class PALUDIS_VISIBLE RepositoryID :
+ public PackageID,
+ private PrivateImplementationPattern<RepositoryID>
+ {
+ private:
+ PrivateImplementationPattern<RepositoryID>::ImpPtr & _imp;
+
+ protected:
+ void need_keys_added() const;
+ void need_masks_added() const;
+
+ public:
+ RepositoryID(const RepositoryIDParams &);
+ ~RepositoryID();
+
+ const std::string canonical_form(const PackageIDCanonicalForm) const;
+ const QualifiedPackageName name() const;
+ const VersionSpec version() const;
+ const std::tr1::shared_ptr<const Repository> repository() const;
+ virtual PackageDepSpec uniquely_identifying_spec() const;
+
+ const std::tr1::shared_ptr<const MetadataValueKey<SlotName> > slot_key() const;
+ const std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const PackageID> > >
+ virtual_for_key() const;
+ const std::tr1::shared_ptr<const MetadataCollectionKey<KeywordNameSet> > keywords_key() const;
+ const std::tr1::shared_ptr<const MetadataSpecTreeKey<ProvideSpecTree> > provide_key() const;
+ const std::tr1::shared_ptr<const MetadataCollectionKey<PackageIDSequence> > contains_key() const;
+ const std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const PackageID> > >
+ contained_in_key() const;
+ const std::tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> >
+ dependencies_key() const;
+ const std::tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> >
+ build_dependencies_key() const;
+ const std::tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> >
+ run_dependencies_key() const;
+ const std::tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> >
+ post_dependencies_key() const;
+ const std::tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> >
+ suggested_dependencies_key() const;
+ const std::tr1::shared_ptr<const MetadataSpecTreeKey<FetchableURISpecTree> > fetches_key() const;
+ const std::tr1::shared_ptr<const MetadataSpecTreeKey<SimpleURISpecTree> > homepage_key() const;
+ const std::tr1::shared_ptr<const MetadataValueKey<std::string> > short_description_key() const;
+ const std::tr1::shared_ptr<const MetadataValueKey<std::string> > long_description_key() const;
+ const std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const Contents> > >
+ contents_key() const;
+ const std::tr1::shared_ptr<const MetadataTimeKey> installed_time_key() const;
+ const std::tr1::shared_ptr<const MetadataValueKey<FSEntry> > fs_location_key() const;
+ const std::tr1::shared_ptr<const MetadataValueKey<bool> > transient_key() const;
+ const std::tr1::shared_ptr<const MetadataCollectionKey<Set<std::string> > > from_repositories_key() const;
+ const std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const Choices> > > choices_key() const;
+
+ bool supports_action(const SupportsActionTestBase &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+ void perform_action(Action &) const PALUDIS_ATTRIBUTE((noreturn));
+
+ std::tr1::shared_ptr<const Set<std::string> > breaks_portage() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ bool arbitrary_less_than_comparison(const PackageID &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+ std::size_t extra_hash_value() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+ };
+ }
+}
+
+#endif
diff --git a/paludis/repositories/repository/repository_repository-fwd.hh b/paludis/repositories/repository/repository_repository-fwd.hh
new file mode 100644
index 0000000..ca31529
--- /dev/null
+++ b/paludis/repositories/repository/repository_repository-fwd.hh
@@ -0,0 +1,31 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2010 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
+ */
+
+#ifndef PALUDIS_GUARD_PALUDIS_REPOSITORIES_REPOSITORY_REPOSITORY_REPOSITORY_FWD_HH
+#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_REPOSITORY_REPOSITORY_REPOSITORY_FWD_HH 1
+
+namespace paludis
+{
+ namespace repository_repository
+ {
+ class RepositoryRepository;
+ }
+}
+
+#endif
diff --git a/paludis/repositories/repository/repository_repository.cc b/paludis/repositories/repository/repository_repository.cc
new file mode 100644
index 0000000..eb99dce
--- /dev/null
+++ b/paludis/repositories/repository/repository_repository.cc
@@ -0,0 +1,333 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2010 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/repository/repository_repository.hh>
+#include <paludis/repositories/repository/repository_repository_store.hh>
+#include <paludis/util/private_implementation_pattern-impl.hh>
+#include <paludis/util/active_object_ptr.hh>
+#include <paludis/util/deferred_construction_ptr.hh>
+#include <paludis/util/stringify.hh>
+#include <paludis/util/tokeniser.hh>
+#include <paludis/util/make_named_values.hh>
+#include <paludis/literal_metadata_key.hh>
+#include <paludis/action.hh>
+#include <paludis/syncer.hh>
+#include <paludis/hook.hh>
+#include <list>
+
+using namespace paludis;
+using namespace paludis::repository_repository;
+
+namespace
+{
+ std::tr1::shared_ptr<RepositoryRepositoryStore>
+ make_store(const RepositoryRepository * const repo, const RepositoryRepositoryParams & p)
+ {
+ return make_shared_ptr(new RepositoryRepositoryStore(p.environment(), repo));
+ }
+}
+
+namespace paludis
+{
+ template <>
+ struct Implementation<RepositoryRepository>
+ {
+ const RepositoryRepositoryParams params;
+
+ const std::tr1::shared_ptr<LiteralMetadataValueKey<std::string> > format_key;
+ const std::tr1::shared_ptr<LiteralMetadataValueKey<std::string> > config_filename_key;
+ const std::tr1::shared_ptr<LiteralMetadataValueKey<std::string> > config_template_key;
+ const std::tr1::shared_ptr<LiteralMetadataValueKey<FSEntry> > installed_root_key;
+
+ const ActiveObjectPtr<DeferredConstructionPtr<
+ std::tr1::shared_ptr<RepositoryRepositoryStore> > > store;
+
+ Implementation(const RepositoryRepository * const repo, const RepositoryRepositoryParams & p) :
+ params(p),
+ format_key(new LiteralMetadataValueKey<std::string> ("format", "format",
+ mkt_significant, "repository")),
+ config_filename_key(new LiteralMetadataValueKey<std::string> (
+ "config_filename", "config_filename", mkt_normal, params.config_filename())),
+ config_template_key(new LiteralMetadataValueKey<std::string> (
+ "config_template", "config_template", mkt_normal, params.config_template())),
+ installed_root_key(new LiteralMetadataValueKey<FSEntry>("root", "root", mkt_normal, p.root())),
+ store(DeferredConstructionPtr<std::tr1::shared_ptr<RepositoryRepositoryStore> > (
+ std::tr1::bind(&make_store, repo, std::tr1::cref(params))))
+ {
+ }
+ };
+}
+
+RepositoryRepositoryConfigurationError::RepositoryRepositoryConfigurationError(const std::string & s) throw () :
+ ConfigurationError("RepositoryRepository configuration error: " + s)
+{
+}
+
+RepositoryRepository::RepositoryRepository(const RepositoryRepositoryParams & p) :
+ PrivateImplementationPattern<RepositoryRepository>(new Implementation<RepositoryRepository>(this, p)),
+ Repository(
+ p.environment(),
+ p.name(),
+ make_named_values<RepositoryCapabilities>(
+ value_for<n::destination_interface>(static_cast<RepositoryDestinationInterface *>(0)),
+ value_for<n::environment_variable_interface>(static_cast<RepositoryEnvironmentVariableInterface *>(0)),
+ value_for<n::make_virtuals_interface>(static_cast<RepositoryMakeVirtualsInterface *>(0)),
+ value_for<n::manifest_interface>(static_cast<RepositoryManifestInterface *>(0)),
+ value_for<n::provides_interface>(static_cast<RepositoryProvidesInterface *>(0)),
+ value_for<n::virtuals_interface>(static_cast<RepositoryVirtualsInterface *>(0))
+ )),
+ _imp(PrivateImplementationPattern<RepositoryRepository>::_imp)
+{
+ _add_metadata_keys();
+}
+
+RepositoryRepository::~RepositoryRepository()
+{
+}
+
+bool
+RepositoryRepository::can_be_favourite_repository() const
+{
+ return false;
+}
+
+const bool
+RepositoryRepository::is_unimportant() const
+{
+ return true;
+}
+
+void
+RepositoryRepository::_add_metadata_keys()
+{
+ clear_metadata_keys();
+ add_metadata_key(_imp->format_key);
+ add_metadata_key(_imp->config_filename_key);
+ add_metadata_key(_imp->config_template_key);
+ add_metadata_key(_imp->installed_root_key);
+}
+
+void
+RepositoryRepository::need_keys_added() const
+{
+}
+
+const std::tr1::shared_ptr<const MetadataValueKey<std::string> >
+RepositoryRepository::format_key() const
+{
+ return _imp->format_key;
+}
+
+const std::tr1::shared_ptr<const MetadataValueKey<FSEntry> >
+RepositoryRepository::location_key() const
+{
+ return make_null_shared_ptr();
+}
+
+const std::tr1::shared_ptr<const MetadataValueKey<FSEntry> >
+RepositoryRepository::installed_root_key() const
+{
+ return _imp->installed_root_key;
+}
+
+void
+RepositoryRepository::invalidate()
+{
+ _imp.reset(new Implementation<RepositoryRepository>(this, _imp->params));
+ _add_metadata_keys();
+}
+
+void
+RepositoryRepository::invalidate_masks()
+{
+}
+
+bool
+RepositoryRepository::has_category_named(const CategoryNamePart & c) const
+{
+ return _imp->store->has_category_named(c);
+}
+
+bool
+RepositoryRepository::has_package_named(const QualifiedPackageName & q) const
+{
+ return _imp->store->has_package_named(q);
+}
+
+std::tr1::shared_ptr<const CategoryNamePartSet>
+RepositoryRepository::category_names() const
+{
+ return _imp->store->category_names();
+}
+
+std::tr1::shared_ptr<const CategoryNamePartSet>
+RepositoryRepository::unimportant_category_names() const
+{
+ return _imp->store->unimportant_category_names();
+}
+
+std::tr1::shared_ptr<const CategoryNamePartSet>
+RepositoryRepository::category_names_containing_package(const PackageNamePart & p) const
+{
+ return Repository::category_names_containing_package(p);
+}
+
+std::tr1::shared_ptr<const QualifiedPackageNameSet>
+RepositoryRepository::package_names(const CategoryNamePart & c) const
+{
+ return _imp->store->package_names(c);
+}
+
+std::tr1::shared_ptr<const PackageIDSequence>
+RepositoryRepository::package_ids(const QualifiedPackageName & p) const
+{
+ return _imp->store->package_ids(p);
+}
+
+namespace
+{
+ struct SupportsActionQuery
+ {
+ bool visit(const SupportsActionTest<InstallAction> &) const
+ {
+ return false;
+ }
+
+ bool visit(const SupportsActionTest<FetchAction> &) const
+ {
+ return false;
+ }
+
+ bool visit(const SupportsActionTest<PretendFetchAction> &) const
+ {
+ return false;
+ }
+
+ bool visit(const SupportsActionTest<ConfigAction> &) const
+ {
+ return false;
+ }
+
+ bool visit(const SupportsActionTest<PretendAction> &) const
+ {
+ return false;
+ }
+
+ bool visit(const SupportsActionTest<InfoAction> &) const
+ {
+ return false;
+ }
+
+ bool visit(const SupportsActionTest<UninstallAction> &) const
+ {
+ return false;
+ }
+ };
+}
+
+bool
+RepositoryRepository::some_ids_might_support_action(const SupportsActionTestBase & a) const
+{
+ SupportsActionQuery q;
+ return a.accept_returning<bool>(q);
+}
+
+bool
+RepositoryRepository::sync(const std::tr1::shared_ptr<OutputManager> &) const
+{
+ return false;
+}
+
+std::tr1::shared_ptr<Repository>
+RepositoryRepository::repository_factory_create(
+ Environment * const env,
+ const std::tr1::function<std::string (const std::string &)> & f)
+{
+ Context context("When making repository repository from repo_file '" + f("repo_file") + "':");
+
+ std::string name_str(f("name"));
+ if (name_str.empty())
+ name_str = "repository";
+
+ std::string config_filename(f("config_filename"));
+ if (config_filename.empty())
+ throw RepositoryRepositoryConfigurationError("Key 'config_filename' not specified or empty");
+
+ std::string config_template(f("config_template"));
+ if (config_template.empty())
+ throw RepositoryRepositoryConfigurationError("Key 'config_template' not specified or empty");
+
+ std::string root_str(f("root"));
+ if (root_str.empty())
+ root_str = "/";
+
+ return std::tr1::shared_ptr<RepositoryRepository>(new RepositoryRepository(
+ make_named_values<RepositoryRepositoryParams>(
+ value_for<n::config_filename>(config_filename),
+ value_for<n::config_template>(config_template),
+ value_for<n::environment>(env),
+ value_for<n::name>(RepositoryName(name_str)),
+ value_for<n::root>(root_str)
+ )));
+}
+
+RepositoryName
+RepositoryRepository::repository_factory_name(
+ const Environment * const,
+ const std::tr1::function<std::string (const std::string &)> & f)
+{
+ if (f("name").empty())
+ return RepositoryName("repository");
+ else
+ return RepositoryName(f("name"));
+}
+
+std::tr1::shared_ptr<const RepositoryNameSet>
+RepositoryRepository::repository_factory_dependencies(
+ const Environment * const,
+ const std::tr1::function<std::string (const std::string &)> &)
+{
+ return make_shared_ptr(new RepositoryNameSet);
+}
+
+void
+RepositoryRepository::populate_sets() const
+{
+}
+
+HookResult
+RepositoryRepository::perform_hook(const Hook &)
+{
+ return make_named_values<HookResult>(value_for<n::max_exit_status>(0), value_for<n::output>(""));
+}
+
+const std::tr1::shared_ptr<const MetadataValueKey<std::string> >
+RepositoryRepository::accept_keywords_key() const
+{
+ return make_null_shared_ptr();
+}
+
+const std::tr1::shared_ptr<const MetadataValueKey<std::string> >
+RepositoryRepository::sync_host_key() const
+{
+ return make_null_shared_ptr();
+}
+
+template class PrivateImplementationPattern<repository_repository::RepositoryRepository>;
+
diff --git a/paludis/repositories/repository/repository_repository.hh b/paludis/repositories/repository/repository_repository.hh
new file mode 100644
index 0000000..c7f893a
--- /dev/null
+++ b/paludis/repositories/repository/repository_repository.hh
@@ -0,0 +1,133 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2010 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
+ */
+
+#ifndef PALUDIS_GUARD_PALUDIS_REPOSITORIES_REPOSITORY_REPOSITORY_REPOSITORY_HH
+#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_REPOSITORY_REPOSITORY_REPOSITORY_HH 1
+
+#include <paludis/repositories/repository/repository_repository-fwd.hh>
+#include <paludis/repository.hh>
+#include <paludis/util/private_implementation_pattern.hh>
+#include <paludis/util/attributes.hh>
+
+namespace paludis
+{
+ namespace n
+ {
+ struct config_filename;
+ struct config_template;
+ struct environment;
+ struct name;
+ struct root;
+ }
+
+ namespace repository_repository
+ {
+ class PALUDIS_VISIBLE RepositoryRepositoryConfigurationError :
+ public ConfigurationError
+ {
+ public:
+ RepositoryRepositoryConfigurationError(const std::string &) throw ();
+ };
+
+ struct RepositoryRepositoryParams
+ {
+ NamedValue<n::config_filename, std::string> config_filename;
+ NamedValue<n::config_template, std::string> config_template;
+ NamedValue<n::environment, Environment *> environment;
+ NamedValue<n::name, RepositoryName> name;
+ NamedValue<n::root, FSEntry> root;
+ };
+
+ class PALUDIS_VISIBLE RepositoryRepository :
+ private PrivateImplementationPattern<RepositoryRepository>,
+ public Repository,
+ public std::tr1::enable_shared_from_this<RepositoryRepository>
+ {
+ private:
+ PrivateImplementationPattern<RepositoryRepository>::ImpPtr & _imp;
+
+ void _add_metadata_keys();
+
+ protected:
+ virtual void need_keys_added() const;
+
+ public:
+ RepositoryRepository(const RepositoryRepositoryParams &);
+ ~RepositoryRepository();
+
+ virtual bool can_be_favourite_repository() const;
+
+ virtual const bool is_unimportant() const;
+
+ virtual const std::tr1::shared_ptr<const MetadataValueKey<std::string> > format_key() const;
+ virtual const std::tr1::shared_ptr<const MetadataValueKey<FSEntry> > location_key() const;
+ virtual const std::tr1::shared_ptr<const MetadataValueKey<FSEntry> > installed_root_key() const;
+ virtual const std::tr1::shared_ptr<const MetadataValueKey<std::string> > accept_keywords_key() const;
+ virtual const std::tr1::shared_ptr<const MetadataValueKey<std::string> > sync_host_key() const;
+
+ virtual bool has_category_named(const CategoryNamePart & c) const;
+ virtual bool has_package_named(const QualifiedPackageName & q) const;
+ virtual std::tr1::shared_ptr<const CategoryNamePartSet> category_names() const;
+ virtual std::tr1::shared_ptr<const CategoryNamePartSet> unimportant_category_names() const;
+ virtual std::tr1::shared_ptr<const CategoryNamePartSet> category_names_containing_package(
+ const PackageNamePart & p) const;
+ virtual std::tr1::shared_ptr<const QualifiedPackageNameSet> package_names(
+ const CategoryNamePart & c) const;
+ virtual std::tr1::shared_ptr<const PackageIDSequence> package_ids(const QualifiedPackageName & p) const;
+
+ virtual bool some_ids_might_support_action(const SupportsActionTestBase &) const;
+ virtual void invalidate();
+ virtual void invalidate_masks();
+
+ virtual bool sync(const std::tr1::shared_ptr<OutputManager> &) const;
+
+ ///\name RepositoryFactory functions
+ ///\{
+
+ static RepositoryName repository_factory_name(
+ const Environment * const env,
+ const std::tr1::function<std::string (const std::string &)> &);
+
+ static std::tr1::shared_ptr<Repository> repository_factory_create(
+ Environment * const env,
+ const std::tr1::function<std::string (const std::string &)> &);
+
+ static std::tr1::shared_ptr<const RepositoryNameSet> repository_factory_dependencies(
+ const Environment * const env,
+ const std::tr1::function<std::string (const std::string &)> &);
+
+ ///\}
+
+ ///\name Set methods
+ ///\{
+
+ virtual void populate_sets() const;
+
+ ///\}
+
+ virtual HookResult perform_hook(const Hook & hook);
+ };
+ }
+
+#ifdef PALUDIS_HAVE_EXTERN_TEMPLATE
+ extern template class PrivateImplementationPattern<repository_repository::RepositoryRepository>;
+#endif
+}
+
+#endif
diff --git a/paludis/repositories/repository/repository_repository_store.cc b/paludis/repositories/repository/repository_repository_store.cc
new file mode 100644
index 0000000..efea44d
--- /dev/null
+++ b/paludis/repositories/repository/repository_repository_store.cc
@@ -0,0 +1,163 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2010 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/repository/repository_repository_store.hh>
+#include <paludis/repositories/repository/repository_id.hh>
+#include <paludis/util/private_implementation_pattern-impl.hh>
+#include <paludis/util/fs_entry.hh>
+#include <paludis/util/stringify.hh>
+#include <paludis/util/set.hh>
+#include <paludis/util/sequence.hh>
+#include <paludis/util/hashes.hh>
+#include <paludis/util/make_shared_ptr.hh>
+#include <paludis/util/is_file_with_extension.hh>
+#include <paludis/util/log.hh>
+#include <paludis/util/make_named_values.hh>
+#include <paludis/name.hh>
+#include <paludis/version_spec.hh>
+#include <paludis/literal_metadata_key.hh>
+#include <paludis/environment.hh>
+#include <paludis/package_database.hh>
+#include <tr1/functional>
+#include <tr1/unordered_map>
+#include <algorithm>
+#include <set>
+
+using namespace paludis;
+using namespace paludis::repository_repository;
+
+typedef std::tr1::unordered_map<CategoryNamePart,
+ std::tr1::shared_ptr<QualifiedPackageNameSet>,
+ Hash<CategoryNamePart> > PackageNames;
+
+typedef std::tr1::unordered_map<QualifiedPackageName,
+ std::tr1::shared_ptr<PackageIDSequence>,
+ Hash<QualifiedPackageName> > IDs;
+
+namespace paludis
+{
+ template <>
+ struct Implementation<RepositoryRepositoryStore>
+ {
+ const Environment * const env;
+ const RepositoryRepository * const repo;
+ mutable std::tr1::shared_ptr<CategoryNamePartSet> categories;
+ mutable PackageNames package_names;
+ mutable IDs ids;
+
+ Implementation(const Environment * const e, const RepositoryRepository * const r) :
+ env(e),
+ repo(r),
+ categories(new CategoryNamePartSet)
+ {
+ }
+ };
+}
+
+RepositoryRepositoryStore::RepositoryRepositoryStore(
+ const Environment * const env,
+ const RepositoryRepository * const repo) :
+ PrivateImplementationPattern<RepositoryRepositoryStore>(new Implementation<RepositoryRepositoryStore>(env, repo))
+{
+ _populate();
+}
+
+RepositoryRepositoryStore::~RepositoryRepositoryStore()
+{
+}
+
+void
+RepositoryRepositoryStore::_populate()
+{
+ for (PackageDatabase::RepositoryConstIterator r(_imp->env->package_database()->begin_repositories()),
+ r_end(_imp->env->package_database()->end_repositories()) ; r != r_end ; ++r)
+ _populate_one((*r)->name());
+}
+
+void
+RepositoryRepositoryStore::_populate_one(const RepositoryName & repo_name)
+{
+ const std::tr1::shared_ptr<RepositoryID> id(new RepositoryID(make_named_values<RepositoryIDParams>(
+ value_for<n::environment>(_imp->env),
+ value_for<n::name>(CategoryNamePart("repository") + PackageNamePart(stringify(repo_name))),
+ value_for<n::repository>(_imp->repo)
+ )));
+
+ _imp->categories->insert(id->name().category());
+
+ PackageNames::iterator p(_imp->package_names.find(id->name().category()));
+ if (_imp->package_names.end() == p)
+ p = _imp->package_names.insert(std::make_pair(id->name().category(),
+ make_shared_ptr(new QualifiedPackageNameSet))).first;
+ p->second->insert(id->name());
+
+ IDs::iterator i(_imp->ids.find(id->name()));
+ if (_imp->ids.end() == i)
+ i = _imp->ids.insert(std::make_pair(id->name(), make_shared_ptr(new PackageIDSequence))).first;
+ i->second->push_back(id);
+}
+
+bool
+RepositoryRepositoryStore::has_category_named(const CategoryNamePart & c) const
+{
+ return _imp->categories->end() != _imp->categories->find(c);
+}
+
+bool
+RepositoryRepositoryStore::has_package_named(const QualifiedPackageName & q) const
+{
+ return _imp->ids.end() != _imp->ids.find(q);
+}
+
+std::tr1::shared_ptr<const CategoryNamePartSet>
+RepositoryRepositoryStore::category_names() const
+{
+ return _imp->categories;
+}
+
+std::tr1::shared_ptr<const CategoryNamePartSet>
+RepositoryRepositoryStore::unimportant_category_names() const
+{
+ std::tr1::shared_ptr<CategoryNamePartSet> result(make_shared_ptr(new CategoryNamePartSet));
+ result->insert(CategoryNamePart("repository"));
+ return result;
+}
+
+std::tr1::shared_ptr<const QualifiedPackageNameSet>
+RepositoryRepositoryStore::package_names(const CategoryNamePart & c) const
+{
+ PackageNames::iterator p(_imp->package_names.find(c));
+ if (_imp->package_names.end() == p)
+ return make_shared_ptr(new QualifiedPackageNameSet);
+ else
+ return p->second;
+}
+
+std::tr1::shared_ptr<const PackageIDSequence>
+RepositoryRepositoryStore::package_ids(const QualifiedPackageName & p) const
+{
+ IDs::iterator i(_imp->ids.find(p));
+ if (_imp->ids.end() == i)
+ return make_shared_ptr(new PackageIDSequence);
+ else
+ return i->second;
+}
+
+template class PrivateImplementationPattern<repository_repository::RepositoryRepositoryStore>;
+
diff --git a/paludis/repositories/repository/repository_repository_store.hh b/paludis/repositories/repository/repository_repository_store.hh
new file mode 100644
index 0000000..1a847c6
--- /dev/null
+++ b/paludis/repositories/repository/repository_repository_store.hh
@@ -0,0 +1,73 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2010 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
+ */
+
+#ifndef PALUDIS_GUARD_PALUDIS_REPOSITORIES_REPOSITORY_REPOSITORY_REPOSITORY_STORE_HH
+#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_REPOSITORY_REPOSITORY_REPOSITORY_STORE_HH 1
+
+#include <paludis/repositories/repository/repository_repository-fwd.hh>
+#include <paludis/util/private_implementation_pattern.hh>
+#include <paludis/util/fs_entry-fwd.hh>
+#include <paludis/name-fwd.hh>
+#include <paludis/package_id-fwd.hh>
+#include <paludis/environment-fwd.hh>
+#include <tr1/memory>
+
+namespace paludis
+{
+ namespace repository_repository
+ {
+ class PALUDIS_VISIBLE RepositoryRepositoryStore :
+ private PrivateImplementationPattern<RepositoryRepositoryStore>
+ {
+ private:
+ void _populate();
+ void _populate_one(const RepositoryName &);
+
+ public:
+ RepositoryRepositoryStore(
+ const Environment * const,
+ const RepositoryRepository * const);
+ ~RepositoryRepositoryStore();
+
+ bool has_category_named(const CategoryNamePart &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ bool has_package_named(const QualifiedPackageName & q) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ std::tr1::shared_ptr<const CategoryNamePartSet> category_names() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ std::tr1::shared_ptr<const CategoryNamePartSet> unimportant_category_names() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ std::tr1::shared_ptr<const QualifiedPackageNameSet> package_names(
+ const CategoryNamePart & c) const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ std::tr1::shared_ptr<const PackageIDSequence> package_ids(
+ const QualifiedPackageName & p) const PALUDIS_ATTRIBUTE((warn_unused_result));
+ };
+ }
+
+#ifdef PALUDIS_HAVE_EXTERN_TEMPLATE
+ extern template class PrivateImplementationPattern<repository_repository::RepositoryRepositoryStore>;
+#endif
+}
+
+#endif
diff --git a/paludis/repository_factory.cc b/paludis/repository_factory.cc
index 4a66e57..1818c0b 100644
--- a/paludis/repository_factory.cc
+++ b/paludis/repository_factory.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2008, 2009 Ciaran McCreesh
+ * Copyright (c) 2008, 2009, 2010 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
@@ -123,6 +123,7 @@ RepositoryFactory::RepositoryFactory() :
register_repositories(static_cast<const TypeOrNoType<REPOSITORY_GROUP_IF_e>::Type *>(0), this);
register_repositories(static_cast<const TypeOrNoType<REPOSITORY_GROUP_IF_gems>::Type *>(0), this);
register_repositories(static_cast<const TypeOrNoType<REPOSITORY_GROUP_IF_fake>::Type *>(0), this);
+ register_repositories(static_cast<const TypeOrNoType<REPOSITORY_GROUP_IF_repository>::Type *>(0), this);
register_repositories(static_cast<const TypeOrNoType<REPOSITORY_GROUP_IF_unavailable>::Type *>(0), this);
register_repositories(static_cast<const TypeOrNoType<REPOSITORY_GROUP_IF_unwritten>::Type *>(0), this);
register_repositories(static_cast<const TypeOrNoType<REPOSITORY_GROUP_IF_unpackaged>::Type *>(0), this);
diff --git a/vim/ftdetect/paludis.vim b/vim/ftdetect/paludis.vim
index 56e0b8d..9c430ff 100644
--- a/vim/ftdetect/paludis.vim
+++ b/vim/ftdetect/paludis.vim
@@ -1,7 +1,7 @@
" Vim filetype detection file
" Language: Paludis Things
" Author: Ciaran McCreesh
-" Copyright: Copyright (c) 2007 Ciaran McCreesh
+" Copyright: Copyright (c) 2007, 2010 Ciaran McCreesh
" Licence: You may redistribute this under the same terms as Vim itself
"
" Filetype detection for Paludis things.
@@ -71,6 +71,9 @@ au BufNewFile,BufRead **/options.conf.d/*.conf
au BufNewFile,BufRead repository_defaults.conf
\ set filetype=paludis-repositories-conf
+au BufNewFile,BufRead repository.template
+ \ set filetype=paludis-repositories-conf
+
au BufNewFile,BufRead **/repositories/*.conf
\ set filetype=paludis-repositories-conf
diff --git a/vim/syntax/paludis-repositories-conf.vim b/vim/syntax/paludis-repositories-conf.vim
index 3626c6a..0cece02 100644
--- a/vim/syntax/paludis-repositories-conf.vim
+++ b/vim/syntax/paludis-repositories-conf.vim
@@ -1,7 +1,7 @@
" Vim syntax file
" Language: Paludis repositories/*.conf files
" Author: Ciaran McCreesh
-" Copyright: Copyright (c) 2007, 2008, 2009 Ciaran McCreesh
+" Copyright: Copyright (c) 2007, 2008, 2009, 2010 Ciaran McCreesh
" Licence: You may redistribute this under the same terms as Vim itself
"
" Syntax highlighting for Paludis repositories/*.conf files.
@@ -26,16 +26,18 @@ syn match PaludisRepositoriesConfEquals /=/ skipwhite
syn region PaludisRepositoriesConfValue contained start=// end=/$/
\ contains=PaludisRepositoriesConfString,PaludisRepositoriesConfUnquoted,
\ PaludisRepositoriesConfContinuation,PaludisRepositoriesConfVariable,
- \ PaludisRepositoriesConfKnownValue
+ \ PaludisRepositoriesConfBadTemplateVariable,PaludisRepositoriesConfMacro,
+ \ PaludisRepositoriesConfBadMacro,PaludisRepositoriesConfKnownValue
\ skipwhite
syn match PaludisRepositoriesConfContinuation contained /\\$/
\ skipnl
-syn match PaludisRepositoriesConfUnquoted contained /[^ \t$"'\\]\+/ skipwhite
+syn match PaludisRepositoriesConfUnquoted contained /[^ \t$%"'\\]\+/ skipwhite
syn region PaludisRepositoriesConfString contained start=/"/ end=/"/
- \ contains=PaludisRepositoriesConfVariable
+ \ contains=PaludisRepositoriesConfVariable,PaludisRepositoriesConfBadTemplateVariable,
+ \ PaludisRepositoriesConfMacro,PaludisRepositoriesConfBadMacro
\ skipwhite
syn keyword PaludisRepositoriesConfKnownKey contained
@@ -45,7 +47,7 @@ syn keyword PaludisRepositoriesConfKnownKey contained
\ provides_cache importance layout use_manifest
\ binary_uri_prefix binary_keywords binary_destination binary_distdir
\ eapi_when_unspecified eapi_when_unknown profile_eapi_when_unspecified
- \ name handler
+ \ name handler config_template config_filename
syn keyword PaludisRepositoriesConfBadKey contained
\ world
@@ -53,16 +55,29 @@ syn keyword PaludisRepositoriesConfBadKey contained
syn keyword PaludisRepositoriesConfKnownValue contained
\ use require ignore
-syn match PaludisRepositoriesConfVariable contained /\$\({[^}]\+}\|[a-zA-Z0-9_]\+\)/ skipwhite
-
-hi def link PaludisRepositoriesConfKnownKey Keyword
-hi def link PaludisRepositoriesConfBadKey Error
-hi def link PaludisRepositoriesConfKnownValue Keyword
-hi def link PaludisRepositoriesConfString String
-hi def link PaludisRepositoriesConfUnquoted Constant
-hi def link PaludisRepositoriesConfVariable Identifier
-hi def link PaludisRepositoriesConfContinuation Preproc
-hi def link PaludisRepositoriesConfComment Comment
+syn match PaludisRepositoriesConfVariable contained
+ \ /\$\({\(repository_template\)\@![^}]\+}\|\(repository_template\)\@![a-zA-Z0-9_]\+\)/ skipwhite
+
+syn match PaludisRepositoriesConfBadTemplateVariable contained
+ \ /\$\({repository_template[^}]*}\|repository_template[a-zA-Z0-9_]*\)/ skipwhite
+
+syn match PaludisRepositoriesConfMacro contained
+ \ /%\({repository_template[^}]*}\|repository_template[a-zA-Z0-9_]\*\)/ skipwhite
+
+syn match PaludisRepositoriesConfBadMacro contained
+ \ /%\({\(repository_template\)\@![^}]\+}\|\(repository_template\)\@![a-zA-Z0-9_]\+\)/ skipwhite
+
+hi def link PaludisRepositoriesConfKnownKey Keyword
+hi def link PaludisRepositoriesConfBadKey Error
+hi def link PaludisRepositoriesConfKnownValue Keyword
+hi def link PaludisRepositoriesConfString String
+hi def link PaludisRepositoriesConfUnquoted Constant
+hi def link PaludisRepositoriesConfVariable Identifier
+hi def link PaludisRepositoriesConfBadTemplateVariable Error
+hi def link PaludisRepositoriesConfMacro Macro
+hi def link PaludisRepositoriesConfBadMacro Error
+hi def link PaludisRepositoriesConfContinuation Preproc
+hi def link PaludisRepositoriesConfComment Comment
let b:current_syntax = "paludis-repositories-conf"