1 |
-----BEGIN PGP SIGNED MESSAGE----- |
2 |
Hash: SHA1 |
3 |
|
4 |
Marijn Schouten (hkBst) wrote: |
5 |
|
6 |
Zlin found yet another bug. Since echo "" will output a newline my current |
7 |
proposed implementation of useq won't be quiet. |
8 |
|
9 |
> _use() { |
10 |
> local flag=$1 |
11 |
> local string_success=$2 |
12 |
> local string_failure=$3 |
13 |
> local success=0 |
14 |
> |
15 |
> # invert the return value for "!blah" and strip the '!' |
16 |
> [[ ${flag} = !* ]] && { success=1 ; flag=${flag:1} } |
17 |
> |
18 |
> # Make sure we have this USE flag in IUSE |
19 |
> if ! hasq "${flag}" ${IUSE} ${E_IUSE} && ! hasq "${flag}" |
20 |
> ${PORTAGE_ARCHLIST} selinux; then |
21 |
> eqawarn "QA Notice: USE Flag '${flag}' not in IUSE for ${CATEGORY}/${PF}" |
22 |
> fi |
23 |
> |
24 |
> hasq ${flag} ${USE} || ((success=1-success)) |
25 |
> |
26 |
> echo $(_if success "${string_success}" "${string_failure}") |
27 |
> return success |
28 |
> } |
29 |
|
30 |
More fixed version: |
31 |
|
32 |
_use() { |
33 |
local flag=$1 |
34 |
local string_success=$2 |
35 |
local string_failure=$3 |
36 |
local success=0 |
37 |
|
38 |
# invert the return value for "!blah" and strip the '!' |
39 |
[[ ${flag} = !* ]] && { success=1 ; flag=${flag:1} } |
40 |
|
41 |
# Make sure we have this USE flag in IUSE |
42 |
if ! hasq "${flag}" ${IUSE} ${E_IUSE} && ! hasq "${flag}" |
43 |
${PORTAGE_ARCHLIST} selinux; then |
44 |
eqawarn "QA Notice: USE Flag '${flag}' not in IUSE for ${CATEGORY}/${PF}" |
45 |
fi |
46 |
|
47 |
hasq ${flag} ${USE} || ((success=1-success)) |
48 |
|
49 |
string=$(_if success "${string_success}" "${string_failure}") |
50 |
string && echo string |
51 |
return success |
52 |
} |
53 |
|
54 |
Marijn |
55 |
|
56 |
- -- |
57 |
Marijn Schouten (hkBst), Gentoo Lisp project |
58 |
<http://www.gentoo.org/proj/en/lisp/>, #gentoo-lisp on FreeNode |
59 |
-----BEGIN PGP SIGNATURE----- |
60 |
Version: GnuPG v2.0.7 (GNU/Linux) |
61 |
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org |
62 |
|
63 |
iD8DBQFHKhB4p/VmCx0OL2wRAr1oAJ9bhV8v39aIhZUlbqkBlOQMTUmxegCgg8ae |
64 |
nPAlNhvlLaHsZKNVpFvPuYM= |
65 |
=gIN+ |
66 |
-----END PGP SIGNATURE----- |
67 |
-- |
68 |
gentoo-portage-dev@g.o mailing list |