From dc0b7730846c3aeb835d891db390e93a04ae3552 Mon Sep 17 00:00:00 2001 From: Torsten Werner Date: Sun, 16 Jan 2011 20:58:44 +0100 Subject: [PATCH] Remove function get_suite_architecture(). Signed-off-by: Torsten Werner --- dak/admin.py | 13 +++++++++---- daklib/dbconn.py | 31 ------------------------------- 2 files changed, 9 insertions(+), 35 deletions(-) diff --git a/dak/admin.py b/dak/admin.py index 2bb1f185..814c6abc 100755 --- a/dak/admin.py +++ b/dak/admin.py @@ -287,10 +287,15 @@ def __suite_architecture_rm(d, args): 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())) diff --git a/daklib/dbconn.py b/daklib/dbconn.py index 78fb8f0a..d66a64cf 100755 --- a/daklib/dbconn.py +++ b/daklib/dbconn.py @@ -2551,37 +2551,6 @@ class Suite(object): __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): """ -- 2.39.5