summaryrefslogtreecommitdiffstats
path: root/urpm/select.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2007-09-06 10:38:38 +0000
committerPascal Rigaux <pixel@mandriva.com>2007-09-06 10:38:38 +0000
commit6f23b47db6f4a4e69267eb4fd5b70f21fd1fa6d0 (patch)
tree2ba6131342678f730fd449e635a102ef2b75897f /urpm/select.pm
parentdcefd4e833df000e6a88a7d976d7c42f33f81090 (diff)
downloadurpmi-6f23b47db6f4a4e69267eb4fd5b70f21fd1fa6d0.tar
urpmi-6f23b47db6f4a4e69267eb4fd5b70f21fd1fa6d0.tar.gz
urpmi-6f23b47db6f4a4e69267eb4fd5b70f21fd1fa6d0.tar.bz2
urpmi-6f23b47db6f4a4e69267eb4fd5b70f21fd1fa6d0.tar.xz
urpmi-6f23b47db6f4a4e69267eb4fd5b70f21fd1fa6d0.zip
new functions:
- use URPM::build_listid - prepare for next commit which will handle more than one searchmedia
Diffstat (limited to 'urpm/select.pm')
-rw-r--r--urpm/select.pm27
1 files changed, 19 insertions, 8 deletions
diff --git a/urpm/select.pm b/urpm/select.pm
index fd57be04..645105fa 100644
--- a/urpm/select.pm
+++ b/urpm/select.pm
@@ -44,6 +44,21 @@ sub _findindeps {
}
}
+sub pkg_in_searchmedia {
+ my ($urpm, $pkg) = @_;
+
+ $urpm->{searchmedia}{start} <= $pkg->id
+ && $urpm->{searchmedia}{end} >= $pkg->id;
+}
+sub searchmedia_idlist {
+ my ($urpm) = @_;
+ $urpm->{searchmedia} && [ $urpm->{searchmedia}{start} .. $urpm->{searchmedia}{end} ];
+}
+sub build_listid_ {
+ my ($urpm) = @_;
+ $urpm->build_listid(undef, undef, searchmedia_idlist($urpm));
+}
+
#- search packages registered by their names by storing their ids into the $packages hash.
#- Recognized options:
#- all
@@ -65,9 +80,7 @@ sub search_packages {
&& ($options{src} ? $_->arch eq 'src' : $_->is_arch_compat)
&& ($options{use_provides} || $_->name eq $v)
&& defined($_->id)
- && (!defined $urpm->{searchmedia} ||
- $urpm->{searchmedia}{start} <= $_->id
- && $urpm->{searchmedia}{end} >= $_->id)
+ && ($urpm->{searchmedia} || pkg_in_searchmedia($urpm, $_))
? $_ : @{[]};
} $urpm->packages_providing($v))
{
@@ -97,10 +110,7 @@ sub search_packages {
_findindeps($urpm, \%found, $qv, $v, $options{caseinsensitive}, $options{src});
}
- foreach my $id (defined $urpm->{searchmedia} ?
- ($urpm->{searchmedia}{start} .. $urpm->{searchmedia}{end}) :
- (0 .. $#{$urpm->{depslist}})
- ) {
+ foreach my $id (build_listid_($urpm)) {
my $pkg = $urpm->{depslist}[$id];
($options{src} ? $pkg->arch eq 'src' : $pkg->is_arch_compat) or next;
my $pack_name = $pkg->name;
@@ -221,7 +231,8 @@ sub resolve_dependencies {
#- auto select package for upgrading the distribution.
if ($options{auto_select}) {
$urpm->request_packages_to_upgrade($db, $state, $requested, requested => undef,
- start => $urpm->{searchmedia}{start}, end => $urpm->{searchmedia}{end});
+ $urpm->{searchmedia} ? (idlist => searchmedia_idlist($urpm)) : (),
+ );
}
my @priority_upgrade;