* [PATCH 0/2] patch class fixes
@ 2017-12-05 1:36 Paul Eggleton
2017-12-05 1:36 ` [PATCH 1/2] classes/patch: remove unused variable Paul Eggleton
2017-12-05 1:36 ` [PATCH 2/2] classes/patch: when PATCHTOOL = "git" double-check the repository Paul Eggleton
0 siblings, 2 replies; 3+ messages in thread
From: Paul Eggleton @ 2017-12-05 1:36 UTC (permalink / raw)
To: openembedded-core
A couple of fixes for the patch class.
The following changes since commit a7cd9d1183be603777fc9c8c448281fe01224f7b:
lib/oe/utils: remove param_bool() (2017-12-02 11:24:38 +0000)
are available in the git repository at:
git://git.openembedded.org/openembedded-core-contrib paule/patch-fixes
http://cgit.openembedded.org/openembedded-core-contrib/log/?h=paule/patch-fixes
Paul Eggleton (2):
classes/patch: remove unused variable
classes/patch: when PATCHTOOL = "git" double-check the repository
meta/classes/patch.bbclass | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
--
2.9.5
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/2] classes/patch: remove unused variable
2017-12-05 1:36 [PATCH 0/2] patch class fixes Paul Eggleton
@ 2017-12-05 1:36 ` Paul Eggleton
2017-12-05 1:36 ` [PATCH 2/2] classes/patch: when PATCHTOOL = "git" double-check the repository Paul Eggleton
1 sibling, 0 replies; 3+ messages in thread
From: Paul Eggleton @ 2017-12-05 1:36 UTC (permalink / raw)
To: openembedded-core
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
meta/classes/patch.bbclass | 1 -
1 file changed, 1 deletion(-)
diff --git a/meta/classes/patch.bbclass b/meta/classes/patch.bbclass
index 8f35cb4..930ee33 100644
--- a/meta/classes/patch.bbclass
+++ b/meta/classes/patch.bbclass
@@ -26,7 +26,6 @@ python () {
python patch_task_patch_prefunc() {
# Prefunc for do_patch
- func = d.getVar('BB_RUNTASK')
srcsubdir = d.getVar('S')
patchdir = os.path.join(srcsubdir, 'patches')
--
2.9.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] classes/patch: when PATCHTOOL = "git" double-check the repository
2017-12-05 1:36 [PATCH 0/2] patch class fixes Paul Eggleton
2017-12-05 1:36 ` [PATCH 1/2] classes/patch: remove unused variable Paul Eggleton
@ 2017-12-05 1:36 ` Paul Eggleton
1 sibling, 0 replies; 3+ messages in thread
From: Paul Eggleton @ 2017-12-05 1:36 UTC (permalink / raw)
To: openembedded-core
If a bug is present or the user has set PATCHTOOL = "git" on a source
tree that isn't git, if we try to perform git operations (such as
committing or changing branches) when extracting source, then we might
in fact be running those operations on the metadata repository if the
build directory is underneath, say, poky or OE-Core, and that could
make a mess. Check if the source tree is a git repository and refuse
to continue if it isn't.
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
meta/classes/patch.bbclass | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/meta/classes/patch.bbclass b/meta/classes/patch.bbclass
index 930ee33..2fc6925 100644
--- a/meta/classes/patch.bbclass
+++ b/meta/classes/patch.bbclass
@@ -28,6 +28,21 @@ python patch_task_patch_prefunc() {
# Prefunc for do_patch
srcsubdir = d.getVar('S')
+ workdir = os.path.abspath(d.getVar('WORKDIR'))
+ testsrcdir = os.path.abspath(srcsubdir)
+ if (testsrcdir + os.sep).startswith(workdir + os.sep):
+ # Double-check that either workdir or S or some directory in-between is a git repository
+ found = False
+ while testsrcdir != '/':
+ if os.path.exists(os.path.join(testsrcdir, '.git')):
+ found = True
+ break
+ if testsrcdir == workdir:
+ break
+ testsrcdir = os.path.dirname(testsrcdir)
+ if not found:
+ bb.fatal('PATCHTOOL = "git" set for source tree that is not a git repository. Refusing to continue as that may result in commits being made in your metadata repository.')
+
patchdir = os.path.join(srcsubdir, 'patches')
if os.path.exists(patchdir):
if os.listdir(patchdir):
--
2.9.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-12-05 1:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-05 1:36 [PATCH 0/2] patch class fixes Paul Eggleton
2017-12-05 1:36 ` [PATCH 1/2] classes/patch: remove unused variable Paul Eggleton
2017-12-05 1:36 ` [PATCH 2/2] classes/patch: when PATCHTOOL = "git" double-check the repository Paul Eggleton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox