Re: Python version dependencies in pkg

From: Shane Ambler <FreeBSD_at_ShaneWare.Biz>
Date: Tue, 04 Oct 2022 06:49:18 UTC
On 3/10/22 2:06 pm, Tatsuki Makino wrote:
> I tend to just keep the answer in my head and forget the why :)
> And a point I remembered.
> Shane Ambler wrote on 2022/10/02 12:27:
>> While making or updating a port, I build and install for each flavour
>> before testing with poudriere
>> make FLAVOR=py38 stage-qa install clean
>> make FLAVOR=py39 stage-qa install clean
>> make FLAVOR=py310 stage-qa install clean
>> I find that this doesn't carry through to dependencies so I end up
>> setting FLAVOR in the env
>> setenv FLAVOR py310; make stage-qa install clean
>> and bash would be - export FLAVOR=py310; make install
> Isn't that behavior no problem because it is a USE_PYTHON=allflavors port or because BUILD_ALL_PYTHON_FLAVORS is defined in the /etc/make.conf?
> In environments where this is not the case, the following occurs
> # make -C /usr/ports/multimedia/libopenshot/ install FLAVOR=py310
> ===>  py310-libopenshot-0.2.7_4 Unknown flavor 'py310', possible flavors:
> py39.
> *** Error code 1

That error indicates a flavour that is not supported. For example a port
specifying USES=python:3.9 means py39 is the only supported flavor so
building with py310 would fail. USES=python:3.8-3.10 would build for
py39 and py310 but fail for py311

So it isn't an option you can set globally, you only use it to build one
flavour of the one port at a time, although you can set it in env so
that it carries through to install deps that require and support the
same flavour. Useful when first creating a port, sometimes for new
versions, after that you use poudriere to test build all available

Instead of building flavours, you can use pkg to install all flavours
that are available in the pkg repo.

pkg search numpy

pkg install py38-numpy py39-numpy

> Stop.
> make: stopped in /usr/ports/multimedia/libopenshot/
> Next.
> As long as FLAVOR was only used for Python, there was no problem.
> But now FLAVOR has the following just for what I know.
> devel/llvm-devel, editors/emacs, graphics/evince, graphics/gpu-firmware-*-kmod... and what else was there? :)

Works for any port using flavours, the value given just has to be valid
for the port you are building. lite is valid for llvm-devel, canna is
valid for emacs.

You can get a list of valid flavours for a port -

make -C /usr/ports/devel/llvm-devel -V FLAVORS

> I don't know if the make variable FLAVOR is something that can have more than one FLAVOR in it.
> Python and PHP seem to have a part where it puts the FLAVOR for itself into another variable like PY_FLAVOR or PHP_FLAVOR.
> However, sometimes FLAVOR is used without considering the possibility that it may contain unrelated FLAVOR or multiple FLAVORs in other cases.

No - FLAVOR is a single value option, you only build one at a time.

you can build multiple flavours in a loop -

for F in py38 py39 py310
make FLAVOR=$F install

Which means you can write a script that gets the valid flavours and
builds all flavours for a given port.

FreeBSD - the place to B...Software Developing

Shane Ambler