Skip to content

Commit

Permalink
Builder: Generate build commits for XML feed
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Dec 15, 2011
1 parent 40985b2 commit 43d23df
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
2 changes: 2 additions & 0 deletions distrib/autobuild.py
Expand Up @@ -97,9 +97,11 @@ def update_changes(fromTag=None, toTag=None, debChanges=False):
changes = builder.Changes(fromTag, toTag)

if debChanges:
# Only update the Debian changelog.
changes.generate('deb')
else:
changes.generate('html')
changes.generate('xml')


def update_debian_changelog():
Expand Down
23 changes: 23 additions & 0 deletions distrib/builder/changes.py
Expand Up @@ -11,6 +11,7 @@ def __init__(self):
self.author = ''
self.date = ''
self.link = ''
self.hash = ''
self.message = ''

def setSubject(self, subject):
Expand Down Expand Up @@ -47,6 +48,7 @@ def parse(self):
'[[Date]]%ai[[/Date]]' + \
'[[Link]]http://deng.git.sourceforge.net/git/gitweb.cgi?' + \
'p=deng/deng;a=commit;h=%H[[/Link]]' + \
'[[Hash]]%H[[/Hash]]' + \
'[[Message]]%b[[/Message]]'
os.system("git log %s..%s --format=\"%s\" >> %s" % (self.fromTag, self.toTag, format, tmpName))

Expand Down Expand Up @@ -92,6 +94,11 @@ def parse(self):
end = logText.find('[[/Link]]', pos)
entry.link = logText[pos+8:end]

# Hash.
pos = logText.find('[[Hash]]', pos)
end = logText.find('[[/Hash]]', pos)
entry.hash = logText[pos+8:end]

# Message.
pos = logText.find('[[Message]]', pos)
end = logText.find('[[/Message]]', pos)
Expand All @@ -118,6 +125,22 @@ def generate(self, format):
print >> out, '</ol>'
out.close()

elif format == 'xml':
out = file(Event(toTag).filePath('changes.xml'), 'wt')
print >> out, '<commitCount>%i</commitCount>' % len(self.entries)
print >> out, '<commits>'
for entry in self.entries:
print >> out, '<commit>'
print >> out, '<submitDate>%s</submitDate>' % entry.date
print >> out, '<author>%s</author>' % entry.author
print >> out, '<repositoryUrl>%s</repositoryUrl>' % entry.link
print >> out, '<sha1>%s</sha1>' % entry.hash
print >> out, '<title>%s</title>' % entry.subject
print >> out, '<message>%s</message>' % entry.message
print >> out, '</commit>'
print >> out, '</commits>'
out.close()

elif format == 'deb':
# Append the changes to the debian package changelog.
os.chdir(os.path.join(config.DISTRIB_DIR, 'linux'))
Expand Down

0 comments on commit 43d23df

Please sign in to comment.