summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2008-10-27 11:38:11 +0000
committerPascal Rigaux <pixel@mandriva.com>2008-10-27 11:38:11 +0000
commitb494812daced7acbb49aaf27671cde8a4f055b7e (patch)
treec8be06534263a1f3d99723ba7a2dd836caa3d173
parent58ee3cbcf2b07a7538b3265605d1effa6823d9da (diff)
downloadurpmi-b494812daced7acbb49aaf27671cde8a4f055b7e.tar
urpmi-b494812daced7acbb49aaf27671cde8a4f055b7e.tar.gz
urpmi-b494812daced7acbb49aaf27671cde8a4f055b7e.tar.bz2
urpmi-b494812daced7acbb49aaf27671cde8a4f055b7e.tar.xz
urpmi-b494812daced7acbb49aaf27671cde8a4f055b7e.zip
simplify: instead of passing around {rpmdb}, set $urpm->{env_rpmdb} and use it
-rw-r--r--urpm.pm12
-rw-r--r--urpm/install.pm2
-rw-r--r--urpm/main_loop.pm1
-rw-r--r--urpm/select.pm5
4 files changed, 7 insertions, 13 deletions
diff --git a/urpm.pm b/urpm.pm
index 5e8b48cb..93d0c992 100644
--- a/urpm.pm
+++ b/urpm.pm
@@ -151,6 +151,7 @@ sub set_env {
$urpm->{prefer_list} = "$env/prefer.list";
$urpm->{prefer_vendor_list} = "$env/prefer.vendor.list";
$urpm->{statedir} = $env;
+ $urpm->{env_rpmdb} = "$env/rpmdb.cz";
}
sub set_files {
@@ -280,17 +281,12 @@ sub is_cdrom_url {
sub db_open_or_die_ {
my ($urpm, $b_write_perm) = @_;
- db_open_or_die($urpm, $urpm->{root}, $b_write_perm);
-}
-
-sub db_open_or_die__ {
- my ($urpm, $o_rpmdb) = @_;
my $db;
- if ($o_rpmdb) {
+ if ($urpm->{env_rpmdb}) {
$db = new URPM;
- $db->parse_synthesis($o_rpmdb);
+ $db->parse_synthesis($urpm->{env_rpmdb});
} else {
- $db = urpm::db_open_or_die_($urpm);
+ $db = db_open_or_die($urpm, $urpm->{root}, $b_write_perm);
}
$db;
}
diff --git a/urpm/install.pm b/urpm/install.pm
index 4ed0000e..01410a6e 100644
--- a/urpm/install.pm
+++ b/urpm/install.pm
@@ -44,7 +44,7 @@ sub build_transaction_set_ {
#- build simplest transaction (no split).
$urpm->build_transaction_set(undef, $state, split_length => 0);
} else {
- my $db = urpm::db_open_or_die__($urpm, $options{rpmdb});
+ my $db = urpm::db_open_or_die_($urpm);
my $sig_handler = sub { undef $db; exit 3 };
local $SIG{INT} = $sig_handler;
diff --git a/urpm/main_loop.pm b/urpm/main_loop.pm
index fdb82717..8761a16d 100644
--- a/urpm/main_loop.pm
+++ b/urpm/main_loop.pm
@@ -63,7 +63,6 @@ $callbacks->{post_removable} and $callbacks->{post_removable}->();
#- now create transaction just before installation, this will save user impression of slowness.
#- split of transaction should be disabled if --test is used.
urpm::install::build_transaction_set_($urpm, $state,
- rpmdb => $env && "$env/rpmdb.cz",
nodeps => $urpm->{options}{'allow-nodeps'} || $urpm->{options}{'allow-force'},
keep => $urpm->{options}{keep},
split_level => $urpm->{options}{'split-level'},
diff --git a/urpm/select.pm b/urpm/select.pm
index c780b932..f816bbb7 100644
--- a/urpm/select.pm
+++ b/urpm/select.pm
@@ -229,7 +229,6 @@ sub _search_packages_keep_best {
#- The return value is true if program should be restarted (in order to take
#- care of important packages being upgraded (priority upgrades)
#- %options :
-#- rpmdb
#- auto_select
#- install_src
#- priority_upgrade
@@ -248,7 +247,7 @@ sub resolve_dependencies {
require urpm::parallel; #- help perl_checker;
urpm::parallel::resolve_dependencies($urpm, $state, $requested, %options);
} else {
- my $db = urpm::db_open_or_die__($urpm, $options{rpmdb});
+ my $db = urpm::db_open_or_die_($urpm);
my $sig_handler = sub { undef $db; exit 3 };
local $SIG{INT} = $sig_handler;
@@ -261,7 +260,7 @@ sub resolve_dependencies {
);
}
- if ($options{priority_upgrade} && !$options{rpmdb}) {
+ if ($options{priority_upgrade} && !$urpm->{env_rpmdb}) {
#- first check if a priority_upgrade package is requested
#- (it should catch all occurences in --auto-select mode)
#- (nb: a package "foo" may appear twice, and only one will be set flag_upgrade)