pkgcheck icon indicating copy to clipboard operation
pkgcheck copied to clipboard

EbuildSemiReservedName doesn't detect `CDEPEND` usage

Open thesamesam opened this issue 2 years ago • 4 comments

Tested at ::gentoo commit 71d0d48fe392b55b1ed9fdd3727d9dd4a9310ca2 in net-dns/unbound.

$ head -n 45 unbound-1.17.0.ebuild
# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI="8"
PYTHON_COMPAT=( python3_{9..11} )

inherit autotools flag-o-matic multilib-minimal python-single-r1 systemd verify-sig

MY_P=${PN}-${PV/_/}
DESCRIPTION="A validating, recursive and caching DNS resolver"
HOMEPAGE="https://unbound.net/ https://nlnetlabs.nl/projects/unbound/about/"
SRC_URI="https://nlnetlabs.nl/downloads/unbound/${MY_P}.tar.gz
        verify-sig? ( https://nlnetlabs.nl/downloads/unbound/${MY_P}.tar.gz.asc )"
VERIFY_SIG_OPENPGP_KEY_PATH=${BROOT}/usr/share/openpgp-keys/unbound.net.asc

LICENSE="BSD GPL-2"
SLOT="0/8" # ABI version of libunbound.so
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~mips ~ppc ~ppc64 ~riscv ~x86"
IUSE="debug dnscrypt dnstap +ecdsa ecs gost +http2 python redis selinux static-libs systemd test +tfo threads"
REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
RESTRICT="!test? ( test )"

# Note: expat is needed by executable only but the Makefile is custom
# and doesn't make it possible to easily install the library without
# the executables. MULTILIB_USEDEP may be dropped once build system
# is fixed.

CDEPEND="acct-group/unbound
        acct-user/unbound
        >=dev-libs/expat-2.1.0-r3[${MULTILIB_USEDEP}]
        >=dev-libs/libevent-2.0.21:0=[${MULTILIB_USEDEP}]
        >=dev-libs/openssl-1.0.1h-r2:0=[${MULTILIB_USEDEP}]
        dnscrypt? ( dev-libs/libsodium:=[${MULTILIB_USEDEP}] )
        dnstap? (
                dev-libs/fstrm[${MULTILIB_USEDEP}]
                >=dev-libs/protobuf-c-1.0.2-r1:=[${MULTILIB_USEDEP}]
        )
        ecdsa? (
                dev-libs/openssl:0[-bindist(-)]
        )
        http2? ( net-libs/nghttp2:=[${MULTILIB_USEDEP}] )
        python? ( ${PYTHON_DEPS} )
        redis? ( dev-libs/hiredis:= )
        systemd? ( sys-apps/systemd )
"
[...]
$ pkgcheck --version
pkgcheck 0.10.25-2-g4166bfd -- Fri, 19 May 2023 20:02:52 +0300

pkgcheck doesn't report a EbuildSemiReservedName result here for the use of CDEPEND.

thesamesam avatar Jun 19 '23 21:06 thesamesam

Curiously, the test for this says CDEPEND is ok: https://github.com/pkgcore/pkgcheck/blob/4166bfdb42b288e9e7c7eabc14196ecab3351fb9/testdata/repos/standalone/EbuildReservedCheck/EbuildSemiReservedName/EbuildSemiReservedName-0.ebuild#L11

thesamesam avatar Jun 19 '23 21:06 thesamesam

Oh, this is interesting...

Old pkgcore NEWS mentions CDEPEND: https://github.com/pkgcore/pkgcore/blob/668894eaf04cf7165d4b9eb78326bc25201ac66b/NEWS.rst#pkgcore-05114-2010-04-21

It was dropped in https://github.com/pkgcore/pkgcore/commit/e6a5ded4d933c0f045b4aac2f7779c4d9e17944a too. But pkgcore doesn't recognise it anymore, so this just seems like a coincidence.

I assumed that https://github.com/pkgcore/pkgcheck/pull/552/files#diff-823b00e249271038f4ed6fa4f9958a5e7cd77970b15e613af832dfa9a1163639R128 was a clever trick to get variables with a one-character difference from "DEPEND" which isn't recognised, but I suppose this ends up excluding CDEPEND. But then why didn't we use ADEPEND there anyway?

thesamesam avatar Jun 19 '23 21:06 thesamesam

We specially drop CDEPEND since it used used commonly, and we thought it was a good exclude candidate:

https://github.com/pkgcore/pkgcheck/blob/4166bfdb42b288e9e7c7eabc14196ecab3351fb9/src/pkgcheck/checks/reserved.py#L128-L132

arthurzam avatar Jun 21 '23 18:06 arthurzam

I'd say people should just use COMMON_DEPEND there and we shouldn't drop it.

thesamesam avatar Aug 04 '23 00:08 thesamesam