summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2008-07-01 10:53:07 +0000
committerPascal Rigaux <pixel@mandriva.com>2008-07-01 10:53:07 +0000
commite7680509b66f204cdb2e3925d333f07746dc4c36 (patch)
tree952b1c8d1e0fca5d9e7deaed288152d6ada4bc24
parentd99173d6e61042d0ba9c4a6372c9e2a47d3bf942 (diff)
downloadurpmi-e7680509b66f204cdb2e3925d333f07746dc4c36.tar
urpmi-e7680509b66f204cdb2e3925d333f07746dc4c36.tar.gz
urpmi-e7680509b66f204cdb2e3925d333f07746dc4c36.tar.bz2
urpmi-e7680509b66f204cdb2e3925d333f07746dc4c36.tar.xz
urpmi-e7680509b66f204cdb2e3925d333f07746dc4c36.zip
create db_open_or_die_() and use it
-rw-r--r--urpm.pm6
-rw-r--r--urpm/install.pm4
-rw-r--r--urpm/select.pm6
-rwxr-xr-xurpmi2
4 files changed, 12 insertions, 6 deletions
diff --git a/urpm.pm b/urpm.pm
index 06b74537..41852e0a 100644
--- a/urpm.pm
+++ b/urpm.pm
@@ -224,6 +224,12 @@ sub is_cdrom_url {
protocol_from_url($url) eq 'cdrom';
}
+sub db_open_or_die_ {
+ my ($urpm, $b_write_perm) = @_;
+ db_open_or_die($urpm, $urpm->{root}, $b_write_perm);
+}
+
+# please use higher level function db_open_or_die_()
sub db_open_or_die {
my ($urpm, $root, $b_write_perm) = @_;
diff --git a/urpm/install.pm b/urpm/install.pm
index a48fbf7c..bd45298e 100644
--- a/urpm/install.pm
+++ b/urpm/install.pm
@@ -43,7 +43,7 @@ sub build_transaction_set_ {
$db = new URPM;
$db->parse_synthesis($options{rpmdb});
} else {
- $db = urpm::db_open_or_die($urpm, $urpm->{root});
+ $db = urpm::db_open_or_die_($urpm);
}
my $sig_handler = sub { undef $db; exit 3 };
@@ -146,7 +146,7 @@ sub install {
my ($urpm, $remove, $install, $upgrade, %options) = @_;
$options{translate_message} = 1;
- my $db = urpm::db_open_or_die($urpm, $urpm->{root}, !$options{test}); #- open in read/write mode unless testing installation.
+ my $db = urpm::db_open_or_die_($urpm, !$options{test}); #- open in read/write mode unless testing installation.
my $trans = $db->create_transaction($urpm->{root});
if ($trans) {
diff --git a/urpm/select.pm b/urpm/select.pm
index f04d3bff..dc663d6f 100644
--- a/urpm/select.pm
+++ b/urpm/select.pm
@@ -248,7 +248,7 @@ sub resolve_dependencies {
$db = new URPM;
$db->parse_synthesis($options{rpmdb});
} else {
- $db = urpm::db_open_or_die($urpm, $urpm->{root});
+ $db = urpm::db_open_or_die_($urpm);
}
my $sig_handler = sub { undef $db; exit 3 };
@@ -285,7 +285,7 @@ sub resolve_dependencies {
sub select_replacepkgs {
my ($urpm, $state, $requested) = @_;
- my $db = urpm::db_open_or_die($urpm, $urpm->{root});
+ my $db = urpm::db_open_or_die_($urpm);
foreach my $id (keys %$requested) {
my @pkgs = $urpm->find_candidate_packages_($id);
if (my ($pkg) = grep { URPM::is_package_installed($db, $_) } @pkgs) {
@@ -387,7 +387,7 @@ sub find_packages_to_remove {
#- invoke parallel finder.
$urpm->{parallel_handler}->parallel_find_remove($urpm, $state, $l, %options, find_packages_to_remove => 1);
} else {
- my $db = urpm::db_open_or_die($urpm, $urpm->{root});
+ my $db = urpm::db_open_or_die_($urpm);
my (@m, @notfound);
if (!$options{matches}) {
diff --git a/urpmi b/urpmi
index 3cc0400e..3792230c 100755
--- a/urpmi
+++ b/urpmi
@@ -537,7 +537,7 @@ if (@ask_unselect) {
my @ask_remove = $urpm->{options}{'allow-force'} ? @{[]} : urpm::select::removed_packages($urpm, $state);
if (@ask_remove) {
{
- my $db = urpm::db_open_or_die($urpm, $urpm->{root});
+ my $db = urpm::db_open_or_die_($urpm);
urpm::select::find_removed_from_basesystem($urpm, $db, $state, sub {
my $urpm = shift @_;
foreach (@_) {