install-missing-packages installs all flavours

From: Daniel O'Connor <darius_at_dons.net.au>
Date: Sat, 13 Aug 2022 03:41:01 UTC
Hi,
I am building some lightly customised install media for work and am trying to avoid having to build all the packages myself (to save time) so normally I create a metaport with RUN_DEPENDS on all I want then run 'make install-missing-packages' to fetch all of the prebuilt packages.

This seemed to work fairly well until recently when I tried it, but now it pulls in all of the port flavours which obviously blows out the install size to a ridiculous degree.

For now I modified my install like so:

--- /usr/ports/Mk/bsd.port.mk.orig      2022-08-12 09:33:02.669922000 +0000
+++ /usr/ports/Mk/bsd.port.mk   2022-08-12 09:33:03.553032000 +0000
@@ -4052,6 +4052,7 @@
 ALL-DEPENDS-FLAVORS-LIST=      ${DEPENDS-LIST} -f -r ${_UNIFIED_DEPENDS:Q}
 DEINSTALL-DEPENDS-FLAVORS-LIST=        ${DEPENDS-LIST} -f -r ${_UNIFIED_DEPENDS:N${PKG_DEPENDS}:Q}
 MISSING-DEPENDS-LIST=          ${DEPENDS-LIST} -m ${_UNIFIED_DEPENDS:Q}
+MISSING-DEPENDS-FLAVOURS-LIST=         ${DEPENDS-LIST} -f -m ${_UNIFIED_DEPENDS:Q}
 BUILD-DEPENDS-LIST=                    ${DEPENDS-LIST} "${PKG_DEPENDS} ${EXTRACT_DEPENDS} ${PATCH_DEPENDS} ${FETCH_DEPENDS} ${BUILD_DEPENDS} ${LIB_DEPENDS}"
 RUN-DEPENDS-LIST=                      ${DEPENDS-LIST} "${LIB_DEPENDS} ${RUN_DEPENDS}"
 TEST-DEPENDS-LIST=                     ${DEPENDS-LIST} ${TEST_DEPENDS:Q}
@@ -4323,7 +4324,7 @@

 # Install missing dependencies from package
 install-missing-packages:
-       @_dirs=$$(${MISSING-DEPENDS-LIST}); \
+       @_dirs=$$(${MISSING-DEPENDS-FLAVOURS-LIST}); \
        ${ECHO_CMD} "$${_dirs}" | ${SED} "s%${PORTSDIR}/%%g" | \
                ${SU_CMD} "${XARGS} -o ${PKG_BIN} install -A"

Which works a lot better for my use case but I am not sure if it's a general solution or not (or if there should be a 'install-missing-package-flavours' target or something).

Curiously I still end up with Python 3.8 and 3.10 but I can't see where they are being pulled in. I ran this to calculate the deps:
(for i in $(make -V _UNIFIED_DEPENDS); do
echo "============ $i"
/usr/bin/env PORTSDIR="/usr/ports" dp_MAKE="make" dp_PKGNAME="gs-ports-minimal-1.0" dp_PKG_INFO="/usr/local/sbin/pkg-static info -g" dp_SCRIPTSDIR="/usr/ports/Mk/Scripts" dp_OVERLAYS="" /bin/sh /usr/ports/Mk/Scripts/depends-list.sh -f -m "$i"
echo
done)|less

(Ran in my meta port) 

However it only shows Python 3.9 (as I would expect) but 'make install-missing-packages' still pulls in 3.8 and 3.10. This isn't a big deal since just those ports are pretty small but it seems like a bug.

Thanks.

--
Daniel O'Connor
"The nice thing about standards is that there
are so many of them to choose from."
-- Andrew Tanenbaum