aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-11-28 22:49:41 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-11-28 22:49:41 +0000
commit0c43939dfbe7eed502ae9fda607fc620ed8c7320 (patch)
tree7bf88532f44ff587d75b93786dd968e603a52403
parent8dcd5e80f234094c18905718067f946829f6924a (diff)
downloadpaludis-0c43939dfbe7eed502ae9fda607fc620ed8c7320.tar.gz
paludis-0c43939dfbe7eed502ae9fda607fc620ed8c7320.tar.xz
Show (x of y) in logs
-rwxr-xr-xhooks/log.bash18
-rw-r--r--paludis/tasks/install_task.cc26
-rw-r--r--paludis/tasks/sync_task.cc11
-rw-r--r--paludis/tasks/uninstall_task.cc12
4 files changed, 48 insertions, 19 deletions
diff --git a/hooks/log.bash b/hooks/log.bash
index ef06cf7..16a0022 100755
--- a/hooks/log.bash
+++ b/hooks/log.bash
@@ -19,16 +19,18 @@
mkdir -p "${ROOT}/var/log"
+X_OF_Y="${X_OF_Y+ (${X_OF_Y})}"
+
(
echo -n "$(date +%s ): "
case "${HOOK}" in
install_pre)
- echo "starting install of package ${TARGET}"
+ echo "starting install of package ${TARGET}${X_OF_Y}"
;;
install_post)
- echo "finished install of package ${TARGET}"
+ echo "finished install of package ${TARGET}${X_OF_Y}"
;;
install_all_pre)
@@ -40,11 +42,11 @@ mkdir -p "${ROOT}/var/log"
;;
uninstall_pre)
- echo "starting uninstall of package ${TARGET}"
+ echo "starting uninstall of package ${TARGET}${X_OF_Y}"
;;
uninstall_post)
- echo "finished uninstall of package ${TARGET}"
+ echo "finished uninstall of package ${TARGET}${X_OF_Y}"
;;
uninstall_all_pre)
@@ -56,11 +58,11 @@ mkdir -p "${ROOT}/var/log"
;;
fetch_pre)
- echo "starting fetch of package ${TARGET}"
+ echo "starting fetch of package ${TARGET}${X_OF_Y}"
;;
fetch_post)
- echo "finished fetch of package ${TARGET}"
+ echo "finished fetch of package ${TARGET}${X_OF_Y}"
;;
fetch_all_pre)
@@ -72,11 +74,11 @@ mkdir -p "${ROOT}/var/log"
;;
sync_pre)
- echo "starting sync of repository ${TARGET}"
+ echo "starting sync of repository ${TARGET}${X_OF_Y}"
;;
sync_post)
- echo "finished sync of repository ${TARGET}"
+ echo "finished sync of repository ${TARGET}${X_OF_Y}"
;;
*)
diff --git a/paludis/tasks/install_task.cc b/paludis/tasks/install_task.cc
index a8c6473..2f0c33e 100644
--- a/paludis/tasks/install_task.cc
+++ b/paludis/tasks/install_task.cc
@@ -211,11 +211,18 @@ InstallTask::execute()
}
/* fetch / install our entire list */
+ int x(0), y(0);
+ for (DepList::Iterator dep(_imp->dep_list.begin()), dep_end(_imp->dep_list.end()) ;
+ dep != dep_end ; ++dep)
+ if (! dep->skip_install)
+ ++y;
+
for (DepList::Iterator dep(_imp->dep_list.begin()), dep_end(_imp->dep_list.end()) ;
dep != dep_end ; ++dep)
{
if (dep->skip_install)
continue;
+ ++x;
_imp->current_dep_list_entry = dep;
std::string cpvr(stringify(dep->package.name) + "-" +
@@ -225,12 +232,15 @@ InstallTask::execute()
/* we're about to fetch / install one item */
if (_imp->install_options.fetch_only)
{
- _imp->env->perform_hook(Hook("fetch_pre")("TARGET", cpvr));
+ _imp->env->perform_hook(Hook("fetch_pre")
+ ("TARGET", cpvr)
+ ("X_OF_Y", stringify(x) + " of " + stringify(y)));
on_fetch_pre(*dep);
}
else
{
- _imp->env->perform_hook(Hook("install_pre")("TARGET", cpvr));
+ _imp->env->perform_hook(Hook("install_pre")("TARGET", cpvr)
+ ("X_OF_Y", stringify(x) + " of " + stringify(y)));
on_install_pre(*dep);
}
@@ -255,12 +265,14 @@ InstallTask::execute()
if (_imp->install_options.fetch_only)
{
on_fetch_post(*dep);
- _imp->env->perform_hook(Hook("fetch_post")("TARGET", cpvr));
+ _imp->env->perform_hook(Hook("fetch_post")("TARGET", cpvr)
+ ("X_OF_Y", stringify(x) + " of " + stringify(y)));
}
else
{
on_install_post(*dep);
- _imp->env->perform_hook(Hook("install_post")("TARGET", cpvr));
+ _imp->env->perform_hook(Hook("install_post")("TARGET", cpvr)
+ ("X_OF_Y", stringify(x) + " of " + stringify(y)));
}
if (_imp->install_options.fetch_only)
@@ -305,7 +317,8 @@ InstallTask::execute()
c_end(clean_list.end()) ; c != c_end ; ++c)
{
/* clean one item */
- _imp->env->perform_hook(Hook("uninstall_pre")("TARGET", stringify(*c)));
+ _imp->env->perform_hook(Hook("uninstall_pre")("TARGET", stringify(*c))
+ ("X_OF_Y", stringify(x) + " of " + stringify(y)));
on_clean_pre(*dep, *c);
const RepositoryUninstallableInterface * const uninstall_interface(
@@ -325,7 +338,8 @@ InstallTask::execute()
}
on_clean_post(*dep, *c);
- _imp->env->perform_hook(Hook("uninstall_post")("TARGET", stringify(*c)));
+ _imp->env->perform_hook(Hook("uninstall_post")("TARGET", stringify(*c))
+ ("X_OF_Y", stringify(x) + " of " + stringify(y)));
}
/* we're done cleaning */
diff --git a/paludis/tasks/sync_task.cc b/paludis/tasks/sync_task.cc
index f3f0a95..30d1581 100644
--- a/paludis/tasks/sync_task.cc
+++ b/paludis/tasks/sync_task.cc
@@ -70,12 +70,15 @@ SyncTask::execute()
_imp->targets.end(), " ")));
on_sync_all_pre();
+ int x(0), y(std::distance(_imp->targets.begin(), _imp->targets.end()));
for (std::list<RepositoryName>::const_iterator r(_imp->targets.begin()), r_end(_imp->targets.end()) ;
r != r_end ; ++r)
{
Context context_local("When syncing repository '" + stringify(*r) + "':");
+ ++x;
- _imp->env->perform_hook(Hook("sync_pre")("TARGET", stringify(*r)));
+ _imp->env->perform_hook(Hook("sync_pre")("TARGET", stringify(*r))
+ ("X_OF_Y", stringify(x) + " of " + stringify(y)));
on_sync_pre(*r);
try
@@ -89,12 +92,14 @@ SyncTask::execute()
}
catch (const SyncFailedError & e)
{
- _imp->env->perform_hook(Hook("sync_fail")("TARGET", stringify(*r)));
+ _imp->env->perform_hook(Hook("sync_fail")("TARGET", stringify(*r))
+ ("X_OF_Y", stringify(x) + " of " + stringify(y)));
on_sync_fail(*r, e);
}
on_sync_post(*r);
- _imp->env->perform_hook(Hook("sync_post")("TARGET", stringify(*r)));
+ _imp->env->perform_hook(Hook("sync_post")("TARGET", stringify(*r))
+ ("X_OF_Y", stringify(x) + " of " + stringify(y)));
}
on_sync_all_post();
diff --git a/paludis/tasks/uninstall_task.cc b/paludis/tasks/uninstall_task.cc
index 6d717bb..a4687bb 100644
--- a/paludis/tasks/uninstall_task.cc
+++ b/paludis/tasks/uninstall_task.cc
@@ -194,14 +194,21 @@ UninstallTask::execute()
_imp->raw_targets.end(), " ")));
on_uninstall_all_pre();
+ int x(0), y(0);
+ for (UninstallList::Iterator i(list.begin()), i_end(list.end()) ; i != i_end ; ++i)
+ if (! i->skip_uninstall)
+ ++y;
+
for (UninstallList::Iterator i(list.begin()), i_end(list.end()) ; i != i_end ; ++i)
{
if (i->skip_uninstall)
continue;
+ ++x;
std::string cpvr(stringify(i->package));
- _imp->env->perform_hook(Hook("uninstall_pre")("TARGET", cpvr));
+ _imp->env->perform_hook(Hook("uninstall_pre")("TARGET", cpvr)
+ ("X_OF_Y", stringify(x) + " of " + stringify(y)));
on_uninstall_pre(*i);
const RepositoryUninstallableInterface * const uninstall_interface(
@@ -221,7 +228,8 @@ UninstallTask::execute()
}
on_uninstall_post(*i);
- _imp->env->perform_hook(Hook("uninstall_post")("TARGET", cpvr));
+ _imp->env->perform_hook(Hook("uninstall_post")("TARGET", cpvr)
+ ("X_OF_Y", stringify(x) + " of " + stringify(y)));
}
on_uninstall_all_post();