Skip to content

Instantly share code, notes, and snippets.

@mcgrof
Created May 6, 2013 23:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mcgrof/5529248 to your computer and use it in GitHub Desktop.
Save mcgrof/5529248 to your computer and use it in GitHub Desktop.
diff --git a/gentree.py b/gentree.py
index afe3645..3960863 100755
--- a/gentree.py
+++ b/gentree.py
@@ -358,6 +358,7 @@ def process(kerneldir, outdir, copy_list_file, git_revision=None,
patches.sort()
prefix_len = len(os.path.join(source_dir, 'patches')) + 1
for pfile in patches:
+ patch_header = ""
print_name = pfile[prefix_len:]
# read the patch file
p = patch.fromfile(pfile)
@@ -378,6 +379,7 @@ def process(kerneldir, outdir, copy_list_file, git_revision=None,
if args.refresh:
# but for refresh, of course look at all files the patch touches
for patchitem in p.items:
+ patch_header.join(patchitem.header)
patched_file = '/'.join(patchitem.source.split('/')[1:])
fullfn = os.path.join(args.outdir, patched_file)
shutil.copyfile(fullfn, fullfn + '.orig_file')
@@ -401,7 +403,8 @@ def process(kerneldir, outdir, copy_list_file, git_revision=None,
return 2
if args.refresh:
- pfilef = open(pfile + '.tmp', 'w')
+ pfilef = open(pfile + '.tmp', 'a')
+ pfilef.write(patch_header)
for patchitem in p.items:
patched_file = '/'.join(patchitem.source.split('/')[1:])
fullfn = os.path.join(args.outdir, patched_file)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment