8 lilypath = os.environ['LILYPOND_SOURCEDIR'] + '/'
10 print 'Please set LILYPOND_SOURCEDIR to the toplevel source, eg LILYPOND_SOURCEDIR=/home/foobar/lilypond-1.2.3/'
13 lilypath = lilypath + '/bin/'
14 sys.path.append(lilypath)
17 from lilypython import *
26 self.to_version = lilydirs.version_tuple()
27 self.from_version = prev_version(self.to_version)
34 'Generate a patch to go to this version.\n'
35 ' --from=FROM, -f FROM old is FROM\n'
36 ' --to=TO, -t TO to version TO\n'
44 sys.stderr.write('untarring ' + fn)
45 # can't seem to fix errors:
46 # gzip: stdout: Broken pipe
47 # tar: Child returned status 1
48 # os.system ('tar xzf ' + fn)
49 # sys.stderr.write('\n')
50 # ugh, even this does not work, but one error message less :-)
51 os.system ('gzip --quiet -dc ' + fn + '| tar xf - ')
52 # so print soothing message:
53 sys.stderr.write('make-patch:ugh: Please ignore error: gzip: stdout: Broken pipe\n');
57 header = 'Generated by make-patch, old = %s, new = %s\n\
61 cd lilypond-source-dir; patch -E -p0 < %s\n\
63 Patches do not contain automatically generated files, \n\
64 i.e. you should rerun configure\n\n'
66 pats = ['*.lsm', 'configure', '*.txt', 'lilypond.spec']
67 def remove_automatic(dirnames):
69 files = files + multiple_find(pats, dirnames)
74 def makepatch(fv, tv, patfile_nm):
76 prev_cwd = os.getcwd();
78 untar(released_tarball(fv))
79 untar(released_tarball(tv))
80 remove_automatic([dirname(fv), dirname(tv)])
85 patfile_nm = '../patch-%s' % version_tuple_to_str(tv)
87 f = open(patfile_nm, 'w')
89 (version_tuple_to_str(fv), version_tuple_to_str(tv), \
90 os.path.basename(patfile_nm)))
93 sys.stderr.write('diffing to %s... ' % patfile_nm)
94 os.system('diff -urN ../%s . >> %s' % (dirname(fv), patfile_nm))
95 #os.system('gzip -9f %s' % patfile_nm)
98 sys.stderr.write('cleaning ... ')
99 os.system('rm -fr %s %s' % (dirname(tv), dirname(fv)))
100 sys.stderr.write('\n')
104 sys.stderr.write('This is make-patch version %s\n' % mp_version)
105 (cl_options, files) = getopt.getopt(sys.argv[1:],
106 'hf:o:t:', ['output=', 'help', 'from=', 'to='])
108 for opt in cl_options:
111 if o == '--from' or o == '-f':
112 options.from_version = version_str_to_tuple(a)
113 elif o == '--to' or o == '-t':
114 options.to_version = version_str_to_tuple(a)
115 elif o== '--help' or o == '-h':
118 elif o == '--output' or o == '-o':
119 outfn = os.path.join(os.getcwd(), a)
124 pn = 'patch-%s' % version_tuple_to_str(options.to_version)
125 outfn = os.path.join(os.getcwd(), pn)
127 makepatch(options.from_version, options.to_version, outfn)
129 if __name__ == '__main__':