]> err.no Git - dak/commitdiff
Remove function get_suite_architecture().
authorTorsten Werner <twerner@debian.org>
Sun, 16 Jan 2011 19:58:44 +0000 (20:58 +0100)
committerTorsten Werner <twerner@debian.org>
Sun, 16 Jan 2011 20:01:16 +0000 (21:01 +0100)
Signed-off-by: Torsten Werner <twerner@debian.org>
dak/admin.py
daklib/dbconn.py

index 2bb1f1853187af821ccf06c317bf40cc6de8aefd..814c6abca87e8f9a83bfd6fd34ba3cb8760ded70 100755 (executable)
@@ -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()))
index 78fb8f0ae6b33ddafc9af54b99edf3928e2acb22..d66a64cfda64b036e9c847948227db5384f0bcf3 100755 (executable)
@@ -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):
     """