bodhi/buildsys.py | 8 +++++
bodhi/controllers.py | 37 ++++++++----------------
bodhi/masher.py | 17 +++++++++++
bodhi/model.py | 60 ++++++++++++++++++++++++++--------------
bodhi/tests/test_client.py | 8 ++---
bodhi/tests/test_controllers.py | 20 ++++++-------
6 files changed, 89 insertions(+), 61 deletions(-)
New commits:
commit 05e91fbd267df54e9830c0bb28126dbd08b5ab05
Author: Luke Macken <lmacken(a)redhat.com>
Date: Mon Aug 30 16:58:51 2010 -0400
Update our DevBuildsys to get our test suite working with the new 'pending'
tags
diff --git a/bodhi/buildsys.py b/bodhi/buildsys.py
index d4ce7f0..fc4a2e8 100644
--- a/bodhi/buildsys.py
+++ b/bodhi/buildsys.py
@@ -41,15 +41,23 @@ class Buildsystem(object):
def listTagged(self): raise NotImplementedError
def taskFinished(self): raise NotImplementedError
def untagBuild(self): raise NotImplementedError
+ def tagBuild(self): raise NotImplementedError
class DevBuildsys(Buildsystem):
"""
A dummy buildsystem instance used during development and testing
"""
+
+ def multiCall(self):
+ pass
+
def moveBuild(self, *args, **kw):
log.debug("moveBuild(%s, %s)" % (args, kw))
+ def tagBuild(self, *args, **kw):
+ log.debug("tagBuild(%s, %s)" % (args, kw))
+
def untagBuild(self, *args, **kw):
log.debug("untagBuild(%s, %s)" % (args, kw))
commit 678384d0dae8228a28d2a3d17e03a091eb2d4d15
Author: Luke Macken <lmacken(a)redhat.com>
Date: Mon Aug 30 16:51:10 2010 -0400
Have bodhi start managing the 'pending' koji tags.
When an update is initially requested to be pushed to testing, bodhi
will add a dist-fNN-updates-testing-pending tag to the builds. From
here, AutoQA will automatically handle mashing repositories of these
pending builds to perform various tests on.
Once requested to go to the stable repository, bodhi will then add the
dist-fNN-updates-pending tag to all of the builds so that AutoQA can perform a
second round of sanity checks.
When pushed, bodhi will handle removing these tags.
Once AutoQA is good to go, then bodhi will need to ensure that no updates can
be pushed to the corresponding repos until AutoQA gives it the appropriate
karma
diff --git a/bodhi/masher.py b/bodhi/masher.py
index be0a318..239ee75 100644
--- a/bodhi/masher.py
+++ b/bodhi/masher.py
@@ -431,6 +431,17 @@ class MashTask(Thread):
if not self.success:
raise MashTaskException("Failed to move builds")
+ def remove_pending_tags(self):
+ """ Remove all pending tags from these updates """
+ log.debug("Removing pending tags from builds")
+ self.koji.multicall = True
+ for update in self.updates:
+ if update.request == 'stable':
+ update.remove_tag(update.release.pending_stable_tag, koji=self.koji)
+ elif update.request == 'testing':
+ update.remove_tag(update.release.pending_testing_tag, koji=self.koji)
+ self.koji.multiCall()
+
# With a large pushes, this tends to cause much buildsystem churn, as well
# as polluting the tag history.
#def undo_move(self):
@@ -611,6 +622,12 @@ class MashTask(Thread):
if not self.resume and len(self.updates):
self.move_builds()
+ # Remove all pending tags
+ # TODO: Once AutoQA is Good To Go, then we'll want to prevent
+ # updates from being pushed if they have not gotten the appropriate
+ # karma from AutoQA. For now, bodhi is simply handling the pending tags.
+ self.remove_pending_tags()
+
# Mash our repositories
self.mash()
diff --git a/bodhi/model.py b/bodhi/model.py
index 99cc696..80f7f99 100644
--- a/bodhi/model.py
+++ b/bodhi/model.py
@@ -97,6 +97,14 @@ class Release(SQLObject):
return '%s-updates' % self.dist_tag
@property
+ def pending_testing_tag(self):
+ return self.testing_tag + '-pending'
+
+ @property
+ def pending_stable_tag(self):
+ return self.stable_tag + '-pending'
+
+ @property
def stable_repo(self):
id = self.name.replace('-', '').lower()
if self.name.startswith('EL'): # EPEL Hack.
@@ -476,6 +484,13 @@ class PackageUpdate(SQLObject):
else:
action = 'testing'
+ # Add the appropriate 'pending' koji tag to this update, so tools like
+ # AutoQA can mash repositories of them for testing.
+ if action == 'testing':
+ self.add_tag(self.release.pending_testing_tag)
+ elif action == 'stable':
+ self.add_tag(self.release.pending_stable_tag)
+
self.request = action
self.pushed = False
#self.date_pushed = None
@@ -885,6 +900,30 @@ class PackageUpdate(SQLObject):
else:
self.comment("This update has been obsoleted",
author='bodhi')
+ def add_tag(self, tag, koji=None):
+ """ Add a koji tag to all builds in this update
"""
+ log.debug('Adding tag %s to %s' % (tag, self.title))
+ return_multicall = not koji
+ if not koji:
+ koji = buildsys.get_session()
+ koji.multicall = True
+ for build in self.builds:
+ koji.tagBuild(tag, build.nvr, force=True)
+ if return_multicall:
+ return koji.multiCall()
+
+ def remove_tag(self, tag, koji=None):
+ """ Remove a koji tag from all builds in this update
"""
+ log.debug('Removing tag %s from %s' % (tag, self.title))
+ return_multicall = not koji
+ if not koji:
+ koji = buildsys.get_session()
+ koji.multicall = True
+ for build in self.builds:
+ koji.untagBuild(tag, build.nvr, force=True)
+ if return_multicall:
+ return koji.multiCall()
+
def get_maintainers(self):
"""
Return a list of people that have commit access to all of the packages
commit 5dc046972ce2cb0ce68e5ebb22872e44e040fd8f
Merge: af0b95c... e794fa9...
Author: Luke Macken <lmacken(a)redhat.com>
Date: Fri Aug 27 03:02:15 2010 -0400
Merge branch 'master' of
git+ssh://git.fedorahosted.org/git/bodhi
commit af0b95c13835d963f508195e9476395f2f2aed1e
Author: Luke Macken <lmacken(a)redhat.com>
Date: Wed Aug 18 17:18:55 2010 -0400
Revert "Obsolete updates when they are deleted, as opposed to destroying
them."
This reverts commit a83245afb74d2ccf23e326d26e82a490eb51951f.
diff --git a/bodhi/controllers.py b/bodhi/controllers.py
index 2b2f2ce..216c390 100644
--- a/bodhi/controllers.py
+++ b/bodhi/controllers.py
@@ -450,30 +450,19 @@ class Root(controllers.RootController):
flash_log("Cannot delete an update you did not submit")
if request_format() == 'json': return dict()
raise redirect(update.get_url())
-
- # We're no longer deleting anything from our database
- # "Deleting" an update will now obsolete it
- # In the TG2 port, we should have a seperate state for this
-
- update.move_to_candidate()
- update.status = 'obsolete'
- update.comment("This update has been obsoleted")
- flash_log('Obsoleted <a href="%s">%s</a>' %
(update.get_url(),
- update.title))
-
- #if not update.pushed:
- # msg = "Deleted %s" % update.title
- # map(lambda x: x.destroySelf(), update.comments)
- # for build in update.builds:
- # if len(build.updates) == 1:
- # build.destroySelf()
- # update.untag()
- # update.destroySelf()
- # flash_log(msg)
- # mail.send_admin('deleted', update)
- # mail.send(update.people_to_notify(), 'deleted', update)
- #else:
- # flash_log("Cannot delete a pushed update")
+ if not update.pushed:
+ msg = "Deleted %s" % update.title
+ map(lambda x: x.destroySelf(), update.comments)
+ for build in update.builds:
+ if len(build.updates) == 1:
+ build.destroySelf()
+ update.untag()
+ update.destroySelf()
+ flash_log(msg)
+ mail.send_admin('deleted', update)
+ mail.send(update.people_to_notify(), 'deleted', update)
+ else:
+ flash_log("Cannot delete a pushed update")
except SQLObjectNotFound:
flash_log("Update %s does not exist" % update)
if request_format() == 'json': return dict()
diff --git a/bodhi/model.py b/bodhi/model.py
index a0bd626..eacb2ae 100644
--- a/bodhi/model.py
+++ b/bodhi/model.py
@@ -850,27 +850,6 @@ class PackageUpdate(SQLObject):
self.status = 'pending'
mail.send_admin('unpushed', self)
- def move_to_candidate(self):
- """ Move this update back to the candidate tag """
- log.info("Moving %s back to %s" % (self.title,
- self.release.candidate_tag))
- koji = buildsys.get_session()
- known_tags = (self.release.candidate_tag, self.release.testing_tag)
- for build in self.builds:
- for tag in build.get_tags():
- if tag in known_tags:
- try:
- koji.moveBuild(tag, self.release.candidate_tag,
- build.nvr, force=True)
- break
- except Exception, e:
- log.exception(e)
- log.error('There was a problem moving %s' % build.nvr)
- else:
- log.warning("Not moving tag: %s" % tag)
- if self.pushed:
- self.pushed = False
-
def untag(self):
""" Untag all of the builds in this update """
log.info("Untagging %s" % self.title)
diff --git a/bodhi/tests/test_client.py b/bodhi/tests/test_client.py
index 7892fd3..9a197fa 100644
--- a/bodhi/tests/test_client.py
+++ b/bodhi/tests/test_client.py
@@ -114,13 +114,11 @@ class TestClient(testutil.DBTest):
bodhi = self.__get_bodhi_client()
opts = self.__get_opts()
self.__save_update(self.build, opts, bodhi)
- up = PackageUpdate.byTitle(self.build)
- assert up.status == 'pending'
+ assert PackageUpdate.byTitle(self.build)
data = bodhi.delete(update=self.build)
try:
- up = PackageUpdate.byTitle(self.build)
- assert up.status == 'obsolete'
- #assert False, "Update not deleted properly"
+ PackageUpdate.byTitle(self.build)
+ assert False, "Update not deleted properly"
except SQLObjectNotFound:
pass
diff --git a/bodhi/tests/test_controllers.py b/bodhi/tests/test_controllers.py
index 96ce0fd..eb50604 100644
--- a/bodhi/tests/test_controllers.py
+++ b/bodhi/tests/test_controllers.py
@@ -573,20 +573,18 @@ class TestControllers(testutil.DBTest):
headers=session)
try:
update = PackageUpdate.byTitle(params['builds'])
- assert update.status == 'obsolete', update.status
- #print update
- #assert False, "Update never deleted!"
+ print update
+ assert False, "Update never deleted!"
except SQLObjectNotFound:
pass
- # We're not deleting any builds or updates anymore...
- #for build in params['builds'].split(','):
- # try:
- # build = PackageBuild.byNvr(build)
- # print build
- # assert False, "Build never deleted!"
- # except SQLObjectNotFound:
- # pass
+ for build in params['builds'].split(','):
+ try:
+ build = PackageBuild.byNvr(build)
+ print build
+ assert False, "Build never deleted!"
+ except SQLObjectNotFound:
+ pass
def test_requests(self):
session = login()