From: Mike O'Connor Date: Thu, 29 Oct 2009 16:34:49 +0000 (+0000) Subject: Merge branch 'master' of /home/stew/src/dak X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=2a96091acb1b1eaf66f181e95872771878290885;hp=db12f65ea58c1739169373ba66386d437dfc00a4;p=dak.git Merge branch 'master' of /home/stew/src/dak --- diff --git a/dak/dakdb/update17.py b/dak/dakdb/update17.py index 0d7efa9e..b5bbb3cc 100644 --- a/dak/dakdb/update17.py +++ b/dak/dakdb/update17.py @@ -52,6 +52,9 @@ def do_update(self): c.execute("""CREATE INDEX ind_bin_contents_binary ON bin_contents(binary_id);""" ) + c.execute("GRANT ALL ON bin_contents TO ftpmaster;") + c.execute("GRANT SELECT ON bin_contents TO public;") + self.db.commit() except psycopg2.ProgrammingError, msg: diff --git a/daklib/config.py b/daklib/config.py index 09df17bb..c86c1b36 100755 --- a/daklib/config.py +++ b/daklib/config.py @@ -28,6 +28,7 @@ Config access class ################################################################################ +import os import apt_pkg import socket @@ -37,10 +38,9 @@ from singleton import Singleton default_config = "/etc/dak/dak.conf" -def which_conf_file(Cnf): - res = socket.gethostbyaddr(socket.gethostname()) - if Cnf.get("Config::" + res[0] + "::DakConfig"): - return Cnf["Config::" + res[0] + "::DakConfig"] +def which_conf_file(): + if os.getenv("DAK_CONFIG"): + return os.getenv("DAK_CONFIG") else: return default_config @@ -57,7 +57,7 @@ class Config(Singleton): self.Cnf = apt_pkg.newConfiguration() - apt_pkg.ReadConfigFileISC(self.Cnf, default_config) + apt_pkg.ReadConfigFileISC(self.Cnf, which_conf_file()) # Check whether our dak.conf was the real one or # just a pointer to our main one diff --git a/daklib/utils.py b/daklib/utils.py index b0b71c01..accf5fdb 100755 --- a/daklib/utils.py +++ b/daklib/utils.py @@ -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())