summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS4
-rw-r--r--pod/urpmf.8.pod4
-rw-r--r--pod/urpmi.8.pod5
-rw-r--r--pod/urpmi.cfg.5.pod4
-rw-r--r--t/data/SPECS/suggests/a-1.spec14
-rw-r--r--t/data/SPECS/suggests/a-2.spec15
-rw-r--r--t/data/SPECS/suggests/a-3.spec14
-rw-r--r--t/data/SPECS/suggests/b.spec14
-rw-r--r--t/data/SPECS/suggests/bb.spec14
-rw-r--r--t/data/SPECS/suggests/c.spec14
-rw-r--r--t/data/SPECS/suggests/cc.spec14
-rw-r--r--t/data/SPECS/suggests/suggested_b.spec13
-rw-r--r--t/data/SPECS/suggests/suggested_c.spec13
-rw-r--r--t/data/SPECS/suggests/with-invalid.spec14
-rw-r--r--t/superuser--suggests.t75
-rw-r--r--urpm/args.pm2
-rw-r--r--urpm/select.pm1
-rwxr-xr-xurpmf3
-rwxr-xr-xurpmi4
-rw-r--r--urpmi.bash-completion4
20 files changed, 242 insertions, 3 deletions
diff --git a/NEWS b/NEWS
index 02eb362c..214df844 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,9 @@
- urpmi
o explicit error when using "urpmi ---install-src" as user with remote media
+ o add support for "suggests": a newly suggested package is installed as if
+ required, but one can remove it afterwards, or use --no-suggests
+- urpmf
+ o handle --suggests
Version 4.9.28 - 3 August 2007, by Pascal "Pixel" Rigaux
diff --git a/pod/urpmf.8.pod b/pod/urpmf.8.pod
index af05582c..897aeabc 100644
--- a/pod/urpmf.8.pod
+++ b/pod/urpmf.8.pod
@@ -184,6 +184,10 @@ Prints the Size tag.
Prints the names of source rpms.
+=item B<--suggests>
+
+Prints the Suggests tag.
+
=item B<--summary>
Prints the Summary tag.
diff --git a/pod/urpmi.8.pod b/pod/urpmi.8.pod
index 710dd28f..33476963 100644
--- a/pod/urpmi.8.pod
+++ b/pod/urpmi.8.pod
@@ -185,6 +185,11 @@ Quiet mode: when calling rpm no upgrade status is printed.
Proposes a verbose mode with various messages.
+=item B<--no-suggests>
+
+With this option, urpmi will not install "suggested" packages.
+By default, urpmi will install (newly) suggested packages.
+
=item B<--allow-nodeps>
With this option, urpmi will ask the user on error whether it should
diff --git a/pod/urpmi.cfg.5.pod b/pod/urpmi.cfg.5.pod
index 420b41c6..34e90a28 100644
--- a/pod/urpmi.cfg.5.pod
+++ b/pod/urpmi.cfg.5.pod
@@ -29,6 +29,10 @@ Same as specifying B<--allow-force> for urpmi. Disabled by default.
Same as specifying B<--allow-nodeps> for urpmi. Disabled by default.
+=item B<no-suggests>
+
+Same as specifying B<--no-suggests> for urpmi. Disabled by default.
+
=item B<auto>
Same as specifying B<--auto> for urpmi. Disabled by default.
diff --git a/t/data/SPECS/suggests/a-1.spec b/t/data/SPECS/suggests/a-1.spec
new file mode 100644
index 00000000..b31038b9
--- /dev/null
+++ b/t/data/SPECS/suggests/a-1.spec
@@ -0,0 +1,14 @@
+Summary: a
+Name: a
+Version: 1
+Release: 1
+License: x
+Group: x
+Url: x
+Suggests: suggested_b
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/suggests/a-2.spec b/t/data/SPECS/suggests/a-2.spec
new file mode 100644
index 00000000..2431bd9c
--- /dev/null
+++ b/t/data/SPECS/suggests/a-2.spec
@@ -0,0 +1,15 @@
+Summary: a
+Name: a
+Version: 2
+Release: 1
+License: x
+Group: x
+Url: x
+Suggests: suggested_b
+Suggests: suggested_c
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/suggests/a-3.spec b/t/data/SPECS/suggests/a-3.spec
new file mode 100644
index 00000000..43d51a36
--- /dev/null
+++ b/t/data/SPECS/suggests/a-3.spec
@@ -0,0 +1,14 @@
+Summary: a
+Name: a
+Version: 3
+Release: 1
+License: x
+Group: x
+Url: x
+Suggests: suggested_b
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/suggests/b.spec b/t/data/SPECS/suggests/b.spec
new file mode 100644
index 00000000..da1ee869
--- /dev/null
+++ b/t/data/SPECS/suggests/b.spec
@@ -0,0 +1,14 @@
+Summary: b
+Name: b
+Version: 1
+Release: 1
+License: x
+Group: x
+Url: x
+Requires: bb
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/suggests/bb.spec b/t/data/SPECS/suggests/bb.spec
new file mode 100644
index 00000000..4319c755
--- /dev/null
+++ b/t/data/SPECS/suggests/bb.spec
@@ -0,0 +1,14 @@
+Summary: bb
+Name: bb
+Version: 1
+Release: 1
+License: x
+Group: x
+Url: x
+Suggests: suggested_b
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/suggests/c.spec b/t/data/SPECS/suggests/c.spec
new file mode 100644
index 00000000..96e34787
--- /dev/null
+++ b/t/data/SPECS/suggests/c.spec
@@ -0,0 +1,14 @@
+Summary: c
+Name: c
+Version: 1
+Release: 1
+License: x
+Group: x
+Url: x
+Suggests: cc
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/suggests/cc.spec b/t/data/SPECS/suggests/cc.spec
new file mode 100644
index 00000000..170cffb9
--- /dev/null
+++ b/t/data/SPECS/suggests/cc.spec
@@ -0,0 +1,14 @@
+Summary: cc
+Name: cc
+Version: 1
+Release: 1
+License: x
+Group: x
+Url: x
+Requires: b
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/suggests/suggested_b.spec b/t/data/SPECS/suggests/suggested_b.spec
new file mode 100644
index 00000000..11c48863
--- /dev/null
+++ b/t/data/SPECS/suggests/suggested_b.spec
@@ -0,0 +1,13 @@
+Summary: suggested_b
+Name: suggested_b
+Version: 1
+Release: 1
+License: x
+Group: x
+Url: x
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/suggests/suggested_c.spec b/t/data/SPECS/suggests/suggested_c.spec
new file mode 100644
index 00000000..1c721384
--- /dev/null
+++ b/t/data/SPECS/suggests/suggested_c.spec
@@ -0,0 +1,13 @@
+Summary: suggested_c
+Name: suggested_c
+Version: 1
+Release: 1
+License: x
+Group: x
+Url: x
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/suggests/with-invalid.spec b/t/data/SPECS/suggests/with-invalid.spec
new file mode 100644
index 00000000..781f7988
--- /dev/null
+++ b/t/data/SPECS/suggests/with-invalid.spec
@@ -0,0 +1,14 @@
+Summary: x
+Name: with-invalid
+Version: 1
+Release: 1
+License: x
+Group: x
+Url: x
+Suggests: invalid
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/superuser--suggests.t b/t/superuser--suggests.t
new file mode 100644
index 00000000..b3e897cc
--- /dev/null
+++ b/t/superuser--suggests.t
@@ -0,0 +1,75 @@
+#!/usr/bin/perl
+
+use strict;
+use lib '.', 't';
+use helper;
+use Expect;
+use urpm::util;
+use Test::More 'no_plan';
+
+need_root_and_prepare();
+
+my $medium_name = 'suggests';
+
+urpmi_addmedia("$medium_name $::pwd/media/$medium_name");
+
+test_b();
+test_c();
+test_invalid();
+test_upgrade();
+
+sub test_b {
+ test('b', ['bb'], ['suggested_b']);
+ test_2('bb', [], 'b', [], []);
+}
+
+sub test_c {
+ test('c', [], ['cc', 'b', 'bb', 'suggested_b']);
+ test_2('b', ['bb'], 'c', [], ['cc']);
+ test_2('bb', [], 'c', [], ['cc', 'b']);
+}
+
+sub test_invalid {
+ urpmi("--auto with-invalid");
+ check_installed_and_remove('with-invalid');
+}
+
+sub test {
+ my ($name, $required, $suggested) = @_;
+ urpmi("--no-suggests --auto $name");
+ check_installed_and_remove($name, @$required);
+ urpmi("--auto $name");
+ check_installed_names($name, @$required, @$suggested);
+ urpme("$name @$required");
+ check_installed_and_remove(@$suggested);
+}
+
+sub test_2 {
+ my ($name1, $required1, $name2, $required2, $suggested2) = @_;
+
+ urpmi("--no-suggests --auto $name1");
+ check_installed_names($name1, @$required1);
+ urpmi("--no-suggests --auto $name2");
+ check_installed_and_remove($name1, @$required1, $name2, @$required2);
+
+ urpmi("--no-suggests --auto $name1");
+ check_installed_names($name1, @$required1);
+ urpmi("--auto $name2");
+ check_installed_and_remove($name1, @$required1, $name2, @$required2, @$suggested2);
+}
+
+sub test_upgrade {
+ urpmi(" --auto a-1");
+ check_installed_names('a', 'suggested_b');
+ urpmi(" --auto a-2");
+ check_installed_names('a', 'suggested_b', 'suggested_c');
+ urpmi(" --auto a-3");
+ check_installed_and_remove('a', 'suggested_b', 'suggested_c');
+
+ urpmi("--no-suggests --auto a-1");
+ check_installed_names('a');
+ urpmi(" --auto a-2");
+ check_installed_names('a', 'suggested_c');
+ urpmi(" --auto a-3");
+ check_installed_and_remove('a', 'suggested_c');
+}
diff --git a/urpm/args.pm b/urpm/args.pm
index 403e52b6..68feea57 100644
--- a/urpm/args.pm
+++ b/urpm/args.pm
@@ -94,6 +94,7 @@ my %options_spec = (
$urpm->{options}{'priority-upgrade'} = '';
},
force => \$::force,
+ 'no-suggests' => sub { $urpm->{options}{'no-suggests'} = 1 },
'allow-nodeps' => sub { $urpm->{options}{'allow-nodeps'} = 1 },
'allow-force' => sub { $urpm->{options}{'allow-force'} = 1 },
'parallel=s' => \$::parallel,
@@ -342,6 +343,7 @@ foreach my $k (qw(
requires
size
sourcerpm
+ suggests
summary
url
vendor
diff --git a/urpm/select.pm b/urpm/select.pm
index 24b844f8..7544e83b 100644
--- a/urpm/select.pm
+++ b/urpm/select.pm
@@ -165,6 +165,7 @@ sub search_packages {
#- callback_choices
#- keep
#- nodeps
+#- no_suggests
sub resolve_dependencies {
#- $state->{selected} will contain the selection of packages to be
#- installed or upgraded
diff --git a/urpmf b/urpmf
index 03ca1fa4..8c93f538 100755
--- a/urpmf
+++ b/urpmf
@@ -77,6 +77,7 @@ usage: urpmf [options] pattern-expression
") . N(" --requires - requires tags
") . N(" --size - installed size
") . N(" --sourcerpm - source rpm name
+") . N(" --suggests - suggests tags
") . N(" --summary - summary
") . N(" --url - url
") . N(" --vendor - vendor
@@ -124,7 +125,7 @@ $urpm->{info} = sub { print STDERR "$_[0]\n" };
$urpm->{log} = sub { print STDERR "$_[0]\n" } if $options{verbose} > 0;
my $multitag = '';
-my %multitags = map { $_ => 1 } qw(conffiles conflicts files obsoletes provides requires);
+my %multitags = map { $_ => 1 } qw(conffiles conflicts files obsoletes provides requires suggests);
my %usedtags;
(my $proto = $qf) =~ s/%([-\d]*)(\w+)/%${1}s/g;
diff --git a/urpmi b/urpmi
index b0991ac0..5b56ee5b 100755
--- a/urpmi
+++ b/urpmi
@@ -469,6 +469,7 @@ my $restart_itself = urpm::select::resolve_dependencies($urpm,
install_src => $install_src,
keep => $urpm->{options}{keep},
nodeps => $urpm->{options}{'allow-nodeps'} || $urpm->{options}{'allow-force'},
+ no_suggests => $urpm->{options}{'no-suggests'},
priority_upgrade => $test || $env ? '' : $urpm->{options}{'priority-upgrade'},
);
@@ -571,6 +572,9 @@ foreach my $pkg (sort { $a->name cmp $b->name } @{$urpm->{depslist}}[keys %{$sta
push @root_only, $fullname;
} elsif ($install_src || $pkg->arch ne 'src') {
$sum += $pkg->size;
+ if ($state->{selected}{$pkg->id}{suggested}) {
+ $fullname = N("%s (suggested)", $fullname);
+ }
push @to_install, $fullname;
}
}
diff --git a/urpmi.bash-completion b/urpmi.bash-completion
index bc93daed..1f252a8b 100644
--- a/urpmi.bash-completion
+++ b/urpmi.bash-completion
@@ -106,7 +106,7 @@ _urpmi()
# add dangereous option for everything else as rurpmi
if [[ ${COMP_WORDS[0]} != *rurpmi ]]; then
options="$options --root --use-distrib --env \
- --allow-nodeps --allow-force --force \
+ --allow-nodeps --allow-force --no-suggests --force \
--noscripts --auto-update --keep --nokeep \
--verify-rpm"
for (( i=1; i < COMP_CWORD; i++ )); do
@@ -243,7 +243,7 @@ _urpmf()
--media --excludemedia --sortmedia --synthesis --use-distrib \
--verbose --quiet --uniq --name --group --license --size \
--epoch --summary --description --sourcerpm --packager\
- --buildhost --url --provides --requires --files \
+ --buildhost --url --provides --requires --suggests --files \
--conflicts --obsoletes --env ' -- $cur ) )
else
# return available files