White space / consistent usage of spaces / indentation of 4 fixes
This commit is contained in:
10
ReviewBot.py
10
ReviewBot.py
@@ -158,7 +158,7 @@ class ReviewBot(object):
|
||||
def _set_review(self, req, state):
|
||||
doit = self.can_accept_review(req.reqid)
|
||||
if doit is None:
|
||||
self.logger.info("can't change state, %s does not have the reviewer"%(req.reqid))
|
||||
self.logger.info("can't change state, %s does not have the reviewer"%(req.reqid))
|
||||
|
||||
newstate = state
|
||||
|
||||
@@ -267,8 +267,8 @@ class ReviewBot(object):
|
||||
dst_package = a.src_package
|
||||
# Ignoring patchinfo package for checking
|
||||
if self._is_patchinfo(a.src_package):
|
||||
self.logger.info("package is patchinfo, ignoring")
|
||||
return None
|
||||
self.logger.info("package is patchinfo, ignoring")
|
||||
return None
|
||||
# dirty obs crap
|
||||
if a.tgt_releaseproject is not None:
|
||||
ugly_suffix = '.'+a.tgt_releaseproject.replace(':', '_')
|
||||
@@ -397,9 +397,9 @@ class ReviewBot(object):
|
||||
|
||||
def set_request_ids_search_review(self):
|
||||
if self.review_user:
|
||||
review = "@by_user='%s' and @state='new'" % self.review_user
|
||||
review = "@by_user='%s' and @state='new'" % self.review_user
|
||||
else:
|
||||
review = "@by_group='%s' and @state='new'" % self.review_group
|
||||
review = "@by_group='%s' and @state='new'" % self.review_group
|
||||
url = osc.core.makeurl(self.apiurl, ('search', 'request'), { 'match': "state/@name='review' and review[%s]" % review, 'withfullhistory': 1 } )
|
||||
root = ET.parse(osc.core.http_GET(url)).getroot()
|
||||
|
||||
|
@@ -100,34 +100,43 @@ Report = namedtuple('Report', ('src_project', 'src_package', 'src_rev', 'dst_pro
|
||||
# report for a single library
|
||||
LibResult = namedtuple('LibResult', ('src_repo', 'src_lib', 'dst_repo', 'dst_lib', 'arch', 'htmlreport', 'result'))
|
||||
|
||||
|
||||
class DistUrlMismatch(Exception):
|
||||
def __init__(self, disturl, md5):
|
||||
Exception.__init__(self)
|
||||
self.msg = 'disturl mismatch has: %s wanted ...%s'%(disturl, md5)
|
||||
|
||||
def __str__(self):
|
||||
return self.msg
|
||||
|
||||
|
||||
class SourceBroken(Exception):
|
||||
def __init__(self, project, package):
|
||||
Exception.__init__(self)
|
||||
self.msg = '%s/%s has broken sources, needs rebase'%(project, package)
|
||||
|
||||
def __str__(self):
|
||||
return self.msg
|
||||
|
||||
|
||||
class NoBuildSuccess(Exception):
|
||||
def __init__(self, project, package, md5):
|
||||
Exception.__init__(self)
|
||||
self.msg = '%s/%s(%s) had no successful build'%(project, package, md5)
|
||||
|
||||
def __str__(self):
|
||||
return self.msg
|
||||
|
||||
|
||||
class NotReadyYet(Exception):
|
||||
def __init__(self, project, package, reason):
|
||||
Exception.__init__(self)
|
||||
self.msg = '%s/%s not ready yet: %s'%(project, package, reason)
|
||||
|
||||
def __str__(self):
|
||||
return self.msg
|
||||
|
||||
|
||||
class MissingDebugInfo(Exception):
|
||||
def __init__(self, missing_debuginfo):
|
||||
Exception.__init__(self)
|
||||
@@ -137,23 +146,29 @@ class MissingDebugInfo(Exception):
|
||||
self.msg += "%s/%s %s/%s %s %s\n"%i
|
||||
elif len(i) == 5:
|
||||
self.msg += "%s/%s %s/%s %s\n"%i
|
||||
|
||||
def __str__(self):
|
||||
return self.msg
|
||||
|
||||
|
||||
class FetchError(Exception):
|
||||
def __init__(self, msg):
|
||||
Exception.__init__(self)
|
||||
self.msg = msg
|
||||
|
||||
def __str__(self):
|
||||
return self.msg
|
||||
|
||||
|
||||
class MaintenanceError(Exception):
|
||||
def __init__(self, msg):
|
||||
Exception.__init__(self)
|
||||
self.msg = msg
|
||||
|
||||
def __str__(self):
|
||||
return self.msg
|
||||
|
||||
|
||||
class LogToDB(logging.Filter):
|
||||
def __init__(self, session):
|
||||
self.session = session
|
||||
@@ -166,6 +181,7 @@ class LogToDB(logging.Filter):
|
||||
self.session.commit()
|
||||
return True
|
||||
|
||||
|
||||
class ABIChecker(ReviewBot.ReviewBot):
|
||||
""" check ABI of library packages
|
||||
"""
|
||||
@@ -649,7 +665,7 @@ class ABIChecker(ReviewBot.ReviewBot):
|
||||
'-lib', libname,
|
||||
'-old', old,
|
||||
'-new', new,
|
||||
'-report-path', output
|
||||
'-report-path', output
|
||||
]
|
||||
self.logger.debug(cmd)
|
||||
r = subprocess.Popen(cmd, close_fds=True, cwd=CACHEDIR).wait()
|
||||
|
@@ -48,6 +48,7 @@ class RemindedPackage(object):
|
||||
self.reminded=reminded
|
||||
self.bug=bug
|
||||
self.remindCount=remindCount
|
||||
|
||||
def __str__(self):
|
||||
return '{} {} {} {}'.format(self.firstfail, self.reminded, self.bug, self.remindCount)
|
||||
|
||||
@@ -135,7 +136,7 @@ def main(args):
|
||||
for package in data:
|
||||
# Only consider packages that failed for > seconds_to_remember days (7 days)
|
||||
if package["firstfail"] < now - seconds_to_remember:
|
||||
if not package["name"] in RemindedLoaded.keys():
|
||||
if not package["name"] in RemindedLoaded.keys():
|
||||
# This is the first time we see this package failing for > 7 days
|
||||
reminded = now
|
||||
bug=""
|
||||
|
@@ -160,7 +160,7 @@ class FccSubmitter(object):
|
||||
root = ET.parse(http_GET(makeurl(self.apiurl,['source', project],
|
||||
query=query))).getroot()
|
||||
packages = [i.get('name') for i in root.findall('entry')]
|
||||
|
||||
|
||||
return packages
|
||||
|
||||
def get_request_list(self, package):
|
||||
@@ -263,7 +263,7 @@ class FccSubmitter(object):
|
||||
print 'Build succeeded packages:'
|
||||
print '-------------------------------------'
|
||||
for pkg in succeeded_packages:
|
||||
print pkg
|
||||
print pkg
|
||||
|
||||
print '-------------------------------------'
|
||||
print "Found {} build succeded packages".format(len(succeeded_packages))
|
||||
|
@@ -17,15 +17,17 @@ def _checker_check_dups(self, project, opts):
|
||||
target = a.find('target')
|
||||
type = a.attrib['type']
|
||||
assert target != None
|
||||
if target.attrib['project'] != project: continue
|
||||
#print(id)
|
||||
#ET.dump(target)
|
||||
if not target.attrib.has_key('package'): continue
|
||||
if target.attrib['project'] != project:
|
||||
continue
|
||||
# print(id)
|
||||
# ET.dump(target)
|
||||
if not target.attrib.has_key('package'):
|
||||
continue
|
||||
package = target.attrib['package']
|
||||
if rqs.has_key(type + package):
|
||||
[oldid, oldsource] = rqs[type + package]
|
||||
if oldid > id:
|
||||
s = oldid
|
||||
if oldid > id:
|
||||
s = oldid
|
||||
oldid = id
|
||||
id = s
|
||||
assert oldid < id
|
||||
@@ -52,7 +54,7 @@ def do_check_dups(self, subcmd, opts, *args):
|
||||
opts.apiurl = self.get_api_url()
|
||||
|
||||
for p in args[:]:
|
||||
self._checker_check_dups(p, opts)
|
||||
self._checker_check_dups(p, opts)
|
||||
|
||||
#Local Variables:
|
||||
#mode: python
|
||||
|
@@ -44,6 +44,7 @@ class AdiCommand:
|
||||
Fore.CYAN + review['package'] + Fore.RESET,
|
||||
review['request'])
|
||||
return
|
||||
|
||||
if self.api.is_user_member_of(self.api.user, self.api.cstaging_group):
|
||||
print query_project, Fore.GREEN + 'ready'
|
||||
packages = []
|
||||
@@ -138,6 +139,6 @@ class AdiCommand:
|
||||
requests.add(request)
|
||||
self.create_new_adi(requests, split=split)
|
||||
else:
|
||||
self.check_adi_projects()
|
||||
self.check_adi_projects()
|
||||
if self.api.is_user_member_of(self.api.user, self.api.cstaging_group):
|
||||
self.create_new_adi((), by_dp=by_dp, split=split)
|
||||
|
@@ -40,7 +40,7 @@ class CpioFile(object):
|
||||
def __init__(self, off, buf):
|
||||
self.off = off
|
||||
self.buf = buf
|
||||
|
||||
|
||||
if off&3:
|
||||
raise Exception("invalid offset %d"% off)
|
||||
|
||||
@@ -49,8 +49,8 @@ class CpioFile(object):
|
||||
|
||||
fields = struct.unpack(fmt, buf[self.off:off])
|
||||
|
||||
if fields[0] != "070701":
|
||||
raise Exception("invalid cpio header %s"%self.c_magic)
|
||||
if fields[0] != "070701":
|
||||
raise Exception("invalid cpio header %s"%self.c_magic)
|
||||
|
||||
names = ("c_ino", "c_mode", "c_uid", "c_gid",
|
||||
"c_nlink", "c_mtime", "c_filesize",
|
||||
|
@@ -19,7 +19,7 @@ class RepairCommand(object):
|
||||
reqid = str(request)
|
||||
req = get_request(self.api.apiurl, reqid)
|
||||
|
||||
if not req:
|
||||
if not req:
|
||||
raise oscerr.WrongArgs('Request {} not found'.format(reqid))
|
||||
|
||||
if req.state.name != 'review':
|
||||
|
@@ -470,8 +470,8 @@ class PkgListGen(ToolBase.ToolBase):
|
||||
if not r:
|
||||
raise Exception("failed to add repo {}/{}/{}. Need to run update first?".format(project, reponame, arch))
|
||||
for solvable in repo.solvables_iter():
|
||||
if solvable.name in solvables:
|
||||
self.lockjobs[arch].append(pool.Job(solv.Job.SOLVER_SOLVABLE|solv.Job.SOLVER_LOCK, solvable.id))
|
||||
if solvable.name in solvables:
|
||||
self.lockjobs[arch].append(pool.Job(solv.Job.SOLVER_SOLVABLE|solv.Job.SOLVER_LOCK, solvable.id))
|
||||
solvables.add(solvable.name)
|
||||
|
||||
pool.addfileprovides()
|
||||
|
@@ -225,7 +225,7 @@ class RepoChecker(ReviewBot.ReviewBot):
|
||||
|
||||
self.logger.info('mirroring {}'.format(path))
|
||||
if os.system(' '.join(parts)):
|
||||
raise Exception('failed to mirror {}'.format(path))
|
||||
raise Exception('failed to mirror {}'.format(path))
|
||||
|
||||
self.mirrored.add((project, arch))
|
||||
return directory
|
||||
|
@@ -21,27 +21,27 @@ osc.conf.get_config()
|
||||
def get_prj_results(prj, arch):
|
||||
url = osc.core.makeurl(osc.conf.config['apiurl'], ['build', prj, 'standard', arch, "_jobhistory?code=lastfailures"])
|
||||
f = osc.core.http_GET(url)
|
||||
xml = f.read()
|
||||
xml = f.read()
|
||||
results = []
|
||||
|
||||
root = ET.fromstring(xml)
|
||||
root = ET.fromstring(xml)
|
||||
|
||||
xmllines = root.findall("./jobhist")
|
||||
|
||||
for pkg in xmllines:
|
||||
if pkg.attrib['code'] == 'failed':
|
||||
if pkg.attrib['code'] == 'failed':
|
||||
results.append(pkg.attrib['package'])
|
||||
|
||||
|
||||
return results
|
||||
|
||||
def compare_results(factory, rebuild, testmode):
|
||||
|
||||
com_res = set(rebuild).symmetric_difference(set(factory))
|
||||
|
||||
|
||||
if testmode != False:
|
||||
print com_res
|
||||
|
||||
return com_res
|
||||
|
||||
return com_res
|
||||
|
||||
def check_pkgs(rebuild_list):
|
||||
url = osc.core.makeurl(osc.conf.config['apiurl'], ['source', 'openSUSE:Factory'])
|
||||
@@ -52,14 +52,14 @@ def check_pkgs(rebuild_list):
|
||||
root = ET.fromstring(xml)
|
||||
|
||||
xmllines = root.findall("./entry")
|
||||
|
||||
|
||||
for pkg in xmllines:
|
||||
if pkg.attrib['name'] in rebuild_list:
|
||||
pkglist.append(pkg.attrib['name'])
|
||||
pkglist.append(pkg.attrib['name'])
|
||||
|
||||
return pkglist
|
||||
|
||||
def rebuild_pkg_in_factory(package, prj, arch, testmode, code=None):
|
||||
def rebuild_pkg_in_factory(package, prj, arch, testmode, code=None):
|
||||
query = { 'cmd': 'rebuild', 'arch': arch }
|
||||
#prj = "home:jzwickl"
|
||||
if package:
|
||||
@@ -67,11 +67,10 @@ def rebuild_pkg_in_factory(package, prj, arch, testmode, code=None):
|
||||
pkg = query['package']
|
||||
|
||||
u = osc.core.makeurl(osc.conf.config['apiurl'], ['build', prj], query=query)
|
||||
# print u
|
||||
|
||||
if testmode != False:
|
||||
print "Trigger rebuild for this package: " + u
|
||||
|
||||
|
||||
else:
|
||||
try:
|
||||
print 'tried to trigger rebuild for project \'%s\' package \'%s\'' % (prj, pkg)
|
||||
@@ -79,29 +78,29 @@ def rebuild_pkg_in_factory(package, prj, arch, testmode, code=None):
|
||||
|
||||
except:
|
||||
print 'could not trigger rebuild for project \'%s\' package \'%s\'' % (prj, pkg)
|
||||
|
||||
|
||||
testmode = False
|
||||
try:
|
||||
if sys.argv[1] != None:
|
||||
if sys.argv[1] == '-test':
|
||||
testmode = True
|
||||
print "testmode: "+str(testmode)
|
||||
print "testmode: "+str(testmode)
|
||||
else:
|
||||
testmode = False
|
||||
except:
|
||||
pass
|
||||
|
||||
for arch in architectures:
|
||||
fact_result = get_prj_results('openSUSE:Factory', arch)
|
||||
rebuild_result = get_prj_results('openSUSE:Factory:Rebuild', arch)
|
||||
rebuild_result = check_pkgs(rebuild_result)
|
||||
fact_result = check_pkgs(fact_result)
|
||||
result = compare_results(fact_result, rebuild_result, testmode)
|
||||
fact_result = get_prj_results('openSUSE:Factory', arch)
|
||||
rebuild_result = get_prj_results('openSUSE:Factory:Rebuild', arch)
|
||||
rebuild_result = check_pkgs(rebuild_result)
|
||||
fact_result = check_pkgs(fact_result)
|
||||
result = compare_results(fact_result, rebuild_result, testmode)
|
||||
|
||||
print sorted(result)
|
||||
print sorted(result)
|
||||
|
||||
for package in result:
|
||||
rebuild_pkg_in_factory(package, 'openSUSE:Factory', arch, testmode, None)
|
||||
rebuild_pkg_in_factory(package, 'openSUSE:Factory:Rebuild', arch, testmode, None)
|
||||
for package in result:
|
||||
rebuild_pkg_in_factory(package, 'openSUSE:Factory', arch, testmode, None)
|
||||
rebuild_pkg_in_factory(package, 'openSUSE:Factory:Rebuild', arch, testmode, None)
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user