diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2014-02-06 13:39:01 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-02-11 11:56:56 +0000 |
commit | e9c1191da4f84c9743b053e7030ab28b48f57c44 (patch) | |
tree | 6ec08d0f0e48c1614a87c4a932b96df47d94c502 /meta/recipes-devtools/python | |
parent | f9623968f078758eb8fb8ebad0b4595b15f8cb42 (diff) | |
download | poky-e9c1191da4f84c9743b053e7030ab28b48f57c44.tar.gz |
python-smartpm: really ignore conflicts during install with --attempt
The original patch added in OE-Core commit
bdf07b1698d228dc7ff555199a269b1ff8ceca19 was supposed to ignore
conflicts, but it was unable to do so because it wasn't raising errors
in the right place. When the --attempt option is used (as is done in
complementary package installation for RPM), raise errors immediately
on conflicts, catch errors at the right point so that requested packages
and their dependencies can be ignored, and print appropriate warnings
when doing so.
Fixes [YOCTO #5313].
(From OE-Core rev: 210a426584b77ad2331332059af85bb9f4e2081f)
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/python')
-rw-r--r-- | meta/recipes-devtools/python/python-smartpm/smart-attempt.patch | 134 |
1 files changed, 121 insertions, 13 deletions
diff --git a/meta/recipes-devtools/python/python-smartpm/smart-attempt.patch b/meta/recipes-devtools/python/python-smartpm/smart-attempt.patch index 0d603d3d1b..113618255f 100644 --- a/meta/recipes-devtools/python/python-smartpm/smart-attempt.patch +++ b/meta/recipes-devtools/python/python-smartpm/smart-attempt.patch | |||
@@ -1,18 +1,27 @@ | |||
1 | Add a mechanism to attempt the install operation, w/o failing. | 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 | ||
2 | 5 | ||
3 | For complementary and 'attemptonly' packages, we need a way to instruct smart to | 6 | In OpenEmbedded, for complementary and 'attemptonly' package processing, |
4 | try to install, but ignore any failures. | 7 | we need a way to instruct smart to try to install, but ignore any |
8 | failures (usually conflicts). | ||
5 | 9 | ||
6 | This option only works for the install operation. | 10 | This option only works for the install operation. |
7 | 11 | ||
8 | Upstream-Status: Pending | 12 | Upstream-Status: Pending |
9 | 13 | ||
10 | Signed-off-by: Mark Hatle <mark.hatle@windriver.com> | 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(-) | ||
11 | 20 | ||
12 | Index: smart-1.4.1/smart/commands/install.py | 21 | diff --git a/smart/commands/install.py b/smart/commands/install.py |
13 | =================================================================== | 22 | index 590222c..6ef9682 100644 |
14 | --- smart-1.4.1.orig/smart/commands/install.py | 23 | --- a/smart/commands/install.py |
15 | +++ smart-1.4.1/smart/commands/install.py | 24 | +++ b/smart/commands/install.py |
16 | @@ -50,6 +50,8 @@ def option_parser(): | 25 | @@ -50,6 +50,8 @@ def option_parser(): |
17 | parser = OptionParser(usage=USAGE, | 26 | parser = OptionParser(usage=USAGE, |
18 | description=DESCRIPTION, | 27 | description=DESCRIPTION, |
@@ -32,11 +41,106 @@ Index: smart-1.4.1/smart/commands/install.py | |||
32 | if opts.explain: | 41 | if opts.explain: |
33 | sysconf.set("explain-changesets", True, soft=True) | 42 | sysconf.set("explain-changesets", True, soft=True) |
34 | 43 | ||
35 | Index: smart-1.4.1/smart/transaction.py | 44 | diff --git a/smart/transaction.py b/smart/transaction.py |
36 | =================================================================== | 45 | index 5730a42..e3e61c6 100644 |
37 | --- smart-1.4.1.orig/smart/transaction.py | 46 | --- a/smart/transaction.py |
38 | +++ smart-1.4.1/smart/transaction.py | 47 | +++ b/smart/transaction.py |
39 | @@ -1216,9 +1216,17 @@ class Transaction(object): | 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): | ||
40 | else: | 144 | else: |
41 | op = REMOVE | 145 | op = REMOVE |
42 | if op is INSTALL or op is REINSTALL: | 146 | if op is INSTALL or op is REINSTALL: |
@@ -48,7 +152,8 @@ Index: smart-1.4.1/smart/transaction.py | |||
48 | + if pkg in changeset: | 152 | + if pkg in changeset: |
49 | + changeset.setRequested(pkg, True) | 153 | + changeset.setRequested(pkg, True) |
50 | + except Failed, e: | 154 | + except Failed, e: |
51 | + if sysconf.has("attempt-install", soft=True): | 155 | + if attempt: |
156 | + iface.warning(_("Can't install %s: %s") % (pkg, e)) | ||
52 | + if pkg in changeset: | 157 | + if pkg in changeset: |
53 | + del changeset[pkg] | 158 | + del changeset[pkg] |
54 | + continue | 159 | + continue |
@@ -57,3 +162,6 @@ Index: smart-1.4.1/smart/transaction.py | |||
57 | elif op is REMOVE: | 162 | elif op is REMOVE: |
58 | self._remove(pkg, changeset, locked, pending) | 163 | self._remove(pkg, changeset, locked, pending) |
59 | elif op is UPGRADE: | 164 | elif op is UPGRADE: |
165 | -- | ||
166 | 1.8.4.2 | ||
167 | |||