1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-11-10 06:46:15 +01:00

Send sha256 hashes for tracked files if the wc is pulled/linkrepair

In case of a pulled/linkrepair wc, it is possible that the backend
requests a hash for a tracked file, which is neither added, restored,
nor modified. For instance, this can happen if a new file was added
to the link target. Hence, for a pulled/linkrepair wc always send
the sha256 hashes of the tracked files.
This commit is contained in:
Marcus Huewe 2017-12-03 14:44:01 +01:00
parent e818989d21
commit f698103977

View File

@ -1484,6 +1484,15 @@ class Package:
'error: file \'%s\' with state \'%s\' is not known by meta' \
% (filename, st))
todo_send[filename] = f.md5
if ((self.ispulled() or self.islinkrepair()) and st != 'A'
and filename not in sha256sums):
# Ignore files with state 'A': if we should consider it,
# it would have been in pac.todo, which implies that it is
# in sha256sums.
# The storefile is guaranteed to exist (since we have a
# pulled/linkrepair wc, the file cannot have state 'S')
storefile = os.path.join(self.storedir, filename)
sha256sums[filename] = sha256_dgst(storefile)
if not force and not real_send and not todo_delete and not self.islinkrepair() and not self.ispulled():
print('nothing to do for package %s' % self.name)