Yedidyah Bar David has uploaded a new change for review. Change subject: packaging: setup: List unreverted changes on cleanup ......................................................................
packaging: setup: List unreverted changes on cleanup Similarly to what we do with files that do not match their saved hash and are not deleted, output lines in files that were supposed to be reverted but are not found. Change-Id: Ib9555c6d6a2f1652edc1065f9c49154123e8accc Signed-off-by: Yedidyah Bar David <d...@redhat.com> --- M packaging/setup/plugins/ovirt-engine-remove/files/simple.py 1 file changed, 48 insertions(+), 1 deletion(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/21/22621/1 diff --git a/packaging/setup/plugins/ovirt-engine-remove/files/simple.py b/packaging/setup/plugins/ovirt-engine-remove/files/simple.py index 6f431ac..0f72df3 100644 --- a/packaging/setup/plugins/ovirt-engine-remove/files/simple.py +++ b/packaging/setup/plugins/ovirt-engine-remove/files/simple.py @@ -83,13 +83,60 @@ just_add.append(c['removed']) else: replace[c['added']] = c['removed'] + # For checking if remove/replace lines were found, we work on copies, + # because there might be duplicate lines in the file. + remove_unremoved = just_remove[:] + replace_unremoved = replace.copy() for line in old_content: - if line not in just_remove: + if line in just_remove: + if line in remove_unremoved: + remove_unremoved.remove(line) + else: #should be updated or added if line in replace: + orig_line = line line = replace[line] + if orig_line in replace_unremoved: + del replace_unremoved[orig_line] new_content.append(line) new_content.extend(just_add) + if remove_unremoved: + self.logger.warning( + _( + 'The following lines were not found in {file} and so ' + 'were not removed:' + ).format( + file=filename, + ) + ) + self.dialog.note( + '\n'.join( + [ + '\t{line}'.format(line=line) + for line in remove_unremoved + ] + ), + ) + if replace_unremoved: + self.logger.warning( + _( + 'The following lines were not found in {file} and so ' + 'were not reverted to their old content:' + ).format( + file=filename, + ) + ) + self.dialog.note( + '\n'.join( + [ + '\tnew:\t{new}\n\told:\t{old}\n'.format( + new=new, + old=old, + ) + for new, old in replace_unremoved.items() + ] + ), + ) self.environment[otopicons.CoreEnv.MAIN_TRANSACTION].append( filetransaction.FileTransaction( -- To view, visit http://gerrit.ovirt.org/22621 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib9555c6d6a2f1652edc1065f9c49154123e8accc Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Yedidyah Bar David <d...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches