Given that we can detect USEflags, it will be better to check that prior to starting the emerge: >>> Running pre-merge checks for media-gfx/darktable-3.0.2 * ERROR: media-gfx/darktable-3.0.2::gentoo failed (pretend phase): * Please switch to a gcc version built with USE=graphite * * Call stack: * ebuild.sh, line 125: Called pkg_pretend * darktable-3.0.2.ebuild, line 84: Called die * The specific snippet of code: * test-flags-CC -floop-block &> /dev/null || \ * die "Please switch to a gcc version built with USE=graphite" * * If you need support, post the output of `emerge --info '=media-gfx/darktable-3.0.2::gentoo'`, * the complete build log and the output of `emerge -pqv '=media-gfx/darktable-3.0.2::gentoo'`. * The complete build log is located at '/var/log/portage/build/media-gfx/darktable-3.0.2:20200801-105901.log.gz'. * For convenience, a symlink to the build log is located at '/tmp/portage/media-gfx/darktable-3.0.2/temp/build.log.gz'. * The ebuild environment file is located at '/tmp/portage/media-gfx/darktable-3.0.2/temp/die.env'. * Working directory: '/tmp/portage/media-gfx/darktable-3.0.2/homedir' * S: '/tmp/portage/media-gfx/darktable-3.0.2/work/darktable-3.0.2' Reproducible: Always
Umm, no. Depending on sys-devel/gcc[graphite] merely ensures that there is a version of gcc installed that supports graphite - but it does not mean that the *currently selected* compiler supports it.
I see, I missed that point (taking for granted that most users have only one gcc installed). But if none of the installed gcc versions meets the requirements, then this requirement cannot be satisfied. So, requiring it in DEPEND is still a good idea, IMHO. Do not throw away the current check, but it is kind of run-time check in a way. If you don't agree, please mark again as INVALID and I'll shut up ;-D
(In reply to Kalin KOZHUHAROV from comment #0) > Given that we can detect USEflags No, you can't. You can have more than one compiler installed and not all of their USE flags (are not|should not be) required to match (but only a single compiler's). So instead you have to check for features of a particular compiler that has been set up to be used for building this package, which is exactly what pkg_pretend() is doing here.