Skip to content

Commit

Permalink
Send sha256 hashes for tracked files if the wc is pulled/linkrepair
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
marcus-h committed Dec 3, 2017
1 parent e818989 commit f698103
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions osc/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1484,6 +1484,15 @@ def commit(self, msg='', verbose=False, skip_local_service_run=False, can_branch
'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)
Expand Down

0 comments on commit f698103

Please sign in to comment.