aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>2017-03-23 15:09:04 +0200
committerMarkus Lehtonen <markus.lehtonen@linux.intel.com>2017-03-24 09:46:13 +0200
commit1ef94ca0b8778b2152ce2c1dc7c4e802c8722291 (patch)
treee695296cd76873d707b8a88ef818fe91a90e28f1
parente39945f346379e15541cdcc242a9cdc5390ebf25 (diff)
downloadopenembedded-core-contrib-1ef94ca0b8778b2152ce2c1dc7c4e802c8722291.tar.gz
openembedded-core-contrib-1ef94ca0b8778b2152ce2c1dc7c4e802c8722291.tar.bz2
openembedded-core-contrib-1ef94ca0b8778b2152ce2c1dc7c4e802c8722291.zip
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@linux.intel.com>
-rwxr-xr-xscripts/oe-git-archive12
1 files changed, 10 insertions, 2 deletions
diff --git a/scripts/oe-git-archive b/scripts/oe-git-archive
index aef4ba10a72..1805ab3260f 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: