Dnia 2015-02-02, o godz. 15:06:40 Michał Górny <mgo...@gentoo.org> napisał(a):
> The idea is that instead of having USE=libav (that's tangential to > USE=ffmpeg and confusing) to use a USE_EXPAND like FFMPEG_IMPL taking > either ffmpeg or libav. Now, why... Ok, since this is going to be a long night, a quick summary of the alternatives. First of all, plain USE='ffmpeg libav' where each one signifies one of the impls. This can't work because we already have packages that depend on, say, 'app-misc/tracker[ffmpeg]'. If we replaced that with two optional flags, we'd have to do '|| ( tracker[ffmpeg] tracker[libav] )'. And || () deps are pretty much fragile, don't support := operator and cause unpredictable blockers during dependency resolution. So this can't work. Secondly, global variables that are not USE flags. They can't work since the dependencies in ebuilds need to be consistent and can not be affected by external variables. Thirdly, || () blocks. I already listed above why they must not be used. So, after throwing all technically unsound solutions, we are left with having to have exactly one *feature flag* -- the flag that enables ffmpeg-or-libav support in the packages that have it optional, and one or more *implementation flags* that select the implementation when more than one can be used. For feature flag, name is the only issue. Currently USE=ffmpeg serves that purpose and I think changing that would have a very high cost (and cause a lot of bikeshed), esp. if we would end up reusing the flag for another purpose. So most likely leave it as-is. For implementation flags, we have three options: a. one binary 'libav' flag that switches between the two implementations, b. two regular unary flags that select one of the implementations, c. two USE_EXPAND unary flags that select one of the implementations. A. binary 'libav' flag (or similar) default set in profiles: USE="${USE} libav" user changes impl to ffmpeg: USE="-libav" portage output: media-video/foo USE="... ffmpeg ... libav ..." ebuild code: IUSE="ffmpeg libav" RDEPEND=" ffmpeg? ( !libav? ( media-video/ffmpeg:0= ) libav? ( media-video/libav:0= ) )" non-meaningful flag combinations: USE="-ffmpeg libav" -> doesn't give you libav B. two regular unary flags (i'm going to use ffmpeg/libav here but the names would likely have to be different) default set in profiles: USE="${USE} libav" user changes impl to ffmpeg: USE="-libav ffmpeg" portage output: media-video/foo USE="... avcodec ... libav ... -ffmpeg ..." ebuild code: IUSE="avcodec ffmpeg libav" RDEPEND=" avcodec? ( ffmpeg? ( media-video/ffmpeg:0= ) libav? ( media-video/libav:0= ) )" REQUIRED_USE="avcodec? ( ^^ ( ffmpeg libav ) )" non-meaningful flag combinations: USE="-avcodec *" -> doesn't give you libav or ffmpeg disallowed flag combinations: USE="avcodec -ffmpeg -libav" -> no implementation selected USE="avcodec ffmpeg libav" -> multiple implementations selected C. two USE_EXPAND unary flags default set in profiles: FFMPEG_IMPL="libav" user changes impl to ffmpeg: FFMPEG_IMPL=ffmpeg portage output: media-video/foo USE="... ffmpeg ..." FFMPEG_IMPL="libav -ffmpeg" ebuild code (yeah, pain to type -- but only once...): IUSE="ffmpeg ffmpeg_impl_ffmpeg ffmpeg_impl_libav" RDEPEND=" ffmpeg? ( ffmpeg_impl_ffmpeg? ( media-video/ffmpeg:0= ) ffmpeg_impl_libav? ( media-video/libav:0= ) )" REQUIRED_USE="ffmpeg? ( ^^ ( ffmpeg_impl_ffmpeg ffmpeg_impl_libav ) )" non-meaningful flag combinations: USE="-ffmpeg" FFMPEG_IMPL="*" -> doesn't give you libav or ffmpeg disallowed flag combinations: USE="ffmpeg" FFMPEG_IMPL="-ffmpeg -libav" -> no implementation selected USE="ffmpeg" FFMPEG_IMPL="ffmpeg libav" -> multiple implementations selected -- Best regards, Michał Górny
pgpFc6utuRKj0.pgp
Description: OpenPGP digital signature