summaryrefslogtreecommitdiffstats
path: root/urpm.pm
diff options
context:
space:
mode:
authorOlivier Thauvin <nanardon@mandriva.org>2004-11-24 18:32:46 +0000
committerOlivier Thauvin <nanardon@mandriva.org>2004-11-24 18:32:46 +0000
commita851747b92213cfeffead634414cb36d9fc576a6 (patch)
tree82efe01fd523f6b5806c431dbb5981182301e8f4 /urpm.pm
parentd0975a4dc82a25a2f1e2105e9c405fcaf067bdfa (diff)
downloadurpmi-a851747b92213cfeffead634414cb36d9fc576a6.tar
urpmi-a851747b92213cfeffead634414cb36d9fc576a6.tar.gz
urpmi-a851747b92213cfeffead634414cb36d9fc576a6.tar.bz2
urpmi-a851747b92213cfeffead634414cb36d9fc576a6.tar.xz
urpmi-a851747b92213cfeffead634414cb36d9fc576a6.zip
- add --search-media options: looking requested or package to update with --auto-select in given media
- replace a die() by $urpm->{fatal}()
Diffstat (limited to 'urpm.pm')
-rw-r--r--urpm.pm33
1 files changed, 28 insertions, 5 deletions
diff --git a/urpm.pm b/urpm.pm
index a00383e4..f4a8bf91 100644
--- a/urpm.pm
+++ b/urpm.pm
@@ -390,7 +390,7 @@ sub configure {
$urpm->clean;
- $options{parallel} && $options{usedistrib} and die N("Can't use parallel mode with use-distrib mode");
+ $options{parallel} && $options{usedistrib} and $urpm->{fatal}(1, N("Can't use parallel mode with use-distrib mode"));
if ($options{parallel}) {
my ($parallel_options, $parallel_handler);
@@ -458,6 +458,15 @@ sub configure {
$_->{ignore} = 1;
}
}
+ if ($options{searchmedia}) {
+ $urpm->select_media($options{searchmedia}); # Ensure this media has been selected
+ foreach (grep { !$_->{ignore} } @{$urpm->{media} || []}) {
+ $_->{name} eq $options{searchmedia} and do {
+ $_->{searchmedia} = 1;
+ last;
+ };
+ }
+ }
if ($options{excludemedia}) {
delete $_->{modified} foreach @{$urpm->{media} || []};
$urpm->select_media(split ',', $options{excludemedia});
@@ -531,7 +540,14 @@ sub configure {
}
}
unless ($_->{ignore}) {
- unless (defined $_->{start} && defined $_->{end}) {
+ if (defined $_->{start} && defined $_->{end}) {
+ if ($_->{searchmedia}) {
+ ($urpm->{searchmedia}{start}, $urpm->{searchmedia}{end}) = ($_->{start}, $_->{end});
+ $urpm->{log}(N("Search start: %s end: %s",
+ $urpm->{searchmedia}{start}, $urpm->{searchmedia}{end}));
+ delete $_->{searchmedia};
+ }
+ } else {
$urpm->{error}(N("problem reading hdlist or synthesis file of medium \"%s\"", $_->{name}));
$_->{ignore} = 1;
}
@@ -1986,7 +2002,7 @@ sub _findindeps {
sub search_packages {
my ($urpm, $packages, $names, %options) = @_;
my (%exact, %exact_a, %exact_ra, %found, %foundi);
-
+ $urpm->{log}(N("Search"));
foreach my $v (@$names) {
my $qv = quotemeta $v;
$qv = '(?i)' . $qv if $options{caseinsensitive};
@@ -1998,6 +2014,9 @@ 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))
? $_ : @{[]}
} map {
$urpm->{depslist}[$_]
@@ -2026,7 +2045,10 @@ sub search_packages {
}
}
- foreach my $id (0 .. $#{$urpm->{depslist}}) {
+ foreach my $id (defined $urpm->{searchmedia} ?
+ ($urpm->{searchmedia}{start} .. $urpm->{searchmedia}{end}) :
+ (0 .. $#{$urpm->{depslist}})) {
+
my $pkg = $urpm->{depslist}[$id];
($options{src} ? $pkg->arch eq 'src' : $pkg->is_arch_compat) or next;
@@ -2143,7 +2165,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);
+ $urpm->request_packages_to_upgrade($db, $state, $requested, requested => undef,
+ start => $urpm->{searchmedia}{start}, end => $urpm->{searchmedia}{end});
}
#- resolve dependencies which will be examined for packages that need to