On Mon, Jan 10, 2022 at 10:54:22AM -0500, Ian Darwin wrote:
> > > > I am working on OpenBSD 7.0, x86_64. I'm trying to script an install
> > > > of developer tools I use, like GCC and Git. When I attempt to install
> > > > GCC I am prompted:
> > > >
> > > > $ sudo pkg_add gcc g++
> > > > quirks-4.54 signed on 2022-01-09T19:08:35Z
> > > > Ambiguous: choose package for gcc
> > > > a 0: <None>
> > > > 1: gcc-8.4.0p9
> > > > 2: gcc-11.2.0p0
> > > >
> > > > I've looked over the man page at https://man.openbsd.org/pkg_add, but
> > > > I don't see an option to tell pkg_add to install the latest version of
> > > > the package.
> > >
> > > Sure there is.
> > >
> > > Quoting the manpage:
> > > There is also an ambiguity related to ports with multiple branches.
> > > For
> > > instance ‘pkg_add python’ is ambiguous, as there are several versions
> > > of
> > > python in the ports tree. So is ‘pkg_add postfix’. The special form
> > > ‘pkgname%branch’ can be used to restrict matches to a branch matching
> > > the
> > > pkgpath(7).
> > >
> > > pkg_add gcc%11 g++%11
> > > will do the trick
>
> In the context of the original post, I think he meant a way to invoke
> "pkg_add" and have
> it just install whatever the latest is, without having to know a priori that
> there is a version 11.
> "Just install gcc, dammit". There are many ports that have version choices
> and in the context
> of installing the latest of everything in a "scripted install", having to
> either stop mid-install
> and answer such a prompt, or sort out in advance what ports exist in multiple
> versions,
> is not what's wanted. It may be unwise, but it's what some people that do
> scripted installs want.
> I have wished for this too, but it never bothered me enough to send a query.
> :-)
Which one is the "latest" here?
$ doas pkg_add bogofilter
doas (kk@box) password:
quirks-4.92 signed on 2022-01-07T13:45:06Z
Ambiguous: choose package for bogofilter
a 0: <None>
1: bogofilter-1.2.5
2: bogofilter-1.2.5-db4
3: bogofilter-1.2.5-lmdb
4: bogofilter-1.2.5-qdbm
5: bogofilter-1.2.5-sqlite3
Your choice:
--
Andreas (Kusalananda) Kähäri
SciLifeLab, NBIS, ICM
Uppsala University, Sweden
.