X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=daklib%2Fcontents.py;h=bbbacd4a3f73172e4c021e8beda380d2351ac850;hb=587510bf3b36c23e76756144f765304321287397;hp=056da53f18d244c8ed28a51a440d0dac364d3c11;hpb=ddf0f7dd6691ac530013468c68b6e81118c67a31;p=dak.git diff --git a/daklib/contents.py b/daklib/contents.py index 056da53f..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): @@ -252,8 +257,12 @@ class ContentsScanner(object): ''' session = DBConn().session() binary = session.query(DBBinary).get(self.binary_id) + empty_package = True for filename in binary.scan_contents(): binary.contents.append(BinContents(file = filename)) + empty_package = False + if empty_package: + binary.contents.append(BinContents(file = 'EMPTY_PACKAGE')) try: session.commit() except IntegrityError: