signingkey = get_field('signingkey')
if signingkey is not None:
suite.signingkeys = [signingkey.upper()]
+ suite.srcformats = s.query(SrcFormat).all()
s.add(suite)
s.flush()
- for sf in s.query(SrcFormat).all():
- ssf = SuiteSrcFormat()
- ssf.suite = suite
- ssf.src_format = sf
- s.add(ssf)
- s.flush()
except IntegrityError, e:
die("E: Integrity error adding suite %s (it probably already exists)" % suite_name)
except SQLAlchemyError, e:
################################################################################
-class SuiteSrcFormat(object):
- def __init__(self, *args, **kwargs):
- pass
-
- def __repr__(self):
- return '<SuiteSrcFormat (%s, %s)>' % (self.suite_id, self.src_format_id)
-
-__all__.append('SuiteSrcFormat')
-
-@session_wrapper
-def get_suite_src_formats(suite, session=None):
- """
- Returns list of allowed SrcFormat for C{suite}.
-
- @type suite: str
- @param suite: Suite name to search for
-
- @type session: Session
- @param session: Optional SQL session object (a temporary one will be
- generated if not supplied)
-
- @rtype: list
- @return: the list of allowed source formats for I{suite}
- """
-
- q = session.query(SrcFormat)
- q = q.join(SuiteSrcFormat)
- q = q.join(Suite).filter_by(suite_name=suite)
- q = q.order_by('format_name')
-
- return q.all()
-
-__all__.append('get_suite_src_formats')
-
-################################################################################
-
class Uid(ORMObject):
def __init__(self, uid = None, name = None):
self.uid = uid
properties = dict(suite_id = self.tbl_suite.c.id,
policy_queue = relation(PolicyQueue),
copy_queues = relation(BuildQueue,
- secondary=self.tbl_suite_build_queue_copy)),
+ secondary=self.tbl_suite_build_queue_copy),
+ srcformats = relation(SrcFormat, secondary=self.tbl_suite_src_formats,
+ backref=backref('suites', lazy='dynamic'))),
extension = validator)
- mapper(SuiteSrcFormat, self.tbl_suite_src_formats,
- properties = dict(suite_id = self.tbl_suite_src_formats.c.suite,
- suite = relation(Suite, backref='suitesrcformats'),
- src_format_id = self.tbl_suite_src_formats.c.src_format,
- src_format = relation(SrcFormat)))
-
mapper(Uid, self.tbl_uid,
properties = dict(uid_id = self.tbl_uid.c.id,
fingerprint = relation(Fingerprint)),
# Only a limited list of source formats are allowed in each suite
for dist in self.pkg.changes["distribution"].keys():
- allowed = [ x.format_name for x in get_suite_src_formats(dist, session) ]
+ allowed = [ x.format_name for x in dist.srcformats ]
if self.pkg.dsc["format"] not in allowed:
self.rejects.append("%s: source format '%s' not allowed in %s (accepted: %s) " % (dsc_filename, self.pkg.dsc["format"], dist, ", ".join(allowed)))