diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2008-01-18 17:12:18 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2008-01-18 17:12:18 +0000 |
commit | 4770bc86abc884603500987585d34f85acfcc06b (patch) | |
tree | 8884fbabdba83b427f2d079f4331f0010a2341c1 | |
parent | 66ab26598afa8239868d32b5118304c629dafe81 (diff) | |
download | urpmi-4770bc86abc884603500987585d34f85acfcc06b.tar urpmi-4770bc86abc884603500987585d34f85acfcc06b.tar.gz urpmi-4770bc86abc884603500987585d34f85acfcc06b.tar.bz2 urpmi-4770bc86abc884603500987585d34f85acfcc06b.tar.xz urpmi-4770bc86abc884603500987585d34f85acfcc06b.zip |
- urpmi:
o --buildrequires deprecate --src, --src is kept for compatibility but its
behaviour is changed a little (it doesn't download src.rpm anymore)
ie implement what i suggested on cooker mailing list:
Date: Thu, 15 Nov 2007 18:21:32 +0100
Subject: urpmi --src issues, suggesting replacing --src with --buildrequires
current situation:
% urpmi /xxx/foo.src.rpm
#=> installs foo.src.rpm buildrequires
% urpmi --install-src foo bar
#=> downloads foo.src.rpm bar.src.rpm and "rpm -i"
% urpmi --help | grep -- --src
--src, -s - next package is a source package.
% urpmi --src foo
#=> urpmi says it will install foo buildrequires + foo.src.rpm
#=> in fact, it only installs foo buildrequires
weird cases in current urpmi:
% urpmi --src foo bar
#=> equiv to "urpmi --src foo ; urpmi bar"
% urpmi foo --src bar
#=> equiv to "urpmi --src foo bar" above :-(
% urpmi --src foo --src bar
#=> equiv to "urpmi --src foo bar" :-(
suggestions:
1) we could make --src a global option:
% urpmi --src foo bar
#=> would install buildrequires of foo.src.rpm and bar.src.rpm
cons: it breaks compatibility (though i'm quite sure noone uses the
previous behaviour)
2) deprecate --src, introduce with --buildrequires:
% urpmi --buildrequires foo bar
#=> would install buildrequires of foo.src.rpm and bar.src.rpm
3) when doing "urpmi /xxx/foo.src.rpm", warn the user that it should
use either "--install-src" or "--buildrequires", and that urpmi is
defaulting to "--buildrequires"
2) and 3) are implemented now
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | pod/urpmi.8.pod | 13 | ||||
-rw-r--r-- | urpm/args.pm | 4 | ||||
-rwxr-xr-x | urpmi | 38 | ||||
-rw-r--r-- | urpmi.bash-completion | 4 |
5 files changed, 32 insertions, 29 deletions
@@ -3,6 +3,8 @@ and --downloader --wget o fix displaying error message when failing to lock (regression in 5.1) - urpmi: + o --buildrequires deprecate --src, --src is kept for compatibility but its + behaviour is changed a little (it doesn't download src.rpm anymore) o --install-src as user now works for remote medium o --install-src will succesfully installed src.rpm from /var/cache/urpmi/rpms/* (unless post-clean is 0) diff --git a/pod/urpmi.8.pod b/pod/urpmi.8.pod index fbdd52bb..5f99430d 100644 --- a/pod/urpmi.8.pod +++ b/pod/urpmi.8.pod @@ -150,13 +150,10 @@ Disable fast search on exact package name; that means that urpmi will propose all packages matching part of the name, even if one of them matches exactly the specified name (this is the same as B<-y>). -=item B<--src> I<name> +=item B<--buildrequires> -Search a source package matching I<name> and select all its dependencies -(that is, its C<BuildRequires>) by default, unless the B<--install-src> -switch is used in order to install the source package itself. (You can -also install the build dependencies read directly from an rpm spec -file.) +Select all the C<BuildRequires> of the wanted source packages. +(You can also install the build dependencies read directly from an rpm spec file.) =item B<--install-src> @@ -392,10 +389,6 @@ Do not search in provides to find package (this is the opposite of B<-p>). This is the same as B<--fuzzy>. -=item B<-s> I<name> - -This is the same as B<--src>. - =item B<-q> This is the same as B<--quiet>. diff --git a/urpm/args.pm b/urpm/args.pm index b676a891..17f02ce0 100644 --- a/urpm/args.pm +++ b/urpm/args.pm @@ -83,7 +83,9 @@ my %options_spec = ( 'split-level=s' => sub { $urpm->{options}{'split-level'} = $_[1] }, 'split-length=s' => sub { $urpm->{options}{'split-length'} = $_[1] }, 'fuzzy!' => sub { $urpm->{options}{fuzzy} = $_[1] }, - 'src|s' => \$::src, + 'src|s' => sub { $urpm->{error}("option --src is deprecated, use --buildrequires instead (nb: it doesn't download src.rpm anymore)"); + $options{buildrequires} = 1 }, + 'buildrequires' => \$options{buildrequires}, 'install-src' => \$::install_src, clean => sub { $::clean = 1; $::noclean = 0 }, noclean => sub { @@ -41,7 +41,6 @@ our $auto_select = 0; our $auto_update = 0; our $no_install = 0; our $no_remove = 0; -our $src = 0; our $install_src = 0; our $clean = 0; our $noclean = 0; @@ -95,7 +94,7 @@ usage: . N(" --split-length - small transaction length, default is %d. ", urpm::default_options()->{'split-length'}) . N(" --fuzzy, -y - impose fuzzy search. -") . N(" --src, -s - next package is a source package. +") . N(" --buildrequires - install the buildrequires of the packages ") . N(" --install-src - install only source package (no binaries). ") . N(" --clean - remove rpm from cache before anything else. ") . N(" --noclean - don't clean rpms from cache. @@ -200,12 +199,12 @@ foreach (@ARGV) { } next; } - if ($src) { - push @src_names, $_; - } else { - push @names, $_; - } - $src = 0; #- reset switch for next package. + push @names, $_; +} + +if ($options{buildrequires}) { + push @src_names, @names; + @names = (); } #- use install_src to promote all names as src package. @@ -215,6 +214,9 @@ if ($install_src) { @names = (); #- allow to use --install-src as a non-root user $options{nolock} = 1; +} elsif (@src_files && !$options{buildrequires}) { + $urpm->{error}(N("please use --buildrequires or --install-src, defaulting to --buildrequires")); + $options{buildrequires} = 1; } #- rurpmi checks @@ -566,18 +568,22 @@ my $ask_user = $env || $search_result eq 'substring'; my @root_only; my @to_install = @{$urpm->{depslist}}[sort { $a <=> $b } keys %{$state->{selected}}]; # sorted by medium for format_selected_packages +{ + my ($src, $binary) = partition { $_->arch eq 'src' } @to_install; + if ($install_src) { + if (@$binary && $install_src && !$env) { + my $list = join(' ', sort map { $_->name } @$binary); + $urpm->{fatal}(1, N("You must first call urpmi with --buildrequires to install the following dependencies:\n%s\n", $list)); + } + } else { + @to_install = @$binary; + } +} + foreach my $pkg (@to_install) { #- reflect change in flag usage, now requested is set whatever a package is selected or not, #- but required is always set (so a required but not requested is a pure dependency). $ask_user ||= !$pkg->flag_requested || $auto_select || $parallel; - - if (!$env && $install_src && $pkg->arch ne 'src') { - push @root_only, scalar $pkg->fullname; - } -} -if (@root_only && !$env) { - print N("You must first call urpmi without --install-src to install the following dependencies:\n%s\n", join(' ', sort @root_only)); - exit 1; } $urpm->{nb_install} = @to_install; if (!$urpm->{options}{auto} && $ask_user && $urpm->{nb_install} || $env && !$options{debug__do_not_install}) { diff --git a/urpmi.bash-completion b/urpmi.bash-completion index 65aaa3cd..39578f13 100644 --- a/urpmi.bash-completion +++ b/urpmi.bash-completion @@ -94,10 +94,10 @@ _urpmi() if [[ "$cur" == -* ]]; then # return list of available options - options="$common_options -a -p -P -y -s --update --media \ + options="$common_options -a -p -P -y --update --media \ --excludemedia --sortmedia --synthesis --auto \ --auto-select --no-uninstall --split-level \ - --split-length --fuzzy --src --install-src --clean \ + --split-length --fuzzy --buildrequires --install-src --clean \ --noclean --parallel --wget --prozilla --curl \ --limit-rate --proxy --proxy-user --bug \ --no-verify-rpm --no-install --test --excludepath \ |