• [gentoo-dev] [PATCH v2] python-utils-r1.eclass: Eliminate false positiv

    From =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?@21:1/5 to All on Sun Aug 6 19:40:01 2023
    Modify the occluded package check to unidirectionally check for
    additional files in installed package directory. This eliminates false positives when the source directory contains additional files,
    in particular C sources.

    This change also eliminates the dependency on diff(1), in favor
    of comm(1). As a side effect, we no longer compare .py files for
    equality but that shouldn't be such a big deal.

    Signed-off-by: Michał Górny <mgorny@gentoo.org>
    ---
    eclass/python-utils-r1.eclass | 29 +++++++++++++++++--------

    Changes in v2: inlined the find calls into comm args, removed grep
    and added assert -- thanks to ionen.

    diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass index 27157a003ab2..2db3f7b52dac 100644
    --- a/eclass/python-utils-r1.eclass
    +++ b/eclass/python-utils-r1.eclass
    @@ -1244,14 +1244,13 @@ _python_check_occluded_packages() {
    # positives before filing bugs.
    [[ ! ${PYTHON_EXPERIMENTAL_QA} ]] && return

    - type -P diff &>/dev/null || return
    [[ -z ${BUILD_DIR} || ! -d ${BUILD_DIR}/install ]] && return

    local sitedir="${BUILD_DIR}/install$(python_get_sitedir)"
    # avoid unnecessarily checking if we are inside install dir
    [[ ${sitedir} -ef . ]] && return

    - local f fn diff
    + local f fn diff l
    for f in "${sitedir}"/*/; do
    f=${f%/}
    fn=${f##*/}
    @@ -1260,17 +1259,29 @@ _python_check_occluded_packages() {
    [[ ${fn} == *.dist-info || ${fn} == *.egg-info ]] && continue

    i