1
0
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:
Klaas Freitag 2010-02-27 20:15:15 +01:00
commit 22b684fa38
10 changed files with 154 additions and 154 deletions

View File

@ -98,5 +98,4 @@ if __name__ == "__main__":
checker.cleanup() checker.cleanup()
raise e raise e
# vim: sw=4 et # vim: sw=4 et

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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):