integ/extended/python-smartpm/files/commit_transaction_error_handling.patch
Dean Troyer 3cd12006bb StarlingX open source release updates
Signed-off-by: Dean Troyer <dtroyer@gmail.com>
2018-05-31 07:36:35 -07:00

38 lines
1.2 KiB
Diff

---
smart/backends/rpm/pm.py | 10 ++++++++++
1 file changed, 10 insertions(+)
--- a/smart/backends/rpm/pm.py
+++ b/smart/backends/rpm/pm.py
@@ -283,6 +283,8 @@ class RPMPackageManager(PackageManager):
prog.setDone()
if probs and (not retry):
raise Error, "\n".join([x[0] for x in probs])
+ if cb.errors > 0:
+ raise Error, "One or more errors occurred during transaction"
prog.stop()
if retry and len(changeset):
self.commit(changeset, pkgpaths)
@@ -297,6 +299,7 @@ class RPMCallback:
self.rpmoutbuffer = ""
self.lasttopic = None
self.topic = None
+ self.errors = 0
def grabOutput(self, flag):
if flag:
@@ -415,6 +418,13 @@ class RPMCallback:
self.prog.setSubDone(subkey)
self.prog.show()
+ elif what == rpm.RPMCALLBACK_SCRIPT_ERROR:
+ self.errors += 1
+ elif what == rpm.RPMCALLBACK_UNPACK_ERROR:
+ self.errors += 1
+ elif what == rpm.RPMCALLBACK_CPIO_ERROR:
+ self.errors += 1
+
from smart.backends.rpm.base import rpm, getTS
# vim:ts=4:sw=4:et