s = d.session()
if not dryrun:
try:
- sa = get_suite_architecture(args[2].lower(), args[3].lower(), s)
- if sa is None:
- die("E: can't find suite-architecture entry for %s, %s" % (args[2].lower(), args[3].lower()))
- s.delete(sa)
+ suite_name = args[2].lower()
+ suite = get_suite(suite_name, s)
+ if suite is None:
+ die('E: no such suite %s' % suite_name)
+ arch_string = args[3].lower()
+ architecture = get_architecture(arch_string, s)
+ if architecture not in suite.architectures:
+ die("E: architecture %s not found in suite %s" % (arch_string, suite_name))
+ suite.architectures.remove(architecture)
s.commit()
except IntegrityError, e:
die("E: Can't remove suite-architecture entry (%s, %s) - it's probably referenced" % (args[2].lower(), args[3].lower()))
__all__.append('Suite')
-@session_wrapper
-def get_suite_architecture(suite, architecture, session=None):
- """
- Returns a SuiteArchitecture object given C{suite} and ${arch} or None if it
- doesn't exist
-
- @type suite: str
- @param suite: Suite name to search for
-
- @type architecture: str
- @param architecture: Architecture name to search for
-
- @type session: Session
- @param session: Optional SQL session object (a temporary one will be
- generated if not supplied)
-
- @rtype: SuiteArchitecture
- @return: the SuiteArchitecture object or None
- """
-
- q = session.query(SuiteArchitecture)
- q = q.join(Architecture).filter_by(arch_string=architecture)
- q = q.join(Suite).filter_by(suite_name=suite)
-
- try:
- return q.one()
- except NoResultFound:
- return None
-
-__all__.append('get_suite_architecture')
-
@session_wrapper
def get_suite(suite, session=None):
"""