aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-07-28 21:52:24 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-07-28 21:52:24 +0000
commit02912ca61fe8794415c11757cc1d48b7ab794309 (patch)
tree04e500940efcc3221871b00110a9cf0417ac1078
parentf5e5425a91baba4b851a99d5fdf7de68f1df3cfc (diff)
downloadpaludis-02912ca61fe8794415c11757cc1d48b7ab794309.tar.gz
paludis-02912ca61fe8794415c11757cc1d48b7ab794309.tar.xz
r1212@snowdrop: ciaranm | 2006-07-28 22:45:23 +0100
More work on splitting up PortageRepository
-rw-r--r--paludis/repositories/portage/Makefile.am1
-rw-r--r--paludis/repositories/portage/portage_repository.cc45
-rw-r--r--paludis/repositories/portage/portage_repository.hh68
-rw-r--r--paludis/repositories/portage/portage_repository_ebuild_metadata.cc64
-rw-r--r--paludis/repositories/portage/portage_repository_ebuild_metadata.hh6
-rw-r--r--paludis/repositories/portage/portage_repository_metadata.hh2
-rw-r--r--paludis/repositories/portage/portage_repository_news.cc20
-rw-r--r--paludis/repositories/portage/portage_repository_news.hh3
-rw-r--r--paludis/repositories/portage/portage_repository_params.hh98
-rw-r--r--paludis/repositories/portage/portage_repository_sets.cc20
-rw-r--r--paludis/repositories/portage/portage_repository_sets.hh3
11 files changed, 189 insertions, 141 deletions
diff --git a/paludis/repositories/portage/Makefile.am b/paludis/repositories/portage/Makefile.am
index 9cd9938..51f4273 100644
--- a/paludis/repositories/portage/Makefile.am
+++ b/paludis/repositories/portage/Makefile.am
@@ -18,6 +18,7 @@ paludis_repositories_portage_include_HEADERS = \
portage_repository_profile.hh \
portage_repository_exceptions.hh \
portage_repository_news.hh \
+ portage_repository_params.hh \
portage_repository_sets.hh \
portage_repository_metadata.hh \
portage_repository_ebuild_metadata.hh
diff --git a/paludis/repositories/portage/portage_repository.cc b/paludis/repositories/portage/portage_repository.cc
index ad856ae..06a2684 100644
--- a/paludis/repositories/portage/portage_repository.cc
+++ b/paludis/repositories/portage/portage_repository.cc
@@ -186,7 +186,7 @@ namespace paludis
mutable MirrorMap mirrors;
/// Constructor.
- Implementation(const PortageRepositoryParams &);
+ Implementation(PortageRepository * const, const PortageRepositoryParams &);
/// Destructor.
~Implementation();
@@ -219,7 +219,8 @@ namespace paludis
bool has_our_virtuals;
};
- Implementation<PortageRepository>::Implementation(const PortageRepositoryParams & p) :
+ Implementation<PortageRepository>::Implementation(PortageRepository * const repo,
+ const PortageRepositoryParams & p) :
db(p.get<prpk_package_database>()),
env(p.get<prpk_environment>()),
location(p.get<prpk_location>()),
@@ -240,9 +241,9 @@ namespace paludis
has_arch_list(false),
has_mirrors(false),
profile_ptr(0),
- news_ptr(0),
- sets_ptr(0),
- metadata_ptr(new PortageRepositoryEbuildMetadata(cache, location)),
+ news_ptr(new PortageRepositoryNews(env, repo, p)),
+ sets_ptr(new PortageRepositorySets(env, repo, p)),
+ metadata_ptr(new PortageRepositoryEbuildMetadata(env, repo, p)),
has_our_virtuals(false)
{
}
@@ -293,7 +294,7 @@ PortageRepository::PortageRepository(const PortageRepositoryParams & p) :
param<repo_world>(static_cast<WorldInterface *>(0)),
param<repo_environment_variable>(this)
))),
- PrivateImplementationPattern<PortageRepository>(new Implementation<PortageRepository>(p))
+ PrivateImplementationPattern<PortageRepository>(new Implementation<PortageRepository>(this, p))
{
// the info_vars and info_pkgs info is only added on demand, since it's
// fairly slow to calculate.
@@ -1292,9 +1293,6 @@ PortageRepository::do_install(const QualifiedPackageName & q, const VersionSpec
DepAtom::Pointer
PortageRepository::do_package_set(const std::string & s, const PackageSetOptions & o) const
{
- if (! _imp->sets_ptr)
- _imp->sets_ptr.assign(new PortageRepositorySets(_imp->env, this));
-
if (s == "system")
{
_imp->need_profiles();
@@ -1345,9 +1343,6 @@ PortageRepository::end_provide_map() const
void
PortageRepository::update_news() const
{
- if (! _imp->news_ptr)
- _imp->news_ptr.assign(new PortageRepositoryNews(_imp->env, this));
-
_imp->news_ptr->update_news();
}
@@ -1459,12 +1454,6 @@ PortageRepository::info(bool verbose) const
}
FSEntry
-PortageRepository::news_dir() const
-{
- return _imp->newsdir;
-}
-
-FSEntry
PortageRepository::news_skip_file() const
{
return FSEntry(_imp->root / "var" / "lib" / "paludis" / "news" /
@@ -1486,21 +1475,17 @@ PortageRepository::profile_variable(const std::string & s) const
return _imp->profile_ptr->environment_variable(s);
}
-FSEntryCollection::ConstPointer
-PortageRepository::profile_locations() const
+PortageRepository::OurVirtualsIterator
+PortageRepository::end_our_virtuals() const
{
- return _imp->profile_locations;
+ need_virtual_names();
+ return OurVirtualsIterator(_imp->our_virtuals.end());
}
-FSEntry
-PortageRepository::sets_dir() const
-{
- return _imp->setsdir;
-}
-
-FSEntry
-PortageRepository::security_dir() const
+PortageRepository::OurVirtualsIterator
+PortageRepository::find_our_virtuals(const QualifiedPackageName & q) const
{
- return _imp->securitydir;
+ need_virtual_names();
+ return OurVirtualsIterator(_imp->our_virtuals.find(q));
}
diff --git a/paludis/repositories/portage/portage_repository.hh b/paludis/repositories/portage/portage_repository.hh
index 714ac2b..98a38eb 100644
--- a/paludis/repositories/portage/portage_repository.hh
+++ b/paludis/repositories/portage/portage_repository.hh
@@ -24,6 +24,7 @@
#include <paludis/util/fs_entry.hh>
#include <paludis/util/private_implementation_pattern.hh>
#include <paludis/util/smart_record.hh>
+#include <paludis/repositories/portage/portage_repository_params.hh>
#include <string>
/** \file
@@ -39,65 +40,6 @@ namespace paludis
class PortageRepositoryNews;
/**
- * Keys for PortageRepositoryParams.
- *
- * \see PortageRepositoryParams
- * \ingroup grpportagerepository
- */
- enum PortageRepositoryParamsKeys
- {
- prpk_environment,
- prpk_package_database,
- prpk_location,
- prpk_profiles,
- prpk_cache,
- prpk_distdir,
- prpk_eclassdirs,
- prpk_setsdir,
- prpk_securitydir,
- prpk_newsdir,
- prpk_sync,
- prpk_sync_exclude,
- prpk_root,
- prpk_buildroot,
- last_prpk
- };
-
- /**
- * Tag for PortageRepositoryParams.
- *
- * \see PortageRepositoryParams
- * \ingroup grpportagerepository
- */
- struct PortageRepositoryParamsTag :
- SmartRecordTag<comparison_mode::NoComparisonTag, void>,
- SmartRecordKeys<PortageRepositoryParamsKeys, last_prpk>,
- SmartRecordKey<prpk_environment, const Environment *>,
- SmartRecordKey<prpk_package_database, const PackageDatabase *>,
- SmartRecordKey<prpk_location, const FSEntry>,
- SmartRecordKey<prpk_profiles, FSEntryCollection::Pointer>,
- SmartRecordKey<prpk_cache, const FSEntry>,
- SmartRecordKey<prpk_distdir, const FSEntry>,
- SmartRecordKey<prpk_eclassdirs, FSEntryCollection::Pointer>,
- SmartRecordKey<prpk_setsdir, const FSEntry>,
- SmartRecordKey<prpk_securitydir, const FSEntry>,
- SmartRecordKey<prpk_newsdir, const FSEntry>,
- SmartRecordKey<prpk_sync, const std::string>,
- SmartRecordKey<prpk_sync_exclude, const std::string>,
- SmartRecordKey<prpk_root, const FSEntry>,
- SmartRecordKey<prpk_buildroot, const FSEntry>
- {
- };
-
- /**
- * Constructor parameters for PortageRepository.
- *
- * \see PortageRepository
- * \ingroup grpportagerepository
- */
- typedef MakeSmartRecord<PortageRepositoryParamsTag>::Type PortageRepositoryParams;
-
- /**
* A PortageRepository is a Repository that handles the layout used by
* Portage for the main Gentoo tree.
*
@@ -215,16 +157,16 @@ namespace paludis
///\name Information about PortageRepository
///\{
- FSEntry news_dir() const;
FSEntry news_skip_file() const;
FSEntry news_unread_file() const;
std::string profile_variable(const std::string &) const;
- FSEntryCollection::ConstPointer profile_locations() const;
+ typedef libwrapiter::ForwardIterator<PortageRepository, std::pair<
+ const QualifiedPackageName, PackageDepAtom::ConstPointer> > OurVirtualsIterator;
- FSEntry sets_dir() const;
- FSEntry security_dir() const;
+ OurVirtualsIterator end_our_virtuals() const;
+ OurVirtualsIterator find_our_virtuals(const QualifiedPackageName &) const;
///\}
};
diff --git a/paludis/repositories/portage/portage_repository_ebuild_metadata.cc b/paludis/repositories/portage/portage_repository_ebuild_metadata.cc
index 29ef011..c40e419 100644
--- a/paludis/repositories/portage/portage_repository_ebuild_metadata.cc
+++ b/paludis/repositories/portage/portage_repository_ebuild_metadata.cc
@@ -18,8 +18,11 @@
*/
#include <paludis/repositories/portage/portage_repository_ebuild_metadata.hh>
+#include <paludis/repositories/portage/portage_repository.hh>
+#include <paludis/ebuild.hh>
#include <paludis/portage_dep_parser.hh>
+#include <paludis/version_metadata.hh>
#include <paludis/util/fs_entry.hh>
#include <paludis/util/log.hh>
#include <paludis/util/tokeniser.hh>
@@ -35,22 +38,25 @@ namespace paludis
struct Implementation<PortageRepositoryEbuildMetadata> :
InternalCounted<Implementation<PortageRepositoryEbuildMetadata> >
{
- FSEntry cache_dir;
- FSEntry ebuild_dir;
-
- Implementation(const FSEntry & c, const FSEntry & e) :
- cache_dir(c),
- ebuild_dir(e)
+ const Environment * const environment;
+ PortageRepository * const portage_repository;
+ const PortageRepositoryParams params;
+
+ Implementation(const Environment * const e, PortageRepository * const p,
+ const PortageRepositoryParams & k) :
+ environment(e),
+ portage_repository(p),
+ params(k)
{
}
};
}
-PortageRepositoryEbuildMetadata::PortageRepositoryEbuildMetadata(const FSEntry & c,
- const FSEntry & e) :
+PortageRepositoryEbuildMetadata::PortageRepositoryEbuildMetadata(
+ const Environment * const e, PortageRepository * const p, const PortageRepositoryParams & k) :
PortageRepositoryMetadata(".ebuild"),
PrivateImplementationPattern<PortageRepositoryEbuildMetadata>(new
- Implementation<PortageRepositoryEbuildMetadata>(c, e))
+ Implementation<PortageRepositoryEbuildMetadata>(e, p, k))
{
}
@@ -64,12 +70,12 @@ PortageRepositoryEbuildMetadata::generate_version_metadata(const QualifiedPackag
{
VersionMetadata::Pointer result(new VersionMetadata::Ebuild(PortageDepParser::parse_depend));
- FSEntry cache_file(_imp->cache_dir);
+ FSEntry cache_file(_imp->params.get<prpk_cache>());
cache_file /= stringify(q.get<qpn_category>());
cache_file /= stringify(q.get<qpn_package>()) + "-" + stringify(v);
bool ok(false);
- VirtualsMap::iterator vi(_imp->our_virtuals.end());
+ PortageRepository::OurVirtualsIterator vi(_imp->portage_repository->end_our_virtuals());
if (cache_file.is_regular_file())
{
std::ifstream cache(stringify(cache_file).c_str());
@@ -98,14 +104,14 @@ PortageRepositoryEbuildMetadata::generate_version_metadata(const QualifiedPackag
time_t cache_time(cache_file.mtime());
ok = true;
- if ((_imp->ebuild_dir / stringify(q.get<qpn_category>()) /
+ if ((_imp->params.get<prpk_location>() / stringify(q.get<qpn_category>()) /
stringify(q.get<qpn_package>()) /
(stringify(q.get<qpn_package>()) + "-" + stringify(v)
+ ".ebuild")).mtime() > cache_time)
ok = false;
else
{
- FSEntry timestamp(_imp->ebuild_dir / "metadata" / "timestamp");
+ FSEntry timestamp(_imp->params.get<prpk_location>() / "metadata" / "timestamp");
if (timestamp.exists())
cache_time = timestamp.mtime();
@@ -113,8 +119,8 @@ PortageRepositoryEbuildMetadata::generate_version_metadata(const QualifiedPackag
WhitespaceTokeniser::get_instance()->tokenise(
stringify(result->get_ebuild_interface()->get<evm_inherited>()),
std::back_inserter(inherits));
- for (FSEntryCollection::Iterator e(_imp->eclassdirs->begin()),
- e_end(_imp->eclassdirs->end()) ; e != e_end ; ++e)
+ for (FSEntryCollection::Iterator e(_imp->params.get<prpk_eclassdirs>()->begin()),
+ e_end(_imp->params.get<prpk_eclassdirs>()->end()) ; e != e_end ; ++e)
for (std::list<std::string>::const_iterator i(inherits.begin()),
i_end(inherits.end()) ; i != i_end ; ++i)
{
@@ -133,9 +139,11 @@ PortageRepositoryEbuildMetadata::generate_version_metadata(const QualifiedPackag
"Couldn't read the cache file at '"
+ stringify(cache_file) + "'");
}
- else if (_imp->our_virtuals.end() != ((vi = _imp->our_virtuals.find(q))))
+ else if (_imp->portage_repository->end_our_virtuals() !=
+ ((vi = _imp->portage_repository->find_our_virtuals(q))))
{
- VersionMetadata::ConstPointer m(version_metadata(vi->second->package(), v));
+ VersionMetadata::ConstPointer m(_imp->portage_repository->version_metadata(
+ vi->second->package(), v));
result->set<vm_slot>(m->get<vm_slot>());
result->get_ebuild_interface()->set<evm_keywords>(m->get_ebuild_interface()->get<evm_keywords>());
result->set<vm_eapi>(m->get<vm_eapi>());
@@ -147,28 +155,28 @@ PortageRepositoryEbuildMetadata::generate_version_metadata(const QualifiedPackag
if (! ok)
{
- if (_imp->cache.basename() != "empty")
+ if (_imp->params.get<prpk_cache>().basename() != "empty")
Log::get_instance()->message(ll_warning, lc_no_context,
"No usable cache entry for '" + stringify(q) +
- "-" + stringify(v) + "' in '" + stringify(name()) + "'");
+ "-" + stringify(v) + "' in '" + stringify(_imp->portage_repository->name()) + "'");
- PackageDatabaseEntry e(q, v, name());
+ PackageDatabaseEntry e(q, v, _imp->portage_repository->name());
EbuildMetadataCommand cmd(EbuildCommandParams::create((
- param<ecpk_environment>(_imp->env),
+ param<ecpk_environment>(_imp->environment),
param<ecpk_db_entry>(&e),
- param<ecpk_ebuild_dir>(_imp->location / stringify(q.get<qpn_category>()) /
+ param<ecpk_ebuild_dir>(_imp->params.get<prpk_location>() / stringify(q.get<qpn_category>()) /
stringify(q.get<qpn_package>())),
- param<ecpk_files_dir>(_imp->location / stringify(q.get<qpn_category>()) /
+ param<ecpk_files_dir>(_imp->params.get<prpk_location>() / stringify(q.get<qpn_category>()) /
stringify(q.get<qpn_package>()) / "files"),
- param<ecpk_eclassdirs>(_imp->eclassdirs),
- param<ecpk_portdir>(_imp->location),
- param<ecpk_distdir>(_imp->distdir),
- param<ecpk_buildroot>(_imp->buildroot)
+ param<ecpk_eclassdirs>(_imp->params.get<prpk_eclassdirs>()),
+ param<ecpk_portdir>(_imp->params.get<prpk_location>()),
+ param<ecpk_distdir>(_imp->params.get<prpk_distdir>()),
+ param<ecpk_buildroot>(_imp->params.get<prpk_buildroot>())
)));
if (! cmd())
Log::get_instance()->message(ll_warning, lc_no_context,
"No usable metadata for '" + stringify(q)
- + "-" + stringify(v) + "' in '" + stringify(name()) + "'");
+ + "-" + stringify(v) + "' in '" + stringify(_imp->portage_repository->name()) + "'");
if (0 == ((result = cmd.metadata())))
throw InternalError(PALUDIS_HERE, "cmd.metadata() is zero pointer???");
diff --git a/paludis/repositories/portage/portage_repository_ebuild_metadata.hh b/paludis/repositories/portage/portage_repository_ebuild_metadata.hh
index 38864af..9d59959 100644
--- a/paludis/repositories/portage/portage_repository_ebuild_metadata.hh
+++ b/paludis/repositories/portage/portage_repository_ebuild_metadata.hh
@@ -21,6 +21,7 @@
#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_PORTAGE_PORTAGE_REPOSITORY_EBUILD_METADATA_HH 1
#include <paludis/repositories/portage/portage_repository_metadata.hh>
+#include <paludis/repositories/portage/portage_repository_params.hh>
#include <paludis/util/private_implementation_pattern.hh>
/** \file
@@ -32,13 +33,16 @@
namespace paludis
{
class FSEntry;
+ class PortageRepository;
class PortageRepositoryEbuildMetadata :
public PortageRepositoryMetadata,
private PrivateImplementationPattern<PortageRepositoryEbuildMetadata>
{
public:
- PortageRepositoryEbuildMetadata(const FSEntry & cache_dir, const FSEntry & ebuild_dir);
+ PortageRepositoryEbuildMetadata(const Environment * const,
+ PortageRepository * const portage_repository,
+ const PortageRepositoryParams &);
virtual ~PortageRepositoryEbuildMetadata();
diff --git a/paludis/repositories/portage/portage_repository_metadata.hh b/paludis/repositories/portage/portage_repository_metadata.hh
index 18d2f09..a7ee10d 100644
--- a/paludis/repositories/portage/portage_repository_metadata.hh
+++ b/paludis/repositories/portage/portage_repository_metadata.hh
@@ -39,7 +39,7 @@ namespace paludis
public InternalCounted<PortageRepositoryMetadata>
{
private:
- const std::string & _ext;
+ const std::string _ext;
protected:
PortageRepositoryMetadata(const std::string & ext);
diff --git a/paludis/repositories/portage/portage_repository_news.cc b/paludis/repositories/portage/portage_repository_news.cc
index d74ee33..f5915fc 100644
--- a/paludis/repositories/portage/portage_repository_news.cc
+++ b/paludis/repositories/portage/portage_repository_news.cc
@@ -42,17 +42,21 @@ namespace paludis
{
const Environment * const environment;
const PortageRepository * const portage_repository;
+ const PortageRepositoryParams params;
- Implementation(const Environment * const e, const PortageRepository * const p) :
+ Implementation(const Environment * const e, const PortageRepository * const p,
+ const PortageRepositoryParams & k) :
environment(e),
- portage_repository(p)
+ portage_repository(p),
+ params(k)
{
}
};
}
-PortageRepositoryNews::PortageRepositoryNews(const Environment * const e, const PortageRepository * const p) :
- PrivateImplementationPattern<PortageRepositoryNews>(new Implementation<PortageRepositoryNews>(e, p))
+PortageRepositoryNews::PortageRepositoryNews(const Environment * const e, const PortageRepository * const p,
+ const PortageRepositoryParams & k) :
+ PrivateImplementationPattern<PortageRepositoryNews>(new Implementation<PortageRepositoryNews>(e, p, k))
{
}
@@ -64,10 +68,10 @@ void
PortageRepositoryNews::update_news() const
{
Context context("When updating news at location '" +
- stringify(_imp->portage_repository->news_dir()) + "' for repository '" +
+ stringify(_imp->params.get<prpk_newsdir>()) + "' for repository '" +
stringify(_imp->portage_repository->name()) + "':");
- if (! _imp->portage_repository->news_dir().is_directory())
+ if (! _imp->params.get<prpk_newsdir>().is_directory())
return;
std::set<std::string> skip;
@@ -80,7 +84,7 @@ PortageRepositoryNews::update_news() const
std::copy(s.begin(), s.end(), std::inserter(skip, skip.end()));
}
- for (DirIterator d(_imp->portage_repository->news_dir()), d_end ; d != d_end ; ++d)
+ for (DirIterator d(_imp->params.get<prpk_newsdir>()), d_end ; d != d_end ; ++d)
{
Context local_context("When handling news entry '" + stringify(*d) + "':");
@@ -121,7 +125,7 @@ PortageRepositoryNews::update_news() const
if (news.begin_display_if_profile() != news.end_display_if_profile())
{
bool local_show(false);
- FSEntryCollection::ConstPointer c(_imp->portage_repository->profile_locations());
+ FSEntryCollection::ConstPointer c(_imp->params.get<prpk_profiles>());
for (FSEntryCollection::Iterator p(c->begin()), p_end(c->end()) ; p != p_end ; ++p)
{
std::string profile(strip_leading_string(strip_trailing_string(
diff --git a/paludis/repositories/portage/portage_repository_news.hh b/paludis/repositories/portage/portage_repository_news.hh
index ad8ac89..a8b3e3d 100644
--- a/paludis/repositories/portage/portage_repository_news.hh
+++ b/paludis/repositories/portage/portage_repository_news.hh
@@ -50,7 +50,8 @@ namespace paludis
///\name Basic operations
///\{
- PortageRepositoryNews(const Environment * const, const PortageRepository * const);
+ PortageRepositoryNews(const Environment * const, const PortageRepository * const,
+ const PortageRepositoryParams &);
~PortageRepositoryNews();
///\}
diff --git a/paludis/repositories/portage/portage_repository_params.hh b/paludis/repositories/portage/portage_repository_params.hh
new file mode 100644
index 0000000..12bb0ad
--- /dev/null
+++ b/paludis/repositories/portage/portage_repository_params.hh
@@ -0,0 +1,98 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk>
+ *
+ * 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_PORTAGE_PORTAGE_REPOSITORY_PARAMS_HH
+#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_PORTAGE_PORTAGE_REPOSITORY_PARAMS_HH 1
+
+#include <paludis/util/smart_record.hh>
+#include <paludis/util/fs_entry.hh>
+
+/** \file
+ * Declaration for the PortageRepositoryParams class.
+ *
+ * \ingroup grpportagerepository
+ */
+
+namespace paludis
+{
+ class Environment;
+ class PackageDatabase;
+
+ /**
+ * Keys for PortageRepositoryParams.
+ *
+ * \see PortageRepositoryParams
+ * \ingroup grpportagerepository
+ */
+ enum PortageRepositoryParamsKeys
+ {
+ prpk_environment,
+ prpk_package_database,
+ prpk_location,
+ prpk_profiles,
+ prpk_cache,
+ prpk_distdir,
+ prpk_eclassdirs,
+ prpk_setsdir,
+ prpk_securitydir,
+ prpk_newsdir,
+ prpk_sync,
+ prpk_sync_exclude,
+ prpk_root,
+ prpk_buildroot,
+ last_prpk
+ };
+
+ /**
+ * Tag for PortageRepositoryParams.
+ *
+ * \see PortageRepositoryParams
+ * \ingroup grpportagerepository
+ */
+ struct PortageRepositoryParamsTag :
+ SmartRecordTag<comparison_mode::NoComparisonTag, void>,
+ SmartRecordKeys<PortageRepositoryParamsKeys, last_prpk>,
+ SmartRecordKey<prpk_environment, const Environment *>,
+ SmartRecordKey<prpk_package_database, const PackageDatabase *>,
+ SmartRecordKey<prpk_location, const FSEntry>,
+ SmartRecordKey<prpk_profiles, FSEntryCollection::Pointer>,
+ SmartRecordKey<prpk_cache, const FSEntry>,
+ SmartRecordKey<prpk_distdir, const FSEntry>,
+ SmartRecordKey<prpk_eclassdirs, FSEntryCollection::Pointer>,
+ SmartRecordKey<prpk_setsdir, const FSEntry>,
+ SmartRecordKey<prpk_securitydir, const FSEntry>,
+ SmartRecordKey<prpk_newsdir, const FSEntry>,
+ SmartRecordKey<prpk_sync, const std::string>,
+ SmartRecordKey<prpk_sync_exclude, const std::string>,
+ SmartRecordKey<prpk_root, const FSEntry>,
+ SmartRecordKey<prpk_buildroot, const FSEntry>
+ {
+ };
+
+ /**
+ * Constructor parameters for PortageRepository.
+ *
+ * \see PortageRepository
+ * \ingroup grpportagerepository
+ */
+ typedef MakeSmartRecord<PortageRepositoryParamsTag>::Type PortageRepositoryParams;
+
+}
+
+#endif
diff --git a/paludis/repositories/portage/portage_repository_sets.cc b/paludis/repositories/portage/portage_repository_sets.cc
index 12e287c..941a570 100644
--- a/paludis/repositories/portage/portage_repository_sets.cc
+++ b/paludis/repositories/portage/portage_repository_sets.cc
@@ -157,17 +157,21 @@ namespace paludis
{
const Environment * const environment;
const PortageRepository * const portage_repository;
+ const PortageRepositoryParams params;
- Implementation(const Environment * const e, const PortageRepository * const p) :
+ Implementation(const Environment * const e, const PortageRepository * const p,
+ const PortageRepositoryParams & k) :
environment(e),
- portage_repository(p)
+ portage_repository(p),
+ params(k)
{
}
};
}
-PortageRepositorySets::PortageRepositorySets(const Environment * const e, const PortageRepository * const p) :
- PrivateImplementationPattern<PortageRepositorySets>(new Implementation<PortageRepositorySets>(e, p))
+PortageRepositorySets::PortageRepositorySets(const Environment * const e, const PortageRepository * const p,
+ const PortageRepositoryParams & k) :
+ PrivateImplementationPattern<PortageRepositorySets>(new Implementation<PortageRepositorySets>(e, p, k))
{
}
@@ -183,11 +187,11 @@ PortageRepositorySets::package_set(const std::string & s, const PackageSetOption
throw InternalError(PALUDIS_HERE, "system set should've been handled by PortageRepository");
else if ("security" == s)
return security_set(o);
- else if ((_imp->portage_repository->sets_dir() / (s + ".conf")).exists())
+ else if ((_imp->params.get<prpk_setsdir>() / (s + ".conf")).exists())
{
GeneralSetDepTag::Pointer tag(new GeneralSetDepTag(s));
- FSEntry ff(_imp->portage_repository->sets_dir() / (s + ".conf"));
+ FSEntry ff(_imp->params.get<prpk_setsdir>() / (s + ".conf"));
Context context("When loading package set '" + s + "' from '" + stringify(ff) + "':");
AllDepAtom::Pointer result(new AllDepAtom);
@@ -289,11 +293,11 @@ PortageRepositorySets::security_set(const PackageSetOptions & o) const
bool list_affected_only(o.get<pso_list_affected_only>());
InstallState affected_state(list_affected_only ? is_either : is_installed_only);
- if (!_imp->portage_repository->security_dir().is_directory())
+ if (!_imp->params.get<prpk_securitydir>().is_directory())
return DepAtom::Pointer(new AllDepAtom);
std::list<FSEntry> advisories;
- std::copy(DirIterator(_imp->portage_repository->security_dir()), DirIterator(),
+ std::copy(DirIterator(_imp->params.get<prpk_securitydir>()), DirIterator(),
filter_inserter(std::back_inserter(advisories),
IsFileWithExtension("advisory-", ".conf")));
diff --git a/paludis/repositories/portage/portage_repository_sets.hh b/paludis/repositories/portage/portage_repository_sets.hh
index fd4865c..133b7ef 100644
--- a/paludis/repositories/portage/portage_repository_sets.hh
+++ b/paludis/repositories/portage/portage_repository_sets.hh
@@ -53,7 +53,8 @@ namespace paludis
///\name Basic operations
///\{
- PortageRepositorySets(const Environment * const env, const PortageRepository * const);
+ PortageRepositorySets(const Environment * const env, const PortageRepository * const,
+ const PortageRepositoryParams &);
~PortageRepositorySets();
///\}