X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=dak%2Fgenerate_index_diffs.py;h=e3cbd320786ba53399bda3ffa4ff34dd8b365072;hb=519c1dbf89c13557afc15a429164616ac563d379;hp=ba5e37d02e96fd73b2ed36b23281d511214b282c;hpb=ffab325635f23149aacd1e00b54437ac73b5ce18;p=dak.git diff --git a/dak/generate_index_diffs.py b/dak/generate_index_diffs.py index ba5e37d0..e3cbd320 100755 --- a/dak/generate_index_diffs.py +++ b/dak/generate_index_diffs.py @@ -337,9 +337,9 @@ def genchanges(Options, outdir, oldfile, origfile, maxdiffs = 56): os.link(origfile + origext, oldfile + origext) os.unlink(newfile) - f = open(outdir + "/Index", "w") - upd.dump(f) - f.close() + with open(outdir + "/Index.new", "w") as f: + upd.dump(f) + os.rename(outdir + "/Index.new", outdir + "/Index") def main(): @@ -429,13 +429,14 @@ def main(): packages = "Sources" maxsuite = maxsources else: - longarch = "binary-%s"% (architecture) + longarch = "binary-%s" % (architecture) packages = "Packages" maxsuite = maxpackages - # Process Contents - file = "%s/%s/Contents-%s" % (tree, component, architecture) - storename = "%s/%s_%s_contents_%s" % (Options["TempDir"], suite, component, architecture) - genchanges(Options, file + ".diff", storename, file, maxcontents) + + # Process Contents + file = "%s/%s/Contents-%s" % (tree, component, architecture) + storename = "%s/%s_%s_contents_%s" % (Options["TempDir"], suite, component, architecture) + genchanges(Options, file + ".diff", storename, file, maxcontents) file = "%s/%s/%s/%s" % (tree, component, longarch, packages) storename = "%s/%s_%s_%s" % (Options["TempDir"], suite, component, architecture)