public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: Sam James <sam@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Cc: base-system@gentoo.org, kde@gentoo.org, Sam James <sam@gentoo.org>
Subject: [gentoo-dev] [PATCH] cmake.eclass: workaround S=${WORKDIR} creating builddir above ${WORKDIR}
Date: Mon, 26 Jun 2023 10:57:15 +0100	[thread overview]
Message-ID: <20230626095716.1292297-1-sam@gentoo.org> (raw)

When S=${WORKDIR}, cmake.eclass would create its build directory (if CMAKE_USE_DIR
is unset) above WORKDIR(!) as ${WORKDIR}_build. Creating directories above
WORKDIR is not legal.

Portage has its own bug (bug #889418) in that it doesn't clean up unknown directories
above WORKDIR in PORTAGE_TMPDIR, so combined, you get a problem where "ebuild ... clean" doesn't
actually clean things up at all, and you get very confusing issues if e.g. changing
CC between runs.

The explicit S=WORKDIR check isn't truly needed but it makes explicit our
intent here.

Bug: https://bugs.gentoo.org/889418
Closes: https://bugs.gentoo.org/889420
Signed-off-by: Sam James <sam@gentoo.org>
---
 eclass/cmake.eclass | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/eclass/cmake.eclass b/eclass/cmake.eclass
index 1cdbc123a243..4050beb22ba3 100644
--- a/eclass/cmake.eclass
+++ b/eclass/cmake.eclass
@@ -293,6 +293,15 @@ _cmake_check_build_dir() {
 		BUILD_DIR="${CMAKE_USE_DIR}"
 	else
 		: "${BUILD_DIR:=${CMAKE_USE_DIR}_build}"
+
+		# Avoid creating ${WORKDIR}_build (which is above WORKDIR).
+		# TODO: For EAPI > 8, we should ban S=WORKDIR for CMake.
+		# See bug #889420.
+		if [[ ${S} == ${WORKDIR} && ${BUILD_DIR} == ${WORKDIR}_build ]] ; then
+			eqawarn "QA notice: S=WORKDIR is deprecated for cmake.eclass."
+			eqawarn "Please relocate the sources in src_unpack."
+			BUILD_DIR="${WORKDIR}"/${P}_build
+		fi
 	fi
 
 	einfo "Source directory (CMAKE_USE_DIR): \"${CMAKE_USE_DIR}\""
-- 
2.41.0



             reply	other threads:[~2023-06-26  9:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-26  9:57 Sam James [this message]
2023-06-26 10:36 ` [gentoo-dev] [PATCH] cmake.eclass: workaround S=${WORKDIR} creating builddir above ${WORKDIR} Ulrich Mueller
2023-06-26 10:45   ` Jaco Kroon
2023-06-26 11:14     ` Ulrich Mueller
2023-06-26 15:24   ` Sam James

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230626095716.1292297-1-sam@gentoo.org \
    --to=sam@gentoo.org \
    --cc=base-system@gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    --cc=kde@gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox