Re: pkg_add interactive prompts

2011-05-17 Thread frantisek holop
hmm, on Tue, May 17, 2011 at 11:38:09PM +0200, Matthias Kilian said that
> On Tue, May 17, 2011 at 11:00:01PM +0200, frantisek holop wrote:
> > (my rationale for removing the option "0: " is that
> > i have asked for the package, so why would i choose None?
> > i can always ctrl-c out if i have changed my mind...)
> 
> AFAIK, ambiguous packages can also happen during updates (pkg_add
> -ui), for example if an updated package has a new dependency on
> another package that's available in different flavors. You don't

in that case, isn't the dependency menu shown? (with no )

as i understand it, dependencies are not optional,
one FLAVOR must be chosen if something depends on it.

-f
-- 
what good grammar you got.  what school you went?



Re: pkg_add interactive prompts

2011-05-17 Thread Matthias Kilian
On Tue, May 17, 2011 at 11:00:01PM +0200, frantisek holop wrote:
> (my rationale for removing the option "0: " is that
> i have asked for the package, so why would i choose None?
> i can always ctrl-c out if i have changed my mind...)

AFAIK, ambiguous packages can also happen during updates (pkg_add
-ui), for example if an updated package has a new dependency on
another package that's available in different flavors. You don't
want to hit ^C in this case, because pkg_add -ui can take a long
time, especially when the number of installed packages is huge and
the update is run over a slow link.

Apart from this, I like the idea.

Ciao,
Kili



pkg_add interactive prompts

2011-05-17 Thread frantisek holop
hi there,

the following diff tries to make pkg_add's prompts
be more "installer-like".  if i look at the popularity
of the installer, that might be a good thing..
(and i find the 'a' (for 'auto' i guess) a bit out of place
and confusing)


before:

$ sudo pkg_add midori
Ambiguous: choose dependency for midori-0.3.5p0:
 a   0: tango-icon-theme-0.8.90p2
 1: gnome-icon-theme-2.30.3p1
 2: xfce4-icon-theme-4.4.3p6
Your choice: _


after:

$ sudo pkg_add midori
Ambiguous dependency for midori-0.3.5p0:
 0: tango-icon-theme-0.8.90p2
 1: gnome-icon-theme-2.30.3p1
 2: xfce4-icon-theme-4.4.3p6
Select package? [0] _


for packages, after:

$ sudo pkg_add mp3info
Ambiguous package name mp3info:
 0: mp3info-0.8.5ap6
 1: mp3info-0.8.5ap6-no_x11
Select package? [0] _


(my rationale for removing the option "0: " is that
i have asked for the package, so why would i choose None?
i can always ctrl-c out if i have changed my mind...)



Index: OpenBSD/AddDelete.pm
===
RCS file: /cvs/src/usr.sbin/pkg_add/OpenBSD/AddDelete.pm,v
retrieving revision 1.46
diff -u -p -r1.46 AddDelete.pm
--- OpenBSD/AddDelete.pm7 Mar 2011 09:26:47 -   1.46
+++ OpenBSD/AddDelete.pm17 May 2011 20:55:12 -
@@ -250,9 +250,8 @@ sub choose_location
if ($state->{interactive}) {
require OpenBSD::Interactive;
 
-   $h{''} = undef;
$state->progress->clear;
-   my $result = $state->ask_list("Ambiguous: choose package for 
$name", 1, sort keys %h);
+   my $result = $state->ask_list("Ambiguous package name $name:", 
1, sort keys %h);
return $h{$result};
} else {
$state->errsay("Ambiguous: #1 could be #2",
Index: Dependencies.pm
===
RCS file: /cvs/src/usr.sbin/pkg_add/OpenBSD/Dependencies.pm,v
retrieving revision 1.151
diff -u -p -r1.151 Dependencies.pm
--- Dependencies.pm 24 Dec 2010 09:04:14 -  1.151
+++ Dependencies.pm 17 May 2011 20:33:57 -
@@ -578,7 +578,7 @@ sub find_dep_in_repositories
@pkgs = ((grep {$_ eq $dep->{def}} @pkgs),
(sort (grep {$_ ne $dep->{def}} @pkgs)));
my $good = $state->ask_list(
-   'Ambiguous: choose dependency for '.$self->{set}->print.': 
',
+   'Multiple possible dependencies for 
'.$self->{set}->print.': ',
$state->{interactive}, @pkgs);
return $c{$good};
} else {
Index: Interactive.pm
===
RCS file: /cvs/src/usr.sbin/pkg_add/OpenBSD/Interactive.pm,v
retrieving revision 1.17
diff -u -p -r1.17 Interactive.pm
--- Interactive.pm  24 Dec 2010 09:04:14 -  1.17
+++ Interactive.pm  17 May 2011 20:33:57 -
@@ -30,11 +30,11 @@ sub ask_list
print STDERR $prompt, "\n";
my $i = 0;
for my $v (@values) {
-   printf STDERR "%s\t%2d: %s\n", $i == 0 ? " a" : "" , $i, $v;
+   printf STDERR "\t%2d: %s\n", $i, $v;
$i++;
}
 LOOP:
-   print STDERR "Your choice: ";
+   print STDERR "Select package? [0] ";
my $result = ;
unless (defined $result) {
print STDERR "\n";


-f
--
always remember where you came from so you can return.