提交 94728eaa 编写于 作者: L Luca Falavigna

config/debian/dak.conf, dak/transitions.py:

Move TempPath under its own domain, so it can be used by some other
pieces of dak. Adjust transitions accordingly.
Signed-off-by: NLuca Falavigna <dktrkranz@debian.org>
上级 27a8450d
...@@ -49,7 +49,6 @@ Dinstall ...@@ -49,7 +49,6 @@ Dinstall
Transitions Transitions
{ {
Notifications "debian-devel@lists.debian.org"; Notifications "debian-devel@lists.debian.org";
TempPath "/srv/ftp.debian.org/tmp/";
}; };
Generate-Index-Diffs Generate-Index-Diffs
...@@ -744,3 +743,8 @@ Contents ...@@ -744,3 +743,8 @@ Contents
Header "contents"; Header "contents";
Root "/srv/ftp.debian.org/test/"; Root "/srv/ftp.debian.org/test/";
} }
TempPath
{
TempPath "/srv/ftp.debian.org/tmp/";
};
...@@ -287,8 +287,8 @@ def write_transitions_from_file(from_file): ...@@ -287,8 +287,8 @@ def write_transitions_from_file(from_file):
""" """
# Lets check if from_file is in the directory we expect it to be in # Lets check if from_file is in the directory we expect it to be in
if not os.path.abspath(from_file).startswith(Cnf["Transitions::TempPath"]): if not os.path.abspath(from_file).startswith(Cnf["TempPath::TempPath"]):
print "Will not accept transitions file outside of %s" % (Cnf["Transitions::TempPath"]) print "Will not accept transitions file outside of %s" % (Cnf["TempPath::TempPath"])
sys.exit(3) sys.exit(3)
if Options["sudo"]: if Options["sudo"]:
...@@ -318,7 +318,7 @@ def temp_transitions_file(transitions): ...@@ -318,7 +318,7 @@ def temp_transitions_file(transitions):
sudo-ed script and would be unreadable if it has default mkstemp mode sudo-ed script and would be unreadable if it has default mkstemp mode
""" """
(fd, path) = tempfile.mkstemp("", "transitions", Cnf["Transitions::TempPath"]) (fd, path) = tempfile.mkstemp("", "transitions", Cnf["TempPath::TempPath"])
os.chmod(path, 0644) os.chmod(path, 0644)
f = open(path, "w") f = open(path, "w")
yaml.dump(transitions, f, default_flow_style=False) yaml.dump(transitions, f, default_flow_style=False)
...@@ -577,13 +577,13 @@ def main(): ...@@ -577,13 +577,13 @@ def main():
(Cnf["Dinstall::Reject::ReleaseTransitions"])) (Cnf["Dinstall::Reject::ReleaseTransitions"]))
sys.exit(1) sys.exit(1)
# Also check if our temp directory is defined and existant # Also check if our temp directory is defined and existant
temppath = Cnf.get("Transitions::TempPath", "") temppath = Cnf.get("TempPath::TempPath", "")
if temppath == "": if temppath == "":
utils.warn("Transitions::TempPath not defined") utils.warn("TempPath::TempPath not defined")
sys.exit(1) sys.exit(1)
if not os.path.exists(temppath): if not os.path.exists(temppath):
utils.warn("Temporary path %s not found." % utils.warn("Temporary path %s not found." %
(Cnf["Transitions::TempPath"])) (Cnf["TempPath::TempPath"]))
sys.exit(1) sys.exit(1)
if Options["import"]: if Options["import"]:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册