Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 68352 - Script for possible inclusion to gentoolkit ebuild
Summary: Script for possible inclusion to gentoolkit ebuild
Status: RESOLVED WORKSFORME
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High enhancement (vote)
Assignee: Default Assignee for New Packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-10-20 23:21 UTC by Steev Klimaszewski (RETIRED)
Modified: 2006-02-02 13:28 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
the use-flags.sh bash script (use-flags2.sh,590 bytes, application/octet-stream)
2004-10-21 13:07 UTC, Steev Klimaszewski (RETIRED)
Details
here's a script that I wrote myself to easily manipulate the system-wide USE flags in /etc/make.conf (adduseflags,2.95 KB, text/plain)
2005-03-19 19:19 UTC, Triffid Hunter
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Steev Klimaszewski (RETIRED) gentoo-dev 2004-10-20 23:21:29 UTC
Opello (from #gentoo-laptop) wrote a bash script called use-flags.sh that when run allows you to find out what packages have been emerged with a specific use flag.

Reproducible: Always
Steps to Reproduce:
Comment 1 Andrej Kacian (RETIRED) gentoo-dev 2004-10-21 07:58:21 UTC
Where can the script be found?
Comment 2 Steev Klimaszewski (RETIRED) gentoo-dev 2004-10-21 13:07:40 UTC
Created attachment 42341 [details]
the use-flags.sh bash script

Sorry, when I first submitted, it sent mail to my old email address.  Had to
wait for someone to post an update or comment before I could find it.
Comment 3 Triffid Hunter 2005-03-19 19:11:13 UTC
took me a while to work out that it lists installed packages that have the specified flag available...

you may want to specify that it lists packages that have the specified flag as an option, as opposed to were emerged with it enabled...

btw; i re-wrote it a fair bit, using bash's primitive string manipulation rather than sed/grep and its >300% faster - here's my end result :-

~ $ time ./use-flags2.new.sh xvid ; time ./use-flags2.sh xvid
media-tv/xawdecode-1.9.1
media-video/avifile-0.7.41.20041001-r2
media-video/ffmpeg-0.4.9_p20050226-r1
media-video/transcode-0.6.14

real    0m0.926s
user    0m0.521s
sys     0m0.310s
media-tv/xawdecode-1.9.1
media-video/avifile-0.7.41.20041001-r2
media-video/ffmpeg-0.4.9_p20050226-r1
media-video/transcode-0.6.14

real    0m4.959s
user    0m1.653s
sys     0m2.699s

the above times are consistent no matter how often i run the test.

and the script itself :-

#!/bin/bash

if [ -z "$1" ] || [ -n "$2" ]; then
    echo "Usage:  $0 flag"
    exit
fi

for pkg in `find /var/db/pkg -type f -name '*.ebuild' -print | sort`
do
        pdir=${pkg%/?*}
        if [ -f "$pdir/IUSE" ];
        then
                FC=" $(< $pdir/IUSE) "
                [ -z "${FC/* $1 *}" ] && echo ${pdir#/*/*/*/}
        fi
done
Comment 4 Triffid Hunter 2005-03-19 19:19:41 UTC
Created attachment 53905 [details]
here's a script that I wrote myself to easily manipulate the system-wide USE flags in /etc/make.conf

~ # adduseflags
USAGE: adduseflags <flags>

flags: one or more use flags, separated by spaces, optionally prepended with a
       "-", "+" or "_"
       if a use flag isn't in the list, it will be added, be it +flag or -flag.

       if a use flag is in the list, and its state isn't changed, no change
	 happens.
       if a use flag is in the list, and its state is changed (either from
	 +flag to -flag or vice versa), the original flag is replaced by the
	 new one

this should make the use intuitive, whereby adduseflag option will "set" a
flag, and adduseflags -flag will "unset" it.

to remove a flag from the list altogether, restoring its effective state to
default, prepend it with a "_", as in adduseflags _ipv6
Comment 5 Jakub Moc (RETIRED) gentoo-dev 2006-02-02 13:28:38 UTC
(In reply to comment #3)
# equery hasuse apache2
[ Searching for USE flag apache2 in all categories among: ]
 * installed packages
[I--] [  ] dev-lang/php-4.4.1-r3 (4)
[I--] [  ] app-admin/apachetop-0.12.5-r1 (0)
[I--] [  ] www-apache/mod_jk-1.2.13 (0)
[I--] [  ] net-www/mod_auth_mysql-3.0.0 (0)
[I--] [  ] net-www/mod_log_sql-1.100 (0)
[I--] [  ] net-www/apache-2.0.55-r1 (2)

(In reply to comment #4)
euse --enable, euse --disable

Closing.