diff options
author | Francois Pons <fpons@mandriva.com> | 2003-03-10 16:44:18 +0000 |
---|---|---|
committer | Francois Pons <fpons@mandriva.com> | 2003-03-10 16:44:18 +0000 |
commit | 7a020dddcbfe8607021850068d967e2ae7305cb6 (patch) | |
tree | d03bb100bf81a9c4b510593b6a940e2e1dbb9240 /URPM | |
parent | 9accf4ef442661ca16d045919b4ae062bd34ecd9 (diff) | |
download | perl-URPM-7a020dddcbfe8607021850068d967e2ae7305cb6.tar perl-URPM-7a020dddcbfe8607021850068d967e2ae7305cb6.tar.gz perl-URPM-7a020dddcbfe8607021850068d967e2ae7305cb6.tar.bz2 perl-URPM-7a020dddcbfe8607021850068d967e2ae7305cb6.tar.xz perl-URPM-7a020dddcbfe8607021850068d967e2ae7305cb6.zip |
0.81-12mdk
Diffstat (limited to 'URPM')
-rw-r--r-- | URPM/Build.pm | 19 | ||||
-rw-r--r-- | URPM/Resolve.pm | 9 |
2 files changed, 15 insertions, 13 deletions
diff --git a/URPM/Build.pm b/URPM/Build.pm index f1116e2..cdcbdc5 100644 --- a/URPM/Build.pm +++ b/URPM/Build.pm @@ -11,14 +11,14 @@ use strict; #- clean : bool to clean cache before (default no). sub parse_rpms_build_headers { my ($urpm, %options) = @_; - my ($dir, %cache, @headers, %names); + my ($dir, %cache, @headers); local (*DIR, *F); #- check for mandatory options. if (@{$options{rpms} || []} > 0) { #- build a working directory which will hold rpm headers. $dir = $options{dir} || ($ENV{TMPDIR} || "/tmp") . "/.build_hdlist"; - $options{clean} and system(($ENV{LD_LOADER} ? ($ENV{LD_LOADER}) : ()), "rm", "-rf", $dir); + $options{clean} and system($ENV{LD_LOADER} ? $ENV{LD_LOADER} : @{[]}, "rm", "-rf", $dir); -d $dir or mkdir $dir, 0755 or die "cannot create directory $dir\n"; #- examine cache if it contains any headers which will be much faster to read @@ -104,7 +104,7 @@ sub parse_headers { defined $id or die "bad header $dir/$_\n"; $options{callback} and $options{callback}->($urpm, $id, %options); } - defined $id ? ($start, $id) : (); + defined $id ? ($start, $id) : @{[]}; } #- compute dependencies, result in stored in info values of urpm. @@ -178,7 +178,7 @@ sub compute_deps { #- expand choices and closure again. my %ordered; foreach ($start .. $end) { - my @requires = ($_); + my @requires = $_; my ($dep, %requires); while (defined ($dep = shift @requires)) { exists $requires{$dep} || /^[^\d\|]*$/ and next; @@ -230,7 +230,7 @@ sub compute_deps { my ($na, $nb) = map { $urpm->{depslist}[$_]->name } ($a, $b); my ($sa, $sb) = map { /^lib(.*)/ and $1 } ($na, $nb); $sa && $sb ? $sa cmp $sb : $sa ? -1 : $sb ? +1 : $na cmp $nb; - }} ($start .. $end)} = ($start .. $end); + } } ($start .. $end)} = ($start .. $end); #- recompute requires to use packages id, drop any base packages or #- reference of a package to itself. @@ -248,7 +248,7 @@ sub compute_deps { #- this allow computation of dropable choices. my ($to_drop, @choices_base_id, @choices_id); foreach (split /\|/, $_) { - my ($id, $base) = (exists $remap_ids{$_} ? $remap_ids{$_} : $_, $urpm->{depslist}[$_]->flag_base); + my ($id, $base) = (exists($remap_ids{$_}) ? $remap_ids{$_} : $_, $urpm->{depslist}[$_]->flag_base); $base and push @choices_base_id, $id; $base &&= ! $pkg->flag_base; $to_drop ||= $id == $pkg->id || exists $requires_id{$id} || $base; @@ -271,7 +271,7 @@ sub compute_deps { next; } } elsif (/^\d+$/) { - ($id, $base) = (exists $remap_ids{$_} ? $remap_ids{$_} : $_, $urpm->{depslist}[$_]->flag_base); + ($id, $base) = (exists($remap_ids{$_}) ? $remap_ids{$_} : $_, $urpm->{depslist}[$_]->flag_base); } else { $not_founds{$_} = undef; next; @@ -294,7 +294,7 @@ sub compute_deps { foreach my $h (values %{$urpm->{provides}}) { my %provided; foreach (keys %{$h || {}}) { - $provided{exists $remap_ids{$_} ? $remap_ids{$_} : $_} = delete $h->{$_}; + $provided{exists($remap_ids{$_}) ? $remap_ids{$_} : $_} = delete $h->{$_}; } $h = \%provided; } @@ -332,6 +332,7 @@ sub build_hdlist { $ratio = $options{ratio} || 4; $split = $options{split} || 400000; + local *B; open B, "| " . ($ENV{LD_LOADER} || '') . " packdrake -b${ratio}ds '$options{hdlist}' '$dir' $split"; foreach my $pkg (@{$urpm->{depslist}}[$start .. $end]) { my $filename = $pkg->fullname; @@ -398,7 +399,7 @@ sub build_base_files { if ($options{depslist}) { open F, ">$options{depslist}"; - for (0 .. $#{$urpm->{depslist}}) { + foreach (0 .. $#{$urpm->{depslist}}) { my $pkg = $urpm->{depslist}[$_]; printf F ("%s-%s-%s.%s%s %s %s\n", $pkg->fullname, diff --git a/URPM/Resolve.pm b/URPM/Resolve.pm index 289fd7c..004e894 100644 --- a/URPM/Resolve.pm +++ b/URPM/Resolve.pm @@ -33,7 +33,7 @@ sub find_candidate_packages { #- return unresolved requires of a package (a new one or a existing one). sub unsatisfied_requires { - my ($urpm, $db, $state, $pkg, %options) = @_; + my ($_urpm, $db, $state, $pkg, %options) = @_; my %properties; #- all requires should be satisfied according to selected package, or installed packages. @@ -244,7 +244,6 @@ sub resolve_requested { my (@chosen_good_locales, @chosen_bad_locales, @chosen_other); foreach (@chosen) { $_ or next; - my $good_locales; if (my ($specific_locales) = grep { /locales-/ && ! /locales-en/ } $_->requires_nosense) { if ((grep { $urpm->{depslist}[$_]->flag_available } keys %{$urpm->{provides}{$specific_locales}}) > 0 || $db->traverse_tag('name', [ $specific_locales ], undef) > 0) { @@ -416,7 +415,9 @@ sub resolve_requested { if (grep { ranges_overlap($_, $property) } $p->provides) { #- the existing package will conflicts with selection, check if a newer #- version will be ok, else ask to remove the old. - my $packages = $urpm->find_candidate_packages($p->name, \%avoided); + my $need_deps = $p->name . " > " . ($p->epoch ? $p->epoch.":" : "") . + $p->version . "-" . $p->release; + my $packages = $urpm->find_candidate_packages($need_deps, \%avoided); my $best = join '|', map { $_->id } grep { ! grep { ranges_overlap($_, $property) } $_->provides } @{$packages->{$p->name}}; @@ -625,7 +626,7 @@ sub compute_installed_flags { #- by default, only takes best package and its obsoleted and compute #- all installed or upgrade flag. sub request_packages_to_upgrade { - my ($urpm, $db, $state, $requested, %options) = @_; + my ($urpm, $db, $_state, $requested, %options) = @_; my (%provides, %names, %skip, %requested, %obsoletes, @obsoleters); #- build direct access to best package according to name. |