diff options
Diffstat (limited to 'recruiters/quizzes/end-quiz.txt')
-rw-r--r-- | recruiters/quizzes/end-quiz.txt | 44 |
1 files changed, 44 insertions, 0 deletions
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. |