From: Torsten Werner Date: Mon, 14 Mar 2011 21:07:40 +0000 (+0100) Subject: Break hardlink when writing Contents files. X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=587510bf3b36c23e76756144f765304321287397;p=dak.git Break hardlink when writing Contents files. Signed-off-by: Torsten Werner --- diff --git a/daklib/contents.py b/daklib/contents.py index 4a6330f8..bbbacd4a 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):