We have the following requirements:
- ant 1.6.5+
- subversion
- python 2.5+
- a running version of confluence
The first step is to checkout some files from the corresponding tag from the jboss public repository
mkdir ~/temp
cd ~/temp
svn co http://anonsvn.jboss.org/repos/jbossas/tags/JBPAPP_4_3_0_GA/build
svn co http://anonsvn.jboss.org/repos/jbossas/tags/JBPAPP_4_3_0_GA/tools
svn co http://anonsvn.jboss.org/repos/jbossas/tags/JBPAPP_4_3_0_GA/thirdparty
cd ~/temp
svn co http://anonsvn.jboss.org/repos/jbossas/tags/JBPAPP_4_3_0_GA/build
svn co http://anonsvn.jboss.org/repos/jbossas/tags/JBPAPP_4_3_0_GA/tools
svn co http://anonsvn.jboss.org/repos/jbossas/tags/JBPAPP_4_3_0_GA/thirdparty
The second step is to run the corresponding ant build to generate the components info files
cd ~/temp/build
ant -f build-thirdparty.xml
ant -f build-thirdparty.xml
Download this script and replace CHANGEME with the path to the correct location.
import os import urllib2 import re from BeautifulSoup import BeautifulSoup basedir = '/CHANGEME/temp/thirdparty' # this is the directory that needs to be changed infofile = 'component-info.xml' ts = '|' header = '||Component||Library||Version||Description||Comment||' print header for dir in sorted(os.listdir(basedir)): if dir == '': print 'The directory structure is not adequate' break filepath = ''.join([basedir, '/', dir, '/', infofile]) if os.path.exists(filepath): filepath = ''.join(['file://',filepath]) file = urllib2.urlopen(filepath) else: continue xml = file.read() soup = BeautifulSoup(xml) for attr, value in soup.find('component').attrs: if attr == 'id': c_attr = value elif attr == 'description': d_attr = str(value).replace('\n', '').replace(' ', '') elif attr == 'version': v_attr = value else: continue artifacts = soup.findAll('artifact') for line in artifacts: ids = re.split('"', str(line)) print ts + c_attr + ts + ids[1] + ts + v_attr + ts + d_attr + ts + " " + ts
And finally run the script
python /path/to/the/script/jbjarversion.py > list
In 'list' you have the list formatted to be a confluence table.
No comments:
Post a Comment