aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-12-17 19:49:42 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-12-17 19:49:42 +0000
commit1ee6e1e1783173f3761f7edaf02f2767cfe2bf4f (patch)
tree77d27df41528436de2013de69bed3bf8c3c1c348
parent44bb89ba473f74171d056f6b8ed085d827bca015 (diff)
downloadpaludis-1ee6e1e1783173f3761f7edaf02f2767cfe2bf4f.tar.gz
paludis-1ee6e1e1783173f3761f7edaf02f2767cfe2bf4f.tar.xz
Use less rams
-rw-r--r--paludis/repositories/e/e_installed_repository_id.cc65
-rw-r--r--paludis/repositories/e/ebuild_id.cc83
2 files changed, 77 insertions, 71 deletions
diff --git a/paludis/repositories/e/e_installed_repository_id.cc b/paludis/repositories/e/e_installed_repository_id.cc
index e6edae5..d5d612a 100644
--- a/paludis/repositories/e/e_installed_repository_id.cc
+++ b/paludis/repositories/e/e_installed_repository_id.cc
@@ -38,6 +38,7 @@
#include <paludis/util/return_literal_function.hh>
#include <paludis/util/make_null_shared_ptr.hh>
#include <paludis/util/fs_stat.hh>
+#include <paludis/util/singleton-impl.hh>
#include <paludis/name.hh>
#include <paludis/version_spec.hh>
@@ -110,6 +111,30 @@ namespace
std::shared_ptr<const MetadataValueKey<std::string> > pkgmanager;
std::shared_ptr<const MetadataValueKey<std::string> > vdb_format;
};
+
+
+ struct EInstalledRepositoryIDData :
+ Singleton<EInstalledRepositoryIDData>
+ {
+ std::shared_ptr<DependenciesLabelSequence> raw_dependencies_labels;
+ std::shared_ptr<DependenciesLabelSequence> build_dependencies_labels;
+ std::shared_ptr<DependenciesLabelSequence> run_dependencies_labels;
+ std::shared_ptr<DependenciesLabelSequence> post_dependencies_labels;
+
+ EInstalledRepositoryIDData() :
+ raw_dependencies_labels(std::make_shared<DependenciesLabelSequence>()),
+ build_dependencies_labels(std::make_shared<DependenciesLabelSequence>()),
+ run_dependencies_labels(std::make_shared<DependenciesLabelSequence>()),
+ post_dependencies_labels(std::make_shared<DependenciesLabelSequence>())
+ {
+ raw_dependencies_labels->push_back(std::make_shared<DependenciesBuildLabel>("build", return_literal_function(true)));
+ raw_dependencies_labels->push_back(std::make_shared<DependenciesRunLabel>("run", return_literal_function(true)));
+
+ build_dependencies_labels->push_back(std::make_shared<DependenciesBuildLabel>("DEPEND", return_literal_function(true)));
+ run_dependencies_labels->push_back(std::make_shared<DependenciesRunLabel>("RDEPEND", return_literal_function(true)));
+ post_dependencies_labels->push_back(std::make_shared<DependenciesPostLabel>("PDEPEND", return_literal_function(true)));
+ }
+ };
}
namespace paludis
@@ -131,11 +156,6 @@ namespace paludis
std::shared_ptr<const MetadataValueKey<FSPath> > fs_location;
std::shared_ptr<const EAPI> eapi;
- std::shared_ptr<DependenciesLabelSequence> raw_dependencies_labels;
- std::shared_ptr<DependenciesLabelSequence> build_dependencies_labels;
- std::shared_ptr<DependenciesLabelSequence> run_dependencies_labels;
- std::shared_ptr<DependenciesLabelSequence> post_dependencies_labels;
-
Imp(const QualifiedPackageName & q, const VersionSpec & v,
const Environment * const e,
const std::shared_ptr<const Repository> r, const FSPath & f) :
@@ -143,23 +163,8 @@ namespace paludis
version(v),
environment(e),
repository(r),
- dir(f),
- raw_dependencies_labels(std::make_shared<DependenciesLabelSequence>()),
- build_dependencies_labels(std::make_shared<DependenciesLabelSequence>()),
- run_dependencies_labels(std::make_shared<DependenciesLabelSequence>()),
- post_dependencies_labels(std::make_shared<DependenciesLabelSequence>())
+ dir(f)
{
- raw_dependencies_labels->push_back(std::make_shared<DependenciesBuildLabel>("build",
- return_literal_function(true)));
- raw_dependencies_labels->push_back(std::make_shared<DependenciesRunLabel>("run",
- return_literal_function(true)));
-
- build_dependencies_labels->push_back(std::make_shared<DependenciesBuildLabel>("DEPEND",
- return_literal_function(true)));
- run_dependencies_labels->push_back(std::make_shared<DependenciesRunLabel>("RDEPEND",
- return_literal_function(true)));
- post_dependencies_labels->push_back(std::make_shared<DependenciesPostLabel>("PDEPEND",
- return_literal_function(true)));
}
};
}
@@ -331,19 +336,23 @@ EInstalledRepositoryID::need_keys_added() const
raw_deps->top()->accept(rewriter);
_imp->keys->raw_dependencies = std::make_shared<EDependenciesKey>(_imp->environment, shared_from_this(), vars->dependencies()->name(),
- vars->dependencies()->description(), raw_deps_str, _imp->build_dependencies_labels, mkt_dependencies);
+ vars->dependencies()->description(), raw_deps_str,
+ EInstalledRepositoryIDData::get_instance()->build_dependencies_labels, mkt_dependencies);
add_metadata_key(_imp->keys->raw_dependencies);
_imp->keys->build_dependencies = std::make_shared<EDependenciesKey>(_imp->environment, shared_from_this(), vars->dependencies()->name() + ".DEPEND",
- vars->dependencies()->description() + " (build)", rewriter.depend(), _imp->build_dependencies_labels, mkt_internal);
+ vars->dependencies()->description() + " (build)", rewriter.depend(),
+ EInstalledRepositoryIDData::get_instance()->build_dependencies_labels, mkt_internal);
add_metadata_key(_imp->keys->build_dependencies);
_imp->keys->run_dependencies = std::make_shared<EDependenciesKey>(_imp->environment, shared_from_this(), vars->dependencies()->name() + ".RDEPEND",
- vars->dependencies()->description() + " (run)", rewriter.rdepend(), _imp->build_dependencies_labels, mkt_internal);
+ vars->dependencies()->description() + " (run)", rewriter.rdepend(),
+ EInstalledRepositoryIDData::get_instance()->run_dependencies_labels, mkt_internal);
add_metadata_key(_imp->keys->run_dependencies);
_imp->keys->post_dependencies = std::make_shared<EDependenciesKey>(_imp->environment, shared_from_this(), vars->dependencies()->name() + ".PDEPEND",
- vars->dependencies()->description() + " (post)", rewriter.pdepend(), _imp->build_dependencies_labels, mkt_internal);
+ vars->dependencies()->description() + " (post)", rewriter.pdepend(),
+ EInstalledRepositoryIDData::get_instance()->post_dependencies_labels, mkt_internal);
add_metadata_key(_imp->keys->post_dependencies);
}
}
@@ -354,7 +363,7 @@ EInstalledRepositoryID::need_keys_added() const
{
_imp->keys->build_dependencies = std::make_shared<EDependenciesKey>(_imp->environment, shared_from_this(), vars->build_depend()->name(),
vars->build_depend()->description(), file_contents(_imp->dir / vars->build_depend()->name()),
- _imp->build_dependencies_labels, mkt_dependencies);
+ EInstalledRepositoryIDData::get_instance()->build_dependencies_labels, mkt_dependencies);
add_metadata_key(_imp->keys->build_dependencies);
}
@@ -363,7 +372,7 @@ EInstalledRepositoryID::need_keys_added() const
{
_imp->keys->run_dependencies = std::make_shared<EDependenciesKey>(_imp->environment, shared_from_this(), vars->run_depend()->name(),
vars->run_depend()->description(), file_contents(_imp->dir / vars->run_depend()->name()),
- _imp->run_dependencies_labels, mkt_dependencies);
+ EInstalledRepositoryIDData::get_instance()->run_dependencies_labels, mkt_dependencies);
add_metadata_key(_imp->keys->run_dependencies);
}
@@ -372,7 +381,7 @@ EInstalledRepositoryID::need_keys_added() const
{
_imp->keys->post_dependencies = std::make_shared<EDependenciesKey>(_imp->environment, shared_from_this(), vars->pdepend()->name(),
vars->pdepend()->description(), file_contents(_imp->dir / vars->pdepend()->name()),
- _imp->post_dependencies_labels, mkt_dependencies);
+ EInstalledRepositoryIDData::get_instance()->post_dependencies_labels, mkt_dependencies);
add_metadata_key(_imp->keys->post_dependencies);
}
}
diff --git a/paludis/repositories/e/ebuild_id.cc b/paludis/repositories/e/ebuild_id.cc
index 3ae177b..28509b6 100644
--- a/paludis/repositories/e/ebuild_id.cc
+++ b/paludis/repositories/e/ebuild_id.cc
@@ -72,6 +72,40 @@
using namespace paludis;
using namespace paludis::erepository;
+namespace
+{
+ struct EbuildIDData :
+ Singleton<EbuildIDData>
+ {
+ std::shared_ptr<Set<std::string> > pbin_behaviours_value;
+ std::shared_ptr<LiteralMetadataStringSetKey> pbin_behaviours_key;
+
+ std::shared_ptr<DependenciesLabelSequence> raw_dependencies_labels;
+ std::shared_ptr<DependenciesLabelSequence> build_dependencies_labels;
+ std::shared_ptr<DependenciesLabelSequence> run_dependencies_labels;
+ std::shared_ptr<DependenciesLabelSequence> post_dependencies_labels;
+
+ EbuildIDData() :
+ pbin_behaviours_value(std::make_shared<Set<std::string>>()),
+ pbin_behaviours_key(std::make_shared<LiteralMetadataStringSetKey>("behaviours", "behaviours", mkt_internal, pbin_behaviours_value)),
+ raw_dependencies_labels(std::make_shared<DependenciesLabelSequence>()),
+ build_dependencies_labels(std::make_shared<DependenciesLabelSequence>()),
+ run_dependencies_labels(std::make_shared<DependenciesLabelSequence>()),
+ post_dependencies_labels(std::make_shared<DependenciesLabelSequence>())
+ {
+ pbin_behaviours_value->insert("unbinaryable");
+ pbin_behaviours_value->insert("binary");
+
+ raw_dependencies_labels->push_back(std::make_shared<DependenciesBuildLabel>("build", return_literal_function(true)));
+ raw_dependencies_labels->push_back(std::make_shared<DependenciesRunLabel>("run", return_literal_function(true)));
+
+ build_dependencies_labels->push_back(std::make_shared<DependenciesBuildLabel>("DEPEND", return_literal_function(true)));
+ run_dependencies_labels->push_back(std::make_shared<DependenciesRunLabel>("RDEPEND", return_literal_function(true)));
+ post_dependencies_labels->push_back(std::make_shared<DependenciesPostLabel>("PDEPEND", return_literal_function(true)));
+ }
+ };
+}
+
namespace paludis
{
template <>
@@ -130,10 +164,6 @@ namespace paludis
mutable std::shared_ptr<const LiteralMetadataValueKey<std::string> > generated_using;
mutable std::shared_ptr<const LiteralMetadataStringSetKey> behaviours;
- std::shared_ptr<DependenciesLabelSequence> raw_dependencies_labels;
- std::shared_ptr<DependenciesLabelSequence> build_dependencies_labels;
- std::shared_ptr<DependenciesLabelSequence> run_dependencies_labels;
- std::shared_ptr<DependenciesLabelSequence> post_dependencies_labels;
Imp(const QualifiedPackageName & q, const VersionSpec & v,
const Environment * const e,
@@ -148,23 +178,8 @@ namespace paludis
master_mtime(t),
eclass_mtimes(m),
has_keys(false),
- has_masks(false),
- raw_dependencies_labels(std::make_shared<DependenciesLabelSequence>()),
- build_dependencies_labels(std::make_shared<DependenciesLabelSequence>()),
- run_dependencies_labels(std::make_shared<DependenciesLabelSequence>()),
- post_dependencies_labels(std::make_shared<DependenciesLabelSequence>())
+ has_masks(false)
{
- raw_dependencies_labels->push_back(std::make_shared<DependenciesBuildLabel>("build",
- return_literal_function(true)));
- raw_dependencies_labels->push_back(std::make_shared<DependenciesRunLabel>("run",
- return_literal_function(true)));
-
- build_dependencies_labels->push_back(std::make_shared<DependenciesBuildLabel>("DEPEND",
- return_literal_function(true)));
- run_dependencies_labels->push_back(std::make_shared<DependenciesRunLabel>("RDEPEND",
- return_literal_function(true)));
- post_dependencies_labels->push_back(std::make_shared<DependenciesPostLabel>("PDEPEND",
- return_literal_function(true)));
}
};
}
@@ -185,24 +200,6 @@ EbuildID::~EbuildID()
{
}
-namespace
-{
- struct PbinBehaviours :
- Singleton<PbinBehaviours>
- {
- std::shared_ptr<Set<std::string> > behaviours_value;
- std::shared_ptr<LiteralMetadataStringSetKey> behaviours_key;
-
- PbinBehaviours() :
- behaviours_value(std::make_shared<Set<std::string>>()),
- behaviours_key(std::make_shared<LiteralMetadataStringSetKey>("behaviours", "behaviours", mkt_internal, behaviours_value))
- {
- behaviours_value->insert("unbinaryable");
- behaviours_value->insert("binary");
- }
- };
-}
-
void
EbuildID::need_keys_added() const
{
@@ -421,7 +418,7 @@ EbuildID::need_keys_added() const
if (_imp->eapi->supported()->is_pbin())
{
- _imp->behaviours = PbinBehaviours::get_instance()->behaviours_key;
+ _imp->behaviours = EbuildIDData::get_instance()->pbin_behaviours_key;
add_metadata_key(_imp->behaviours);
}
}
@@ -962,7 +959,7 @@ EbuildID::load_raw_depend(const std::string & r, const std::string & h, const st
{
Lock l(_imp->mutex);
_imp->raw_dependencies = std::make_shared<EDependenciesKey>(_imp->environment, shared_from_this(), r, h, v,
- _imp->raw_dependencies_labels, mkt_dependencies);
+ EbuildIDData::get_instance()->raw_dependencies_labels, mkt_dependencies);
add_metadata_key(_imp->raw_dependencies);
}
@@ -972,7 +969,7 @@ EbuildID::load_build_depend(const std::string & r, const std::string & h, const
{
Lock l(_imp->mutex);
_imp->build_dependencies = std::make_shared<EDependenciesKey>(_imp->environment, shared_from_this(), r, h, v,
- _imp->build_dependencies_labels, rewritten ? mkt_internal : mkt_dependencies);
+ EbuildIDData::get_instance()->build_dependencies_labels, rewritten ? mkt_internal : mkt_dependencies);
add_metadata_key(_imp->build_dependencies);
}
@@ -982,7 +979,7 @@ EbuildID::load_run_depend(const std::string & r, const std::string & h, const st
{
Lock l(_imp->mutex);
_imp->run_dependencies = std::make_shared<EDependenciesKey>(_imp->environment, shared_from_this(), r, h, v,
- _imp->run_dependencies_labels, rewritten ? mkt_internal : mkt_dependencies);
+ EbuildIDData::get_instance()->run_dependencies_labels, rewritten ? mkt_internal : mkt_dependencies);
add_metadata_key(_imp->run_dependencies);
}
@@ -992,7 +989,7 @@ EbuildID::load_post_depend(const std::string & r, const std::string & h, const s
{
Lock l(_imp->mutex);
_imp->post_dependencies = std::make_shared<EDependenciesKey>(_imp->environment, shared_from_this(), r, h, v,
- _imp->post_dependencies_labels, rewritten ? mkt_internal : mkt_dependencies);
+ EbuildIDData::get_instance()->post_dependencies_labels, rewritten ? mkt_internal : mkt_dependencies);
add_metadata_key(_imp->post_dependencies);
}