diff options
-rw-r--r-- | urpm.pm | 33 | ||||
-rw-r--r-- | urpm/args.pm | 2 | ||||
-rwxr-xr-x | urpmi | 3 | ||||
-rwxr-xr-x | urpmq | 2 |
4 files changed, 35 insertions, 5 deletions
@@ -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 diff --git a/urpm/args.pm b/urpm/args.pm index ca447cc9..af1a1daf 100644 --- a/urpm/args.pm +++ b/urpm/args.pm @@ -51,6 +51,7 @@ my %options_spec = ( 'media|mediums=s' => \$::media, 'excludemedia|exclude-media=s' => \$::excludemedia, 'sortmedia|sort-media=s' => \$::sortmedia, + 'searchmedia|search-media=s' => \$::searchmedia, 'synthesis=s' => \$::synthesis, auto => sub { $urpm->{options}{auto} = $::auto = 1; @@ -178,6 +179,7 @@ my %options_spec = ( 'media|mediums=s' => \$options{media}, 'excludemedia|exclude-media=s' => \$options{excludemedia}, 'sortmedia|sort-media=s' => \$options{sortmedia}, + 'searchmedia|search-media=s' => \$options{searchmedia}, 'synthesis=s' => \$options{sortmedia}, 'auto-select' => sub { $options{deps} = $options{upgrade} = $options{auto_select} = 1; @@ -30,6 +30,7 @@ my $urpm = new urpm; #- default options. our $update = 0; our $media = ''; +our $searchmedia = undef; our $excludemedia = ''; our $sortmedia = ''; our $synthesis = ''; @@ -74,6 +75,7 @@ usage: ", $urpm::VERSION) . N(" --help - print this help message. ") . N(" --update - use only update media. ") . N(" --media - use only the given media, separated by comma. +") . N(" --searchmedia - use only the given media to search requested (or updated) packages. ") . N(" --excludemedia - do not use the given media, separated by comma. ") . N(" --sortmedia - sort media according to substrings separated by comma. ") . N(" --synthesis - use the given synthesis instead of urpmi db. @@ -318,6 +320,7 @@ unless ($env) { } $urpm->configure(nocheck_access => $env || $< != 0, media => $media, + searchmedia => $searchmedia, excludemedia => $excludemedia, sortmedia => $sortmedia, synthesis => $synthesis, @@ -43,6 +43,7 @@ usage: ", $urpm::VERSION) . N(" --help - print this help message. ") . N(" --update - use only update media. ") . N(" --media - use only the given media, separated by comma. +") . N(" --searchmedia - use only the given media to search requested (or updated) packages. ") . N(" --excludemedia - do not use the given media, separated by comma. ") . N(" --sortmedia - sort media according to substrings separated by comma. ") . N(" --synthesis - use the synthesis given instead of urpmi db. @@ -126,6 +127,7 @@ $urpm->configure( noinstalling => $urpm::args::options{nodepslist}, nodepslist => $urpm::args::options{nodepslist}, media => $urpm::args::options{media}, + searchmedia => $urpm::args::options{searchmedia}, excludemedia => $urpm::args::options{excludemedia}, sortmedia => $urpm::args::options{sortmedia}, synthesis => $urpm::args::options{synthesis}, |