Created attachment 368498 [details, diff] eutils_add_optfeature.patch Attached is a patch to add the function "optfeature()" to eutils. The function is tweaked from one that floppym uses in net-misc/netctl, which apparently was in turn borrowed and tweaked from one mgorny wrote. The general idea is that you call optfeature "description" cat-egory/package and if package isn't installed it will suggest cat-egory/package for (description). It can take multiple packages as arguments for when one of several packages would meet the optional dependency as well. This would be used in conjunction with an elog message saying something like "This package has several optional dependencies, consider installing:". I could also see this being handled as some sort of bash array (say, OPTDEPENDS), but I'm not proficient enough in bash to figure out how that might work out.
If I pass multiple atoms and one of the latter ones is installed, the function will still print the ones preceding it, but not any that come after. For example, if I have cat/b installed, and I make this call: optfeature foobar cat/a cat/b cat/c The output would be: cat/a for foobar
Created attachment 368506 [details, diff] eutils_add_optfeature_v2.patch Updated to test whether any of the packages are installed, and only display if none are.
Created attachment 368508 [details, diff] eutils_add_optfeature_v2.patch Fixed typo as well
Created attachment 368510 [details, diff] eutils_add_optfeature_v2.patch And put the function within the if/fi preventing multiple inherits
Created attachment 368514 [details, diff] eutils_add_optfeature_v3.patch I've expanded the optfeature function a bit so that a feature can be provided by a set of multiple packages. Currently a set of packages is indicated with \( (the escaping is required by bash), however, I'm open to a better way of defining sets.
Created attachment 368516 [details, diff] eutils_add_optfeature_v4.patch This patch modifies the previous patch so that sets are indicated by quoted strings (eg: "app-misc/foo app-misc/bar") rather than escaped parenthesis.
Created attachment 368518 [details, diff] eutils_add_optfeature_v6.patch cleanup variable definitions
please post this to the gentoo-dev@ list for review
Reopening since we seem to have nothing more to say on -dev. Comments consisted of a non-substantive complaint about having discussed this before and a "I'm fine with this as long as it's opt-in." Is that enough review for the patch to be added?
I looked at the patch and it looks good to me. Does anyone else in base-system have an objection to this going in?
@creffett: I would commit the patch sometime tomorrow if no one objects.
In the absence of any objections, this has been committed.
the documentation was broken (invalid use of @CODE). the style was broken (missing braces with vars). i've fixed those: http://sources.gentoo.org/eclass/eutils.eclass?r1=1.432&r2=1.433 however, the current code still has bad expansion logic. when you do: optfeature "bar support" app-misc/bar app-misc/baz[bar] ... for i; do for j in ${i}; do that will wrongly try to do expansion on ${i}. you can disable shell options to avoid it (like path expansion), but i'd just say drop the support entirely. is it really necessary to pack it into one call ?
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1c584e31cf0861c94332a5350614912b073616bc commit 1c584e31cf0861c94332a5350614912b073616bc Author: David Seifert <soap@gentoo.org> AuthorDate: 2021-01-11 20:33:09 +0000 Commit: David Seifert <soap@gentoo.org> CommitDate: 2021-01-11 20:33:09 +0000 optfeature.eclass: [QA] Fix unwanted globbing Closes: https://bugs.gentoo.org/498988 Reported-by: Mike Frysinger <vapier@gentoo.org> Suggested-by: Ulrich Müller <ulm@gentoo.org> Signed-off-by: David Seifert <soap@gentoo.org> eclass/optfeature.eclass | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)