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