[dak/master] Break hardlink when writing Contents files.
Signed-off-by: Torsten Werner <twerner@debian.org>
---
daklib/contents.py | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/daklib/contents.py b/daklib/contents.py
index 4a6330f..bbbacd4 100755
--- a/daklib/contents.py
+++ b/daklib/contents.py
@@ -191,7 +191,9 @@ select bc.file, o.section || '/' || b.package as package
Write the output file.
'''
command = ['gzip', '--rsyncable']
- output_file = open(self.output_filename(), 'w')
+ final_filename = self.output_filename()
+ temp_filename = final_filename + '.new'
+ output_file = open(temp_filename, 'w')
gzip = Popen(command, stdin = PIPE, stdout = output_file)
gzip.stdin.write(self.get_header())
for item in self.fetch():
@@ -199,6 +201,9 @@ select bc.file, o.section || '/' || b.package as package
gzip.stdin.close()
output_file.close()
gzip.wait()
+ os.remove(final_filename)
+ os.rename(temp_filename, final_filename)
+ os.chmod(final_filename, 0664)
@classmethod
def write_all(class_, suite_names = [], force = False):
--
1.7.2.3
Reply to: