Skip to content

Commit

Permalink
Give better message when source files are missing
Browse files Browse the repository at this point in the history
If source files are missing from the system which are in the plist
file we should write out the missing file paths too.
  • Loading branch information
csordasmarton committed May 2, 2018
1 parent 07c5a34 commit 112f9f5
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions libcodechecker/libhandlers/store.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,19 +189,28 @@ def assemble_zip(inputs, zip_file, client):
file_to_mtime = {}

def collect_file_hashes_from_plist(plist_file):
"""
Collects file content hashes and last modification times of files which
can be found in the given plist file.
:returns List of file paths which are in the processed plist file but
missing from the user's disk.
"""
missing_files = []
try:
files, _ = plist_parser.parse_plist(plist_file)

for f in files:
if not os.path.isfile(f):
return False
missing_files.append(f)
continue

content_hash = util.get_file_content_hash(f)
hash_to_file[content_hash] = f
file_to_hash[f] = content_hash
file_to_mtime[f] = util.get_last_mod_time(f)

return True
return missing_files
except Exception as ex:
LOG.error('Parsing the plist failed: ' + str(ex))

Expand All @@ -223,15 +232,16 @@ def collect_file_hashes_from_plist(plist_file):
for f in files:
plist_file = os.path.join(input_path, f)
if f.endswith(".plist"):
if collect_file_hashes_from_plist(plist_file):
missing_files = collect_file_hashes_from_plist(plist_file)
if not missing_files:
LOG.debug(
"Copying file '{0}' to ZIP assembly dir..."
.format(plist_file))
plist_report_files.append(os.path.join(input_path, f))
else:
LOG.warning("Skipping '{0}' because it contains "
"a missing source file."
.format(plist_file))
LOG.warning("Skipping '%s' because it refers "
"the following missing source files: %s",
plist_file, missing_files)
elif f == 'metadata.json':
plist_report_files.append(os.path.join(input_path, f))

Expand Down

0 comments on commit 112f9f5

Please sign in to comment.