bodhi/controllers.py bodhi/tests
by Luke Macken
bodhi/controllers.py | 13 ++++++++++++-
bodhi/tests/test_controllers.py | 29 +++++++++++++++++++++++++++++
2 files changed, 41 insertions(+), 1 deletion(-)
New commits:
commit 2f21b5bf5cd74d050c38f7fccedf2d4df3c9e305
Author: Luke Macken <lmacken(a)redhat.com>
Date: Thu Jan 28 06:31:28 2010 -0500
Update newly added bugs when editing an update (#386)
diff --git a/bodhi/controllers.py b/bodhi/controllers.py
index 33c7734..ae224cb 100644
--- a/bodhi/controllers.py
+++ b/bodhi/controllers.py
@@ -29,9 +29,10 @@ from sqlobject.sqlbuilder import AND, OR
from turbogears import (controllers, expose, validate, redirect, identity,
paginate, flash, error_handler, validators, config)
+from turbogears import url as tg_url
from turbogears.widgets import DataGrid
-from fedora.tg.util import request_format, tg_url
+from fedora.tg.util import request_format
from fedora.tg.controllers import login as fc_login
from fedora.tg.controllers import logout as fc_logout
@@ -826,6 +827,7 @@ class Root(controllers.RootController):
# Add/remove the necessary Bugzillas
try:
+ original_bugs = [bug.bz_id for bug in update.bugs]
update.update_bugs(bugs)
except xmlrpclib.Fault, f:
log.exception(f)
@@ -848,6 +850,15 @@ class Root(controllers.RootController):
#mail.send(update.get_maintainers(), 'edited', update)
mail.send(update.submitter, 'edited', update)
note.insert(0, "Update successfully edited")
+
+ # Update any newly added bugs
+ for bug in bugs:
+ if bug not in original_bugs:
+ log.debug("Updating newly added bug: %s" % bug)
+ Bugzilla.byBz_id(bug).add_comment(update,
+ "%s has been submitted as an update for %s.\n%s" %
+ (update.title, release.long_name,
+ config.get('base_address') + tg_url(update.get_url())))
else:
# Notify security team of newly submitted security updates
if update.type == 'security':
diff --git a/bodhi/tests/test_controllers.py b/bodhi/tests/test_controllers.py
index 75c82a1..6f6e9c0 100644
--- a/bodhi/tests/test_controllers.py
+++ b/bodhi/tests/test_controllers.py
@@ -1822,3 +1822,32 @@ class TestControllers(testutil.DBTest):
json = simplejson.loads(cherrypy.response.body[0])
assert json['num_items'] == 100, json['num_items']
assert len(json['updates']) == 100, len(json['updates'])
+
+ def test_add_bugs_to_update(self):
+ session = login()
+ f7 = create_release()
+ params = {
+ 'builds' : 'TurboGears-1.0.2.2-2.fc7 python-sqlobject-0.8.2-1.fc7',
+ 'type_' : 'bugfix',
+ 'bugs' : '1',
+ 'cves' : '',
+ 'notes' : ''
+ }
+ self.save_update(params, session)
+
+ # Add another build, for a different release
+ params = {
+ 'builds' : 'TurboGears-1.0.2.2-2.fc7 python-sqlobject-0.8.2-1.fc7',
+ 'release' : 'Fedora 7',
+ 'type_' : 'bugfix',
+ 'bugs' : '1 2',
+ 'cves' : '',
+ 'notes' : '',
+ 'edited' : 'TurboGears-1.0.2.2-2.fc7,python-sqlobject-0.8.2-1.fc7',
+ }
+
+ testutil.capture_log(['bodhi.controllers', 'bodhi.util', 'bodhi.model'])
+ self.save_update(params, session)
+ logs = testutil.get_log()
+ assert 'Updating newly added bug: 2' in logs
+ assert len(PackageUpdate.byTitle(params['edited']).bugs) == 2
14 years, 3 months
bodhi/controllers.py bodhi/tests
by Luke Macken
bodhi/controllers.py | 13 +++++++-
bodhi/tests/test_controllers.py | 64 ++++++++++++++++++++++++++++++++++++++++
2 files changed, 76 insertions(+), 1 deletion(-)
New commits:
commit 261aa87a8c090afd8a4543c46d173371f0dc439e
Author: Luke Macken <lmacken(a)redhat.com>
Date: Thu Jan 28 05:58:16 2010 -0500
Detect conflicting builds when editing updates (#385)
diff --git a/bodhi/controllers.py b/bodhi/controllers.py
index af7c1de..33c7734 100644
--- a/bodhi/controllers.py
+++ b/bodhi/controllers.py
@@ -40,7 +40,7 @@ from bodhi.rss import Feed
from bodhi.new import NewUpdateController, update_form
from bodhi.util import make_update_link, make_type_icon, make_karma_icon, link
from bodhi.util import flash_log, get_pkg_pushers, make_request_icon
-from bodhi.util import json_redirect, url
+from bodhi.util import json_redirect, url, get_nvr
from bodhi.admin import AdminController
from bodhi.metrics import MetricsController
from bodhi.model import (Package, PackageBuild, PackageUpdate, Release,
@@ -637,6 +637,17 @@ class Root(controllers.RootController):
"engineering at %s about unpushing this update." %
config.get('release_team_address'))
raise InvalidUpdateException(params)
+
+ # Check for conflicting builds when editing
+ for build in builds:
+ for other_build in builds:
+ if get_nvr(build)[0] == get_nvr(other_build)[0]:
+ if build != other_build:
+ flash_log("Unable to save update with conflicting builds of "
+ "the same package: %s and %s. Please remove one "
+ "and try again." % (build, other_build))
+ raise InvalidUpdateException(params)
+
edited.unpush()
# Refresh the tags for these builds
diff --git a/bodhi/tests/test_controllers.py b/bodhi/tests/test_controllers.py
index fbee31f..75c82a1 100644
--- a/bodhi/tests/test_controllers.py
+++ b/bodhi/tests/test_controllers.py
@@ -359,6 +359,70 @@ class TestControllers(testutil.DBTest):
assert f7up.builds[0].nvr == f7build
assert f7up.builds[0].package.name == 'TurboGears'
+ def test_add_older_build_to_update(self):
+ """ Try adding a newer build an update (#385) """
+ session = login()
+ f7 = create_release()
+ params = {
+ 'builds' : 'TurboGears-1.0.2.2-2.fc7 python-sqlobject-0.8.2-1.fc7',
+ 'type_' : 'bugfix',
+ 'bugs' : '',
+ 'cves' : '',
+ 'notes' : ''
+ }
+ self.save_update(params, session)
+
+ # Add another build, for a different release
+ params = {
+ 'builds' : 'TurboGears-1.0.2.2-2.fc7 python-sqlobject-0.8.2-1.fc7 TurboGears-1.0.2.2-1.fc7',
+ 'release' : 'Fedora 7',
+ 'type_' : 'bugfix',
+ 'bugs' : '1',
+ 'cves' : '',
+ 'notes' : '',
+ 'edited' : 'TurboGears-1.0.2.2-2.fc7,python-sqlobject-0.8.2-1.fc7',
+ }
+
+ testutil.capture_log(['bodhi.controllers', 'bodhi.util', 'bodhi.model'])
+ self.save_update(params, session)
+ logs = testutil.get_log()
+ up = PackageUpdate.select()[0]
+ assert len(up.builds) == 2, up.builds
+ assert up.title == params['edited']
+ assert u'Unable to save update with conflicting builds of the same package: TurboGears-1.0.2.2-2.fc7 and TurboGears-1.0.2.2-1.fc7. Please remove one and try again.' in logs
+
+ def test_add_newer_build_to_update(self):
+ """ Try adding a newer build an update (#385) """
+ session = login()
+ f7 = create_release()
+ params = {
+ 'builds' : 'TurboGears-1.0.2.2-2.fc7 python-sqlobject-0.8.2-1.fc7',
+ 'type_' : 'bugfix',
+ 'bugs' : '',
+ 'cves' : '',
+ 'notes' : ''
+ }
+ self.save_update(params, session)
+
+ # Add another build, for a different release
+ params = {
+ 'builds' : 'TurboGears-1.0.2.2-2.fc7 python-sqlobject-0.8.2-1.fc7 TurboGears-1.0.2.2-3.fc7',
+ 'release' : 'Fedora 7',
+ 'type_' : 'bugfix',
+ 'bugs' : '1',
+ 'cves' : '',
+ 'notes' : '',
+ 'edited' : 'TurboGears-1.0.2.2-2.fc7,python-sqlobject-0.8.2-1.fc7',
+ }
+
+ testutil.capture_log(['bodhi.controllers', 'bodhi.util', 'bodhi.model'])
+ self.save_update(params, session)
+ logs = testutil.get_log()
+ up = PackageUpdate.select()[0]
+ assert len(up.builds) == 2, up.builds
+ assert up.title == params['edited']
+ assert u'Unable to save update with conflicting builds of the same package: TurboGears-1.0.2.2-2.fc7 and TurboGears-1.0.2.2-3.fc7. Please remove one and try again.' in logs
+
def test_add_different_release_to_update(self):
"""
Try adding a build for a different release to an update (#251)
14 years, 3 months
bodhi/controllers.py bodhi/util.py
by Luke Macken
bodhi/controllers.py | 3 +--
bodhi/util.py | 3 ++-
2 files changed, 3 insertions(+), 3 deletions(-)
New commits:
commit 28bc5e48eb9b82cb8ff9dc0d9ec1a8b956816ed9
Author: Luke Macken <lmacken(a)redhat.com>
Date: Wed Jan 27 23:39:57 2010 -0500
Apply a patch from Toshio to use fedora.tg.util.tg_url
diff --git a/bodhi/controllers.py b/bodhi/controllers.py
index 5daf4c5..af7c1de 100644
--- a/bodhi/controllers.py
+++ b/bodhi/controllers.py
@@ -29,10 +29,9 @@ from sqlobject.sqlbuilder import AND, OR
from turbogears import (controllers, expose, validate, redirect, identity,
paginate, flash, error_handler, validators, config)
-from turbogears import url as tg_url
from turbogears.widgets import DataGrid
-from fedora.tg.util import request_format
+from fedora.tg.util import request_format, tg_url
from fedora.tg.controllers import login as fc_login
from fedora.tg.controllers import logout as fc_logout
diff --git a/bodhi/util.py b/bodhi/util.py
index cc48eb7..0fc4909 100644
--- a/bodhi/util.py
+++ b/bodhi/util.py
@@ -33,10 +33,11 @@ from yum.misc import checksum
from os.path import isdir, join, dirname, basename, isfile
from datetime import datetime
from decorator import decorator
-from turbogears import config, flash, redirect, url as tg_url
+from turbogears import config, flash, redirect
from fedora.tg.util import request_format
from fedora.client import PackageDB
from fedora.tg.util import url as csrf_url
+from fedora.tg.util import tg_url
from bodhi.exceptions import (RPMNotFound, RepodataException,
InvalidUpdateException)
14 years, 3 months
bodhi/controllers.py bodhi/tests
by Luke Macken
bodhi/controllers.py | 8 ++++++++
bodhi/tests/test_controllers.py | 32 ++++++++++++++++++++++++++++++++
2 files changed, 40 insertions(+)
New commits:
commit ed526428192fe6af23352bd809dffc0d6e2349d8
Author: Luke Macken <lmacken(a)redhat.com>
Date: Wed Jan 27 10:56:47 2010 -0500
Disallow the ability to edit an update, and add a build from a different release (#251)
diff --git a/bodhi/controllers.py b/bodhi/controllers.py
index 9f1915d..5daf4c5 100644
--- a/bodhi/controllers.py
+++ b/bodhi/controllers.py
@@ -661,6 +661,14 @@ class Root(controllers.RootController):
break
if rel:
log.debug("Adding %s for %s" % (rel.name, build))
+ if edited:
+ if edited.release != rel:
+ valid = False
+ flash_log("Cannot add a %s build to a %s update. "
+ "Please create a new update for %s" % (
+ rel.name, edited.release.name, build))
+ raise InvalidUpdateException(params)
+
if not releases.has_key(rel):
releases[rel] = []
if build not in releases[rel]:
diff --git a/bodhi/tests/test_controllers.py b/bodhi/tests/test_controllers.py
index b998952..fbee31f 100644
--- a/bodhi/tests/test_controllers.py
+++ b/bodhi/tests/test_controllers.py
@@ -359,6 +359,38 @@ class TestControllers(testutil.DBTest):
assert f7up.builds[0].nvr == f7build
assert f7up.builds[0].package.name == 'TurboGears'
+ def test_add_different_release_to_update(self):
+ """
+ Try adding a build for a different release to an update (#251)
+ """
+ session = login()
+ f7 = create_release()
+ f8 = create_release('8', dist='dist-f')
+ params = {
+ 'builds' : 'TurboGears-1.0.2.2-2.fc7',
+ 'type_' : 'bugfix',
+ 'bugs' : '',
+ 'cves' : '',
+ 'notes' : ''
+ }
+ self.save_update(params, session)
+
+ # Add another build, for a different release
+ params = {
+ 'builds' : 'TurboGears-1.0.2.2-2.fc7 python-sqlobject-0.8.2-1.fc8',
+ 'release' : 'Fedora 7',
+ 'type_' : 'bugfix',
+ 'bugs' : '1',
+ 'cves' : '',
+ 'notes' : '',
+ 'edited' : 'TurboGears-1.0.2.2-2.fc7'
+ }
+
+ testutil.capture_log(['bodhi.controllers', 'bodhi.util', 'bodhi.model'])
+ self.save_update(params, session)
+ logs = testutil.get_log()
+ assert 'Cannot add a F8 build to a F7 update. Please create a new update for python-sqlobject-0.8.2-1.fc8' in logs
+
def test_edit(self):
session = login()
create_release()
14 years, 3 months
bodhi/templates
by Luke Macken
bodhi/templates/show.kid | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
New commits:
commit 874cb70edadef38151dc8eb3f6662c566a93be56
Author: Luke Macken <lmacken(a)redhat.com>
Date: Wed Jan 27 10:16:18 2010 -0500
Show the anonymous testers email address if we are logged in (#234)
diff --git a/bodhi/templates/show.kid b/bodhi/templates/show.kid
index f7c63cd..1744d42 100644
--- a/bodhi/templates/show.kid
+++ b/bodhi/templates/show.kid
@@ -245,7 +245,18 @@ karma = "<img src=\"%s\" align=\"top\" /> <b>%d</b>" % (tg.url('/static/images/k
<blockquote>
<div py:if="update.comments">
<div py:for="comment in update.get_comments()">
- <img py:attrs="{'src' : tg.url('/static/images/comment-%d.png' % comment.karma)}" hspace="3"/><b>${comment.anonymous and 'Anonymous Tester' or comment.author}</b> - ${comment.timestamp}<br/>
+ <img py:attrs="{'src' : tg.url('/static/images/comment-%d.png' % comment.karma)}" hspace="3"/>
+ <div py:if="comment.anonymous">
+ <div py:if="tg.identity.anonymous">
+ <b>Anonymous Tester</b> - ${comment.timestamp}<br/>
+ </div>
+ <div py:if="not tg.identity.anonymous">
+ <b>${comment.author}</b> (Anonymous) - ${comment.timestamp}<br/>
+ </div>
+ </div>
+ <div py:if="not comment.anonymous">
+ <b>comment.author</b> - ${comment.timestamp}<br/>
+ </div>
<pre><div py:replace="comment.text">Comment</div></pre>
</div>
</div>
14 years, 3 months
bodhi/controllers.py
by Luke Macken
bodhi/controllers.py | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
New commits:
commit e7ec446d2277eaa16afded7eed76e0ae1557faa5
Author: Luke Macken <lmacken(a)redhat.com>
Date: Wed Jan 27 09:56:34 2010 -0500
Add a 'request' argument to our list API (#224)
diff --git a/bodhi/controllers.py b/bodhi/controllers.py
index 63b61a4..9f1915d 100644
--- a/bodhi/controllers.py
+++ b/bodhi/controllers.py
@@ -224,11 +224,12 @@ class Root(controllers.RootController):
'count_only': validators.StringBool(),
'created_since': validators.UnicodeString(),
'pushed_since': validators.UnicodeString(),
+ 'request': validators.UnicodeString(),
})
def list(self, release=None, bugs=None, cves=None, status=None, type_=None,
package=None, mine=False, get_auth=False, username=None,
start_date=None, end_date=None, count_only=False,
- created_since=None, pushed_since=None, **kw):
+ created_since=None, pushed_since=None, request=None, **kw):
""" Return a list of updates based on given parameters """
log.debug('list(%s)' % locals())
query = []
@@ -243,7 +244,7 @@ class Root(controllers.RootController):
# If no arguments are specified, return the most recent updates
if not release and not bugs and not cves and not status and not type_ \
and not package and not mine and not username and not created_since \
- and not pushed_since:
+ and not pushed_since and not request:
log.debug("No arguments, returning latest")
updates = PackageUpdate.select(orderBy=orderBy).reversed()
num_items = updates.count()
@@ -266,6 +267,8 @@ class Root(controllers.RootController):
orderBy = PackageUpdate.q.date_pushed
if type_:
query.append(PackageUpdate.q.type == type_)
+ if request:
+ query.append(PackageUpdate.q.request == request)
if mine:
query.append(
PackageUpdate.q.submitter == identity.current.user_name)
14 years, 3 months
bodhi/templates
by Luke Macken
bodhi/templates/pending.kid | 1 +
1 file changed, 1 insertion(+)
New commits:
commit ccd86c1f0ccbcb152cc28f7a28aab73cdcc9cfcc
Author: Luke Macken <lmacken(a)redhat.com>
Date: Wed Jan 27 09:17:38 2010 -0500
Add the [all] link back to the pending updats list (#322)
diff --git a/bodhi/templates/pending.kid b/bodhi/templates/pending.kid
index fbd7553..8a19767 100644
--- a/bodhi/templates/pending.kid
+++ b/bodhi/templates/pending.kid
@@ -15,6 +15,7 @@
href="${tg.paginate.get_href(page)}">${page}</a>
<b py:if="page == tg.paginate.current_page">${page}</b>
</span>
+ <a href="?tg_paginate_limit=${num_items}">all</a>
</div>
<table class="list">
14 years, 3 months
2 commits - bodhi/mail.py bodhi/tests
by Luke Macken
bodhi/mail.py | 6 +++---
bodhi/tests/test_model.py | 4 ++--
2 files changed, 5 insertions(+), 5 deletions(-)
New commits:
commit cd3c755ae9402ffe630ca5d8c16111e5a2e1725f
Author: Luke Macken <lmacken(a)redhat.com>
Date: Wed Jan 27 09:09:06 2010 -0500
Update some unit tests for the new URLs
diff --git a/bodhi/tests/test_model.py b/bodhi/tests/test_model.py
index c84fcaa..baa63c8 100644
--- a/bodhi/tests/test_model.py
+++ b/bodhi/tests/test_model.py
@@ -288,7 +288,7 @@ class TestPackageUpdate(testutil.DBTest):
templates = get_template(update)
assert templates
assert templates[0][0] == u'[SECURITY] Fedora 7 Test Update: TurboGears-1.0.2.2-2.fc7'
- assert templates[0][1] == u'--------------------------------------------------------------------------------\nFedora Test Update Notification\nFEDORA-2010-0001\nNone\n--------------------------------------------------------------------------------\n\nName : TurboGears\nProduct : Fedora 7\nVersion : 1.0.2.2\nRelease : 2.fc7\nURL : turbogears.org\nSummary : summary\nDescription :\ndescription\n\n--------------------------------------------------------------------------------\nUpdate Information:\n\nfoobar\n--------------------------------------------------------------------------------\nReferences:\n\n [ 1 ] Bug #1 - None\n https://bugzilla.redhat.com/show_bug.cgi?id=1\n [ 2 ] CVE-2007-0000\n http://www.cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2007-0000\n--------... update can be installed with the "yum" update program. Use \nsu -c \'yum --enablerepo=updates-testing update TurboGears\' at the command line.\nFor more information, refer to "Managing Software with yum",\navailable at http://docs.fedoraproject.org/yum/.\n\nAll packages are signed with the Fedora Project GPG key. More details on the\nGPG keys used by the Fedora Project can be found at\nhttp://fedoraproject.org/keys\n--------------------------------------...', templates[0][1]
+ assert templates[0][1] == u'--------------------------------------------------------------------------------\nFedora Test Update Notification\nFEDORA-2010-0001\nNone\n--------------------------------------------------------------------------------\n\nName : TurboGears\nProduct : Fedora 7\nVersion : 1.0.2.2\nRelease : 2.fc7\nURL : turbogears.org\nSummary : summary\nDescription :\ndescription\n\n--------------------------------------------------------------------------------\nUpdate Information:\n\nfoobar\n--------------------------------------------------------------------------------\nReferences:\n\n [ 1 ] Bug #1 - None\n https://bugzilla.redhat.com/show_bug.cgi?id=1\n [ 2 ] CVE-2007-0000\n http://www.cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2007-0000\n--------... update can be installed with the "yum" update program. Use \nsu -c \'yum --enablerepo=updates-testing update TurboGears\' at the command line.\nFor more information, refer to "Managing Software with yum",\navailable at http://docs.fedoraproject.org/yum/.\n\nAll packages are signed with the Fedora Project GPG key. More details on the\nGPG keys used by the Fedora Project can be found at\nhttps://fedoraproject.org/keys\n-------------------------------------...', templates[0][1]
def test_latest(self):
update = self.get_update(name='yum-3.2.1-1.fc7')
@@ -548,7 +548,7 @@ class TestPackageUpdate(testutil.DBTest):
templates = get_template(update)
assert templates
assert templates[0][0] == u'[SECURITY] Fedora 7 Test Update: TurboGears-1.0.2.2-2.fc7'
- assert templates[0][1] == u'--------------------------------------------------------------------------------\nFedora Test Update Notification\nFEDORA-2010-0001\nNone\n--------------------------------------------------------------------------------\n\nName : TurboGears\nProduct : Fedora 7\nVersion : 1.0.2.2\nRelease : 2.fc7\nURL : turbogears.org\nSummary : summary\nDescription :\nZ\u2019s\n\n--------------------------------------------------------------------------------\nUpdate Information:\n\nfoobar\n--------------------------------------------------------------------------------\nReferences:\n\n [ 1 ] Bug #1 - None\n https://bugzilla.redhat.com/show_bug.cgi?id=1\n [ 2 ] CVE-2007-0000\n http://www.cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2007-0000\n--------... update can be installed with the "yum" update program. Use \nsu -c \'yum --enablerepo=updates-testing update TurboGears\' at the command line.\nFor more information, refer to "Managing Software with yum",\navailable at http://docs.fedoraproject.org/yum/.\n\nAll packages are signed with the Fedora Project GPG key. More details on the\nGPG keys used by the Fedora Project can be found at\nhttp://fedoraproject.org/keys\n--------------------------------------...'
+ assert templates[0][1] == u'--------------------------------------------------------------------------------\nFedora Test Update Notification\nFEDORA-2010-0001\nNone\n--------------------------------------------------------------------------------\n\nName : TurboGears\nProduct : Fedora 7\nVersion : 1.0.2.2\nRelease : 2.fc7\nURL : turbogears.org\nSummary : summary\nDescription :\nZ\u2019s\n\n--------------------------------------------------------------------------------\nUpdate Information:\n\nfoobar\n--------------------------------------------------------------------------------\nReferences:\n\n [ 1 ] Bug #1 - None\n https://bugzilla.redhat.com/show_bug.cgi?id=1\n [ 2 ] CVE-2007-0000\n http://www.cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2007-0000\n--------... update can be installed with the "yum" update program. Use \nsu -c \'yum --enablerepo=updates-testing update TurboGears\' at the command line.\nFor more information, refer to "Managing Software with yum",\navailable at http://docs.fedoraproject.org/yum/.\n\nAll packages are signed with the Fedora Project GPG key. More details on the\nGPG keys used by the Fedora Project can be found at\nhttps://fedoraproject.org/keys\n-------------------------------------...'
class TestBugzilla(testutil.DBTest):
commit 520f66a34b6e2ca64d82f9f7ebc21d73d2c682ec
Author: Luke Macken <lmacken(a)redhat.com>
Date: Wed Jan 27 09:07:11 2010 -0500
Apply a patch from Till Maas to s/http/https/ some of our URLs (#256)
diff --git a/bodhi/mail.py b/bodhi/mail.py
index 83ac27d..78a83a8 100644
--- a/bodhi/mail.py
+++ b/bodhi/mail.py
@@ -194,7 +194,7 @@ for more than 2 weeks if you deem it necessary.
You can submit this update to be pushed to the stable repository by going to
the following URL:
- http://admin.fedoraproject.org/updates/request/stable/%(package)s
+ https://admin.fedoraproject.org/updates/request/stable/%(package)s
or by running the following command with the bodhi-client:
@@ -218,7 +218,7 @@ or by running the following command with the bodhi-client:
To approve this update and request that it be pushed to stable, you can use
the link below:
- http://admin.fedoraproject.org/updates/approve/%(package)s
+ https://admin.fedoraproject.org/updates/approve/%(package)s
""",
'fields' : lambda x: {
'package' : x.title,
@@ -267,7 +267,7 @@ available at http://docs.fedoraproject.org/yum/.
All packages are signed with the Fedora Project GPG key. More details on the
GPG keys used by the Fedora Project can be found at
-http://fedoraproject.org/keys
+https://fedoraproject.org/keys
--------------------------------------------------------------------------------
"""
14 years, 3 months
3 commits - bodhi/masher.py bodhi/model.py comps/CVS
by Luke Macken
bodhi/masher.py | 10 +++-------
bodhi/model.py | 3 ++-
comps/CVS/Root | 2 +-
3 files changed, 6 insertions(+), 9 deletions(-)
New commits:
commit 31d8f0c475b3d0d8c4863d45de7be9081c111017
Author: Luke Macken <lmacken(a)redhat.com>
Date: Wed Jan 27 09:05:15 2010 -0500
Use the tg_url method when injecting URLs in PackageUpdate.__str__
diff --git a/bodhi/model.py b/bodhi/model.py
index fee8aa8..4a7c14e 100644
--- a/bodhi/model.py
+++ b/bodhi/model.py
@@ -29,6 +29,7 @@ from turbogears.database import PackageHub
from os.path import isfile, join
from textwrap import wrap
+from fedora.tg.util import tg_url
from bodhi import buildsys, mail
from bodhi.util import get_nvr, rpm_fileheader, header, get_age, get_age_in_days
from bodhi.util import Singleton, authorized_user, flash_log, build_evr, url
@@ -591,7 +592,7 @@ class PackageUpdate(SQLObject):
subsequent_indent=' ' * 13, width=67)
comments.append(u'\n'.join(text) + '\n')
val += u'\n'.join(comments).lstrip()
- val += u"\n %s\n" % (config.get('base_address') + url(self.get_url()))
+ val += u"\n %s\n" % (config.get('base_address') + tg_url(self.get_url()))
return val
def get_build_tag(self):
commit 921f3b87657257be3e10847e0667f67b33f274d8
Author: Luke Macken <lmacken(a)redhat.com>
Date: Tue Jan 26 19:33:17 2010 -0500
Use subprocess.call(..., cwd=path) instead of os.chdir
diff --git a/bodhi/masher.py b/bodhi/masher.py
index 97ccacb..da1fb4f 100644
--- a/bodhi/masher.py
+++ b/bodhi/masher.py
@@ -439,17 +439,13 @@ class MashTask(Thread):
our repositories
"""
log.debug("Updating comps...")
- olddir = os.getcwd()
comps_dir = config.get('comps_dir')
if not exists(comps_dir):
- os.chdir(dirname(comps_dir))
cmd = 'cvs -d %s co comps' % config.get('comps_cvs')
log.debug("running command: %s" % cmd)
- subprocess.call(cmd, shell=True)
- os.chdir(comps_dir)
- subprocess.call('cvs update', shell=True)
- subprocess.call('make', shell=True)
- os.chdir(olddir)
+ subprocess.call(cmd, shell=True, cwd=comps_dir)
+ subprocess.call('cvs update', shell=True, cwd=comps_dir)
+ subprocess.call('make', shell=True, cwd=comps_dir)
def update_symlinks(self):
""" Stage our updates repository.
commit a31e1ea7305af613d7028dd1f19a555c6e5d1b3d
Author: Luke Macken <lmacken(a)redhat.com>
Date: Tue Jan 26 19:31:55 2010 -0500
Update our comps CVS root
diff --git a/comps/CVS/Root b/comps/CVS/Root
index 6369fc0..d4915b4 100644
--- a/comps/CVS/Root
+++ b/comps/CVS/Root
@@ -1 +1 @@
-:pserver:anonymous@cvs.fedora.redhat.com:/cvs/pkgs
+:pserver:anonymous@cvs.fedoraproject.org:/cvs/pkgs
14 years, 3 months
3 commits - bodhi.egg-info/SOURCES.txt bodhi/mail.py bodhi/model.py bodhi.spec bodhi/tests
by Luke Macken
bodhi.egg-info/SOURCES.txt | 1
bodhi.spec | 2 -
bodhi/mail.py | 18 ++++++++++-
bodhi/model.py | 12 +++++++
bodhi/tests/test_controllers.py | 61 ++++++++++++++++++++++------------------
5 files changed, 64 insertions(+), 30 deletions(-)
New commits:
commit 68fb6ebdc5f29a87af3e8d909a595377fc186134
Author: Luke Macken <lmacken(a)redhat.com>
Date: Tue Jan 26 14:05:39 2010 -0500
Some critpath workflow changes and test improvements.
- If a developer +1's a critpath update that for a pending release, and it
becomes approved after, then automatically submit it to stable.
- This makes it so the workflow does not require someone to come along and
request that it be pushed to stable after it has the appropriate karma.
diff --git a/bodhi.egg-info/SOURCES.txt b/bodhi.egg-info/SOURCES.txt
index c579c72..60b8600 100644
--- a/bodhi.egg-info/SOURCES.txt
+++ b/bodhi.egg-info/SOURCES.txt
@@ -166,6 +166,7 @@ bodhi/tests/__init__.py
bodhi/tests/test_buildsystem.py
bodhi/tests/test_client.py
bodhi/tests/test_controllers.py
+bodhi/tests/test_masher.py
bodhi/tests/test_metadata.py
bodhi/tests/test_model.py
bodhi/tests/test_util.py
diff --git a/bodhi.spec b/bodhi.spec
index 663ba19..e40e5a3 100644
--- a/bodhi.spec
+++ b/bodhi.spec
@@ -3,7 +3,7 @@
Name: bodhi
Version: 0.7.0
-Release: 1%{?dist}
+Release: 2%{?dist}
Summary: A modular framework that facilitates publishing software updates
Group: Applications/Internet
License: GPLv2+
diff --git a/bodhi/mail.py b/bodhi/mail.py
index 7cad3ee..83ac27d 100644
--- a/bodhi/mail.py
+++ b/bodhi/mail.py
@@ -433,7 +433,7 @@ def send(to, msg_type, update, sender=None):
to = [to]
for person in to:
send_mail(sender, person, '[Fedora Update] %s[%s] %s' % (
- if update.critpath and '[CRITPATH] ' or '',
+ update.critpath and '[CRITPATH] ' or '',
msg_type, update.title), messages[msg_type]['body'] %
messages[msg_type]['fields'](update))
diff --git a/bodhi/model.py b/bodhi/model.py
index 00d69bf..fee8aa8 100644
--- a/bodhi/model.py
+++ b/bodhi/model.py
@@ -689,9 +689,11 @@ class PackageUpdate(SQLObject):
as stable. If it reaches the 'unstable_karma', it is unpushed.
"""
if not author: author = identity.current.user_name
+ critpath_approved = self.critpath_approved
# Hack: Add admin groups to usernames (eg: "lmacken (releng)")
admin_groups = config.get('admin_groups', 'releng qa security_respons').split()
+
for group in identity.current.groups:
if group in admin_groups:
author += ' (%s)' % group
@@ -736,6 +738,14 @@ class PackageUpdate(SQLObject):
people.add(comment.author.split()[0])
mail.send(people, 'comment', self)
+ # If we're a Critical Path update for a pending release
+ if self.critpath and self.release.locked:
+ # If we weren't approved before, and now are, push to stable
+ if not critpath_approved and self.critpath_approved:
+ self.comment('Critical path update approved', author='bodhi')
+ self.request = 'stable'
+ mail.send_admin('critpath_approved', self)
+
def unpush(self):
""" Move this update back to its dist-fX-updates-candidate tag """
koji = buildsys.get_session()
diff --git a/bodhi/tests/test_controllers.py b/bodhi/tests/test_controllers.py
index de6755e..b998952 100644
--- a/bodhi/tests/test_controllers.py
+++ b/bodhi/tests/test_controllers.py
@@ -1285,6 +1285,14 @@ class TestControllers(testutil.DBTest):
assert "Push to Stable" in cherrypy.response.body[0]
assert "Push to Testing" in cherrypy.response.body[0]
+ testutil.create_request('/updates/request/stable/%s' % params['builds'],
+ method='GET', headers=session)
+ update = PackageUpdate.byTitle(params['builds'])
+
+ # We're allowing devs to still request critpath updates to stable
+ # without a karma prerequisite for non-pending releases.
+ assert update.request == 'stable'
+
def test_non_critpath_actions_in_normal_release(self):
session = login()
create_release()
@@ -1324,27 +1332,10 @@ class TestControllers(testutil.DBTest):
update = PackageUpdate.byTitle(params['builds'])
assert update.request == 'testing'
- def test_push_critpath_to_frozen_release_and_request_stable(self):
- session = login()
- create_release(locked=True)
- params = {
- 'builds' : 'kernel-2.6.31-1.fc7',
- 'release' : 'Fedora 7',
- 'type_' : 'bugfix',
- 'bugs' : '',
- 'notes' : 'foobar',
- 'stable_karma' : 1,
- 'request': 'stable',
- 'unstable_karma' : -1,
- }
- self.save_update(params, session)
- update = PackageUpdate.byTitle(params['builds'])
- assert update.request == 'testing'
-
# Ensure we can't create a stable request
testutil.capture_log(["bodhi.util", "bodhi.controllers", "bodhi.model"])
testutil.create_request('/updates/request/stable/%s' % params['builds'],
- method='POST', headers=session)
+ method='POST', headers=session)
log = testutil.get_log()
assert "Forcing critical path update into testing" in log
update = PackageUpdate.byTitle(params['builds'])
@@ -1367,6 +1358,15 @@ class TestControllers(testutil.DBTest):
update = PackageUpdate.byTitle(params['builds'])
assert update.request == 'testing'
+ # Ensure we can't create a stable request
+ testutil.capture_log(["bodhi.util", "bodhi.controllers", "bodhi.model"])
+ testutil.create_request('/updates/request/stable/%s' % params['builds'],
+ method='POST', headers=session)
+ log = testutil.get_log()
+ assert "Critical path update not yet approved!" in log, log
+ update = PackageUpdate.byTitle(params['builds'])
+ assert update.request == 'testing'
+
def test_critpath_to_frozen_release_available_actions(self):
"""
Ensure devs can attempt to push critpath updates for pending releases
@@ -1435,6 +1435,15 @@ class TestControllers(testutil.DBTest):
assert len(update.comments) == 1
assert update.comments[0].author == 'bob'
+ # Make sure not even releng can submit it to stable until it gets another
+ # approval
+ testutil.create_request('/updates/request/stable/%s' % params['builds'],
+ method='GET', headers=releng)
+ update = PackageUpdate.byTitle(params['builds'])
+ assert update.request == 'testing'
+ assert update.karma == 1
+ update.request = None
+
# Have another developer +1 it, so it gets up to +2
# Ensure we can't push it to stable, until we get admin approval
testutil.create_request('/updates/comment?text=foobar&title=%s&karma=1' %
@@ -1444,8 +1453,11 @@ class TestControllers(testutil.DBTest):
method='GET', headers=login(username='foobar'))
assert "Push Critical Path update to Stable" not in cherrypy.response.body[0]
update = PackageUpdate.byTitle(params['builds'])
- assert not update.request
assert update.karma == 2
+ assert update.request == 'stable'
+
+ # Reset it, and have releng approve it as well
+ update.request = None
# Have releng try again, and ensure it can be pushed to stable
testutil.create_request('/updates/comment?text=foobar&title=%s&karma=1' %
@@ -1569,15 +1581,10 @@ class TestControllers(testutil.DBTest):
headers=login(username='bob'))
update = PackageUpdate.byTitle(params['builds'])
- assert len(update.comments) == 2
+ assert len(update.comments) == 3, update.comments
assert update.comments[1].author == 'bob', update.comments
-
- testutil.create_request('/updates/%s' % params['builds'],
- method='GET', headers=session)
- update = PackageUpdate.byTitle(params['builds'])
- assert update.comments[0].author == 'guest (qa)'
-
- assert "Mark Critical Path update as Stable" in cherrypy.response.body[0], cherrypy.response.body[0]
+ assert update.comments[2].author == 'bodhi', update.comments
+ assert update.comments[2].text == 'Critical path update approved'
def test_created_since(self):
session = login()
commit b4814867cacae7f1f52b008545eea20291f4b900
Author: Luke Macken <lmacken(a)redhat.com>
Date: Tue Jan 26 13:52:08 2010 -0500
Send an email to releng once critical path updates get approved
diff --git a/bodhi/mail.py b/bodhi/mail.py
index 1842e17..7cad3ee 100644
--- a/bodhi/mail.py
+++ b/bodhi/mail.py
@@ -227,6 +227,19 @@ the link below:
}
},
+ 'critpath_approved' : {
+ 'body' : u"""\
+The Critical Path update `%(package)s` has been approved.
+
+%(updatestr)s
+
+""",
+ 'fields' : lambda x: {
+ 'package' : x.title,
+ 'updatestr' : unicode(x)
+ }
+ },
+
}
fedora_errata_template = u"""\
diff --git a/bodhi/model.py b/bodhi/model.py
index 9a0ecbb..00d69bf 100644
--- a/bodhi/model.py
+++ b/bodhi/model.py
@@ -414,9 +414,11 @@ class PackageUpdate(SQLObject):
for group in identity.current.groups:
if group in admin_groups:
if not self.critpath_approved:
+ log.info("Critical path update not yet approved!")
action = 'testing'
self.comment('Critical path update approved',
author=identity.current.user_name)
+ mail.send_admin('critpath_approved', self)
break
else:
log.info('Forcing critical path update into testing')
commit d38f67834943129ea857a3fce3e9e9677a6ee0e4
Author: Luke Macken <lmacken(a)redhat.com>
Date: Tue Jan 26 13:39:23 2010 -0500
Mark emails to admins as [CRITPATH] when necessary
diff --git a/bodhi/mail.py b/bodhi/mail.py
index 6c11187..1842e17 100644
--- a/bodhi/mail.py
+++ b/bodhi/mail.py
@@ -419,8 +419,9 @@ def send(to, msg_type, update, sender=None):
if type(to) not in (list, set, tuple):
to = [to]
for person in to:
- send_mail(sender, person, '[Fedora Update] [%s] %s' % (msg_type,
- update.title), messages[msg_type]['body'] %
+ send_mail(sender, person, '[Fedora Update] %s[%s] %s' % (
+ if update.critpath and '[CRITPATH] ' or '',
+ msg_type, update.title), messages[msg_type]['body'] %
messages[msg_type]['fields'](update))
def send_releng(subject, body):
14 years, 3 months