summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/python
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/python')
-rw-r--r--meta/recipes-devtools/python/python-smartpm/smart-attempt.patch6
-rw-r--r--meta/recipes-devtools/python/python-smartpm/smart-rpm-transaction-failure-check.patch57
-rw-r--r--meta/recipes-devtools/python/python-smartpm_git.bb1
3 files changed, 61 insertions, 3 deletions
diff --git a/meta/recipes-devtools/python/python-smartpm/smart-attempt.patch b/meta/recipes-devtools/python/python-smartpm/smart-attempt.patch
index ec98e03c0a..5aedc88266 100644
--- a/meta/recipes-devtools/python/python-smartpm/smart-attempt.patch
+++ b/meta/recipes-devtools/python/python-smartpm/smart-attempt.patch
@@ -36,7 +36,7 @@ index 9bbd952..ba6405a 100644
36 finally: 36 finally:
37 del getTS.ts 37 del getTS.ts
38 cb.grabOutput(False) 38 cb.grabOutput(False)
39+ if probs and sysconf.has("attempt-install", soft=True): 39+ if (probs is not None) and sysconf.has("attempt-install", soft=True):
40+ def remove_conflict(pkgNEVR): 40+ def remove_conflict(pkgNEVR):
41+ for key in changeset.keys(): 41+ for key in changeset.keys():
42+ if pkgNEVR == str(key): 42+ if pkgNEVR == str(key):
@@ -67,8 +67,8 @@ index 9bbd952..ba6405a 100644
67+ retry = 0 67+ retry = 0
68+ 68+
69 prog.setDone() 69 prog.setDone()
70- if probs: 70- if probs is not None:
71+ if probs and (not retry): 71+ if (probs is not None) and (not retry):
72 raise Error, "\n".join([x[0] for x in probs]) 72 raise Error, "\n".join([x[0] for x in probs])
73 prog.stop() 73 prog.stop()
74+ if retry and len(changeset): 74+ if retry and len(changeset):
diff --git a/meta/recipes-devtools/python/python-smartpm/smart-rpm-transaction-failure-check.patch b/meta/recipes-devtools/python/python-smartpm/smart-rpm-transaction-failure-check.patch
new file mode 100644
index 0000000000..bb8c3afdb7
--- /dev/null
+++ b/meta/recipes-devtools/python/python-smartpm/smart-rpm-transaction-failure-check.patch
@@ -0,0 +1,57 @@
1From 0c55d7e18f40465e95e8e4bf22af01f5d4477d3c Mon Sep 17 00:00:00 2001
2From: Daniel Klauer <daniel.klauer@gin.de>
3Date: Wed, 11 May 2016 17:22:49 +0200
4Subject: [PATCH] rpm: Don't ignore transaction error with empty problems list
5
6SmartPM could misinterpret RPM transaction error as success,
7if ts.run() (RPM Python API) returns an empty problems list,
8because of incorrect check for None which treated empty list
9to be the same as None when it has different meaning.
10
11ts.run() returns:
12* None in case of success
13* problems list in case of error, may be empty
14(look at rpmts_Run() in rpm-5.4.14/python/rpmts-py.c [1])
15
16"if mylist" is not good enough to check for error here, because it will
17treat an empty list as "false" because its len() == 0 [2].
18
19ts.check() seems to be different (it's ok for it to return an empty list),
20but for consistency it should be made clear that it can return either None,
21an empty list or a non-empty list.
22
23[1] http://rpm5.org/cvs/fileview?f=rpm/python/rpmts-py.c&v=1.111.2.3
24[2] https://docs.python.org/2/library/stdtypes.html#truth-value-testing
25
26Upstream-Status: Pending
27
28Signed-off-by: Daniel Klauer <daniel.klauer@gin.de>
29---
30 smart/backends/rpm/pm.py | 4 ++--
31 1 file changed, 2 insertions(+), 2 deletions(-)
32
33diff --git a/smart/backends/rpm/pm.py b/smart/backends/rpm/pm.py
34index 9bbd952..635f726 100644
35--- a/smart/backends/rpm/pm.py
36+++ b/smart/backends/rpm/pm.py
37@@ -208,7 +208,7 @@ class RPMPackageManager(PackageManager):
38 force = sysconf.get("rpm-force", False)
39 if not force:
40 probs = ts.check()
41- if probs:
42+ if (probs is not None) and (len(probs) != 0):
43 problines = []
44 for prob in probs:
45 name1 = "%s-%s-%s" % prob[0]
46@@ -247,7 +247,7 @@ class RPMPackageManager(PackageManager):
47 del getTS.ts
48 cb.grabOutput(False)
49 prog.setDone()
50- if probs:
51+ if probs is not None:
52 raise Error, "\n".join([x[0] for x in probs])
53 prog.stop()
54
55--
561.9.1
57
diff --git a/meta/recipes-devtools/python/python-smartpm_git.bb b/meta/recipes-devtools/python/python-smartpm_git.bb
index f030b3eb37..0d37dae3cb 100644
--- a/meta/recipes-devtools/python/python-smartpm_git.bb
+++ b/meta/recipes-devtools/python/python-smartpm_git.bb
@@ -17,6 +17,7 @@ SRC_URI = "\
17 file://smart-recommends.patch \ 17 file://smart-recommends.patch \
18 file://smart-improve-error-reporting.patch \ 18 file://smart-improve-error-reporting.patch \
19 file://smart-channelsdir.patch \ 19 file://smart-channelsdir.patch \
20 file://smart-rpm-transaction-failure-check.patch \
20 file://smart-attempt.patch \ 21 file://smart-attempt.patch \
21 file://smart-attempt-fix.patch \ 22 file://smart-attempt-fix.patch \
22 file://smart-add-for-rpm-ignoresize-check.patch \ 23 file://smart-add-for-rpm-ignoresize-check.patch \