commit:     65364fa2fa675ed05152f8fe5e4665cf262ed4b7
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 31 02:02:36 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Jan 31 02:06:03 2022 +0000
URL:        https://gitweb.gentoo.org/proj/crossdev.git/commit/?id=65364fa2

crossdev: don't pick ebuild version from overlay if unmatching KEYWORDS

We don't want to e.g. pick a GCC from an overlay if it doesn't
have KEYWORDS for our target, which then leads to an early
crossdev failure as it obviously can't then emerge GCC.

Signed-off-by: Sam James <sam <AT> gentoo.org>

 crossdev | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/crossdev b/crossdev
index 806a66c..287fd53 100755
--- a/crossdev
+++ b/crossdev
@@ -1194,9 +1194,26 @@ set_links() {
        fi
        for s in ${ovl} ${SEARCH_OVERLAYS} ; do
                if [[ -d ${s}/${cat}/${pkg} ]] ; then
-                       srcdir=${s}
-                       einfo "getting ${cat}/${pkg} from ${srcdir}"
-                       break
+                       # Versions in an additional non-crossdev overlay may 
not have the right keywords.
+                       # e.g. suppose we have sys-devel/gcc in an overlay with 
just ~arch keywords.
+                       # (Or not be keyworded for our target arch at all!)
+                       local search_kw_string=
+
+                       case "${LVER}" in
+                               "[stable]")
+                                       search_kw_string="^[~]${TARCH}"
+                                       ;;
+                               *)
+                                       search_kw_string="${TARCH}"
+                                       ;;
+                       esac
+
+                       if grep -qre "KEYWORDS=.*${search_kw_string}" 
"${s}/${cat}/${pkg}" ; then
+                               # ... so only skip if we found one which is at 
least stable.
+                               srcdir=${s}
+                               einfo "getting ${cat}/${pkg} from ${srcdir}"
+                               break
+                       fi
                fi
        done
        ln -s "${srcdir}"/${cat}/${pkg} "${d}"

Reply via email to