summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/python/python-smartpm/smart-attempt.patch
blob: 0d603d3d1b92021444fe69df5818cb3b8e99d99b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
Add a mechanism to attempt the install operation, w/o failing.

For complementary and 'attemptonly' packages, we need a way to instruct smart to
try to install, but ignore any failures.

This option only works for the install operation.

Upstream-Status: Pending

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>

Index: smart-1.4.1/smart/commands/install.py
===================================================================
--- smart-1.4.1.orig/smart/commands/install.py
+++ smart-1.4.1/smart/commands/install.py
@@ -50,6 +50,8 @@ def option_parser():
     parser = OptionParser(usage=USAGE,
                           description=DESCRIPTION,
                           examples=EXAMPLES)
+    parser.add_option("--attempt", action="store_true",
+                      help=_("attempt to install packages, ignore failures"))
     parser.add_option("--stepped", action="store_true",
                       help=_("split operation in steps"))
     parser.add_option("--urls", action="store_true",
@@ -80,6 +82,9 @@ def main(ctrl, opts):
     if not opts.args:
         raise Error, _("no package(s) given")
 
+    if opts.attempt:
+	sysconf.set("attempt-install", True, soft=True)
+
     if opts.explain:
         sysconf.set("explain-changesets", True, soft=True)
 
Index: smart-1.4.1/smart/transaction.py
===================================================================
--- smart-1.4.1.orig/smart/transaction.py
+++ smart-1.4.1/smart/transaction.py
@@ -1216,9 +1216,17 @@ class Transaction(object):
                     else:
                         op = REMOVE
                 if op is INSTALL or op is REINSTALL:
-                    self._install(pkg, changeset, locked, pending)
-                    if pkg in changeset:
-                        changeset.setRequested(pkg, True)
+                    try:
+                        self._install(pkg, changeset, locked, pending)
+                        if pkg in changeset:
+                            changeset.setRequested(pkg, True)
+                    except Failed, e:
+                        if sysconf.has("attempt-install", soft=True):
+                            if pkg in changeset:
+                                del changeset[pkg]
+                            continue
+                        else:
+                            raise Failed, e
                 elif op is REMOVE:
                     self._remove(pkg, changeset, locked, pending)
                 elif op is UPGRADE: