Cleanup some debug in the script, and fix version number for the current build.

This commit is contained in:
LexManos 2012-10-28 23:42:41 -07:00
parent d7adac4508
commit 64354382d4
2 changed files with 7 additions and 38 deletions

View file

@ -44,40 +44,10 @@ def getBuildInfo(url):
item['author'] = item['author']['fullName']
build.pop('changeSet')
build.pop('actions')
#pprint(data)
return data
def main():
target_build = 0
job_path = None
change_file = None
if len(sys.argv) > 3:
try:
target_build = int(sys.argv[1])
job_path = sys.argv[2]
change_file = sys.argv[3]
except:
pass
else:
target_build = 10000
job_path = "http://jenkins.minecraftforge.net/job/forge/"
change_file = "changes.txt"
p = re.compile('\w+-(?P<type>\w+)-(?P<version>[\d]+.[\d]+.[\d]+.(?P<build>[\d]+)).zip')
builds = {}
for filename in os.listdir('D:\\tmp'):
m = p.search(filename)
if not m is None:
builds[m.group('build')] = m.group('version')
#pprint(builds)
for key in sorted(builds.iterkeys(), key=lambda key: int(key)):
print '%s %s' % (key, builds[key])
make_changelog(job_path, int(key), 'd:\\tmp\minecraftforge-changelog-%s.txt' % builds[key])
def make_changelog(job_path, target_build, change_file):
def make_changelog(job_path, target_build, change_file, current_version=None):
builds = getBuildInfo('%s/api/python?tree=builds[number,actions[text],changeSet[items[author[fullName],comment]]]&pretty=true' % job_path)
#pprint(builds)
log = [ "Changelog:" ]
@ -86,7 +56,10 @@ def make_changelog(job_path, target_build, change_file):
if len(build['items']) == 0: continue
log.append('')
if build['version'] is None:
log.append('Build %s' % build['number'])
if current_version is None:
log.append('Build %s' % build['number'])
else:
log.append('Build %s' % current_version)
else:
log.append('Build %s' % build['version'])
for change in build['items']:
@ -98,11 +71,7 @@ def make_changelog(job_path, target_build, change_file):
elif len(comments) == 1:
log.append('\t%s: %s' % (change['author'], comments[0]))
#print '\n'.join(log)
file = open(change_file, 'wb')
for line in log:
file.write('%s\n' % line)
file.close()
if __name__ == '__main__':
main()
file.close()

View file

@ -57,7 +57,7 @@ def main():
os.makedirs(out_folder)
changelog_file = 'forge-%s/minecraftforge-changelog-%s.txt' % (version_str, version_str)
make_changelog("http://jenkins.minecraftforge.net/job/forge/", build_num, changelog_file)
make_changelog("http://jenkins.minecraftforge.net/job/forge/", build_num, changelog_file, version_str)
version_file = 'forgeversion.properties'
if os.path.exists(version_file):