]> git.decadent.org.uk Git - dak.git/blobdiff - dak/check_archive.py
Use components from database
[dak.git] / dak / check_archive.py
index 53db5ba7256aee3453f3f8ae0f8f6cb80e6b68d2..1fb8560baaa628bb61abec14f56adce4094b50ac 100755 (executable)
@@ -41,6 +41,7 @@ import apt_inst
 from daklib.dbconn import *
 from daklib import utils
 from daklib.config import Config
+from daklib.dak_exceptions import InvalidDscError, ChangesUnicodeError, CantOpenError
 
 ################################################################################
 
@@ -150,16 +151,22 @@ def check_dscs():
 
     count = 0
 
-    for dsc_file in DBConn().session().query(DSCFile):
-        f = dsc_file.poolfile.fullpath
+    for src in DBConn().session().query(DBSource).order_by(DBSource.source, DBSource.version):
+        f = src.poolfile.fullpath
         try:
             utils.parse_changes(f, signing_rules=1, dsc_file=1)
-        except InvalidDscError, line:
+        except InvalidDscError:
             utils.warn("syntax error in .dsc file %s" % f)
             count += 1
         except ChangesUnicodeError:
             utils.warn("found invalid dsc file (%s), not properly utf-8 encoded" % f)
             count += 1
+        except CantOpenError:
+            utils.warn("missing dsc file (%s)" % f)
+            count += 1
+        except Exception, e:
+            utils.warn("miscellaneous error parsing dsc file (%s): %s" % (f, str(e)))
+            count += 1
 
     if count:
         utils.warn("Found %s invalid .dsc files." % (count))
@@ -417,7 +424,7 @@ def check_indices_files_exist():
     Ensure files mentioned in Packages & Sources exist
     """
     for suite in [ "stable", "testing", "unstable" ]:
-        for component in Cnf.ValueList("Suite::%s::Components" % (suite)):
+        for component in get_component_names():
             architectures = get_suite_architectures(suite)
             for arch in [ i.arch_string.lower() for i in architectures ]:
                 if arch == "source":