8 commits - bodhi/mail.py bodhi/masher.py bodhi/model.py bodhi/tests
by Luke Macken
bodhi/mail.py | 3 -
bodhi/masher.py | 54 +++++++++++++++++++++---
bodhi/model.py | 14 +++---
bodhi/tests/test_controllers.py | 90 ++++++++++++++++++++++++++++++++++++----
4 files changed, 138 insertions(+), 23 deletions(-)
New commits:
commit 10f0d4ecea3e2cfb2ee14df526b61e3807aed4ca
Author: Luke Macken <lmacken(a)redhat.com>
Date: Thu Sep 16 17:11:20 2010 -0400
Add a 'safe_to_resume' sanity check when resuming updates pushes
diff --git a/bodhi/masher.py b/bodhi/masher.py
index 6743a18..2fbde75 100644
--- a/bodhi/masher.py
+++ b/bodhi/masher.py
@@ -361,6 +361,34 @@ class MashTask(Thread):
del pending_nvrs, testing_nvrs, stable_nvrs
return self.safe
+ def safe_to_resume(self):
+ """
+ Check for bodhi/koji inconsistencies, and make sure it is safe to
+ perform actions against this set of updates
+ """
+ testing_nvrs = {}
+ stable_nvrs = {}
+ log.debug("Making sure builds are safe to resume")
+
+ # For each release, populate the lists of pending/testing/stable builds
+ for update in self.updates:
+ if not testing_nvrs.has_key(update.release.name):
+ testing_nvrs[update.release.name] = [build['nvr'] for build in
+ self.koji.listTagged(update.release.testing_tag)]
+ stable_nvrs[update.release.name] = [build['nvr'] for build in
+ self.koji.listTagged(update.release.stable_tag)]
+
+ for update in self.updates:
+ for build in update.builds:
+ if update.request == 'testing':
+ if build.nvr not in testing_nvrs[update.release.name]:
+ self.error_log("%s not tagged as testing" % build.nvr)
+ elif update.request == 'stable':
+ if build.nvr not in stable_nvrs[update.release.name]:
+ self.error_log("%s not tagged as stable" % build.nvr)
+
+ return self.safe
+
def _find_repos(self):
"""
Based on our updates, build a list of repositories that we need to
@@ -610,15 +638,23 @@ class MashTask(Thread):
"""
self.success = True
try:
- if not self.resume and not self.safe_to_move():
- log.error("safe_to_move failed! -- aborting")
- self._unlock()
- masher.done(self)
- return
+ if self.resume:
+ if not self.safe_to_resume():
+ log.error("safe_to_resume failed! -- aborting")
+ self._unlock()
+ masher.done(self)
+ return
else:
- log.debug("Builds look OK to me")
+ if not self.safe_to_move():
+ log.error("safe_to_move failed! -- aborting")
+ self._unlock()
+ masher.done(self)
+ return
+
+ log.debug("Builds look OK to me")
# Update all bug titles for security updates
+ log.info('Updating bug titles for security updates')
for update in self.updates:
if update.type == 'security':
for bug in update.bugs:
commit 5a485ec5ee273144535eea68d5a839844ce541da
Author: Luke Macken <lmacken(a)redhat.com>
Date: Thu Sep 16 16:53:40 2010 -0400
Update all bugzilla titles for security updates before pushing.
The security team puts a lot of effort into polishing up security bugs &
updates to make sure they have the appropriate data. A lot of security bugs
are altered after submission to bodhi (for example, to add the CVE to the title).
diff --git a/bodhi/masher.py b/bodhi/masher.py
index 59f4033..6743a18 100644
--- a/bodhi/masher.py
+++ b/bodhi/masher.py
@@ -618,6 +618,12 @@ class MashTask(Thread):
else:
log.debug("Builds look OK to me")
+ # Update all bug titles for security updates
+ for update in self.updates:
+ if update.type == 'security':
+ for bug in update.bugs:
+ bug.fetch_details()
+
# Move koji build tags
if not self.resume and len(self.updates):
self.move_builds()
commit 5aa810d1939c5ed9af321811ba96b2cae0199de6
Author: Luke Macken <lmacken(a)redhat.com>
Date: Thu Sep 16 16:28:53 2010 -0400
Add a new unit test to make sure a batch of builds can't obsolete an update that only has a single build
diff --git a/bodhi/tests/test_controllers.py b/bodhi/tests/test_controllers.py
index 6f9d6ba..5d2276e 100644
--- a/bodhi/tests/test_controllers.py
+++ b/bodhi/tests/test_controllers.py
@@ -2546,3 +2546,47 @@ class TestControllers(testutil.DBTest):
method='POST', headers=session)
update = PackageUpdate.byTitle(params['builds'])
assert update.request == 'stable'
+
+ def test_obsoleting_different_batches_of_updates(self):
+ """
+ Make sure a batch of builds can't obsolete an update that only has a
+ single build
+ """
+ session = login()
+ create_release()
+ params = {
+ 'builds' : 'nethack-2.6.31-1.fc7',
+ 'release' : 'Fedora 7',
+ 'type_' : 'bugfix',
+ 'bugs' : '',
+ 'notes' : '',
+ 'autokarma': True,
+ 'stable_karma' : 3,
+ 'request': 'stable',
+ 'unstable_karma' : -3,
+ }
+
+ self.save_update(params, session)
+ update = PackageUpdate.byTitle(params['builds'])
+ assert update.request != 'stable', update.request
+ update.status = 'testing'
+ update.pushed = True
+ update.request = None
+ update.pushed = True
+
+ new_params = {
+ 'builds' : 'kernel-2.6.40-1.fc7,nethack-2.6.32-1.fc7,TurboGears-1.2.0-1.fc7',
+ 'release' : 'Fedora 7',
+ 'type_' : 'bugfix',
+ 'bugs' : '',
+ 'notes' : '',
+ 'autokarma': True,
+ 'stable_karma' : 3,
+ 'request': 'stable',
+ 'unstable_karma' : -3,
+ }
+ self.save_update(new_params, session)
+
+ # Make sure it doesn't obsolete the older one
+ assert PackageUpdate.byTitle(new_params['builds']).status == 'pending'
+ assert PackageUpdate.byTitle(params['builds']).status == 'testing'
commit aaf104e1c2c6fe1b7bd5cf54fc713471f47d176a
Author: Luke Macken <lmacken(a)redhat.com>
Date: Thu Sep 16 16:07:09 2010 -0400
Get the rest of our test suite working again
diff --git a/bodhi/tests/test_controllers.py b/bodhi/tests/test_controllers.py
index 4dc42cb..6f9d6ba 100644
--- a/bodhi/tests/test_controllers.py
+++ b/bodhi/tests/test_controllers.py
@@ -691,7 +691,7 @@ class TestControllers(testutil.DBTest):
testutil.create_request('/updates/request/stable/%s' % params['builds'],
method='POST', headers=session)
update = PackageUpdate.byTitle(params['builds'])
- assert update.request == 'stable'
+ assert update.request == 'testing'
def test_unauthorized_request(self):
session = login()
@@ -1001,7 +1001,7 @@ class TestControllers(testutil.DBTest):
}
self.save_update(params, session)
update = PackageUpdate.byTitle(params['builds'])
- assert update.request == 'stable'
+ assert update.request == 'testing'
params = {
'builds' : 'nethack-2.10-3.20070831cvs.fc7',
'release' : 'Fedora 7',
@@ -1224,7 +1224,7 @@ class TestControllers(testutil.DBTest):
self.save_update(params, session)
assert PackageUpdate.select().count() == 1
- assert PackageUpdate.select()[0].request == 'stable'
+ assert PackageUpdate.select()[0].request == 'testing'
testutil.create_request('/updates/admin/push', headers=session)
# Make sure security updates do not slip in unapproved
@@ -1244,7 +1244,7 @@ class TestControllers(testutil.DBTest):
#testutil.print_log()
assert '1 pending request' in cherrypy.response.body[0], cherrypy.response.body[0]
- # Revoke the stable request from the update
+ # Revoke the testingrequest from the update
testutil.create_request('/updates/revoke/%s' % params['builds'],
headers=session)
@@ -1284,15 +1284,15 @@ class TestControllers(testutil.DBTest):
params['builds'], method='POST',
headers=session)
update = PackageUpdate.byTitle(params['builds'])
- assert update.request == 'stable'
- assert len(update.comments) == 2
- assert update.get_comments()[-1].text == 'This update has been submitted for stable by guest. '
+ assert update.request == 'testing'
+ assert len(update.comments) == 1
+ assert update.get_comments()[-1].text == 'This update has been submitted for testing by guest. '
testutil.create_request('/updates/request/obsolete/%s' %
params['builds'], method='POST',
headers=session)
update = PackageUpdate.byTitle(params['builds'])
print update
- assert len(update.comments) == 3
+ assert len(update.comments) == 2
assert update.get_comments()[-1].text == 'This update has been obsoleted'
assert update.get_comments()[-1].author == 'bodhi'
@@ -2356,7 +2356,7 @@ class TestControllers(testutil.DBTest):
}
self.save_update(params, session)
update = PackageUpdate.byTitle(params['builds'])
- assert update.request == 'stable', update.request
+ assert update.request == 'testing', update.request
def test_duplicate_packages_for_same_release(self):
"""
commit bd757b4997bcff99a8028a49efdf3b4a65f470fc
Author: Luke Macken <lmacken(a)redhat.com>
Date: Thu Sep 16 16:06:41 2010 -0400
Add a test_security_approval_to_stable unit test.
This ensures that security updates that try to go to stable hit testing first.
diff --git a/bodhi/tests/test_controllers.py b/bodhi/tests/test_controllers.py
index e29b15a..4dc42cb 100644
--- a/bodhi/tests/test_controllers.py
+++ b/bodhi/tests/test_controllers.py
@@ -1053,6 +1053,34 @@ class TestControllers(testutil.DBTest):
assert update.approved
assert update.request == 'testing'
+ def test_security_approval_to_stable(self):
+ """
+ Make sure we disallow pushing directly to stable after security approval
+ """
+ session = login(group='security_respons')
+ create_release()
+ params = {
+ 'builds' : 'TurboGears-2.6.23.1-21.fc7',
+ 'release' : 'Fedora 7',
+ 'type_' : 'security',
+ 'bugs' : '',
+ 'notes' : 'foobar',
+ 'request' : 'stable',
+ 'autokarma': False,
+ }
+ #testutil.capture_log(['bodhi.model', 'bodhi.controllers', 'bodhi.admin', 'bodhi.masher', 'bodhi.util'])
+ self.save_update(params, session)
+ update = PackageUpdate.byTitle(params['builds'])
+ #assert False, testutil.get_log()
+ assert update.request == 'testing', update.request
+ assert not update.approved
+
+ url = '/updates/approve?update=' + params['builds']
+ testutil.create_request(url, headers=session, method='POST')
+ update = PackageUpdate.byTitle(params['builds'])
+ assert update.approved
+ assert update.request == 'testing', update.request
+
def test_cached_acls(self):
"""
Make sure that the list of committers for this package is getting
commit bc17e0e5f67aa44bd1166db5b8d607f471b74bdb
Author: Luke Macken <lmacken(a)redhat.com>
Date: Thu Sep 16 16:06:15 2010 -0400
Update our karma update requirement check to make sure autokarma is enabled
diff --git a/bodhi/model.py b/bodhi/model.py
index ebd6b4a..af8c138 100644
--- a/bodhi/model.py
+++ b/bodhi/model.py
@@ -467,7 +467,8 @@ class PackageUpdate(SQLObject):
flash_notes = ''
if action == 'stable' and not self.critpath:
# Check if we've met the karma requirements
- if self.karma >= self.stable_karma or self.critpath_approved:
+ if (self.stable_karma != 0 and self.karma >= self.stable_karma) or \
+ self.critpath_approved:
pass
else:
# If we haven't met the stable karma requirements, check if it has met
commit 81cd8f3bbf7826ba8e2306434952b63a840762ee
Author: Luke Macken <lmacken(a)redhat.com>
Date: Thu Sep 16 16:05:56 2010 -0400
Disable the need for security update approval for updates to hit testing
diff --git a/bodhi/model.py b/bodhi/model.py
index 580a453..ebd6b4a 100644
--- a/bodhi/model.py
+++ b/bodhi/model.py
@@ -404,11 +404,12 @@ class PackageUpdate(SQLObject):
self.obsolete()
flash_log("%s has been obsoleted" % self.title)
return
- elif self.type == 'security' and not self.approved:
- flash_log("%s is awaiting approval of the Security Team" %
- self.title)
- self.request = action
- return
+ #elif self.type == 'security' and not self.approved:
+ # flash_log("%s is awaiting approval of the Security Team" %
+ # self.title)
+ # # FIXME: Disallow direct to stable pushes of stable
+ # self.request = action
+ # return
elif action == 'stable' and pathcheck:
# Make sure we don't break update paths by trying to push out
# an update that is older than than the latest.
commit 650c85b818289a9892e950055efb840fb4b1270a
Author: Luke Macken <lmacken(a)redhat.com>
Date: Thu Sep 16 14:18:59 2010 -0400
Stop butchering the update notes in our announcement mails (#426)
diff --git a/bodhi/mail.py b/bodhi/mail.py
index 2016691..f387b58 100644
--- a/bodhi/mail.py
+++ b/bodhi/mail.py
@@ -355,8 +355,7 @@ def get_template(update, use_template='fedora_errata_template'):
info['product'] = update.release.long_name
info['notes'] = ""
if update.notes and len(update.notes):
- info['notes'] = u"Update Information:\n\n%s\n" % \
- '\n'.join(wrap(update.notes, width=80))
+ info['notes'] = u"Update Information:\n\n%s\n" % update.notes
info['notes'] += line
# Add this updates referenced Bugzillas and CVEs
13 years, 8 months
bodhi/metadata.py
by Luke Macken
bodhi/metadata.py | 1 +
1 file changed, 1 insertion(+)
New commits:
commit b374aaa61753d20d6d396afa0fa8ece13890c883
Author: Luke Macken <lmacken(a)redhat.com>
Date: Wed Sep 15 11:45:59 2010 -0400
Bail out of insert_pkgtags if we can't determine the repo
diff --git a/bodhi/metadata.py b/bodhi/metadata.py
index 9541743..af415bd 100644
--- a/bodhi/metadata.py
+++ b/bodhi/metadata.py
@@ -301,6 +301,7 @@ class ExtendedMetadata(object):
filename += '-t'
else:
log.error('Unknown repo %s' % self.repo)
+ return
tags_url = config.get('pkgtags_url') + filename
log.info('Downloading %s' % tags_url)
13 years, 8 months
3 commits - bodhi/config bodhi/masher.py bodhi/metadata.py bodhi/modifyrepo.py
by Luke Macken
bodhi/config/app.cfg | 1 +
bodhi/masher.py | 1 +
bodhi/metadata.py | 34 ++++++++++++++++++++++++++++++++++
bodhi/modifyrepo.py | 8 +++++---
4 files changed, 41 insertions(+), 3 deletions(-)
New commits:
commit 8f623181e4cb04758369e631f29eca5148e60324
Author: Luke Macken <lmacken(a)redhat.com>
Date: Wed Sep 15 11:44:19 2010 -0400
Download and inject the pkgtags.sqlite into our repodata from the pkgdb (#435)
diff --git a/bodhi/config/app.cfg b/bodhi/config/app.cfg
index 49b7884..c7320d6 100644
--- a/bodhi/config/app.cfg
+++ b/bodhi/config/app.cfg
@@ -130,6 +130,7 @@ acl_system = 'dummy'
## Package DB
##
pkgdb_url = 'https://admin.fedoraproject.org/pkgdb'
+pkgtags_url = 'https://admin.fedoraproject.org/pkgdb/lists/sqlitebuildtags/'
##
## Bugzilla settings. The username/password for our bugzilla account comes
diff --git a/bodhi/masher.py b/bodhi/masher.py
index fe26b4b..59f4033 100644
--- a/bodhi/masher.py
+++ b/bodhi/masher.py
@@ -835,6 +835,7 @@ class MashTask(Thread):
log.debug("Generating updateinfo.xml.gz for %s" % repo)
uinfo = ExtendedMetadata(repo, olduinfo)
uinfo.insert_updateinfo()
+ uinfo.insert_pkgtags()
log.debug("Updateinfo generation took: %s secs" % (time.time()-t0))
self.genmd = False
diff --git a/bodhi/metadata.py b/bodhi/metadata.py
index 465ada0..9541743 100644
--- a/bodhi/metadata.py
+++ b/bodhi/metadata.py
@@ -16,6 +16,7 @@
__version__ = '1.4'
import os
+import urllib
import logging
from xml.dom import minidom
@@ -278,3 +279,36 @@ class ExtendedMetadata(object):
repomd.add(self.doc)
except RepositoryNotFound:
log.error("Cannot find repomd.xml in %s" % self.repo)
+
+ def insert_pkgtags(self):
+ """ Download and inject the pkgtags sqlite from the pkgdb """
+ try:
+ for arch in os.listdir(self.repo):
+ if arch == 'SRPMS':
+ continue
+ filename = ''
+ if self.repo.startswith('f'):
+ release = self.repo[1:].split('-')[0]
+ filename = 'F-%s-%s-' % (release, arch)
+ if 'testing' in self.repo:
+ filename += 'tu'
+ else:
+ filename += 'u'
+ elif self.repo.startswith('el'):
+ release = self.repo[2:].split('-')[0]
+ filename = 'E-%s-%s' % (release, arch)
+ if 'testing' in self.repo:
+ filename += '-t'
+ else:
+ log.error('Unknown repo %s' % self.repo)
+
+ tags_url = config.get('pkgtags_url') + filename
+ log.info('Downloading %s' % tags_url)
+ f = urllib.urlretrieve(tags_url, filename='/tmp/pkgtags.sqlite')
+
+ repomd = RepoMetadata(join(self.repo, arch, 'repodata'))
+ repomd.add('/tmp/pkgtags.sqlite')
+
+ except Exception, e:
+ log.exception(e)
+ log.error("There was a problem injecting pkgtags")
commit b48d79af011766da2630268f11f265babbf79581
Author: Luke Macken <lmacken(a)redhat.com>
Date: Wed Sep 15 11:43:13 2010 -0400
Use kitchen's to_bytes method when writing out our extended metadata.
Without this, our metadata.py explodes when trying to inject a binary sqlite
file
diff --git a/bodhi/modifyrepo.py b/bodhi/modifyrepo.py
index a4ef06f..eb5b5ce 100644
--- a/bodhi/modifyrepo.py
+++ b/bodhi/modifyrepo.py
@@ -30,6 +30,8 @@ import gzip
from hashlib import sha1 as sha
from xml.dom import minidom
+from kitchen.text.converters import to_bytes
+
from bodhi.exceptions import RepositoryNotFound
class RepoMetadata(object):
@@ -79,7 +81,7 @@ class RepoMetadata(object):
mdtype = mdname.split('.')[0]
destmd = os.path.join(self.repodir, mdname)
newmd = gzip.GzipFile(destmd, 'wb')
- newmd.write(md.encode('utf-8'))
+ newmd.write(to_bytes(md, errors='ignore', non_string='passthru'))
newmd.close()
print "Wrote:", destmd
@@ -102,7 +104,7 @@ class RepoMetadata(object):
self._insert_element(data, 'timestamp',
text=str(os.stat(destmd).st_mtime))
self._insert_element(data, 'open-checksum', attrs={ 'type' : 'sha' },
- text=sha(md.encode('utf-8')).hexdigest())
+ text=sha(to_bytes(md, errors='ignore', non_string='passthru')).hexdigest())
#print " type =", mdtype
#print " location =", 'repodata/' + mdname
commit 576a4401d330d25031504f07258cde79c16cb0e6
Author: Luke Macken <lmacken(a)redhat.com>
Date: Wed Sep 15 11:42:45 2010 -0400
Check for basestring instead of str in our metadata generator
diff --git a/bodhi/modifyrepo.py b/bodhi/modifyrepo.py
index cb39ec0..a4ef06f 100644
--- a/bodhi/modifyrepo.py
+++ b/bodhi/modifyrepo.py
@@ -63,7 +63,7 @@ class RepoMetadata(object):
if isinstance(metadata, minidom.Document):
md = metadata.toxml()
mdname = 'updateinfo.xml'
- elif isinstance(metadata, str):
+ elif isinstance(metadata, basestring):
if os.path.exists(metadata):
oldmd = file(metadata, 'r')
md = oldmd.read()
13 years, 8 months
2 commits - bodhi/config bodhi/jobs.py bodhi/masher.py
by Luke Macken
bodhi/config/app.cfg | 3 +++
bodhi/jobs.py | 5 +++++
bodhi/masher.py | 13 +++++++++++++
3 files changed, 21 insertions(+)
New commits:
commit fa220a2bf07744dc169f805dedd7f01fb8647f09
Author: Luke Macken <lmacken(a)redhat.com>
Date: Wed Sep 15 10:27:34 2010 -0400
Display a list of security updates that need testing in our digest (#446)
diff --git a/bodhi/masher.py b/bodhi/masher.py
index 4cd1b1f..fe26b4b 100644
--- a/bodhi/masher.py
+++ b/bodhi/masher.py
@@ -735,6 +735,14 @@ class MashTask(Thread):
updates.append(update)
return updates
+ def get_security_updates(self, release):
+ release = Release.select(Release.q.long_name==release)
+ return PackageUpdate.select(
+ AND(PackageUpdate.q.releaseID == release.id,
+ PackageUpdate.q.type == 'security',
+ PackageUpdate.q.status == 'testing',
+ PackageUpdate.q.request == None))
+
def send_digest_mail(self):
'''
Send digest mail to mailing lists
@@ -743,6 +751,11 @@ class MashTask(Thread):
log.debug("Sending digest for updates-testing %s" % prefix)
maildata = u''
try:
+ maildata += u'The following %s Security updates need testing:\n\n' % prefix
+ for update in self.get_security_updates(prefix):
+ maildata += u' %s\n' % config.get('base_address') + url(update.get_url())
+ maildata += '\n\n'
+
maildata += u'The following %s Critical Path updates have yet to be approved:\n\n' % prefix
for update in self.get_unapproved_critpath_updates(prefix):
maildata += u' %s\n' % config.get('base_address') + url(update.get_url())
commit a98b07a63f73bbbaf165e58f397bc88548004d8a
Author: Luke Macken <lmacken(a)redhat.com>
Date: Wed Sep 15 10:22:36 2010 -0400
Email the proventesters for unapproved critpath updates after 2 weeks
diff --git a/bodhi/config/app.cfg b/bodhi/config/app.cfg
index 7498ac0..49b7884 100644
--- a/bodhi/config/app.cfg
+++ b/bodhi/config/app.cfg
@@ -80,6 +80,9 @@ security_team = None
# Superuser groups
admin_groups = 'proventesters security_respons'
+# The email address of the proventesters
+proventesters_email = 'proventesters-members(a)fedoraproject.org'
+
# Where do we send update announcements to ?
# These variables should be named per: Release.prefix_id.lower()_announce_list
fedora_announce_list = None
diff --git a/bodhi/jobs.py b/bodhi/jobs.py
index 0c3984f..b986aeb 100644
--- a/bodhi/jobs.py
+++ b/bodhi/jobs.py
@@ -86,6 +86,7 @@ def nagmail():
]
oldname = None
mail_admin = False
+ mail_proventesters = False
for name, query, date in queries:
for update in query:
@@ -105,6 +106,7 @@ def nagmail():
oldname = name
name = 'old_testing_critpath'
mail_admin = True
+ mail_proventesters = True
log.info("[%s] Nagging %s about %s" % (name, update.submitter,
update.title))
@@ -112,6 +114,9 @@ def nagmail():
if mail_admin:
mail.send_admin(name, update)
mail_admin = False
+ if mail_proventesters:
+ mail.send(config.get('proventesters_email'), name, update)
+ mail_proventesters = False
nagged[name] = datetime.utcnow()
update.nagged = nagged
13 years, 8 months
bodhi/model.py
by Luke Macken
bodhi/model.py | 19 ++++++-------------
1 file changed, 6 insertions(+), 13 deletions(-)
New commits:
commit 82f08379cd17d392555c48d40fc7acfcf4ae6c9e
Author: Luke Macken <lmacken(a)redhat.com>
Date: Wed Sep 15 10:12:55 2010 -0400
Update our karma updating algorithm (#421)
Based on patch from Matt McCutchen.
diff --git a/bodhi/model.py b/bodhi/model.py
index 56acd88..580a453 100644
--- a/bodhi/model.py
+++ b/bodhi/model.py
@@ -780,19 +780,12 @@ class PackageUpdate(SQLObject):
pass
if not anonymous and karma != 0:
- mycomments = [c.karma for c in self.comments if c.author == author
- and not c.anonymous and c.karma != 0]
- if mycomments:
- if karma == 1 and mycomments[-1] == -1:
- self.karma += 2
- elif karma == -1 and mycomments[-1] == 1:
- self.karma -= 2
- elif mycomments[-1] == self.karma:
- pass
- else:
- self.karma += karma
- else:
- self.karma += karma
+ my_karmas = [c.karma for c in self.comments if c.author == author
+ and not c.anonymous and c.karma != 0]
+ if len(my_karmas) > 0:
+ # Remove the previous karma.
+ self.karma -= my_karmas[-1]
+ self.karma += karma
log.info("Updated %s karma to %d" % (self.title, self.karma))
Comment(text=text, karma=karma, update=self, author=author,
13 years, 8 months
2 commits - bodhi/model.py bodhi/tests bodhi/tools
by Luke Macken
bodhi/model.py | 19 +++++++++-------
bodhi/tests/test_controllers.py | 47 ++++++++++++++++++++++++++++++++++++----
bodhi/tools/metrics.py | 1
3 files changed, 55 insertions(+), 12 deletions(-)
New commits:
commit 6899d5963fc49d6bc502f002076118098d348f30
Author: Luke Macken <lmacken(a)redhat.com>
Date: Tue Sep 14 17:41:19 2010 -0400
Refactor some of our karma code, allowing people to revert their karma more
than once (#480)
diff --git a/bodhi/model.py b/bodhi/model.py
index c03e194..56acd88 100644
--- a/bodhi/model.py
+++ b/bodhi/model.py
@@ -779,15 +779,18 @@ class PackageUpdate(SQLObject):
# in which case this block is not necessary
pass
- if not anonymous and karma != 0 and \
- not filter(lambda c: c.author == author and c.karma == karma,
- self.comments):
+ if not anonymous and karma != 0:
mycomments = [c.karma for c in self.comments if c.author == author
- and not c.anonymous]
- if karma == 1 and -1 in mycomments:
- self.karma += 2
- elif karma == -1 and 1 in mycomments:
- self.karma -= 2
+ and not c.anonymous and c.karma != 0]
+ if mycomments:
+ if karma == 1 and mycomments[-1] == -1:
+ self.karma += 2
+ elif karma == -1 and mycomments[-1] == 1:
+ self.karma -= 2
+ elif mycomments[-1] == self.karma:
+ pass
+ else:
+ self.karma += karma
else:
self.karma += karma
log.info("Updated %s karma to %d" % (self.title, self.karma))
diff --git a/bodhi/tests/test_controllers.py b/bodhi/tests/test_controllers.py
index 8626b84..e29b15a 100644
--- a/bodhi/tests/test_controllers.py
+++ b/bodhi/tests/test_controllers.py
@@ -241,14 +241,15 @@ class TestControllers(testutil.DBTest):
update = PackageUpdate.byTitle(params['builds'])
assert update.karma == -1
- # don't let them do it again
+ # let them change their -1 to a +1
x = testutil.create_request('/updates/comment?text=bizbaz&title=%s&karma=1' %
params['builds'], method='POST',
headers=session)
update = PackageUpdate.byTitle(params['builds'])
- assert update.karma == -1
+ assert update.karma == 1, update.karma
- # Add a new comment, and make sure we can access the comments in the proper order
+ # Add a new comment, and make sure we can access the comments in the
+ # proper order
x = testutil.create_request('/updates/comment?text=woopdywoop&title=%s' %
params['builds'], method='POST',
headers=session)
@@ -2231,10 +2232,48 @@ class TestControllers(testutil.DBTest):
assert PackageUpdate.byTitle(params['builds']).karma == 1
# have the submitter +1 the update
+ #testutil.capture_log(['bodhi.controller', 'bodhi.util'])
testutil.create_request('/updates/comment?text=foobar&title=%s&karma=1' %
params['builds'], method='POST', headers=session)
up = PackageUpdate.byTitle(params['builds'])
- assert up.karma == 3
+ #assert False, testutil.get_log()
+ assert up.karma == 3, up.karma
+
+ def test_reverting_karma(self):
+ """
+ Ensure that a developer can give negative karma, and then proceed to
+ later give positive karma.
+ """
+ session = login()
+ create_release()
+ params = {
+ 'builds' : 'TurboGears-1.0.8-1.fc7',
+ 'release' : 'Fedora 7',
+ 'type_' : 'bugfix',
+ 'bugs' : '',
+ 'notes' : 'foobar',
+ 'request' : 'Stable',
+ 'autokarma' : True,
+ 'stable_karma' : 5,
+ 'unstable_karma' : -5
+ }
+ self.save_update(params, session)
+ assert PackageUpdate.byTitle(params['builds']).karma == 0
+
+ testutil.create_request('/updates/comment?text=bar&title=%s&karma=1' %
+ params['builds'], method='POST',
+ headers=session)
+ assert PackageUpdate.byTitle(params['builds']).karma == 1
+
+ testutil.create_request('/updates/comment?text=bar&title=%s&karma=-1' %
+ params['builds'], method='POST',
+ headers=session)
+ assert PackageUpdate.byTitle(params['builds']).karma == -1
+
+ testutil.create_request('/updates/comment?text=bar&title=%s&karma=1' %
+ params['builds'], method='POST',
+ headers=session)
+ assert PackageUpdate.byTitle(params['builds']).karma == 1, PackageUpdate.byTitle(params['builds']).karma
def test_suggest_reboot(self):
session = login()
commit 0f59a166e16d84f25fffed717c3ae1ce1d65316b
Author: Luke Macken <lmacken(a)redhat.com>
Date: Tue Sep 14 16:04:57 2010 -0400
Display the # of fixed bugs in our metrics report
diff --git a/bodhi/tools/metrics.py b/bodhi/tools/metrics.py
index 871fbe3..34fa9c3 100755
--- a/bodhi/tools/metrics.py
+++ b/bodhi/tools/metrics.py
@@ -143,6 +143,7 @@ def main():
for type in types:
print " * %d %s updates (%0.2f%%)" % (data['num_%s' % type], type,
float(data['num_%s' % type]) / data['num_updates'] * 100)
+ print " * %d bugs resolved" % len(data['bugs'])
print " * %d critical path updates (%0.2f%%)" % (data['num_critpath'],
float(data['num_critpath']) / data['num_updates'] * 100)
print " * %d approved critical path updates" % (
13 years, 8 months
bodhi/controllers.py
by Luke Macken
bodhi/controllers.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit 498022008b0f7cfb652af810f40e788f46975667
Author: Luke Macken <lmacken(a)redhat.com>
Date: Mon Sep 13 17:15:39 2010 -0400
Update our edit message
diff --git a/bodhi/controllers.py b/bodhi/controllers.py
index 29c1ee7..1994950 100644
--- a/bodhi/controllers.py
+++ b/bodhi/controllers.py
@@ -493,7 +493,7 @@ class Root(controllers.RootController):
}
log.debug("values = %s" % values)
if update.status == 'testing':
- flash("Editing this update will move it back to a pending state.")
+ flash("Adding or removing builds from this update will move it back to a pending state.")
return dict(form=update_form, values=values, action=url("/save"),
title='Edit Update')
13 years, 8 months
bodhi/controllers.py
by Luke Macken
bodhi/controllers.py | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
New commits:
commit 090d2c84041e63e1dcebd99115292f7473529c32
Author: Luke Macken <lmacken(a)redhat.com>
Date: Mon Sep 13 17:07:14 2010 -0400
More fixes for the edit functionality.
- Only refresh the koji tags if we need to
- If we edit an update and don't have to mess with tags,
then later on assume it's still tagged as testing.
diff --git a/bodhi/controllers.py b/bodhi/controllers.py
index e0c6eda..29c1ee7 100644
--- a/bodhi/controllers.py
+++ b/bodhi/controllers.py
@@ -662,6 +662,7 @@ class Root(controllers.RootController):
# If we're editing an update, unpush it first so we can assume all
# of the builds are tagged as update candidates
+ edited_testing_update = False
if edited:
try:
edited = PackageUpdate.byTitle(edited)
@@ -713,15 +714,15 @@ class Root(controllers.RootController):
# Make sure all builds are tagged as updates-candidate
# and bring the update back to a pending state
edited.unpush()
+
+ # Refresh the tags for these builds
+ for build in edited.builds:
+ if build.nvr in buildinfo:
+ buildinfo[build.nvr]['tags'] = [tag['name'] for tag in
+ koji.listTags(build.nvr)]
else:
# No need to change the bodhi state or koji tag
- pass
-
- # Refresh the tags for these builds
- for build in edited.builds:
- if build.nvr in buildinfo:
- buildinfo[build.nvr]['tags'] = [tag['name'] for tag in
- koji.listTags(build.nvr)]
+ edited_testing_update = True
# Make sure all builds are tagged appropriately. We also determine
# which builds get pushed for which releases, based on the tag.
@@ -733,6 +734,9 @@ class Root(controllers.RootController):
for tag in tags:
rel = None
for r in Release.select():
+ if edited_testing_update and tag == r.testing_tag:
+ rel = r
+ break
if tag == r.candidate_tag:
rel = r
break
13 years, 8 months
bodhi/tests
by Luke Macken
bodhi/tests/test_controllers.py | 73 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 73 insertions(+)
New commits:
commit 62539842cfdc1b8e4388e5de3023ffb7e72d6008
Author: Luke Macken <lmacken(a)redhat.com>
Date: Mon Sep 13 16:38:37 2010 -0400
Add a couple more unit tests to make sure our new edit behavior works properly
diff --git a/bodhi/tests/test_controllers.py b/bodhi/tests/test_controllers.py
index a9c5cf3..8626b84 100644
--- a/bodhi/tests/test_controllers.py
+++ b/bodhi/tests/test_controllers.py
@@ -549,6 +549,79 @@ class TestControllers(testutil.DBTest):
update = PackageUpdate.byTitle('python-sqlobject-0.8.2-1.fc7')
assert len(update.builds) == 1
+ def test_edit_notes(self):
+ """
+ Make sure we can edit the notes without having the update go back to pending
+ """
+ session = login()
+ create_release()
+ params = {
+ 'builds' : 'TurboGears-1.0.2.2-2.fc7',
+ 'release' : 'Fedora 7',
+ 'type_' : 'bugfix',
+ 'bugs' : '',
+ 'cves' : '',
+ 'notes' : ''
+ }
+ self.save_update(params, session)
+ update = PackageUpdate.byTitle(params['builds'])
+
+ # Pretend it's pushed to testing
+ update.status = 'testing'
+ update.request = None
+
+ # Add another build, and a bug
+ params = {
+ 'builds' : 'TurboGears-1.0.2.2-2.fc7',
+ 'release' : 'Fedora 7',
+ 'type_' : 'bugfix',
+ 'bugs' : '1',
+ 'cves' : '',
+ 'notes' : '',
+ 'edited' : 'TurboGears-1.0.2.2-2.fc7'
+ }
+ self.save_update(params, session)
+ update = PackageUpdate.byTitle(params['builds'])
+
+ assert update.status == 'testing'
+ assert update.request == None
+
+
+ def test_edit_builds(self):
+ """ Make sure we can edit builds in an update """
+ session = login()
+ create_release()
+ params = {
+ 'builds' : 'TurboGears-1.0.2.2-2.fc7',
+ 'release' : 'Fedora 7',
+ 'type_' : 'bugfix',
+ 'bugs' : '',
+ 'cves' : '',
+ 'notes' : ''
+ }
+ self.save_update(params, session)
+ update = PackageUpdate.byTitle(params['builds'])
+
+ # Pretend it's pushed to testing
+ update.status = 'testing'
+ update.request = None
+
+ # Add another build, and a bug
+ params = {
+ 'builds' : 'TurboGears-1.0.2.2-2.fc7 python-sqlobject-0.1-1.fc7',
+ 'release' : 'Fedora 7',
+ 'type_' : 'bugfix',
+ 'bugs' : '1',
+ 'cves' : '',
+ 'notes' : '',
+ 'edited' : 'TurboGears-1.0.2.2-2.fc7'
+ }
+ self.save_update(params, session)
+ update = PackageUpdate.byTitle(','.join(params['builds'].split()))
+
+ assert update.status == 'pending'
+ assert update.request == 'testing'
+
def test_delete(self):
session = login()
create_release()
13 years, 8 months
bodhi.egg-info/PKG-INFO bodhi.egg-info/SOURCES.txt bodhi/release.py bodhi.spec bodhi/tools
by Luke Macken
bodhi.egg-info/PKG-INFO | 2 +-
bodhi.egg-info/SOURCES.txt | 3 +++
bodhi.spec | 5 ++++-
bodhi/release.py | 2 +-
bodhi/tools/client.py | 2 +-
5 files changed, 10 insertions(+), 4 deletions(-)
New commits:
commit 7487ab9ae3636af4bd677798141f8f351123945c
Author: Luke Macken <lmacken(a)redhat.com>
Date: Fri Sep 10 18:37:07 2010 -0400
0.7.9 release
diff --git a/bodhi.egg-info/PKG-INFO b/bodhi.egg-info/PKG-INFO
index 622f493..45f7e76 100644
--- a/bodhi.egg-info/PKG-INFO
+++ b/bodhi.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.0
Name: bodhi
-Version: 0.7.7
+Version: 0.7.9
Summary: Bodhi is a modular web-system that facilitates the process of publishing updates for a Fedora-based software distribution
Home-page: https://fedorahosted.org/bodhi
Author: Luke Macken
diff --git a/bodhi.egg-info/SOURCES.txt b/bodhi.egg-info/SOURCES.txt
index f1c597b..6fb7bc9 100644
--- a/bodhi.egg-info/SOURCES.txt
+++ b/bodhi.egg-info/SOURCES.txt
@@ -78,10 +78,13 @@ bodhi/static/images/desc.gif
bodhi/static/images/edit.png
bodhi/static/images/enhancement.png
bodhi/static/images/favicon.ico
+bodhi/static/images/hardhat.png
bodhi/static/images/header-faq.png
bodhi/static/images/header-fedora_logo.png
bodhi/static/images/header-fedora_logo.png.old
bodhi/static/images/header-projects.png
+bodhi/static/images/i.gif
+bodhi/static/images/info.png
bodhi/static/images/karma-1.png
bodhi/static/images/karma0.png
bodhi/static/images/karma1.png
diff --git a/bodhi.spec b/bodhi.spec
index ac04a6a..be7c2c2 100644
--- a/bodhi.spec
+++ b/bodhi.spec
@@ -2,7 +2,7 @@
%{!?pyver: %define pyver %(%{__python} -c "import sys ; print sys.version[:3]")}
Name: bodhi
-Version: 0.7.8.1
+Version: 0.7.9
Release: 1%{?dist}
Summary: A modular framework that facilitates publishing software updates
Group: Applications/Internet
@@ -120,6 +120,9 @@ rm -rf bodhi/tests bodhi/tools/test-bodhi.py
%changelog
+* Fri Sep 10 2010 Luke Macken <lmacken(a)redhat.com> - 0.7.9-1
+- 0.7.9 release
+
* Thu Aug 12 2010 Luke Macken <lmacken(a)redhat.com> - 0.7.8-1
- 0.7.8 release
- Have the bodhi-client subpackage require python-kitchen
diff --git a/bodhi/release.py b/bodhi/release.py
index 8e6eb28..8f82ad9 100644
--- a/bodhi/release.py
+++ b/bodhi/release.py
@@ -1,4 +1,4 @@
-VERSION = '0.7.8'
+VERSION = '0.7.9'
NAME = 'bodhi'
DESCRIPTION = 'Bodhi is a modular web-system that facilitates the process of publishing updates for a Fedora-based software distribution'
AUTHOR = 'Luke Macken'
diff --git a/bodhi/tools/client.py b/bodhi/tools/client.py
index 1605330..66eb5d3 100755
--- a/bodhi/tools/client.py
+++ b/bodhi/tools/client.py
@@ -15,7 +15,7 @@
# Copyright 2007-2010 Red Hat, Inc
# Authors: Luke Macken <lmacken(a)redhat.com>
-__version__ = '0.7.8'
+__version__ = '0.7.9'
__description__ = 'Command line tool for interacting with Bodhi'
import sys
13 years, 8 months