On Fri, Dec 23, 2022 at 09:31:59AM +0000, Klemens Nanni wrote:
> In security/qdigidoc4, I see debug-qt6-qttools being fetched but not
> installed (given qt6-qttools is not yet installed).
>
> I can reproduce this with:
>
> # pkg_delete qt6-qttools
> $ make DEBUG_PACKAGES='' INSTALL_DEBUG_PACKAGES=No
>
> Somehow the expression `${DEBUG_PACKAGES:M${_S}}' (select all elements
> patching the pattern) with DEBUG_PACKAGES being the empty string and
> _S being "-" (from MULTI_PACKAGES) evaluates to true.
>
> Wrapping it in !empty() behaves as expected and stops fetching debug-*.
>
> Feedback? Objection? OK?
>
> Index: bsd.port.mk
> ===================================================================
> RCS file: /cvs/ports/infrastructure/mk/bsd.port.mk,v
> retrieving revision 1.1581
> diff -u -p -r1.1581 bsd.port.mk
> --- bsd.port.mk 16 Nov 2022 17:42:18 -0000 1.1581
> +++ bsd.port.mk 23 Dec 2022 09:26:34 -0000
> @@ -988,7 +988,7 @@ _PACKAGE_LINKS += ${MACHINE_ARCH}/ftp/${
> _PACKAGE_COOKIES += ${_PACKAGE_COOKIES${_S}}
> _PACKAGE_COOKIE += ${_PACKAGE_COOKIE${_S}}
> PKGFILE${_S} = ${_PKG_REPO}${_PKGFILE${_S}}
> -. if ${DEBUG_PACKAGES:M${_S}}
> +. if !empty(${DEBUG_PACKAGES:M${_S}})
> _PACKAGE_COOKIES += ${_DBG_PACKAGE_COOKIE${_S}}
> . if ${PERMIT_PACKAGE${_S}:L} == "yes"
> _PACKAGE_COOKIES${_S} +=
> ${PACKAGE_REPOSITORY}/${MACHINE_ARCH}/ftp/${_DBG_PKGFILE${_S}}
> @@ -1201,7 +1201,7 @@ PKG_ARGS${_S} += -A'${PKG_ARCH${_S}}'
> _pkg${_S} = ${_PKGFILE${_S}}
> _pkg_cookie${_S} = ${_PACKAGE_COOKIE${_S}}
>
> -. if ${DEBUG_PACKAGES:M${_S}}
> +. if !empty(${DEBUG_PACKAGES:M${_S}})
> _DBG_PKG_ARGS${_S} := ${PKG_ARGS${_S}}
> _DBG_PKG_ARGS${_S} += -P${FULLPKGPATH${_S}}:=:${FULLPKGNAME${_S}}
> _DBG_PKG_ARGS${_S} += -DCOMMENT="debug info for ${PKGSTEM${_S}}"
> @@ -2013,7 +2013,7 @@ _update_plist += `SUBPACKAGE=$i make run
> _build_debug_info = PORTSDIR=${PORTSDIR} ${_PERLSCRIPT}/build-debug-info -P
> ${_WRKDEBUG} --
>
> .for i in ${BUILD_PACKAGES}
> -. if ${DEBUG_PACKAGES:M$i}
> +. if !empty(${DEBUG_PACKAGES:M$i})
> _build_debug_info += ${PKG_ARGS$i} ${FULLPKGNAME$i}
> . endif
> .endfor
>
Oh, I misread what you're doing.
Your usage of empty is deeply wrong. empty takes a variable name (with
possible modifiers), so your diff would say
.if !empty(DEBUG_PACKAGES:M${_S})
(note there is no ${} around the variable name)
As far as fetching actually goes, what you're seeing is actually a feature.
Debug packages don't really "exist", they're a by-product of normal package
building. As a result, there's no way to fetch debug-packages independently,
or to build them independently, so yeah, grabbing the regular package from
the net will *also* grab the debug package.
And that's actually a good thing, because if later on you figure you need
to debug that piece of software, you already have the correct debug
package lying around (remember that regular and debug packages cannot get
out of synch, at all. egdb won't even try to read debugging information if
it wasn't extracted from that specific binary)