On Sunday 16 December 2007 08:13:49 Donnie Berkholz wrote: > On 17:46 Fri 14 Dec , Greg Kroah-Hartman (gregkh) wrote: > > pkg_setup() { > > einfo "Checking mplayer for USE flags we need..." > > for f in "encode dvd x264 mp3"; do > > if ! built_with_use media-video/mplayer $f; then > > eerror "$f" > > die "mplayer merged without $f USE flag" > > fi > > done > > Does this actually work as you want? I'd be surprised. Quoting the whole > thing should treat it as a single flag with spaces and only run through > the loop once. > > It should only coincidentally work because built_with_use() takes any > number of flags and loops through them, but I doubt it prints the single > missing flag as you intend.
Indeed it works because $f isn't quoted and built_with_use handles a list just fine. Just the for loop is pointless. Fixing it to check only one use flag at a time, however, is a horrible idea because it risks telling the user to recompile mplayer four times each adding another use flag. There really is no reason not to just show the full list of required flags if one of them is missing but if you really want to at least move the die out of the loop. -- Bo Andresen
signature.asc
Description: This is a digitally signed message part.