Skip to content
This repository was archived by the owner on Feb 4, 2020. It is now read-only.
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions clcache.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,23 +192,23 @@ def getManifestHash(compilerBinary, commandLine, sourceFile):
return getFileHash(sourceFile, additionalData)

@staticmethod
def getIncludesContentHashForFiles(includes):
listOfIncludesHashes = []
def verifyIncludesHashes(includes):
includeMissing = False

for path in sorted(includes.keys()):
try:
fileHash = getFileHash(path)
if fileHash != includes[path]:
raise IncludeChangedException()
listOfIncludesHashes.append(fileHash)
except FileNotFoundError:
includeMissing = True

if includeMissing:
raise IncludeNotFoundException()

return ManifestRepository.getIncludesContentHashForHashes(listOfIncludesHashes)
@staticmethod
def getIncludesContentHashForFiles(includes):
return ManifestRepository.getIncludesContentHashForHashes(sorted(includes.values()))

@staticmethod
def getIncludesContentHashForHashes(listOfIncludesHashes):
Expand Down Expand Up @@ -1514,10 +1514,12 @@ def processDirect(cache, objectFile, compiler, cmdLine, sourceFile):
if manifest is not None:
# NOTE: command line options already included in hash for manifest name
try:
includesContentHash = ManifestRepository.getIncludesContentHashForFiles({
includes = {
expandBasedirPlaceholder(path, baseDir):contentHash
for path, contentHash in manifest.includeFiles.items()
})
}
ManifestRepository.verifyIncludesHashes(includes)
includesContentHash = ManifestRepository.getIncludesContentHashForFiles(includes)

cachekey = manifest.includesContentToObjectMap.get(includesContentHash)
assert cachekey is not None
Expand Down