[oe-commits] [openembedded-core] 20/28: scripts/oe-git-archive: implement --exclude
git at git.openembedded.org
git at git.openembedded.org
Sat Mar 25 11:04:11 UTC 2017
This is an automated email from the git hooks/post-receive script.
rpurdie pushed a commit to branch master-next
in repository openembedded-core.
commit 5074dd3175c67b931b516c2750645bf663185fbc
Author: Markus Lehtonen <markus.lehtonen at linux.intel.com>
AuthorDate: Fri Mar 24 16:17:28 2017 +0200
scripts/oe-git-archive: implement --exclude
May be used for excluding certain files from the commit.
[YOCTO #10582]
Signed-off-by: Markus Lehtonen <markus.lehtonen at linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
scripts/oe-git-archive | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/scripts/oe-git-archive b/scripts/oe-git-archive
index aef4ba1..1805ab3 100755
--- a/scripts/oe-git-archive
+++ b/scripts/oe-git-archive
@@ -83,7 +83,7 @@ def init_git_repo(path, no_create, bare):
return repo
-def git_commit_data(repo, data_dir, branch, message):
+def git_commit_data(repo, data_dir, branch, message, exclude):
"""Commit data into a Git repository"""
log.info("Committing data into to branch %s", branch)
tmp_index = os.path.join(repo.git_dir, 'index.oe-git-archive')
@@ -92,6 +92,11 @@ def git_commit_data(repo, data_dir, branch, message):
env_update = {'GIT_INDEX_FILE': tmp_index,
'GIT_WORK_TREE': os.path.abspath(data_dir)}
repo.run_cmd('add .', env_update)
+
+ # Remove files that are excluded
+ if exclude:
+ repo.run_cmd(['rm', '--cached'] + [f for f in exclude], env_update)
+
tree = repo.run_cmd('write-tree', env_update)
# Create new commit object from the tree
@@ -183,6 +188,9 @@ def parse_args(argv):
parser.add_argument('--tag-msg-body',
default='',
help="Tag message body (pattern)")
+ parser.add_argument('--exclude', action='append', default=[],
+ help="Glob to exclude files from the commit. Relative "
+ "to DATA_DIR. May be specified multiple times")
parser.add_argument('data_dir', metavar='DATA_DIR',
help="Data to commit")
return parser.parse_args(argv)
@@ -221,7 +229,7 @@ def main(argv=None):
# Commit data
commit = git_commit_data(data_repo, args.data_dir, branch_name,
- commit_msg)
+ commit_msg, args.exclude)
# Create tag
if tag_name:
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Openembedded-commits
mailing list