summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2008-03-11 14:29:42 +0000
committerPascal Rigaux <pixel@mandriva.com>2008-03-11 14:29:42 +0000
commitbf81740eea5d5e354bb8de76e6505d1d5b3af3dd (patch)
tree901363f28783c04c5d1b96f23161819a15e501f0
parent766ff34cae51aaba217851a184c0f91530fbc16d (diff)
downloadurpmi-bf81740eea5d5e354bb8de76e6505d1d5b3af3dd.tar
urpmi-bf81740eea5d5e354bb8de76e6505d1d5b3af3dd.tar.gz
urpmi-bf81740eea5d5e354bb8de76e6505d1d5b3af3dd.tar.bz2
urpmi-bf81740eea5d5e354bb8de76e6505d1d5b3af3dd.tar.xz
urpmi-bf81740eea5d5e354bb8de76e6505d1d5b3af3dd.zip
- urpmi:
o have a nicer error message when perl-Hal-Cdroms is missing (#38778)
-rw-r--r--NEWS2
-rw-r--r--urpm/cdrom.pm6
2 files changed, 6 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index 6bcbcc2e..5afc90d8 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,8 @@
- bash-completion:
o restore available-pkgs completion using "urpmq --list" by default
(it needed COMP_URPMI_HDLISTS to be set, but it should be fast enough now)
+- urpmi:
+ o have a nicer error message when perl-Hal-Cdroms is missing (#38778)
Version 5.9 - 7 March 2008, by Thierry Vignaud
diff --git a/urpm/cdrom.pm b/urpm/cdrom.pm
index a2b2e7c8..385ac978 100644
--- a/urpm/cdrom.pm
+++ b/urpm/cdrom.pm
@@ -63,7 +63,8 @@ sub _try_mounting_cdrom_using_hal {
$urpm->{cdrom_mounted} = {}; # reset
- require Hal::Cdroms;
+ eval { require Hal::Cdroms; 1 } or $urpm->{error}(N("you must mount cdrom or install perl-Hal-Cdroms to have it done automatically")), return();
+
my $hal_cdroms = Hal::Cdroms->new;
foreach my $hal_path ($hal_cdroms->list) {
my $mntpoint;
@@ -121,7 +122,8 @@ sub _eject_cdrom {
my $mntpoint = delete $urpm->{cdrom_mounted}{$hal_path};
$urpm->{debug} and $urpm->{debug}("umounting and ejecting $mntpoint (cdrom $hal_path)");
- require Hal::Cdroms;
+ eval { require Hal::Cdroms; 1 } or return;
+
my $hal_cdroms = Hal::Cdroms->new;
$hal_cdroms->unmount($hal_path) or do {
my $mntpoint = $hal_cdroms->get_mount_point($hal_path);