diff options
Diffstat (limited to 'meta/recipes-devtools/python/python-smartpm/smart-attempt.patch')
-rw-r--r-- | meta/recipes-devtools/python/python-smartpm/smart-attempt.patch | 167 |
1 files changed, 167 insertions, 0 deletions
diff --git a/meta/recipes-devtools/python/python-smartpm/smart-attempt.patch b/meta/recipes-devtools/python/python-smartpm/smart-attempt.patch new file mode 100644 index 0000000000..113618255f --- /dev/null +++ b/meta/recipes-devtools/python/python-smartpm/smart-attempt.patch | |||
@@ -0,0 +1,167 @@ | |||
1 | From 7ee23804a06f81476cc2b31a6db11b52d7af764e Mon Sep 17 00:00:00 2001 | ||
2 | From: Mark Hatle <mark.hatle@windriver.com> | ||
3 | Date: Mon, 20 Jan 2014 14:30:52 +0000 | ||
4 | Subject: [PATCH] Add mechanism to attempt install without failing | ||
5 | |||
6 | In OpenEmbedded, for complementary and 'attemptonly' package processing, | ||
7 | we need a way to instruct smart to try to install, but ignore any | ||
8 | failures (usually conflicts). | ||
9 | |||
10 | This option only works for the install operation. | ||
11 | |||
12 | Upstream-Status: Pending | ||
13 | |||
14 | Signed-off-by: Mark Hatle <mark.hatle@windriver.com> | ||
15 | Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> | ||
16 | --- | ||
17 | smart/commands/install.py | 5 ++++ | ||
18 | smart/transaction.py | 65 +++++++++++++++++++++++++++++++++++------------ | ||
19 | 2 files changed, 54 insertions(+), 16 deletions(-) | ||
20 | |||
21 | diff --git a/smart/commands/install.py b/smart/commands/install.py | ||
22 | index 590222c..6ef9682 100644 | ||
23 | --- a/smart/commands/install.py | ||
24 | +++ b/smart/commands/install.py | ||
25 | @@ -50,6 +50,8 @@ def option_parser(): | ||
26 | parser = OptionParser(usage=USAGE, | ||
27 | description=DESCRIPTION, | ||
28 | examples=EXAMPLES) | ||
29 | + parser.add_option("--attempt", action="store_true", | ||
30 | + help=_("attempt to install packages, ignore failures")) | ||
31 | parser.add_option("--stepped", action="store_true", | ||
32 | help=_("split operation in steps")) | ||
33 | parser.add_option("--urls", action="store_true", | ||
34 | @@ -80,6 +82,9 @@ def main(ctrl, opts): | ||
35 | if not opts.args: | ||
36 | raise Error, _("no package(s) given") | ||
37 | |||
38 | + if opts.attempt: | ||
39 | + sysconf.set("attempt-install", True, soft=True) | ||
40 | + | ||
41 | if opts.explain: | ||
42 | sysconf.set("explain-changesets", True, soft=True) | ||
43 | |||
44 | diff --git a/smart/transaction.py b/smart/transaction.py | ||
45 | index 5730a42..e3e61c6 100644 | ||
46 | --- a/smart/transaction.py | ||
47 | +++ b/smart/transaction.py | ||
48 | @@ -555,6 +555,8 @@ class Transaction(object): | ||
49 | changeset.set(pkg, INSTALL) | ||
50 | isinst = changeset.installed | ||
51 | |||
52 | + attempt = sysconf.has("attempt-install", soft=True) | ||
53 | + | ||
54 | # Remove packages conflicted by this one. | ||
55 | for cnf in pkg.conflicts: | ||
56 | for prv in cnf.providedby: | ||
57 | @@ -564,11 +566,16 @@ class Transaction(object): | ||
58 | if not isinst(prvpkg): | ||
59 | locked[prvpkg] = (LOCKED_CONFLICT_BY, pkg) | ||
60 | continue | ||
61 | - if prvpkg in locked: | ||
62 | - raise Failed, _("Can't install %s: conflicted package " | ||
63 | - "%s is locked") % (pkg, prvpkg) | ||
64 | - self._remove(prvpkg, changeset, locked, pending, depth) | ||
65 | - pending.append((PENDING_UPDOWN, prvpkg)) | ||
66 | + if attempt: | ||
67 | + del changeset[pkg] | ||
68 | + raise Failed, _("Can't install %s: it conflicts with package " | ||
69 | + "%s") % (pkg, prvpkg) | ||
70 | + else: | ||
71 | + if prvpkg in locked: | ||
72 | + raise Failed, _("Can't install %s: conflicted package " | ||
73 | + "%s is locked") % (pkg, prvpkg) | ||
74 | + self._remove(prvpkg, changeset, locked, pending, depth) | ||
75 | + pending.append((PENDING_UPDOWN, prvpkg)) | ||
76 | |||
77 | # Remove packages conflicting with this one. | ||
78 | for prv in pkg.provides: | ||
79 | @@ -579,12 +586,18 @@ class Transaction(object): | ||
80 | if not isinst(cnfpkg): | ||
81 | locked[cnfpkg] = (LOCKED_CONFLICT, pkg) | ||
82 | continue | ||
83 | - if cnfpkg in locked: | ||
84 | + if attempt: | ||
85 | + del changeset[pkg] | ||
86 | raise Failed, _("Can't install %s: it's conflicted by " | ||
87 | - "the locked package %s") \ | ||
88 | - % (pkg, cnfpkg) | ||
89 | - self._remove(cnfpkg, changeset, locked, pending, depth) | ||
90 | - pending.append((PENDING_UPDOWN, cnfpkg)) | ||
91 | + "the package %s") \ | ||
92 | + % (pkg, cnfpkg) | ||
93 | + else: | ||
94 | + if cnfpkg in locked: | ||
95 | + raise Failed, _("Can't install %s: it's conflicted by " | ||
96 | + "the locked package %s") \ | ||
97 | + % (pkg, cnfpkg) | ||
98 | + self._remove(cnfpkg, changeset, locked, pending, depth) | ||
99 | + pending.append((PENDING_UPDOWN, cnfpkg)) | ||
100 | |||
101 | # Remove packages with the same name that can't | ||
102 | # coexist with this one. | ||
103 | @@ -594,10 +607,15 @@ class Transaction(object): | ||
104 | if not isinst(namepkg): | ||
105 | locked[namepkg] = (LOCKED_NO_COEXIST, pkg) | ||
106 | continue | ||
107 | - if namepkg in locked: | ||
108 | + if attempt: | ||
109 | + del changeset[pkg] | ||
110 | raise Failed, _("Can't install %s: it can't coexist " | ||
111 | "with %s") % (pkg, namepkg) | ||
112 | - self._remove(namepkg, changeset, locked, pending, depth) | ||
113 | + else: | ||
114 | + if namepkg in locked: | ||
115 | + raise Failed, _("Can't install %s: it can't coexist " | ||
116 | + "with %s") % (pkg, namepkg) | ||
117 | + self._remove(namepkg, changeset, locked, pending, depth) | ||
118 | |||
119 | # Install packages required by this one. | ||
120 | for req in pkg.requires + pkg.recommends: | ||
121 | @@ -1176,6 +1194,8 @@ class Transaction(object): | ||
122 | |||
123 | self._policy.runStarting() | ||
124 | |||
125 | + attempt = sysconf.has("attempt-install", soft=True) | ||
126 | + | ||
127 | try: | ||
128 | changeset = self._changeset.copy() | ||
129 | isinst = changeset.installed | ||
130 | @@ -1190,7 +1210,11 @@ class Transaction(object): | ||
131 | locked[pkg] = (LOCKED_KEEP, None) | ||
132 | elif op is INSTALL: | ||
133 | if not isinst(pkg) and pkg in locked: | ||
134 | - raise Failed, _("Can't install %s: it's locked") % pkg | ||
135 | + if attempt: | ||
136 | + iface.warning(_("Can't install %s: it's locked") % pkg) | ||
137 | + del changeset[pkg] | ||
138 | + else: | ||
139 | + raise Failed, _("Can't install %s: it's locked") % pkg | ||
140 | changeset.set(pkg, INSTALL) | ||
141 | locked[pkg] = (LOCKED_INSTALL, None) | ||
142 | elif op is REMOVE: | ||
143 | @@ -1216,9 +1240,18 @@ class Transaction(object): | ||
144 | else: | ||
145 | op = REMOVE | ||
146 | if op is INSTALL or op is REINSTALL: | ||
147 | - self._install(pkg, changeset, locked, pending) | ||
148 | - if pkg in changeset: | ||
149 | - changeset.setRequested(pkg, True) | ||
150 | + try: | ||
151 | + self._install(pkg, changeset, locked, pending) | ||
152 | + if pkg in changeset: | ||
153 | + changeset.setRequested(pkg, True) | ||
154 | + except Failed, e: | ||
155 | + if attempt: | ||
156 | + iface.warning(_("Can't install %s: %s") % (pkg, e)) | ||
157 | + if pkg in changeset: | ||
158 | + del changeset[pkg] | ||
159 | + continue | ||
160 | + else: | ||
161 | + raise Failed, e | ||
162 | elif op is REMOVE: | ||
163 | self._remove(pkg, changeset, locked, pending) | ||
164 | elif op is UPGRADE: | ||
165 | -- | ||
166 | 1.8.4.2 | ||
167 | |||