aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-07-29 23:21:40 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-07-29 23:21:40 +0000
commit8e82dd8f89b63c33ae18ad91c093a245395ccc1d (patch)
tree3905d1bb5590c5a11d81244c38dae816651a5e31
parent99a97e0d49f7ecd4c060659940be99454f29383f (diff)
downloadpaludis-8e82dd8f89b63c33ae18ad91c093a245395ccc1d.tar.gz
paludis-8e82dd8f89b63c33ae18ad91c093a245395ccc1d.tar.xz
Use a virtual constructor for PortageRepositoryEntries
-rw-r--r--paludis/repositories/portage/portage_repository.cc7
-rw-r--r--paludis/repositories/portage/portage_repository.hh2
-rw-r--r--paludis/repositories/portage/portage_repository_ebuild_entries.cc7
-rw-r--r--paludis/repositories/portage/portage_repository_ebuild_entries.hh14
-rw-r--r--paludis/repositories/portage/portage_repository_entries.cc6
-rw-r--r--paludis/repositories/portage/portage_repository_entries.hh32
-rw-r--r--paludis/repositories/portage/portage_repository_params.hh2
7 files changed, 67 insertions, 3 deletions
diff --git a/paludis/repositories/portage/portage_repository.cc b/paludis/repositories/portage/portage_repository.cc
index d9433cb..32f968f 100644
--- a/paludis/repositories/portage/portage_repository.cc
+++ b/paludis/repositories/portage/portage_repository.cc
@@ -25,12 +25,11 @@
#include <paludis/repositories/portage/portage_repository_news.hh>
#include <paludis/repositories/portage/portage_repository_sets.hh>
#include <paludis/repositories/portage/portage_repository_exceptions.hh>
-#include <paludis/repositories/portage/portage_repository_ebuild_entries.hh>
+#include <paludis/repositories/portage/portage_repository_entries.hh>
#include <paludis/config_file.hh>
#include <paludis/dep_atom.hh>
#include <paludis/dep_atom_flattener.hh>
-#include <paludis/ebuild.hh>
#include <paludis/environment.hh>
#include <paludis/hashed_containers.hh>
#include <paludis/match_package.hh>
@@ -191,7 +190,8 @@ namespace paludis
profile_ptr(0),
news_ptr(new PortageRepositoryNews(params.get<prpk_environment>(), repo, p)),
sets_ptr(new PortageRepositorySets(params.get<prpk_environment>(), repo, p)),
- entries_ptr(new PortageRepositoryEbuildEntries(params.get<prpk_environment>(), repo, p)),
+ entries_ptr(PortageRepositoryEntriesMaker::get_instance()->find_maker(
+ params.get<prpk_entry_format>())(params.get<prpk_environment>(), repo, p)),
has_our_virtuals(false)
{
}
@@ -760,6 +760,7 @@ PortageRepository::make_portage_repository(
buildroot = "/var/tmp/paludis";
return CountedPtr<Repository>(new PortageRepository(PortageRepositoryParams::create((
+ param<prpk_entry_format>("ebuild"),
param<prpk_environment>(env),
param<prpk_package_database>(db),
param<prpk_location>(location),
diff --git a/paludis/repositories/portage/portage_repository.hh b/paludis/repositories/portage/portage_repository.hh
index 55709df..26e921a 100644
--- a/paludis/repositories/portage/portage_repository.hh
+++ b/paludis/repositories/portage/portage_repository.hh
@@ -173,6 +173,8 @@ namespace paludis
/**
* Register PortageRepository.
+ *
+ * \ingroup grpportagerepository
*/
static const RepositoryMaker::RegisterMaker register_portage_repository(
"portage", &PortageRepository::make_portage_repository);
diff --git a/paludis/repositories/portage/portage_repository_ebuild_entries.cc b/paludis/repositories/portage/portage_repository_ebuild_entries.cc
index 59bad30..917c88e 100644
--- a/paludis/repositories/portage/portage_repository_ebuild_entries.cc
+++ b/paludis/repositories/portage/portage_repository_ebuild_entries.cc
@@ -554,3 +554,10 @@ PortageRepositoryEbuildEntries::get_environment_variable(const QualifiedPackageN
return cmd.result();
}
+PortageRepositoryEbuildEntries::Pointer
+PortageRepositoryEbuildEntries::make_portage_repository_ebuild_entries(
+ const Environment * const e, PortageRepository * const r, const PortageRepositoryParams & p)
+{
+ return Pointer(new PortageRepositoryEbuildEntries(e, r, p));
+}
+
diff --git a/paludis/repositories/portage/portage_repository_ebuild_entries.hh b/paludis/repositories/portage/portage_repository_ebuild_entries.hh
index 937f5ff..97ef9d0 100644
--- a/paludis/repositories/portage/portage_repository_ebuild_entries.hh
+++ b/paludis/repositories/portage/portage_repository_ebuild_entries.hh
@@ -40,6 +40,10 @@ namespace paludis
private PrivateImplementationPattern<PortageRepositoryEbuildEntries>
{
public:
+ static PortageRepositoryEbuildEntries::Pointer
+ make_portage_repository_ebuild_entries(const Environment * const,
+ PortageRepository * const, const PortageRepositoryParams &);
+
PortageRepositoryEbuildEntries(const Environment * const,
PortageRepository * const portage_repository,
const PortageRepositoryParams &);
@@ -56,6 +60,16 @@ namespace paludis
virtual void install(const QualifiedPackageName &, const VersionSpec &,
const InstallOptions &, PortageRepositoryProfile::ConstPointer) const;
};
+
+ /**
+ * Register PortageRepositoryEbuildEntries.
+ *
+ * \ingroup grpportagerepository
+ */
+ static const PortageRepositoryEntriesMaker::RegisterMaker register_portage_repository_ebuild_entries(
+ "ebuild", &PortageRepositoryEbuildEntries::make_portage_repository_ebuild_entries);
+
+
}
#endif
diff --git a/paludis/repositories/portage/portage_repository_entries.cc b/paludis/repositories/portage/portage_repository_entries.cc
index 3abbbbb..d1bbce3 100644
--- a/paludis/repositories/portage/portage_repository_entries.cc
+++ b/paludis/repositories/portage/portage_repository_entries.cc
@@ -30,3 +30,9 @@ PortageRepositoryEntries::~PortageRepositoryEntries()
{
}
+NoSuchPortageRepositoryEntriesType::NoSuchPortageRepositoryEntriesType(const std::string & format) throw ():
+ ConfigurationError("No available maker for Portage repository entries type '" + format + "'")
+{
+}
+
+
diff --git a/paludis/repositories/portage/portage_repository_entries.hh b/paludis/repositories/portage/portage_repository_entries.hh
index 1544879..3a59a10 100644
--- a/paludis/repositories/portage/portage_repository_entries.hh
+++ b/paludis/repositories/portage/portage_repository_entries.hh
@@ -26,7 +26,9 @@
#include <paludis/version_metadata.hh>
#include <paludis/util/counted_ptr.hh>
#include <paludis/util/instantiation_policy.hh>
+#include <paludis/util/virtual_constructor.hh>
#include <paludis/repositories/portage/portage_repository_profile.hh>
+#include <paludis/repositories/portage/portage_repository_params.hh>
#include <string>
/** \file
@@ -37,6 +39,9 @@
namespace paludis
{
+ class PortageRepository;
+ class Environment;
+
class PortageRepositoryEntries :
public InternalCounted<PortageRepositoryEntries>
{
@@ -64,6 +69,33 @@ namespace paludis
virtual void install(const QualifiedPackageName &, const VersionSpec &,
const InstallOptions &, PortageRepositoryProfile::ConstPointer) const = 0;
};
+
+ /**
+ * Thrown if a repository of the specified type does not exist.
+ *
+ * \ingroup grpexceptions
+ * \ingroup grprepository
+ */
+ class NoSuchPortageRepositoryEntriesType : public ConfigurationError
+ {
+ public:
+ /**
+ * Constructor.
+ */
+ NoSuchPortageRepositoryEntriesType(const std::string & format) throw ();
+ };
+
+ /**
+ * Virtual constructor for PortageRepositoryEntries.
+ *
+ * \ingroup grprepository
+ */
+ typedef VirtualConstructor<std::string,
+ PortageRepositoryEntries::Pointer (*) (const Environment * const, PortageRepository * const,
+ const PortageRepositoryParams &),
+ virtual_constructor_not_found::ThrowException<NoSuchPortageRepositoryEntriesType> >
+ PortageRepositoryEntriesMaker;
+
}
#endif
diff --git a/paludis/repositories/portage/portage_repository_params.hh b/paludis/repositories/portage/portage_repository_params.hh
index 12bb0ad..6c8b865 100644
--- a/paludis/repositories/portage/portage_repository_params.hh
+++ b/paludis/repositories/portage/portage_repository_params.hh
@@ -42,6 +42,7 @@ namespace paludis
*/
enum PortageRepositoryParamsKeys
{
+ prpk_entry_format,
prpk_environment,
prpk_package_database,
prpk_location,
@@ -68,6 +69,7 @@ namespace paludis
struct PortageRepositoryParamsTag :
SmartRecordTag<comparison_mode::NoComparisonTag, void>,
SmartRecordKeys<PortageRepositoryParamsKeys, last_prpk>,
+ SmartRecordKey<prpk_entry_format, const std::string>,
SmartRecordKey<prpk_environment, const Environment *>,
SmartRecordKey<prpk_package_database, const PackageDatabase *>,
SmartRecordKey<prpk_location, const FSEntry>,