dependencies: Remove version from cache key
We cannot have 2 different versions with all other kwargs being identical. This simplifies a lot that code.
This commit is contained in:
parent
2f72d4db09
commit
a92b41fdcd
|
@ -1984,17 +1984,14 @@ class ExtraFrameworkDependency(ExternalDependency):
|
|||
|
||||
|
||||
def get_dep_identifier(name, kwargs, want_cross):
|
||||
# Need immutable objects since the identifier will be used as a dict key
|
||||
version_reqs = listify(kwargs.get('version', []))
|
||||
if isinstance(version_reqs, list):
|
||||
version_reqs = frozenset(version_reqs)
|
||||
identifier = (name, version_reqs, want_cross)
|
||||
identifier = (name, want_cross)
|
||||
for key, value in kwargs.items():
|
||||
# 'version' is embedded above as the second element for easy access
|
||||
# 'version' is irrelevant for caching; the caller must check version matches
|
||||
# 'native' is handled above with `want_cross`
|
||||
# 'required' is irrelevant for caching; the caller handles it separately
|
||||
# 'fallback' subprojects cannot be cached -- they must be initialized
|
||||
if key in ('version', 'native', 'required', 'fallback',):
|
||||
# 'default_options' is only used in fallback case
|
||||
if key in ('version', 'native', 'required', 'fallback', 'default_options'):
|
||||
continue
|
||||
# All keyword arguments are strings, ints, or lists (or lists of lists)
|
||||
if isinstance(value, list):
|
||||
|
|
|
@ -2851,28 +2851,24 @@ external dependencies (including libraries) must go to "dependencies".''')
|
|||
want_cross = not kwargs['native']
|
||||
else:
|
||||
want_cross = is_cross
|
||||
|
||||
identifier = dependencies.get_dep_identifier(name, kwargs, want_cross)
|
||||
cached_dep = None
|
||||
# Check if we've already searched for and found this dep
|
||||
if identifier in self.coredata.deps:
|
||||
cached_dep = self.coredata.deps[identifier]
|
||||
mlog.log('Dependency', mlog.bold(name),
|
||||
'found:', mlog.green('YES'), '(cached)')
|
||||
else:
|
||||
# Check if exactly the same dep with different version requirements
|
||||
# was found already.
|
||||
wanted = identifier[1]
|
||||
for trial, trial_dep in self.coredata.deps.items():
|
||||
# trial[1], identifier[1] are the version requirements
|
||||
if trial[0] != identifier[0] or trial[2:] != identifier[2:]:
|
||||
continue
|
||||
found = trial_dep.get_version()
|
||||
if not wanted or mesonlib.version_compare_many(found, wanted)[0]:
|
||||
# We either don't care about the version, or our
|
||||
# version requirements matched the trial dep's version.
|
||||
cached_dep = trial_dep
|
||||
break
|
||||
return identifier, cached_dep
|
||||
cached_dep = self.coredata.deps.get(identifier)
|
||||
if cached_dep:
|
||||
if not cached_dep.found():
|
||||
mlog.log('Dependency', mlog.bold(name),
|
||||
'found:', mlog.red('NO'), '(cached)')
|
||||
return identifier, cached_dep
|
||||
|
||||
# Verify the cached dep version match
|
||||
wanted = kwargs.get('version', [])
|
||||
found = cached_dep.get_version()
|
||||
if not wanted or mesonlib.version_compare_many(found, wanted)[0]:
|
||||
mlog.log('Dependency', mlog.bold(name),
|
||||
'found:', mlog.green('YES'), '(cached)')
|
||||
return identifier, cached_dep
|
||||
|
||||
return identifier, None
|
||||
|
||||
@staticmethod
|
||||
def check_subproject_version(wanted, found):
|
||||
|
|
Loading…
Reference in New Issue