diff options
| author | genone <genone@gentoo.org> | 2007-05-10 11:49:39 +0000 |
|---|---|---|
| committer | genone <genone@gentoo.org> | 2007-05-10 11:49:39 +0000 |
| commit | 549271801d86845d537321a240cdfc3b1679a92d (patch) | |
| tree | 026d7df1811c7b05c0d3673f59f7d54f69e25fa9 /trunk/src/euse | |
| parent | ab6e848f7ac91f157f2d5e65c2e0c9be8cd43a4a (diff) | |
| download | gentoolkit-549271801d86845d537321a240cdfc3b1679a92d.tar.gz | |
Fix incorrect flag status display if a flag appears multiple times in a single location
svn path=/; revision=398
Diffstat (limited to 'trunk/src/euse')
| -rwxr-xr-x | trunk/src/euse/euse | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/trunk/src/euse/euse b/trunk/src/euse/euse index 4bb3e6f..8814e28 100755 --- a/trunk/src/euse/euse +++ b/trunk/src/euse/euse @@ -111,6 +111,26 @@ showversion() { echo "This is free software; see the source for copying conditions." } +# remove duplicate flags from the given list in both positive and negative forms +# (but unlike portage always keep the last value even if it's negative) +# Otherwise the status flags could be incorrect if a flag appers multiple times in +# one location (like make.conf). +# Using python here as bash sucks for list handling. +reduce_incrementals() { + echo $@ | python -c "import sys +r=[] +for x in sys.stdin.read().split(): + if x[0] == '-' and x[1:] in r: + r.remove(x[1:]) + r.append(x) + elif x[0] != '-' and '-'+x in r: + r.remove('-'+x) + r.append(x) + elif x not in r: + r.append(x) +print ' '.join(r)" +} + # the following function creates a bash array ACTIVE_FLAGS that contains the # global use flags, indexed by origin: 0: environment, 1: make.conf, # 2: make.defaults, 3: make.globals @@ -121,18 +141,18 @@ get_useflags() { # backup portdir so get_portdir() doesn't give false results later portdir_backup="${PORTDIR}" - ACTIVE_FLAGS[0]="${USE}" + ACTIVE_FLAGS[0]="$(reduce_incrementals ${USE})" USE="" source "${MAKE_CONF_PATH}" - ACTIVE_FLAGS[1]="${USE}" + ACTIVE_FLAGS[1]="$(reduce_incrementals ${USE})" USE="" for x in $(get_all_make_defaults); do source "${x}" - ACTIVE_FLAGS[2]="${ACTIVE_FLAGS[2]} ${USE}" + ACTIVE_FLAGS[2]="$(reduce_incrementals ${ACTIVE_FLAGS[2]} ${USE})" done USE="" source "${MAKE_GLOBALS_PATH}" - ACTIVE_FLAGS[3]="${USE}" + ACTIVE_FLAGS[3]="$(reduce_incrementals ${USE})" # restore saved env variables USE="${ACTIVE_FLAGS[0]}" |
