Re: extracting pkg-message for FreshPorts

From: Dan Langille <dan_at_langille.org>
Date: Tue, 10 Aug 2021 23:33:03 UTC
Dan Langille wrote on 8/9/21 9:57 PM:

[snip]
> 5 - needs to build
>
> [dan@empty:/usr/ports/x11/nvidia-driver-390] $ make -V PKGMESSAGE
> /var/ports/usr/ports/x11/nvidia-driver-390/work/pkg-message
>
> [dan@empty:/usr/ports/x11/nvidia-driver-390] $ sudo make configure 
> -DNO_DIALOG
> ===> Skipping 'config' as NO_DIALOG is defined
> ===>  License NVIDIA accepted by the user
>
[snip]
> ===> Configuring for pkgconf-1.7.4,1
> configure: loading site script /usr/ports/Templates/config.site
> checking for gcc... cc
>
> This does a lot of building. A lot.  That's not good.

Some followup. The above installed 134 ports and worked:

[dan@empty:/usr/ports/x11/nvidia-driver-390] $ ls -l 
/var/ports/usr/ports/x11/nvidia-driver-390/work/pkg-message
-rw-r--r--  1 root  wheel  1808 Aug 10 22:31 
/var/ports/usr/ports/x11/nvidia-driver-390/work/pkg-message

> Is there a better way?
Yes, there is.  make apply-slist

 From IRC came that suggestion, which, oddly enough, I was originally 
using before heading down this rabbit hole.

[root@empty /usr/ports/x11/nvidia-driver-390]# make apply-slist
/bin/sh: cannot create 
/var/ports/usr/ports/x11/nvidia-driver-390/work/pkg-message: No such 
file or directory
*** Error code 2

Stop.
make: stopped in /usr/ports/x11/nvidia-driver-390
[root@empty /usr/ports/x11/nvidia-driver-390]#


Nope. That won't work.

The next suggestion was: make extract apply-slist

[root@empty /usr/ports/x11/nvidia-driver-390]# make extract apply-slist
===> Building/installing dialog4ports as it is required for the config 
dialog
===>  Cleaning for dialog4ports-0.1.6
===>  License BSD2CLAUSE accepted by the user
===>   dialog4ports-0.1.6 depends on file: /usr/local/sbin/pkg - found
=> dialog4ports-0.1.6.tar.gz doesn't seem to exist in /var/ports/distfiles/.
=> Attempting to fetch 
https://files.etoilebsd.net/dialog4ports/dialog4ports-0.1.6.tar.gz
dialog4ports-0.1.6.tar.gz                               10 kB  161 
MBps    00s
....
boom dialog box.

[root@empty /usr/ports/x11/nvidia-driver-390]# make extract apply-slist 
-DNO_DIALOG
===> Skipping 'config' as NO_DIALOG is defined
===>  License NVIDIA accepted by the user
===>   nvidia-driver-390-390.144 depends on file: /usr/local/sbin/pkg - 
found
=> NVIDIA-FreeBSD-x86_64-390.144.tar.gz doesn't seem to exist in 
/var/ports/distfiles/.
=> Attempting to fetch 
https://jp.download.nvidia.com/XFree86/FreeBSD-x86_64/390.144/NVIDIA-FreeBSD-x86_64-390.144.tar.gz
NVIDIA-FreeBSD-x86_64-390.144.tar.gz                    62 MB   13 
MBps    05s
===> Fetching all distfiles required by nvidia-driver-390-390.144 for 
building
===>  Extracting for nvidia-driver-390-390.144
=> SHA256 Checksum OK for NVIDIA-FreeBSD-x86_64-390.144.tar.gz.
[root@empty /usr/ports/x11/nvidia-driver-390]# make -V PKGMESSAGE
/var/ports/usr/ports/x11/nvidia-driver-390/work/pkg-message
[root@empty /usr/ports/x11/nvidia-driver-390]# ls -l 
/var/ports/usr/ports/x11/nvidia-driver-390/work/pkg-message
-rw-r--r--  1 root  wheel  1808 Aug 10 23:24 
/var/ports/usr/ports/x11/nvidia-driver-390/work/pkg-message
[root@empty /usr/ports/x11/nvidia-driver-390]#

Success.

This approach also works for all the previous example where PKG_MESSAGE 
refers to something in the /work* directory

Thank you for coming to my TED talk.

-- 
Dan Langille - dan@langille.org
https://langille.org/