[build]: Update versions_manager.py to make versions map key unique (#7146)

py2/py3/deb packages names are case insensitive, and the versions map
key should be the same for packages whose name can have different cases.

For example, in files/build/versions/default/versions-py3, package
"click==7.1.2" is pinned; and in
files/build/versions/dockers/docker-sonic-vs/versions-py3, package
"Click==7.0" is pinned.
Without this fix, the aggregated versions-py3 file used for building
docker-sonic-vs looks like below:
...
click==7.1.2
Click==7.0
...
However, we actually want "click==7.0" to overwrite "click==7.1.2" for
docker-sonic-vs build.
This commit is contained in:
Yilan 2021-03-30 08:34:25 -07:00 committed by GitHub
parent 9dd45da854
commit d3fae0080e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -44,6 +44,8 @@ class Component:
offset = line.rfind('==')
if offset > 0:
package = line[:offset].strip()
if 'py2' in version_file.lower() or 'py3' in version_file.lower():
package = package.lower()
version = line[offset+2:].strip()
result[package] = version
return result