summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/python/python-smartpm/smart-attempt.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/python/python-smartpm/smart-attempt.patch')
-rw-r--r--meta/recipes-devtools/python/python-smartpm/smart-attempt.patch164
1 files changed, 59 insertions, 105 deletions
diff --git a/meta/recipes-devtools/python/python-smartpm/smart-attempt.patch b/meta/recipes-devtools/python/python-smartpm/smart-attempt.patch
index 82d2e6cf31..ec98e03c0a 100644
--- a/meta/recipes-devtools/python/python-smartpm/smart-attempt.patch
+++ b/meta/recipes-devtools/python/python-smartpm/smart-attempt.patch
@@ -18,38 +18,68 @@ Upstream-Status: Pending
18Signed-off-by: Mark Hatle <mark.hatle@windriver.com> 18Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
19Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> 19Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
20--- 20---
21 smart.py | 5 +++- 21 backends/rpm/pm.py | 35 ++++++++++++++++++++++++++++++++++-
22 smart/commands/install.py | 5 ++++ 22 transaction.py | 50 +++++++++++++++++++++++++++++++++++++-------------
23 smart/transaction.py | 65 +++++++++++++++++++++++++++++++++++------------ 23 2 files changed, 71 insertions(+), 14 deletions(-)
24 3 files changed, 58 insertions(+), 17 deletions(-)
25 24
26Index: smart-1.4.1/smart/commands/install.py 25diff --git a/smart/backends/rpm/pm.py b/smart/backends/rpm/pm.py
27=================================================================== 26index 9bbd952..ba6405a 100644
28--- smart-1.4.1.orig/smart/commands/install.py 27--- a/smart/backends/rpm/pm.py
29+++ smart-1.4.1/smart/commands/install.py 28+++ b/smart/backends/rpm/pm.py
30@@ -50,6 +50,8 @@ def option_parser(): 29@@ -241,15 +241,48 @@ class RPMPackageManager(PackageManager):
31 parser = OptionParser(usage=USAGE, 30 cb = RPMCallback(prog, upgradednames)
32 description=DESCRIPTION, 31 cb.grabOutput(True)
33 examples=EXAMPLES) 32 probs = None
34+ parser.add_option("--attempt", action="store_true", 33+ retry = 0
35+ help=_("attempt to install packages, ignore failures")) 34 try:
36 parser.add_option("--stepped", action="store_true", 35 probs = ts.run(cb, None)
37 help=_("split operation in steps")) 36 finally:
38 parser.add_option("--urls", action="store_true", 37 del getTS.ts
39@@ -80,6 +82,9 @@ def main(ctrl, opts): 38 cb.grabOutput(False)
40 if not opts.args: 39+ if probs and sysconf.has("attempt-install", soft=True):
41 raise Error, _("no package(s) given") 40+ def remove_conflict(pkgNEVR):
42 41+ for key in changeset.keys():
43+ if opts.attempt: 42+ if pkgNEVR == str(key):
44+ sysconf.set("attempt-install", True, soft=True) 43+ del changeset[key]
44+ del pkgpaths[key]
45+ iface.warning("Removing %s due to file %s conflicting with %s" % (pkgNEVR, fname, altNEVR))
46+ break
47+
48+ retry = 1
49+ for prob in probs:
50+ if prob[1][0] == rpm.RPMPROB_NEW_FILE_CONFLICT:
51+ msg = prob[0].split()
52+ fname = msg[1]
53+ pkgNEVR = msg[7]
54+ altNEVR = msg[9]
55+ pkgNEVR = pkgNEVR.rsplit('.', 1)[0] + '@' + pkgNEVR.rsplit('.', 1)[1]
56+ altNEVR = altNEVR.rsplit('.', 1)[0] + '@' + altNEVR.rsplit('.', 1)[1]
57+ remove_conflict(pkgNEVR)
58+ elif prob[1][0] == rpm.RPMPROB_FILE_CONFLICT:
59+ msg = prob[0].split()
60+ fname = msg[1]
61+ pkgNEVR = msg[5]
62+ altNEVR = msg[11]
63+ pkgNEVR = pkgNEVR.rsplit('.', 1)[0] + '@' + pkgNEVR.rsplit('.', 1)[1]
64+ altNEVR = altNEVR.rsplit('.', 1)[0] + '@' + altNEVR.rsplit('.', 1)[1]
65+ remove_conflict(pkgNEVR)
66+ else:
67+ retry = 0
45+ 68+
46 if opts.explain: 69 prog.setDone()
47 sysconf.set("explain-changesets", True, soft=True) 70- if probs:
71+ if probs and (not retry):
72 raise Error, "\n".join([x[0] for x in probs])
73 prog.stop()
74+ if retry and len(changeset):
75+ self.commit(changeset, pkgpaths)
48 76
49Index: smart-1.4.1/smart/transaction.py 77 class RPMCallback:
50=================================================================== 78 def __init__(self, prog, upgradednames):
51--- smart-1.4.1.orig/smart/transaction.py 79diff --git a/smart/transaction.py b/smart/transaction.py
52+++ smart-1.4.1/smart/transaction.py 80index 4b90cb7..3e043e9 100644
81--- a/smart/transaction.py
82+++ b/smart/transaction.py
53@@ -555,6 +555,8 @@ class Transaction(object): 83@@ -555,6 +555,8 @@ class Transaction(object):
54 changeset.set(pkg, INSTALL) 84 changeset.set(pkg, INSTALL)
55 isinst = changeset.installed 85 isinst = changeset.installed
@@ -145,79 +175,3 @@ Index: smart-1.4.1/smart/transaction.py
145 changeset.set(pkg, INSTALL) 175 changeset.set(pkg, INSTALL)
146 locked[pkg] = (LOCKED_INSTALL, None) 176 locked[pkg] = (LOCKED_INSTALL, None)
147 elif op is REMOVE: 177 elif op is REMOVE:
148@@ -1216,9 +1240,18 @@ class Transaction(object):
149 else:
150 op = REMOVE
151 if op is INSTALL or op is REINSTALL:
152- self._install(pkg, changeset, locked, pending)
153- if pkg in changeset:
154- changeset.setRequested(pkg, True)
155+ try:
156+ self._install(pkg, changeset, locked, pending)
157+ if pkg in changeset:
158+ changeset.setRequested(pkg, True)
159+ except Failed, e:
160+ if attempt:
161+ iface.warning(_("Can't install %s: %s") % (pkg, e))
162+ if pkg in changeset:
163+ del changeset[pkg]
164+ continue
165+ else:
166+ raise Failed, e
167 elif op is REMOVE:
168 self._remove(pkg, changeset, locked, pending)
169 elif op is UPGRADE:
170Index: smart-1.4.1/smart/backends/rpm/pm.py
171===================================================================
172--- smart-1.4.1.orig/smart/backends/rpm/pm.py
173+++ smart-1.4.1/smart/backends/rpm/pm.py
174@@ -243,15 +253,48 @@ class RPMPackageManager(PackageManager):
175 cb = RPMCallback(prog, upgradednames)
176 cb.grabOutput(True)
177 probs = None
178+ retry = 0
179 try:
180 probs = ts.run(cb, None)
181 finally:
182 del getTS.ts
183 cb.grabOutput(False)
184+ if probs and sysconf.has("attempt-install", soft=True):
185+ def remove_conflict(pkgNEVR):
186+ for key in changeset.keys():
187+ if pkgNEVR == str(key):
188+ del changeset[key]
189+ del pkgpaths[key]
190+ iface.warning("Removing %s due to file %s conflicting with %s" % (pkgNEVR, fname, altNEVR))
191+ break
192+
193+ retry = 1
194+ for prob in probs:
195+ if prob[1][0] == rpm.RPMPROB_NEW_FILE_CONFLICT:
196+ msg = prob[0].split()
197+ fname = msg[1]
198+ pkgNEVR = msg[7]
199+ altNEVR = msg[9]
200+ pkgNEVR = pkgNEVR.rsplit('.', 1)[0] + '@' + pkgNEVR.rsplit('.', 1)[1]
201+ altNEVR = altNEVR.rsplit('.', 1)[0] + '@' + altNEVR.rsplit('.', 1)[1]
202+ remove_conflict(pkgNEVR)
203+ elif prob[1][0] == rpm.RPMPROB_FILE_CONFLICT:
204+ msg = prob[0].split()
205+ fname = msg[1]
206+ pkgNEVR = msg[5]
207+ altNEVR = msg[11]
208+ pkgNEVR = pkgNEVR.rsplit('.', 1)[0] + '@' + pkgNEVR.rsplit('.', 1)[1]
209+ altNEVR = altNEVR.rsplit('.', 1)[0] + '@' + altNEVR.rsplit('.', 1)[1]
210+ remove_conflict(pkgNEVR)
211+ else:
212+ retry = 0
213+
214 prog.setDone()
215- if probs:
216+ if probs and (not retry):
217 raise Error, "\n".join([x[0] for x in probs])
218 prog.stop()
219+ if retry and len(changeset):
220+ self.commit(changeset, pkgpaths)
221
222 class RPMCallback:
223 def __init__(self, prog, upgradednames):