diff options
Diffstat (limited to 'scripts/combo-layer')
-rwxr-xr-x | scripts/combo-layer | 41 |
1 files changed, 8 insertions, 33 deletions
diff --git a/scripts/combo-layer b/scripts/combo-layer index 92c5cbb813..f028098cbb 100755 --- a/scripts/combo-layer +++ b/scripts/combo-layer | |||
@@ -662,7 +662,14 @@ def action_update(conf, args): | |||
662 | patch_cmd_range = "%s..%s" % (repo['last_revision'], top_revision) | 662 | patch_cmd_range = "%s..%s" % (repo['last_revision'], top_revision) |
663 | rev_cmd_range = patch_cmd_range | 663 | rev_cmd_range = patch_cmd_range |
664 | 664 | ||
665 | file_filter = repo.get('file_filter',"") | 665 | file_filter = repo.get('file_filter',".") |
666 | |||
667 | # Filter out unwanted files | ||
668 | exclude = repo.get('file_exclude', '') | ||
669 | if exclude: | ||
670 | for path in exclude.split(): | ||
671 | p = "%s/%s" % (dest_dir, path) if dest_dir != '.' else path | ||
672 | file_filter += " ':!%s'" % p | ||
666 | 673 | ||
667 | patch_cmd = "git format-patch -N %s --output-directory %s %s -- %s" % \ | 674 | patch_cmd = "git format-patch -N %s --output-directory %s %s -- %s" % \ |
668 | (prefix,repo_patch_dir, patch_cmd_range, file_filter) | 675 | (prefix,repo_patch_dir, patch_cmd_range, file_filter) |
@@ -681,38 +688,6 @@ def action_update(conf, args): | |||
681 | runcmd("%s %s %s %s" % (repo['hook'], patch, revlist[count], name)) | 688 | runcmd("%s %s %s %s" % (repo['hook'], patch, revlist[count], name)) |
682 | count=count-1 | 689 | count=count-1 |
683 | 690 | ||
684 | # Step 3a: Filter out unwanted files and patches. | ||
685 | exclude = repo.get('file_exclude', '') | ||
686 | if exclude: | ||
687 | filter = ['filterdiff', '-p1'] | ||
688 | for path in exclude.split(): | ||
689 | filter.append('-x') | ||
690 | filter.append('%s/%s' % (dest_dir, path) if dest_dir != '.' else path) | ||
691 | for patch in patchlist[:]: | ||
692 | filtered = patch + '.tmp' | ||
693 | with open(filtered, 'w') as f: | ||
694 | runcmd(filter + [patch], out=f) | ||
695 | # Now check for empty patches. | ||
696 | if runcmd(['filterdiff', '--list', filtered]): | ||
697 | # Possibly modified. | ||
698 | os.unlink(patch) | ||
699 | os.rename(filtered, patch) | ||
700 | else: | ||
701 | # Empty, ignore it. Must also remove from revlist. | ||
702 | with open(patch, 'r') as f: | ||
703 | fromline = f.readline() | ||
704 | if not fromline: | ||
705 | # Patch must have been empty to start with. No need | ||
706 | # to remove it. | ||
707 | continue | ||
708 | m = re.match(r'''^From ([0-9a-fA-F]+) .*\n''', fromline) | ||
709 | rev = m.group(1) | ||
710 | logger.debug('skipping empty patch %s = %s' % (patch, rev)) | ||
711 | os.unlink(patch) | ||
712 | os.unlink(filtered) | ||
713 | patchlist.remove(patch) | ||
714 | revlist.remove(rev) | ||
715 | |||
716 | # Step 4: write patch list and revision list to file, for user to edit later | 691 | # Step 4: write patch list and revision list to file, for user to edit later |
717 | patchlist_file = os.path.join(os.getcwd(), patch_dir, "patchlist-%s" % name) | 692 | patchlist_file = os.path.join(os.getcwd(), patch_dir, "patchlist-%s" % name) |
718 | repo['patchlist'] = patchlist_file | 693 | repo['patchlist'] = patchlist_file |