]> git.decadent.org.uk Git - dak.git/blobdiff - daklib/utils.py
Tidy daklib.utils.which_conf_file
[dak.git] / daklib / utils.py
old mode 100755 (executable)
new mode 100644 (file)
index 6ec92f8..3cc4053
@@ -712,24 +712,23 @@ def where_am_i ():
         return res[0]
 
 def which_conf_file ():
-    if os.getenv("DAK_CONFIG"):
-        print(os.getenv("DAK_CONFIG"))
-        return os.getenv("DAK_CONFIG")
-    else:
-        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
+    if os.getenv('DAK_CONFIG'):
+        return os.getenv('DAK_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"]
+
+    return default_config
 
 def which_apt_conf_file ():
     res = socket.gethostbyaddr(socket.gethostname())
@@ -1362,7 +1361,7 @@ def check_signature (sig_filename, data_filename="", keyrings=None, autofetch=No
     # Finally ensure there's not something we don't recognise
     known_keywords = dict(VALIDSIG="",SIG_ID="",GOODSIG="",BADSIG="",ERRSIG="",
                           SIGEXPIRED="",KEYREVOKED="",NO_PUBKEY="",BADARMOR="",
-                          NODATA="",NOTATION_DATA="",NOTATION_NAME="",KEYEXPIRED="")
+                          NODATA="",NOTATION_DATA="",NOTATION_NAME="",KEYEXPIRED="",POLICY_URL="")
 
     for keyword in keywords.keys():
         if not known_keywords.has_key(keyword):
@@ -1504,7 +1503,8 @@ def get_changes_files(from_dir):
 apt_pkg.init()
 
 Cnf = apt_pkg.newConfiguration()
-apt_pkg.ReadConfigFileISC(Cnf,default_config)
+if not os.getenv("DAK_TEST"):
+    apt_pkg.ReadConfigFileISC(Cnf,default_config)
 
 if which_conf_file() != default_config:
     apt_pkg.ReadConfigFileISC(Cnf,which_conf_file())