Deriving base port/package names

Matthew Seaman matthew at
Fri Apr 8 15:23:18 UTC 2016

On 2016/04/08 15:47, Roger Marquis wrote:
> As in: `pkg rquery -a %n | grep -- '-[0-9]' | fmt`
>   efax-0.9a font-adobe-100dpi font-adobe-75dpi font-adobe-utopia-100dpi
>   font-adobe-utopia-75dpi font-bh-100dpi font-bh-75dpi
>   font-bh-lucidatypewriter-100dpi font-bh-lucidatypewriter-75dpi
>   font-bitstream-100dpi font-bitstream-75dpi gl-117 gnome-2048
>   ja-edict-utf-8 ja-kon2-14dot ja-kon2-16dot ja-rubygem-mail-iso-2022-jp
>   krb5-112 krb5-113 krb5-114 liblqr-1 libutf-8
>   linux-enemyterritory-jaymod-217 linux-enemyterritory-omni-bot-0660
>   nvidia-driver-304 nvidia-driver-340 onscripter-1byte p5-Acme-6502
>   p5-Business-OnlinePayment-2CheckOut p5-Chemistry-3DBuilder p5-WWW-2ch
>   p5-WWW-Shorten-0rz ppmd-7z qt5-3d quake2-3zb2 stf-6rd-kmod vte3-290
>   xhtml-11 xorg-fonts-100dpi xorg-fonts-75dpi
> Some of us see this as a weakness in the standard.  That plus the lack
> of documentation where you'd expect to find it violates the principles
> of least surprise and KIS.

The 'version' part of a full package name can't contain the '-'
character.  Put another way, if you're working with full pkgnames
'%n-%v' it's always the last '-' character that separates the name from
the version.

In shell, you can do something like this:

$ pkgname='postgresql92-client-9.2.16'
$ echo ${pkgname%-*}
$ echo ${pkgname##*-}

or if you prefer sed(1):

$ echo $pkgname | sed -e 's,-[^-]*$,,'
$ echo $pkgname | sed -e 's,^.*-,,'

It's generally assumed that you'ld know if you've got a version part
appended to the name or not, and would be able to code accordingly.

I think a proposal to rename large chunks of the ports tree to eliminate
hyphens and digits would certainly not receive a warm welcome.



-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 972 bytes
Desc: OpenPGP digital signature
URL: <>

More information about the freebsd-ports mailing list