]> git.decadent.org.uk Git - dak.git/blobdiff - dak/transitions.py
improve import-keyring output
[dak.git] / dak / transitions.py
index 530ef0c87d99b4677ae87b2c38287d2ffee27c2e..af39ee23a52ff788ac28c66094dd1b8386694a39 100755 (executable)
@@ -23,7 +23,7 @@
 
 ################################################################################
 
-import os, pg, sys, time, errno, fcntl, tempfile, pwd
+import os, pg, sys, time, errno, fcntl, tempfile, pwd, re
 import apt_pkg
 import daklib.database
 import daklib.utils
@@ -34,6 +34,8 @@ Cnf = None
 Options = None
 projectB = None
 
+re_broken_package = re.compile(r"[a-zA-Z]\w+\s+\-.*")
+
 ################################################################################
 
 #####################################
@@ -125,12 +127,16 @@ def load_transitions(trans_file):
                 if type(t[key]) != list:
                     print "ERROR: Unknown type %s for packages in transition %s." % (type(t[key]), test)
                     failure = True
-
                 try:
                     for package in t["packages"]:
                         if type(package) != str:
                             print "ERROR: Packages list contains invalid type %s (as %s) in transition %s" % (type(package), package, test)
                             failure = True
+                        if re_broken_package.match(package):
+                            # Someone had a space too much (or not enough), we have something looking like
+                            # "package1 - package2" now.
+                            print "ERROR: Invalid indentation of package list in transition %s, around package(s): %s" % (test, package)
+                            failure = True
                 except TypeError:
                     # In case someone has an empty packages list
                     print "ERROR: No packages defined in transition %s" % (test)