aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-05-05 00:24:49 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-05-05 00:24:49 +0000
commitecdff783d01e26f51eb11f08c7c935a67049d4ce (patch)
tree62ff8847c8fe6d05858694ed89a3a5f2add13de4
parentffb66c65756ed3911bf11fe70ec0cf783363d6ab (diff)
downloadpaludis-ecdff783d01e26f51eb11f08c7c935a67049d4ce.tar.gz
paludis-ecdff783d01e26f51eb11f08c7c935a67049d4ce.tar.xz
Rework dep tagging, and use it more heavily
-rw-r--r--paludis/default_environment.cc10
-rw-r--r--paludis/dep_tag.cc42
-rw-r--r--paludis/dep_tag.hh26
-rw-r--r--paludis/environment.cc2
-rw-r--r--paludis/portage_repository.cc18
-rw-r--r--paludis/vdb_repository.cc4
-rw-r--r--src/install.cc14
7 files changed, 108 insertions, 8 deletions
diff --git a/paludis/default_environment.cc b/paludis/default_environment.cc
index 6db4898..07e4fe8 100644
--- a/paludis/default_environment.cc
+++ b/paludis/default_environment.cc
@@ -444,6 +444,7 @@ DefaultEnvironment::local_package_set(const std::string & s) const
{
LineConfigFile f(ff);
AllDepAtom::Pointer result(new AllDepAtom);
+ GeneralSetDepTag::Pointer tag(new GeneralSetDepTag(s));
for (LineConfigFile::Iterator line(f.begin()), line_end(f.end()) ;
line != line_end ; ++line)
@@ -457,15 +458,20 @@ DefaultEnvironment::local_package_set(const std::string & s) const
{
Log::get_instance()->message(ll_warning, "Line '" + *line + "' in set file '"
+ stringify(ff) + "' does not specify '*' or '?', assuming '*'");
- result->add_child(PackageDepAtom::Pointer(new PackageDepAtom(tokens.at(0))));
+ PackageDepAtom::Pointer atom(new PackageDepAtom(tokens.at(0)));
+ atom->set_tag(tag);
+ result->add_child(atom);
}
else if ("*" == tokens.at(0))
{
- result->add_child(PackageDepAtom::Pointer(new PackageDepAtom(tokens.at(1))));
+ 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 (! package_database()->query(
PackageDepAtom::Pointer(new PackageDepAtom(p->package())),
is_installed_only)->empty())
diff --git a/paludis/dep_tag.cc b/paludis/dep_tag.cc
index 67be095..2c793c3 100644
--- a/paludis/dep_tag.cc
+++ b/paludis/dep_tag.cc
@@ -53,6 +53,31 @@ namespace
*/
static const DepTagCategoryMaker::RegisterMaker register_glsa_dep_tag("glsa",
&make_glsa_dep_tag);
+
+ /**
+ * Create the DepTagCategory for seneral sets.
+ *
+ * \see register_general_set_dep_tag
+ *
+ * \ingroup grpdeptag
+ */
+ DepTagCategory::ConstPointer
+ make_general_set_dep_tag()
+ {
+ return DepTagCategory::ConstPointer(new DepTagCategory(
+ "general",
+ "General sets",
+ "",
+ ""));
+ }
+
+ /**
+ * Register the general set dep tag category instance.
+ *
+ * \ingroup grpdeptag
+ */
+ static const DepTagCategoryMaker::RegisterMaker register_general_set_dep_tag("general",
+ &make_general_set_dep_tag);
}
DepTagCategory::DepTagCategory(const std::string & id,
@@ -102,3 +127,20 @@ GLSADepTag::glsa_title() const
return _glsa_title;
}
+GeneralSetDepTag::GeneralSetDepTag(const std::string & id) :
+ _id(id)
+{
+}
+
+std::string
+GeneralSetDepTag::short_text() const
+{
+ return _id;
+}
+
+std::string
+GeneralSetDepTag::category() const
+{
+ return "general";
+}
+
diff --git a/paludis/dep_tag.hh b/paludis/dep_tag.hh
index 32252e1..1269c32 100644
--- a/paludis/dep_tag.hh
+++ b/paludis/dep_tag.hh
@@ -125,13 +125,14 @@ namespace paludis
class DepTag;
class GLSADepTag;
+ class GeneralSetDepTag;
/**
* Visitor class for visiting the different DepTag subclasses.
*
* \ingroup grpdeptag
*/
- typedef VisitorTypes<GLSADepTag *> DepTagVisitorTypes;
+ typedef VisitorTypes<GLSADepTag *, GeneralSetDepTag *> DepTagVisitorTypes;
/**
* A DepTag can be associated with a PackageDepAtom, and is transferred
@@ -216,6 +217,29 @@ namespace paludis
*/
std::string glsa_title() const;
};
+
+ /**
+ * DepTag subclass for general sets.
+ *
+ * \ingroup grpdeptag
+ */
+ class GeneralSetDepTag :
+ public DepTag,
+ public Visitable<GeneralSetDepTag, DepTagVisitorTypes>
+ {
+ private:
+ const std::string _id;
+
+ public:
+ /**
+ * Constructor.
+ */
+ GeneralSetDepTag(const std::string & id);
+
+ virtual std::string short_text() const;
+
+ virtual std::string category() const;
+ };
}
#endif
diff --git a/paludis/environment.cc b/paludis/environment.cc
index 3638ae5..b793337 100644
--- a/paludis/environment.cc
+++ b/paludis/environment.cc
@@ -224,7 +224,7 @@ Environment::end_provide_map() const
DepAtom::Pointer
Environment::package_set(const std::string & s) const
{
- if (s == "everything" || s == "system" || s == "world")
+ if (s == "everything" || s == "system" || s == "world" || s == "security")
{
AllDepAtom::Pointer result(new AllDepAtom);
diff --git a/paludis/portage_repository.cc b/paludis/portage_repository.cc
index 680bf70..1c3993e 100644
--- a/paludis/portage_repository.cc
+++ b/paludis/portage_repository.cc
@@ -208,6 +208,9 @@ namespace paludis
/// System packages.
mutable AllDepAtom::Pointer system_packages;
+ /// Tag for system packages.
+ mutable GeneralSetDepTag::Pointer system_tag;
+
/// Constructor.
Implementation(const PortageRepositoryParams &);
@@ -247,7 +250,8 @@ Implementation<PortageRepository>::Implementation(const PortageRepositoryParams
has_profile(false),
has_arch_list(false),
has_mirrors(false),
- system_packages(new AllDepAtom)
+ system_packages(new AllDepAtom),
+ system_tag(new GeneralSetDepTag("system"))
{
}
@@ -415,6 +419,7 @@ Implementation<PortageRepository>::add_profile_r(const FSEntry & f) const
Context context_line("When parsing line '" + *line + "':");
PackageDepAtom::Pointer atom(new PackageDepAtom(line->substr(1)));
+ atom->set_tag(system_tag);
system_packages->add_child(atom);
}
}
@@ -1581,6 +1586,8 @@ PortageRepository::do_package_set(const std::string & s) const
}
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) + "':");
@@ -1600,15 +1607,20 @@ PortageRepository::do_package_set(const std::string & s) const
{
Log::get_instance()->message(ll_warning, "Line '" + *line + "' in set file '"
+ stringify(ff) + "' does not specify '*' or '?', assuming '*'");
- result->add_child(PackageDepAtom::Pointer(new PackageDepAtom(tokens.at(0))));
+ PackageDepAtom::Pointer atom(new PackageDepAtom(tokens.at(0)));
+ atom->set_tag(tag);
+ result->add_child(atom);
}
else if ("*" == tokens.at(0))
{
- result->add_child(PackageDepAtom::Pointer(new PackageDepAtom(tokens.at(1))));
+ 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())
diff --git a/paludis/vdb_repository.cc b/paludis/vdb_repository.cc
index a3c84db..17dc998 100644
--- a/paludis/vdb_repository.cc
+++ b/paludis/vdb_repository.cc
@@ -737,6 +737,7 @@ VDBRepository::do_package_set(const std::string & s) const
if ("everything" == s)
{
AllDepAtom::Pointer result(new AllDepAtom);
+ GeneralSetDepTag::Pointer tag(new GeneralSetDepTag("everything"));
if (! _imp->entries_valid)
_imp->load_entries();
@@ -745,6 +746,7 @@ VDBRepository::do_package_set(const std::string & s) const
p_end(_imp->entries.end()) ; p != p_end ; ++p)
{
PackageDepAtom::Pointer atom(new PackageDepAtom(p->name));
+ atom->set_tag(tag);
result->add_child(atom);
}
@@ -753,6 +755,7 @@ VDBRepository::do_package_set(const std::string & s) const
else if ("world" == s)
{
AllDepAtom::Pointer result(new AllDepAtom);
+ GeneralSetDepTag::Pointer tag(new GeneralSetDepTag("world"));
if (_imp->world_file.exists())
{
@@ -762,6 +765,7 @@ VDBRepository::do_package_set(const std::string & s) const
line != line_end ; ++line)
{
PackageDepAtom::Pointer atom(new PackageDepAtom(QualifiedPackageName(*line)));
+ atom->set_tag(tag);
result->add_child(atom);
}
}
diff --git a/src/install.cc b/src/install.cc
index c6eab33..0a0bbc8 100644
--- a/src/install.cc
+++ b/src/install.cc
@@ -44,6 +44,18 @@ namespace
cout << "* " << colour(cl_yellow, tag->short_text()) << ": "
<< tag->glsa_title() << endl;
}
+
+ void visit(const p::GeneralSetDepTag * const tag)
+ {
+ cout << "* " << colour(cl_yellow, tag->short_text());
+ if (tag->short_text() == "world")
+ cout << ": " << "Packages that have been explicitly installed";
+ else if (tag->short_text() == "everything")
+ cout << ": " << "All installed packages";
+ else if (tag->short_text() == "system")
+ cout << ": " << "Packages that are part of the base system";
+ cout << endl;
+ }
};
}
@@ -256,7 +268,7 @@ do_install()
find_maker(*cat)());
if (! c->title().empty())
- cout << colour(cl_heading, c->title()) << endl << endl;
+ cout << colour(cl_heading, c->title()) << ":" << endl << endl;
if (! c->pre_text().empty())
cout << c->pre_text() << endl << endl;