зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1653190: Fix handling of checksum format in python 2 vs 3; r=mtabara
We switched to using python 3 to run generate-checksums, this caused the checksum files to have an extra `b''` in them. The original fix caused the generation of merkletree to fail. This moves the code that encodes the hash closer to where it is output. Differential Revision: https://phabricator.services.mozilla.com/D85196
This commit is contained in:
Родитель
013e24471d
Коммит
67ea30d732
|
@ -8,7 +8,9 @@ def parse_checksums_file(checksums):
|
|||
"""
|
||||
fileInfo = {}
|
||||
for line in checksums.splitlines():
|
||||
hash_, type_, size, file_ = six.ensure_str(line).split(None, 3)
|
||||
hash_, type_, size, file_ = line.split(None, 3)
|
||||
type_ = six.ensure_str(type_)
|
||||
file_ = six.ensure_str(file_)
|
||||
size = int(size)
|
||||
if size < 0:
|
||||
raise ValueError("Found negative value (%d) for size." % size)
|
||||
|
|
|
@ -204,9 +204,9 @@ class ChecksumsGenerator(BaseScript, VirtualenvMixin):
|
|||
summary = self._get_summary_filename(fmt)
|
||||
self.info("Creating summary file: {}".format(summary))
|
||||
|
||||
content = "{} TREE_HEAD\n".format(head)
|
||||
content = "{} TREE_HEAD\n".format(head.decode('ascii'))
|
||||
for i in range(len(files)):
|
||||
content += "{} {}\n".format(proofs[i], files[i])
|
||||
content += "{} {}\n".format(proofs[i].decode('ascii'), files[i])
|
||||
|
||||
self.write_to_file(summary, content)
|
||||
|
||||
|
@ -216,7 +216,11 @@ class ChecksumsGenerator(BaseScript, VirtualenvMixin):
|
|||
self.info("Creating big checksums file: {}".format(sums))
|
||||
with open(sums, "w+") as output_file:
|
||||
for fn in sorted(self.checksums):
|
||||
output_file.write("{} {}\n".format(self.checksums[fn]["hashes"][fmt], fn))
|
||||
output_file.write(
|
||||
"{} {}\n".format(
|
||||
self.checksums[fn]["hashes"][fmt].decode("ascii"), fn
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
Загрузка…
Ссылка в новой задаче