From 19cd735585aaec445f59e00b84221bcd9e669c56 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Mon, 25 Feb 2013 17:57:16 +0000 Subject: enable callers to pass their own callbacks for erasure progress & errors eg: for rpmdrake/gurpm/drakx --- NEWS | 2 ++ urpm/install.pm | 4 ++-- urpm/main_loop.pm | 3 +++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 7121c8e0..d54092e8 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,6 @@ - library: + o enable rpmdrake/gurpm/drakx to pass their own callbacks for erasure + progress & errors o enhanced doc Version 7.19 - 9 February 2013, by Thierry Vignaud diff --git a/urpm/install.pm b/urpm/install.pm index b970d93c..a6478b11 100644 --- a/urpm/install.pm +++ b/urpm/install.pm @@ -298,9 +298,9 @@ sub _get_callbacks { } }; - $options->{callback_uninst} = $options->{verbose} >= 0 ? \&install_logger : $erase_logger; + $options->{callback_uninst} ||= $options->{verbose} >= 0 ? \&install_logger : $erase_logger; - $options->{callback_error} = sub { + $options->{callback_error} ||= sub { my ($urpm, undef, $id, $subtype) = @_; my $n = $urpm->{depslist}[$id]->fullname; $urpm->{error}("ERROR: '$subtype' failed for $n: "); diff --git a/urpm/main_loop.pm b/urpm/main_loop.pm index 66b211b3..099c68da 100644 --- a/urpm/main_loop.pm +++ b/urpm/main_loop.pm @@ -217,6 +217,7 @@ sub _init_common_options { justdb => $options{justdb}, replacepkgs => $options{replacepkgs}, callback_close_helper => $callbacks->{close_helper}, + callback_error => $callbacks->{error}, callback_inst => $callbacks->{inst}, callback_open_helper => $callbacks->{open_helper}, callback_trans => $callbacks->{trans}, @@ -411,6 +412,8 @@ Parameters: =item trans() called for transaction opening/progress/end +=item error() called for cpio, script or unpacking errors + =item callback_report_uninst(): called for erasure progrses =back -- cgit v1.2.1