pkg force to add a package

Baptiste Daroussin bapt at FreeBSD.org
Wed Feb 10 22:50:37 UTC 2016


On Wed, Feb 10, 2016 at 06:29:21PM +0100, Tomasz Sowa wrote:
> Hi
> 
> Some questions about pkg. On one computer I have recompiled my ports,
> next I wanted to copy them to another machine so I created packages
> (for simplicity I'm showing only one package):
> /home/tomek# pkg create -f tar nettle-3.2
> Creating package for nettle-3.2
> It created nettle-3.2.tar package.
> 
> On the other machine I have nettle installed but it was in an old
> version:
> [second_machine]/home/tomek# pkg info | grep nettle
> nettle-2.7.1                   Low-level cryptographic library
> 
> Let we see some files from the package:
> [second_machine]/home/tomek# pkg info -l nettle-2.7.1 | grep lib | head -n 4
>         /usr/local/lib/libhogweed.a
>         /usr/local/lib/libhogweed.so
>         /usr/local/lib/libhogweed.so.2
>         /usr/local/lib/libhogweed.so.2.5
> 
> Make sure those files belong to the nettle package:
> [second_machine]/home/tomek# pkg which /usr/local/lib/libhogweed.so.2 /usr/local/lib/libhogweed.so.2.5
> /usr/local/lib/libhogweed.so.2 was installed by package nettle-2.7.1
> /usr/local/lib/libhogweed.so.2.5 was installed by package nettle-2.7.1
> 
> Now I move the new nettle-3.2 to this machine and try to
> `pkg add` it:
> [second_machine]/home/tomek# pkg add nettle-3.2.tar 
> [second_machine] Installing nettle-3.2...
> the most recent version of nettle-2.7.1 is already installed
> 
> It reports me that I have the newest version installed, where the
> information (version) is taken from? is it normal behavior?
> 
> So I have forced the installation:
> [second_machine]/home/tomek# pkg add -f nettle-3.2.tar
> [second_machine] Installing nettle-3.2...
> package nettle is already installed, forced install
> [second_machine] Extracting nettle-3.2: 100%
> 
> Make sure it is really installed:
> [second_machine]/home/tomek# pkg info | grep nettle
> nettle-3.2                     Low-level cryptographic library
> 
> But what about the old files from nettle 2.7.1?
> [second_machine]/home/tomek# ll /usr/local/lib/libhogweed.so.2 /usr/local/lib/libhogweed.so.2.5
> lrwxr-xr-x  1 root  wheel      17  2 lip  2015 /usr/local/lib/libhogweed.so.2@ -> libhogweed.so.2.5
> -rw-r--r--  1 root  wheel  419229  2 lip  2015 /usr/local/lib/libhogweed.so.2.5
> 
> There are still there, may they belongs to some other package now?
> [second_machine]/home/tomek# pkg which /usr/local/lib/libhogweed.so.2 /usr/local/lib/libhogweed.so.2.5
> /usr/local/lib/libhogweed.so.2 was not found in the database
> /usr/local/lib/libhogweed.so.2.5 was not found in the database
> 
> No, they are orphans. And next question is: is it correct behavior?
> I would expect that either `pkg info | grep nettle` reports both:
> nettle-2.7.1                   Low-level cryptographic library
> nettle-3.2                     Low-level cryptographic library
> or if only nettle-3.2 is installed those files from 2.7.1
> are uninstalled. Correct me if am wrong pls.
> 

Beside the error message being wrong, the issue is the fact you do use pkg add
(which is not supposed to be used in that case)

pkg add is a basic tool supposed to mimic the old pkg_add for the ports tree
usage (I don't know how to properly warn users about it) or for special other
cases.

What you were looking for was pkg install ./nettle-3.2.tar which will replace
the old nettle already installed.

and of course the error message from pkg add is mis leading and should be fixed.

Best regards,
Bapt
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-pkg/attachments/20160210/3bb56e70/attachment.sig>


More information about the freebsd-pkg mailing list