* [gentoo-dev] [PATCH v2] python-utils-r1.eclass: Eliminate false positives from occluded check
@ 2023-08-06 17:36 Michał Górny
0 siblings, 0 replies; only message in thread
From: Michał Górny @ 2023-08-06 17:36 UTC (permalink / raw
To: gentoo-dev; +Cc: Michał Górny
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
if [[ -d ${fn} ]]; then
- diff=$(diff -dupr -x "__pycache__" "${fn}" "${sitedir}/${fn}")
+ diff=$(
+ comm -1 -3 <(
+ find "${fn}" -type f -not -path '*/__pycache__/*' |
+ sort
+ assert
+ ) <(
+ cd "${sitedir}" &&
+ find "${fn}" -type f -not -path '*/__pycache__/*' |
+ sort
+ assert
+ )
+ )
+
if [[ -n ${diff} ]]; then
eqawarn "The directory ${fn} occludes package installed for ${EPYTHON}."
- echo
- echo ">>> Diff:"
- echo "${diff}"
- echo "<<< End-of-diff"
- echo
+ eqawarn "The installed package includes additional files:"
+ eqawarn
+ while IFS= read -r l; do
+ eqawarn " ${l}"
+ done <<<"${diff}"
+ eqawarn
if [[ ! ${_PYTHON_WARNED_OCCLUDED_PACKAGES} ]]; then
- eqawarn "The complete build log includes diffs."
eqawarn "For more information on occluded packages, please see:"
eqawarn "https://projects.gentoo.org/python/guide/test.html#importerrors-for-c-extensions"
_PYTHON_WARNED_OCCLUDED_PACKAGES=1
--
2.41.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2023-08-06 17:37 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-06 17:36 [gentoo-dev] [PATCH v2] python-utils-r1.eclass: Eliminate false positives from occluded check Michał Górny
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox