aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-04-07 05:21:36 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-04-07 05:21:36 +0000
commit5c1417a1040626c2149d9b857f91ba5bc26c50fc (patch)
tree5d075f15fac7761ebbc30e6157f0ed69a2d0084e
parent8318d9615f6a84d9c67ceab7b9271a793cf94582 (diff)
downloadpaludis-5c1417a1040626c2149d9b857f91ba5bc26c50fc.tar.gz
paludis-5c1417a1040626c2149d9b857f91ba5bc26c50fc.tar.xz
Show whether we're upgrading, downgrading etc in install pretend list
-rw-r--r--src/colour.hh4
-rw-r--r--src/install.cc28
2 files changed, 31 insertions, 1 deletions
diff --git a/src/colour.hh b/src/colour.hh
index 6595a87..9b41d24 100644
--- a/src/colour.hh
+++ b/src/colour.hh
@@ -28,6 +28,7 @@ enum Colour
{
cl_red = 31,
cl_green = 32,
+ cl_yellow = 33,
cl_blue = 34,
cl_bold_red = cl_red + 100,
@@ -40,7 +41,8 @@ enum Colour
cl_slot = cl_blue,
cl_visible = cl_flag_on,
cl_masked = cl_flag_off,
- cl_heading = cl_bold_green
+ cl_heading = cl_bold_green,
+ cl_updatemode = cl_yellow
};
bool use_colour() PALUDIS_ATTRIBUTE((pure));
diff --git a/src/install.cc b/src/install.cc
index 58a3f29..a8b2b2c 100644
--- a/src/install.cc
+++ b/src/install.cc
@@ -101,6 +101,8 @@ do_install()
for (p::DepList::Iterator dep(dep_list.begin()), dep_end(dep_list.end()) ;
dep != dep_end ; ++dep)
{
+ Context loop_context("When displaying DepList entry '" + stringify(*dep) + "':");
+
/* display name */
cout << "* " << colour(cl_package_name, dep->get<p::dle_name>());
@@ -118,6 +120,32 @@ do_install()
cout << colour(cl_slot, " {:" + p::stringify(
dep->get<p::dle_metadata>()->get(p::vmk_slot)) + "}");
+ /* indicate [U], [S] or [N]. display existing version, if we're
+ * already installed */
+ p::PackageDatabaseEntryCollection::Pointer existing(env->package_database()->
+ query(p::PackageDepAtom::Pointer(new p::PackageDepAtom(p::stringify(
+ dep->get<p::dle_name>()))), p::is_installed_only));
+
+ if (existing->empty())
+ cout << colour(cl_updatemode, " [N]");
+ else
+ {
+ existing = env->package_database()->query(p::PackageDepAtom::Pointer(
+ new p::PackageDepAtom(p::stringify(dep->get<p::dle_name>()) + ":" +
+ dep->get<p::dle_metadata>()->get(vmk_slot))),
+ p::is_installed_only);
+ if (existing->empty())
+ cout << colour(cl_updatemode, " [S]");
+ else if (existing->last()->get<p::pde_version>() < dep->get<p::dle_version>())
+ cout << colour(cl_updatemode, " [U " + stringify(
+ existing->last()->get<pde_version>()) + "]");
+ else if (existing->last()->get<p::pde_version>() > dep->get<p::dle_version>())
+ cout << colour(cl_updatemode, " [D " + stringify(
+ existing->last()->get<pde_version>()) + "]");
+ else
+ cout << colour(cl_updatemode, " [R]");
+ }
+
/* fetch db entry */
p::PackageDatabaseEntry p(p::PackageDatabaseEntry(dep->get<p::dle_name>(),
dep->get<p::dle_version>(), dep->get<p::dle_repository>()));