tools/mpp: sort the source urls
Sort the checksum: urls dictionary via the url, so that no matter where the urls came from (import or any dep-solve section), the checksum: url dict is the same for the same set of urls.
This commit is contained in:
parent
ec68369daf
commit
fdd757dd28
1 changed files with 16 additions and 0 deletions
16
tools/mpp.py
16
tools/mpp.py
|
|
@ -316,7 +316,23 @@ class ManifestFile:
|
|||
|
||||
return checksums
|
||||
|
||||
def sort_urls(self):
|
||||
def get_sort_key(item):
|
||||
key = item[1]
|
||||
if isinstance(key, dict):
|
||||
key = key["url"]
|
||||
return key
|
||||
|
||||
urls = self.source_urls
|
||||
if not urls:
|
||||
return urls
|
||||
|
||||
urls_sorted = sorted(urls.items(), key=get_sort_key)
|
||||
urls.clear()
|
||||
urls.update(collections.OrderedDict(urls_sorted))
|
||||
|
||||
def write(self, file, sort_keys=False):
|
||||
self.sort_urls()
|
||||
json.dump(self.root, file, indent=2, sort_keys=sort_keys)
|
||||
file.write("\n")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue