Index: trunk/release-tools/make-release |
— | — | @@ -145,6 +145,44 @@ |
146 | 146 | f.close() |
147 | 147 | return hash.hexdigest() |
148 | 148 | |
| 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 | + |
149 | 187 | def makeRelease(version, branch, dir, prevVersion = None, prevBranch = None): |
150 | 188 | if not os.path.exists(dir): |
151 | 189 | os.mkdir(dir) |
— | — | @@ -152,16 +190,7 @@ |
153 | 191 | package = 'mediawiki-' + version |
154 | 192 | |
155 | 193 | # 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) |
166 | 195 | |
167 | 196 | # Generate the .tar.gz file |
168 | 197 | outFile = open(dir + '/' + package + '.tar.gz', 'w') |
— | — | @@ -182,25 +211,16 @@ |
183 | 212 | |
184 | 213 | # Patch |
185 | 214 | 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') |
187 | 218 | 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 |
190 | 223 | 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 |
205 | 225 | |
206 | 226 | # Sign |
207 | 227 | uploadFiles = [] |
— | — | @@ -233,9 +253,15 @@ |
234 | 254 | print |
235 | 255 | |
236 | 256 | 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 |
240 | 266 | |
241 | 267 | print 'GPG signatures:' |
242 | 268 | for fileName in outFiles: |