From 5f2ad6a2254b5789debdb4f110e6fb8f728de97b Mon Sep 17 00:00:00 2001 From: Michał Górny Date: Sat, 14 Jan 2017 23:08:01 +0100 Subject: end-quiz: Add questions about valid USE flag cases, #465848 --- recruiters/quizzes/end-quiz.txt | 44 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/recruiters/quizzes/end-quiz.txt b/recruiters/quizzes/end-quiz.txt index 96bff5b..eedb3ba 100644 --- a/recruiters/quizzes/end-quiz.txt +++ b/recruiters/quizzes/end-quiz.txt @@ -171,3 +171,47 @@ docs: devmanual package? Under which circumstances should you avoid this check and how? docs: devmanual + +21. When should USE flags be used? What are the cases where they should be + avoided? Consider the following examples. Explain what is wrong in them + and how would you improve them. + +docs: devmanual, common sense + +21.a. A large C++ application with long build time has: + + # libcxx can be optionally used at run time via -stdlib=libc++ + IUSE="libcxx" + DEPEND="" + RDEPEND="libcxx? ( dev-libs/libcxx )" + +21.b. A large package with long build time has: + + inherit bash-completion-r1 + IUSE="bash-completion" + + src_install() { + default + use bash-completion && dobashcomp contrib/bash-completion/foo + } + +21.c. A package unconditionally installs 'foobar' executable which links + to libbar. The ebuild maintainer wanted to make it optional. + He used the following code: + + IUSE="foobar" + RDEPEND="foobar? ( dev-libs/libbar )" + DEPEND="${RDEPEND}" + + src_install() { + default + if ! use foobar; then + rm "${ED}"/usr/bin/foobar || die + fi + } + +21.d. A package has numerous configure switches which control a number + of optional features. All of them are enabled by default. They do + not have any external dependencies, and do not affect the package + size significantly. The ebuild author has added over 20 local USE + flags to control all of them. -- cgit v1.2.3-65-gdbad