extracting pkg-message for FreshPorts

From: Dan Langille <dan_at_langille.org>
Date: Tue, 10 Aug 2021 01:57:13 UTC
FreshPorts wants to extract the pkg-message. It is useful information.

The problem: how we I populate pkg-message when it is not in the repo?

For example, files/pkg-message.in.

The following outlines the solutions and problems I have encountered.

I'm looking for suggestions.  Things I would like to avoid if possible:

* fetching distfiles
* building (other ports)
* installing packages

I will go through a few different situations:

1 - pkg-message exists in the ports tree

[dan@empty:/usr/ports/sysutils/zfsnap] $ make -V PKGMESSAGE
/usr/ports/sysutils/zfsnap/pkg-message

Yes, that file exists, we can use it.


2 - pkg-message does not exist

[dan@empty:/usr/ports/sysutils/mkjail] $ make -V PKGMESSAGE
/usr/ports/sysutils/mkjail/pkg-message
[dan@empty:/usr/ports/sysutils/mkjail] $ ls -l 
/usr/ports/sysutils/mkjail/pkg-message
ls: /usr/ports/sysutils/mkjail/pkg-message: No such file or directory
[dan@empty:/usr/ports/sysutils/mkjail] $

In this case, there is no .in extension, and we ignore it. There is 
nothing to be obtained

3 - files/pkg-message.in exists

[dan@empty:/usr/ports/sysutils/bsdstats] $ make -V PKGMESSAGE
/var/ports/usr/ports/sysutils/bsdstats/work/pkg-message

How do I get that file created with minimal work?

For example:



Compare with:

[dan@empty:/usr/ports/sysutils/anvil] $ make -V PKGMESSAGE
/var/ports/usr/ports/sysutils/anvil/work/pkg-message

if /work occurs in the path, I know it does not exist yet.

Here's how I create it.  This was one approach:

[dan@empty:/usr/ports/sysutils/anvil] $ make -V PKGMESSAGE
/var/ports/usr/ports/sysutils/anvil/work/pkg-message

[dan@empty:/usr/ports/sysutils/anvil] $ sudo make configure -DNO_DIALOG
===> Skipping 'config' as NO_DIALOG is defined
===>  License BSD2CLAUSE accepted by the user
===>   anvil-0.0.19 depends on file: /usr/local/sbin/pkg - found
=> dlangille-anvil-0.0.19_GH0.tar.gz doesn't seem to exist in 
/var/ports/distfiles/.
=> Attempting to fetch 
https://codeload.github.com/dlangille/anvil/tar.gz/0.0.19?dummy=/dlangille-anvil-0.0.19_GH0.tar.gz
fetch: 
https://codeload.github.com/dlangille/anvil/tar.gz/0.0.19?dummy=/dlangille-anvil-0.0.19_GH0.tar.gz: 
size unknown
fetch: 
https://codeload.github.com/dlangille/anvil/tar.gz/0.0.19?dummy=/dlangille-anvil-0.0.19_GH0.tar.gz: 
size of remote file is not known
dlangille-anvil-0.0.19_GH0.tar.gz                       78 kB 3846 
kBps    00s
===> Fetching all distfiles required by anvil-0.0.19 for building
===>  Extracting for anvil-0.0.19
=> SHA256 Checksum OK for dlangille-anvil-0.0.19_GH0.tar.gz.
===>  Patching for anvil-0.0.19
===>  Configuring for anvil-0.0.19



[dan@empty:/usr/ports/sysutils/bsdstats] $ ls -l 
/var/ports/usr/ports/sysutils/anvil/work/pkg-message
-rw-r--r--  1 root  wheel  1145 Aug 10 01:02 
/var/ports/usr/ports/sysutils/anvil/work/pkg-message


Downside: this fetches distfiles



4 - flavored pkg-message

[dan@empty:/usr/ports/x11/nvidia-hybrid-graphics] $ make -V PKGMESSAGE
/var/ports/usr/ports/x11/nvidia-hybrid-graphics/work-default/pkg-message

NOTE the work-default - this indicates a flavor is involved.

[dan@empty:/usr/ports/x11/nvidia-hybrid-graphics] $ sudo make configure 
-DNO_DIALOG
===> Skipping 'config' as NO_DIALOG is defined
===>  License BSD2CLAUSE accepted by the user
===>   nvidia-hybrid-graphics-0.5 depends on file: /usr/local/sbin/pkg - 
found
===> Fetching all distfiles required by nvidia-hybrid-graphics-0.5 for 
building
===>  Extracting for nvidia-hybrid-graphics-0.5
/bin/mkdir -p /var/ports/usr/ports/x11/nvidia-hybrid-graphics/work-default/.
/bin/mkdir -p 
/var/ports/usr/ports/x11/nvidia-hybrid-graphics/work-default/src/bin
/bin/mkdir -p 
/var/ports/usr/ports/x11/nvidia-hybrid-graphics/work-default/src/bin
/bin/mkdir -p 
/var/ports/usr/ports/x11/nvidia-hybrid-graphics/work-default/src/bin
/bin/mkdir -p 
/var/ports/usr/ports/x11/nvidia-hybrid-graphics/work-default/src/bin
/bin/mkdir -p 
/var/ports/usr/ports/x11/nvidia-hybrid-graphics/work-default/src/libexec/nvidia-headless-utils
/bin/mkdir -p 
/var/ports/usr/ports/x11/nvidia-hybrid-graphics/work-default/src/libexec
/bin/mkdir -p 
/var/ports/usr/ports/x11/nvidia-hybrid-graphics/work-default/src/etc/X11
/bin/mkdir -p 
/var/ports/usr/ports/x11/nvidia-hybrid-graphics/work-default/src/etc
/bin/mkdir -p 
/var/ports/usr/ports/x11/nvidia-hybrid-graphics/work-default/src/etc
===>  Patching for nvidia-hybrid-graphics-0.5
===>  Configuring for nvidia-hybrid-graphics-0.5
(reverse-i-search)`': ^C
[dan@empty:/usr/ports/x11/nvidia-hybrid-graphics] $ make -V PKGMESSAGE
/var/ports/usr/ports/x11/nvidia-hybrid-graphics/work-default/pkg-message

[dan@empty:/usr/ports/x11/nvidia-hybrid-graphics] $ ls -l 
/var/ports/var/ports/usr/ports/x11/nvidia-hybrid-graphics/work-default/pkg-message
-rw-r--r--  1 root  wheel  1000 Aug 10 01:40 
/var/ports/usr/ports/x11/nvidia-hybrid-graphics/work-default/pkg-message

Success.



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
===>   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.
===>  Patching for nvidia-driver-390-390.144
===>  Applying extra patch 
/usr/ports/x11/nvidia-driver-390/../nvidia-driver/files/extra-patch-src_nvidia-modeset_nvidia-modeset-freebsd.c
===>  Applying extra patch 
/var/ports/usr/ports/x11/nvidia-driver-390/work/extra-patch-src-Makefile
===>  Applying extra patch 
/var/ports/usr/ports/x11/nvidia-driver-390/work/extra-patch-src-nv-freebsd.h
===>  Applying extra patch 
/var/ports/usr/ports/x11/nvidia-driver-390/work/extra-patch-src-nvidia_dev.c
===>  Applying extra patch 
/var/ports/usr/ports/x11/nvidia-driver-390/work/extra-patch-src-nvidia_pci.c
===>  Applying extra patch 
/var/ports/usr/ports/x11/nvidia-driver-390/work/extra-patch-src-nvidia_ctl.c
===>  Applying extra patch 
/var/ports/usr/ports/x11/nvidia-driver-390/work/extra-patch-src-nvidia_linux.c
===>  Applying extra patch 
/var/ports/usr/ports/x11/nvidia-driver-390/work/extra-patch-src-nv-misc.h
===>  Applying FreeBSD patches for nvidia-driver-390-390.144 from 
/usr/ports/x11/nvidia-driver-390/../nvidia-driver/files
===>   nvidia-driver-390-390.144 depends on file: 
/usr/local/libdata/pkgconfig/x11.pc - not found
===>  License MIT accepted by the user
===>   libX11-1.7.2,1 depends on file: /usr/local/sbin/pkg - found
=> libX11-1.7.2.tar.bz2 doesn't seem to exist in 
/var/ports/distfiles/xorg/lib.
=> Attempting to fetch 
https://xorg.freedesktop.org/releases/individual/lib/libX11-1.7.2.tar.bz2
libX11-1.7.2.tar.bz2                                  2336 kB 3191 
kBps    00s
===> Fetching all distfiles required by libX11-1.7.2,1 for building
===>  Extracting for libX11-1.7.2,1
=> SHA256 Checksum OK for xorg/lib/libX11-1.7.2.tar.bz2.
===>  Patching for libX11-1.7.2,1
===>   libX11-1.7.2,1 depends on package: pkgconf>=1.3.0_1 - not found
===> Skipping 'config' as NO_DIALOG is defined
===>  License ISCL accepted by the user
===>   pkgconf-1.7.4,1 depends on file: /usr/local/sbin/pkg - found
=> pkgconf-1.7.4.tar.xz doesn't seem to exist in /var/ports/distfiles/.
=> Attempting to fetch 
https://distfiles.dereferenced.org/pkgconf/pkgconf-1.7.4.tar.xz
pkgconf-1.7.4.tar.xz                                   287 kB 1274 
kBps    00s
===> Fetching all distfiles required by pkgconf-1.7.4,1 for building
===>  Extracting for pkgconf-1.7.4,1
=> SHA256 Checksum OK for pkgconf-1.7.4.tar.xz.
===>  Patching for pkgconf-1.7.4,1
===>  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.

Is there a better way?

Thank you.


-- 
Sent from Postbox <https://www.postbox-inc.com>