From 4b58334866dda9b3415fee5668b2c7bc08447905 Mon Sep 17 00:00:00 2001 From: Jamie Lenehan Date: Wed, 30 Aug 2006 07:18:07 +0000 Subject: classes/patch.bbclass: Create a "patches" directory when initialising the quilt patcher class. Without this quilt will search for a patches directory - starting from the current directory up to the root directory. If it finds an existing patches directory it will use it for its patches. This causes all sorts of problems since it is not where the patches are expected to be. Prior to the recent patcher changes this directory was being created. --- classes/patch.bbclass | 3 +++ 1 file changed, 3 insertions(+) (limited to 'classes') diff --git a/classes/patch.bbclass b/classes/patch.bbclass index ea0182484e..c62a8ebd76 100644 --- a/classes/patch.bbclass +++ b/classes/patch.bbclass @@ -174,6 +174,9 @@ def patch_init(d): def __init__(self, dir, d): PatchSet.__init__(self, dir, d) self.initialized = False + p = os.path.join(self.dir, 'patches') + if not os.path.exists(p): + os.mkdir(p) def Clean(self): try: -- cgit v1.2.3 From dc8d0a5f1ea8956bc4af88132472cccde4a0e7c3 Mon Sep 17 00:00:00 2001 From: Chris Larson Date: Wed, 30 Aug 2006 07:29:56 +0000 Subject: patch.bbclass: * Add NOOPResolver class, which simply passes the patch failure on up, not doing any actual patch resolution. Set PATCHRESOLVE = "noop" to make use of it. Most useful for unattended builds. --- classes/patch.bbclass | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'classes') diff --git a/classes/patch.bbclass b/classes/patch.bbclass index c62a8ebd76..7bb0900f8a 100644 --- a/classes/patch.bbclass +++ b/classes/patch.bbclass @@ -309,6 +309,19 @@ def patch_init(d): def Finalize(self): raise NotImplementedError() + class NOOPResolver(Resolver): + def __init__(self, patchset): + self.patchset = patchset + + def Resolve(self): + olddir = os.path.abspath(os.curdir) + os.chdir(self.patchset.dir) + try: + self.patchset.Push() + except Exception: + os.chdir(olddir) + raise sys.exc_value + # Patch resolver which relies on the user doing all the work involved in the # resolution, with the exception of refreshing the remote copy of the patch # files (the urls). @@ -360,20 +373,13 @@ def patch_init(d): raise os.chdir(olddir) - # Throw away the changes to the patches in the patchset made by resolve() - def Revert(self): - raise NotImplementedError() - - # Apply the changes to the patches in the patchset made by resolve() - def Finalize(self): - raise NotImplementedError() - g = globals() g["PatchSet"] = PatchSet g["PatchTree"] = PatchTree g["QuiltTree"] = QuiltTree g["Resolver"] = Resolver g["UserResolver"] = UserResolver + g["NOOPResolver"] = NOOPResolver g["NotFoundError"] = NotFoundError g["CmdError"] = CmdError @@ -397,6 +403,7 @@ python patch_do_patch() { cls = patchsetmap[bb.data.getVar('PATCHTOOL', d, 1) or 'quilt'] resolvermap = { + "noop": NOOPResolver, "user": UserResolver, } -- cgit v1.2.3 From ee5c15c58188e02db43e54b9093d9c0f73696182 Mon Sep 17 00:00:00 2001 From: Chris Larson Date: Wed, 30 Aug 2006 08:32:22 +0000 Subject: patch.bbclass: * switch os.mkdir to os.makedirs. * pass on all errors from QuiltTree.Clean(), as it can fail in ways that do not need to be reported to the user, and a failure will end up being seen again during the Import/Push of the patches. --- classes/patch.bbclass | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'classes') diff --git a/classes/patch.bbclass b/classes/patch.bbclass index 7bb0900f8a..5e40b3dc0d 100644 --- a/classes/patch.bbclass +++ b/classes/patch.bbclass @@ -176,16 +176,13 @@ def patch_init(d): self.initialized = False p = os.path.join(self.dir, 'patches') if not os.path.exists(p): - os.mkdir(p) + os.makedirs(p) def Clean(self): try: self._runcmd(["pop", "-a", "-f"]) - except CmdError: - pass - except NotFoundError: + except Exception: pass - # runcmd(["rm", "-rf", os.path.join(self.dir, "patches"), os.path.join(self.dir, ".pc")]) self.initialized = True def InitFromDir(self): -- cgit v1.2.3