r40844 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r40843‎ | r40844 | r40845 >
Date:05:11, 15 September 2008
Author:tstarling
Status:old
Tags:
Comment:
Make a separate i18n patch.
Modified paths:
  • /trunk/release-tools/make-release (modified) (history)

Diff [purge]

Index: trunk/release-tools/make-release
@@ -145,6 +145,44 @@
146146 f.close()
147147 return hash.hexdigest()
148148
 149+def export(branch, dir):
 150+ if os.path.exists(dir):
 151+ print "The directory " + dir + " already exists, I'm assuming it is still valid"
 152+ else:
 153+ print "Exporting %s..." % (branch)
 154+ proc = subprocess.Popen(['svn', 'export', '-q',
 155+ 'http://svn.wikimedia.org/svnroot/mediawiki/' + branch + '/phase3', dir])
 156+ if proc.wait() != 0:
 157+ print "svn export failed, exiting"
 158+ sys.exit(1)
 159+ print "Done"
 160+
 161+def makePatch(patchFileName, dir1, dir2, type):
 162+ patchFile = open(patchFileName, 'w')
 163+ args = ['diff', '-ru']
 164+ if type == 'i18n':
 165+ print "Generating i18n patch file..."
 166+ dir1 += '/languages/messages'
 167+ dir2 += '/languages/messages'
 168+ else:
 169+ print "Generating normal patch file..."
 170+ args.extend(['-x', 'messages'])
 171+
 172+ args.extend([dir1, dir2])
 173+ print ' '.join(args)
 174+ diffProc = subprocess.Popen(args, stdout = subprocess.PIPE)
 175+ gzipProc = subprocess.Popen(['gzip', '-9'],
 176+ stdin = diffProc.stdout, stdout = patchFile)
 177+
 178+ diffStatus = diffProc.wait()
 179+
 180+ if diffStatus > 1 or gzipProc.wait() != 0:
 181+ print "diff failed, exiting"
 182+ sys.exit(1)
 183+ patchFile.close()
 184+ print "Done"
 185+ return diffStatus == 1
 186+
149187 def makeRelease(version, branch, dir, prevVersion = None, prevBranch = None):
150188 if not os.path.exists(dir):
151189 os.mkdir(dir)
@@ -152,16 +190,7 @@
153191 package = 'mediawiki-' + version
154192
155193 # Export the target
156 - if os.path.exists(package):
157 - print "The directory " + package + " already exists, I'm assuming it is still valid"
158 - else:
159 - print "Exporting %s...\n" % (branch)
160 - proc = subprocess.Popen(['svn', 'export', '-q',
161 - 'http://svn.wikimedia.org/svnroot/mediawiki/' + branch + '/phase3', package])
162 - if proc.wait() != 0:
163 - print "svn export failed, exiting"
164 - sys.exit(1)
165 - print "Done"
 194+ export(branch, package)
166195
167196 # Generate the .tar.gz file
168197 outFile = open(dir + '/' + package + '.tar.gz', 'w')
@@ -182,25 +211,16 @@
183212
184213 # Patch
185214 if prevVersion != None:
186 - patchFileName = dir + '/' + package + '.patch.gz'
 215+ prevDir = 'mediawiki-' + prevVersion
 216+ export(prevBranch, prevDir)
 217+ makePatch(dir + '/' + package + '.patch.gz', prevDir, package, 'normal')
187218 outFiles.append(package + '.patch.gz')
188 - if os.path.exists(patchFileName):
189 - print patchFileName + " already exists, I'm assuming it's still valid"
 219+ i18nPatch = 'mediawiki-i18n-' + version + '.patch.gz'
 220+ if (makePatch(dir + '/' + i18nPatch, prevDir, package, 'i18n')):
 221+ outFiles.append(i18nPatch)
 222+ haveI18n = True
190223 else:
191 - print "Generating patch file..."
192 - patchFile = open(patchFileName, 'w')
193 - svnProc = subprocess.Popen(['svn', 'diff',
194 - 'http://svn.wikimedia.org/svnroot/mediawiki/'+prevBranch+'/phase3',
195 - 'http://svn.wikimedia.org/svnroot/mediawiki/'+branch+'/phase3'],
196 - stdout = subprocess.PIPE)
197 - gzipProc = subprocess.Popen(['gzip', '-9'],
198 - stdin = svnProc.stdout, stdout = patchFile)
199 -
200 - if svnProc.wait() != 0 or gzipProc.wait() != 0:
201 - print "svn diff failed, exiting"
202 - sys.exit(1)
203 - patchFile.close()
204 - print "Done"
 224+ haveI18n = False
205225
206226 # Sign
207227 uploadFiles = []
@@ -233,9 +253,15 @@
234254 print
235255
236256 if prevVersion != None:
237 - print "Patch to previous version (" + prevVersion + ")"
238 - print 'http://download.wikimedia.org/mediawiki/' + dir + '/' + package + '.patch.gz'
239 - print
 257+ if haveI18n:
 258+ print "Patch to previous version (" + prevVersion + "), without interface text:"
 259+ print 'http://download.wikimedia.org/mediawiki/' + dir + '/' + package + '.patch.gz'
 260+ print "Interface text changes:"
 261+ print 'http://download.wikimedia.org/mediawiki/' + dir + '/' + i18nPatch
 262+ else:
 263+ print "Patch to previous version (" + prevVersion + "):"
 264+ print 'http://download.wikimedia.org/mediawiki/' + dir + '/' + package + '.patch.gz'
 265+ print
240266
241267 print 'GPG signatures:'
242268 for fileName in outFiles: