mirror of
https://github.com/openSUSE/osc.git
synced 2024-11-14 16:26:13 +01:00
Merge branch 'master' of git@gitorious.org:opensuse/osc
This commit is contained in:
commit
22b684fa38
@ -96,8 +96,8 @@ def run(prg):
|
|||||||
body = e.read()
|
body = e.read()
|
||||||
if getattr(prg.options, 'debug', None) or \
|
if getattr(prg.options, 'debug', None) or \
|
||||||
getattr(prg.conf, 'config', {}).get('debug', None):
|
getattr(prg.conf, 'config', {}).get('debug', None):
|
||||||
print >>sys.stderr, e.hdrs
|
print >>sys.stderr, e.hdrs
|
||||||
print >>sys.stderr, body
|
print >>sys.stderr, body
|
||||||
|
|
||||||
if e.code in [ 400, 403, 404, 500 ]:
|
if e.code in [ 400, 403, 404, 500 ]:
|
||||||
if '<summary>' in body:
|
if '<summary>' in body:
|
||||||
@ -119,7 +119,7 @@ def run(prg):
|
|||||||
print >>sys.stderr, e.msg
|
print >>sys.stderr, e.msg
|
||||||
if getattr(prg.options, 'debug', None) or \
|
if getattr(prg.options, 'debug', None) or \
|
||||||
getattr(prg.conf, 'config', {}).get('debug', None):
|
getattr(prg.conf, 'config', {}).get('debug', None):
|
||||||
print >>sys.stderr, e.e
|
print >>sys.stderr, e.e
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
except (oscerr.WrongOptions, oscerr.WrongArgs), e:
|
except (oscerr.WrongOptions, oscerr.WrongArgs), e:
|
||||||
|
@ -623,9 +623,9 @@ def main(opts, argv):
|
|||||||
os.makedirs(os.path.join(pradir))
|
os.makedirs(os.path.join(pradir))
|
||||||
if not os.path.exists(tffn):
|
if not os.path.exists(tffn):
|
||||||
if opts.linksources:
|
if opts.linksources:
|
||||||
os.link(sffn, tffn)
|
os.link(sffn, tffn)
|
||||||
else:
|
else:
|
||||||
os.symlink(sffn, tffn)
|
os.symlink(sffn, tffn)
|
||||||
|
|
||||||
if bi.pacsuffix == 'rpm':
|
if bi.pacsuffix == 'rpm':
|
||||||
if opts.no_verify or opts.noinit:
|
if opts.no_verify or opts.noinit:
|
||||||
@ -654,7 +654,7 @@ def main(opts, argv):
|
|||||||
else:
|
else:
|
||||||
print 'WARNING: deb packages get not verified, they can compromise your system !'
|
print 'WARNING: deb packages get not verified, they can compromise your system !'
|
||||||
else:
|
else:
|
||||||
print 'WARNING: unknown packages get not verified, they can compromise your system !'
|
print 'WARNING: unknown packages get not verified, they can compromise your system !'
|
||||||
|
|
||||||
print 'Writing build configuration'
|
print 'Writing build configuration'
|
||||||
|
|
||||||
|
149
osc/checker.py
149
osc/checker.py
@ -7,96 +7,95 @@ import rpm
|
|||||||
import base64
|
import base64
|
||||||
|
|
||||||
class KeyError(Exception):
|
class KeyError(Exception):
|
||||||
def __init__(self, key, *args):
|
def __init__(self, key, *args):
|
||||||
Exception.__init__(self)
|
Exception.__init__(self)
|
||||||
self.args = args
|
self.args = args
|
||||||
self.key = key
|
self.key = key
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return ''+self.key+' :'+' '.join(self.args)
|
return ''+self.key+' :'+' '.join(self.args)
|
||||||
|
|
||||||
class Checker:
|
class Checker:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.dbdir = mkdtemp(prefix='oscrpmdb')
|
self.dbdir = mkdtemp(prefix='oscrpmdb')
|
||||||
self.imported = {}
|
self.imported = {}
|
||||||
rpm.addMacro('_dbpath', self.dbdir)
|
rpm.addMacro('_dbpath', self.dbdir)
|
||||||
self.ts = rpm.TransactionSet()
|
self.ts = rpm.TransactionSet()
|
||||||
self.ts.initDB()
|
self.ts.initDB()
|
||||||
self.ts.openDB()
|
self.ts.openDB()
|
||||||
self.ts.setVSFlags(0)
|
self.ts.setVSFlags(0)
|
||||||
#self.ts.Debug(1)
|
#self.ts.Debug(1)
|
||||||
|
|
||||||
def readkeys(self, keys=[]):
|
def readkeys(self, keys=[]):
|
||||||
rpm.addMacro('_dbpath', self.dbdir)
|
rpm.addMacro('_dbpath', self.dbdir)
|
||||||
for key in keys:
|
for key in keys:
|
||||||
self.readkey(key)
|
self.readkey(key)
|
||||||
|
|
||||||
rpm.delMacro("_dbpath")
|
rpm.delMacro("_dbpath")
|
||||||
|
|
||||||
# python is an idiot
|
# python is an idiot
|
||||||
# def __del__(self):
|
# def __del__(self):
|
||||||
# self.cleanup()
|
# self.cleanup()
|
||||||
|
|
||||||
def cleanup(self):
|
def cleanup(self):
|
||||||
self.ts.closeDB()
|
self.ts.closeDB()
|
||||||
rmtree(self.dbdir)
|
rmtree(self.dbdir)
|
||||||
|
|
||||||
def readkey(self, file):
|
def readkey(self, file):
|
||||||
if file in self.imported:
|
if file in self.imported:
|
||||||
return
|
return
|
||||||
|
|
||||||
fd = open(file, "r")
|
fd = open(file, "r")
|
||||||
line = fd.readline()
|
line = fd.readline()
|
||||||
if line and line[0:14] == "-----BEGIN PGP":
|
if line and line[0:14] == "-----BEGIN PGP":
|
||||||
line = fd.readline()
|
line = fd.readline()
|
||||||
while line and line != "\n":
|
while line and line != "\n":
|
||||||
line = fd.readline()
|
line = fd.readline()
|
||||||
if not line:
|
if not line:
|
||||||
raise KeyError(file, "not a pgp public key")
|
raise KeyError(file, "not a pgp public key")
|
||||||
else:
|
else:
|
||||||
raise KeyError(file, "not a pgp public key")
|
raise KeyError(file, "not a pgp public key")
|
||||||
|
|
||||||
key = ''
|
key = ''
|
||||||
line = fd.readline()
|
line = fd.readline()
|
||||||
while line:
|
while line:
|
||||||
if line[0:12] == "-----END PGP":
|
if line[0:12] == "-----END PGP":
|
||||||
break
|
break
|
||||||
line = line.rstrip()
|
line = line.rstrip()
|
||||||
key += line
|
key += line
|
||||||
line = fd.readline()
|
line = fd.readline()
|
||||||
fd.close()
|
fd.close()
|
||||||
if not line or line[0:12] != "-----END PGP":
|
if not line or line[0:12] != "-----END PGP":
|
||||||
raise KeyError(file, "not a pgp public key")
|
raise KeyError(file, "not a pgp public key")
|
||||||
|
|
||||||
bkey = base64.b64decode(key)
|
bkey = base64.b64decode(key)
|
||||||
|
|
||||||
r = self.ts.pgpImportPubkey(bkey)
|
r = self.ts.pgpImportPubkey(bkey)
|
||||||
if r != 0:
|
if r != 0:
|
||||||
raise KeyError(file, "failed to import pubkey")
|
raise KeyError(file, "failed to import pubkey")
|
||||||
self.imported[file] = 1
|
self.imported[file] = 1
|
||||||
|
|
||||||
def check(self, pkg):
|
def check(self, pkg):
|
||||||
fd = os.open(pkg, os.O_RDONLY)
|
fd = os.open(pkg, os.O_RDONLY)
|
||||||
hdr = self.ts.hdrFromFdno(fd)
|
hdr = self.ts.hdrFromFdno(fd)
|
||||||
os.close(fd)
|
os.close(fd)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
import sys
|
import sys
|
||||||
keyfiles = []
|
keyfiles = []
|
||||||
pkgs = []
|
pkgs = []
|
||||||
for arg in sys.argv[1:]:
|
for arg in sys.argv[1:]:
|
||||||
if arg[-4:] == '.rpm':
|
if arg[-4:] == '.rpm':
|
||||||
pkgs.append(arg)
|
pkgs.append(arg)
|
||||||
else:
|
else:
|
||||||
keyfiles.append(arg)
|
keyfiles.append(arg)
|
||||||
|
|
||||||
checker = Checker()
|
|
||||||
try:
|
|
||||||
checker.readkeys(keyfiles)
|
|
||||||
for pkg in pkgs:
|
|
||||||
checker.check(pkg)
|
|
||||||
except Exception, e:
|
|
||||||
checker.cleanup()
|
|
||||||
raise e
|
|
||||||
|
|
||||||
|
checker = Checker()
|
||||||
|
try:
|
||||||
|
checker.readkeys(keyfiles)
|
||||||
|
for pkg in pkgs:
|
||||||
|
checker.check(pkg)
|
||||||
|
except Exception, e:
|
||||||
|
checker.cleanup()
|
||||||
|
raise e
|
||||||
|
|
||||||
# vim: sw=4 et
|
# vim: sw=4 et
|
||||||
|
@ -393,7 +393,7 @@ class Osc(cmdln.Cmdln):
|
|||||||
print "Creating initial patchinfo..."
|
print "Creating initial patchinfo..."
|
||||||
query='cmd=createpatchinfo'
|
query='cmd=createpatchinfo'
|
||||||
if args and args[0]:
|
if args and args[0]:
|
||||||
query += "&name=" + args[0]
|
query += "&name=" + args[0]
|
||||||
url = makeurl(apiurl, ['source', project], query=query)
|
url = makeurl(apiurl, ['source', project], query=query)
|
||||||
f = http_POST(url)
|
f = http_POST(url)
|
||||||
for p in meta_get_packagelist(apiurl, project):
|
for p in meta_get_packagelist(apiurl, project):
|
||||||
@ -777,8 +777,8 @@ class Osc(cmdln.Cmdln):
|
|||||||
for p in pac:
|
for p in pac:
|
||||||
result = create_submit_request(apiurl, project, p)
|
result = create_submit_request(apiurl, project, p)
|
||||||
if not result:
|
if not result:
|
||||||
# sys.exit(result)
|
# sys.exit(result)
|
||||||
sys.exit("submit request creation failed")
|
sys.exit("submit request creation failed")
|
||||||
sr_ids.append(result)
|
sr_ids.append(result)
|
||||||
|
|
||||||
# create submit requests for all found patchinfos
|
# create submit requests for all found patchinfos
|
||||||
@ -804,7 +804,7 @@ class Osc(cmdln.Cmdln):
|
|||||||
|
|
||||||
print "Requests created: ",
|
print "Requests created: ",
|
||||||
for i in sr_ids:
|
for i in sr_ids:
|
||||||
print i,
|
print i,
|
||||||
sys.exit('Successfull finished')
|
sys.exit('Successfull finished')
|
||||||
|
|
||||||
elif len(args) <= 2:
|
elif len(args) <= 2:
|
||||||
@ -2696,7 +2696,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
opts.name_filter = None
|
opts.name_filter = None
|
||||||
opts.status_filter = None
|
opts.status_filter = None
|
||||||
opts.vertical = None
|
opts.vertical = None
|
||||||
self.do_prjresults('prjresults', opts, *args);
|
self.do_prjresults('prjresults', opts, *args)
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
else:
|
else:
|
||||||
project = store_read_project(wd)
|
project = store_read_project(wd)
|
||||||
@ -2817,21 +2817,21 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
|
|
||||||
|
|
||||||
def print_repos(self):
|
def print_repos(self):
|
||||||
wd = os.curdir
|
wd = os.curdir
|
||||||
doprint = False
|
doprint = False
|
||||||
if is_package_dir(wd):
|
if is_package_dir(wd):
|
||||||
str = "package"
|
str = "package"
|
||||||
doprint = True
|
doprint = True
|
||||||
elif is_project_dir(wd):
|
elif is_project_dir(wd):
|
||||||
str = "project"
|
str = "project"
|
||||||
doprint = True
|
doprint = True
|
||||||
|
|
||||||
if doprint:
|
if doprint:
|
||||||
print 'Valid arguments for this %s are:' % str
|
print 'Valid arguments for this %s are:' % str
|
||||||
print
|
print
|
||||||
self.do_repos(None, None)
|
self.do_repos(None, None)
|
||||||
print
|
print
|
||||||
raise oscerr.WrongArgs('Missing arguments')
|
raise oscerr.WrongArgs('Missing arguments')
|
||||||
|
|
||||||
@cmdln.alias('rbl')
|
@cmdln.alias('rbl')
|
||||||
@cmdln.alias('rbuildlog')
|
@cmdln.alias('rbuildlog')
|
||||||
@ -2958,9 +2958,9 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
|
|
||||||
if len(args) == 2: # 2
|
if len(args) == 2: # 2
|
||||||
if is_package_dir('.'):
|
if is_package_dir('.'):
|
||||||
package = store_read_package(wd)
|
package = store_read_package(wd)
|
||||||
else:
|
else:
|
||||||
raise oscerr.WrongArgs('package is not specified.')
|
raise oscerr.WrongArgs('package is not specified.')
|
||||||
project = store_read_project(wd)
|
project = store_read_project(wd)
|
||||||
apiurl = store_read_apiurl(wd)
|
apiurl = store_read_apiurl(wd)
|
||||||
repository = args[0]
|
repository = args[0]
|
||||||
@ -2980,9 +2980,9 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
reason = root.find('explain').text
|
reason = root.find('explain').text
|
||||||
print reason
|
print reason
|
||||||
if reason == "meta change":
|
if reason == "meta change":
|
||||||
print "changed keys:"
|
print "changed keys:"
|
||||||
for package in root.findall('packagechange'):
|
for package in root.findall('packagechange'):
|
||||||
print " ", package.get('change'), package.get('key')
|
print " ", package.get('change'), package.get('key')
|
||||||
|
|
||||||
|
|
||||||
# FIXME: the new osc syntax should allow to specify multiple packages
|
# FIXME: the new osc syntax should allow to specify multiple packages
|
||||||
@ -3026,9 +3026,9 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
|
|
||||||
if len(args) < 3: # 2
|
if len(args) < 3: # 2
|
||||||
if is_package_dir('.'):
|
if is_package_dir('.'):
|
||||||
packages = [store_read_package(wd)]
|
packages = [store_read_package(wd)]
|
||||||
elif not is_project_dir('.'):
|
elif not is_project_dir('.'):
|
||||||
raise oscerr.WrongArgs('Project and package is not specified.')
|
raise oscerr.WrongArgs('Project and package is not specified.')
|
||||||
project = store_read_project(wd)
|
project = store_read_project(wd)
|
||||||
apiurl = store_read_apiurl(wd)
|
apiurl = store_read_apiurl(wd)
|
||||||
repository = args[0]
|
repository = args[0]
|
||||||
@ -3056,7 +3056,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
for package in root.findall('package'):
|
for package in root.findall('package'):
|
||||||
print package.get('name'), ":"
|
print package.get('name'), ":"
|
||||||
for dep in package.findall('pkgdep'):
|
for dep in package.findall('pkgdep'):
|
||||||
print " ", dep.text
|
print " ", dep.text
|
||||||
|
|
||||||
|
|
||||||
@cmdln.option('-x', '--extra-pkgs', metavar='PAC', action='append',
|
@cmdln.option('-x', '--extra-pkgs', metavar='PAC', action='append',
|
||||||
|
12
osc/conf.py
12
osc/conf.py
@ -325,12 +325,12 @@ def init_basicauth(config):
|
|||||||
|
|
||||||
import sys
|
import sys
|
||||||
if sys.version_info < (2, 6):
|
if sys.version_info < (2, 6):
|
||||||
# HTTPS proxy is not supported in old urllib2. It only leads to an error
|
# HTTPS proxy is not supported in old urllib2. It only leads to an error
|
||||||
# or, at best, a warning.
|
# or, at best, a warning.
|
||||||
if 'https_proxy' in os.environ:
|
if 'https_proxy' in os.environ:
|
||||||
del os.environ['https_proxy']
|
del os.environ['https_proxy']
|
||||||
if 'HTTPS_PROXY' in os.environ:
|
if 'HTTPS_PROXY' in os.environ:
|
||||||
del os.environ['HTTPS_PROXY']
|
del os.environ['HTTPS_PROXY']
|
||||||
|
|
||||||
if config['http_debug']:
|
if config['http_debug']:
|
||||||
# brute force
|
# brute force
|
||||||
|
18
osc/core.py
18
osc/core.py
@ -2139,17 +2139,17 @@ def show_attribute_meta(apiurl, prj, pac, subpac, attribute, with_defaults, with
|
|||||||
path.append('source')
|
path.append('source')
|
||||||
path.append(prj)
|
path.append(prj)
|
||||||
if pac:
|
if pac:
|
||||||
path.append(pac)
|
path.append(pac)
|
||||||
if pac and subpac:
|
if pac and subpac:
|
||||||
path.append(subpac)
|
path.append(subpac)
|
||||||
path.append('_attribute')
|
path.append('_attribute')
|
||||||
if attribute:
|
if attribute:
|
||||||
path.append(attribute)
|
path.append(attribute)
|
||||||
query=[]
|
query=[]
|
||||||
if with_defaults:
|
if with_defaults:
|
||||||
query.append("with_default=1")
|
query.append("with_default=1")
|
||||||
if with_project:
|
if with_project:
|
||||||
query.append("with_project=1")
|
query.append("with_project=1")
|
||||||
url = makeurl(apiurl, path, query)
|
url = makeurl(apiurl, path, query)
|
||||||
try:
|
try:
|
||||||
f = http_GET(url)
|
f = http_GET(url)
|
||||||
@ -2547,10 +2547,10 @@ def create_submit_request(apiurl,
|
|||||||
# Yes, this kind of xml construction is horrible
|
# Yes, this kind of xml construction is horrible
|
||||||
targetxml = ""
|
targetxml = ""
|
||||||
if dst_project:
|
if dst_project:
|
||||||
packagexml = ""
|
packagexml = ""
|
||||||
if dst_package:
|
if dst_package:
|
||||||
packagexml = """package="%s" """ %( dst_package )
|
packagexml = """package="%s" """ %( dst_package )
|
||||||
targetxml = """<target project="%s" %s /> """ %( dst_project, packagexml )
|
targetxml = """<target project="%s" %s /> """ %( dst_project, packagexml )
|
||||||
# XXX: keep the old template for now in order to work with old obs instances
|
# XXX: keep the old template for now in order to work with old obs instances
|
||||||
xml = """\
|
xml = """\
|
||||||
<request type="submit">
|
<request type="submit">
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
class NoSecureSSLError(Exception):
|
class NoSecureSSLError(Exception):
|
||||||
def __init__(self, msg):
|
def __init__(self, msg):
|
||||||
|
Exception.__init__(self)
|
||||||
self.msg = msg
|
self.msg = msg
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.msg
|
return self.msg
|
||||||
|
@ -104,7 +104,7 @@ class DebQuery(packagequery.PackageQuery):
|
|||||||
def requires(self):
|
def requires(self):
|
||||||
return self.fields['depends']
|
return self.fields['depends']
|
||||||
|
|
||||||
def getTag(self, num):
|
def gettag(self, num):
|
||||||
return self.fields.get(num, None)
|
return self.fields.get(num, None)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
@ -13,8 +13,8 @@ class PackageQueries(dict):
|
|||||||
# map debian arches to common obs arches
|
# map debian arches to common obs arches
|
||||||
architectureMap = {'i386': ['i586', 'i686'], 'amd64': ['x86_64']}
|
architectureMap = {'i386': ['i586', 'i686'], 'amd64': ['x86_64']}
|
||||||
|
|
||||||
def __init__(self, wantedArchitecture):
|
def __init__(self, wanted_architecture):
|
||||||
self.wantedArchitecture = wantedArchitecture
|
self.wanted_architecture = wanted_architecture
|
||||||
super(PackageQueries, self).__init__()
|
super(PackageQueries, self).__init__()
|
||||||
|
|
||||||
def add(self, query):
|
def add(self, query):
|
||||||
@ -32,13 +32,13 @@ class PackageQueries(dict):
|
|||||||
|
|
||||||
architecture = query.arch()
|
architecture = query.arch()
|
||||||
|
|
||||||
if (architecture in [self.wantedArchitecture, 'noarch', 'all'] or
|
if (architecture in [self.wanted_architecture, 'noarch', 'all'] or
|
||||||
self.wantedArchitecture in self.architectureMap.get(architecture,
|
self.wanted_architecture in self.architectureMap.get(architecture,
|
||||||
[])):
|
[])):
|
||||||
currentQuery = self.get(name)
|
current_query = self.get(name)
|
||||||
|
|
||||||
# if current query does not exist or is older than this new query
|
# if current query does not exist or is older than this new query
|
||||||
if currentQuery is None or currentQuery.vercmp(query) <= 0:
|
if current_query is None or current_query.vercmp(query) <= 0:
|
||||||
super(PackageQueries, self).__setitem__(name, query)
|
super(PackageQueries, self).__setitem__(name, query)
|
||||||
|
|
||||||
class PackageQuery:
|
class PackageQuery:
|
||||||
@ -73,10 +73,10 @@ class PackageQuery:
|
|||||||
def requires(self):
|
def requires(self):
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
def getTag(self):
|
def gettag(self):
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
def vercmp(self, pkgq):
|
def vercmp(self, pkgquery):
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@ -85,20 +85,20 @@ class PackageQuery:
|
|||||||
magic = f.read(7)
|
magic = f.read(7)
|
||||||
f.seek(0)
|
f.seek(0)
|
||||||
extra_tags = ()
|
extra_tags = ()
|
||||||
pkgq = None
|
pkgquery = None
|
||||||
if magic[:4] == '\xed\xab\xee\xdb':
|
if magic[:4] == '\xed\xab\xee\xdb':
|
||||||
import rpmquery
|
import rpmquery
|
||||||
pkgq = rpmquery.RpmQuery(f)
|
pkgquery = rpmquery.RpmQuery(f)
|
||||||
extra_tags = extra_rpmtags
|
extra_tags = extra_rpmtags
|
||||||
elif magic == '!<arch>':
|
elif magic == '!<arch>':
|
||||||
import debquery
|
import debquery
|
||||||
pkgq = debquery.DebQuery(f)
|
pkgquery = debquery.DebQuery(f)
|
||||||
extra_tags = extra_debtags
|
extra_tags = extra_debtags
|
||||||
else:
|
else:
|
||||||
raise PackageError('unsupported package type. magic: \'%s\' (%s)' % (magic, filename))
|
raise PackageError('unsupported package type. magic: \'%s\' (%s)' % (magic, filename))
|
||||||
pkgq.read(all_tags, *extra_tags)
|
pkgquery.read(all_tags, *extra_tags)
|
||||||
f.close()
|
f.close()
|
||||||
return pkgq
|
return pkgquery
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
import sys
|
import sys
|
||||||
|
@ -20,7 +20,7 @@ class RpmHeader:
|
|||||||
def append(self, entry):
|
def append(self, entry):
|
||||||
self.entries.append(entry)
|
self.entries.append(entry)
|
||||||
|
|
||||||
def getTag(self, tag):
|
def gettag(self, tag):
|
||||||
for i in self.entries:
|
for i in self.entries:
|
||||||
if i.tag == tag:
|
if i.tag == tag:
|
||||||
return i
|
return i
|
||||||
@ -131,7 +131,7 @@ class RpmQuery(packagequery.PackageQuery):
|
|||||||
entry.data = entry.data[0]
|
entry.data = entry.data[0]
|
||||||
return
|
return
|
||||||
# get private i18n table
|
# get private i18n table
|
||||||
table = self.header.getTag(100)
|
table = self.header.gettag(100)
|
||||||
# just care about the country code
|
# just care about the country code
|
||||||
lang = lang.split('_', 1)[0]
|
lang = lang.split('_', 1)[0]
|
||||||
cnt = 0
|
cnt = 0
|
||||||
@ -147,9 +147,9 @@ class RpmQuery(packagequery.PackageQuery):
|
|||||||
raise RpmHeaderError('unsupported tag type \'%d\' (tag: \'%s\'' % (entry.type, entry.tag))
|
raise RpmHeaderError('unsupported tag type \'%d\' (tag: \'%s\'' % (entry.type, entry.tag))
|
||||||
|
|
||||||
def __reqprov(self, tag, flags, version):
|
def __reqprov(self, tag, flags, version):
|
||||||
pnames = self.header.getTag(tag).data
|
pnames = self.header.gettag(tag).data
|
||||||
pflags = self.header.getTag(flags).data
|
pflags = self.header.gettag(flags).data
|
||||||
pvers = self.header.getTag(version).data
|
pvers = self.header.gettag(version).data
|
||||||
if not (pnames and pflags and pvers):
|
if not (pnames and pflags and pvers):
|
||||||
raise RpmError('cannot get provides/requires, tags are missing')
|
raise RpmError('cannot get provides/requires, tags are missing')
|
||||||
res = []
|
res = []
|
||||||
@ -179,31 +179,31 @@ class RpmQuery(packagequery.PackageQuery):
|
|||||||
|
|
||||||
# XXX: create dict for the tag => number mapping?!
|
# XXX: create dict for the tag => number mapping?!
|
||||||
def name(self):
|
def name(self):
|
||||||
return self.header.getTag(1000).data
|
return self.header.gettag(1000).data
|
||||||
|
|
||||||
def version(self):
|
def version(self):
|
||||||
return self.header.getTag(1001).data
|
return self.header.gettag(1001).data
|
||||||
|
|
||||||
def release(self):
|
def release(self):
|
||||||
return self.header.getTag(1002).data
|
return self.header.gettag(1002).data
|
||||||
|
|
||||||
def epoch(self):
|
def epoch(self):
|
||||||
epoch = self.header.getTag(1003)
|
epoch = self.header.gettag(1003)
|
||||||
if epoch is None:
|
if epoch is None:
|
||||||
return 0
|
return 0
|
||||||
return epoch.data[0]
|
return epoch.data[0]
|
||||||
|
|
||||||
def arch(self):
|
def arch(self):
|
||||||
return self.header.getTag(1022).data
|
return self.header.gettag(1022).data
|
||||||
|
|
||||||
def summary(self):
|
def summary(self):
|
||||||
return self.header.getTag(1004).data
|
return self.header.gettag(1004).data
|
||||||
|
|
||||||
def description(self):
|
def description(self):
|
||||||
return self.header.getTag(1005).data
|
return self.header.gettag(1005).data
|
||||||
|
|
||||||
def url(self):
|
def url(self):
|
||||||
entry = self.header.getTag(1020)
|
entry = self.header.gettag(1020)
|
||||||
if entry is None:
|
if entry is None:
|
||||||
return None
|
return None
|
||||||
return entry.data
|
return entry.data
|
||||||
@ -217,8 +217,8 @@ class RpmQuery(packagequery.PackageQuery):
|
|||||||
def requires(self):
|
def requires(self):
|
||||||
return self.__reqprov(1049, 1048, 1050)
|
return self.__reqprov(1049, 1048, 1050)
|
||||||
|
|
||||||
def getTag(self, num):
|
def gettag(self, num):
|
||||||
return self.header.getTag(num)
|
return self.header.gettag(num)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def query(filename):
|
def query(filename):
|
||||||
|
Loading…
Reference in New Issue
Block a user