aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-07-28 05:50:03 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-07-28 05:50:03 +0000
commit0419f9776ce67c25cbde1203dc7b8cfc1a77895a (patch)
treef4659f077b88cd1da1f5fc72aa6d8761df7d8f3f
parent4e6afb085fe07bca0e88e8ebfdb7642b170e8421 (diff)
downloadpaludis-0419f9776ce67c25cbde1203dc7b8cfc1a77895a.tar.gz
paludis-0419f9776ce67c25cbde1203dc7b8cfc1a77895a.tar.xz
r1208@snowdrop: ciaranm | 2006-07-28 04:08:17 +0100
Split up PortageRepository some more. Move the news and advisory config file implementations from the main library into the Portage repository library.
-rw-r--r--paludis/config_file.cc87
-rw-r--r--paludis/config_file.hh71
-rw-r--r--paludis/repositories/portage/Makefile.am6
-rw-r--r--paludis/repositories/portage/portage_repository.cc474
-rw-r--r--paludis/repositories/portage/portage_repository.hh67
5 files changed, 82 insertions, 623 deletions
diff --git a/paludis/config_file.cc b/paludis/config_file.cc
index 0116a44..7800ad5 100644
--- a/paludis/config_file.cc
+++ b/paludis/config_file.cc
@@ -564,93 +564,6 @@ AdvisoryFile::get(const std::string & key) const
return _imp->entries[key];
}
-namespace paludis
-{
- template<>
- struct Implementation<NewsFile> :
- InternalCounted<Implementation<NewsFile> >
- {
- mutable bool in_header;
- mutable std::list<std::string> display_if_installed;
- mutable std::list<std::string> display_if_keyword;
- mutable std::list<std::string> display_if_profile;
-
- Implementation() :
- in_header(true)
- {
- }
- };
-}
-
-NewsFile::NewsFile(const FSEntry & filename) :
- ConfigFile(filename),
- PrivateImplementationPattern<NewsFile>(new Implementation<NewsFile>)
-{
- need_lines();
-}
-
-NewsFile::~NewsFile()
-{
-}
-
-void
-NewsFile::accept_line(const std::string & line) const
-{
- if (_imp->in_header)
- {
- std::string::size_type p(line.find(':'));
- if (std::string::npos == p)
- _imp->in_header = false;
- else
- {
- std::string k(strip_leading(strip_trailing(line.substr(0, p), " \t\n"), " \t\n"));
- std::string v(strip_leading(strip_trailing(line.substr(p + 1), " \t\n"), " \t\n"));
- if (k == "Display-If-Installed")
- _imp->display_if_installed.push_back(v);
- else if (k == "Display-If-Keyword")
- _imp->display_if_keyword.push_back(v);
- if (k == "Display-If-Profile")
- _imp->display_if_profile.push_back(v);
- }
- }
-}
-
-NewsFile::DisplayIfInstalledIterator
-NewsFile::begin_display_if_installed() const
-{
- return DisplayIfInstalledIterator(_imp->display_if_installed.begin());
-}
-
-NewsFile::DisplayIfInstalledIterator
-NewsFile::end_display_if_installed() const
-{
- return DisplayIfInstalledIterator(_imp->display_if_installed.end());
-}
-
-NewsFile::DisplayIfKeywordIterator
-NewsFile::begin_display_if_keyword() const
-{
- return DisplayIfKeywordIterator(_imp->display_if_keyword.begin());
-}
-
-NewsFile::DisplayIfKeywordIterator
-NewsFile::end_display_if_keyword() const
-{
- return DisplayIfKeywordIterator(_imp->display_if_keyword.end());
-}
-
-NewsFile::DisplayIfProfileIterator
-NewsFile::begin_display_if_profile() const
-{
- return DisplayIfProfileIterator(_imp->display_if_profile.begin());
-}
-
-NewsFile::DisplayIfProfileIterator
-NewsFile::end_display_if_profile() const
-{
- return DisplayIfProfileIterator(_imp->display_if_profile.end());
-}
-
std::string
KeyValueConfigFile::get(const std::string & key) const
{
diff --git a/paludis/config_file.hh b/paludis/config_file.hh
index ee38639..d04fa36 100644
--- a/paludis/config_file.hh
+++ b/paludis/config_file.hh
@@ -409,77 +409,6 @@ namespace paludis
std::string get(const std::string & key) const;
};
-
- /**
- * A NewsFile represents a GLEP 42 news file.
- *
- * \ingroup grpnewconfigfile
- */
- class NewsFile :
- protected ConfigFile,
- private PrivateImplementationPattern<NewsFile>
- {
- protected:
- void accept_line(const std::string &) const;
-
- public:
- ///\name Basic operations
- ///\{
-
- /**
- * Constructor, from a filename.
- */
- NewsFile(const FSEntry & filename);
-
- ~NewsFile();
-
- ///\}
-
- ///\name Iterate over our Display-If-Installed headers
- ///\{
-
- /// Tag for DisplayIfInstalledIterator.
- struct DisplayIfInstalledIteratorTag;
-
- typedef libwrapiter::ForwardIterator<DisplayIfInstalledIteratorTag,
- const std::string> DisplayIfInstalledIterator;
-
- DisplayIfInstalledIterator begin_display_if_installed() const;
-
- DisplayIfInstalledIterator end_display_if_installed() const;
-
- ///\}
-
- ///\name Iterate over our Display-If-Keyword headers
- ///\{
-
- /// Tag for DisplayIfKeywordIterator.
- struct DisplayIfKeywordIteratorTag;
-
- typedef libwrapiter::ForwardIterator<DisplayIfKeywordIteratorTag,
- const std::string> DisplayIfKeywordIterator;
-
- DisplayIfKeywordIterator begin_display_if_keyword() const;
-
- DisplayIfKeywordIterator end_display_if_keyword() const;
-
- ///\}
-
- ///\name Iterate over our Display-If-Profile headers
- ///\{
-
- /// Tag for DisplayIfProfileIterator.
- struct DisplayIfProfileIteratorTag;
-
- typedef libwrapiter::ForwardIterator<DisplayIfProfileIteratorTag,
- const std::string> DisplayIfProfileIterator;
-
- DisplayIfProfileIterator begin_display_if_profile() const;
-
- DisplayIfProfileIterator end_display_if_profile() const;
-
- ///\}
- };
}
#endif
diff --git a/paludis/repositories/portage/Makefile.am b/paludis/repositories/portage/Makefile.am
index ea41012..54e153b 100644
--- a/paludis/repositories/portage/Makefile.am
+++ b/paludis/repositories/portage/Makefile.am
@@ -16,12 +16,16 @@ libpaludisportagerepository_la_LDFLAGS = -version-info @VERSION_LIB_CURRENT@:@VE
paludis_repositories_portage_include_HEADERS = \
portage_repository.hh \
portage_repository_profile.hh \
- portage_repository_exceptions.hh
+ portage_repository_exceptions.hh \
+ portage_repository_news.hh \
+ portage_repository_sets.hh
libpaludisportagerepository_la_SOURCES = \
portage_repository.cc \
portage_repository_profile.cc \
portage_repository_exceptions.cc \
+ portage_repository_news.cc \
+ portage_repository_sets.cc \
$(paludis_repositories_portage_include_HEADERS)
TESTS = portage_repository_TEST
diff --git a/paludis/repositories/portage/portage_repository.cc b/paludis/repositories/portage/portage_repository.cc
index fc394e1..de582d5 100644
--- a/paludis/repositories/portage/portage_repository.cc
+++ b/paludis/repositories/portage/portage_repository.cc
@@ -22,6 +22,8 @@
#include <paludis/repositories/portage/portage_repository.hh>
#include <paludis/repositories/portage/portage_repository_profile.hh>
+#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/config_file.hh>
@@ -197,9 +199,15 @@ namespace paludis
/// Load profiles, if we haven't already.
inline void need_profiles() const;
- /// Our profile.
+ /// Our profile handler.
mutable PortageRepositoryProfile::Pointer profile_ptr;
+ /// Our news handler.
+ mutable PortageRepositoryNews::Pointer news_ptr;
+
+ /// Our sets handler.
+ mutable PortageRepositorySets::Pointer sets_ptr;
+
/// Our virtuals
mutable VirtualsMap our_virtuals;
@@ -228,6 +236,8 @@ namespace paludis
has_arch_list(false),
has_mirrors(false),
profile_ptr(0),
+ news_ptr(0),
+ sets_ptr(0),
has_our_virtuals(false)
{
}
@@ -1384,316 +1394,19 @@ PortageRepository::do_install(const QualifiedPackageName & q, const VersionSpec
install_cmd();
}
-namespace
-{
- inline
- PackageDepAtom::Pointer make_atom(const PackageDatabaseEntry & e)
- {
- QualifiedPackageName n(e.get<pde_name>());
- VersionSpec v(e.get<pde_version>());
-
- std::string s("=" + stringify(n) + "-" + stringify(v));
- return PackageDepAtom::Pointer(new PackageDepAtom(s));
- }
-}
-
-PackageDatabaseEntryCollection::Iterator
-PortageRepository::find_best(PackageDatabaseEntryCollection & c, const PackageDatabaseEntry & e) const
-{
- Context local("When finding best update for '" + stringify(e.get<pde_name>()) + "-" +
- stringify(e.get<pde_version>()) + "':");
- // Find an entry in c that matches e best. e is not in c.
- QualifiedPackageName n(e.get<pde_name>());
- SlotName s(_imp->env->package_database()->fetch_repository(e.get<pde_repository>())->version_metadata(
- e.get<pde_name>(), e.get<pde_version>())->get<vm_slot>());
- PackageDatabaseEntryCollection::Iterator i(c.begin()), i_end(c.end()), i_best(c.end());
- for ( ; i != i_end; ++i)
- {
- if (n != i->get<pde_name>())
- continue;
- if (s != _imp->env->package_database()->fetch_repository(i->get<pde_repository>())->version_metadata(
- i->get<pde_name>(), i->get<pde_version>())->get<vm_slot>())
- continue;
-
- i_best = i;
- }
-
- return i_best;
-}
-
-AdvisoryVisitor::AdvisoryVisitor(const Environment * const env, const CompositeDepAtom & a) :
- _env(env),
- _a(a)
-{
- Context c("When flattening the AdvisoryFile line:");
- std::for_each(a.begin(), a.end(), accept_visitor(this));
- if (_atoms.size() == 2)
- {
- VersionOperatorValue v1(_atoms[0]->version_operator().value()),
- v2(_atoms[1]->version_operator().value());
-
- if ((v1 == vo_equal) || (v2 == vo_equal))
- throw AdvisoryFileError("Broken line: Forbidden 'equal' atom in range");
- }
-}
-
-void
-AdvisoryVisitor::visit(const AllDepAtom * a)
-{
- std::for_each(a->begin(), a->end(), accept_visitor(this));
-}
-
-void
-AdvisoryVisitor::visit(const AnyDepAtom *)
-{
- throw AdvisoryFileError("Unexpected AnyDepAtom in line");
-}
-
-void
-AdvisoryVisitor::visit(const UseDepAtom * a)
-{
- if (_env->query_use(a->flag(), 0) ^ a->inverse())
- std::for_each(a->begin(), a->end(), accept_visitor(this));
-}
-
-void
-AdvisoryVisitor::visit(const PackageDepAtom * a)
-{
- _atoms.push_back(a);
-}
-
-void
-AdvisoryVisitor::visit(const PlainTextDepAtom *)
-{
-}
-
-void
-AdvisoryVisitor::visit(const BlockDepAtom *)
-{
-}
-
-DepAtom::Pointer
-PortageRepository::do_security_set(const PackageSetOptions & o) const
-{
- Context c("When building security package set:");
- AllDepAtom::Pointer security_packages(new AllDepAtom);
-
- bool list_affected_only(o.get<pso_list_affected_only>());
- InstallState affected_state(list_affected_only ? is_either : is_installed_only);
-
- if (!_imp->securitydir.is_directory())
- return DepAtom::Pointer(new AllDepAtom);
-
- std::list<FSEntry> advisories;
- std::copy(DirIterator(_imp->securitydir), DirIterator(),
- filter_inserter(std::back_inserter(advisories),
- IsFileWithExtension("advisory-", ".conf")));
-
- std::list<FSEntry>::const_iterator f(advisories.begin()),
- f_end(advisories.end());
-
- std::set<std::pair<PackageDatabaseEntry, std::string> > affected;
- PackageDatabaseEntryCollection::Concrete unaffected;
- std::map<std::string, std::string> advisory_map;
-
- for ( ; f != f_end; ++f)
- {
- Context c("When parsing security advisory '" + stringify(*f) + "':");
-
- try
- {
- AdvisoryFile advisory(*f);
- std::string advisory_id(advisory.get("Id"));
- advisory_map[advisory_id] = advisory.get("Title");
-
-
- AdvisoryFile::LineIterator a(advisory.begin_affected()), a_end(advisory.end_affected());
- for ( ; a != a_end ; ++a)
- {
- Context c("When parsing line 'Affected: " + *a + "':");
-
- CompositeDepAtom::ConstPointer line(PortageDepParser::parse(*a));
- AdvisoryVisitor atoms(_imp->env, *line);
-
- if ((0 == atoms.size()) || (2 < atoms.size()))
- {
- continue;
- }
-
- bool is_range(2 == atoms.size());
-
- PackageDatabaseEntryCollection::ConstPointer affected_collection1(
- _imp->db->query(*atoms.at(0), affected_state));
- PackageDatabaseEntryCollection::ConstPointer affected_collection2(
- new PackageDatabaseEntryCollection::Concrete);
- PackageDatabaseEntryCollection::Iterator p(affected_collection1->begin()),
- p_end(affected_collection1->end());
-
- if (is_range)
- affected_collection2 = _imp->db->query(*atoms.at(1), affected_state);
-
- for ( ; p != p_end ; ++p)
- {
- if ((affected.end() != affected.find(std::make_pair(*p, advisory_id))))
- continue;
- if ((! is_range) || (affected_collection2->end() != affected_collection2->find(*p)))
- affected.insert(std::make_pair(*p, advisory_id));
- }
- }
-
- AdvisoryFile::LineIterator u(advisory.begin_unaffected()), u_end(advisory.end_unaffected());
- for ( ; u != u_end ; ++u)
- {
- Context c("When parsing line 'Unaffected: " + *u + "':");
-
- CompositeDepAtom::ConstPointer line(PortageDepParser::parse(*u));
- AdvisoryVisitor atoms(_imp->env, *line);
-
- if ((0 == atoms.size()) || (2 < atoms.size()))
- {
- continue;
- }
-
- bool is_range(2 == atoms.size());
-
- PackageDatabaseEntryCollection::ConstPointer unaffected_collection1(_imp->db->query(
- *atoms.at(0), is_either));
- PackageDatabaseEntryCollection::ConstPointer unaffected_collection2(
- new PackageDatabaseEntryCollection::Concrete);
- PackageDatabaseEntryCollection::Iterator p(unaffected_collection1->begin()),
- p_end(unaffected_collection1->end());
-
- if (is_range)
- unaffected_collection2 = _imp->db->query(*atoms.at(1), is_either);
-
- for ( ; p != p_end ; ++p)
- {
- if ((! is_range) || (unaffected_collection2->end() != unaffected_collection2->find(*p)))
- {
- unaffected.insert(*p);
- std::set<std::pair<PackageDatabaseEntry, std::string> >::iterator
- a(affected.find(std::make_pair(*p, advisory_id)));
- if (a != affected.end())
- affected.erase(a);
- }
- }
- }
- }
- catch (const AdvisoryFileError & e)
- {
- Log::get_instance()->message(ll_warning, lc_context,
- "Malformed advisory file '" + stringify(*f) + "': " + e.message());
- }
- catch (const InternalError & e)
- {
- throw;
- }
- catch (const Exception & e)
- {
- Log::get_instance()->message(ll_warning, lc_context,
- "Exception caught while parsing advisory '" + stringify(*f) +
- "': " + e.message());
- }
-
- }
-
- std::set<std::pair<PackageDatabaseEntry, std::string> >::const_iterator i(affected.begin()), i_end(affected.end());
- if (list_affected_only)
- {
- for ( ; i != i_end ; ++i)
- {
- Context c("When creating adding vulnerable package '" + stringify(i->first) + "':");
-
- PackageDepAtom::Pointer p(make_atom(i->first));
- p->set_tag(GLSADepTag::Pointer(new GLSADepTag(i->second, advisory_map[i->second])));
- security_packages->add_child(p);
- }
- }
- else
- {
- for ( ; i != i_end ; ++i)
- {
- Context c("When finding best update for package '" + stringify(i->first) + "', affected by '" + i->second + "':");
-
- PackageDatabaseEntryCollection::Iterator best = find_best(unaffected, i->first);
- if (best == unaffected.end())
- throw AllMaskedError("No best update available for package '" + stringify(i->first) + "':");
-
- PackageDepAtom::Pointer p(make_atom(*best));
- p->set_tag(GLSADepTag::Pointer(new GLSADepTag(i->second, advisory_map[i->second])));
- security_packages->add_child(p);
- }
- }
-
- return security_packages;
-}
-
DepAtom::Pointer
PortageRepository::do_package_set(const std::string & s, const PackageSetOptions & o) const
{
- if ("system" == s)
+ if (! _imp->sets_ptr)
+ _imp->sets_ptr.assign(new PortageRepositorySets(_imp->env, this));
+
+ if (s == "system")
{
_imp->need_profiles();
return _imp->profile_ptr->system_packages();
}
- else if ("security" == s)
- return do_security_set(o);
- else if ((_imp->setsdir / (s + ".conf")).exists())
- {
- GeneralSetDepTag::Pointer tag(new GeneralSetDepTag(s));
-
- FSEntry ff(_imp->setsdir / (s + ".conf"));
- Context context("When loading package set '" + s + "' from '" + stringify(ff) + "':");
-
- AllDepAtom::Pointer result(new AllDepAtom);
- LineConfigFile f(ff);
- for (LineConfigFile::Iterator line(f.begin()), line_end(f.end()) ;
- line != line_end ; ++line)
- {
- std::vector<std::string> tokens;
- WhitespaceTokeniser::get_instance()->tokenise(*line, std::back_inserter(tokens));
- if (tokens.empty())
- continue;
-
- if (1 == tokens.size())
- {
- Log::get_instance()->message(ll_warning, lc_context,
- "Line '" + *line + "' in set file '"
- + stringify(ff) + "' does not specify '*' or '?', assuming '*'");
- PackageDepAtom::Pointer atom(new PackageDepAtom(tokens.at(0)));
- atom->set_tag(tag);
- result->add_child(atom);
- }
- else if ("*" == tokens.at(0))
- {
- PackageDepAtom::Pointer atom(new PackageDepAtom(tokens.at(1)));
- atom->set_tag(tag);
- result->add_child(atom);
- }
- else if ("?" == tokens.at(0))
- {
- PackageDepAtom::Pointer p(new PackageDepAtom(tokens.at(1)));
- p->set_tag(tag);
- if (! _imp->env->package_database()->query(
- PackageDepAtom::Pointer(new PackageDepAtom(p->package())),
- is_installed_only)->empty())
- result->add_child(p);
- }
- else
- Log::get_instance()->message(ll_warning, lc_context,
- "Line '" + *line + "' in set file '"
- + stringify(ff) + "' does not start with '*' or '?' token, skipping");
-
- if (tokens.size() > 2)
- Log::get_instance()->message(ll_warning, lc_context,
- "Line '" + *line + "' in set file '"
- + stringify(ff) + "' has trailing garbage");
- }
- return result;
- }
- else
- return DepAtom::Pointer(0);
+ return _imp->sets_ptr->package_set(s, o);
}
bool
@@ -1737,113 +1450,10 @@ PortageRepository::end_provide_map() const
void
PortageRepository::update_news() const
{
- Context context("When updating news for repository '" + stringify(name()) + "':");
-
- if (! _imp->newsdir.is_directory())
- return;
-
- std::set<std::string> skip;
- FSEntry
- skip_file(_imp->root / "var" / "lib" / "paludis" / "news" /
- ("news-" + stringify(name()) + ".skip")),
- unread_file(_imp->root / "var" / "lib" / "paludis" / "news" /
- ("news-" + stringify(name()) + ".unread"));
-
- if (skip_file.is_regular_file())
- {
- Context local_context("When handling news skip file '" + stringify(skip_file) + "':");
- LineConfigFile s(skip_file);
- std::copy(s.begin(), s.end(), std::inserter(skip, skip.end()));
- }
-
- for (DirIterator d(_imp->newsdir), d_end ; d != d_end ; ++d)
- {
- Context local_context("When handling news entry '" + stringify(*d) + "':");
-
- if (! d->is_directory())
- continue;
- if (! (*d / (d->basename() + ".en.txt")).is_regular_file())
- continue;
-
- if (skip.end() != skip.find(d->basename()))
- continue;
+ if (! _imp->news_ptr)
+ _imp->news_ptr.assign(new PortageRepositoryNews(_imp->env, this));
- try
- {
- NewsFile news(*d / (d->basename() + ".en.txt"));
- bool show(true);
-
- if (news.begin_display_if_installed() != news.end_display_if_installed())
- {
- bool local_show(false);
- for (NewsFile::DisplayIfInstalledIterator i(news.begin_display_if_installed()),
- i_end(news.end_display_if_installed()) ; i != i_end ; ++i)
- if (! _imp->env->package_database()->query(PackageDepAtom::Pointer(
- new PackageDepAtom(*i)), is_installed_only)->empty())
- local_show = true;
- show &= local_show;
- }
-
- if (news.begin_display_if_keyword() != news.end_display_if_keyword())
- {
- _imp->need_profiles();
-
- bool local_show(false);
- for (NewsFile::DisplayIfKeywordIterator i(news.begin_display_if_keyword()),
- i_end(news.end_display_if_keyword()) ; i != i_end ; ++i)
- if (_imp->profile_ptr->environment_variable("ARCH") == *i)
- local_show = true;
- show &= local_show;
- }
-
- if (news.begin_display_if_profile() != news.end_display_if_profile())
- {
- bool local_show(false);
- for (FSEntryCollection::Iterator p(_imp->profile_locations->begin()),
- p_end(_imp->profile_locations->end()) ; p != p_end ; ++p)
- {
- std::string profile(strip_leading_string(strip_trailing_string(
- strip_leading_string(stringify(p->realpath()),
- stringify(p->realpath())), "/"), "/"));
- Log::get_instance()->message(ll_debug, lc_no_context,
- "Profile path is '" + profile + "'");
- for (NewsFile::DisplayIfProfileIterator i(news.begin_display_if_profile()),
- i_end(news.end_display_if_profile()) ; i != i_end ; ++i)
- if (profile == *i)
- local_show = true;
- }
- show &= local_show;
- }
-
- if (show)
- {
- std::ofstream s(stringify(skip_file).c_str(), std::ios::out | std::ios::app);
- if (! s)
- Log::get_instance()->message(ll_warning, lc_no_context,
- "Cannot append to news skip file '"
- + stringify(skip_file) + "', skipping news item '" + stringify(*d) + "'");
-
- std::ofstream t(stringify(unread_file).c_str(), std::ios::out | std::ios::app);
- if (! t)
- Log::get_instance()->message(ll_warning, lc_no_context,
- "Cannot append to unread file '"
- + stringify(unread_file) + "', skipping news item '" + stringify(*d) + "'");
-
- if (s && t)
- {
- s << d->basename() << std::endl;
- t << d->basename() << std::endl;
- }
- }
- }
- catch (const ConfigFileError & e)
- {
- Log::get_instance()->message(ll_warning, lc_no_context,
- "Skipping news item '"
- + stringify(*d) + "' because of exception '" + e.message() + "' ("
- + e.what() + ")");
- }
- }
+ _imp->news_ptr->update_news();
}
std::string
@@ -1953,3 +1563,49 @@ PortageRepository::info(bool verbose) const
return result;
}
+FSEntry
+PortageRepository::news_dir() const
+{
+ return _imp->newsdir;
+}
+
+FSEntry
+PortageRepository::news_skip_file() const
+{
+ return FSEntry(_imp->root / "var" / "lib" / "paludis" / "news" /
+ ("news-" + stringify(name()) + ".skip"));
+}
+
+FSEntry
+PortageRepository::news_unread_file() const
+{
+ return FSEntry(_imp->root / "var" / "lib" / "paludis" / "news" /
+ ("news-" + stringify(name()) + ".unread"));
+}
+
+std::string
+PortageRepository::profile_variable(const std::string & s) const
+{
+ _imp->need_profiles();
+
+ return _imp->profile_ptr->environment_variable(s);
+}
+
+FSEntryCollection::ConstPointer
+PortageRepository::profile_locations() const
+{
+ return _imp->profile_locations;
+}
+
+FSEntry
+PortageRepository::sets_dir() const
+{
+ return _imp->setsdir;
+}
+
+FSEntry
+PortageRepository::security_dir() const
+{
+ return _imp->securitydir;
+}
+
diff --git a/paludis/repositories/portage/portage_repository.hh b/paludis/repositories/portage/portage_repository.hh
index f921a7f..714ac2b 100644
--- a/paludis/repositories/portage/portage_repository.hh
+++ b/paludis/repositories/portage/portage_repository.hh
@@ -35,6 +35,8 @@
namespace paludis
{
class PackageDatabase;
+ class PortageRepositoryProfile;
+ class PortageRepositoryNews;
/**
* Keys for PortageRepositoryParams.
@@ -118,7 +120,6 @@ namespace paludis
void need_virtual_names() const;
PackageDatabaseEntryCollection::Iterator find_best(PackageDatabaseEntryCollection & c,
const PackageDatabaseEntry & e) const;
- DepAtom::Pointer do_security_set(const PackageSetOptions & o) const;
protected:
/**
@@ -210,66 +211,22 @@ namespace paludis
typedef CountedPtr<PortageRepository, count_policy::InternalCountTag> Pointer;
typedef CountedPtr<const PortageRepository, count_policy::InternalCountTag> ConstPointer;
- };
-
- /**
- * Class to convert AdvisoryFile lines to PackageDepAtom(s).
- */
- class AdvisoryVisitor :
- private InstantiationPolicy<AdvisoryVisitor, instantiation_method::NonCopyableTag>,
- public DepAtomVisitorTypes::ConstVisitor
- {
- private:
- const Environment * const _env;
- mutable const CompositeDepAtom & _a;
+ ///\name Information about PortageRepository
+ ///\{
- mutable std::vector<const PackageDepAtom *> _atoms;
-
- protected:
- ///\name Visit methods
- ///{
- void visit(const AllDepAtom *);
- void visit(const AnyDepAtom *) PALUDIS_ATTRIBUTE((noreturn));
- void visit(const UseDepAtom *);
- void visit(const PlainTextDepAtom *);
- void visit(const PackageDepAtom *);
- void visit(const BlockDepAtom *);
- ///}
-
- public:
- /**
- * Constructor.
- */
- AdvisoryVisitor(const Environment * const env, const CompositeDepAtom & a);
+ FSEntry news_dir() const;
+ FSEntry news_skip_file() const;
+ FSEntry news_unread_file() const;
- /**
- * Destructor.
- */
- ~AdvisoryVisitor()
- {
- }
+ std::string profile_variable(const std::string &) const;
- /**
- * Iterate over our dep atoms.
- */
- typedef std::vector<const PackageDepAtom *>::iterator Iterator;
+ FSEntryCollection::ConstPointer profile_locations() const;
- /**
- * Grab element by index.
- */
- const PackageDepAtom * at(std::vector<const PackageDepAtom *>::size_type n) const
- {
- return _atoms[n];
- }
+ FSEntry sets_dir() const;
+ FSEntry security_dir() const;
- /**
- * Return the number of atoms.
- */
- std::vector<const PackageDepAtom *>::size_type size() const
- {
- return _atoms.size();
- }
+ ///\}
};
/**