aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrancois Pons <fpons@mandriva.com>2002-08-26 18:29:31 +0000
committerFrancois Pons <fpons@mandriva.com>2002-08-26 18:29:31 +0000
commit7860a9828ba608e67bff059f77d53370a400b569 (patch)
tree4ffb2db20547509f9fae6cb91254a492ef9b018b
parentab3408fe242a4213474eff67085d5509367babda (diff)
downloadperl-URPM-7860a9828ba608e67bff059f77d53370a400b569.tar
perl-URPM-7860a9828ba608e67bff059f77d53370a400b569.tar.gz
perl-URPM-7860a9828ba608e67bff059f77d53370a400b569.tar.bz2
perl-URPM-7860a9828ba608e67bff059f77d53370a400b569.tar.xz
perl-URPM-7860a9828ba608e67bff059f77d53370a400b569.zip
0.70-2mdk
-rw-r--r--URPM.xs6
-rw-r--r--URPM/Resolve.pm27
-rw-r--r--perl-URPM.spec9
3 files changed, 38 insertions, 4 deletions
diff --git a/URPM.xs b/URPM.xs
index f393978..860c9d9 100644
--- a/URPM.xs
+++ b/URPM.xs
@@ -1975,7 +1975,9 @@ Trans_run(trans, data, ...)
STRLEN len;
char *s = SvPV(ST(i), len);
- if (len == 5) {
+ if (len == 4 && !memcmp(s, "test", 4)) {
+ if (SvIV(ST(i+1))) transFlags |= RPMTRANS_FLAG_TEST;
+ } else if (len == 5) {
if (!memcmp(s, "force", 5)) {
if (SvIV(ST(i+1))) probFilter |= (RPMPROB_FILTER_REPLACEPKG |
RPMPROB_FILTER_REPLACEOLDFILES |
@@ -1985,6 +1987,8 @@ Trans_run(trans, data, ...)
td.min_delta = SvIV(ST(i+1));
} else if (len == 6 && !memcmp(s, "nosize", 6)) {
if (SvIV(ST(i+1))) probFilter |= RPMPROB_FILTER_DISKSPACE;
+ } else if (len == 10 && !memcmp(s, "oldpackage", 10)) {
+ if (SvIV(ST(i+1))) probFilter |= RPMPROB_FILTER_OLDPACKAGE;
} else if (len == 17 && !memcmp(s, "translate_message", 17))
translate_message = 1;
else if (len >= 9 && !memcmp(s, "callback_", 9)) {
diff --git a/URPM/Resolve.pm b/URPM/Resolve.pm
index 4bafa2a..25a3617 100644
--- a/URPM/Resolve.pm
+++ b/URPM/Resolve.pm
@@ -138,7 +138,7 @@ sub resolve_requested {
};
my ($urpm, $db, $state, $requested, %options) = @_;
- my (@properties, @obsoleted, %requested, $dep);
+ my (@properties, @obsoleted, %requested, %avoided, $dep);
#- keep in mind the requested id (if given) in order to prefer these packages
#- on choices instead of anything other one.
@@ -159,6 +159,7 @@ sub resolve_requested {
my ($best_requested, $best);
foreach (@$_) {
exists $state->{selected}{$_->id} and $best_requested = $_, last;
+ exists $avoided{$_->name} and next;
if ($best_requested || exists $requested{$_->id}) {
if ($best_requested && $best_requested != $_) {
$_->compare_pkg($best_requested) > 0 and $best_requested = $_;
@@ -214,7 +215,26 @@ sub resolve_requested {
} else {
@chosen = values %$packages;
}
- @chosen = sort { $a->id <=> $b->id } @chosen; #- sort package in order to have best ones first.
+ #- packages that requires locales-xxx and the corresponding locales is already installed
+ #- should be prefered over packages that requires locales not installed.
+ my (@chosen_good_locales, @chosen_bad_locales, @chosen_other);
+ foreach (@chosen) {
+ 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) {
+ push @chosen_good_locales, $_;
+ } else {
+ push @chosen_bad_locales, $_;
+ }
+ } else {
+ push @chosen_other, $_;
+ }
+ }
+ #- sort package in order to have best ones first (this means good locales, no locales, bad locales).
+ @chosen = ((sort { $a->id <=> $b->id } @chosen_good_locales),
+ (sort { $a->id <=> $b->id } @chosen_other),
+ (sort { $a->id <=> $b->id } @chosen_bad_locales));
if (!$pkg && $options{callback_choices} && @chosen > 1) {
$pkg = $options{callback_choices}->($urpm, $db, $state, \@chosen);
$pkg or next; #- callback may decide to not continue (or state is already updated).
@@ -258,6 +278,9 @@ sub resolve_requested {
#- this means required dependencies have undef value in selected hash.
#- requested flag is set only for requested package where value is not false.
$state->{selected}{$pkg->id} = delete $requested->{$dep};
+ #- mark package of this name to be avoided if possible.
+ $avoided{$pkg->name} = undef;
+
$options{no_flag_update} or
$state->{selected}{$pkg->id} ? $pkg->set_flag_requested : $pkg->set_flag_required;
diff --git a/perl-URPM.spec b/perl-URPM.spec
index 06925e9..7a4b896 100644
--- a/perl-URPM.spec
+++ b/perl-URPM.spec
@@ -1,7 +1,7 @@
%define name perl-URPM
%define real_name URPM
%define version 0.70
-%define release 1mdk
+%define release 2mdk
%{expand:%%define rpm_version %(rpm -q --queryformat '%{VERSION}-%{RELEASE}' rpm)}
@@ -48,6 +48,13 @@ rm -rf $RPM_BUILD_ROOT
%changelog
+* Mon Aug 26 2002 François Pons <fpons@mandrakesoft.com> 0.70-2mdk
+- added more flags to URPM::Transaction::run (oldpackage, test).
+- fixed choices to prefer right locales dependent packages.
+- added avoided hash to avoid mixing choices when a lot of
+ possible packages are available and split have been done
+ (openjade bug reported on cooker).
+
* Fri Aug 23 2002 François Pons <fpons@mandrakesoft.com> 0.70-1mdk
- fixed search method to work correctly.