summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorPatrick Ohly <patrick.ohly@intel.com>2015-03-27 14:53:11 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-03-31 22:24:34 +0100
commitb936350fc2089672731f56434886f8c83b47d5a3 (patch)
tree2371a45dc6b89ad13c42f909ea6a6d357d8b1eb1 /scripts
parentd81ee4d2770144e9b4507ee3836599e77a07b2ea (diff)
downloadast2050-yocto-poky-b936350fc2089672731f56434886f8c83b47d5a3.zip
ast2050-yocto-poky-b936350fc2089672731f56434886f8c83b47d5a3.tar.gz
combo-layer: fix file_exclude for dest_dir = .
"filterdiff -x ./some/file" does not remove changes for some/file. We must be more careful about constructing the path name and only add the prefix when it really means a directory. While at it, also better normalize the path in copy_selected_files() early on, to handle double slashes. Useful should the function ever gets used for something other that dest_dir (which gets normalized in sanity_check()). (From OE-Core rev: 6c93520b5aaceefecccd83dc77e8ad7681d312c6) Signed-off-by: Patrick Ohly <patrick.ohly@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/combo-layer11
1 files changed, 7 insertions, 4 deletions
diff --git a/scripts/combo-layer b/scripts/combo-layer
index 8f01974..fa60579 100755
--- a/scripts/combo-layer
+++ b/scripts/combo-layer
@@ -249,13 +249,16 @@ def action_init(conf, args):
# files already moved, we need to prepend the
# subdirectory to all filters, otherwise they would
# not match.
- if subdir:
+ if subdir == '.':
+ subdir = ''
+ elif subdir:
+ subdir = os.path.normpath(subdir)
file_filter = ' '.join([subdir + '/' + x for x in file_filter.split()])
exclude_patterns = [subdir + '/' + x for x in exclude_patterns]
# To handle both cases, we cd into the target
# directory and optionally tell tar to strip the path
# prefix when the files were already moved.
- subdir_components = len(os.path.normpath(subdir).split(os.path.sep)) if subdir else 0
+ subdir_components = len(subdir.split(os.path.sep)) if subdir else 0
strip=('--strip-components=%d' % subdir_components) if subdir else ''
# TODO: file_filter wild cards do not work (and haven't worked before either), because
# a) GNU tar requires a --wildcards parameter before turning on wild card matching.
@@ -375,7 +378,7 @@ tail -c +18 $tmpname | head -c -4
if not os.path.exists(extract_dir):
os.makedirs(extract_dir)
copy_selected_files('HEAD', extract_dir, file_filter, exclude_patterns, '.',
- subdir=dest_dir if dest_dir != '.' else '')
+ subdir=dest_dir)
runcmd('git add --all --force .')
if runcmd('git status --porcelain'):
# Something to commit.
@@ -648,7 +651,7 @@ def action_update(conf, args):
filter = ['filterdiff', '-p1']
for path in exclude.split():
filter.append('-x')
- filter.append('%s/%s' % (dest_dir, path) if dest_dir else path)
+ filter.append('%s/%s' % (dest_dir, path) if dest_dir != '.' else path)
for patch in patchlist[:]:
filtered = patch + '.tmp'
with open(filtered, 'w') as f:
OpenPOWER on IntegriCloud