aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-12-17 15:52:48 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-12-17 15:52:48 +0000
commit85da8f29a45e75d3acf38b574258e60e2b6097cc (patch)
treec2a50921c6cd7072c39ba6da5bfbc170ca0342bf
parent14aa14a1bd5ffb39afe98a925d38c8c1e7a36212 (diff)
downloadpaludis-85da8f29a45e75d3acf38b574258e60e2b6097cc.tar.gz
paludis-85da8f29a45e75d3acf38b574258e60e2b6097cc.tar.xz
Move profile switching from NoConfigEnvironmen to PortageRepository. Add a new PerProfileEbuildCheck QA kind, and make DepsVisibleCheck of this type.
-rw-r--r--paludis/environment/no_config/no_config_environment.cc193
-rw-r--r--paludis/environment/no_config/no_config_environment.hh28
-rw-r--r--paludis/environment/no_config/no_config_environment.sr9
-rw-r--r--paludis/qa/Makefile.am.m46
-rw-r--r--paludis/qa/check_result.hh9
-rw-r--r--paludis/qa/deps_visible_check.cc154
-rw-r--r--paludis/qa/deps_visible_check.hh11
-rw-r--r--paludis/qa/deps_visible_check_TEST.cc114
-rwxr-xr-xpaludis/qa/deps_visible_check_TEST_cleanup.sh9
-rwxr-xr-xpaludis/qa/deps_visible_check_TEST_setup.sh57
-rw-r--r--paludis/qa/files.m43
-rw-r--r--paludis/qa/per_profile_ebuild_check.cc36
-rw-r--r--paludis/qa/per_profile_ebuild_check.hh92
-rw-r--r--paludis/qa/per_profile_ebuild_check.sr13
-rw-r--r--paludis/qa/qa_environment.cc81
-rw-r--r--paludis/qa/qa_environment.hh30
-rw-r--r--paludis/repositories/portage/Makefile.am16
-rw-r--r--paludis/repositories/portage/make_ebuild_repository.cc23
-rw-r--r--paludis/repositories/portage/make_ebuild_repository.hh15
-rw-r--r--paludis/repositories/portage/portage_repository.cc81
-rw-r--r--paludis/repositories/portage/portage_repository.hh18
-rw-r--r--paludis/repositories/portage/portage_repository.sr10
-rw-r--r--ruby/paludis_ruby.cc2
-rw-r--r--src/adjutrix/display_default_system_resolution.cc14
-rw-r--r--src/adjutrix/display_profiles_use.cc14
-rwxr-xr-xsrc/adjutrix/find_stable_candidates_TEST_setup.sh3
-rw-r--r--src/qualudis/qualudis.cc53
27 files changed, 771 insertions, 323 deletions
diff --git a/paludis/environment/no_config/no_config_environment.cc b/paludis/environment/no_config/no_config_environment.cc
index 83fef6f..2478d9f 100644
--- a/paludis/environment/no_config/no_config_environment.cc
+++ b/paludis/environment/no_config/no_config_environment.cc
@@ -40,9 +40,8 @@ namespace paludis
const FSEntry write_cache;
bool accept_unstable;
bool is_vdb;
- std::set<KeywordName> accepted_keywords;
- std::list<NoConfigEnvironmentProfilesDescLine> profiles;
- PackageDatabase::Pointer vdb_db;
+
+ PortageRepository::Pointer portage_repo;
Implementation(Environment * const env, const NoConfigEnvironmentParams & params);
};
@@ -112,66 +111,26 @@ Implementation<NoConfigEnvironment>::Implementation(
write_cache(params.write_cache),
accept_unstable(params.accept_unstable),
is_vdb(is_vdb_repository(params.repository_dir, params.repository_type)),
- vdb_db(is_vdb ? new PackageDatabase(env) : 0)
+ portage_repo(0)
{
Context context("When initialising NoConfigEnvironment at '" + stringify(params.repository_dir) + "':");
if (! is_vdb)
{
- Log::get_instance()->message(ll_debug, lc_context, "Not VDB, using profiles.desc");
- try
- {
- LineConfigFile profiles_desc(params.repository_dir / "profiles" / "profiles.desc");
- for (LineConfigFile::Iterator line(profiles_desc.begin()), line_end(profiles_desc.end()) ;
- line != line_end ; ++line)
- {
- std::vector<std::string> tokens;
- WhitespaceTokeniser::get_instance()->tokenise(*line, std::back_inserter(tokens));
-
- if (tokens.size() != 3)
- {
- Log::get_instance()->message(ll_warning, lc_context, "Skipping invalid line '"
- + *line + "'");
- continue;
- }
-
- profiles.push_back(NoConfigEnvironmentProfilesDescLine::create()
- .path(params.repository_dir / "profiles" / tokens.at(1))
- .status(tokens.at(2))
- .arch(tokens.at(0))
- .db(PackageDatabase::Pointer(new PackageDatabase(env))));
- }
- }
- catch (const ConfigFileError & e)
- {
- Log::get_instance()->message(ll_warning, lc_context, "Could not load profiles.desc due to exception '"
- + e.message() + "' (" + e.what() + ")");
- }
+ AssociativeCollection<std::string, std::string>::Pointer keys(
+ new AssociativeCollection<std::string, std::string>::Concrete);
- if (profiles.empty())
- profiles.push_back(NoConfigEnvironmentProfilesDescLine::create()
- .path(params.repository_dir / "profiles" / "base")
- .status("default")
- .arch("default")
- .db(PackageDatabase::Pointer(new PackageDatabase(env))));
+ keys->insert("format", "portage");
+ keys->insert("location", stringify(params.repository_dir));
+ keys->insert("profiles", "/var/empty");
+ keys->insert("write_cache", stringify(params.write_cache));
+ keys->insert("names_cache", "/var/empty");
- for (std::list<NoConfigEnvironmentProfilesDescLine>::iterator
- p(profiles.begin()), p_end(profiles.end()) ; p != p_end ; ++p)
- {
- AssociativeCollection<std::string, std::string>::Pointer keys(
- new AssociativeCollection<std::string, std::string>::Concrete);
-
- keys->insert("format", "portage");
- keys->insert("location", stringify(params.repository_dir));
- keys->insert("profiles", stringify(p->path));
- keys->insert("write_cache", stringify(params.write_cache));
- keys->insert("names_cache", "/var/empty");
-
- p->db->add_repository(RepositoryMaker::get_instance()->find_maker("portage")(env,
- p->db.raw_pointer(), keys));
- p->db->add_repository(RepositoryMaker::get_instance()->find_maker("virtuals")(env,
- p->db.raw_pointer(), AssociativeCollection<std::string, std::string>::Pointer(0)));
- }
+ env->package_database()->add_repository(((portage_repo =
+ RepositoryMaker::get_instance()->find_maker("portage")(env,
+ env->package_database().raw_pointer(), keys))));
+ env->package_database()->add_repository(RepositoryMaker::get_instance()->find_maker("virtuals")(env,
+ env->package_database().raw_pointer(), AssociativeCollection<std::string, std::string>::Pointer(0)));
}
else
{
@@ -185,21 +144,21 @@ Implementation<NoConfigEnvironment>::Implementation(
keys->insert("provides_cache", "/var/empty");
keys->insert("location", stringify(top_level_dir));
- vdb_db->add_repository(RepositoryMaker::get_instance()->find_maker("vdb")(env,
- vdb_db.raw_pointer(), keys));
- vdb_db->add_repository(RepositoryMaker::get_instance()->find_maker("installed_virtuals")(env,
- vdb_db.raw_pointer(), AssociativeCollection<std::string, std::string>::Pointer(0)));
+ env->package_database()->add_repository(RepositoryMaker::get_instance()->find_maker("vdb")(env,
+ env->package_database().raw_pointer(), keys));
+ env->package_database()->add_repository(RepositoryMaker::get_instance()->find_maker("installed_virtuals")(env,
+ env->package_database().raw_pointer(), AssociativeCollection<std::string, std::string>::Pointer(0)));
}
}
NoConfigEnvironment::NoConfigEnvironment(const NoConfigEnvironmentParams & params) :
+ Environment(PackageDatabase::Pointer(new PackageDatabase(this))),
PrivateImplementationPattern<NoConfigEnvironment>(
- new Implementation<NoConfigEnvironment>(this, params)),
- Environment(_imp->is_vdb ? _imp->vdb_db : _imp->profiles.begin()->db)
+ new Implementation<NoConfigEnvironment>(this, params))
{
- /* do this to load accepted_keywords etc */
- if (! _imp->is_vdb)
- set_profile(ProfilesIterator(_imp->profiles.begin()));
+ if (_imp->portage_repo)
+ if (_imp->portage_repo->end_profiles() != _imp->portage_repo->begin_profiles())
+ _imp->portage_repo->set_profile(_imp->portage_repo->begin_profiles());
}
NoConfigEnvironment::~NoConfigEnvironment()
@@ -218,78 +177,76 @@ NoConfigEnvironment::main_repository_dir() const
return _imp->top_level_dir;
}
-void
-NoConfigEnvironment::set_profile(const NoConfigEnvironment::ProfilesIterator & i)
-{
- if (_imp->is_vdb)
- throw ConfigurationError("Calling NoConfigEnvironment::set_profile but no Portage repository was defined");
-
- change_package_database(i->db);
-
- _imp->accepted_keywords.clear();
- _imp->accepted_keywords.insert(KeywordName("*"));
- _imp->accepted_keywords.insert(KeywordName(i->arch));
- if (_imp->accept_unstable)
- _imp->accepted_keywords.insert(KeywordName("~" + i->arch));
-}
-
-void
-NoConfigEnvironment::set_profile(const FSEntry & location)
+bool
+NoConfigEnvironment::accept_keyword(const KeywordName & k, const PackageDatabaseEntry * const) const
{
- Context context("When setting NoConfigEnvironment profile to '" + stringify(location) + "':");
-
if (_imp->is_vdb)
- throw ConfigurationError("Calling NoConfigEnvironment::set_profile but no Portage repository was defined");
+ return true;
- for (ProfilesIterator i(begin_profiles()), i_end(end_profiles()) ; i != i_end ; ++i)
- if (i->path == location)
+ Log::get_instance()->message(ll_debug, lc_no_context, "accept_keyword " + stringify(k) + ":");
+ std::string accept_keywords(_imp->portage_repo->profile_variable("ACCEPT_KEYWORDS"));
+ if (accept_keywords.empty())
+ {
+ std::string arch(_imp->portage_repo->profile_variable("ARCH"));
+ if (stringify(k) == arch)
{
- set_profile(i);
- return;
+ Log::get_instance()->message(ll_debug, lc_no_context, "accept_keyword match on arch");
+ return true;
}
- Log::get_instance()->message(ll_warning, lc_context, "No profiles.desc entry found, faking it");
+ if (_imp->accept_unstable && ("~" + stringify(k) == arch))
+ {
+ Log::get_instance()->message(ll_debug, lc_no_context, "accept_keyword match on ~arch");
+ return true;
+ }
- PackageDatabase::Pointer db(new PackageDatabase(this));
- AssociativeCollection<std::string, std::string>::Pointer keys(
- new AssociativeCollection<std::string, std::string>::Concrete);
+ Log::get_instance()->message(ll_debug, lc_no_context, "accept_keyword no match on arch");
+ }
+ else
+ {
+ std::list<KeywordName> accepted;
+ WhitespaceTokeniser::get_instance()->tokenise(accept_keywords,
+ create_inserter<KeywordName>(std::back_inserter(accepted)));
- keys->insert("format", "portage");
- keys->insert("names_cache", "/var/empty");
- keys->insert("location", stringify(_imp->top_level_dir));
- keys->insert("profiles", stringify(location));
- keys->insert("write_cache", stringify(_imp->write_cache));
+ if (accepted.end() != std::find(accepted.begin(), accepted.end(), k))
+ {
+ Log::get_instance()->message(ll_debug, lc_no_context, "accept_keyword match on accepted");
+ return true;
+ }
- PortageRepository::Pointer p(RepositoryMaker::get_instance()->find_maker("portage")(this,
- db.raw_pointer(), keys));
- db->add_repository(RepositoryMaker::get_instance()->find_maker("virtuals")(this,
- db.raw_pointer(), AssociativeCollection<std::string, std::string>::Pointer(0)));
- db->add_repository(p);
+ if (_imp->accept_unstable && '~' == stringify(k).at(0))
+ {
+ if (accepted.end() != std::find(accepted.begin(), accepted.end(),
+ KeywordName(stringify(k).substr(1))))
+ {
+ Log::get_instance()->message(ll_debug, lc_no_context, "accept_keyword match on ~accepted");
+ return true;
+ }
- _imp->accepted_keywords.clear();
- _imp->accepted_keywords.insert(KeywordName("*"));
- _imp->accepted_keywords.insert(KeywordName(p->profile_variable("ARCH")));
- if (_imp->accept_unstable)
- _imp->accepted_keywords.insert(KeywordName("~" + p->profile_variable("ARCH")));
+ Log::get_instance()->message(ll_debug, lc_no_context, "accept_keyword no match on ~accepted");
+ }
+ else
+ Log::get_instance()->message(ll_debug, lc_no_context, "accept_keyword no match on accepted");
+ }
- change_package_database(db);
+ return false;
}
-bool
-NoConfigEnvironment::accept_keyword(const KeywordName & k, const PackageDatabaseEntry * const) const
+void
+NoConfigEnvironment::set_accept_unstable(const bool value)
{
- return _imp->is_vdb || (_imp->accepted_keywords.end() != _imp->accepted_keywords.find(k));
+ _imp->accept_unstable = value;
}
-NoConfigEnvironment::ProfilesIterator
-NoConfigEnvironment::begin_profiles() const
+PortageRepository::Pointer
+NoConfigEnvironment::portage_repository()
{
- return ProfilesIterator(_imp->profiles.begin());
+ return _imp->portage_repo;
}
-NoConfigEnvironment::ProfilesIterator
-NoConfigEnvironment::end_profiles() const
+PortageRepository::ConstPointer
+NoConfigEnvironment::portage_repository() const
{
- return ProfilesIterator(_imp->profiles.end());
+ return _imp->portage_repo;
}
diff --git a/paludis/environment/no_config/no_config_environment.hh b/paludis/environment/no_config/no_config_environment.hh
index 9aacca6..09d20f7 100644
--- a/paludis/environment/no_config/no_config_environment.hh
+++ b/paludis/environment/no_config/no_config_environment.hh
@@ -27,6 +27,8 @@
namespace paludis
{
+ class PortageRepository;
+
/**
* The type of repository to use for a NoConfigEnvironment.
*
@@ -49,8 +51,8 @@ namespace paludis
* \nosubgrouping
*/
class PALUDIS_VISIBLE NoConfigEnvironment :
- private PrivateImplementationPattern<NoConfigEnvironment>,
- public Environment
+ public Environment,
+ private PrivateImplementationPattern<NoConfigEnvironment>
{
public:
///\name Basic operations
@@ -71,23 +73,13 @@ namespace paludis
virtual bool accept_keyword(const KeywordName &, const PackageDatabaseEntry * const) const;
- ///\name Iterate over our profiles
- ///\{
-
- typedef libwrapiter::ForwardIterator<NoConfigEnvironment, const NoConfigEnvironmentProfilesDescLine> ProfilesIterator;
- ProfilesIterator begin_profiles() const;
- ProfilesIterator end_profiles() const;
-
- ///\}
-
- ///\name Profile functions
- ///\{
-
- void set_profile(const FSEntry & location);
- void set_profile(const ProfilesIterator & iter);
-
- ///\}
+ /**
+ * Should we accept unstable keywords?
+ */
+ void set_accept_unstable(const bool value);
+ CountedPtr<PortageRepository> portage_repository();
+ CountedPtr<const PortageRepository> portage_repository() const;
};
}
diff --git a/paludis/environment/no_config/no_config_environment.sr b/paludis/environment/no_config/no_config_environment.sr
index ff86654..3acafa0 100644
--- a/paludis/environment/no_config/no_config_environment.sr
+++ b/paludis/environment/no_config/no_config_environment.sr
@@ -10,12 +10,3 @@ make_class_NoConfigEnvironmentParams()
allow_named_args
}
-make_class_NoConfigEnvironmentProfilesDescLine()
-{
- key path FSEntry
- key arch std::string
- key status std::string
- key db PackageDatabase::Pointer
- allow_named_args
-}
-
diff --git a/paludis/qa/Makefile.am.m4 b/paludis/qa/Makefile.am.m4
index 3122f7e..bbe9c35 100644
--- a/paludis/qa/Makefile.am.m4
+++ b/paludis/qa/Makefile.am.m4
@@ -62,7 +62,11 @@ libpaludisqa_la_LIBADD = \
$(top_builddir)/paludis/libpaludis.la \
$(top_builddir)/paludis/util/libpaludisutil.la \
$(top_builddir)/paludis/libxml/libpaludislibxml.la \
- @LIBXML2DEPS_LIBS@
+ $(top_builddir)/paludis/environment/no_config/libpaludisnoconfigenvironment.la \
+ $(top_builddir)/paludis/repositories/portage/libpaludisportagerepository.la \
+ $(top_builddir)/paludis/dep_list/libpaludisdeplist.la \
+ @LIBXML2DEPS_LIBS@ \
+ @PCREPLUSPLUS_LIBS@
TESTS = testlist
diff --git a/paludis/qa/check_result.hh b/paludis/qa/check_result.hh
index d7834cd..d39cabc 100644
--- a/paludis/qa/check_result.hh
+++ b/paludis/qa/check_result.hh
@@ -44,8 +44,8 @@ namespace paludis
private:
std::list<Message> _messages;
- const std::string _item;
- const std::string _rule;
+ std::string _item;
+ std::string _rule;
public:
CheckResult(const FSEntry &, const std::string &);
@@ -57,6 +57,11 @@ namespace paludis
return _messages.empty();
}
+ void clear()
+ {
+ _messages.clear();
+ }
+
CheckResult & operator<< (const Message & m)
{
_messages.push_back(m);
diff --git a/paludis/qa/deps_visible_check.cc b/paludis/qa/deps_visible_check.cc
index 6869cef..c6393e7 100644
--- a/paludis/qa/deps_visible_check.cc
+++ b/paludis/qa/deps_visible_check.cc
@@ -18,41 +18,104 @@
*/
#include <paludis/qa/deps_visible_check.hh>
-
+#include <paludis/qa/qa_environment.hh>
#include <paludis/package_database_entry.hh>
+#include <paludis/repositories/portage/portage_repository.hh>
#include <paludis/environment.hh>
#include <paludis/portage_dep_parser.hh>
#include <paludis/dep_atom.hh>
+#include <paludis/dep_atom_pretty_printer.hh>
+#include <paludis/util/save.hh>
+
+#include <list>
using namespace paludis;
using namespace paludis::qa;
namespace
{
+ struct IsViableAnyDepAtomChild
+ {
+ const QAEnvironment * const env;
+ const PackageDatabaseEntry pde;
+
+ IsViableAnyDepAtomChild(const QAEnvironment * const e, const PackageDatabaseEntry & p) :
+ env(e),
+ pde(p)
+ {
+ }
+
+ template <typename T_>
+ bool operator() (T_ atom) const
+ {
+ const UseDepAtom * const u(atom->as_use_dep_atom());
+ if (0 != u)
+ {
+ RepositoryUseInterface * i(env->package_database()->fetch_repository(
+ pde.repository)->use_interface);
+ if (! i)
+ return true;
+
+ if (i->query_use_mask(u->flag(), &pde) && ! u->inverse())
+ return false;
+
+ if (i->query_use_force(u->flag(), &pde) && u->inverse())
+ return false;
+
+ /* arch flags aren't necessarily use masked. stupid! */
+ UseFlagNameCollection::ConstPointer arch_flags(i->arch_flags());
+ if (stringify(u->flag()) != env->portage_repository()->profile_variable("ARCH"))
+ if (arch_flags->end() != arch_flags->find(u->flag()))
+ return u->inverse();
+
+ return true;
+ }
+ else
+ return true;
+ }
+ };
+
struct Checker :
DepAtomVisitorTypes::ConstVisitor
{
CheckResult & result;
const std::string role;
- const Environment * env;
+ const QAEnvironment * env;
+ const PackageDatabaseEntry & pde;
+ bool unstable;
- Checker(CheckResult & rr, const std::string & r, const Environment * e) :
+ Checker(CheckResult & rr, const std::string & r, const QAEnvironment * e,
+ const PackageDatabaseEntry & p, bool u) :
result(rr),
role(r),
- env(e)
+ env(e),
+ pde(p),
+ unstable(u)
{
}
void visit(const PackageDepAtom * const p)
{
bool found(false);
- PackageDatabaseEntryCollection::Pointer matches(env->package_database()->query(PackageDepAtom::Pointer(new PackageDepAtom(p->package())),
- is_either));
+ std::string candidates;
+ PackageDatabaseEntryCollection::Pointer matches(env->package_database()->query(
+ *p, is_either));
for (PackageDatabaseEntryCollection::ReverseIterator m(matches->rbegin()),
m_end(matches->rend()) ; m != m_end ; ++m)
{
- if (env->mask_reasons(*m).any())
+ MaskReasons r;
+ if (((r = env->mask_reasons(*m))).any())
+ {
+ if (! candidates.empty())
+ candidates.append(", ");
+ candidates.append(stringify(m->version));
+ candidates.append(":");
+ for (MaskReason rr(MaskReason(0)) ; rr < last_mr ;
+ rr = MaskReason(static_cast<int>(rr) + 1))
+ if (r[rr])
+ candidates.append(" " + stringify(rr));
continue;
+ }
found = true;
break;
@@ -60,7 +123,8 @@ namespace
if (! found)
result << Message(qal_major, "No visible provider for " + role + " entry '"
- + stringify(*p) + "'");
+ + stringify(*p) + "'" + (unstable ? " (unstable)" : "") + " (candidates: "
+ + candidates + ")");
}
void visit(const AllDepAtom * const a)
@@ -68,12 +132,39 @@ namespace
std::for_each(a->begin(), a->end(), accept_visitor(this));
}
- void visit(const AnyDepAtom * const)
+ void visit(const AnyDepAtom * const a)
{
+ std::list<DepAtom::ConstPointer> viable_children;
+ std::copy(a->begin(), a->end(), filter_inserter(std::back_inserter(viable_children),
+ IsViableAnyDepAtomChild(env, pde)));
+
+ if (viable_children.empty())
+ return;
+
+ bool found(false);
+ for (std::list<DepAtom::ConstPointer>::const_iterator c(viable_children.begin()),
+ c_end(viable_children.end()) ; c != c_end && ! found ; ++c)
+ {
+ Save<CheckResult> save_result(&result);
+ result.clear();
+ (*c)->accept(this);
+ if (result.empty())
+ found = true;
+ }
+
+ if (! found)
+ {
+ DepAtomPrettyPrinter printer(0, false);
+ a->accept(&printer);
+ result << Message(qal_major, "No visible provider for " + role + " entry '"
+ + stringify(printer) + "'" + (unstable ? " (unstable)" : ""));
+ }
}
- void visit(const UseDepAtom * const)
+ void visit(const UseDepAtom * const u)
{
+ if (IsViableAnyDepAtomChild(env, pde)(u))
+ std::for_each(u->begin(), u->end(), accept_visitor(this));
}
void visit(const BlockDepAtom * const)
@@ -91,34 +182,49 @@ DepsVisibleCheck::DepsVisibleCheck()
}
CheckResult
-DepsVisibleCheck::operator() (const EbuildCheckData & e) const
+DepsVisibleCheck::operator() (const PerProfileEbuildCheckData & e) const
{
CheckResult result(stringify(e.name) + "-" + stringify(e.version),
identifier());
try
{
+ e.environment->portage_repository()->set_profile(
+ e.environment->portage_repository()->find_profile(e.profile));
+
PackageDatabaseEntry ee(e.name, e.version,
e.environment->package_database()->favourite_repository());
VersionMetadata::ConstPointer metadata(
e.environment->package_database()->fetch_repository(ee.repository)->version_metadata(ee.name, ee.version));
- if (e.environment->mask_reasons(ee).any())
- result << Message(qal_skip, "Masked, so skipping checks");
- else
+ bool unstable(false);
+ do
{
- Checker depend_checker(result, "DEPEND", e.environment);
- std::string depend(metadata->deps.build_depend_string);
- PortageDepParser::parse(depend)->accept(&depend_checker);
+ e.environment->set_accept_unstable(unstable);
+
+ if (e.environment->mask_reasons(ee).any())
+ result << Message(qal_skip, "Masked, so skipping checks");
+ else
+ {
+ Checker depend_checker(result, "DEPEND", e.environment, ee, unstable);
+ std::string depend(metadata->deps.build_depend_string);
+ PortageDepParser::parse(depend)->accept(&depend_checker);
- Checker rdepend_checker(result, "RDEPEND", e.environment);
- std::string rdepend(metadata->deps.run_depend_string);
- PortageDepParser::parse(rdepend)->accept(&rdepend_checker);
+ Checker rdepend_checker(result, "RDEPEND", e.environment, ee, unstable);
+ std::string rdepend(metadata->deps.run_depend_string);
+ PortageDepParser::parse(rdepend)->accept(&rdepend_checker);
- Checker pdepend_checker(result, "PDEPEND", e.environment);
- std::string pdepend(metadata->deps.post_depend_string);
- PortageDepParser::parse(pdepend)->accept(&pdepend_checker);
- }
+ Checker pdepend_checker(result, "PDEPEND", e.environment, ee, unstable);
+ std::string pdepend(metadata->deps.post_depend_string);
+ PortageDepParser::parse(pdepend)->accept(&pdepend_checker);
+ }
+
+ if (unstable)
+ break;
+ else
+ unstable = true;
+
+ } while (true);
}
catch (const InternalError &)
{
diff --git a/paludis/qa/deps_visible_check.hh b/paludis/qa/deps_visible_check.hh
index cf74edd..0b2b151 100644
--- a/paludis/qa/deps_visible_check.hh
+++ b/paludis/qa/deps_visible_check.hh
@@ -20,7 +20,7 @@
#ifndef PALUDIS_GUARD_PALUDIS_QA_DEPS_VISIBLE_CHECK_HH
#define PALUDIS_GUARD_PALUDIS_QA_DEPS_VISIBLE_CHECK_HH 1
-#include <paludis/qa/ebuild_check.hh>
+#include <paludis/qa/per_profile_ebuild_check.hh>
#include <string>
namespace paludis
@@ -33,12 +33,12 @@ namespace paludis
* \ingroup grpqa
*/
class DepsVisibleCheck :
- public EbuildCheck
+ public PerProfileEbuildCheck
{
public:
DepsVisibleCheck();
- CheckResult operator() (const EbuildCheckData &) const;
+ CheckResult operator() (const PerProfileEbuildCheckData &) const;
static const std::string & identifier();
@@ -48,8 +48,9 @@ namespace paludis
}
};
- static const EbuildCheckMaker::RegisterMaker register_deps_visible_check(
- DepsVisibleCheck::identifier(), &MakeEbuildCheck<DepsVisibleCheck>::make_ebuild_check);
+ static const PerProfileEbuildCheckMaker::RegisterMaker register_deps_visible_check(
+ DepsVisibleCheck::identifier(),
+ &MakePerProfileEbuildCheck<DepsVisibleCheck>::make_per_profile_ebuild_check);
}
}
diff --git a/paludis/qa/deps_visible_check_TEST.cc b/paludis/qa/deps_visible_check_TEST.cc
new file mode 100644
index 0000000..a36c0ea
--- /dev/null
+++ b/paludis/qa/deps_visible_check_TEST.cc
@@ -0,0 +1,114 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ *
+ * 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 "deps_visible_check.hh"
+#include "check_result.hh"
+#include "qa_environment.hh"
+#include <paludis/util/fs_entry.hh>
+#include <paludis/util/join.hh>
+#include <test/test_framework.hh>
+#include <test/test_runner.hh>
+
+using namespace paludis;
+using namespace paludis::qa;
+using namespace test;
+
+namespace test_cases
+{
+ struct DepsVisibleTest
+ {
+ QAEnvironment env;
+
+ FSEntry basedir() const
+ {
+ return FSEntry::cwd() / "deps_visible_check_TEST_dir";
+ }
+
+ DepsVisibleTest(const std::string & subdir) :
+ env(basedir() / subdir)
+ {
+ }
+ };
+
+ struct DepsVisibleNoDepsTest :
+ TestCase,
+ DepsVisibleTest
+ {
+ DepsVisibleNoDepsTest() : TestCase("no deps"), DepsVisibleTest("repo1") { }
+
+ void run()
+ {
+ PerProfileEbuildCheckData params(PerProfileEbuildCheckData::create()
+ .name(QualifiedPackageName("cat-one/pkg-one"))
+ .version(VersionSpec("1"))
+ .environment(&env)
+ .profile(basedir() / "repo1/profiles/profile"));
+
+ CheckResult r((*(*PerProfileEbuildCheckMaker::get_instance()->find_maker(
+ DepsVisibleCheck::identifier()))())(params));
+
+ TestMessageSuffix suffix("r=" + r.item() + ": " + join(r.begin(), r.end(), "; "), false);
+ TEST_CHECK(r.empty());
+ }
+ } deps_visible_no_deps_test;
+
+ struct DepsVisibleOkTest :
+ TestCase,
+ DepsVisibleTest
+ {
+ DepsVisibleOkTest() : TestCase("ok"), DepsVisibleTest("repo1") { }
+
+ void run()
+ {
+ PerProfileEbuildCheckData params(PerProfileEbuildCheckData::create()
+ .name(QualifiedPackageName("cat-one/pkg-one"))
+ .version(VersionSpec("2"))
+ .environment(&env)
+ .profile(basedir() / "repo1/profiles/profile"));
+
+ CheckResult r((*(*PerProfileEbuildCheckMaker::get_instance()->find_maker(
+ DepsVisibleCheck::identifier()))())(params));
+
+ TestMessageSuffix suffix("r=" + r.item() + ": " + join(r.begin(), r.end(), "; "), false);
+ TEST_CHECK(r.empty());
+ }
+ } deps_visible_ok_test;
+
+ struct DepsVisibleNotOkTest :
+ TestCase,
+ DepsVisibleTest
+ {
+ DepsVisibleNotOkTest() : TestCase("not ok"), DepsVisibleTest("repo1") { }
+
+ void run()
+ {
+ PerProfileEbuildCheckData params(PerProfileEbuildCheckData::create()
+ .name(QualifiedPackageName("cat-one/pkg-one"))
+ .version(VersionSpec("3"))
+ .environment(&env)
+ .profile(basedir() / "repo1/profiles/profile"));
+
+ CheckResult r((*(*PerProfileEbuildCheckMaker::get_instance()->find_maker(
+ DepsVisibleCheck::identifier()))())(params));
+
+ TEST_CHECK(! r.empty());
+ }
+ } deps_visible_not_ok_test;
+}
+
diff --git a/paludis/qa/deps_visible_check_TEST_cleanup.sh b/paludis/qa/deps_visible_check_TEST_cleanup.sh
new file mode 100755
index 0000000..9546440
--- /dev/null
+++ b/paludis/qa/deps_visible_check_TEST_cleanup.sh
@@ -0,0 +1,9 @@
+#!/bin/bash
+# vim: set ft=sh sw=4 sts=4 et :
+
+if [ -d deps_visible_check_TEST_dir ] ; then
+ rm -fr deps_visible_check_TEST_dir
+else
+ true
+fi
+
diff --git a/paludis/qa/deps_visible_check_TEST_setup.sh b/paludis/qa/deps_visible_check_TEST_setup.sh
new file mode 100755
index 0000000..c08e04b
--- /dev/null
+++ b/paludis/qa/deps_visible_check_TEST_setup.sh
@@ -0,0 +1,57 @@
+#!/bin/bash
+# vim: set ft=sh sw=4 sts=4 et :
+
+mkdir deps_visible_check_TEST_dir || exit 1
+cd deps_visible_check_TEST_dir || exit 1
+
+mkdir -p repo1/{eclass,distfiles,profiles/profile} || exit 1
+cd repo1 || exit 1
+echo "test-repo-1" > profiles/repo_name || exit 1
+cat <<END > profiles/categories || exit 1
+cat-one
+cat-two
+cat-three
+END
+cat <<END > profiles/profile/make.defaults
+ARCH=test
+END
+cat <<END > profiles/profiles.desc
+test profile/ stable
+END
+
+mkdir -p cat-one/pkg-one
+cat <<"END" > cat-one/pkg-one/pkg-one-1.ebuild
+DESCRIPTION="foo"
+SLOT="foo"
+KEYWORDS="test"
+END
+
+cat <<"END" > cat-one/pkg-one/pkg-one-2.ebuild
+DESCRIPTION="foo"
+SLOT="foo"
+KEYWORDS="test"
+DEPEND="cat-two/fnord"
+END
+
+cat <<"END" > cat-one/pkg-one/pkg-one-3.ebuild
+DESCRIPTION="foo"
+SLOT="foo"
+KEYWORDS="test"
+DEPEND=">=cat-two/fnord-2"
+END
+
+mkdir -p cat-two/fnord
+cat <<"END" > cat-two/fnord/fnord-1.ebuild
+DESCRIPTION="foo"
+SLOT="foo"
+KEYWORDS="test"
+END
+
+cat <<"END" > cat-two/fnord/fnord-2.ebuild
+DESCRIPTION="foo"
+SLOT="foo"
+KEYWORDS="~test"
+END
+
+cd ..
+
diff --git a/paludis/qa/files.m4 b/paludis/qa/files.m4
index b2cb3b9..00d2bdb 100644
--- a/paludis/qa/files.m4
+++ b/paludis/qa/files.m4
@@ -18,7 +18,7 @@ add(`dep_flags_check', `hh', `cc')
add(`dep_packages_check', `hh', `cc')
add(`deprecated_functions_check', `hh', `cc')
add(`deps_exist_check', `hh', `cc')
-add(`deps_visible_check', `hh', `cc')
+add(`deps_visible_check', `hh', `cc', `test', `testscript')
add(`description_check', `hh', `cc')
add(`digest_collisions_check', `hh', `cc')
add(`ebuild_check', `hh', `cc', `sr')
@@ -43,6 +43,7 @@ add(`metadata_file', `hh', `cc', `test')
add(`package_dir_check', `hh', `cc')
add(`package_name_check', `hh', `cc', `test', `testscript')
add(`parse_deps_check', `hh', `cc')
+add(`per_profile_ebuild_check', `hh', `cc', `sr')
add(`qa_environment', `hh', `cc', `test', `testscript', `sr')
add(`restrict_check', `hh', `cc')
add(`src_uri_check', `hh', `cc')
diff --git a/paludis/qa/per_profile_ebuild_check.cc b/paludis/qa/per_profile_ebuild_check.cc
new file mode 100644
index 0000000..ffa9f1d
--- /dev/null
+++ b/paludis/qa/per_profile_ebuild_check.cc
@@ -0,0 +1,36 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ *
+ * 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 "per_profile_ebuild_check.hh"
+
+using namespace paludis;
+using namespace paludis::qa;
+
+#include <paludis/qa/per_profile_ebuild_check-sr.cc>
+
+PerProfileEbuildCheck::PerProfileEbuildCheck()
+{
+}
+
+NoSuchPerProfileEbuildCheckTypeError::NoSuchPerProfileEbuildCheckTypeError(const std::string & s) throw () :
+ Exception("No such per profile ebuild check type: '" + s + "'")
+{
+}
+
+
diff --git a/paludis/qa/per_profile_ebuild_check.hh b/paludis/qa/per_profile_ebuild_check.hh
new file mode 100644
index 0000000..a778114
--- /dev/null
+++ b/paludis/qa/per_profile_ebuild_check.hh
@@ -0,0 +1,92 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ *
+ * 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_QA_PER_PROFILE_EBUILD_CHECK_HH
+#define PALUDIS_GUARD_PALUDIS_QA_PER_PROFILE_EBUILD_CHECK_HH 1
+
+#include <paludis/name.hh>
+#include <paludis/qa/check.hh>
+#include <paludis/qa/check_result.hh>
+#include <paludis/util/counted_ptr.hh>
+#include <paludis/util/virtual_constructor.hh>
+#include <paludis/version_spec.hh>
+
+namespace paludis
+{
+ class Environment;
+
+ namespace qa
+ {
+ class QAEnvironment;
+
+#include <paludis/qa/per_profile_ebuild_check-sr.hh>
+
+ /**
+ * Base class for QA checks that operate upon ebuilds.
+ *
+ * \ingroup grpqa
+ */
+ class PALUDIS_VISIBLE PerProfileEbuildCheck :
+ public Check,
+ public InternalCounted<PerProfileEbuildCheck>
+ {
+ protected:
+ PerProfileEbuildCheck();
+
+ public:
+ virtual CheckResult operator() (const PerProfileEbuildCheckData &) const = 0;
+ };
+
+ /**
+ * Thrown if a bad package ebuild check is requested.
+ *
+ * \ingroup grpexceptions
+ */
+ class PALUDIS_VISIBLE NoSuchPerProfileEbuildCheckTypeError :
+ public Exception
+ {
+ public:
+ NoSuchPerProfileEbuildCheckTypeError(const std::string &) throw ();
+ };
+
+ /**
+ * Make PerProfileEbuildCheck class.
+ *
+ * We're implementing things this way to avoid breaking icc70. Icky.
+ *
+ * \ingroup grpqa
+ */
+ template <typename T_>
+ struct MakePerProfileEbuildCheck
+ {
+ static PerProfileEbuildCheck::Pointer
+ make_per_profile_ebuild_check()
+ {
+ return PerProfileEbuildCheck::Pointer(new T_);
+ }
+ };
+
+ typedef VirtualConstructor<
+ std::string,
+ PerProfileEbuildCheck::Pointer (*) (),
+ virtual_constructor_not_found::ThrowException<NoSuchPerProfileEbuildCheckTypeError> > PerProfileEbuildCheckMaker;
+ }
+}
+
+#endif
diff --git a/paludis/qa/per_profile_ebuild_check.sr b/paludis/qa/per_profile_ebuild_check.sr
new file mode 100644
index 0000000..123a305
--- /dev/null
+++ b/paludis/qa/per_profile_ebuild_check.sr
@@ -0,0 +1,13 @@
+#!/bin/bash
+# vim: set sw=4 sts=4 et :
+
+make_class_PerProfileEbuildCheckData()
+{
+ key name QualifiedPackageName
+ key version VersionSpec
+ key environment "QAEnvironment *"
+ key profile FSEntry
+
+ allow_named_args
+}
+
diff --git a/paludis/qa/qa_environment.cc b/paludis/qa/qa_environment.cc
index 1a626ad..950e8ac 100644
--- a/paludis/qa/qa_environment.cc
+++ b/paludis/qa/qa_environment.cc
@@ -36,80 +36,14 @@ namespace paludis
#include <paludis/qa/qa_environment-sr.hh>
#include <paludis/qa/qa_environment-sr.cc>
}
-
- template<>
- struct Implementation<QAEnvironmentBase> :
- InternalCounted<QAEnvironmentBase>
- {
- std::vector<PackageDatabasesEntry> package_databases;
-
- Implementation(const FSEntry & base, const FSEntry & write_cache, const Environment * const env)
- {
- Context context("When creating package databases from profiles.desc under '"
- + stringify(base / "profiles") + "':");
-
- LineConfigFile profiles_desc(base / "profiles" / "profiles.desc");
- for (LineConfigFile::Iterator line(profiles_desc.begin()), line_end(profiles_desc.end()) ;
- line != line_end ; ++line)
- {
- std::vector<std::string> tokens;
- WhitespaceTokeniser::get_instance()->tokenise(*line, std::back_inserter(tokens));
-
- if (tokens.size() != 3)
- {
- Log::get_instance()->message(ll_warning, lc_context, "Skipping invalid line '"
- + *line + "'");
- continue;
- }
-
- PackageDatabase::Pointer db(new PackageDatabase(env));
-
- /* create our portage repository */
- AssociativeCollection<std::string, std::string>::Pointer keys(
- new AssociativeCollection<std::string, std::string>::Concrete);
-
- keys->insert("format", "portage");
- keys->insert("names_cache", "/var/empty");
- keys->insert("importace", "1");
- keys->insert("location", stringify(base));
- keys->insert("cache", "/var/empty");
- keys->insert("profiles", stringify(base / "profiles" / tokens.at(1)));
- keys->insert("write_cache", stringify(write_cache));
-
- db->add_repository(RepositoryMaker::get_instance()->find_maker("portage")(env,
- db.raw_pointer(), keys));
-
- /* create our virtuals repository */
- db->add_repository(RepositoryMaker::get_instance()->find_maker("virtuals")(env,
- db.raw_pointer(), AssociativeCollection<std::string, std::string>::Pointer(0)));
-
- /* make the entry */
- package_databases.push_back(PackageDatabasesEntry(PackageDatabasesEntry::create()
- .arch(UseFlagName(tokens.at(0)))
- .location(base / "profiles" / tokens.at(1))
- .status(tokens.at(2))
- .package_database(db)));
- }
-
- if (package_databases.empty())
- throw ProfilesDescError("No profiles.desc entries found");
- }
- };
-}
-
-QAEnvironmentBase::QAEnvironmentBase(const FSEntry & b,
- const FSEntry & w, const Environment * const env) :
- PrivateImplementationPattern<QAEnvironmentBase>(new Implementation<QAEnvironmentBase>(b, w, env))
-{
-}
-
-QAEnvironmentBase::~QAEnvironmentBase()
-{
}
QAEnvironment::QAEnvironment(const FSEntry & base, const FSEntry & write_cache) :
- QAEnvironmentBase(base, write_cache, this),
- Environment(_imp->package_databases.begin()->package_database)
+ NoConfigEnvironment(NoConfigEnvironmentParams::create()
+ .repository_dir(base)
+ .write_cache(write_cache)
+ .accept_unstable(false)
+ .repository_type(ncer_portage))
{
}
@@ -124,8 +58,3 @@ QAEnvironment::paludis_command() const
"'paludis_command called from within QAEnvironment'";
}
-ProfilesDescError::ProfilesDescError(const std::string & our_message) throw () :
- ConfigurationError("Bad profiles.desc: " + our_message)
-{
-}
-
diff --git a/paludis/qa/qa_environment.hh b/paludis/qa/qa_environment.hh
index b2aa381..e9e67c8 100644
--- a/paludis/qa/qa_environment.hh
+++ b/paludis/qa/qa_environment.hh
@@ -22,6 +22,7 @@
#define PALUDIS_GUARD_PALUDIS_QA_ENVIRONMENT_HH 1
#include <paludis/environment.hh>
+#include <paludis/environment/no_config/no_config_environment.hh>
#include <paludis/package_database.hh>
#include <paludis/util/private_implementation_pattern.hh>
#include <paludis/util/fs_entry.hh>
@@ -36,26 +37,11 @@ namespace paludis
namespace qa
{
/**
- * Base from member holder for our package databases.
- */
- class QAEnvironmentBase :
- private PrivateImplementationPattern<QAEnvironmentBase>
- {
- friend class QAEnvironment;
-
- protected:
- QAEnvironmentBase(const FSEntry & base, const FSEntry & write_cache,
- const Environment * const env);
- ~QAEnvironmentBase();
- };
-
- /**
* The QAEnvironment is an Environment that corresponds to the environment
* used by Qualudis for QA checks.
*/
class QAEnvironment :
- public QAEnvironmentBase,
- public Environment
+ public NoConfigEnvironment
{
public:
QAEnvironment(const FSEntry & base,
@@ -65,18 +51,6 @@ namespace paludis
virtual std::string paludis_command() const;
};
-
- /**
- * Thrown if a profiles.desc file is broken.
- *
- * \ingroup grpexceptions
- */
- class ProfilesDescError :
- public ConfigurationError
- {
- public:
- ProfilesDescError(const std::string & message) throw ();
- };
}
}
diff --git a/paludis/repositories/portage/Makefile.am b/paludis/repositories/portage/Makefile.am
index d12def0..66c6444 100644
--- a/paludis/repositories/portage/Makefile.am
+++ b/paludis/repositories/portage/Makefile.am
@@ -1,5 +1,8 @@
CLEANFILES = *~ gmon.out *.gcov *.gcno *.gcda
-DISTCLEANFILES = portage_repository-sr.hh portage_repository-sr.cc glsa-sr.hh glsa-sr.cc
+DISTCLEANFILES = \
+ portage_repository-sr.hh portage_repository-sr.cc \
+ glsa-sr.hh glsa-sr.cc \
+ portage_repository_params-sr.hh portage_repository_params-sr.cc
MAINTAINERCLEANFILES = Makefile.in
AM_CXXFLAGS = -I$(top_srcdir) @PALUDIS_CXXFLAGS@ @PALUDIS_CXXFLAGS_VISIBILITY@
@@ -17,6 +20,7 @@ libpaludisportagerepository_la_LDFLAGS = -version-info @VERSION_LIB_CURRENT@:@VE
paludis_repositories_portage_include_HEADERS = \
glsa.hh \
glsa-sr.hh \
+ portage_repository-sr.hh \
portage_repository.hh \
portage_repository_profile_file.hh \
portage_repository_profile.hh \
@@ -72,6 +76,8 @@ EXTRA_DIST = \
portage_repository_params-sr.hh \
portage_repository_params-sr.cc \
portage_repository_params.sr \
+ portage_repository-sr.hh \
+ portage_repository-sr.cc \
xml_things_TEST.cc \
xml_things_TEST_setup.sh \
xml_things_TEST_cleanup.sh
@@ -79,6 +85,8 @@ EXTRA_DIST = \
BUILT_SOURCES = \
portage_repository_params-sr.hh \
portage_repository_params-sr.cc \
+ portage_repository-sr.hh \
+ portage_repository-sr.cc \
glsa-sr.hh \
glsa-sr.cc
@@ -94,6 +102,12 @@ TESTS_ENVIRONMENT = env \
LD_LIBRARY_PATH="`$(top_srcdir)/ebuild/utils/canonicalise $(top_builddir)/paludis/repositories/portage/`" \
bash $(top_srcdir)/test/run_test.sh
+portage_repository-sr.hh : portage_repository.sr $(top_srcdir)/misc/make_sr.bash
+ $(top_srcdir)/misc/make_sr.bash --header $(srcdir)/portage_repository.sr > $@
+
+portage_repository-sr.cc : portage_repository.sr $(top_srcdir)/misc/make_sr.bash
+ $(top_srcdir)/misc/make_sr.bash --source $(srcdir)/portage_repository.sr > $@
+
portage_repository_params-sr.hh : portage_repository_params.sr $(top_srcdir)/misc/make_sr.bash
$(top_srcdir)/misc/make_sr.bash --header $(srcdir)/portage_repository_params.sr > $@
diff --git a/paludis/repositories/portage/make_ebuild_repository.cc b/paludis/repositories/portage/make_ebuild_repository.cc
index 5a9f4ab..7f24866 100644
--- a/paludis/repositories/portage/make_ebuild_repository.cc
+++ b/paludis/repositories/portage/make_ebuild_repository.cc
@@ -25,7 +25,7 @@
using namespace paludis;
-CountedPtr<Repository>
+CountedPtr<PortageRepository>
paludis::make_ebuild_repository(
const Environment * const env,
const PackageDatabase * const db,
@@ -127,7 +127,7 @@ paludis::make_ebuild_repository(
if (m->end() == m->find("buildroot") || ((buildroot = m->find("buildroot")->second)).empty())
buildroot = "/var/tmp/paludis";
- return CountedPtr<Repository>(new PortageRepository(PortageRepositoryParams::create()
+ return CountedPtr<PortageRepository>(new PortageRepository(PortageRepositoryParams::create()
.entry_format("ebuild")
.environment(env)
.package_database(db)
@@ -148,13 +148,16 @@ paludis::make_ebuild_repository(
.buildroot(buildroot)));
}
-CountedPtr<Repository>
-paludis::make_portage_repository(
- const Environment * const env,
- const PackageDatabase * const db,
- AssociativeCollection<std::string, std::string>::ConstPointer m)
+namespace
{
- return make_ebuild_repository(env, db, m);
+ CountedPtr<Repository>
+ make_ebuild_repository_wrapped(
+ const Environment * const env,
+ const PackageDatabase * const db,
+ AssociativeCollection<std::string, std::string>::ConstPointer m)
+ {
+ return make_ebuild_repository(env, db, m);
+ }
}
#ifdef PALUDIS_ENABLE_VISIBILITY
@@ -163,10 +166,10 @@ paludis::make_portage_repository(
namespace
{
const RepositoryMaker::RegisterMaker register_portage_ebuild_repository PALUDIS_ATTRIBUTE((used)) (
- "ebuild", &make_ebuild_repository);
+ "ebuild", &make_ebuild_repository_wrapped);
const RepositoryMaker::RegisterMaker register_portage_portage_repository PALUDIS_ATTRIBUTE((used)) (
- "portage", &make_portage_repository);
+ "portage", &make_ebuild_repository_wrapped);
}
#ifdef PALUDIS_ENABLE_VISIBILITY
# pragma GCC visibility pop
diff --git a/paludis/repositories/portage/make_ebuild_repository.hh b/paludis/repositories/portage/make_ebuild_repository.hh
index 8a3db2f..2b58f0f 100644
--- a/paludis/repositories/portage/make_ebuild_repository.hh
+++ b/paludis/repositories/portage/make_ebuild_repository.hh
@@ -30,23 +30,10 @@ namespace paludis
* \see PortageRepository
* \ingroup grpportagerepository
*/
- CountedPtr<Repository>
+ CountedPtr<PortageRepository>
make_ebuild_repository(const Environment * const,
const PackageDatabase * const,
AssociativeCollection<std::string, std::string>::ConstPointer) PALUDIS_VISIBLE;
-
- /**
- * Create an ebuild format repository.
- *
- * This function forwards to paludis::make_ebuild_repository().
- *
- * \see paludis::make_ebuild_repository()
- * \ingroup grpportagerepository
- */
- CountedPtr<Repository>
- make_portage_repository(const Environment * const,
- const PackageDatabase * const,
- AssociativeCollection<std::string, std::string>::ConstPointer) PALUDIS_VISIBLE;
}
#endif
diff --git a/paludis/repositories/portage/portage_repository.cc b/paludis/repositories/portage/portage_repository.cc
index 72adc00..cfccd7a 100644
--- a/paludis/repositories/portage/portage_repository.cc
+++ b/paludis/repositories/portage/portage_repository.cc
@@ -70,6 +70,8 @@
using namespace paludis;
+#include <paludis/repositories/portage/portage_repository-sr.cc>
+
namespace paludis
{
/// Map for versions.
@@ -94,6 +96,8 @@ namespace paludis
/// Map for virtuals.
typedef MakeHashedMap<QualifiedPackageName, PackageDepAtom::ConstPointer>::Type VirtualsMap;
+ typedef std::list<PortageRepositoryProfilesDescLine> ProfilesDesc;
+
/**
* Implementation data for a PortageRepository.
*
@@ -156,6 +160,8 @@ namespace paludis
/// Load profiles, if we haven't already.
inline void need_profiles() const;
+ void need_profiles_desc() const;
+
/// Our profile handler.
mutable PortageRepositoryProfile::Pointer profile_ptr;
@@ -174,6 +180,10 @@ namespace paludis
/// Have we loaded our virtuals?
bool has_our_virtuals;
+ mutable bool has_profiles_desc;
+
+ mutable ProfilesDesc profiles_desc;
+
RepositoryNameCache::Pointer names_cache;
PortageRepository * const repo;
@@ -193,6 +203,7 @@ namespace paludis
entries_ptr(PortageRepositoryEntriesMaker::get_instance()->find_maker(
params.entry_format)(params.environment, r, p)),
has_our_virtuals(false),
+ has_profiles_desc(false),
names_cache(new RepositoryNameCache(p.names_cache, r)),
repo(r)
{
@@ -213,6 +224,36 @@ namespace paludis
}
void
+ Implementation<PortageRepository>::need_profiles_desc() const
+ {
+ if (has_profiles_desc)
+ return;
+
+ Context context("When loading profiles.desc:");
+
+ LineConfigFile p(params.location / "profiles" / "profiles.desc");
+ for (LineConfigFile::Iterator line(p.begin()), line_end(p.end()) ; line != line_end ; ++line)
+ {
+ std::vector<std::string> tokens;
+ WhitespaceTokeniser::get_instance()->tokenise(*line,
+ std::back_inserter(tokens));
+ if (tokens.size() < 3)
+ continue;
+
+ FSEntryCollection::Concrete profiles;
+ profiles.push_back(params.location / "profiles" / tokens.at(1));
+ profiles_desc.push_back(PortageRepositoryProfilesDescLine::create()
+ .arch(tokens.at(0))
+ .path(*profiles.begin())
+ .status(tokens.at(2))
+ .profile(PortageRepositoryProfile::Pointer(new PortageRepositoryProfile(
+ params.environment, repo->name(), profiles))));
+ }
+
+ has_profiles_desc = true;
+ }
+
+ void
Implementation<PortageRepository>::invalidate() const
{
profile_ptr.zero();
@@ -1033,3 +1074,43 @@ PortageRepository::do_category_names_containing_package(const PackageNamePart &
return result ? result : Repository::do_category_names_containing_package(p);
}
+PortageRepository::ProfilesIterator
+PortageRepository::begin_profiles() const
+{
+ _imp->need_profiles_desc();
+ return ProfilesIterator(_imp->profiles_desc.begin());
+}
+
+PortageRepository::ProfilesIterator
+PortageRepository::end_profiles() const
+{
+ _imp->need_profiles_desc();
+ return ProfilesIterator(_imp->profiles_desc.end());
+}
+
+PortageRepository::ProfilesIterator
+PortageRepository::find_profile(const FSEntry & location) const
+{
+ _imp->need_profiles_desc();
+ for (ProfilesDesc::const_iterator i(_imp->profiles_desc.begin()),
+ i_end(_imp->profiles_desc.end()) ; i != i_end ; ++i)
+ if (i->path == location)
+ return ProfilesIterator(i);
+ return ProfilesIterator(_imp->profiles_desc.end());
+}
+
+void
+PortageRepository::set_profile(const ProfilesIterator & iter)
+{
+ _imp->profile_ptr = iter->profile;
+
+ try
+ {
+ _imp->params.environment->package_database()->fetch_repository(
+ RepositoryName("virtuals"))->invalidate();
+ }
+ catch (const NoSuchRepositoryError &)
+ {
+ }
+}
+
diff --git a/paludis/repositories/portage/portage_repository.hh b/paludis/repositories/portage/portage_repository.hh
index 470e545..78c0358 100644
--- a/paludis/repositories/portage/portage_repository.hh
+++ b/paludis/repositories/portage/portage_repository.hh
@@ -21,9 +21,11 @@
#define PALUDIS_GUARD_PALUDIS_PORTAGE_REPOSITORY_HH 1
#include <paludis/repository.hh>
+#include <paludis/package_database.hh>
#include <paludis/util/fs_entry.hh>
#include <paludis/util/private_implementation_pattern.hh>
#include <paludis/repositories/portage/portage_repository_params.hh>
+#include <paludis/repositories/portage/portage_repository_profile.hh>
#include <string>
/** \file
@@ -34,10 +36,11 @@
namespace paludis
{
- class PackageDatabase;
class PortageRepositoryProfile;
class PortageRepositoryNews;
+#include <paludis/repositories/portage/portage_repository-sr.hh>
+
/**
* A PortageRepository is a Repository that handles the layout used by
* Portage for the main Gentoo tree.
@@ -165,6 +168,19 @@ namespace paludis
const QualifiedPackageName, PackageDepAtom::ConstPointer> > OurVirtualsIterator;
///\}
+
+ ///\name Profile setting and querying functions
+ ///\{
+
+ typedef libwrapiter::ForwardIterator<PortageRepository,
+ const PortageRepositoryProfilesDescLine> ProfilesIterator;
+ ProfilesIterator begin_profiles() const;
+ ProfilesIterator end_profiles() const;
+
+ ProfilesIterator find_profile(const FSEntry & location) const;
+ void set_profile(const ProfilesIterator & iter);
+
+ ///\}
};
}
diff --git a/paludis/repositories/portage/portage_repository.sr b/paludis/repositories/portage/portage_repository.sr
new file mode 100644
index 0000000..279f015
--- /dev/null
+++ b/paludis/repositories/portage/portage_repository.sr
@@ -0,0 +1,10 @@
+make_class_PortageRepositoryProfilesDescLine()
+{
+ key path FSEntry
+ key arch std::string
+ key status std::string
+ key profile PortageRepositoryProfile::Pointer
+ allow_named_args
+}
+
+
diff --git a/ruby/paludis_ruby.cc b/ruby/paludis_ruby.cc
index fbec6f2..a75faeb 100644
--- a/ruby/paludis_ruby.cc
+++ b/ruby/paludis_ruby.cc
@@ -154,8 +154,6 @@ void paludis::ruby::exception_to_ruby_exception(const std::exception & ee)
else if (0 != dynamic_cast<const paludis::DepStringError *>(&ee))
rb_raise(c_dep_string_error, dynamic_cast<const paludis::DepStringError *>(&ee)->message().c_str());
#ifdef ENABLE_RUBY_QA
- else if (0 != dynamic_cast<const paludis::qa::ProfilesDescError *>(&ee))
- rb_raise(c_profiles_desc_error, dynamic_cast<const paludis::qa::ProfilesDescError *>(&ee)->message().c_str());
else if (0 != dynamic_cast<const paludis::qa::NoSuchFileCheckTypeError *>(&ee))
rb_raise(c_no_such_file_check_type_error, dynamic_cast<const paludis::qa::NoSuchFileCheckTypeError *>(&ee)->message().c_str());
else if (0 != dynamic_cast<const paludis::qa::NoSuchPackageDirCheckTypeError *>(&ee))
diff --git a/src/adjutrix/display_default_system_resolution.cc b/src/adjutrix/display_default_system_resolution.cc
index bea3720..314f9c2 100644
--- a/src/adjutrix/display_default_system_resolution.cc
+++ b/src/adjutrix/display_default_system_resolution.cc
@@ -21,6 +21,7 @@
#include "command_line.hh"
#include "colour.hh"
#include <paludis/config_file.hh>
+#include <paludis/repositories/portage/portage_repository.hh>
#include <paludis/util/log.hh>
#include <paludis/util/tokeniser.hh>
#include <paludis/util/dir_iterator.hh>
@@ -112,10 +113,10 @@ int do_display_default_system_resolution(NoConfigEnvironment & env)
if (CommandLine::get_instance()->a_profile.args_begin() ==
CommandLine::get_instance()->a_profile.args_end())
{
- for (NoConfigEnvironment::ProfilesIterator p(env.begin_profiles()), p_end(env.end_profiles()) ;
- p != p_end ; ++p)
+ for (PortageRepository::ProfilesIterator p(env.portage_repository()->begin_profiles()),
+ p_end(env.portage_repository()->end_profiles()) ; p != p_end ; ++p)
{
- env.set_profile(p->path);
+ env.portage_repository()->set_profile(p);
return_code |= display_default_system_resolution(env, p->arch + "." + p->status, p->path);
}
}
@@ -124,7 +125,12 @@ int do_display_default_system_resolution(NoConfigEnvironment & env)
for (args::StringSetArg::Iterator i(CommandLine::get_instance()->a_profile.args_begin()),
i_end(CommandLine::get_instance()->a_profile.args_end()) ; i != i_end ; ++i)
{
- env.set_profile(env.main_repository_dir() / "profiles" / (*i));
+ PortageRepository::ProfilesIterator p(env.portage_repository()->find_profile(
+ env.main_repository_dir() / "profiles" / (*i)));
+ if (p == env.portage_repository()->end_profiles())
+ throw ConfigurationError("Repository does not have a profile listed in profiles.desc matching '"
+ + stringify(*i) + "'");
+ env.portage_repository()->set_profile(p);
return_code |= display_default_system_resolution(env, *i, env.main_repository_dir() / "profiles" / *i);
}
}
diff --git a/src/adjutrix/display_profiles_use.cc b/src/adjutrix/display_profiles_use.cc
index cce7eac..d3f1d39 100644
--- a/src/adjutrix/display_profiles_use.cc
+++ b/src/adjutrix/display_profiles_use.cc
@@ -21,6 +21,7 @@
#include "command_line.hh"
#include "colour.hh"
#include <paludis/config_file.hh>
+#include <paludis/repositories/portage/portage_repository.hh>
#include <paludis/util/log.hh>
#include <paludis/util/tokeniser.hh>
#include <paludis/util/dir_iterator.hh>
@@ -153,10 +154,10 @@ void do_display_profiles_use(NoConfigEnvironment & env)
if (CommandLine::get_instance()->a_profile.args_begin() ==
CommandLine::get_instance()->a_profile.args_end())
{
- for (NoConfigEnvironment::ProfilesIterator p(env.begin_profiles()), p_end(env.end_profiles()) ;
- p != p_end ; ++p)
+ for (PortageRepository::ProfilesIterator p(env.portage_repository()->begin_profiles()),
+ p_end(env.portage_repository()->end_profiles()) ; p != p_end ; ++p)
{
- env.set_profile(p);
+ env.portage_repository()->set_profile(p);
display_profiles_use(env, p->arch + "." + p->status, p->path,
all_use_flags, all_use_expand_flags);
}
@@ -166,7 +167,12 @@ void do_display_profiles_use(NoConfigEnvironment & env)
for (args::StringSetArg::Iterator i(CommandLine::get_instance()->a_profile.args_begin()),
i_end(CommandLine::get_instance()->a_profile.args_end()) ; i != i_end ; ++i)
{
- env.set_profile(env.main_repository_dir() / "profiles" / (*i));
+ PortageRepository::ProfilesIterator p(env.portage_repository()->find_profile(
+ env.main_repository_dir() / "profiles" / (*i)));
+ if (p == env.portage_repository()->end_profiles())
+ throw ConfigurationError("Repository does not have a profile listed in profiles.desc matching '"
+ + stringify(*i) + "'");
+ env.portage_repository()->set_profile(p);
display_profiles_use(env, *i, env.main_repository_dir() /
"profiles" / *i, all_use_flags, all_use_expand_flags);
}
diff --git a/src/adjutrix/find_stable_candidates_TEST_setup.sh b/src/adjutrix/find_stable_candidates_TEST_setup.sh
index 74a0a4a..2e4855f 100755
--- a/src/adjutrix/find_stable_candidates_TEST_setup.sh
+++ b/src/adjutrix/find_stable_candidates_TEST_setup.sh
@@ -14,6 +14,9 @@ END
cat <<END > profiles/profile/make.defaults
ARCH=test
END
+cat <<END > profiles/profiles.desc
+test profile stable
+END
mkdir cat-one
mkdir cat-one/pkg-one
diff --git a/src/qualudis/qualudis.cc b/src/qualudis/qualudis.cc
index 0d4a168..ea0867a 100644
--- a/src/qualudis/qualudis.cc
+++ b/src/qualudis/qualudis.cc
@@ -20,6 +20,7 @@
#include <paludis/args/args.hh>
#include <paludis/paludis.hh>
#include <paludis/qa/qa.hh>
+#include <paludis/repositories/portage/portage_repository.hh>
#include <paludis/util/join.hh>
#include <paludis/util/dir_iterator.hh>
#include <paludis/util/log.hh>
@@ -73,10 +74,10 @@ namespace
}
void
- set_entry_heading(const std::string & s)
+ set_entry_heading(const std::string & s, bool local_quiet = false)
{
current_entry_heading = s;
- if (! QualudisCommandLine::get_instance()->a_quiet.specified())
+ if (! (QualudisCommandLine::get_instance()->a_quiet.specified() || local_quiet))
need_entry_heading();
}
@@ -257,7 +258,7 @@ namespace
}
bool
- do_check_package_dir(const FSEntry & dir, const Environment & env)
+ do_check_package_dir(const FSEntry & dir, qa::QAEnvironment & env)
{
Context context("When checking package '" + stringify(dir) + "':");
cerr << xterm_title("Checking " + dir.dirname().basename() + "/" +
@@ -305,6 +306,38 @@ namespace
}
}
+ if (! fatal)
+ {
+ std::list<FSEntry> files((DirIterator(dir)), DirIterator());
+ for (std::list<FSEntry>::iterator f(files.begin()) ; f != files.end() ; ++f)
+ {
+ if (! IsFileWithExtension(".ebuild")(*f))
+ continue;
+
+ for (PortageRepository::ProfilesIterator i(env.portage_repository()->begin_profiles()),
+ i_end(env.portage_repository()->end_profiles()) ; i != i_end ; ++i)
+ {
+ set_entry_heading("QA checks for package directory " + stringify(dir) +
+ " with profile " + stringify(i->path) + ":", true);
+
+ qa::PerProfileEbuildCheckData pd(
+ QualifiedPackageName(CategoryNamePart(stringify(dir.dirname().basename())),
+ PackageNamePart(stringify(dir.basename()))),
+ VersionSpec(strip_leading_string(strip_trailing_string(f->basename(), ".ebuild"),
+ stringify(dir.basename()) + "-")),
+ &env,
+ i->path);
+ do_check_kind<qa::PerProfileEbuildCheckMaker>(ok, fatal, pd);
+
+ if (fatal)
+ break;
+ }
+
+ if (fatal)
+ break;
+ }
+ }
+
if (! ok && (dir / "metadata.xml").is_regular_file())
{
cout << "metadata.xml:" << endl;
@@ -333,7 +366,7 @@ namespace
}
bool
- do_check_category_dir(const FSEntry & dir, const Environment & env)
+ do_check_category_dir(const FSEntry & dir, qa::QAEnvironment & env)
{
Context context("When checking category '" + stringify(dir) + "':");
@@ -368,7 +401,7 @@ namespace
}
bool
- do_check_eclass_dir(const FSEntry & dir, const Environment &)
+ do_check_eclass_dir(const FSEntry & dir, const qa::QAEnvironment &)
{
Context context("When checking eclass directory '" + stringify(dir) + "':");
@@ -532,6 +565,16 @@ int main(int argc, char *argv[])
(*qa::EbuildCheckMaker::get_instance()->find_maker(*i))()->describe() << endl;
cout << endl;
+ cout << "Per profile ebuild checks:" << endl;
+ std::list<std::string> per_profile_ebuild_checks;
+ qa::PerProfileEbuildCheckMaker::get_instance()->copy_keys(
+ std::back_inserter(per_profile_ebuild_checks));
+ for (std::list<std::string>::const_iterator i(per_profile_ebuild_checks.begin()),
+ i_end(per_profile_ebuild_checks.end()) ; i != i_end ; ++i)
+ cout << " " << *i << ":" << endl << " " <<
+ (*qa::PerProfileEbuildCheckMaker::get_instance()->find_maker(*i))()->describe() << endl;
+ cout << endl;
+
return EXIT_SUCCESS;
}