diff options
-rw-r--r-- | meta/classes/patch.bbclass | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/meta/classes/patch.bbclass b/meta/classes/patch.bbclass index 5e40b3dc0d..0989407844 100644 --- a/meta/classes/patch.bbclass +++ b/meta/classes/patch.bbclass | |||
@@ -117,24 +117,27 @@ def patch_init(d): | |||
117 | """""" | 117 | """""" |
118 | PatchSet.Import(self, patch, force) | 118 | PatchSet.Import(self, patch, force) |
119 | 119 | ||
120 | self.patches.insert(self._current or 0, patch) | 120 | if self._current is not None: |
121 | i = self._current + 1 | ||
122 | else: | ||
123 | i = 0 | ||
124 | self.patches.insert(i, patch) | ||
121 | 125 | ||
122 | def _applypatch(self, patch, force = None, reverse = None): | 126 | def _applypatch(self, patch, force = None, reverse = None): |
123 | shellcmd = ["patch", "<", patch['file'], "-p", patch['strippath']] | 127 | shellcmd = ["cat", patch['file'], "|", "patch", "-p", patch['strippath']] |
124 | if reverse: | 128 | if reverse: |
125 | shellcmd.append('-R') | 129 | shellcmd.append('-R') |
126 | shellcmd.append('--dry-run') | ||
127 | 130 | ||
128 | try: | 131 | if not force: |
129 | output = runcmd(["sh", "-c", " ".join(shellcmd)], self.dir) | 132 | shellcmd.append('--dry-run') |
130 | except CmdError: | 133 | |
131 | if force: | 134 | output = runcmd(["sh", "-c", " ".join(shellcmd)], self.dir) |
132 | shellcmd.pop(len(shellcmd) - 1) | 135 | |
133 | output = runcmd(["sh", "-c", " ".join(shellcmd)], self.dir) | 136 | if force: |
134 | else: | 137 | return |
135 | import sys | ||
136 | raise sys.exc_value | ||
137 | 138 | ||
139 | shellcmd.pop(len(shellcmd) - 1) | ||
140 | output = runcmd(["sh", "-c", " ".join(shellcmd)], self.dir) | ||
138 | return output | 141 | return output |
139 | 142 | ||
140 | def Push(self, force = None, all = None): | 143 | def Push(self, force = None, all = None): |
@@ -144,12 +147,14 @@ def patch_init(d): | |||
144 | self._current = self._current + 1 | 147 | self._current = self._current + 1 |
145 | else: | 148 | else: |
146 | self._current = 0 | 149 | self._current = 0 |
150 | bb.note("applying patch %s" % i) | ||
147 | self._applypatch(i, force) | 151 | self._applypatch(i, force) |
148 | else: | 152 | else: |
149 | if self._current is not None: | 153 | if self._current is not None: |
150 | self._current = self._current + 1 | 154 | self._current = self._current + 1 |
151 | else: | 155 | else: |
152 | self._current = 0 | 156 | self._current = 0 |
157 | bb.note("applying patch %s" % self.patches[self._current]) | ||
153 | self._applypatch(self.patches[self._current], force) | 158 | self._applypatch(self.patches[self._current], force) |
154 | 159 | ||
155 | 160 | ||