Updated test for new GNU Hello
[0compile.git] / bugs.py
blob209ed6ef88b574c2920a1531b47e4e52277f8680
1 # Copyright (C) 2006, Thomas Leonard
2 # See http://0install.net/0compile.html
4 import sys, os, __main__
5 from logging import info
7 from support import *
9 def do_report_bug(args):
10 """report-bug"""
11 buildenv = BuildEnv()
13 log_name = 'build/build-failure.log'
14 build_log = file(log_name)
15 log_text = build_log.read()
16 build_log.close()
18 build_env_xml_file = join(buildenv.metadir, 'build-environment.xml')
19 if os.path.exists(build_env_xml_file):
20 build_env_xml = file(build_env_xml_file)
21 log_text += '\n\nSelected versions:\n' + build_env_xml.read()
22 build_env_xml.close()
23 else:
24 log_text += '\n\n"%s" file not found' % build_env_xml_file
26 import urllib
27 from urllib2 import urlopen
29 print "Sending contents of %s file to default bug tracker..." % log_name
31 stream = urlopen('http://sourceforge.net/tracker/index.php',
32 urllib.urlencode({
33 'group_id': '76468',
34 'atid': '905152',
35 'func': 'postadd',
36 'is_private': '0',
37 'summary': log_text.split('\n', 1)[0], # First line of log
38 'details': log_text}))
39 stream.read()
40 stream.close()
42 __main__.commands.append(do_report_bug)