More build stuff
This commit is contained in:
parent
18069778d9
commit
e5b4d1e953
|
@ -0,0 +1,27 @@
|
||||||
|
import sys
|
||||||
|
import os
|
||||||
|
import commands
|
||||||
|
import fnmatch
|
||||||
|
import re
|
||||||
|
import subprocess, shlex
|
||||||
|
|
||||||
|
def cmdsplit(args):
|
||||||
|
if os.sep == '\\':
|
||||||
|
args = args.replace('\\', '\\\\')
|
||||||
|
return shlex.split(args)
|
||||||
|
|
||||||
|
def main():
|
||||||
|
print("Applying patches")
|
||||||
|
patches = os.path.abspath(sys.argv[1])
|
||||||
|
work = os.path.normpath(sys.argv[2])
|
||||||
|
|
||||||
|
for path, _, filelist in os.walk(patches, followlinks=True):
|
||||||
|
for cur_file in fnmatch.filter(filelist, '*.patch'):
|
||||||
|
patch_file = os.path.normpath(os.path.join(patches, path[len(patches)+1:], cur_file))
|
||||||
|
print(patch_file)
|
||||||
|
cmd = 'patch -p1 -i "%s" ' % (patch_file)
|
||||||
|
process = subprocess.Popen(cmdsplit(cmd), cwd=work, bufsize=-1)
|
||||||
|
process.communicate()
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
|
@ -147,6 +147,12 @@
|
||||||
<target name="build" depends="init,clean,merge-server,patch,build-server,build-source-pack" />
|
<target name="build" depends="init,clean,merge-server,patch,build-server,build-source-pack" />
|
||||||
|
|
||||||
<target name="patch" depends="init">
|
<target name="patch" depends="init">
|
||||||
|
<exec executable="${python.exe}" dir="${basedir}">
|
||||||
|
<arg value="${basedir}/applypatches.py"/>
|
||||||
|
<arg value="${patch.src.dir}"/>
|
||||||
|
<arg value="${mcp.srcdir}"/>
|
||||||
|
</exec>
|
||||||
|
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -27,19 +27,20 @@ def cleanDirs(path):
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
print("Creating patches")
|
print("Creating patches")
|
||||||
base = os.path.normpath(os.path.join(sys.argv[1], 'src-reference'))
|
base = 'src-reference'
|
||||||
work = os.path.normpath(os.path.join(sys.argv[1], 'src-work'))
|
work = 'src-work'
|
||||||
|
patched_dir=os.path.join(sys.argv[1],work)
|
||||||
timestamp = re.compile(r'[0-9-]* [0-9:\.]* [+-][0-9]*\r?\n')
|
timestamp = re.compile(r'[0-9-]* [0-9:\.]* [+-][0-9]*\r?\n')
|
||||||
|
|
||||||
for path, _, filelist in os.walk(work, followlinks=True):
|
for path, _, filelist in os.walk(patched_dir, followlinks=True):
|
||||||
for cur_file in fnmatch.filter(filelist, '*.java'):
|
for cur_file in fnmatch.filter(filelist, '*.java'):
|
||||||
file_base = os.path.normpath(os.path.join(base, path[len(work)+1:], cur_file))
|
file_base = os.path.normpath(os.path.join(base, path[len(patched_dir)+1:], cur_file))
|
||||||
file_work = os.path.normpath(os.path.join(work, path[len(work)+1:], cur_file))
|
file_work = os.path.normpath(os.path.join(work, path[len(patched_dir)+1:], cur_file))
|
||||||
patch = ''
|
patch = ''
|
||||||
cmd = 'diff -u %s %s -r --strip-trailing-cr --new-file' % (file_base, file_work)
|
cmd = 'diff -u %s %s -r --strip-trailing-cr --new-file' % (file_base, file_work)
|
||||||
process = subprocess.Popen(cmdsplit(cmd), stdout=subprocess.PIPE, stderr=subprocess.STDOUT, bufsize=-1)
|
process = subprocess.Popen(cmdsplit(cmd), cwd=os.path.normpath(sys.argv[1]), stdout=subprocess.PIPE, stderr=subprocess.STDOUT, bufsize=-1)
|
||||||
patch, _ = process.communicate()
|
patch, _ = process.communicate()
|
||||||
patch_dir = os.path.join(sys.argv[2]+'patches', path[len(work)+1:])
|
patch_dir = os.path.join(sys.argv[2],'patches', path[len(work)+1:])
|
||||||
patch_file = os.path.join(patch_dir, cur_file + '.patch')
|
patch_file = os.path.join(patch_dir, cur_file + '.patch')
|
||||||
|
|
||||||
if len(patch) > 0:
|
if len(patch) > 0:
|
||||||
|
|
Loading…
Reference in New Issue