aboutsummaryrefslogtreecommitdiff
path: root/qa
diff options
context:
space:
mode:
authorDaniel Robbins <drobbins@gentoo.org>2002-10-05 20:26:30 +0000
committerDaniel Robbins <drobbins@gentoo.org>2002-10-05 20:26:30 +0000
commit709d27b7c4e3ddabc452f2ea2b32eedfda1ad70b (patch)
treea5327398c37338bc8b59a39d83f93e683774a6ee /qa
parentfixed missing / in make.conf.* as per bug#7944 (diff)
downloadportage-cvs-709d27b7c4e3ddabc452f2ea2b32eedfda1ad70b.tar.gz
portage-cvs-709d27b7c4e3ddabc452f2ea2b32eedfda1ad70b.tar.bz2
portage-cvs-709d27b7c4e3ddabc452f2ea2b32eedfda1ad70b.zip
new iuse qa stuff
Diffstat (limited to 'qa')
-rw-r--r--qa/iuse/iuse.sh20
-rwxr-xr-xqa/iuse/iuse2.py58
2 files changed, 78 insertions, 0 deletions
diff --git a/qa/iuse/iuse.sh b/qa/iuse/iuse.sh
new file mode 100644
index 0000000..3b30d25
--- /dev/null
+++ b/qa/iuse/iuse.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+cd /usr/portage/
+for x in `find -name '*.ebuild'`
+do
+ echo $x
+ bn=${x##*/}
+ dn=${x%/*}
+ fn=.use-${bn/.ebuild/}
+ myout=${dn}/${fn}
+
+ #massive pipeline follows
+ sed -e 's/^\([^#]*\)#.*$/\1/' -e '/^pkg_/q' $x | \
+ grep -e 'use [[:alnum:]]*' | \
+ grep -v DESCRIPTION | \
+ sed -e 's/^.*use \([[:alnum:]]*\).*$/\1/' | \
+ sed -e '/^$/d' | \
+ sort | \
+ uniq > $myout
+
+done
diff --git a/qa/iuse/iuse2.py b/qa/iuse/iuse2.py
new file mode 100755
index 0000000..7944b93
--- /dev/null
+++ b/qa/iuse/iuse2.py
@@ -0,0 +1,58 @@
+#!/usr/bin/python2.2
+import portage,sys
+portdir=portage.settings["PORTDIR"]
+for cp in portage.portdb.cp_all():
+ for cpv in portage.portdb.cp_list(cp):
+ try:
+ myaux=portage.portdb.aux_get(cpv,["DEPEND","RDEPEND","SRC_URI"])
+ except KeyError:
+ pass
+ myuse={}
+ for str in myaux:
+ mysplit=str.split()
+ for part in mysplit:
+ if part[-1]=="?":
+ if part[0]=="!":
+ if not myuse.has_key(part[1:-1]):
+ myuse[part[1:-1]]=None
+ else:
+ if not myuse.has_key(part[:-1]):
+ myuse[part[:-1]]=None
+ if not myuse:
+ continue
+ cpsplit=cpv.split("/")
+ mypath=portdir+"/"+cp+"/.use-"+cpsplit[1]
+ print mypath
+ myfile=open(mypath,"r")
+ for x in myfile.readlines():
+ if x[:-1]:
+ if not myuse.has_key(x[:-1]):
+ myuse[x[:-1]]=None
+ print myuse.keys()
+ myfile.close()
+ if not myuse.keys():
+ #no IUSE to add
+ continue
+ myepath=portdir+"/"+cp+"/"+cpsplit[1]+".ebuild"
+ myefile=open(myepath,"r")
+ mylines=myefile.readlines()
+ myefile.close()
+ mynewlines=[]
+ pos=0
+ while (pos<len(mylines)) and (mylines[pos][0]=="#"):
+ mynewlines.append(mylines[pos])
+ pos += 1
+ myuses=myuse.keys()
+ iuseline="\nIUSE=\""+myuses[0]
+ for x in myuses[1:]:
+ iuseline=iuseline+" "+x
+ iuseline=iuseline+"\"\n"
+ mynewlines.append(iuseline)
+ while (pos<len(mylines)):
+ mynewlines.append(mylines[pos])
+ pos += 1
+
+ myefile=open(myepath,"w")
+ for x in mynewlines:
+ myefile.write(x)
+ myefile.close()