3
# Copyright 2009, 2010 Canonical Ltd. This software is licensed under the
4
# GNU Affero General Public License version 3 (see the file LICENSE).
6
"""Upgrade a launchpad-buildd configuration file."""
12
(old_version, conf_file) = sys.argv[1:]
15
print "Upgrading %s to version 12" % conf_file
16
subprocess.call(["mv", conf_file, conf_file+"-prev12~"])
17
in_file = open(conf_file+"-prev12~", "r")
18
out_file = open(conf_file, "w")
20
if line.startswith("[debianmanager]"):
21
line += "ogrepath = /usr/share/launchpad-buildd/slavebin/apply-ogre-model\n"
22
if line.startswith("sbuildargs"):
23
line = line.replace("-A", "")
29
print "Upgrading %s to version 34" % conf_file
30
subprocess.call(["mv", conf_file, conf_file+"-prev34~"])
31
in_file = open(conf_file+"-prev34~", "r")
32
out_file = open(conf_file, "w")
34
if line.startswith("[debianmanager]"):
35
line += "sourcespath = /usr/share/launchpad-buildd/slavebin/override-sources-list\n"
41
print "Upgrading %s to version 39" % conf_file
42
subprocess.call(["mv", conf_file, conf_file+"-prev39~"])
43
in_file = open(conf_file+"-prev39~", "r")
44
out_file = open(conf_file, "w")
46
if line.startswith("sbuildargs"):
47
line = line.replace("-dautobuild ","")
48
if line.startswith("[slave]"):
49
line += "ntphost = ntp.buildd\n"
55
print "Upgrading %s to version 57" % conf_file
56
subprocess.call(["mv", conf_file, conf_file+"-prev57~"])
57
in_file = open(conf_file+"-prev57~", "r")
58
out_file = open(conf_file, "w")
59
# We want to move all the sbuild lines to a new
60
# 'binarypackagemanager' section at the end.
61
binarypackage_lines = []
63
if line.startswith("sbuild"):
64
binarypackage_lines.append(line)
67
out_file.write('[binarypackagemanager]\n')
68
for line in binarypackage_lines:
74
print "Upgrading %s to version 58" % conf_file
75
subprocess.call(["mv", conf_file, conf_file+"-prev58~"])
76
in_file = open(conf_file+"-prev58~", "r")
77
out_file = open(conf_file, "w")
78
out_file.write(in_file.read())
80
'\n[sourcepackagerecipemanager]\n'
81
'buildrecipepath = /usr/share/launchpad-buildd'
82
'/slavebin/buildrecipe\n')
85
print "Upgrading %s to version 59" % conf_file
86
subprocess.call(["mv", conf_file, conf_file+"-prev59~"])
87
in_file = open(conf_file+"-prev59~", "r")
88
out_file = open(conf_file, "w")
89
out_file.write(in_file.read())
91
'\n[translationtemplatesmanager]\n'
92
'generatepath = /usr/share/launchpad-buildd/slavebin/generate-translation-templates\n'
93
'resultarchive = translation-templates.tar.gz\n')
96
print "Upgrading %s to version 63" % conf_file
97
subprocess.call(["mv", conf_file, conf_file+"-prev63~"])
98
in_file = open(conf_file+"-prev63~", "r")
99
out_file = open(conf_file, "w")
101
if not line.startswith('ogrepath'):
105
if __name__ == "__main__":
106
if old_version.find("~") > 0:
107
old_version = old_version[:old_version.find("~")]
108
if int(old_version) < 12:
110
if int(old_version) < 34:
112
if int(old_version) < 39:
114
if int(old_version) < 57:
116
if int(old_version) < 58:
118
if int(old_version) < 59:
120
if int(old_version) < 63: