bodhi/controllers.py | 8 ++++---- bodhi/templates/testing.kid | 2 +- bodhi/tests/test_controllers.py | 29 +++++++++++++++++++++++++++++ bodhi/tools/client.py | 24 ++++++++++++------------ bodhi/util.py | 12 ++++++++++++ 5 files changed, 58 insertions(+), 17 deletions(-)
New commits: commit 3c6d2b61d714dc158286d70e01b6e1518310613b Author: Luke Macken lmacken@redhat.com Date: Tue Jul 13 18:18:54 2010 -0400
Add a unit test to ensure we don't allow updates with multiple versions of the same package (#264). This test currently fails..
diff --git a/bodhi/tests/test_controllers.py b/bodhi/tests/test_controllers.py index ed06a03..8151317 100644 --- a/bodhi/tests/test_controllers.py +++ b/bodhi/tests/test_controllers.py @@ -2215,3 +2215,32 @@ class TestControllers(testutil.DBTest): self.save_update(params, session) update = PackageUpdate.byTitle(params['builds']) assert update.request == 'stable', update.request + + def test_duplicate_packages(self): + """ + Ensure that bodhi disallows submitting an update with two versions + of the same package (#264). + """ + session = login() + create_release() + params = { + 'builds' : 'TurboGears-1.0.8-1.fc7,TurboGears-1.0.8-2.fc7', + 'release' : 'Fedora 7', + 'type_' : 'bugfix', + 'bugs' : '', + 'notes' : 'foobar', + 'request' : 'Stable', + 'suggest_reboot' : True, + 'autokarma' : True, + 'stable_karma' : 5, + 'unstable_karma' : -5 + } + testutil.capture_log(['bodhi.controller', 'bodhi.util']) + self.save_update(params, session) + log = testutil.get_log() + assert "You cannot submit an update containing multiple versions of TurboGears" in log, log + try: + up = PackageUpdate.byTitle(params['builds']) + assert False, "Update with duplicate packages was saved!" + except SQLObjectNotFound, e: + pass
commit 44f5d5a0ab0e6a638ac0b9722d773f388057a8e8 Author: Till Maas opensource@till.name Date: Sun Jul 4 10:15:12 2010 +0200
print query results to stdout instead of stderr
This allows to use the information one is interested in other scripts using a pipe, e.g. to get a list of critpath builds that are not yet approved, one can use:
./client.py 2>/dev/null --critpath --untested --release F13 | cut -d" " -f 2
diff --git a/bodhi/tools/client.py b/bodhi/tools/client.py index c796abb..fb058b2 100755 --- a/bodhi/tools/client.py +++ b/bodhi/tools/client.py @@ -157,7 +157,7 @@ def main(): log.info(data['tg_flash']) if 'updates' in data: for update in data['updates']: - log.info(bodhi.update_str(update)) + print(bodhi.update_str(update).encode("UTF-8"))
else: verify_args(args) @@ -177,7 +177,7 @@ def main(): log.info(data['tg_flash']) if 'updates' in data: for update in data['updates']: - log.info(bodhi.update_str(update)) + print(bodhi.update_str(update).encode("UTF-8"))
elif opts.edit: verify_args(args) @@ -187,14 +187,14 @@ def main(): request=opts.request) log.info(data['tg_flash']) if data.has_key('update'): - log.info(bodhi.update_str(data['update'])) + print(bodhi.update_str(data['update']).encode("UTF-8"))
elif opts.request: verify_args(args) data = bodhi.request(update=args[0], request=opts.request) log.info(data['tg_flash']) if data.has_key('update'): - log.info(bodhi.update_str(data['update'])) + print(bodhi.update_str(data['update']).encode("UTF-8"))
elif opts.delete: verify_args(args) @@ -283,7 +283,7 @@ def main(): if opts.type_: if not update['type'] == opts.type_: continue - log.info(bodhi.update_str(update, minimal=opts.verbose)) + print(bodhi.update_str(update, minimal=opts.verbose).encode("UTF-8"))
elif opts.candidates: for build in bodhi.candidates(): @@ -298,7 +298,7 @@ def main(): if data['tg_flash']: log.info(data['tg_flash']) if data.has_key('update'): - log.info(bodhi.update_str(data['update'])) + print(bodhi.update_str(data['update']).encode("UTF-8"))
elif opts.latest: data = bodhi.latest_builds(package=opts.latest) @@ -310,7 +310,7 @@ def main(): data.sort(cmp=lambda x, y: cmp(x[0].split('-')[1], y[0].split('-')[1])) for dist, build in data: - log.info('%26s %s' % (dist, build)) + print('%26s %s' % (dist, build))
elif opts.critpath: log.info("Getting a list of critical path updates...") @@ -321,14 +321,14 @@ def main(): if data['tg_flash']: log.info(data['tg_flash']) for update in data['updates']: - log.info(bodhi.update_str(update, minimal=not opts.verbose)) + print(bodhi.update_str(update, minimal=not opts.verbose).encode("UTF-8")) log.info("%d pending critical path updates found" % ( len(data['updates'])))
elif opts.mine and not args: data = bodhi.query(mine=opts.mine) for update in data['updates']: - log.info(bodhi.update_str(update, minimal=True)) + print(bodhi.update_str(update, minimal=True).encode("UTF-8")) log.debug(data) log.info(data['title'])
@@ -340,12 +340,12 @@ def main(): sys.exit(-1) if data['num_items'] > 1: for update in data['updates']: - log.info(bodhi.update_str(update, minimal=True)) + print(bodhi.update_str(update, minimal=True).encode("UTF-8")) log.info("%d updates found (%d shown)" % ( data['num_items'], len(data['updates']))) else: for update in data['updates']: - log.info(bodhi.update_str(update)) + print(bodhi.update_str(update).encode("UTF-8")) if args: for arg in args: data = bodhi.query(package=arg, release=opts.release, @@ -369,7 +369,7 @@ def main(): log.info("%d possible updates were found" % len(data['updates'])) for update in data['updates']: - log.info(bodhi.update_str(update, minimal=True)) + print(bodhi.update_str(update, minimal=True).encode("UTF-8")) else: update = data['updates'][0] log.info("Downloading %s..." % update['title'])
commit 902da8129903a0390a8f591e1ab7b3dedf10a776 Author: Till Maas opensource@till.name Date: Tue Jul 13 22:43:03 2010 +0200
link to submitter and release on home page
diff --git a/bodhi/controllers.py b/bodhi/controllers.py index d26ffc6..bdbfd3e 100644 --- a/bodhi/controllers.py +++ b/bodhi/controllers.py @@ -43,7 +43,7 @@ from fedora.tg.controllers import logout as fc_logout from bodhi import buildsys, util 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 make_update_link, make_type_icon, make_karma_icon, link, make_release_link, make_submitter_link from bodhi.util import flash_log, get_pkg_pushers, make_request_icon from bodhi.util import json_redirect, url, get_nvr from bodhi.admin import AdminController @@ -115,12 +115,12 @@ class Root(controllers.RootController): ).reversed(), [ ('Update', make_update_link), - ('Release', lambda row: row.release.long_name), + ('Release', make_release_link), ('Status', lambda row: row.status), ('Type', make_type_icon), ('Request', make_request_icon), ('Karma', make_karma_icon), - ('Submitter', lambda row: row.submitter), + ('Submitter', make_submitter_link), ('Age', lambda row: row.get_submitted_age()), ] ] @@ -133,7 +133,7 @@ class Root(controllers.RootController): ).reversed(), [ ('Update', make_update_link), - ('Release', lambda row: row.release.long_name), + ('Release', make_release_link), ('Status', lambda row: row.status), ('Type', make_type_icon), ('Request', make_request_icon), diff --git a/bodhi/util.py b/bodhi/util.py index 7c1de11..ae70da6 100644 --- a/bodhi/util.py +++ b/bodhi/util.py @@ -167,6 +167,18 @@ def make_karma_icon(update): karma = 0 return Element('img', src=url('/static/images/karma%d.png' % karma))
+def make_link(text, href): + link = Element('a', href=url(href)) + link.text = text + return link + +def make_release_link(update): + return make_link(update.release.long_name, '/' + update.release.name) + +def make_submitter_link(update): + return make_link(update.submitter, '/user/' + update.submitter) + + def get_age(date): age = datetime.utcnow() - date if age.days == 0:
commit 0dc7352d1b67d1545a61912ec0c5e6dea365501f Author: Till Maas opensource@till.name Date: Tue Jul 13 22:16:22 2010 +0200
Link to submitter page in testing updates list
diff --git a/bodhi/templates/testing.kid b/bodhi/templates/testing.kid index 8f63743..8cd6f57 100644 --- a/bodhi/templates/testing.kid +++ b/bodhi/templates/testing.kid @@ -58,7 +58,7 @@ <img src="${tg.url('/static/images/karma%d.png' % karma)}" align="top"/> <b>${update.karma}</b> </td> <td class="list"> - ${update.submitter} + <a href="${tg.url('/user/' + update.submitter)}">${update.submitter}</a> </td> <td class="list"> ${update.date_pushed}