83
83
cur.execute('PRAGMA integrity_check')
84
84
result = cur.fetchall()
85
85
if result != [('ok',)]:
86
raise SystemError, 'Corrupt duplicate db:' + str(result)
86
raise SystemError('Corrupt duplicate db:' + str(result))
88
88
def check_duplicate(self, id, report=None):
89
89
'''Check whether a crash is already known.
225
225
# crash got fixed/rejected
226
226
fixed_ver = self.get_fixed_version(id)
227
227
if fixed_ver == 'invalid':
228
print 'DEBUG: bug %i was invalidated, removing from database' % id
228
print('DEBUG: bug %i was invalidated, removing from database' % id)
229
229
cur2.execute('DELETE FROM crashes WHERE crash_id = ?', [id])
230
230
elif not fixed_ver:
231
print 'WARNING: inconsistency detected: bug #%i does not appear in get_unfixed(), but is not fixed yet' % id
231
print('WARNING: inconsistency detected: bug #%i does not appear in get_unfixed(), but is not fixed yet' % id)
233
233
cur2.execute('UPDATE crashes SET fixed_version = ?, last_change = CURRENT_TIMESTAMP WHERE crash_id = ?',
329
329
This method can raise a NeedsCredentials exception in case of failure.
331
raise NotImplementedError, 'this method must be implemented by a concrete subclass'
331
raise NotImplementedError('this method must be implemented by a concrete subclass')
333
333
def get_comment_url(self, report, handle):
334
334
'''Return an URL that should be opened after report has been uploaded
338
338
user comments); in that case this function should do whichever
339
339
interactive steps it wants to perform.
341
raise NotImplementedError, 'this method must be implemented by a concrete subclass'
341
raise NotImplementedError('this method must be implemented by a concrete subclass')
343
343
def download(self, id):
344
344
'''Download the problem report from given ID and return a Report.'''
346
raise NotImplementedError, 'this method must be implemented by a concrete subclass'
346
raise NotImplementedError('this method must be implemented by a concrete subclass')
348
348
def update(self, id, report, comment, change_description=False,
349
349
attachment_comment=None, key_filter=None):
363
363
If key_filter is a list or set, then only those keys will be added.
365
raise NotImplementedError, 'this method must be implemented by a concrete subclass'
365
raise NotImplementedError('this method must be implemented by a concrete subclass')
367
367
def update_traces(self, id, report, comment=''):
368
368
'''Update the given report ID for retracing results.
376
376
def set_credentials(self, username, password):
377
377
'''Set username and password.'''
379
raise NotImplementedError, 'this method must be implemented by a concrete subclass'
379
raise NotImplementedError('this method must be implemented by a concrete subclass')
381
381
def get_distro_release(self, id):
382
382
'''Get 'DistroRelease: <release>' from the report ID.'''
384
raise NotImplementedError, 'this method must be implemented by a concrete subclass'
384
raise NotImplementedError('this method must be implemented by a concrete subclass')
386
386
def get_unretraced(self):
387
387
'''Return set of crash IDs which have not been retraced yet.
389
389
This should only include crashes which match the current host
392
raise NotImplementedError, 'this method must be implemented by a concrete subclass'
392
raise NotImplementedError('this method must be implemented by a concrete subclass')
394
394
def get_dup_unchecked(self):
395
395
'''Return set of crash IDs which need duplicate checking.
398
398
Python, since they do not need to be retraced. It should not return
399
399
bugs that are covered by get_unretraced().
401
raise NotImplementedError, 'this method must be implemented by a concrete subclass'
401
raise NotImplementedError('this method must be implemented by a concrete subclass')
403
403
def get_unfixed(self):
404
404
'''Return an ID set of all crashes which are not yet fixed.
409
409
there are any errors with connecting to the crash database, it should
410
410
raise an exception (preferably IOError).
412
raise NotImplementedError, 'this method must be implemented by a concrete subclass'
412
raise NotImplementedError('this method must be implemented by a concrete subclass')
414
414
def get_fixed_version(self, id):
415
415
'''Return the package version that fixes a given crash.
423
423
there are any errors with connecting to the crash database, it should
424
424
raise an exception (preferably IOError).
426
raise NotImplementedError, 'this method must be implemented by a concrete subclass'
426
raise NotImplementedError('this method must be implemented by a concrete subclass')
428
428
def get_affected_packages(self, id):
429
429
'''Return list of affected source packages for given ID.'''
431
raise NotImplementedError, 'this method must be implemented by a concrete subclass'
431
raise NotImplementedError('this method must be implemented by a concrete subclass')
433
433
def is_reporter(self, id):
434
434
'''Check whether the user is the reporter of given ID.'''
436
raise NotImplementedError, 'this method must be implemented by a concrete subclass'
436
raise NotImplementedError('this method must be implemented by a concrete subclass')
438
438
def can_update(self, id):
439
439
'''Check whether the user is eligible to update a report.
443
443
exact policy and checks should be done according to the particular
446
raise NotImplementedError, 'this method must be implemented by a concrete subclass'
446
raise NotImplementedError('this method must be implemented by a concrete subclass')
448
448
def duplicate_of(self, id):
449
449
'''Return master ID for a duplicate bug.
451
451
If the bug is not a duplicate, return None.
453
raise NotImplementedError, 'this method must be implemented by a concrete subclass'
453
raise NotImplementedError('this method must be implemented by a concrete subclass')
455
455
def close_duplicate(self, id, master):
456
456
'''Mark a crash id as duplicate of given master ID.
458
458
If master is None, id gets un-duplicated.
460
raise NotImplementedError, 'this method must be implemented by a concrete subclass'
460
raise NotImplementedError('this method must be implemented by a concrete subclass')
462
462
def mark_regression(self, id, master):
463
463
'''Mark a crash id as reintroducing an earlier crash which is
464
464
already marked as fixed (having ID 'master').'''
466
raise NotImplementedError, 'this method must be implemented by a concrete subclass'
466
raise NotImplementedError('this method must be implemented by a concrete subclass')
468
468
def mark_retraced(self, id):
469
469
'''Mark crash id as retraced.'''
471
raise NotImplementedError, 'this method must be implemented by a concrete subclass'
471
raise NotImplementedError('this method must be implemented by a concrete subclass')
473
473
def mark_retrace_failed(self, id, invalid_msg=None):
474
474
'''Mark crash id as 'failed to retrace'.
479
479
This can be a no-op if you are not interested in this.
481
raise NotImplementedError, 'this method must be implemented by a concrete subclass'
481
raise NotImplementedError('this method must be implemented by a concrete subclass')
483
483
def _mark_dup_checked(self, id, report):
484
484
'''Mark crash id as checked for being a duplicate
486
486
This is an internal method that should not be called from outside.
488
raise NotImplementedError, 'this method must be implemented by a concrete subclass'
488
raise NotImplementedError('this method must be implemented by a concrete subclass')
525
525
if os.path.isfile(cfpath) and cf.endswith('.conf'):
527
527
execfile(cfpath, settings['databases'])
528
except Exception as e:
529
529
# ignore broken files
530
print >> sys.stderr, 'Invalid file %s: %s' % (cfpath, str(e))
530
sys.stderr.write('Invalid file %s: %s\n' % (cfpath, str(e)))