summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/python/python-smartpm/smart-attempt-fix.patch
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2015-07-16 23:54:11 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-07-20 10:40:41 +0100
commit350b73f240f45cf3ae4d0f746090c9dbae039921 (patch)
tree2bde75cd34180087058aa49eb3573888c10a5cfd /meta/recipes-devtools/python/python-smartpm/smart-attempt-fix.patch
parentfbec9200fd636a015d8e2d6209e01215e5465f8a (diff)
downloadpoky-350b73f240f45cf3ae4d0f746090c9dbae039921.tar.gz
python-smartpm: Improve warnings/errors consistency
Sadly, smart is not deterministic so the same build can go down multiple different pathways. We'd expect to see the same warnings however depending on the pathway taken, it may or may not warn, particularly with Recommends since they're optional. For example, where a Recommended package is available but has Conflicts, we'd expect to see an warning that we couldn't install it. Some code paths silently hide this (its a LOCKED_CONFLICT). We add printing of warnings for this case. Also, if there are two compatible feeds available (e.g. i586 and core2_32), this changes the code path from direct _install() to _pending() since there are multiple providers. This patch adds warning handling to _pending() so we don't hit hard failures there. This is as seen with the mysterious libspeexdsp failures for x86-lsb on the autobuilder. (From OE-Core rev: ab1eb2432b9a9823335450fd12476e910a95a2aa) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/python/python-smartpm/smart-attempt-fix.patch')
-rw-r--r--meta/recipes-devtools/python/python-smartpm/smart-attempt-fix.patch158
1 files changed, 158 insertions, 0 deletions
diff --git a/meta/recipes-devtools/python/python-smartpm/smart-attempt-fix.patch b/meta/recipes-devtools/python/python-smartpm/smart-attempt-fix.patch
new file mode 100644
index 0000000000..6e672b3321
--- /dev/null
+++ b/meta/recipes-devtools/python/python-smartpm/smart-attempt-fix.patch
@@ -0,0 +1,158 @@
1Sadly, smart is not deterministic so the same build can go down multiple different
2pathways. We'd expect to see the same warnings however depending on the pathway
3taken, it may or may not warn, particularly with Recommends since they're optional.
4
5For example, where a Recommended package is available but has Conflicts, we'd expect
6to see an warning that we couldn't install it. Some code paths silently hide this
7(its a LOCKED_CONFLICT). We add printing of warnings for this case.
8
9Also, if there are two compatible feeds available (e.g. i586 and core2_32), this
10changes the code path from direct _install() to _pending() since there are multiple
11providers. This patch adds warning handling to _pending() so we don't hit hard
12failures there. This is as seen with the mysterious libspeexdsp failures for x86-lsb
13on the autobuilder.
14
15Upstream-Status: Pending
16RP
172015/7/16
18
19Index: git/smart/transaction.py
20===================================================================
21--- git.orig/smart/transaction.py
22+++ git/smart/transaction.py
23@@ -651,13 +651,14 @@ class Transaction(object):
24
25 if not prvpkgs:
26 # No packages provide it at all. Give up.
27+
28+ reasons = []
29+ for prv in req.providedby:
30+ for prvpkg in prv.packages:
31+ lockedres = lockedpkgs.get(prvpkg, None)
32+ if lockedres:
33+ reasons.append(lock_reason(prvpkg, lockedres))
34 if reqrequired:
35- reasons = []
36- for prv in req.providedby:
37- for prvpkg in prv.packages:
38- lockedres = lockedpkgs.get(prvpkg, None)
39- if lockedres:
40- reasons.append(lock_reason(prvpkg, lockedres))
41 if reasons:
42 raise Failed, _("Can't install %s: unable to install provider for %s:\n %s") % \
43 (pkg, req, '\n '.join(reasons))
44@@ -665,7 +666,11 @@ class Transaction(object):
45 raise Failed, _("Can't install %s: no package provides %s") % \
46 (pkg, req)
47 else:
48+ if reasons:
49+ iface.warning(_("Can't install %s: unable to install provider for %s:\n %s") % \
50+ (pkg, req, '\n '.join(reasons)))
51+
52 # It's only a recommend, skip
53 continue
54
55 if len(prvpkgs) == 1:
56@@ -846,6 +852,14 @@ class Transaction(object):
57 isinst = changeset.installed
58 getweight = self._policy.getWeight
59
60+ attempt = sysconf.has("attempt-install", soft=True)
61+
62+ def handle_failure(msg):
63+ if attempt:
64+ iface.warning(msg)
65+ else:
66+ raise Failed, msg
67+
68 updown = []
69 while pending:
70 item = pending.pop(0)
71@@ -870,8 +884,9 @@ class Transaction(object):
72
73 if not prvpkgs:
74 # No packages provide it at all. Give up.
75- raise Failed, _("Can't install %s: no package "
76- "provides %s") % (pkg, req)
77+ handle_failure(_("Can't install %s: no package "
78+ "provides %s") % (pkg, req))
79+ continue
80
81 if len(prvpkgs) > 1:
82 # More than one package provide it. We use _pending here,
83@@ -894,9 +909,10 @@ class Transaction(object):
84 keeporder, cs, lk))
85 keeporder += 0.000001
86 if not alternatives:
87- raise Failed, _("Can't install %s: all packages "
88+ handle_failure(_("Can't install %s: all packages "
89 "providing %s failed to install:\n%s")\
90- % (pkg, req, "\n".join(failures))
91+ % (pkg, req, "\n".join(failures)))
92+ continue
93 alternatives.sort()
94 changeset.setState(alternatives[0][1])
95 if len(alternatives) == 1:
96@@ -954,18 +970,20 @@ class Transaction(object):
97
98 for reqpkg in reqpkgs:
99 if reqpkg in locked and isinst(reqpkg):
100- raise Failed, _("Can't remove %s: requiring "
101+ handle_failure(_("Can't remove %s: requiring "
102 "package %s is locked") % \
103- (pkg, reqpkg)
104+ (pkg, reqpkg))
105+ continue
106 for reqpkg in reqpkgs:
107 # We check again, since other actions may have
108 # changed their state.
109 if not isinst(reqpkg):
110 continue
111 if reqpkg in locked:
112- raise Failed, _("Can't remove %s: requiring "
113+ handle_failure(_("Can't remove %s: requiring "
114 "package %s is locked") % \
115- (pkg, reqpkg)
116+ (pkg, reqpkg))
117+ continue
118 self._remove(reqpkg, changeset, locked,
119 pending, depth)
120 continue
121@@ -978,12 +996,14 @@ class Transaction(object):
122 try:
123 for reqpkg in reqpkgs:
124 if reqpkg in locked and isinst(reqpkg):
125- raise Failed, _("%s is locked") % reqpkg
126+ handle_failure(_("%s is locked") % reqpkg)
127+ continue
128 for reqpkg in reqpkgs:
129 if not cs.installed(reqpkg):
130 continue
131 if reqpkg in lk:
132- raise Failed, _("%s is locked") % reqpkg
133+ handle_failure(_("%s is locked") % reqpkg)
134+ continue
135 self._remove(reqpkg, cs, lk, None, depth)
136 except Failed, e:
137 failures.append(unicode(e))
138@@ -991,9 +1011,10 @@ class Transaction(object):
139 alternatives.append((getweight(cs), cs, lk))
140
141 if not alternatives:
142- raise Failed, _("Can't install %s: all packages providing "
143+ handle_failure(_("Can't install %s: all packages providing "
144 "%s failed to install:\n%s") \
145- % (pkg, prv, "\n".join(failures))
146+ % (pkg, prv, "\n".join(failures)))
147+ continue
148
149 alternatives.sort()
150 changeset.setState(alternatives[0][1])
151@@ -1246,6 +1267,7 @@ class Transaction(object):
152 changeset.setRequested(pkg, True)
153 except Failed, e:
154 if sysconf.has("attempt-install", soft=True):
155+ iface.warning(_("Can't install %s: %s") % (pkg, str(e)))
156 if pkg in changeset:
157 del changeset[pkg]
158 continue