diff options
author | Gyorgy Sarvari <skandigraun@gmail.com> | 2025-09-15 11:02:05 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-09-18 11:16:35 +0100 |
commit | a690cfb9c05f4fbd23712e6eada376d023a6036a (patch) | |
tree | eb535a06624a4422d5bdfbe74670dae38625fa55 /meta/lib/patchtest/repo.py | |
parent | 4ea7a1d0cbfc77b3b8c6b34b5e3da49f97adf463 (diff) | |
download | poky-a690cfb9c05f4fbd23712e6eada376d023a6036a.tar.gz |
patchtest: apply patch in repo root
Patchtest tries to apply the received patch on the repository, without
specifying the directory, which means that the CWD is used. In case the
patch modifies a content in a different folder (e.g. the script is running
in ./meta, but the patch modifies ./meta-selftest), the patch will be skipped,
but git still returns 0, instead of complaining.
To avoid such false positives, specify the working directory for applying the
patch - the top of the repodir.
(From OE-Core rev: 6c7bb23b05ab613d5efe8e1378d7e1b1cc8cfc45)
Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/patchtest/repo.py')
-rw-r--r-- | meta/lib/patchtest/repo.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/meta/lib/patchtest/repo.py b/meta/lib/patchtest/repo.py index 8ec8f68a0b..2cdd6736e4 100644 --- a/meta/lib/patchtest/repo.py +++ b/meta/lib/patchtest/repo.py | |||
@@ -52,7 +52,7 @@ class PatchTestRepo(object): | |||
52 | self._patchcanbemerged = True | 52 | self._patchcanbemerged = True |
53 | try: | 53 | try: |
54 | # Make sure to get the absolute path of the file | 54 | # Make sure to get the absolute path of the file |
55 | self.repo.git.execute(['git', 'apply', '--check', os.path.abspath(self.patch.path)], with_exceptions=True) | 55 | self.repo.git.execute(['git', '-C', self.repodir, 'apply', '--check', os.path.abspath(self.patch.path)], with_exceptions=True) |
56 | except git.exc.GitCommandError as ce: | 56 | except git.exc.GitCommandError as ce: |
57 | self._patchcanbemerged = False | 57 | self._patchcanbemerged = False |
58 | 58 | ||
@@ -76,7 +76,7 @@ class PatchTestRepo(object): | |||
76 | 76 | ||
77 | def merge(self): | 77 | def merge(self): |
78 | if self._patchcanbemerged: | 78 | if self._patchcanbemerged: |
79 | self.repo.git.execute(['git', 'am', '--keep-cr', os.path.abspath(self.patch.path)]) | 79 | self.repo.git.execute(['git', '-C', self.repodir, 'am', '--keep-cr', os.path.abspath(self.patch.path)]) |
80 | self._patchmerged = True | 80 | self._patchmerged = True |
81 | 81 | ||
82 | def clean(self): | 82 | def clean(self): |