* [jethro][PATCH 0/1] Backport fix to devtool for readonly Git hooks
@ 2016-03-10 14:51 Peter Kjellerstedt
2016-03-10 14:51 ` [jethro][PATCH 1/1] lib/oe/patch: Make GitApplyTree._applypatch() support read-only .git/hooks Peter Kjellerstedt
0 siblings, 1 reply; 2+ messages in thread
From: Peter Kjellerstedt @ 2016-03-10 14:51 UTC (permalink / raw)
To: openembedded-core
This backports a change to devtool from master so that devtool can
handle Git hooks that are readonly.
//Peter
The following changes since commit 1a52eceaa5df89914b6a711defdcf0046e74c7f6:
ref-manual: Corrected Note for CentOS package requirements (2016-03-03 17:40:20 +0000)
are available in the git repository at:
git://git.yoctoproject.org/poky-contrib pkj/jethro-devtool-hooks
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=pkj/jethro-devtool-hooks
Peter Kjellerstedt (1):
lib/oe/patch: Make GitApplyTree._applypatch() support read-only
.git/hooks
meta/lib/oe/patch.py | 26 ++++++++++++--------------
1 file changed, 12 insertions(+), 14 deletions(-)
--
2.1.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* [jethro][PATCH 1/1] lib/oe/patch: Make GitApplyTree._applypatch() support read-only .git/hooks
2016-03-10 14:51 [jethro][PATCH 0/1] Backport fix to devtool for readonly Git hooks Peter Kjellerstedt
@ 2016-03-10 14:51 ` Peter Kjellerstedt
0 siblings, 0 replies; 2+ messages in thread
From: Peter Kjellerstedt @ 2016-03-10 14:51 UTC (permalink / raw)
To: openembedded-core
From: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Rather than modifying files in .git/hooks, which can be read-only
(e.g., if it is a link to a directory in /usr/share), move away the
entire .git/hooks directory temporarily.
Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
meta/lib/oe/patch.py | 26 ++++++++++++--------------
1 file changed, 12 insertions(+), 14 deletions(-)
diff --git a/meta/lib/oe/patch.py b/meta/lib/oe/patch.py
index 2bf501e..c25d3c7 100644
--- a/meta/lib/oe/patch.py
+++ b/meta/lib/oe/patch.py
@@ -383,14 +383,15 @@ class GitApplyTree(PatchTree):
reporoot = (runcmd("git rev-parse --show-toplevel".split(), self.dir) or '').strip()
if not reporoot:
raise Exception("Cannot get repository root for directory %s" % self.dir)
- commithook = os.path.join(reporoot, '.git', 'hooks', 'commit-msg')
- commithook_backup = commithook + '.devtool-orig'
- applyhook = os.path.join(reporoot, '.git', 'hooks', 'applypatch-msg')
- applyhook_backup = applyhook + '.devtool-orig'
- if os.path.exists(commithook):
- shutil.move(commithook, commithook_backup)
- if os.path.exists(applyhook):
- shutil.move(applyhook, applyhook_backup)
+ hooks_dir = os.path.join(reporoot, '.git', 'hooks')
+ hooks_dir_backup = hooks_dir + '.devtool-orig'
+ if os.path.lexists(hooks_dir_backup):
+ raise Exception("Git hooks backup directory already exists: %s" % hooks_dir_backup)
+ if os.path.lexists(hooks_dir):
+ shutil.move(hooks_dir, hooks_dir_backup)
+ os.mkdir(hooks_dir)
+ commithook = os.path.join(hooks_dir, 'commit-msg')
+ applyhook = os.path.join(hooks_dir, 'applypatch-msg')
with open(commithook, 'w') as f:
# NOTE: the formatting here is significant; if you change it you'll also need to
# change other places which read it back
@@ -439,12 +440,9 @@ class GitApplyTree(PatchTree):
os.remove(tmpfile)
return output
finally:
- os.remove(commithook)
- os.remove(applyhook)
- if os.path.exists(commithook_backup):
- shutil.move(commithook_backup, commithook)
- if os.path.exists(applyhook_backup):
- shutil.move(applyhook_backup, applyhook)
+ shutil.rmtree(hooks_dir)
+ if os.path.lexists(hooks_dir_backup):
+ shutil.move(hooks_dir_backup, hooks_dir)
class QuiltTree(PatchSet):
--
2.1.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-03-10 14:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-10 14:51 [jethro][PATCH 0/1] Backport fix to devtool for readonly Git hooks Peter Kjellerstedt
2016-03-10 14:51 ` [jethro][PATCH 1/1] lib/oe/patch: Make GitApplyTree._applypatch() support read-only .git/hooks Peter Kjellerstedt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox