aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Stubbs <jstubbs@gentoo.org>2005-08-28 08:37:44 +0000
committerJason Stubbs <jstubbs@gentoo.org>2005-08-28 08:37:44 +0000
commitd9fc4acc572c6647a4f27b838d35d27d805d190e (patch)
tree262a8de35d8c7567312757da5f1f66efdc8cece5 /qa/iuse/iuse2.py
downloadportage-d9fc4acc572c6647a4f27b838d35d27d805d190e.tar.gz
portage-d9fc4acc572c6647a4f27b838d35d27d805d190e.tar.bz2
portage-d9fc4acc572c6647a4f27b838d35d27d805d190e.zip
Migration (without history) of the current stable line to subversion.
svn path=/main/branches/2.0/; revision=1941
Diffstat (limited to 'qa/iuse/iuse2.py')
-rwxr-xr-xqa/iuse/iuse2.py58
1 files changed, 58 insertions, 0 deletions
diff --git a/qa/iuse/iuse2.py b/qa/iuse/iuse2.py
new file mode 100755
index 000000000..7944b9327
--- /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()