On 2020-11-01, Laura Smith <n5d9xq3ti233xiyif2vp@protonmail.ch> wrote:
>
>
>
> Sent with ProtonMail Secure Email.
>
> ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
> On Sunday, 1 November 2020 12:53, Marc Espie <espie@nerim.net> wrote:
>
>> On Sun, Nov 01, 2020 at 12:23:44PM +0000, Laura Smith wrote:
>>
>> > Hi
>> > As far as I can tell from the docs, only pkg_info supports spec style ?
>> > I am trying to script an OpenBSD setup and as part of that certain packages need to be installed. For most packages that is not a problem, however, for example, with gnupg, there are two versions in the 6.8 repo :
>> > gnupg-1.4.23p4.tgz
>> > gnupg-2.2.23p0.tgz
>> > I cannot seem to find a way to tell pkg_add to install >=2 (or better still, install "the latest" version).
>>
>> "Better still" to be discussed.
>>
>> Newer is not always better, especially when some things stop working and
>> stuff like that.
>>
>> It's generally considered that scripting is meant to give you a reliable
>> system...
>>
>> > Any ideas ?
>>
>> You should read pkg_add(1) more closely.
>>
>> pkg_add also understands 'stems', that is, package names without any
>> version specification. For instance, with 'pkg_add kdelibs', pkg_add
>> will look in the current directory (or the PKG_PATH) for a kdelibs
>> package.
>>
>> pkg_add may ask questions in interactive mode, or error out otherwise.
>> Interactive mode is the default on a tty, see options -I/i.
>>
>> For instance 'pkg_add screen' is ambiguous as it matches screen-4.03p6
>> and screen-4.03p6-shm.
>>
>> To avoid ambiguities, pkg_add supports 'stems with flavors', that is, a
>> stem separated from flavors with a double dash. For instance, the
>> previous ambiguity could be resolved by using 'pkg_add screen--' (matches
>> only the empty flavor) or 'pkg_add screen--shm' (matches only the shm
>> flavor).
>>
>> 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).
>>
>> The above ambiguities can be resolved using 'pkg_add postfix%stable' and
>> 'pkg_add python%3.4', respectively.
>>
>> stuff like pkg_add gnupg%gnupg and pkg_add gnupg%gnupg2
>> in 6.8, with possibly a bit more to take care of flavors as well.
>>
>> (note that pkg_info -z will give you the exact specs you want)
>
>
>
> I did actually try "pkg_add gnupg%2" but pkg_add didn't like that. Will go try "pkg_add gnupg%gnupg2" instead....
The exact string you want depends on the subdirectory name used in
ports. This varies between ports - some ports are laid out like
ports/category/name/{1,2} and others ports/category/{name,name2}.
Note that for gnupg this changes after 6.8 because the old 1.x port
has been removed so there's now only gnupg 2.x.
No comments:
Post a Comment