2 import zeroinstall
, sys
, os
, shutil
, time
3 from zeroinstall
.injector
import iface_cache
, model
5 trunk_url
= 'https://zero-install.svn.sourceforge.net/svnroot/zero-install/trunk/0launch'
6 releases_url
= 'https://zero-install.svn.sourceforge.net/svnroot/zero-install/releases/0launch'
8 publish_url
= 'http://0install.net/2006/interfaces/0publish'
11 if os
.spawnlp(os
.P_WAIT
, prog
, prog
, *args
):
12 raise Exception('Command failed: %s %s' % (prog
, ' '.join(args
)))
14 for line
in os
.popen('dpkg-parsechangelog'):
15 if line
.startswith('Version: '):
16 deb_version
= line
.split(' ', 1)[1].strip()
19 raise Exception('Failed to get deb version!')
21 gui_iface_path
= 'zeroinstall/0launch-gui/ZeroInstall-GUI.xml'
22 gui_iface
= iface_cache
.iface_cache
.get_interface(os
.path
.abspath(gui_iface_path
))
23 assert len(gui_iface
.implementations
) == 1
24 gui_impl
= gui_iface
.implementations
.values()[0]
25 if gui_impl
.upstream_stability
== model
.testing
:
26 run('0launch', publish_url
, '--stable', gui_iface_path
)
27 run('0launch', publish_url
, '--set-released', time
.strftime('%Y-%m-%d'), gui_iface_path
)
29 os
.system('svn status')
31 print "\nDebian version: " + deb_version
+ " (hint: debchange -i)"
33 if gui_impl
.get_version() != zeroinstall
.version
:
34 print "GUI feed's version is '%s'; should be '%s'" % (gui_impl
.get_version(), zeroinstall
.version
)
37 sys
.path
.insert(0, './zeroinstall/0launch-gui')
39 if gui
.version
!= zeroinstall
.version
:
40 print "GUI version is %s; should be %s" % (gui
.version
, zeroinstall
.version
)
44 name
= 'injector-' + zeroinstall
.version
45 package_name
= 'zeroinstall-' + name
46 a
= raw_input("Release " + name
+ "? [y/N]")
47 if not a
or a
not in 'Yy':
50 for v
in ['2.3', '2.4', '2.5']:
51 if os
.system('cd tests && python%s ./testall.py' % v
):
52 print "ERROR: Unit test failure with Python %s. Stop" % v
55 print "Checking for existing release..."
56 if os
.system('svn ls ' + releases_url
+ '/' + name
+ ' >/dev/null') == 0:
57 print "WARNING: releases/" + name
+ " already exists"
58 a
= raw_input("Overwrite " + name
+ "? [y/N]")
59 if not a
or a
not in 'Yy':
61 os
.system('svn rm ' + releases_url
+ '/' + name
+ ' -m overwrite')
66 if os
.system('svn cp -m "Released ' + name
+ '" ' +
67 trunk_url
+ ' ' + releases_url
+ '/' + name
):
68 print "Failed to make release"
71 if os
.path
.isdir(package_name
):
72 shutil
.rmtree(package_name
)
73 os
.system('svn export ' + releases_url
+ '/' + name
+ ' ' + package_name
)
75 os
.chdir(package_name
)
76 os
.system('python setup.py sdist')
78 tarball
= package_name
+ '/dist/' + package_name
+ '.tar.gz'
79 print "Tarball is", tarball
80 print "To build .deb: ./makedeb", tarball