summaryrefslogtreecommitdiffstats
path: root/urpm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2008-03-18 09:11:33 +0000
committerPascal Rigaux <pixel@mandriva.com>2008-03-18 09:11:33 +0000
commit2d334b04228f9ac254b21816567e45a6e08fe9d4 (patch)
tree0d287318d48715835577e6dbbe7cbd8075b1f0fc /urpm
parent7117441a1ed466bc2531618ed97639345cb451f7 (diff)
downloadurpmi-2d334b04228f9ac254b21816567e45a6e08fe9d4.tar
urpmi-2d334b04228f9ac254b21816567e45a6e08fe9d4.tar.gz
urpmi-2d334b04228f9ac254b21816567e45a6e08fe9d4.tar.bz2
urpmi-2d334b04228f9ac254b21816567e45a6e08fe9d4.tar.xz
urpmi-2d334b04228f9ac254b21816567e45a6e08fe9d4.zip
handle need_restart() rooted (not very useful, except for tests!)
Diffstat (limited to 'urpm')
-rw-r--r--urpm/main_loop.pm2
-rw-r--r--urpm/sys.pm11
2 files changed, 8 insertions, 5 deletions
diff --git a/urpm/main_loop.pm b/urpm/main_loop.pm
index ff81ee7a..c02e6004 100644
--- a/urpm/main_loop.pm
+++ b/urpm/main_loop.pm
@@ -307,7 +307,7 @@ if ($nok) {
print N("Installation is possible"), "\n";
} elsif (intersection([ keys %{$state->{selected}} ],
[ keys %{$urpm->{provides}{'should-restart'}} ])) {
- if (my $need_restart_formatted = urpm::sys::need_restart_formatted()) {
+ if (my $need_restart_formatted = urpm::sys::need_restart_formatted($urpm->{root})) {
$callbacks->{need_restart}($need_restart_formatted) if $callbacks->{need_restart};
}
}
diff --git a/urpm/sys.pm b/urpm/sys.pm
index 08baa0ff..acbc5a9e 100644
--- a/urpm/sys.pm
+++ b/urpm/sys.pm
@@ -161,9 +161,11 @@ sub _launched_time {
}
}
-sub need_restart() {
+sub need_restart {
+ my ($root) = @_;
my $rpm_qf = '%{name} %{installtime} [%{provides}:%{Provideversion} ]\n';
- open(my $F, "rpm -q --whatprovides should-restart --qf '$rpm_qf' | uniq |");
+ my $options = ($root ? "--root $root " : '') . "-q --whatprovides should-restart --qf '$rpm_qf'";
+ open(my $F, "rpm $options | uniq |");
my (%need_restart, %launched_time);
while (my $line = <$F>) {
@@ -181,8 +183,9 @@ sub need_restart() {
%need_restart && \%need_restart;
}
-sub need_restart_formatted() {
- my $need_restart = need_restart() or return;
+sub need_restart_formatted {
+ my ($root) = @_;
+ my $need_restart = need_restart($root) or return;
foreach (keys %$need_restart) {
$need_restart->{$_} = N("You should restart %s for %s", translate($_), join(', ', sort @{$need_restart->{$_}}));