diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2006-11-21 16:44:20 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2006-11-21 16:44:20 +0000 |
commit | 7a06098308affed9fd1498dc8f1cda7e7b6819d8 (patch) | |
tree | 844ff685783210d69488800cf966d2d0d70fd4cb | |
parent | 6dd79ba8245b0e9aedaadcccc0c38564d8826abf (diff) | |
download | urpmi-7a06098308affed9fd1498dc8f1cda7e7b6819d8.tar urpmi-7a06098308affed9fd1498dc8f1cda7e7b6819d8.tar.gz urpmi-7a06098308affed9fd1498dc8f1cda7e7b6819d8.tar.bz2 urpmi-7a06098308affed9fd1498dc8f1cda7e7b6819d8.tar.xz urpmi-7a06098308affed9fd1498dc8f1cda7e7b6819d8.zip |
move create_transaction() and prepare_transaction() from urpm.pm into urpm/install.pm
-rwxr-xr-x | gurpmi2 | 4 | ||||
-rw-r--r-- | urpm.pm | 38 | ||||
-rw-r--r-- | urpm/install.pm | 39 | ||||
-rwxr-xr-x | urpmi | 4 |
4 files changed, 43 insertions, 42 deletions
@@ -228,7 +228,7 @@ sub do_install_3 () { exit 0 if $response eq 'cancel'; 1; }); - $urpm->create_transaction( + urpm::install::create_transaction($urpm, $state, split_level => $urpm->{options}{'split-level'}, split_length => $urpm->{options}{'split-length'}, @@ -237,7 +237,7 @@ sub do_install_3 () { my $progress_nb; foreach my $set (@{$state->{transaction} || []}) { my (@transaction_list, %transaction_sources); - $urpm->prepare_transaction($set, $list, \%sources, \@transaction_list, \%transaction_sources); + urpm::install::prepare_transaction($urpm, $set, $list, \%sources, \@transaction_list, \%transaction_sources); $urpm->download_packages_of_distant_media( \@transaction_list, \%transaction_sources, @@ -2210,32 +2210,6 @@ sub resolve_dependencies { $need_restart; } -sub create_transaction { - my ($urpm, $state, %options) = @_; - - if ($urpm->{parallel_handler} || !$options{split_length} || - keys %{$state->{selected}} < $options{split_level}) { - #- build simplest transaction (no split). - $urpm->build_transaction_set(undef, $state, split_length => 0); - } else { - my $db; - - if ($options{rpmdb}) { - $db = new URPM; - $db->parse_synthesis($options{rpmdb}); - } else { - $db = db_open_or_die($urpm, $urpm->{root}); - } - - my $sig_handler = sub { undef $db; exit 3 }; - local $SIG{INT} = $sig_handler; - local $SIG{QUIT} = $sig_handler; - - #- build transaction set... - $urpm->build_transaction_set($db, $state, split_length => $options{split_length}); - } -} - #- get the list of packages that should not be upgraded or installed, #- typically from the inst.list or skip.list files. sub get_packages_list { @@ -2618,18 +2592,6 @@ sub download_packages_of_distant_media { 1; } -#- prepare transaction. -sub prepare_transaction { - my ($_urpm, $set, $list, $sources, $transaction_list, $transaction_sources) = @_; - - foreach my $id (@{$set->{upgrade}}) { - foreach (0..$#$list) { - exists $list->[$_]{$id} and $transaction_list->[$_]{$id} = $list->[$_]{$id}; - } - exists $sources->{$id} and $transaction_sources->{$id} = $sources->{$id}; - } -} - #- extract package that should be installed instead of upgraded, #- sources is a hash of id -> source rpm filename. sub extract_packages_to_install { diff --git a/urpm/install.pm b/urpm/install.pm index c17c72f6..0c0df043 100644 --- a/urpm/install.pm +++ b/urpm/install.pm @@ -16,6 +16,45 @@ eval { $progress_size < 5 and $progress_size = 5; }; + +#- prepare transaction. +sub prepare_transaction { + my ($_urpm, $set, $list, $sources, $transaction_list, $transaction_sources) = @_; + + foreach my $id (@{$set->{upgrade}}) { + foreach (0..$#$list) { + exists $list->[$_]{$id} and $transaction_list->[$_]{$id} = $list->[$_]{$id}; + } + exists $sources->{$id} and $transaction_sources->{$id} = $sources->{$id}; + } +} + +sub create_transaction { + my ($urpm, $state, %options) = @_; + + if ($urpm->{parallel_handler} || !$options{split_length} || + keys %{$state->{selected}} < $options{split_level}) { + #- build simplest transaction (no split). + $urpm->build_transaction_set(undef, $state, split_length => 0); + } else { + my $db; + + if ($options{rpmdb}) { + $db = new URPM; + $db->parse_synthesis($options{rpmdb}); + } else { + $db = urpm::db_open_or_die($urpm, $urpm->{root}); + } + + my $sig_handler = sub { undef $db; exit 3 }; + local $SIG{INT} = $sig_handler; + local $SIG{QUIT} = $sig_handler; + + #- build transaction set... + $urpm->build_transaction_set($db, $state, split_length => $options{split_length}); + } +} + # install logger callback sub install_logger { my ($urpm, $type, $id, $subtype, $amount, $total) = @_; @@ -609,7 +609,7 @@ $urpm->copy_packages_of_removable_media( #- now create transaction just before installation, this will save user impression of slowness. #- split of transaction should be disabled if --test is used. -$urpm->create_transaction($state, +urpm::install::create_transaction($urpm, $state, nodeps => $urpm->{options}{'allow-nodeps'} || $urpm->{options}{'allow-force'}, split_level => $urpm->{options}{'split-level'}, split_length => !$test && $urpm->{options}{'split-length'}); @@ -624,7 +624,7 @@ foreach my $set (@{$state->{transaction} || []}) { print "\n"; #- prepare transaction... - $urpm->prepare_transaction($set, $list, \%sources, \@transaction_list, \%transaction_sources); + urpm::install::prepare_transaction($urpm, $set, $list, \%sources, \@transaction_list, \%transaction_sources); #- first, filter out what is really needed to download for this small transaction. $urpm->download_packages_of_distant_media( |