]> code.ossystems Code Review - openembedded-core.git/commitdiff
patch.bbclass: sync with upstream oe.
authorChris Larson <kergoth@openedhand.com>
Fri, 15 Sep 2006 07:54:58 +0000 (07:54 +0000)
committerChris Larson <kergoth@openedhand.com>
Fri, 15 Sep 2006 07:54:58 +0000 (07:54 +0000)
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@713 311d38ba-8fff-0310-9ca6-ca027cbcb966

meta/classes/patch.bbclass

index 5e40b3dc0dae933fde97162229cf5aca24686f97..0989407844a7e1dde55fe4176b3cb1da459d3a70 100644 (file)
@@ -117,24 +117,27 @@ def patch_init(d):
                        """"""
                        PatchSet.Import(self, patch, force)
 
-                       self.patches.insert(self._current or 0, patch)
+                       if self._current is not None:
+                               i = self._current + 1
+                       else:
+                               i = 0
+                       self.patches.insert(i, patch)
 
                def _applypatch(self, patch, force = None, reverse = None):
-                       shellcmd = ["patch", "<", patch['file'], "-p", patch['strippath']]
+                       shellcmd = ["cat", patch['file'], "|", "patch", "-p", patch['strippath']]
                        if reverse:
                                shellcmd.append('-R')
-                       shellcmd.append('--dry-run')
 
-                       try:
-                               output = runcmd(["sh", "-c", " ".join(shellcmd)], self.dir)
-                       except CmdError:
-                               if force:
-                                       shellcmd.pop(len(shellcmd) - 1)
-                                       output = runcmd(["sh", "-c", " ".join(shellcmd)], self.dir)
-                               else:
-                                       import sys
-                                       raise sys.exc_value
+                       if not force:
+                               shellcmd.append('--dry-run')
+
+                       output = runcmd(["sh", "-c", " ".join(shellcmd)], self.dir)
+
+                       if force:
+                               return
 
+                       shellcmd.pop(len(shellcmd) - 1)
+                       output = runcmd(["sh", "-c", " ".join(shellcmd)], self.dir)
                        return output
 
                def Push(self, force = None, all = None):
@@ -144,12 +147,14 @@ def patch_init(d):
                                                self._current = self._current + 1
                                        else:
                                                self._current = 0
+                                       bb.note("applying patch %s" % i)
                                        self._applypatch(i, force)
                        else:
                                if self._current is not None:
                                        self._current = self._current + 1
                                else:
                                        self._current = 0
+                               bb.note("applying patch %s" % self.patches[self._current])
                                self._applypatch(self.patches[self._current], force)