]> git.decadent.org.uk Git - dak.git/commitdiff
Merge branch 'master' of /home/stew/src/dak
authorMike O'Connor <stew@dhcp-101.dfw1.kickstart.lan>
Thu, 29 Oct 2009 16:34:49 +0000 (16:34 +0000)
committerMike O'Connor <stew@dhcp-101.dfw1.kickstart.lan>
Thu, 29 Oct 2009 16:34:49 +0000 (16:34 +0000)
1  2 
daklib/utils.py

diff --combined daklib/utils.py
index d581e70bd03d6f1719ef7f3cf50fd5af71523357,b0b71c0169d413e32d5a6c0b1aa009dd76f4211d..accf5fdb36b9157c4ad1eb5b86dcb1bbce760e2e
@@@ -48,6 -48,7 +48,7 @@@ from regexes import re_html_escaping, h
                      re_gpg_uid, re_re_mark, re_whitespace_comment, re_issource, \
                      re_is_orig_source
  
+ from formats import parse_format, validate_changes_format
  from srcformats import get_format_from_string
  from collections import defaultdict
  
@@@ -527,9 -528,8 +528,8 @@@ def build_file_list(changes, is_a_dsc=0
      if not changes.has_key(field):
          raise NoFilesFieldError
  
-     # Get SourceFormat object for this Format and validate it
-     format = get_format_from_string(changes['format'])
-     format.validate_format(is_a_dsc=is_a_dsc, field=field)
+     # Validate .changes Format: field
+     validate_changes_format(parse_format(changes['format']), field)
  
      includes_section = (not is_a_dsc) and field == "files"
  
@@@ -710,24 -710,20 +710,24 @@@ def where_am_i ()
          return res[0]
  
  def which_conf_file ():
 -    res = socket.gethostbyaddr(socket.gethostname())
 -    # In case we allow local config files per user, try if one exists
 -    if Cnf.FindB("Config::" + res[0] + "::AllowLocalConfig"):
 -        homedir = os.getenv("HOME")
 -        confpath = os.path.join(homedir, "/etc/dak.conf")
 -        if os.path.exists(confpath):
 -            apt_pkg.ReadConfigFileISC(Cnf,default_config)
 -
 -    # We are still in here, so there is no local config file or we do
 -    # not allow local files. Do the normal stuff.
 -    if Cnf.get("Config::" + res[0] + "::DakConfig"):
 -        return Cnf["Config::" + res[0] + "::DakConfig"]
 +    if os.getenv("DAK_CONFIG"):
 +        print(os.getenv("DAK_CONFIG"))
 +        return os.getenv("DAK_CONFIG")
      else:
 -        return default_config
 +        res = socket.gethostbyaddr(socket.gethostname())
 +        # In case we allow local config files per user, try if one exists
 +        if Cnf.FindB("Config::" + res[0] + "::AllowLocalConfig"):
 +            homedir = os.getenv("HOME")
 +            confpath = os.path.join(homedir, "/etc/dak.conf")
 +            if os.path.exists(confpath):
 +                apt_pkg.ReadConfigFileISC(Cnf,default_config)
 +
 +        # We are still in here, so there is no local config file or we do
 +        # not allow local files. Do the normal stuff.
 +        if Cnf.get("Config::" + res[0] + "::DakConfig"):
 +            return Cnf["Config::" + res[0] + "::DakConfig"]
 +        else:
 +            return default_config
  
  def which_apt_conf_file ():
      res = socket.gethostbyaddr(socket.gethostname())
@@@ -1508,8 -1504,8 +1508,8 @@@ apt_pkg.init(
  Cnf = apt_pkg.newConfiguration()
  apt_pkg.ReadConfigFileISC(Cnf,default_config)
  
#if which_conf_file() != default_config:
#    apt_pkg.ReadConfigFileISC(Cnf,which_conf_file())
+ if which_conf_file() != default_config:
+     apt_pkg.ReadConfigFileISC(Cnf,which_conf_file())
  
  ###############################################################################