aboutsummaryrefslogtreecommitdiff
blob: 975823ab5319a128c936280dca101aa8ec4c4c2b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/python -O
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/bin/fixvirtuals,v 1.4 2004/11/10 03:10:56 genone Exp $

import os,sys
sys.path = ["/usr/lib/portage/pym"]+sys.path

import portage

if portage.secpass!=2:
	print "fixvirtuals: root access required."
	sys.exit(1)

newvirts={}
myvirts=portage.grabdict("/var/cache/edb/virtuals")
myprovides=portage.db["/"]["vartree"].get_all_provides()

for myvirt in myprovides.keys():
	newvirts[myvirt]=[]
	for mycatpkg in myprovides[myvirt]:
		mysplit=portage.portage_versions.catpkgsplit(mycatpkg)
		pkg=mysplit[0]+"/"+mysplit[1]

		try:
			if (newvirts[myvirt].index(pkg)):
				pass
		except SystemExit, e:
			raise  # This needs to be propogated
		except:
			newvirts[myvirt].append(pkg)

portage.writedict(newvirts,"/var/cache/edb/virtuals")