Do not try to remove sha1 cache and changelog files that do not exist

Traceback (most recent call last):
  File "bin/remove-obsolete-new-packages", line 178, in <module>
    remove(sha1_cache_path, 'file from sha1 cache')
  File "bin/remove-obsolete-new-packages", line 122, in remove
    os.rmdir(os.path.dirname(path))
  File "/usr/lib/python3.5/posixpath.py", line 148, in dirname
    i = p.rfind(sep) + 1
AttributeError: 'NoneType' object has no attribute 'rfind'

Traceback (most recent call last):
  File "bin/remove-obsolete-new-packages", line 181, in <module>
    remove(changelog_path, 'changelog file')
  File "bin/remove-obsolete-new-packages", line 122, in remove
    os.rmdir(os.path.dirname(path))
  File "/usr/lib/python3.5/posixpath.py", line 148, in dirname
    i = p.rfind(sep) + 1
AttributeError: 'NoneType' object has no attribute 'rfind'
parent 090177c2
......@@ -174,10 +174,12 @@ for name, versions in data.items():
changelog_path = hash_path(sha1_changelog_dir,
get_basename(sha1_cache_path),
'changelog file')
remove(sha1_cache_path, 'file from sha1 cache')
if sha1_cache_path:
remove(sha1_cache_path, 'file from sha1 cache')
if hash_cache_path:
remove(hash_cache_path, 'symlink from %s cache' % hash_type)
remove(changelog_path, 'changelog file')
if changelog_path:
remove(changelog_path, 'changelog file')
try:
logging.debug('removing entry from sources.files: %s', files[hash])
del files[hash]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment