[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:
parent
9dd45da854
commit
d3fae0080e
@ -22,7 +22,7 @@ class Component:
|
|||||||
ctype -- Component Type, such as deb, py2, etc
|
ctype -- Component Type, such as deb, py2, etc
|
||||||
dist -- Distribution, such as stretch, buster, etc
|
dist -- Distribution, such as stretch, buster, etc
|
||||||
arch -- Architectrue, such as amd64, arm64, etc
|
arch -- Architectrue, such as amd64, arm64, etc
|
||||||
|
|
||||||
'''
|
'''
|
||||||
def __init__(self, versions, ctype, dist=ALL_DIST, arch=ALL_ARCH):
|
def __init__(self, versions, ctype, dist=ALL_DIST, arch=ALL_ARCH):
|
||||||
self.versions = versions
|
self.versions = versions
|
||||||
@ -44,6 +44,8 @@ class Component:
|
|||||||
offset = line.rfind('==')
|
offset = line.rfind('==')
|
||||||
if offset > 0:
|
if offset > 0:
|
||||||
package = line[:offset].strip()
|
package = line[:offset].strip()
|
||||||
|
if 'py2' in version_file.lower() or 'py3' in version_file.lower():
|
||||||
|
package = package.lower()
|
||||||
version = line[offset+2:].strip()
|
version = line[offset+2:].strip()
|
||||||
result[package] = version
|
result[package] = version
|
||||||
return result
|
return result
|
||||||
@ -86,7 +88,7 @@ class Component:
|
|||||||
if config and self.ctype == 'deb':
|
if config and self.ctype == 'deb':
|
||||||
none_config_file_path = os.path.join(file_path, filename)
|
none_config_file_path = os.path.join(file_path, filename)
|
||||||
self.dump_to_file(none_config_file_path, False, priority)
|
self.dump_to_file(none_config_file_path, False, priority)
|
||||||
filename = VERSION_DEB_PREFERENCE
|
filename = VERSION_DEB_PREFERENCE
|
||||||
file_path = os.path.join(file_path, filename)
|
file_path = os.path.join(file_path, filename)
|
||||||
self.dump_to_file(file_path, config, priority)
|
self.dump_to_file(file_path, config, priority)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user