2
# This program is free software; you can redistribute it and/or modify
3
# it under the terms of the GNU General Public License as published by
4
# the Free Software Foundation; either version 2 of the License, or
5
# (at your option) any later version.
7
# This program is distributed in the hope that it will be useful,
8
# but WITHOUT ANY WARRANTY; without even the implied warranty of
9
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
# GNU Library General Public License for more details.
12
# You should have received a copy of the GNU General Public License
13
# along with this program; if not, write to the Free Software
14
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
15
# Copyright 2003 Duke University
17
# classes for parsing the metadata files for the new metadata format
20
# used with python -i :)
32
def process(current, total):
33
sys.stdout.write('\r' + ' ' * 80)
34
sys.stdout.write('\rNode %d of %d' % (current, total))
38
print 'test.py: /path/to/repo /other/repo somepackagename'
43
pkgSack = packageSack.XMLPackageSack(packageObject.RpmXMLPackageObject)
48
repomdxmlfile = os.path.join(basepath, 'repodata/repomd.xml')
52
repodata = repoMDObject.RepoMD(repoid, repomdxmlfile)
53
except mdErrors.RepoMDError, e:
54
print >> sys.stderr, e
57
(pbase, phref) = repodata.primaryLocation()
58
(fbase, fhref) = repodata.filelistsLocation()
59
(obase, ohref) = repodata.otherLocation()
63
for file in processlist:
65
print 'importing %s from %s' % (file, repoid)
66
complete = basepath + '/' + file
68
pkgSack.addFile(repoid, complete, process)
69
except mdErrors.PackageSackError, e:
70
print >> sys.stderr, e
76
for pkg in pkgSack.searchNevra(sys.argv[3]):
78
for reqtup in pkg.returnPrco('requires'):
79
(reqn, reqf, (reqe,reqv,reqr)) = reqtup
80
# rpmlib deps should be handled on their own
81
if reqn[:6] == 'rpmlib':
83
# kill self providers, too
84
if pkg.checkPrco('provides', reqtup):
87
# get a list of all pkgs that match the reqn
88
providers = pkgSack.searchProvides(reqn)
89
if len(providers) == 0:
90
print 'unresolved: %s %s %s:%s-%s' % (reqn, reqf, reqe, reqv, reqr)
93
if len(providers) == 1:
95
print '%s: %s from %s' % (reqn, providers[0], providers[0].returnSimple('relativepath'))
98
# only one entry but we need to match out it out
99
if providers[0].checkPrco('provides', reqtup):
100
print '%s: %s from %s' % (reqn, providers[0], providers[0].returnSimple('relativepath'))
104
output = '%s:' % reqn
105
for prov in providers:
107
if prov.checkPrco('provides', reqtup):
108
output = output + '||' + prov.__str__()
110
print '%s does not provide %s %s %s %s %s' % (prov, reqn, reqf, reqe, reqv, reqr)
112
output = output + '||' + prov.__str__()