summaryrefslogtreecommitdiffstats
path: root/scripts/combo-layer
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/combo-layer')
-rwxr-xr-xscripts/combo-layer11
1 files changed, 7 insertions, 4 deletions
diff --git a/scripts/combo-layer b/scripts/combo-layer
index 8f019744fc..fa60579272 100755
--- a/scripts/combo-layer
+++ b/scripts/combo-layer
@@ -249,13 +249,16 @@ def action_init(conf, args):
249 # files already moved, we need to prepend the 249 # files already moved, we need to prepend the
250 # subdirectory to all filters, otherwise they would 250 # subdirectory to all filters, otherwise they would
251 # not match. 251 # not match.
252 if subdir: 252 if subdir == '.':
253 subdir = ''
254 elif subdir:
255 subdir = os.path.normpath(subdir)
253 file_filter = ' '.join([subdir + '/' + x for x in file_filter.split()]) 256 file_filter = ' '.join([subdir + '/' + x for x in file_filter.split()])
254 exclude_patterns = [subdir + '/' + x for x in exclude_patterns] 257 exclude_patterns = [subdir + '/' + x for x in exclude_patterns]
255 # To handle both cases, we cd into the target 258 # To handle both cases, we cd into the target
256 # directory and optionally tell tar to strip the path 259 # directory and optionally tell tar to strip the path
257 # prefix when the files were already moved. 260 # prefix when the files were already moved.
258 subdir_components = len(os.path.normpath(subdir).split(os.path.sep)) if subdir else 0 261 subdir_components = len(subdir.split(os.path.sep)) if subdir else 0
259 strip=('--strip-components=%d' % subdir_components) if subdir else '' 262 strip=('--strip-components=%d' % subdir_components) if subdir else ''
260 # TODO: file_filter wild cards do not work (and haven't worked before either), because 263 # TODO: file_filter wild cards do not work (and haven't worked before either), because
261 # a) GNU tar requires a --wildcards parameter before turning on wild card matching. 264 # a) GNU tar requires a --wildcards parameter before turning on wild card matching.
@@ -375,7 +378,7 @@ tail -c +18 $tmpname | head -c -4
375 if not os.path.exists(extract_dir): 378 if not os.path.exists(extract_dir):
376 os.makedirs(extract_dir) 379 os.makedirs(extract_dir)
377 copy_selected_files('HEAD', extract_dir, file_filter, exclude_patterns, '.', 380 copy_selected_files('HEAD', extract_dir, file_filter, exclude_patterns, '.',
378 subdir=dest_dir if dest_dir != '.' else '') 381 subdir=dest_dir)
379 runcmd('git add --all --force .') 382 runcmd('git add --all --force .')
380 if runcmd('git status --porcelain'): 383 if runcmd('git status --porcelain'):
381 # Something to commit. 384 # Something to commit.
@@ -648,7 +651,7 @@ def action_update(conf, args):
648 filter = ['filterdiff', '-p1'] 651 filter = ['filterdiff', '-p1']
649 for path in exclude.split(): 652 for path in exclude.split():
650 filter.append('-x') 653 filter.append('-x')
651 filter.append('%s/%s' % (dest_dir, path) if dest_dir else path) 654 filter.append('%s/%s' % (dest_dir, path) if dest_dir != '.' else path)
652 for patch in patchlist[:]: 655 for patch in patchlist[:]:
653 filtered = patch + '.tmp' 656 filtered = patch + '.tmp'
654 with open(filtered, 'w') as f: 657 with open(filtered, 'w') as f: