tags 542230 patch thanks Earlier today I wrote: > On IRC Joerg Jaspert suggested adding an index file in the i18n > directories themselves, and adding those index files in the main > Release file (similar to what's done for pdiffs).
Attached a patch that should do this. It's the simplest implementation I could come up with and I've tested that the new function gen_i18n_index by itself works. I hope it's OK to generate the Index file for i18n as part of generate_releases.py as it is not 100% logical. If not, it should not be too hard to split that out into a separate script. It's mostly copy-and-paste programming, so please review carefully. Cheers, FJP
From: Frans Pop <f...@debian.org> Subject: Generate an index for i18n files and list that index in Release diff --git a/dak/generate_releases.py b/dak/generate_releases.py index d6aeb39..55cf97d 100755 --- a/dak/generate_releases.py +++ b/dak/generate_releases.py @@ -59,6 +59,24 @@ def add_tiffani (files, path, indexstem): #print "ALERT: there was a tiffani file %s" % (filepath) files.append(index) +def gen_i18n_index (files, tree, sec): + path = Cnf["Dir::Root"] + tree + "/" + i18n_path = "%s/i18n" % (sec) + if os.path.exists("%s/%s" % (path, i18n_path)): + index = "%s/Index" % (i18n_path) + out = open("%s/%s" % (path, index), "w") + out.write("SHA1:\n") + for x in os.listdir("%s/%s" % (path, i18n_path)): + if x.startswith('Translation-'): + f = open("%s/%s/%s" % (path, i18n_path, x), "r") + size = os.fstat(f.fileno())[6] + f.seek(0) + sha1sum = apt_pkg.sha1sum(f) + f.close + out.write(" %s %7d %s\n" % (sha1sum, size, x)) + out.close() + files.append(index) + def compressnames (tree,type,file): compress = AptCnf.get("%s::%s::Compress" % (tree,type), AptCnf.get("Default::%s::Compress" % (type), ". gzip")) result = [] @@ -296,6 +314,7 @@ def main (): relpath = Cnf["Dir::Root"]+tree+"/"+rel write_release_file(relpath, suite, sec, origin, label, arch, version, suite_suffix, notautomatic) files.append(rel) + gen_i18n_index(files, tree, sec) if AptCnf.has_key("tree::%s/main" % (tree)): for dis in ["main", "contrib", "non-free"]: