1
1
#!/usr/bin/env python
2
from __future__ import with_statement
2
import imp, os, shutil, subprocess, tempfile
9
4
from fabric.api import env, run, local, cd
10
5
from fabric.operations import put
17
VERSION='%d.%d.%d' % (MAJOR_VERSION, MINOR_VERSION, REVISION_VERSION)
19
VERSION='%s-%s' % (VERSION, BUILD_VERSION,)
21
SDIST_DIR = os.path.realpath('packaging')
22
if not os.path.exists(SDIST_DIR):
23
print "The packaging directory doesn't exist - create it or change the directory in the fabfile"
25
TARBALL_PATTERN = 'openerp-*-%s.tar.gz' % VERSION
26
EXE_WIN32_PATTERN = 'openerp-*-setup-%s.exe' % VERSION
27
WORKING_DIRECTORY = os.getcwd()
7
# This should be updated every release
10
VERSION_FULL='%s.0-rc2'%VERSION_MAJOR
12
WINDOWS_IP='172.16.225.128'
14
# This should not be updated
30
17
('openobject-server', 'server', os.path.join('bin', 'release.py'), 'server_release.py.mako'),
32
19
('openobject-web', 'web', os.path.join('openobject', 'release.py'), 'web_release.py.mako'),
36
DOWNLOAD_DIRECTORY = os.path.join('/', 'var', 'www', 'www.openerp.com', 'www', 'download')
37
REMOTE_DIRECTORY = os.path.join(DOWNLOAD_DIRECTORY, 'unstable')
38
SOURCE_DIRECTORY = os.path.join(REMOTE_DIRECTORY, 'source')
39
WIN32_DIRECTORY = os.path.join(REMOTE_DIRECTORY, 'win32')
22
DIR_DIST = os.path.realpath('packaging')
23
if not os.path.exists(DIR_DIST):
26
GLOB_TARBALL = 'openerp-*-%s.tar.gz' % VERSION_FULL
27
GLOB_WIN32 = 'openerp-*-setup-%s.exe' % VERSION_FULL
29
DIR_WEBSITE = os.path.join('/', 'var', 'www', 'www.openerp.com', 'www', 'download')
30
DIR_SOURCE = os.path.join(DIR_WEBSITE, 'unstable', 'source')
31
DIR_WIN32 = os.path.join(DIR_WEBSITE, 'unstable', 'win32')
41
33
env.hosts = ['root@openerp.com']
45
Make the version defined in this file and the release.py files
47
print "CURRENT: %r" % (VERSION)
48
for project, project_directory, release_file, _ in PROJECTS:
49
release = imp.load_source(release_file, os.path.join(project_directory, release_file))
50
print "project: %r -- %r" % (project, release.version)
54
37
Make bzr pull on each branch
64
47
bzr pull -d client;
65
48
bzr pull -d server;
67
rsync --exclude .bzr/ -av addons/ server/bin/addons/
50
#rsync --exclude .bzr/ -av addons/ server/bin/addons/
69
52
for i in cmd.split('\n'):
77
from subprocess import Popen, call
78
for project in PROJECTS:
79
project_name = project[0]
80
project_directory = project[1]
82
directory = os.path.abspath(project_directory)
83
print "project: %s - %s" % (project_name, directory,)
84
Popen(['python', os.path.join(directory, 'setup.py'), 'sdist', '-d', os.path.abspath(SDIST_DIR)],
85
cwd=directory).communicate()
89
Upload the tarballs (source)
91
run('mkdir %s -p' % SOURCE_DIRECTORY)
92
put(os.path.join(SDIST_DIR, TARBALL_PATTERN), SOURCE_DIRECTORY)
96
Upload the Windows Installers
98
run('mkdir %s -p' % WIN32_DIRECTORY)
99
put(os.path.join(SDIST_DIR, EXE_WIN32_PATTERN), WIN32_DIRECTORY)
101
def update_local_current():
103
Update the local CURRENT file with the new version
105
local('echo %s > %s' % (VERSION, os.path.join(SDIST_DIR, 'CURRENT')))
107
56
def update_release_files():
109
58
Update the release files
116
65
template = MakoTemplate(filename=template_file)
117
66
file_pointer = open(release_file, 'w')
118
67
file_pointer.write(
119
template.render(VERSION=VERSION,
120
MAJOR_VERSION='%d.%d' % (MAJOR_VERSION, MINOR_VERSION)
68
template.render(VERSION_FULL=VERSION_FULL, VERSION_MAJOR)
123
70
file_pointer.close()
124
71
print "release_file: %r" % release_file
77
for project in PROJECTS:
78
directory = os.path.abspath(project[1])
79
cmd=['python', os.path.join(directory, 'setup.py'), 'sdist', '-d', os.path.abspath(DIR_DIST)]
81
subprocess.Popen(cmd, cwd=directory).communicate()
126
83
def update_current():
128
Update the CURRENT file with the new version
130
run('echo %s > %s' % (VERSION, os.path.join(DOWNLOAD_DIRECTORY, 'CURRENT')))
131
run('chown www-data:www-data %s -R' % DOWNLOAD_DIRECTORY)
85
Update the local CURRENT file with the new version
87
local('echo %s > %s' % (VERSION_FULL, os.path.join(DIR_DIST, 'CURRENT')))
91
Upload the tarballs (source)
93
run('mkdir %s -p' % DIR_SOURCE)
94
put(os.path.join(DIR_DIST, GLOB_TARBALL), DIR_SOURCE)
98
Upload the Windows Installers
100
run('mkdir %s -p' % DIR_WIN32)
101
put(os.path.join(DIR_DIST, GLOB_WIN32), DIR_WIN32)
135
105
Upload the Windows Installer and the tarballs
141
111
def update_planets():