Gentoo Archives: gentoo-dev

From: Tom Knight <tomk@g.o>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] use foo && bar vs. [ `use foo` ] && bar
Date: Mon, 19 Jul 2004 17:33:52
Message-Id: 20040719173349.GA26225@earwig.bogus
1 Hi
2
3 First I want to say how glad I am to be part of the dev team. I'll try my
4 best not to screw anything up, so excuse any silly questions I'm bound to
5 have.
6
7 Back on topic, I've searched for this on bugzilla, and didn't find anything,
8 but I'm sure it's come up on the forums before. There are several ebuilds
9 which have something along the lines of:
10
11 use foo && bar
12
13 Which executes bar if the foo USE flag is set, the problem is that the use
14 function not only returns true when the USE flag is set it also echos the
15 flag to stdout. When you emerge something you end up with loads of use flags
16 outputted.
17
18 The solution is to do it like this:
19
20 [ `use foo` ] && bar
21
22 Which returns true if foo is in USE, but doesn't output the USE flag.
23
24 I'm going have a go at fixing some of the net-mail packages, if others can
25 do the same taht would be great.
26
27 tom

Replies