[Bug 264454] Do not build TEST_DEPENDS in case NO_TEST is set and do not run tests

From: <bugzilla-noreply_at_freebsd.org>
Date: Fri, 10 Jun 2022 08:10:15 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=264454

Stefan Eßer <se@FreeBSD.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|New                         |Open

--- Comment #11 from Stefan Eßer <se@FreeBSD.org> ---
(In reply to Bjoern A. Zeeb from comment #9)

> You go by assumptions of what people are doing.

Yes, given no further information I do have to make assumptions.

> I do not do port upgrades;  in fact I most often never do apart from select 
> individual bits which I do not handle this way.
> I build coherent image (tailored distribution) after FreeBSD version bumps 
> on main at times (I am not even doing every one of them).

You cannot expect bsd.port.mk to provide the high level functionality for every
use case. I have managed the port management tools: they do exactly that -
provide user oriented and configurable functionality.

But you do not have to use a tool like portmaster. Something as simple as the
following script should be sufficient to build packages for a specified set of
ports without fetching or building anything not required:

----------------------------
#!/bin/sh -e

WANTED="
shells/bash
www/py-arxiv
"

make_wanted () {
    echo "$WANTED" | while read dir; do
        if [ -n "$dir" ]; then
            make -C $dir "$@"
        fi
    done
}

cd /usr/ports

make_wanted clean

REQUIRED=$(make_wanted run-depends-list | sort -u)

for dir in $REQUIRED; do
    make -C $dir package
done
----------------------------

This will create a consistent set of packages including all run dependencies. 

One possible issue with such a simple approach is that it expects all ports to
be built for just the default flavor.

FLAVOR support has been implemented in the ports system a way that is very
unfriendly to any tool except poudriere.

The port management tools provide the above shown functionality (and a lot
more) in a way that optimizes the procedure and that can deal with non-default
flavors.

Trying to get all functionality for all possible non-standard use-cases into
bsd.port.mk is the completely wrong approach. This Makefile provides a set of
primitive functions that can be used in scripts like the example above to
implement any special case.

It is much easier to deal with such use-cases in shell scripts (or other script
languages) than in a Makefile. Makefiles implements target driven
functionality, scripts implement procedures.

The *-recursive function in bsd.port.mk have been implemented at a time when
there were no port management tools (and not even the pkg command and PKGDB).

They do not serve your use case well and probably never will. I have shown
other examples where functionality at that level is not provided by bsd.port.mk
in a way that is useful for tasks like those you want it to achieve.

What you are doing is a typical use-case for poudriere. It builds packages in a
way that guarantees their consistency and always in a clean environment, not
influenced by any ports already present on the base system.

-- 
You are receiving this mail because:
You are on the CC list for the bug.