patchupdate.py: Move static part of generated Makefile into Makefile.in.

This commit is contained in:
Sebastian Lackner 2014-07-26 21:29:46 +02:00
parent 13cf73babe
commit 9a01f9973d

View File

@ -334,7 +334,7 @@ def verify_dependencies(all_patches):
to_delete.append(i)
if len(to_delete) == 0:
raise PatchUpdaterError("Circular dependency in set of patches: %d" %
raise PatchUpdaterError("Circular dependency in set of patches: %s" %
", ".join([patch.name for i, patch in patches.iteritems()]))
for j in to_delete:
@ -352,7 +352,7 @@ def verify_dependencies(all_patches):
modified_files[f] = []
modified_files[f].append(i)
# Iterate over pairs of patches, check for existing causal relationship
# Check if patches always apply correctly
load_patch_cache()
try:
for f, indices in modified_files.iteritems():
@ -363,34 +363,9 @@ def verify_dependencies(all_patches):
def generate_makefile(all_patches, fp):
"""Generate Makefile for a specific set of patches."""
fp.write("#\n")
fp.write("# This file is automatically generated, DO NOT EDIT!\n")
fp.write("#\n")
fp.write("\n")
fp.write("CURDIR ?= ${.CURDIR}\n")
fp.write("PATCH := $(CURDIR)/../debian/tools/gitapply.sh -d $(DESTDIR)\n")
fp.write("\n")
fp.write("PATCHLIST :=\t%s\n" % " \\\n\t\t".join(["%s.ok" % patch.name for i, patch in all_patches.iteritems()]))
fp.write("\n")
fp.write(".PHONY: install\n")
fp.write("install:\n")
fp.write("\t@$(MAKE) apply; \\\n")
fp.write("\tstatus=$$?; \\\n")
fp.write("\trm -f *.ok; \\\n")
fp.write("\texit $$status\n")
fp.write("\n")
fp.write(".PHONY: apply\n")
fp.write("apply: $(PATCHLIST)\n")
fp.write("\tcat *.ok | sort | $(CURDIR)/../debian/tools/patchlist.sh | $(PATCH)\n")
fp.write("\tcd $(DESTDIR) && autoreconf -f\n")
fp.write("\tcd $(DESTDIR) && ./tools/make_requests\n")
fp.write("\n")
fp.write(".PHONY: clean\n")
fp.write("clean:\n")
fp.write("\trm -f *.ok\n")
fp.write("\n")
fp.write(".NOTPARALLEL:\n")
fp.write("\n")
with open("./debian/tools/Makefile.in") as template_fp:
template = template_fp.read()
fp.write(template.format(patchlist=" \\\n\t\t".join(["%s.ok" % patch.name for i, patch in all_patches.iteritems()])))
for i, patch in all_patches.iteritems():
fp.write("# Patchset %s\n" % patch.name)