]> git.decadent.org.uk Git - dak.git/blobdiff - dak/process_unchecked.py
Revert "Merge commit 'stew/content_generation' into merge"
[dak.git] / dak / process_unchecked.py
index 6761a419fa4ef0887ee3b3a125df07700ec28313..8392e7f5e4b31ac5df7996f7fc4bb30e0973039b 100755 (executable)
@@ -38,7 +38,7 @@ from daklib.dak_exceptions import *
 from daklib.regexes import re_valid_version, re_valid_pkg_name, re_changelog_versions, \
                            re_strip_revision, re_strip_srcver, re_spacestrip, \
                            re_isanum, re_no_epoch, re_no_revision, re_taint_free, \
-                           re_isadeb, re_extract_src_version, re_issource
+                           re_isadeb, re_extract_src_version, re_issource, re_default_answer
 
 from types import *
 
@@ -78,10 +78,11 @@ def init():
                  ('h',"help","Dinstall::Options::Help"),
                  ('n',"no-action","Dinstall::Options::No-Action"),
                  ('p',"no-lock", "Dinstall::Options::No-Lock"),
-                 ('s',"no-mail", "Dinstall::Options::No-Mail")]
+                 ('s',"no-mail", "Dinstall::Options::No-Mail"),
+                 ('d',"directory", "Dinstall::Options::Directory", "HasArg")]
 
     for i in ["automatic", "help", "no-action", "no-lock", "no-mail",
-              "override-distribution", "version"]:
+              "override-distribution", "version", "directory"]:
         Cnf["Dinstall::Options::%s" % (i)] = ""
 
     changes_files = apt_pkg.ParseCommandLine(Cnf,Arguments,sys.argv)
@@ -90,6 +91,15 @@ def init():
     if Options["Help"]:
         usage()
 
+    # If we have a directory flag, use it to find our files
+    if Cnf["Dinstall::Options::Directory"] != "":
+        # Note that we clobber the list of files we were given in this case
+        # so warn if the user has done both
+        if len(changes_files) > 0:
+            utils.warn("Directory provided so ignoring files given on command line")
+
+        changes_files = utils.get_changes_files(Cnf["Dinstall::Options::Directory"])
+
     Upload = queue.Upload(Cnf)
 
     changes = Upload.pkg.changes
@@ -186,6 +196,9 @@ def check_changes():
     except ParseChangesError, line:
         reject("%s: parse error, can't grok: %s." % (filename, line))
         return 0
+    except ChangesUnicodeError:
+        reject("%s: changes file not proper utf-8" % (filename))
+        return 0
 
     # Parse the Files field from the .changes into another dictionary
     try:
@@ -289,7 +302,7 @@ def check_distributions():
             (source, dest) = args[1:3]
             if changes["distribution"].has_key(source):
                 for arch in changes["architecture"].keys():
-                    if arch not in Cnf.ValueList("Suite::%s::Architectures" % (source)):
+                    if arch not in database.get_suite_architectures(source):
                         reject("Mapping %s to %s for unreleased architecture %s." % (source, dest, arch),"")
                         del changes["distribution"][source]
                         changes["distribution"][dest] = 1
@@ -323,13 +336,15 @@ def check_distributions():
 ################################################################################
 
 def check_deb_ar(filename):
-    """Sanity check the ar of a .deb, i.e. that there is:
+    """
+    Sanity check the ar of a .deb, i.e. that there is:
 
o debian-binary
o control.tar.gz
o data.tar.gz or data.tar.bz2
     1. debian-binary
     2. control.tar.gz
     3. data.tar.gz or data.tar.bz2
 
-in that order, and nothing else."""
+    in that order, and nothing else.
+    """
     cmd = "ar t %s" % (filename)
     (result, output) = commands.getstatusoutput(cmd)
     if result != 0:
@@ -449,7 +464,7 @@ def check_files():
             default_suite = Cnf.get("Dinstall::DefaultSuite", "Unstable")
             architecture = control.Find("Architecture")
             upload_suite = changes["distribution"].keys()[0]
-            if architecture not in Cnf.ValueList("Suite::%s::Architectures" % (default_suite)) and architecture not in Cnf.ValueList("Suite::%s::Architectures" % (upload_suite)):
+            if architecture not in database.get_suite_architectures(default_suite) and architecture not in database.get_suite_architectures(upload_suite):
                 reject("Unknown architecture '%s'." % (architecture))
 
             # Ensure the architecture of the .deb is one of the ones
@@ -693,6 +708,9 @@ def check_dsc():
         reject("%s: parse error, can't grok: %s." % (dsc_filename, line))
     except InvalidDscError, line:
         reject("%s: syntax error on line %s." % (dsc_filename, line))
+    except ChangesUnicodeError:
+        reject("%s: dsc file not proper utf-8." % (dsc_filename))
+
     # Build up the file list of files mentioned by the .dsc
     try:
         dsc_files.update(utils.build_file_list(dsc, is_a_dsc=1))