order_by(desc('source.version'))
return q.first()
+def get_suite_version(source, session):
+ 'returns a list of tuples (suite_name, version) for source package'
+ q = session.query(Suite.suite_name, DBSource.version). \
+ join(Suite.sources).filter_by(source = source)
+ return q.all()
+
class Upload(object):
"""
Everything that has to do with an upload processed.
version = self.pkg.dsc.get("version")
# Ensure version is sane
- q = session.query(SrcAssociation)
- q = q.join(DBSource).filter(DBSource.source==source)
-
- self.cross_suite_version_check([ (x.suite.suite_name, x.source.version) for x in q.all() ],
+ self.cross_suite_version_check(get_suite_version(source, session),
filename, version, sourceful=True)
################################################################################
check_poolfile, get_poolfile_like_name, get_source_in_suite, \
get_suites_source_in, add_dsc_to_db, source_exists
from daklib.queue_install import package_to_suite
-from daklib.queue import get_newest_source
+from daklib.queue import get_newest_source, get_suite_version
from sqlalchemy.orm.exc import MultipleResultsFound
import unittest
self.assertTrue(package_to_suite(upload, 'lenny', self.session))
def test_get_newest_source(self):
- 'test function get_newest_source'
+ 'test function get_newest_source()'
self.setup_sources()
- self.session.flush()
import daklib.queue
daklib.queue.dm_suites = ['sid']
self.assertEqual(self.source['hello'], get_newest_source('hello', self.session))
self.assertEqual(None, get_newest_source('foobar', self.session))
+ def test_get_suite_version(self):
+ 'test function get_suite_version()'
+
+ self.setup_sources()
+ result = get_suite_version('hello', self.session)
+ self.assertEqual(2, len(result))
+ self.assertTrue(('sid', '2.2-1') in result)
+ self.assertTrue(('sid', '2.2-2') in result)
+ result = get_suite_version('sl', self.session)
+ self.assertEqual(2, len(result))
+ self.assertTrue(('squeeze', '3.03-16') in result)
+ self.assertTrue(('sid', '3.03-16') in result)
if __name__ == '__main__':
unittest.main()