diff options
| author | Ross Burton <ross.burton@arm.com> | 2023-11-21 14:06:17 +0000 |
|---|---|---|
| committer | Steve Sakoman <steve@sakoman.com> | 2024-01-04 04:09:43 -1000 |
| commit | 911935d7bdd166ede35ddbad4f454eaccd2a0982 (patch) | |
| tree | 85f5f4b016a90b6b8c582ab13ff4267daa5e29a8 /meta/lib | |
| parent | dc33087410ae71ca6e2d4ac63ff4c948ac78d495 (diff) | |
| download | poky-911935d7bdd166ede35ddbad4f454eaccd2a0982.tar.gz | |
lib/oe/patch: ensure os.chdir restoring always happens
If we chdir(), do the chdir back to the original directory in a finally
block so they always run.
(From OE-Core rev: 1680d1766445b21e35c6b874c4767b385862017f)
Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit cdc40292818683b6df1c814498c7589450a163fa)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
Diffstat (limited to 'meta/lib')
| -rw-r--r-- | meta/lib/oe/patch.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/meta/lib/oe/patch.py b/meta/lib/oe/patch.py index ff9afc9df9..9b480b2b28 100644 --- a/meta/lib/oe/patch.py +++ b/meta/lib/oe/patch.py | |||
| @@ -772,8 +772,9 @@ class NOOPResolver(Resolver): | |||
| 772 | self.patchset.Push() | 772 | self.patchset.Push() |
| 773 | except Exception: | 773 | except Exception: |
| 774 | import sys | 774 | import sys |
| 775 | os.chdir(olddir) | ||
| 776 | raise | 775 | raise |
| 776 | finally: | ||
| 777 | os.chdir(olddir) | ||
| 777 | 778 | ||
| 778 | # Patch resolver which relies on the user doing all the work involved in the | 779 | # Patch resolver which relies on the user doing all the work involved in the |
| 779 | # resolution, with the exception of refreshing the remote copy of the patch | 780 | # resolution, with the exception of refreshing the remote copy of the patch |
| @@ -833,9 +834,9 @@ class UserResolver(Resolver): | |||
| 833 | # User did not fix the problem. Abort. | 834 | # User did not fix the problem. Abort. |
| 834 | raise PatchError("Patch application failed, and user did not fix and refresh the patch.") | 835 | raise PatchError("Patch application failed, and user did not fix and refresh the patch.") |
| 835 | except Exception: | 836 | except Exception: |
| 836 | os.chdir(olddir) | ||
| 837 | raise | 837 | raise |
| 838 | os.chdir(olddir) | 838 | finally: |
| 839 | os.chdir(olddir) | ||
| 839 | 840 | ||
| 840 | 841 | ||
| 841 | def patch_path(url, fetch, workdir, expand=True): | 842 | def patch_path(url, fetch, workdir, expand=True): |
