@@ -32,7 +32,7 @@ def __init__(self, configfile=None, backupcfg=False):
32
32
self .test_export_path = self .config .get ('EXPORT' , 'TEST_EXPORT_PATH' , 'testcsv' , 'Path under BASE_EXPORT_PATH to write the test CSV files to.' )
33
33
self .stable_export_path = self .config .get ('EXPORT' , 'STABLE_EXPORT_PATH' , 'stablecsv' , 'Path under BASE_EXPORT_PATH to write the stable CSV files to.' )
34
34
self .test_export_url = self .config .get ('EXPORT' , 'TEST_EXPORT_URL' , 'http://export.mcpbot.bspk.rs' )
35
- self .exports_json_url = self .config .get ('EXPORT' , 'EXPORTS_JSON_URL' , 'http://export.mcpbot.bspk.rs/versions.json?limit=1 ' )
35
+ self .exports_json_url = self .config .get ('EXPORT' , 'EXPORTS_JSON_URL' , 'http://export.mcpbot.bspk.rs/versions.json' )
36
36
self .maven_repo_url = self .config .get ('EXPORT' , 'MAVEN_REPO_URL' , 'http://files.minecraftforge.net/maven/manage/upload/de/oceanlabs/mcp/' )
37
37
self .maven_repo_user = self .config .get ('EXPORT' , 'MAVEN_REPO_USER' , 'mcp' )
38
38
self .maven_repo_pass = self .config .get ('EXPORT' , 'MAVEN_REPO_PASS' , '' )
@@ -63,6 +63,7 @@ def __init__(self, configfile=None, backupcfg=False):
63
63
self .registerCommand ('latest' , self .getLatestMappingVersion , ['any' ], 0 , 2 , '[snapshot|stable] [<mcversion>]' , 'Gets a list of the latest mapping versions.' , allowpub = True )
64
64
self .registerCommand ('commit' , self .commitMappings , ['mcp_team' ], 0 , 1 , '[<srg_name>|method|field|param]' , 'Commits staged mapping changes. If SRG name is specified only that member will be committed. If method/field/param is specified only that member type will be committed. Give no arguments to commit all staged changes.' , allowduringreadonly = False )
65
65
self .registerCommand ('maventime' ,self .setMavenTime ,['mcp_team' ], 1 , 1 , '<HH:MM>' , 'Changes the time that the Maven upload will occur using 24 hour clock format.' )
66
+
66
67
self .registerCommand ('srg' , self .getSrgUrl , ['any' ], 1 , 1 , '<MC Version>' , 'Gets the URL of the SRG zip file for the Minecraft version specified.' , allowpub = True )
67
68
68
69
self .registerCommand ('gc' , self .getClass , ['any' ], 1 , 2 , "<class> [<version>]" , "Returns class information. Defaults to current version. Version can be for MCP or MC." , allowpub = True )
@@ -122,7 +123,7 @@ def __init__(self, configfile=None, backupcfg=False):
122
123
'ssf' : 'sf' , 'scm' : 'sm' , 'ssm' : 'sm' , 'fscf' : 'fsf' , 'fssf' : 'fsf' , 'fscm' : 'fsm' , 'fssm' : 'fsm' }
123
124
124
125
def clone (self ):
125
- return MCPBot (self .configfile , self . nspass , self . backupcfg )
126
+ return MCPBot (self .configfile , False )
126
127
127
128
def onStartUp (self ):
128
129
super (MCPBot , self ).onStartUp ()
@@ -289,6 +290,7 @@ def doMavenPush(self, isSnapshot, now):
289
290
self .sendPrimChanMessage ("%s Pushing %s mappings to Forge Maven." % (typeStr , chanStr ))
290
291
291
292
tries = 0
293
+ self .logger .info ('Pushing ' + stdZipName )
292
294
success = MavenHandler .upload (self .maven_repo_url , self .maven_repo_user , self .maven_repo_pass ,
293
295
stdZipName , local_path = stdZipDirPath , remote_path = stdZipDir , logger = self .logger )
294
296
while tries < self .upload_retry_count and not success :
@@ -313,6 +315,7 @@ def doMavenPush(self, isSnapshot, now):
313
315
if success :
314
316
self .sendPrimChanOpNotice (success )
315
317
tries = 0
318
+ self .logger .info ('Pushing ' + nodocZipName )
316
319
success = MavenHandler .upload (self .maven_repo_url , self .maven_repo_user , self .maven_repo_pass ,
317
320
nodocZipName , local_path = nodocZipDirPath , remote_path = nodocZipDir , logger = self .logger )
318
321
while tries < self .upload_retry_count and not success :
@@ -333,6 +336,28 @@ def doMavenPush(self, isSnapshot, now):
333
336
self .sendPrimChanOpNotice (success )
334
337
self .sendPrimChanMessage ('Semi-live (every %d min), Snapshot (daily ~%s EST), and Stable (committed) MCPBot mapping exports can be found here: %s' % (self .test_export_period , self .maven_upload_time_str , self .test_export_url ))
335
338
339
+ # push json file to maven
340
+ if success and JsonHelper .save_remote_json_to_path (self .exports_json_url , os .path .join (self .base_export_path , 'versions.json' )):
341
+ tries = 0
342
+ self .logger .info ('Pushing versions.json' )
343
+ success = MavenHandler .upload (self .maven_repo_url , self .maven_repo_user , self .maven_repo_pass ,
344
+ 'versions.json' , local_path = self .base_export_path , remote_path = '' , logger = self .logger )
345
+ while tries < self .upload_retry_count and not success :
346
+ tries += 1
347
+ self .logger .warning ('*** Upload attempt failed. Trying again in 3 minutes. ***' )
348
+ time .sleep (180 )
349
+ success = MavenHandler .upload (self .maven_repo_url , self .maven_repo_user , self .maven_repo_pass ,
350
+ 'versions.json' , local_path = self .base_export_path , remote_path = '' , logger = self .logger )
351
+
352
+ if success and tries == 0 :
353
+ self .logger .info ('Maven upload successful.' )
354
+ elif success and tries > 0 :
355
+ self .logger .info ('Maven upload successful after %d %s.' % (tries , 'retry' if tries == 1 else 'retries' ))
356
+ else :
357
+ self .logger .error ('*** Maven upload failed after %d retries. ***' % tries )
358
+ elif success :
359
+ self .logger .error ('*** Remote JSON was not successfully retrieved. ***' )
360
+
336
361
337
362
# def sqlRequest(self, bot, sender, dest, cmd, args):
338
363
# sql = ' '.join(args)
@@ -380,7 +405,7 @@ def getLatestMappingVersion(self, bot, sender, dest, cmd, args):
380
405
elif args [1 ].lower () in ['stable' , 'snapshot' ]:
381
406
mappingType = args [1 ].lower ()
382
407
383
- jsonUrl = self .exports_json_url
408
+ jsonUrl = self .exports_json_url + '?limit=1'
384
409
385
410
# if not version:
386
411
# val, status = self.db.getVersions(1)
0 commit comments