bodhi.egg-info/PKG-INFO | 2 +-
bodhi.egg-info/SOURCES.txt | 2 ++
bodhi.spec | 5 ++++-
bodhi/model.py | 38 +++++++++++++++++++++++++++++++-------
bodhi/release.py | 2 +-
bodhi/tests/test_metadata.py | 6 +++---
bodhi/tests/test_model.py | 27 +++++++++++++++++++++++++--
7 files changed, 67 insertions(+), 15 deletions(-)
New commits:
commit 471d3a5e48aa615f6f94dbb6c10f71771ec3a69f
Author: Luke Macken <lmacken(a)redhat.com>
Date: Mon Nov 24 13:31:53 2008 -0500
Fix some unit tests that broke due to our date_pushed change
diff --git a/bodhi/tests/test_metadata.py b/bodhi/tests/test_metadata.py
index 904ebbe..5424500 100644
--- a/bodhi/tests/test_metadata.py
+++ b/bodhi/tests/test_metadata.py
@@ -70,7 +70,7 @@ class TestExtendedMetadata(testutil.DBTest):
assert notice['updated'] == update.date_modified
assert notice['from'] == str(config.get('bodhi_email'))
assert notice['description'] == update.notes
- assert notice['issued'] == 'None'
+ assert notice['issued'] != None
assert notice['update_id'] == update.updateid
cve = notice['references'][0]
assert cve['type'] == 'cve'
@@ -141,7 +141,7 @@ class TestExtendedMetadata(testutil.DBTest):
assert notice['updated'] == update.date_modified
assert notice['from'] == str(config.get('bodhi_email'))
assert notice['description'] == update.notes
- assert notice['issued'] == 'None'
+ assert notice['issued'] != None
assert notice['update_id'] == update.updateid
cve = notice['references'][0]
assert cve['type'] == 'cve'
@@ -176,7 +176,7 @@ class TestExtendedMetadata(testutil.DBTest):
assert notice['updated'] == update.date_modified
assert notice['from'] == str(config.get('bodhi_email'))
assert notice['description'] == update.notes
- assert notice['issued'] == 'None'
+ assert notice['issued'] != None
assert notice['update_id'] == update.updateid
cve = notice['references'][0]
assert cve['type'] == 'cve'
diff --git a/bodhi/tests/test_model.py b/bodhi/tests/test_model.py
index eab511e..91ae71e 100644
--- a/bodhi/tests/test_model.py
+++ b/bodhi/tests/test_model.py
@@ -253,10 +253,11 @@ class TestPackageUpdate(testutil.DBTest):
build.get_rpm_header = rpm_header
build.get_latest = latest
+ update.date_pushed = None
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-2008-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-newkey 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-2008-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]
def test_latest(self):
update = self.get_update(name='yum-3.2.1-1.fc7')
@@ -512,10 +513,11 @@ class TestPackageUpdate(testutil.DBTest):
build.get_rpm_header = rpm_header
build.get_latest = latest
+ update.date_pushed = None
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-2008-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-newkey 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-2008-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--------------------------------------...
class TestBugzilla(testutil.DBTest):
commit 10291ebb88c628876ff1d89264ffa9297e527d9f
Author: Luke Macken <lmacken(a)redhat.com>
Date: Sat Nov 22 18:27:40 2008 -0500
Righteous hack for the 10k bug.
Due to a flaw in the way the PackageUpdate.assign_id method finds the update
with the highest id, when we reached 10,000 updates this year, it started to
fail. The previous method ordered updates by the updateid string column, which
now fails since u'FEDORA-2008-10000' < u'FEDORA-2008-9999'.
This patch changes this query to grab the most recent update based on the
date_pushed column. This technically should also have the highest updateid.
However, since SQLObject completely ignores milliseconds, we need to also
take into account multiple updates being pushed during the same second.
This changeset also includes a testcase for the 10k bug.
diff --git a/bodhi/model.py b/bodhi/model.py
index 2bc7c07..8767c43 100644
--- a/bodhi/model.py
+++ b/bodhi/model.py
@@ -258,19 +258,37 @@ class PackageUpdate(SQLObject):
if self.updateid != None and self.updateid != u'None':
log.debug("Keeping current update id %s" % self.updateid)
return
- update = PackageUpdate.select(PackageUpdate.q.updateid != 'None',
- orderBy=PackageUpdate.q.updateid)
+
+ updates = PackageUpdate.select(
+ AND(PackageUpdate.q.date_pushed != None,
+ PackageUpdate.q.updateid != None),
+ orderBy=PackageUpdate.q.date_pushed, limit=1).reversed()
+
try:
- prefix, year, id = update[-1].updateid.split('-')
+ update = updates[0]
+
+ # We need to check if there are any other updates that were pushed
+ # at the same time, since SQLObject ignores milliseconds
+ others = PackageUpdate.select(
+ PackageUpdate.q.date_pushed == update.date_pushed)
+ if others.count() > 1:
+ # find the update with the highest id
+ for other in others:
+ if other.updateid_int > update.updateid_int:
+ update = other
+
+ prefix, year, id = update.updateid.split('-')
if int(year) != time.localtime()[0]: # new year
id = 0
id = int(id) + 1
- except (AttributeError, IndexError):
- id = 1
+ except IndexError:
+ id = 1 # First update
+
self.updateid = u'%s-%s-%0.4d' % (self.release.id_prefix,
time.localtime()[0],id)
log.debug("Setting updateid for %s to %s" % (self.title,
self.updateid))
+ self.date_pushed = datetime.utcnow()
hub.commit()
def set_request(self, action, pathcheck=True):
@@ -356,7 +374,6 @@ class PackageUpdate(SQLObject):
"""
if self.request == 'testing':
self.pushed = True
- self.date_pushed = datetime.utcnow()
self.status = 'testing'
self.assign_id()
elif self.request == 'obsolete':
@@ -364,7 +381,6 @@ class PackageUpdate(SQLObject):
self.status = 'obsolete'
elif self.request == 'stable':
self.pushed = True
- self.date_pushed = datetime.utcnow()
self.status = 'stable'
self.assign_id()
self.request = None
@@ -742,6 +758,14 @@ class PackageUpdate(SQLObject):
sorted.sort(lambda x, y: cmp(x.timestamp, y.timestamp))
return sorted
+ @property
+ def updateid_int(self):
+ """ Return the integer $ID from the 'FEDORA-2008-$ID'
updateid """
+ if not self.updateid:
+ return None
+ prefix, year, id = self.updateid.split('-')
+ return int(id)
+
class Comment(SQLObject):
timestamp = DateTimeCol(default=datetime.utcnow)
diff --git a/bodhi/tests/test_model.py b/bodhi/tests/test_model.py
index b654fe8..eab511e 100644
--- a/bodhi/tests/test_model.py
+++ b/bodhi/tests/test_model.py
@@ -109,11 +109,32 @@ class TestPackageUpdate(testutil.DBTest):
update.assign_id()
assert update.updateid == '%s-%s-0001' % (update.release.id_prefix,
time.localtime()[0])
+ assert update.date_pushed
update = self.get_update(name='TurboGears-0.4.4-8.fc7')
update.assign_id()
assert update.updateid == '%s-%s-0002' % (update.release.id_prefix,
time.localtime()[0])
+ # 10k bug
+ update.updateid = 'FEDORA-2008-9999'
+ newupdate = self.get_update(name='nethack-2.5.6-1.fc10')
+ newupdate.assign_id()
+ assert newupdate.updateid == 'FEDORA-2008-10000'
+
+ newerupdate = self.get_update(name='nethack-2.5.7-1.fc10')
+ newerupdate.assign_id()
+ assert newerupdate.updateid == 'FEDORA-2008-10001'
+
+ # test updates that were pushed at the same time. assign_id should
+ # be able to figure out which one has the highest id.
+ now = datetime.utcnow()
+ newupdate.date_pushed = now
+ newerupdate.date_pushed = now
+
+ newest = self.get_update(name='nethack-2.5.8-1.fc10')
+ newest.assign_id()
+ assert newest.updateid == 'FEDORA-2008-10002'
+
def test_url(self):
update = self.get_update()
print "URL = ", update.get_url()
commit 3cbc992f54453e8d3cc254e29143f8f9d53bc22a
Author: Luke Macken <lmacken(a)redhat.com>
Date: Fri Nov 21 13:41:55 2008 -0500
0.5.11
diff --git a/bodhi.egg-info/PKG-INFO b/bodhi.egg-info/PKG-INFO
index f0365e1..195bd60 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.5.9
+Version: 0.5.11
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 02c1fc9..ddc3168 100644
--- a/bodhi.egg-info/SOURCES.txt
+++ b/bodhi.egg-info/SOURCES.txt
@@ -39,6 +39,8 @@ bodhi.egg-info/sqlobject.txt
bodhi.egg-info/top_level.txt
bodhi/config/__init__.py
bodhi/config/app.cfg
+bodhi/config/f10-updates-testing.mash
+bodhi/config/f10-updates.mash
bodhi/config/f7-updates-testing.mash
bodhi/config/f7-updates.mash
bodhi/config/f8-updates-testing.mash
diff --git a/bodhi.spec b/bodhi.spec
index 79469e2..2cacb87 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.5.10
+Version: 0.5.11
Release: 1%{?dist}
Summary: A modular framework that facilitates publishing software updates
Group: Applications/Internet
@@ -113,6 +113,9 @@ rm -rf bodhi/tests bodhi/tools/test-bodhi.py
%changelog
+* Fri Nov 21 2008 Luke Macken <lmacken(a)redhat.com> - 0.5.11-1
+- Various F10 release tweaks
+
* Fri Oct 24 2008 Luke Macken <lmacken(a)redhat.com> - 0.5.10-3
- Latest upstream release
diff --git a/bodhi/release.py b/bodhi/release.py
index c2a3af8..2addce3 100644
--- a/bodhi/release.py
+++ b/bodhi/release.py
@@ -1,4 +1,4 @@
-VERSION = '0.5.10'
+VERSION = '0.5.11'
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'