2
# Copyright (C) 2009 Canonical
7
# This program is free software; you can redistribute it and/or modify it under
8
# the terms of the GNU General Public License as published by the Free Software
9
# Foundation; version 3.
11
# This program is distributed in the hope that it will be useful, but WITHOUT
12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
16
# You should have received a copy of the GNU General Public License along with
17
# this program; if not, write to the Free Software Foundation, Inc.,
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
25
sys.path.insert(0, "../")
26
from softwarecenter.enums import *
28
if __name__ == "__main__":
30
# mapping from a package to the apps it has
33
# mapping from applications names to packages (a generic name
34
# like Terminal may be provided by multiple packages)
38
pathname = os.path.join(XAPIAN_BASE_PATH, "xapian")
39
db = xapian.Database(pathname)
40
for m in db.postlist(""):
41
doc = db.get_document(m.docid)
42
appname = doc.get_data()
43
pkgname = doc.get_value(XAPIAN_VALUE_PKGNAME)
45
if not pkgname in pkg_to_app:
46
pkg_to_app[pkgname] = set()
47
pkg_to_app[pkgname].add(appname)
48
if not appname in app_to_pkg:
49
app_to_pkg[appname] = set()
50
app_to_pkg[appname].add(pkgname)
53
print "Applications with the same name from multiple packages:"
54
for app in app_to_pkg:
55
if len(app_to_pkg[app]) > 1:
56
print "app: %s (%s): %s" % (app,
58
sorted(app_to_pkg[app]))
61
print "Packages with multiple Applications:"
62
for pkg in pkg_to_app:
63
if len(pkg_to_app[pkg]) > 1:
64
print "pkg: %s (%s): %s" % (pkg,
66
sorted(pkg_to_app[pkg]))