summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>2017-03-24 16:17:28 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-03-27 08:15:06 +0100
commite10d1ea0827c9ef22363946f917eebabfdb36a8b (patch)
treef97439627dd2a6b20a7ebb35a5e518d7a83381ee /scripts
parent60f32a00dcd4b965a770279bbe0dd05295afee6a (diff)
downloadpoky-e10d1ea0827c9ef22363946f917eebabfdb36a8b.tar.gz
scripts/oe-git-archive: implement --exclude
May be used for excluding certain files from the commit. [YOCTO #10582] (From OE-Core rev: fd125cf694bebefbe9a98fd1bb199d6ca472dad5) Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-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 aef4ba10a7..1805ab3260 100755
--- a/scripts/oe-git-archive
+++ b/scripts/oe-git-archive
@@ -83,7 +83,7 @@ def init_git_repo(path, no_create, bare):
83 return repo 83 return repo
84 84
85 85
86def git_commit_data(repo, data_dir, branch, message): 86def git_commit_data(repo, data_dir, branch, message, exclude):
87 """Commit data into a Git repository""" 87 """Commit data into a Git repository"""
88 log.info("Committing data into to branch %s", branch) 88 log.info("Committing data into to branch %s", branch)
89 tmp_index = os.path.join(repo.git_dir, 'index.oe-git-archive') 89 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):
92 env_update = {'GIT_INDEX_FILE': tmp_index, 92 env_update = {'GIT_INDEX_FILE': tmp_index,
93 'GIT_WORK_TREE': os.path.abspath(data_dir)} 93 'GIT_WORK_TREE': os.path.abspath(data_dir)}
94 repo.run_cmd('add .', env_update) 94 repo.run_cmd('add .', env_update)
95
96 # Remove files that are excluded
97 if exclude:
98 repo.run_cmd(['rm', '--cached'] + [f for f in exclude], env_update)
99
95 tree = repo.run_cmd('write-tree', env_update) 100 tree = repo.run_cmd('write-tree', env_update)
96 101
97 # Create new commit object from the tree 102 # Create new commit object from the tree
@@ -183,6 +188,9 @@ def parse_args(argv):
183 parser.add_argument('--tag-msg-body', 188 parser.add_argument('--tag-msg-body',
184 default='', 189 default='',
185 help="Tag message body (pattern)") 190 help="Tag message body (pattern)")
191 parser.add_argument('--exclude', action='append', default=[],
192 help="Glob to exclude files from the commit. Relative "
193 "to DATA_DIR. May be specified multiple times")
186 parser.add_argument('data_dir', metavar='DATA_DIR', 194 parser.add_argument('data_dir', metavar='DATA_DIR',
187 help="Data to commit") 195 help="Data to commit")
188 return parser.parse_args(argv) 196 return parser.parse_args(argv)
@@ -221,7 +229,7 @@ def main(argv=None):
221 229
222 # Commit data 230 # Commit data
223 commit = git_commit_data(data_repo, args.data_dir, branch_name, 231 commit = git_commit_data(data_repo, args.data_dir, branch_name,
224 commit_msg) 232 commit_msg, args.exclude)
225 233
226 # Create tag 234 # Create tag
227 if tag_name: 235 if tag_name: